Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-08 18:28:21 +0000
committerStijn Buys <ingar@osirion.org>2008-10-08 18:28:21 +0000
commit4331f5c17901f46693dcb5c2df96276f6851be25 (patch)
tree903f70d18c7842121c5409a5ec121e0a565fd5ef /src/ui/widget.cc
parente3b810e1fe8ced1e0245f8d999bdc9136cfcdc70 (diff)
libui updates, paint namespace, font and palette fixes, button sound
Diffstat (limited to 'src/ui/widget.cc')
-rw-r--r--src/ui/widget.cc26
1 files changed, 19 insertions, 7 deletions
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)