2003-01-11 19:17:13 +00:00
|
|
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
2002-11-16 02:15:49 +00:00
|
|
|
#ifndef __button_hh
|
|
|
|
#define __button_hh
|
|
|
|
|
2002-11-16 13:21:24 +00:00
|
|
|
#include "focuslabel.hh"
|
2002-11-11 03:47:12 +00:00
|
|
|
|
|
|
|
namespace otk {
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
class Button : public FocusLabel {
|
2002-11-11 03:47:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Button(Widget *parent);
|
|
|
|
~Button();
|
2002-11-11 03:47:12 +00:00
|
|
|
|
2003-01-20 06:11:12 +00:00
|
|
|
inline const RenderTexture *getPressedFocusTexture(void) const
|
2002-11-14 11:41:50 +00:00
|
|
|
{ return _pressed_focus_tx; }
|
2003-01-20 06:11:12 +00:00
|
|
|
void setPressedFocusTexture(RenderTexture *texture)
|
2002-11-14 11:41:50 +00:00
|
|
|
{ _pressed_focus_tx = texture; }
|
|
|
|
|
2003-01-20 06:11:12 +00:00
|
|
|
inline const RenderTexture *getPressedUnfocusTexture(void) const
|
2002-11-14 11:41:50 +00:00
|
|
|
{ return _pressed_unfocus_tx; }
|
2003-01-20 06:11:12 +00:00
|
|
|
void setPressedUnfocusTexture(RenderTexture *texture)
|
2002-11-14 11:41:50 +00:00
|
|
|
{ _pressed_unfocus_tx = texture; }
|
|
|
|
|
2003-01-20 06:11:12 +00:00
|
|
|
void setTexture(RenderTexture *texture);
|
|
|
|
void setUnfocusTexture(RenderTexture *texture);
|
2002-11-14 11:41:50 +00:00
|
|
|
|
2002-11-11 03:47:12 +00:00
|
|
|
inline bool isPressed(void) const { return _pressed; }
|
2002-11-16 13:21:24 +00:00
|
|
|
void press(unsigned int mouse_button);
|
|
|
|
void release(unsigned int mouse_button);
|
2002-11-11 03:47:12 +00:00
|
|
|
|
2002-11-16 14:30:18 +00:00
|
|
|
void buttonPressHandler(const XButtonEvent &e);
|
|
|
|
void buttonReleaseHandler(const XButtonEvent &e);
|
2002-11-14 11:41:50 +00:00
|
|
|
|
2003-01-22 22:46:16 +00:00
|
|
|
virtual void setStyle(RenderStyle *style);
|
2002-12-03 19:01:41 +00:00
|
|
|
|
2002-11-11 03:47:12 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
bool _pressed;
|
2002-11-16 13:21:24 +00:00
|
|
|
unsigned int _mouse_button;
|
2002-11-14 11:41:50 +00:00
|
|
|
|
2003-01-20 06:11:12 +00:00
|
|
|
RenderTexture *_pressed_focus_tx;
|
|
|
|
RenderTexture *_pressed_unfocus_tx;
|
2002-11-11 03:47:12 +00:00
|
|
|
|
2003-01-20 06:11:12 +00:00
|
|
|
RenderTexture *_unpr_focus_tx;
|
|
|
|
RenderTexture *_unpr_unfocus_tx;
|
2002-11-11 03:47:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2002-11-16 02:15:49 +00:00
|
|
|
|
|
|
|
#endif
|