new button that is a focuslabel
[mikachu/openbox.git] / otk / button.hh
1 #ifndef __button_hh
2 #define __button_hh
3
4 #include "focuslabel.hh"
5
6 namespace otk {
7
8 class OtkButton : public OtkFocusLabel {
9
10 public:
11
12   OtkButton(OtkWidget *parent);
13   ~OtkButton();
14
15   inline const BTexture *getPressedFocusTexture(void) const
16   { return _pressed_focus_tx; }
17   void setPressedFocusTexture(BTexture *texture)
18   { _pressed_focus_tx = texture; }
19
20   inline const BTexture *getPressedUnfocusTexture(void) const
21   { return _pressed_unfocus_tx; }
22   void setPressedUnfocusTexture(BTexture *texture)
23   { _pressed_unfocus_tx = texture; }
24
25   void setTexture(BTexture *texture);
26   void setUnfocusTexture(BTexture *texture);
27
28   inline bool isPressed(void) const { return _pressed; }
29   void press(unsigned int mouse_button);
30   void release(unsigned int mouse_button);
31
32   int buttonPressHandler(const XButtonEvent &e);
33   int buttonReleaseHandler(const XButtonEvent &e);
34
35 private:
36
37   bool _pressed;
38   unsigned int _mouse_button;
39
40   BTexture *_pressed_focus_tx;
41   BTexture *_pressed_unfocus_tx;
42
43   BTexture *_unpr_focus_tx;
44   BTexture *_unpr_unfocus_tx;
45 };
46
47 }
48
49 #endif