50 |
|
|
51 |
class Widget : public ActionListener { |
class Widget : public ActionListener { |
52 |
public: |
public: |
|
virtual ~Widget() {} |
|
|
|
|
53 |
/* |
/* |
54 |
** Widget interface |
** Widget interface |
55 |
*/ |
*/ |
102 |
class Container : public Widget { |
class Container : public Widget { |
103 |
public: |
public: |
104 |
Container() {} |
Container() {} |
105 |
virtual ~Container(); |
~Container(); |
106 |
|
|
107 |
void add_child (Widget *w); |
void add_child (Widget *w); |
108 |
void redraw_child (Widget *w, const px::Rect &r); |
void redraw_child (Widget *w, const px::Rect &r); |
131 |
void set_spacing (int pixels); |
void set_spacing (int pixels); |
132 |
protected: |
protected: |
133 |
List(int spacing=5) : m_spacing(spacing) {} |
List(int spacing=5) : m_spacing(spacing) {} |
|
virtual ~List() {} |
|
134 |
private: |
private: |
135 |
int m_spacing; // # of pixels between container items |
int m_spacing; // # of pixels between container items |
136 |
}; |
}; |
198 |
class Button : public Widget { |
class Button : public Widget { |
199 |
protected: |
protected: |
200 |
Button() : highlighted(false) {} |
Button() : highlighted(false) {} |
|
virtual ~Button() {} |
|
201 |
|
|
202 |
void draw(px::GC &gc, const px::Rect &r); |
void draw(px::GC &gc, const px::Rect &r); |
203 |
protected: |
protected: |
213 |
class PushButton : public Button { |
class PushButton : public Button { |
214 |
public: |
public: |
215 |
PushButton(); |
PushButton(); |
|
virtual ~PushButton() {} |
|
216 |
|
|
217 |
bool is_pressed() { return pressed; } |
bool is_pressed() { return pressed; } |
218 |
protected: |
protected: |
228 |
class TextButton : public PushButton { |
class TextButton : public PushButton { |
229 |
public: |
public: |
230 |
TextButton(const std::string &t, ActionListener *al=0); |
TextButton(const std::string &t, ActionListener *al=0); |
|
virtual ~TextButton() {} |
|
231 |
|
|
232 |
void set_text(const std::string &t); |
void set_text(const std::string &t); |
233 |
private: |
private: |
248 |
ImageButton(const std::string &unselected, |
ImageButton(const std::string &unselected, |
249 |
const std::string &selected, |
const std::string &selected, |
250 |
ActionListener *al = 0); |
ActionListener *al = 0); |
|
virtual ~ImageButton() {} |
|
251 |
private: |
private: |
252 |
// Widget interface. |
// Widget interface. |
253 |
void draw(px::GC &gc, const px::Rect &r); |
void draw(px::GC &gc, const px::Rect &r); |
260 |
class Menu : public Container { |
class Menu : public Container { |
261 |
public: |
public: |
262 |
Menu(); |
Menu(); |
|
virtual ~Menu(); |
|
263 |
|
|
264 |
//! true: ok, false: menu aborted by user |
//! true: ok, false: menu aborted by user |
265 |
bool manage(px::Screen *scr); |
bool manage(px::Screen *scr); |