]> git.tdb.fi Git - libs/gltk.git/blob - source/dialog.cpp
Style update: add spaces around assignments
[libs/gltk.git] / source / dialog.cpp
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 #include "button.h"
9 #include "dialog.h"
10
11 namespace Msp {
12 namespace GLtk {
13
14 Dialog::Dialog(const Resources &r):
15         Widget(r),
16         Panel(r),
17         stale(false)
18 { }
19
20 void Dialog::add_button(Button &button, int code)
21 {
22         add(button);
23         button.signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &Dialog::response), code));
24 }
25
26 void Dialog::button_release(int x, int y, unsigned button)
27 {
28         Panel::button_release(x, y, button);
29         if(stale)
30                 delete this;
31 }
32
33 void Dialog::key_release(unsigned key, unsigned mod)
34 {
35         Panel::key_release(key, mod);
36         if(stale)
37                 delete this;
38 }
39
40 void Dialog::response(int code)
41 {
42         on_response(code);
43         signal_response.emit(code);
44         stale = true;
45 }
46
47 } // namespace GLtk
48 } // namespace Msp