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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef NUVIE_GUI_GUI_DIALOG_H
24 #define NUVIE_GUI_GUI_DIALOG_H
25 
26 
27 
28 #include "ultima/nuvie/gui/widgets/gui_widget.h"
29 #include "ultima/nuvie/screen/screen.h"
30 
31 namespace Ultima {
32 namespace Nuvie {
33 
34 #define GUI_DIALOG_MOVABLE true
35 #define GUI_DIALOG_UNMOVABLE false
36 
37 class GUI_Dialog : public GUI_Widget {
38 
39 	int old_x, old_y;
40 	int button_x, button_y;
41 	uint8 R, G, B;
42 	uint32 bg_color;
43 
44 	bool drag;
45 	Graphics::ManagedSurface *border[8];
46 
47 	unsigned char *backingstore;
48 
49 	Common::Rect backingstore_rect;
50 public:
51 	/* Passed the area, color and shape */
52 	GUI_Dialog(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, bool is_moveable);
53 	~GUI_Dialog() override;
54 	/* Map the color to the display */
55 	void SetDisplay(Screen *s) override;
56 
57 	/* Show the widget  */
58 	void Display(bool full_redraw) override;
59 
60 	/* events, used for dragging the area. */
61 	GUI_status MouseDown(int x, int y, Shared::MouseButton button) override;
62 	GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
63 	GUI_status MouseMotion(int x, int y, uint8 state) override;
64 	void MoveRelative(int dx, int dy) override;
65 protected:
66 	bool can_drag;
67 	void loadBorderImages();
68 };
69 
70 } // End of namespace Nuvie
71 } // End of namespace Ultima
72 
73 #endif
74