X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwidget.cpp;h=e20ea82b56fcf085a2cab9a8eb7a1e0e96aaad19;hb=c2635c5a3dca6a6cea5562fd387beb0662b18cf0;hp=7f153eb5540e4462bfa57645fab2b113cfb06a8b;hpb=bcdbb414c5f1abe860cad6bb67fd5da7c0122cfd;p=libs%2Fgltk.git diff --git a/source/widget.cpp b/source/widget.cpp index 7f153eb..e20ea82 100644 --- a/source/widget.cpp +++ b/source/widget.cpp @@ -1,14 +1,27 @@ +/* $Id$ + +This file is part of libmspgltk +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #include #include #include "resources.h" #include "widget.h" -#include using namespace std; namespace Msp { namespace GLtk { +Widget::Widget(const Resources &r): + res(r), + style(0), + state(NORMAL), + visible(true) +{ } + void Widget::set_position(int x, int y) { geom.x=x; @@ -44,17 +57,6 @@ void Widget::render() const GL::pop_matrix(); } -Widget::Widget(const Resources &r): - res(r), - style(0), - state(NORMAL) -{ } - -void Widget::update_style() -{ - style=&res.get_style(get_class(), style_name); -} - void Widget::render_part(const Part &part) const { render_graphic(part); @@ -79,7 +81,7 @@ void Widget::render_text(const Part &part, const string &text) const part.get_alignment().apply(geom, text_w, static_cast(font->get_ascent()*font_size)); GL::scale_uniform(font_size); - const Color &color=style->get_font_color(); + const GL::Color &color=style->get_font_color(); glColor3f(color.r, color.g, color.b); font->draw_string(text); glColor3f(1, 1, 1); @@ -87,5 +89,41 @@ void Widget::render_text(const Part &part, const string &text) const GL::pop_matrix(); } +void Widget::update_style() +{ + string sname=get_class(); + if(!style_name.empty()) + { + sname+='-'; + sname+=style_name; + } + style=res.get