197 |
|
|
198 |
class Button : public Widget { |
class Button : public Widget { |
199 |
protected: |
protected: |
200 |
Button() : highlighted(false) {} |
Button(); |
201 |
|
|
|
void draw(px::GC &gc, const px::Rect &r); |
|
|
protected: |
|
202 |
// Widget interface. |
// Widget interface. |
203 |
void activate() { highlighted=true; redraw(); } |
void draw(px::GC &gc, const px::Rect &r); |
204 |
void deactivate() { highlighted=false; redraw(); } |
void activate(); |
205 |
|
void deactivate(); |
206 |
private: |
private: |
207 |
|
|
208 |
bool highlighted; |
bool m_activep; |
209 |
}; |
}; |
210 |
|
|
211 |
|
|
213 |
public: |
public: |
214 |
PushButton(); |
PushButton(); |
215 |
|
|
216 |
bool is_pressed() { return pressed; } |
bool is_pressed() { return m_pressedp; } |
217 |
protected: |
protected: |
218 |
bool on_event(const SDL_Event &e); |
bool on_event(const SDL_Event &e); |
219 |
void deactivate(); |
void deactivate(); |
220 |
private: |
private: |
221 |
bool pressed; |
bool m_pressedp; |
222 |
}; |
}; |
223 |
|
|
224 |
//---------------------------------------- |
//---------------------------------------- |