ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

gui/dialog.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GUI_DIALOG_H
00024 #define GUI_DIALOG_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/str.h"
00028 #include "common/keyboard.h"
00029 
00030 #include "gui/object.h"
00031 #include "gui/ThemeEngine.h"
00032 
00033 #ifdef ENABLE_KEYMAPPER
00034 namespace Common {
00035 struct Event;
00036 }
00037 #endif
00038 
00039 namespace GUI {
00040 
00041 class EventRecorder;
00042 
00043 class Widget;
00044 
00045 // Some "common" commands sent to handleCommand()
00046 enum {
00047     kCloseCmd  = 'clos',
00048     kOKCmd     = 'ok  '
00049 };
00050 
00051 class Dialog : public GuiObject {
00052     friend class GuiManager;
00053     friend class EventRecorder;
00054     friend class Tooltip;
00055 protected:
00056     Widget  *_mouseWidget;
00057     Widget  *_focusedWidget;
00058     Widget  *_dragWidget;
00059     Widget  *_tickleWidget;
00060     bool    _visible;
00061 
00062     ThemeEngine::DialogBackground _backgroundType;
00063 
00064 private:
00065     int     _result;
00066 
00067 public:
00068     Dialog(int x, int y, int w, int h);
00069     Dialog(const Common::String &name);
00070 
00071     virtual int runModal();
00072 
00073     bool    isVisible() const   { return _visible; }
00074 
00075     void    releaseFocus();
00076     void    setFocusWidget(Widget *widget);
00077     Widget *getFocusWidget() { return _focusedWidget; }
00078 
00079     void setTickleWidget(Widget *widget) { _tickleWidget = widget; }
00080     void unSetTickleWidget() { _tickleWidget = NULL; }
00081     Widget *getTickleWidget() { return _tickleWidget; }
00082 
00083     virtual void reflowLayout();
00084     virtual void lostFocus();
00085     virtual void receivedFocus(int x = -1, int y = -1) { if (x >= 0 && y >= 0) handleMouseMoved(x, y, 0); }
00086 
00087 protected:
00088     virtual void open();
00089     virtual void close();
00090 
00092     void markWidgetsAsDirty();
00093 
00095     virtual void drawDialog(DrawLayer layerToDraw);
00096 
00098     void drawWidgets();
00099 
00100     virtual void handleTickle(); // Called periodically (in every guiloop() )
00101     virtual void handleMouseDown(int x, int y, int button, int clickCount);
00102     virtual void handleMouseUp(int x, int y, int button, int clickCount);
00103     virtual void handleMouseWheel(int x, int y, int direction);
00104     virtual void handleKeyDown(Common::KeyState state);
00105     virtual void handleKeyUp(Common::KeyState state);
00106     virtual void handleMouseMoved(int x, int y, int button);
00107     virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
00108 #ifdef ENABLE_KEYMAPPER
00109     virtual void handleOtherEvent(Common::Event evt);
00110 #endif
00111 
00112     Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
00113     Widget *findWidget(const char *name);
00114     void removeWidget(Widget *widget);
00115 
00116     void setDefaultFocusedWidget();
00117 
00118     void setResult(int result) { _result = result; }
00119     int getResult() const { return _result; }
00120 };
00121 
00122 } // End of namespace GUI
00123 
00124 #endif


Generated on Sat Mar 16 2019 05:01:24 for ResidualVM by doxygen 1.7.1
curved edge   curved edge