]> git.tdb.fi Git - libs/gltk.git/blob - source/button.h
Reorder class members
[libs/gltk.git] / source / button.h
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GLTK_BUTTON_H_
9 #define MSP_GLTK_BUTTON_H_
10
11 #include <sigc++/sigc++.h>
12 #include "widget.h"
13
14 namespace Msp {
15 namespace GLtk {
16
17 /**
18 A clickable button widget.  Buttons can have a text label, which is displayed
19 in a spacial part "text".
20 */
21 class Button: public Widget
22 {
23 public:
24         class Loader: public Widget::Loader
25         {
26         public:
27                 Loader(Button &);
28                 Button &get_object() const;
29         };
30
31 private
32         std::string text;
33         bool pressed;
34
35 public:
36         sigc::signal<void> signal_clicked;
37
38         Button(const Resources &, const std::string & =std::string());
39         void set_text(const std::string &);
40         void button_press(int, int, unsigned);
41         void button_release(int, int, unsigned);
42         void pointer_enter();
43         void pointer_leave();
44 private:
45         const char *get_class() const { return "button"; }
46         void render_part(const Part &) const;
47 };
48
49 } // namespace GLtk
50 } // namespace Msp
51
52 #endif