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());
|
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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
10
otk/label.cc
10
otk/label.cc
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue