label and focuslabel update their textures automatically on a style change

This commit is contained in:
Dana Jansens 2002-12-03 19:10:03 +00:00
parent f890d31d6b
commit 26adc8853b
4 changed files with 24 additions and 4 deletions

View file

@ -16,9 +16,7 @@ OtkFocusLabel::OtkFocusLabel(OtkWidget *parent)
const ScreenInfo *info = OBDisplay::screenInfo(getScreen()); const ScreenInfo *info = OBDisplay::screenInfo(getScreen());
_xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), _xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(),
info->getColormap()); info->getColormap());
setStyle(getStyle());
setTexture(getStyle()->getLabelFocus());
setUnfocusTexture(getStyle()->getLabelUnfocus());
} }
OtkFocusLabel::~OtkFocusLabel() OtkFocusLabel::~OtkFocusLabel()
@ -26,6 +24,16 @@ OtkFocusLabel::~OtkFocusLabel()
XftDrawDestroy(_xftdraw); XftDrawDestroy(_xftdraw);
} }
void OtkFocusLabel::setStyle(Style *style)
{
OtkFocusWidget::setStyle(style);
setTexture(getStyle()->getLabelFocus());
setUnfocusTexture(getStyle()->getLabelUnfocus());
}
void OtkFocusLabel::update(void) void OtkFocusLabel::update(void)
{ {
if (_dirty) { if (_dirty) {

View file

@ -18,6 +18,8 @@ public:
void update(void); void update(void);
virtual void setStyle(Style *style);
private: private:
//! Object used by Xft to render to the drawable //! Object used by Xft to render to the drawable
XftDraw *_xftdraw; XftDraw *_xftdraw;

View file

@ -15,7 +15,7 @@ OtkLabel::OtkLabel(OtkWidget *parent)
_xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), _xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(),
info->getColormap()); info->getColormap());
setTexture(getStyle()->getLabelUnfocus()); setStyle(getStyle());
} }
OtkLabel::~OtkLabel() OtkLabel::~OtkLabel()
@ -23,6 +23,14 @@ OtkLabel::~OtkLabel()
XftDrawDestroy(_xftdraw); XftDrawDestroy(_xftdraw);
} }
void OtkLabel::setStyle(Style *style)
{
OtkWidget::setStyle(style);
setTexture(getStyle()->getLabelUnfocus());
}
void OtkLabel::update(void) void OtkLabel::update(void)
{ {
if (_dirty) { if (_dirty) {

View file

@ -18,6 +18,8 @@ public:
void update(void); void update(void);
virtual void setStyle(Style *style);
private: private:
//! Object used by Xft to render to the drawable //! Object used by Xft to render to the drawable
XftDraw *_xftdraw; XftDraw *_xftdraw;