104 |
class Container : public Widget { |
class Container : public Widget { |
105 |
public: |
public: |
106 |
Container() {} |
Container() {} |
107 |
~Container(); |
virtual ~Container(); |
108 |
|
|
109 |
void add_child (Widget *w); |
void add_child (Widget *w); |
110 |
void redraw_child (Widget *w, const px::Rect &r); |
void redraw_child (Widget *w, const px::Rect &r); |
111 |
|
|
132 |
public: |
public: |
133 |
void set_spacing (int pixels); |
void set_spacing (int pixels); |
134 |
protected: |
protected: |
135 |
List(int spacing=5) : m_spacing(spacing) |
List(int spacing=5) : m_spacing(spacing) {} |
136 |
{} |
virtual ~List() {} |
137 |
private: |
private: |
138 |
int m_spacing; // # of pixels between container items |
int m_spacing; // # of pixels between container items |
139 |
}; |
}; |
176 |
class Label : public Widget { |
class Label : public Widget { |
177 |
public: |
public: |
178 |
Label (const std::string &text); |
Label (const std::string &text); |
179 |
|
|
180 |
// Widget interface |
// Widget interface |
181 |
void draw (px::GC &gc, const px::Rect &r); |
void draw (px::GC &gc, const px::Rect &r); |
182 |
|
|
194 |
class Button : public Widget { |
class Button : public Widget { |
195 |
protected: |
protected: |
196 |
Button() : highlighted(false) {} |
Button() : highlighted(false) {} |
197 |
|
virtual ~Button() {} |
198 |
|
|
199 |
void draw(px::GC &gc, const px::Rect &r); |
void draw(px::GC &gc, const px::Rect &r); |
200 |
protected: |
protected: |
210 |
class PushButton : public Button { |
class PushButton : public Button { |
211 |
public: |
public: |
212 |
PushButton(); |
PushButton(); |
213 |
|
virtual ~PushButton() {} |
214 |
|
|
215 |
bool is_pressed() { return pressed; } |
bool is_pressed() { return pressed; } |
216 |
protected: |
protected: |
217 |
bool on_event(const SDL_Event &e); |
bool on_event(const SDL_Event &e); |
226 |
class TextButton : public PushButton { |
class TextButton : public PushButton { |
227 |
public: |
public: |
228 |
TextButton(const std::string &t, ActionListener *al=0); |
TextButton(const std::string &t, ActionListener *al=0); |
229 |
|
virtual ~TextButton() {} |
230 |
|
|
231 |
void set_text(const std::string &t); |
void set_text(const std::string &t); |
232 |
private: |
private: |
233 |
// Widget interface. |
// Widget interface. |
246 |
public: |
public: |
247 |
ImageButton(const std::string &unselected, |
ImageButton(const std::string &unselected, |
248 |
const std::string &selected, |
const std::string &selected, |
249 |
ActionListener *al=0); |
ActionListener *al = 0); |
250 |
|
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); |
254 |
std::string fname_sel, fname_unsel; |
std::string fname_sel, fname_unsel; |
255 |
}; |
}; |
256 |
|
|