]> icculus.org git repositories - mikachu/openbox.git/blob - otk/button.hh
make window placement not go off screen at all
[mikachu/openbox.git] / otk / button.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __button_hh
3 #define __button_hh
4
5 #include "focuslabel.hh"
6
7 namespace otk {
8
9 class Button : public FocusLabel {
10
11 public:
12
13   Button(Widget *parent);
14   ~Button();
15
16   inline const Texture *getPressedFocusTexture(void) const
17   { return _pressed_focus_tx; }
18   void setPressedFocusTexture(Texture *texture)
19   { _pressed_focus_tx = texture; }
20
21   inline const Texture *getPressedUnfocusTexture(void) const
22   { return _pressed_unfocus_tx; }
23   void setPressedUnfocusTexture(Texture *texture)
24   { _pressed_unfocus_tx = texture; }
25
26   void setTexture(Texture *texture);
27   void setUnfocusTexture(Texture *texture);
28
29   inline bool isPressed(void) const { return _pressed; }
30   void press(unsigned int mouse_button);
31   void release(unsigned int mouse_button);
32
33   void buttonPressHandler(const XButtonEvent &e);
34   void buttonReleaseHandler(const XButtonEvent &e);
35
36   virtual void setStyle(Style *style);
37   
38 private:
39
40   bool _pressed;
41   unsigned int _mouse_button;
42
43   Texture *_pressed_focus_tx;
44   Texture *_pressed_unfocus_tx;
45
46   Texture *_unpr_focus_tx;
47   Texture *_unpr_unfocus_tx;
48 };
49
50 }
51
52 #endif