From 4331f5c17901f46693dcb5c2df96276f6851be25 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 8 Oct 2008 18:28:21 +0000 Subject: libui updates, paint namespace, font and palette fixes, button sound --- src/ui/widget.cc | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/ui/widget.cc') diff --git a/src/ui/widget.cc b/src/ui/widget.cc index 11d7427..4ff577c 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -5,8 +5,8 @@ */ #include "auxiliary/functions.h" -#include "render/primitives.h" #include "sys/sys.h" +#include "ui/paint.h" #include "ui/ui.h" #include "ui/widget.h" @@ -17,6 +17,7 @@ Widget::Widget(Widget *parent) { widget_border = true; widget_background = false; widget_palette = 0; + widget_font = 0; widget_label.assign("widget"); if (!parent) { @@ -62,6 +63,14 @@ Palette const *Widget::palette() const { } } +Font const *Widget::font() const { + if (widget_font) { + return widget_font; + } else { + return parent()->font(); + } +} + void Widget::show() { widget_visible = true; @@ -99,6 +108,11 @@ void Widget::set_palette(Palette *palette) widget_palette = palette; } +void Widget::set_font(Font *font) +{ + widget_font = font; +} + void Widget::set_location(float const x, float const y) { widget_location.assign(x, y); } @@ -204,9 +218,8 @@ void Widget::draw_background() if (!widget_background) return; - if (palette()) - render::gl::color(palette()->background()); - render::primitives::rectangle(global_location(), size()); + paint::color(palette()->background()); + paint::rectangle(global_location(), size()); } void Widget::draw_border() @@ -214,9 +227,8 @@ void Widget::draw_border() if (!widget_border) return; - if (palette()) - render::gl::color(palette()->border()); - render::primitives::border(global_location(), size()); + paint::color(palette()->border()); + paint::border(global_location(), size()); } Widget *Widget::find_focus(math::Vector2f const & pos) -- cgit v1.2.3