]> git.tdb.fi Git - libs/gltk.git/blob - source/dialog.h
Rearrange members
[libs/gltk.git] / source / dialog.h
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2010-2011  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 public:
25         sigc::signal<void, int> signal_response;
26
27 private:
28         bool stale;
29
30 public:
31         Dialog();
32
33         /** Adds an action button to the dialog.  Pressing the button will invoke
34         response handlers and delete the dialog. */
35         void add_button(Button &, int);
36
37         virtual void button_release(int, int, unsigned);
38         virtual void key_release(unsigned, unsigned);
39 protected:
40         void response(int);
41
42         /** Called when an action button is pressed. */
43         virtual void on_response(int) { }
44 };
45
46 } // namespace GLtk
47 } // namespace Msp
48
49 #endif