all repos — openbox @ 26adc8853bc04f3f2f2d2e5f5ac94121f23b72e2

openbox fork - make it a bit more like ryudo

label and focuslabel update their textures automatically on a style change
Dana Jansens danakj@orodu.net
commit

26adc8853bc04f3f2f2d2e5f5ac94121f23b72e2

parent

f890d31d6bf41db5c565e4f1b25132a6df1bd044

4 files changed, 24 insertions(+), 4 deletions(-)

jump to
M otk/focuslabel.ccotk/focuslabel.cc

@@ -16,15 +16,23 @@ {

const ScreenInfo *info = OBDisplay::screenInfo(getScreen()); _xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), info->getColormap()); - - setTexture(getStyle()->getLabelFocus()); - setUnfocusTexture(getStyle()->getLabelUnfocus()); + setStyle(getStyle()); } OtkFocusLabel::~OtkFocusLabel() { XftDrawDestroy(_xftdraw); } + + +void OtkFocusLabel::setStyle(Style *style) +{ + OtkFocusWidget::setStyle(style); + + setTexture(getStyle()->getLabelFocus()); + setUnfocusTexture(getStyle()->getLabelUnfocus()); +} + void OtkFocusLabel::update(void) {
M otk/focuslabel.hhotk/focuslabel.hh

@@ -18,6 +18,8 @@ void setText(const std::string &text) { _text = text; _dirty = true; }

void update(void); + virtual void setStyle(Style *style); + private: //! Object used by Xft to render to the drawable XftDraw *_xftdraw;
M otk/label.ccotk/label.cc

@@ -15,13 +15,21 @@ const ScreenInfo *info = OBDisplay::screenInfo(getScreen());

_xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), info->getColormap()); - setTexture(getStyle()->getLabelUnfocus()); + setStyle(getStyle()); } OtkLabel::~OtkLabel() { XftDrawDestroy(_xftdraw); } + +void OtkLabel::setStyle(Style *style) +{ + OtkWidget::setStyle(style); + + setTexture(getStyle()->getLabelUnfocus()); +} + void OtkLabel::update(void) {
M otk/label.hhotk/label.hh

@@ -18,6 +18,8 @@ void setText(const std::string &text) { _text = text; _dirty = true; }

void update(void); + virtual void setStyle(Style *style); + private: //! Object used by Xft to render to the drawable XftDraw *_xftdraw;