73 |
int get_y() const { return area.y; } |
int get_y() const { return area.y; } |
74 |
int get_w() const { return area.w; } |
int get_w() const { return area.w; } |
75 |
int get_h() const { return area.h; } |
int get_h() const { return area.h; } |
76 |
Menu * get_menu() const { return menu; } |
Menu *get_menu() const { return menu; } |
77 |
|
|
78 |
void set_parent(Widget *parent) { m_parent = parent; } |
void set_parent(Widget *parent) { m_parent = parent; } |
79 |
|
|
131 |
public: |
public: |
132 |
void set_spacing (int pixels); |
void set_spacing (int pixels); |
133 |
protected: |
protected: |
134 |
List(int spacing=5) |
List(int spacing=5) : m_spacing(spacing) |
|
: m_spacing(spacing) |
|
135 |
{} |
{} |
136 |
private: |
private: |
137 |
int m_spacing; // # of pixels between container items |
int m_spacing; // # of pixels between container items |
166 |
std::string imgname; |
std::string imgname; |
167 |
}; |
}; |
168 |
|
|
169 |
|
enum Alignment { |
170 |
|
ALIGN_LEFT, |
171 |
|
ALIGN_RIGHT, |
172 |
|
ALIGN_CENTER |
173 |
|
}; |
174 |
|
|
175 |
|
class Label : public Widget { |
176 |
|
public: |
177 |
|
Label (const std::string &text); |
178 |
|
|
179 |
|
// Widget interface |
180 |
|
void draw (px::GC &gc, const px::Rect &r); |
181 |
|
|
182 |
|
// Methods |
183 |
|
void set_text (const std::string &text); |
184 |
|
void set_font (px::Font *font); |
185 |
|
void set_alignment (Alignment horizontal, Alignment vertical=ALIGN_CENTER); |
186 |
|
private: |
187 |
|
// Variables. |
188 |
|
std::string m_text; |
189 |
|
px::Font *m_font; |
190 |
|
Alignment m_halign, m_valign; |
191 |
|
}; |
192 |
|
|
193 |
class Button : public Widget { |
class Button : public Widget { |
194 |
protected: |
protected: |
195 |
Button() : highlighted(false) {} |
Button() : highlighted(false) {} |
239 |
class ImageButton : public PushButton { |
class ImageButton : public PushButton { |
240 |
public: |
public: |
241 |
ImageButton(const std::string &unselected, |
ImageButton(const std::string &unselected, |
242 |
const std::string &selected); |
const std::string &selected, |
243 |
|
ActionListener *al=0); |
244 |
private: |
private: |
245 |
// Widget interface. |
// Widget interface. |
246 |
void draw(px::GC &gc, const px::Rect &r); |
void draw(px::GC &gc, const px::Rect &r); |