X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=otk%2Fbutton.cc;h=fd23a5698d74d54ff15851df3c25255834459025;hb=24924367f9486b29b8b9fd024781ccb5f9e0e276;hp=f080c7699d24d5de5a90f0d113a72cc84de5b85e;hpb=d4d15160fe81353a9f7958c1feb1821abe179a70;p=chaz%2Fopenbox diff --git a/otk/button.cc b/otk/button.cc index f080c769..fd23a569 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -1,3 +1,9 @@ +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- + +#ifdef HAVE_CONFIG_H +# include "../config.h" +#endif + #include "button.hh" namespace otk { @@ -6,17 +12,24 @@ OtkButton::OtkButton(OtkWidget *parent) : OtkFocusLabel(parent), _pressed(false), _pressed_focus_tx(0), _pressed_unfocus_tx(0), _unpr_focus_tx(0), _unpr_unfocus_tx(0) { + setStyle(getStyle()); +} + +OtkButton::~OtkButton() +{ +} + + +void OtkButton::setStyle(Style *style) +{ + OtkFocusLabel::setStyle(style); + setTexture(getStyle()->getButtonFocus()); setUnfocusTexture(getStyle()->getButtonUnfocus()); _pressed_focus_tx = getStyle()->getButtonPressedFocus(); _pressed_unfocus_tx = getStyle()->getButtonPressedUnfocus(); } -OtkButton::~OtkButton() -{ - if (_pressed_focus_tx) delete _pressed_focus_tx; - if (_pressed_unfocus_tx) delete _pressed_unfocus_tx; -} void OtkButton::press(unsigned int mouse_button) { @@ -51,18 +64,18 @@ void OtkButton::setUnfocusTexture(BTexture *texture) _unpr_unfocus_tx = texture; } -int OtkButton::buttonPressHandler(const XButtonEvent &e) +void OtkButton::buttonPressHandler(const XButtonEvent &e) { press(e.button); update(); - return OtkFocusWidget::buttonPressHandler(e); + OtkFocusWidget::buttonPressHandler(e); } -int OtkButton::buttonReleaseHandler(const XButtonEvent &e) +void OtkButton::buttonReleaseHandler(const XButtonEvent &e) { release(e.button); update(); - return OtkFocusWidget::buttonReleaseHandler(e); + OtkFocusWidget::buttonReleaseHandler(e); } }