ScummVM API documentation
dialogs.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef COMMON_DIALOG_MANAGER_H
23 #define COMMON_DIALOG_MANAGER_H
24 
25 #include "common/scummsys.h"
26 
27 #if defined(USE_SYSDIALOGS)
28 
29 #include "common/fs.h"
30 #include "common/system.h"
31 #include "common/events.h"
32 
33 namespace Common {
34 
48 public:
52  enum DialogResult {
53  kDialogError = -1,
55  kDialogOk = 1
56  };
57 
58  DialogManager() : _wasFullscreen(false) {}
59  virtual ~DialogManager() {}
60 
69  virtual DialogResult showFileBrowser(const Common::U32String &title, FSNode &choice, bool isDirBrowser = false) { return kDialogError; }
70 
71 protected:
72  bool _wasFullscreen;
73 
77  void beginDialog() {
78  // If we were in fullscreen mode, switch back
80  if (_wasFullscreen) {
84  }
85  }
86 
90  void endDialog() {
91  // While the native file browser is open, any input events (e.g. keypresses) are
92  // still received by the application. With SDL backend for example this results in the
93  // events beeing queued and processed after we return, thus dispatching events that were
94  // intended for the native file browser. For example: pressing Esc to cancel the native
95  // file browser would cause the application to quit in addition to closing the
96  // file browser. To avoid this happening clear all pending events.
98 
99  // If we were in fullscreen mode, switch back
100  if (_wasFullscreen) {
104  }
105  }
106 };
107 
110 } // End of namespace Common
111 
112 #endif
113 
114 #endif // COMMON_DIALOG_MANAGER_H
virtual DialogResult showFileBrowser(const Common::U32String &title, FSNode &choice, bool isDirBrowser=false)
Definition: dialogs.h:69
virtual TransactionError endGFXTransaction()
Definition: system.h:1169
User confirmed the dialog (OK/Yes buttons).
Definition: dialogs.h:55
EventDispatcher * getEventDispatcher()
Definition: events.h:571
OSystem * g_system
User cancelled the dialog (Cancel/No/Close buttons).
Definition: dialogs.h:54
Definition: ustr.h:57
Definition: algorithm.h:29
Definition: fs.h:69
Definition: system.h:422
Common::EventManager * getEventManager()
Definition: system.h:1550
Definition: dialogs.h:47
Dialog could not be displayed.
Definition: dialogs.h:53
virtual void beginGFXTransaction()
Definition: system.h:1137
DialogResult
Definition: dialogs.h:52
virtual void setFeatureState(Feature f, bool enable)
Definition: system.h:658
void beginDialog()
Definition: dialogs.h:77
void endDialog()
Definition: dialogs.h:90
virtual bool getFeatureState(Feature f)
Definition: system.h:665