: Label(parent),
_pressed(false)
{
- setHighlighted(false);
setHorizontalJustify(RenderStyle::CenterJustify);
setVerticalJustify(RenderStyle::CenterJustify);
styleChanged(*RenderStyle::style(screen()));
_texture = style.buttonUnpressUnfocusBackground();
_forecolor = style.buttonUnfocusColor();
}
- Widget::styleChanged(style);
+ refresh();
}
}
_text(""),
_justify_horz(RenderStyle::LeftTopJustify),
_justify_vert(RenderStyle::LeftTopJustify),
- _highlight(true)
+ _highlight(false)
{
styleChanged(*RenderStyle::style(screen()));
}
_texture = style.labelUnfocusBackground();
_forecolor = style.textUnfocusColor();
}
- _font = style.labelFont();
- Widget::styleChanged(style);
- calcDefaultSizes();
+ if (_font != style.labelFont()) {
+ _font = style.labelFont();
+ calcDefaultSizes();
+ }
}
void Label::renderForeground(Surface &surface)
assert(parent);
createWindow(false);
parent->addChild(this);
- parent->layout();
+ if (parent->visible()) parent->layout();
_dispatcher->registerHandler(_window, this);
}
{
if (children) {
std::list<Widget*>::iterator it , end = _children.end();
- for (it = _children.begin(); it != end; ++it)
+ for (it = _children.begin(); it != end; ++it) {
(*it)->show(true);
+ }
}
if (!_visible) {
_visible = true;
void Widget::update()
{
+ if (!_visible) return;
_dirty = true;
if (parent())
parent()->layout(); // relay-out us and our siblings
void Widget::layout()
{
+ if (_children.empty() || !_visible) return;
if (_direction == Horizontal)
layoutHorz();
else
if (_ignore_config) {
_ignore_config--;
} else {
+ // only interested in these for top level windows
+ if (_parent) return;
+
XEvent ev;
ev.xconfigure.width = e.width;
ev.xconfigure.height = e.height;
virtual void exposeHandler(const XExposeEvent &e);
virtual void configureHandler(const XConfigureEvent &e);
- virtual void styleChanged(const RenderStyle &) {calcDefaultSizes();update();}
+ virtual void styleChanged(const RenderStyle &) {}
protected:
virtual void addChild(Widget *w) { assert(w); _children.push_back(w); }
_poplabel.setText(text)
scsize = otk.display.screenInfo(_screen).size()
size = _poplabel.minSize()
- _popwidget.resize(_poplabel.minSize())
- _popwidget.move(otk.Point((scsize.width() - size.width()) / 2,
- (scsize.height() - size.height()) / 2))
+ _popwidget.moveresize(otk.Rect((scsize.width() - size.width()) / 2,
+ (scsize.height() - size.height()) / 2,
+ size.width(), size.height()))
_popwidget.show(1)
def _move(data):
_poplabel.setText(text)
scsize = otk.display.screenInfo(_screen).size()
size = _poplabel.minSize()
- _popwidget.resize(_poplabel.minSize())
- _popwidget.move(otk.Point((scsize.width() - size.width()) / 2,
- (scsize.height() - size.height()) / 2))
+ _popwidget.moveresize(otk.Rect((scsize.width() - size.width()) / 2,
+ (scsize.height() - size.height()) / 2,
+ size.width(), size.height()))
_popwidget.show(1)
def _resize(data):
if current and c.window() == current.window():
self.menupos = i
w.setHighlighted(1)
- pass
- else:
- w.setHighlighted(0)
- pass
self.menuwidgets.append(w)
if c.iconic(): t = c.iconTitle()
# show or hide the list and its child widgets
if len(self.clients) > 1:
size = self.screeninfo.size()
- self.widget.resize(otk.Size(width, height))
- self.widget.move(otk.Point((size.width() - width) / 2,
- (size.height() - height) / 2))
+ self.widget.moveresize(otk.Rect((size.width() - width) / 2,
+ (size.height() - height) / 2,
+ width, height))
self.widget.show(1)
def activatetarget(self, final):