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

dialogbox.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
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 STARK_UI_DIALOG_BOX_H
00024 #define STARK_UI_DIALOG_BOX_H
00025 
00026 #include "engines/stark/ui/window.h"
00027 
00028 #include "common/keyboard.h"
00029 #include "common/scummsys.h"
00030 
00031 namespace Stark {
00032 
00033 namespace Gfx {
00034 class SurfaceRenderer;
00035 class Texture;
00036 }
00037 
00038 typedef Common::Functor0<void> ConfirmCallback;
00039 
00040 class VisualText;
00041 
00048 class DialogBox : public Window {
00049 public:
00050     DialogBox(Gfx::Driver *gfx, Cursor *cursor);
00051     ~DialogBox() override;
00052 
00054     void open(const Common::String &message, ConfirmCallback *confirmCallback,
00055               const Common::String &confirmLabel, const Common::String &cancelLabel);
00056 
00058     void close();
00059 
00061     void onScreenChanged();
00062 
00064     void onKeyPress(const Common::KeyState &keyState);
00065 
00066 protected:
00067     void onRender() override;
00068     void onClick(const Common::Point &pos) override;
00069 
00070 private:
00071     static Graphics::Surface *loadBackground();
00072     static void drawBevel(Graphics::Surface *surface, const Common::Rect &rect);
00073     static Common::Rect centerRect(const Common::Rect &container, const Common::Rect &size);
00074 
00075     void freeForeground();
00076     void recomputeLayout();
00077 
00078     Gfx::SurfaceRenderer *_surfaceRenderer;
00079     Gfx::Texture *_backgroundTexture;
00080     Gfx::Texture *_foregroundTexture;
00081 
00082     VisualText *_messageVisual;
00083     VisualText *_confirmLabelVisual;
00084     VisualText *_cancelLabelVisual;
00085 
00086     Common::Rect _confirmButtonRect;
00087     Common::Rect _cancelButtonRect;
00088     Common::Rect _messageRect;
00089 
00090     ConfirmCallback *_confirmCallback;
00091 };
00092 
00093 } // End of namespace Stark
00094 
00095 #endif // STARK_UI_DIALOG_BOX_H


Generated on Sat May 25 2019 05:00:43 for ResidualVM by doxygen 1.7.1
curved edge   curved edge