]>
Dogcows Code - chaz/openbox/blob - otk/button.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
11 OtkButton::OtkButton(OtkWidget
*parent
)
12 : OtkFocusLabel(parent
), _pressed(false), _pressed_focus_tx(0),
13 _pressed_unfocus_tx(0), _unpr_focus_tx(0), _unpr_unfocus_tx(0)
18 OtkButton::~OtkButton()
23 void OtkButton::setStyle(Style
*style
)
25 OtkFocusLabel::setStyle(style
);
27 setTexture(getStyle()->getButtonFocus());
28 setUnfocusTexture(getStyle()->getButtonUnfocus());
29 _pressed_focus_tx
= getStyle()->getButtonPressedFocus();
30 _pressed_unfocus_tx
= getStyle()->getButtonPressedUnfocus();
34 void OtkButton::press(unsigned int mouse_button
)
38 if (_pressed_focus_tx
)
39 OtkFocusWidget::setTexture(_pressed_focus_tx
);
40 if (_pressed_unfocus_tx
)
41 OtkFocusWidget::setUnfocusTexture(_pressed_unfocus_tx
);
43 _mouse_button
= mouse_button
;
46 void OtkButton::release(unsigned int mouse_button
)
48 if (_mouse_button
!= mouse_button
) return; // wrong button
50 OtkFocusWidget::setTexture(_unpr_focus_tx
);
51 OtkFocusWidget::setUnfocusTexture(_unpr_unfocus_tx
);
55 void OtkButton::setTexture(BTexture
*texture
)
57 OtkFocusWidget::setTexture(texture
);
58 _unpr_focus_tx
= texture
;
61 void OtkButton::setUnfocusTexture(BTexture
*texture
)
63 OtkFocusWidget::setUnfocusTexture(texture
);
64 _unpr_unfocus_tx
= texture
;
67 void OtkButton::buttonPressHandler(const XButtonEvent
&e
)
71 OtkFocusWidget::buttonPressHandler(e
);
74 void OtkButton::buttonReleaseHandler(const XButtonEvent
&e
)
78 OtkFocusWidget::buttonReleaseHandler(e
);
This page took 0.038428 seconds and 4 git commands to generate.