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
33namespace Common {
34
48public:
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
71protected:
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 being 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
Definition: dialogs.h:47
void endDialog()
Definition: dialogs.h:90
DialogResult
Definition: dialogs.h:52
@ kDialogCancel
User cancelled the dialog (Cancel/No/Close buttons).
Definition: dialogs.h:54
@ kDialogError
Dialog could not be displayed.
Definition: dialogs.h:53
@ kDialogOk
User confirmed the dialog (OK/Yes buttons).
Definition: dialogs.h:55
void beginDialog()
Definition: dialogs.h:77
virtual DialogResult showFileBrowser(const Common::U32String &title, FSNode &choice, bool isDirBrowser=false)
Definition: dialogs.h:69
EventDispatcher * getEventDispatcher()
Definition: events.h:591
Definition: fs.h:69
Definition: ustr.h:57
Common::EventManager * getEventManager()
Definition: system.h:1609
virtual bool getFeatureState(Feature f)
Definition: system.h:667
virtual void setFeatureState(Feature f, bool enable)
Definition: system.h:660
@ kFeatureFullscreenMode
Definition: system.h:420
virtual TransactionError endGFXTransaction()
Definition: system.h:1209
virtual void beginGFXTransaction()
Definition: system.h:1177
OSystem * g_system
Definition: algorithm.h:29