Remove ancient trunk folder from svn repository
[synfig.git] / synfig-studio / src / synfigapp / uimanager.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file uimanager.h
3 **      \brief User Interface Manager Class
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_APP_UIMANAGER_H
26 #define __SYNFIG_APP_UIMANAGER_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <ETL/handle>
31 #include <synfig/general.h>
32 #include <synfig/string.h>
33 #include <sigc++/object.h>
34
35 /* === M A C R O S ========================================================= */
36
37 /* === T Y P E D E F S ===================================================== */
38
39 /* === C L A S S E S & S T R U C T S ======================================= */
40
41 namespace synfigapp {
42
43 class UIInterface : public etl::shared_object, public synfig::ProgressCallback, public sigc::trackable
44 {
45 public:
46         enum Response
47         {
48                 RESPONSE_CANCEL=-1,
49                 RESPONSE_NO=0,
50                 RESPONSE_YES=1,
51                 RESPONSE_OK=2
52         };
53         virtual ~UIInterface() { }
54         virtual Response confirmation(const std::string &title, const std::string &primaryText,
55                                         const std::string &secondaryText, const std::string &confirmPhrase,
56                                         const std::string &cancelPhrase, Response dflt=RESPONSE_OK)=0;
57         virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
58         virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
59         virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK)=0;
60 };
61
62 class DefaultUIInterface : public UIInterface
63 {
64 public:
65         Response confirmation(const std::string &/*title*/, const std::string &/*primaryText*/,
66                                 const std::string &/*secondaryText*/, const std::string &/*confirmPhrase*/,
67                                 const std::string &/*cancelPhrase*/, Response dflt)
68                 { return dflt; }
69         Response yes_no(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
70                 { return dflt; }
71         Response yes_no_cancel(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
72                 { return dflt; }
73         Response ok_cancel(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
74                 { return dflt; }
75
76         bool task(const std::string &/*task*/)
77                 { return true; }
78         bool error(const std::string &/*task*/)
79                 { return true; }
80         bool warning(const std::string &/*task*/)
81                 { return true; }
82         bool amount_complete(int /*current*/, int /*total*/)
83                 { return true; }
84 };
85
86 class ConfidentUIInterface : public UIInterface
87 {
88 public:
89         Response confirmation(const std::string &/*title*/, const std::string &/*primaryText*/,
90                                 const std::string &/*secondaryText*/, const std::string &/*confirmPhrase*/,
91                                 const std::string &/*cancelPhrase*/, Response /*dflt*/)
92                 { return RESPONSE_OK; }
93         Response yes_no(const std::string &/*title*/, const std::string &/*message*/,Response /*dflt*/)
94                 { return RESPONSE_YES; }
95         Response yes_no_cancel(const std::string &/*title*/, const std::string &/*message*/,Response /*dflt*/)
96                 { return RESPONSE_YES; }
97         Response ok_cancel(const std::string &/*title*/, const std::string &/*message*/,Response /*dflt*/)
98                 { return RESPONSE_OK; }
99
100         bool task(const std::string &/*task*/)
101                 { return true; }
102         bool error(const std::string &/*task*/)
103                 { return true; }
104         bool warning(const std::string &/*task*/)
105                 { return true; }
106         bool amount_complete(int /*current*/, int /*total*/)
107                 { return true; }
108 };
109
110 class ConsoleUIInterface : public UIInterface
111 {
112 public:
113         Response confirmation(const std::string &title, const std::string &primaryText,
114                                 const std::string &secondaryText, const std::string &confirmPhrase,
115                                 const std::string &cancelPhrase, Response dflt);
116         Response yes_no(const std::string &title, const std::string &message,Response dflt);
117         Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt);
118         Response ok_cancel(const std::string &title, const std::string &message,Response dflt);
119
120         bool task(const std::string &task);
121         bool error(const std::string &task);
122         bool warning(const std::string &task);
123         bool amount_complete(int current, int total);
124 };
125
126 }; // END of namespace synfigapp
127
128 /* === E N D =============================================================== */
129
130 #endif