]>
Dogcows Code - chaz/openbox/blob - otk/button.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
11 Button::Button(Widget
*parent
)
12 : FocusLabel(parent
), _pressed(false), _pressed_focus_tx(0),
13 _pressed_unfocus_tx(0), _unpr_focus_tx(0), _unpr_unfocus_tx(0)
22 void Button::setStyle(Style
*style
)
24 FocusLabel::setStyle(style
);
26 setTexture(style
->getButtonFocus());
27 setUnfocusTexture(style
->getButtonUnfocus());
28 _pressed_focus_tx
= style
->getButtonPressedFocus();
29 _pressed_unfocus_tx
= style
->getButtonPressedUnfocus();
33 void Button::press(unsigned int mouse_button
)
37 if (_pressed_focus_tx
)
38 FocusWidget::setTexture(_pressed_focus_tx
);
39 if (_pressed_unfocus_tx
)
40 FocusWidget::setUnfocusTexture(_pressed_unfocus_tx
);
42 _mouse_button
= mouse_button
;
45 void Button::release(unsigned int mouse_button
)
47 if (_mouse_button
!= mouse_button
) return; // wrong button
49 FocusWidget::setTexture(_unpr_focus_tx
);
50 FocusWidget::setUnfocusTexture(_unpr_unfocus_tx
);
54 void Button::setTexture(Texture
*texture
)
56 FocusWidget::setTexture(texture
);
57 _unpr_focus_tx
= texture
;
60 void Button::setUnfocusTexture(Texture
*texture
)
62 FocusWidget::setUnfocusTexture(texture
);
63 _unpr_unfocus_tx
= texture
;
66 void Button::buttonPressHandler(const XButtonEvent
&e
)
70 FocusWidget::buttonPressHandler(e
);
73 void Button::buttonReleaseHandler(const XButtonEvent
&e
)
77 FocusWidget::buttonReleaseHandler(e
);
This page took 0.038943 seconds and 4 git commands to generate.