1 /* === S Y N F I G ========================================================= */
3 ** \brief User Interface Manager Class
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_APP_UIMANAGER_H
26 #define __SYNFIG_APP_UIMANAGER_H
28 /* === H E A D E R S ======================================================= */
31 #include <synfig/general.h>
32 #include <synfig/string.h>
33 #include <sigc++/object.h>
35 /* === M A C R O S ========================================================= */
37 /* === T Y P E D E F S ===================================================== */
39 /* === C L A S S E S & S T R U C T S ======================================= */
43 class UIInterface : public etl::shared_object, public synfig::ProgressCallback, public sigc::trackable
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;
62 class DefaultUIInterface : public UIInterface
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)
69 Response yes_no(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
71 Response yes_no_cancel(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
73 Response ok_cancel(const std::string &/*title*/, const std::string &/*message*/,Response dflt)
76 bool task(const std::string &/*task*/)
78 bool error(const std::string &/*task*/)
80 bool warning(const std::string &/*task*/)
82 bool amount_complete(int /*current*/, int /*total*/)
86 class ConfidentUIInterface : public UIInterface
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; }
100 bool task(const std::string &/*task*/)
102 bool error(const std::string &/*task*/)
104 bool warning(const std::string &/*task*/)
106 bool amount_complete(int /*current*/, int /*total*/)
110 class ConsoleUIInterface : public UIInterface
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);
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);
126 }; // END of namespace synfigapp
128 /* === E N D =============================================================== */