]>
Dogcows Code - chaz/openbox/blob - otk/button.cc
04906fe517306f1e06baa4d5a0dbdf28c7934a2c
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
);
27 //setTexture(style->getButtonFocus());
28 //setUnfocusTexture(style->getButtonUnfocus());
29 //_pressed_focus_tx = style->getButtonPressedFocus();
30 //_pressed_unfocus_tx = style->getButtonPressedUnfocus();
34 void Button::press(unsigned int mouse_button
)
38 if (_pressed_focus_tx
)
39 FocusWidget::setTexture(_pressed_focus_tx
);
40 if (_pressed_unfocus_tx
)
41 FocusWidget::setUnfocusTexture(_pressed_unfocus_tx
);
43 _mouse_button
= mouse_button
;
46 void Button::release(unsigned int mouse_button
)
48 if (_mouse_button
!= mouse_button
) return; // wrong button
50 FocusWidget::setTexture(_unpr_focus_tx
);
51 FocusWidget::setUnfocusTexture(_unpr_unfocus_tx
);
55 void Button::setTexture(RenderTexture
*texture
)
57 FocusWidget::setTexture(texture
);
58 _unpr_focus_tx
= texture
;
61 void Button::setUnfocusTexture(RenderTexture
*texture
)
63 FocusWidget::setUnfocusTexture(texture
);
64 _unpr_unfocus_tx
= texture
;
67 void Button::buttonPressHandler(const XButtonEvent
&e
)
71 FocusWidget::buttonPressHandler(e
);
74 void Button::buttonReleaseHandler(const XButtonEvent
&e
)
78 FocusWidget::buttonReleaseHandler(e
);
This page took 0.037385 seconds and 4 git commands to generate.