label and focuslabel update their textures automatically on a style change
Dana Jansens danakj@orodu.net
4 files changed,
24 insertions(+),
4 deletions(-)
M
otk/focuslabel.cc
→
otk/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.hh
→
otk/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.cc
→
otk/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.hh
→
otk/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;