]> git.tdb.fi Git - libs/gltk.git/blob - source/dialog.h
Store the Resources reference only in Root widget
[libs/gltk.git] / source / dialog.h
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2010  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GLTK_DIALOG_H_
9 #define MSP_GLTK_DIALOG_H_
10
11 #include "panel.h"
12
13 namespace Msp {
14 namespace GLtk {
15
16 class Button;
17
18 /**
19 A Dialog is used for temporary interaction with the user.  When any of the
20 Dialog's action buttons are clicked, it will emit a signal and delete itself.
21 */
22 class Dialog: public Panel
23 {
24 private:
25         bool stale;
26
27 public:
28         sigc::signal<void, int> signal_response;
29
30         Dialog();
31
32         /** Adds an action button to the dialog.  Pressing the button will invoke
33         response handlers and delete the dialog. */
34         void add_button(Button &, int);
35
36         virtual void button_release(int, int, unsigned);
37         virtual void key_release(unsigned, unsigned);
38 protected:
39         void response(int);
40
41         /** Called when an action button is pressed. */
42         virtual void on_response(int) { }
43 };
44
45 } // namespace GLtk
46 } // namespace Msp
47
48 #endif