From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/ui/widget.cc | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/ui/widget.cc') diff --git a/src/ui/widget.cc b/src/ui/widget.cc index b1157d5..2e2f291 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -22,13 +22,13 @@ Widget::Widget(Widget *parent) widget_palette = 0; widget_font = 0; widget_label.assign("widget"); - + if (!parent) { widget_parent = root(); } else { widget_parent = parent; } - + if (widget_parent) widget_parent->add_child(this); } @@ -55,7 +55,7 @@ size_t Widget::list(const size_t indent, const bool visible_only) const print(indent); size_t n = 1; for (Children::const_iterator it = widget_children.begin(); it != widget_children.end(); it++) { - n += (*it)->list(indent+1, visible_only); + n += (*it)->list(indent + 1, visible_only); } return n; } @@ -94,7 +94,7 @@ void Widget::lower() { if (!parent()) return; - + Children::iterator it = parent()->find_child(this); if (it != parent()->children().end()) { parent()->children().erase(it); @@ -106,7 +106,7 @@ void Widget::raise() { if (!parent()) return; - + Children::iterator it = parent()->find_child(this); if (it != parent()->children().end()) { parent()->children().erase(it); @@ -120,11 +120,11 @@ void Widget::set_focus() widget_focus = true; return; } - + for (Children::iterator it = parent()->children().begin(); it != parent()->children().end(); it++) { (*it)->widget_focus = false; } - + widget_focus = true; } @@ -138,7 +138,7 @@ void Widget::hide() widget_visible = false; if (parent() && focus()) { Widget::Children::reverse_iterator it = parent()->children().rbegin(); - + while (it != parent()->children().rend()) { Widget *w = (*it); if (w != this && w->visible()) { @@ -185,7 +185,7 @@ void Widget::set_label(char const *label) aux::to_label(widget_label); } else { widget_label.clear(); - } + } } void Widget::set_palette(const Palette *palette) @@ -247,7 +247,7 @@ Widget::Children::iterator Widget::find_child(Widget *child) if ((*it) == child) return it; } - + return it; } @@ -274,7 +274,7 @@ Widget *Widget::find_input_focus() { if (!visible() || !widget_focus) return 0; - + for (Children::reverse_iterator rit = widget_children.rbegin(); rit != widget_children.rend(); ++rit) { Widget *w = (*rit); if (w->visible() && w->widget_focus) { @@ -283,7 +283,7 @@ Widget *Widget::find_input_focus() return f; } } - + // no child with input focus return this; } @@ -293,7 +293,7 @@ Widget *Widget::find_mouse_focus(const math::Vector2f & pos) // this widget is not visible if (!visible() || !size().contains(pos)) return 0; - + // reverse-iterate children for (Children::reverse_iterator rit = widget_children.rbegin(); rit != widget_children.rend(); ++rit) { Widget *w = (*rit); @@ -302,9 +302,9 @@ Widget *Widget::find_mouse_focus(const math::Vector2f & pos) if (f) return f; } - + } - + // no child with mouse focus return this; } @@ -324,16 +324,16 @@ bool Widget::has_input_focus() const bool Widget::event_key(const bool pressed, const int key, const unsigned int modifier) { bool handled = false; - + if (pressed) { handled = on_keypress(key, modifier); } else { handled = on_keyrelease(key, modifier); } - + if (!handled && parent()) handled = parent()->event_key(pressed, key, modifier); - + return handled; } @@ -341,11 +341,11 @@ bool Widget::event_mouse(const math::Vector2f &cursor) { math::Vector2f local_cursor = to_local_coords(cursor); bool handled = false; - + if (root()->mouse_focus() != this) { on_mouseover(local_cursor); } - + on_mousemove(local_cursor); return handled; } @@ -354,7 +354,7 @@ void Widget::event_draw() { if (!visible()) return; - + if (widget_background) draw_background(); if (widget_border) @@ -362,7 +362,7 @@ void Widget::event_draw() if (debug()) draw_debug_border(); draw(); - + for (Children::iterator it = widget_children.begin(); it != widget_children.end(); it++) { if ((*it)->visible()) (*it)->event_draw(); -- cgit v1.2.3