my log
[synfig.git] / synfig-studio / trunk / src / synfigapp / uimanager.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file uimanager.h
3 **      \brief User Interface Manager Class
4 **
5 **      $Id: uimanager.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_APP_UIMANAGER_H
25 #define __SYNFIG_APP_UIMANAGER_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <ETL/handle>
30 #include <synfig/general.h>
31 #include <synfig/string.h>
32 #include <sigc++/object.h>
33
34 /* === M A C R O S ========================================================= */
35
36 /* === T Y P E D E F S ===================================================== */
37
38 /* === C L A S S E S & S T R U C T S ======================================= */
39
40 namespace synfigapp {
41
42 class UIInterface : public etl::shared_object, public synfig::ProgressCallback, public sigc::trackable
43 {
44 public:
45         enum Response
46         {
47                 RESPONSE_CANCEL=-1,
48                 RESPONSE_NO=0,
49                 RESPONSE_YES=1,
50                 RESPONSE_OK=2
51         };
52         virtual ~UIInterface() { }
53         virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
54         virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
55         virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK)=0;
56 };      
57
58 class DefaultUIInterface : public UIInterface
59 {
60 public:
61         Response yes_no(const std::string &title, const std::string &message,Response dflt)
62                 { return dflt; }
63         Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt)
64                 { return dflt; }
65         Response ok_cancel(const std::string &title, const std::string &message,Response dflt)
66                 { return dflt; }
67         
68         bool task(const std::string &task)
69                 { return true; }
70         bool error(const std::string &task)
71                 { return true; }
72         bool warning(const std::string &task)
73                 { return true; }
74         bool amount_complete(int current, int total)
75                 { return true; }
76 };      
77
78 class ConfidentUIInterface : public UIInterface
79 {
80 public:
81         Response yes_no(const std::string &title, const std::string &message,Response dflt)
82                 { return RESPONSE_YES; }
83         Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt)
84                 { return RESPONSE_YES; }
85         Response ok_cancel(const std::string &title, const std::string &message,Response dflt)
86                 { return RESPONSE_OK; }
87         
88         bool task(const std::string &task)
89                 { return true; }
90         bool error(const std::string &task)
91                 { return true; }
92         bool warning(const std::string &task)
93                 { return true; }
94         bool amount_complete(int current, int total)
95                 { return true; }
96 };      
97
98 class ConsoleUIInterface : public UIInterface
99 {
100 public:
101         Response yes_no(const std::string &title, const std::string &message,Response dflt);
102         Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt);
103         Response ok_cancel(const std::string &title, const std::string &message,Response dflt);
104         
105         bool task(const std::string &task);
106         bool error(const std::string &task);
107         bool warning(const std::string &task);
108         bool amount_complete(int current, int total);
109 };      
110
111 }; // END of namespace synfigapp
112
113 /* === E N D =============================================================== */
114
115 #endif