From 26adc8853bc04f3f2f2d2e5f5ac94121f23b72e2 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 3 Dec 2002 19:10:03 +0000 Subject: [PATCH] label and focuslabel update their textures automatically on a style change --- otk/focuslabel.cc | 14 +++++++++++--- otk/focuslabel.hh | 2 ++ otk/label.cc | 10 +++++++++- otk/label.hh | 2 ++ 4 files changed, 24 insertions(+), 4 deletions(-) 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; -- 2.45.2