]>
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 : Label(parent
), _default(false), _pressed(false)
14 setHorizontalJustify(RenderStyle::CenterJustify
);
15 setVerticalJustify(RenderStyle::CenterJustify
);
16 styleChanged(*RenderStyle::style(screen()));
23 void Button::press(unsigned int mouse_button
)
28 _mouse_button
= mouse_button
;
30 styleChanged(*RenderStyle::style(screen()));
34 void Button::release(unsigned int mouse_button
)
36 if (!_pressed
|| _mouse_button
!= mouse_button
) return; // wrong button
40 styleChanged(*RenderStyle::style(screen()));
44 void Button::buttonPressHandler(const XButtonEvent
&e
)
46 Widget::buttonPressHandler(e
);
50 void Button::buttonReleaseHandler(const XButtonEvent
&e
)
52 Widget::buttonReleaseHandler(e
);
56 void Button::setDefault(bool d
)
59 styleChanged(*RenderStyle::style(screen()));
63 void Button::styleChanged(const RenderStyle
&style
)
67 _texture
= style
.buttonPressFocusBackground();
69 _texture
= style
.buttonUnpressFocusBackground();
70 _forecolor
= style
.buttonFocusColor();
73 _texture
= style
.buttonPressUnfocusBackground();
75 _texture
= style
.buttonUnpressUnfocusBackground();
76 _forecolor
= style
.buttonUnfocusColor();
78 Widget::styleChanged(style
);
This page took 0.036449 seconds and 4 git commands to generate.