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

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 namespace Common {
00034 struct Event;
00035 }
00036 
00037 namespace GUI {
00038 
00039 class EventRecorder;
00040 
00041 class Widget;
00042 
00043 // Some "common" commands sent to handleCommand()
00044 enum {
00045     kCloseCmd  = 'clos',
00046     kOKCmd     = 'ok  '
00047 };
00048 
00049 class Dialog : public GuiObject {
00050     friend class GuiManager;
00051     friend class EventRecorder;
00052     friend class Tooltip;
00053 protected:
00054     Widget  *_mouseWidget;
00055     Widget  *_focusedWidget;
00056     Widget  *_dragWidget;
00057     Widget  *_tickleWidget;
00058     bool    _visible;
00059 
00060     ThemeEngine::DialogBackground _backgroundType;
00061 
00062 private:
00063     int     _result;
00064 
00065 public:
00066     Dialog(int x, int y, int w, int h);
00067     Dialog(const Common::String &name);
00068 
00069     virtual int runModal();
00070 
00071     bool    isVisible() const   { return _visible; }
00072 
00073     void    releaseFocus();
00074     void    setFocusWidget(Widget *widget);
00075     Widget *getFocusWidget() { return _focusedWidget; }
00076 
00077     void setTickleWidget(Widget *widget) { _tickleWidget = widget; }
00078     void unSetTickleWidget() { _tickleWidget = NULL; }
00079     Widget *getTickleWidget() { return _tickleWidget; }
00080 
00081     virtual void reflowLayout();
00082     virtual void lostFocus();
00083     virtual void receivedFocus(int x = -1, int y = -1) { if (x >= 0 && y >= 0) handleMouseMoved(x, y, 0); }
00084 
00085 protected:
00086     virtual void open();
00087     virtual void close();
00088 
00090     void markWidgetsAsDirty();
00091 
00093     virtual void drawDialog(DrawLayer layerToDraw);
00094 
00096     void drawWidgets();
00097 
00098     virtual void handleTickle(); // Called periodically (in every guiloop() )
00099     virtual void handleMouseDown(int x, int y, int button, int clickCount);
00100     virtual void handleMouseUp(int x, int y, int button, int clickCount);
00101     virtual void handleMouseWheel(int x, int y, int direction);
00102     virtual void handleKeyDown(Common::KeyState state);
00103     virtual void handleKeyUp(Common::KeyState state);
00104     virtual void handleMouseMoved(int x, int y, int button);
00105     virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
00106     virtual void handleOtherEvent(Common::Event evt);
00107 
00108     Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
00109     Widget *findWidget(const char *name);
00110     void removeWidget(Widget *widget);
00111 
00112     void setDefaultFocusedWidget();
00113 
00114     void setResult(int result) { _result = result; }
00115     int getResult() const { return _result; }
00116 };
00117 
00118 } // End of namespace GUI
00119 
00120 #endif


Generated on Sat Sep 14 2019 05:01:22 for ResidualVM by doxygen 1.7.1
curved edge   curved edge