]> icculus.org git repositories - mikachu/openbox.git/blob - otk/button.hh
fixed bugs, got otkapp to select on a fd, modded widget to make use of otkapp, press...
[mikachu/openbox.git] / otk / button.hh
1 #ifndef __button_hh
2 #define __button_hh
3
4 #include "focuswidget.hh"
5 //#include "pixmap.hh"
6
7 namespace otk {
8
9 class OtkButton : public OtkFocusWidget {
10
11 public:
12
13   OtkButton(OtkWidget *parent);
14   ~OtkButton();
15
16   inline const BTexture *getPressedFocusTexture(void) const
17   { return _pressed_focus_tx; }
18   void setPressedFocusTexture(BTexture *texture)
19   { _pressed_focus_tx = texture; }
20
21   inline const BTexture *getPressedUnfocusTexture(void) const
22   { return _pressed_unfocus_tx; }
23   void setPressedUnfocusTexture(BTexture *texture)
24   { _pressed_unfocus_tx = texture; }
25
26   void setTexture(BTexture *texture);
27   void setUnfocusTexture(BTexture *texture);
28
29   inline const std::string &getText(void) const { return _text; }
30   void setText(const std::string &text) { _text = text; _dirty = true; }
31
32   //inline const OtkPixmap &getPixmap(void) const { return _pixmap; }
33   //void setPixmap(const OtkPixmap &pixmap);
34
35   inline bool isPressed(void) const { return _pressed; }
36   void press(void);
37   void release(void);
38
39   void update(void);
40   int exposeHandler(const XExposeEvent &e);
41   int configureHandler(const XConfigureEvent &e);
42   int buttonPressHandler(const XButtonEvent &e);
43   int buttonReleaseHandler(const XButtonEvent &e);
44
45 private:
46
47   std::string _text;
48   //OtkPixmap _pixmap;
49   bool _pressed;
50   bool _dirty;
51
52   BTexture *_pressed_focus_tx;
53   BTexture *_pressed_unfocus_tx;
54
55   BTexture *_unpr_focus_tx;
56   BTexture *_unpr_unfocus_tx;
57 };
58
59 }
60
61 #endif