label and focuslabel update their textures automatically on a style change
This commit is contained in:
parent
f890d31d6b
commit
26adc8853b
4 changed files with 24 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
10
otk/label.cc
10
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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue