]> icculus.org git repositories - mikachu/openbox.git/blob - otk/button.hh
abort() on X errors that aren't BadWindow errors
[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 otk::BTexture *getPressedFocusTexture(void) const
16   { return _pressed_focus_tx; }
17   void setPressedFocusTexture(otk::BTexture *texture)
18   { _pressed_focus_tx = texture; }
19
20   inline const otk::BTexture *getPressedUnfocusTexture(void) const
21   { return _pressed_unfocus_tx; }
22   void setPressedUnfocusTexture(otk::BTexture *texture)
23   { _pressed_unfocus_tx = texture; }
24
25   void setTexture(otk::BTexture *texture);
26   void setUnfocusTexture(otk::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   void buttonPressHandler(const XButtonEvent &e);
33   void buttonReleaseHandler(const XButtonEvent &e);
34
35   virtual void setStyle(otk::Style *style);
36   
37 private:
38
39   bool _pressed;
40   unsigned int _mouse_button;
41
42   BTexture *_pressed_focus_tx;
43   BTexture *_pressed_unfocus_tx;
44
45   BTexture *_unpr_focus_tx;
46   BTexture *_unpr_unfocus_tx;
47 };
48
49 }
50
51 #endif