From: Dana Jansens Date: Tue, 3 Dec 2002 19:10:03 +0000 (+0000) Subject: label and focuslabel update their textures automatically on a style change X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=26adc8853bc04f3f2f2d2e5f5ac94121f23b72e2;p=chaz%2Fopenbox label and focuslabel update their textures automatically on a style change --- diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc index 50b473d8..234aca04 100644 --- a/otk/focuslabel.cc +++ b/otk/focuslabel.cc @@ -16,9 +16,7 @@ OtkFocusLabel::OtkFocusLabel(OtkWidget *parent) 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() @@ -26,6 +24,16 @@ OtkFocusLabel::~OtkFocusLabel() XftDrawDestroy(_xftdraw); } + +void OtkFocusLabel::setStyle(Style *style) +{ + OtkFocusWidget::setStyle(style); + + setTexture(getStyle()->getLabelFocus()); + setUnfocusTexture(getStyle()->getLabelUnfocus()); +} + + void OtkFocusLabel::update(void) { if (_dirty) { diff --git a/otk/focuslabel.hh b/otk/focuslabel.hh index cc94f05a..042082eb 100644 --- a/otk/focuslabel.hh +++ b/otk/focuslabel.hh @@ -18,6 +18,8 @@ public: void update(void); + virtual void setStyle(Style *style); + private: //! Object used by Xft to render to the drawable XftDraw *_xftdraw; diff --git a/otk/label.cc b/otk/label.cc index 24cf8402..170974ac 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -15,7 +15,7 @@ OtkLabel::OtkLabel(OtkWidget *parent) _xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), info->getColormap()); - setTexture(getStyle()->getLabelUnfocus()); + setStyle(getStyle()); } OtkLabel::~OtkLabel() @@ -23,6 +23,14 @@ OtkLabel::~OtkLabel() XftDrawDestroy(_xftdraw); } +void OtkLabel::setStyle(Style *style) +{ + OtkWidget::setStyle(style); + + setTexture(getStyle()->getLabelUnfocus()); +} + + void OtkLabel::update(void) { if (_dirty) { diff --git a/otk/label.hh b/otk/label.hh index c959a2fa..0dd81442 100644 --- a/otk/label.hh +++ b/otk/label.hh @@ -18,6 +18,8 @@ public: void update(void); + virtual void setStyle(Style *style); + private: //! Object used by Xft to render to the drawable XftDraw *_xftdraw;