]>
Dogcows Code - chaz/openbox/blob - otk/button.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
9 Button::Button(Widget
*parent
)
13 setHorizontalJustify(RenderStyle::CenterJustify
);
14 setVerticalJustify(RenderStyle::CenterJustify
);
15 styleChanged(*RenderStyle::style(screen()));
22 void Button::press(unsigned int mouse_button
)
27 _mouse_button
= mouse_button
;
29 styleChanged(*RenderStyle::style(screen()));
33 void Button::release(unsigned int mouse_button
)
35 if (!_pressed
|| _mouse_button
!= mouse_button
) return; // wrong button
39 styleChanged(*RenderStyle::style(screen()));
43 void Button::buttonPressHandler(const XButtonEvent
&e
)
45 Widget::buttonPressHandler(e
);
49 void Button::buttonReleaseHandler(const XButtonEvent
&e
)
51 Widget::buttonReleaseHandler(e
);
54 if (p
&& !_pressed
&& e
.x
> 0 && e
.y
> 0 &&
55 e
.x
< area().width() && e
.y
< area().height())
56 clickHandler(_mouse_button
);
59 void Button::styleChanged(const RenderStyle
&style
)
61 if (isHighlighted()) {
63 _texture
= style
.buttonPressFocusBackground();
65 _texture
= style
.buttonUnpressFocusBackground();
66 _forecolor
= style
.buttonFocusColor();
69 _texture
= style
.buttonPressUnfocusBackground();
71 _texture
= style
.buttonUnpressUnfocusBackground();
72 _forecolor
= style
.buttonUnfocusColor();
This page took 0.040553 seconds and 4 git commands to generate.