]>
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)
15 setTexture(getStyle()->getButtonFocus());
16 setUnfocusTexture(getStyle()->getButtonUnfocus());
17 _pressed_focus_tx
= getStyle()->getButtonPressedFocus();
18 _pressed_unfocus_tx
= getStyle()->getButtonPressedUnfocus();
21 OtkButton::~OtkButton()
23 if (_pressed_focus_tx
) delete _pressed_focus_tx
;
24 if (_pressed_unfocus_tx
) delete _pressed_unfocus_tx
;
27 void OtkButton::press(unsigned int mouse_button
)
31 if (_pressed_focus_tx
)
32 OtkFocusWidget::setTexture(_pressed_focus_tx
);
33 if (_pressed_unfocus_tx
)
34 OtkFocusWidget::setUnfocusTexture(_pressed_unfocus_tx
);
36 _mouse_button
= mouse_button
;
39 void OtkButton::release(unsigned int mouse_button
)
41 if (_mouse_button
!= mouse_button
) return; // wrong button
43 OtkFocusWidget::setTexture(_unpr_focus_tx
);
44 OtkFocusWidget::setUnfocusTexture(_unpr_unfocus_tx
);
48 void OtkButton::setTexture(BTexture
*texture
)
50 OtkFocusWidget::setTexture(texture
);
51 _unpr_focus_tx
= texture
;
54 void OtkButton::setUnfocusTexture(BTexture
*texture
)
56 OtkFocusWidget::setUnfocusTexture(texture
);
57 _unpr_unfocus_tx
= texture
;
60 void OtkButton::buttonPressHandler(const XButtonEvent
&e
)
64 OtkFocusWidget::buttonPressHandler(e
);
67 void OtkButton::buttonReleaseHandler(const XButtonEvent
&e
)
71 OtkFocusWidget::buttonReleaseHandler(e
);
This page took 0.037926 seconds and 5 git commands to generate.