]> git.tdb.fi Git - libs/gltk.git/blob - source/dropdown.h
Add Dropdown widget
[libs/gltk.git] / source / dropdown.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_DROPDOWN_H_
9 #define MSP_GLTK_DROPDOWN_H_
10
11 #include <sigc++/signal.h>
12 #include "widget.h"
13
14 namespace Msp {
15 namespace GLtk {
16
17 class List;
18
19 class Dropdown: public Widget
20 {
21 private:
22         List *list;
23         std::string text;
24         bool list_active;
25
26 public:
27         sigc::signal<void, int, const std::string &> signal_item_selected;
28
29         Dropdown(const Resources &);
30         ~Dropdown();
31
32         void append(const std::string &);
33
34         virtual void button_press(int, int, unsigned);
35         virtual void button_release(int, int, unsigned);
36         virtual void pointer_motion(int, int);
37         virtual void pointer_enter();
38         virtual void pointer_leave();
39 private:
40         virtual const char *get_class() const { return "dropdown"; }
41         virtual void render_special(const Part &) const;
42
43         virtual void on_geometry_change();
44
45         void list_item_selected(unsigned, const std::string &);
46 };
47
48 } // namespace GLtk
49 } // namespace Msp
50
51 #endif