diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-02-08 08:59:24 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-02-08 08:59:24 +0000 |
| commit | ef231de58a738c83bf505e184fbafa9077f7452e (patch) | |
| tree | ffdfa60aea48424d925393efea433b1313b6e9a7 /otk | |
| parent | ee9eaed6cd48db249711912133758679a029b5b1 (diff) | |
mad optimizations
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/button.cc | 3 | ||||
| -rw-r--r-- | otk/label.cc | 9 | ||||
| -rw-r--r-- | otk/widget.cc | 10 | ||||
| -rw-r--r-- | otk/widget.hh | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/otk/button.cc b/otk/button.cc index 1e128784..c0f48100 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -12,7 +12,6 @@ Button::Button(Widget *parent) : Label(parent), _pressed(false) { - setHighlighted(false); setHorizontalJustify(RenderStyle::CenterJustify); setVerticalJustify(RenderStyle::CenterJustify); styleChanged(*RenderStyle::style(screen())); @@ -70,7 +69,7 @@ void Button::styleChanged(const RenderStyle &style) _texture = style.buttonUnpressUnfocusBackground(); _forecolor = style.buttonUnfocusColor(); } - Widget::styleChanged(style); + refresh(); } } diff --git a/otk/label.cc b/otk/label.cc index c56f91f8..16fa25a0 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -17,7 +17,7 @@ Label::Label(Widget *parent) _text(""), _justify_horz(RenderStyle::LeftTopJustify), _justify_vert(RenderStyle::LeftTopJustify), - _highlight(true) + _highlight(false) { styleChanged(*RenderStyle::style(screen())); } @@ -92,9 +92,10 @@ void Label::styleChanged(const RenderStyle &style) _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) diff --git a/otk/widget.cc b/otk/widget.cc index 612a252d..8ab57708 100644 --- a/otk/widget.cc +++ b/otk/widget.cc @@ -61,7 +61,7 @@ Widget::Widget(Widget *parent, Direction direction, int bevel) assert(parent); createWindow(false); parent->addChild(this); - parent->layout(); + if (parent->visible()) parent->layout(); _dispatcher->registerHandler(_window, this); } @@ -80,8 +80,9 @@ void Widget::show(bool children) { 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; @@ -107,6 +108,7 @@ void Widget::setEventMask(long e) void Widget::update() { + if (!_visible) return; _dirty = true; if (parent()) parent()->layout(); // relay-out us and our siblings @@ -224,6 +226,7 @@ void Widget::setBevel(int b) void Widget::layout() { + if (_children.empty() || !_visible) return; if (_direction == Horizontal) layoutHorz(); else @@ -470,6 +473,9 @@ void Widget::configureHandler(const XConfigureEvent &e) 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; diff --git a/otk/widget.hh b/otk/widget.hh index 2e4de47e..5c366503 100644 --- a/otk/widget.hh +++ b/otk/widget.hh @@ -77,7 +77,7 @@ public: 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); } |
