X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbutton.cpp;h=e7548386e0467cd6f8caec148973098b2fe7bffa;hb=6081ed9020ad22214a8e5b3829092f97b12d7c71;hp=aecfd32fe0d004a56c8201d0da5f33f32599c636;hpb=1a5f227ac945bc9e6449d1552e5d9eb4c1c196fb;p=libs%2Fgltk.git diff --git a/source/button.cpp b/source/button.cpp index aecfd32..e754838 100644 --- a/source/button.cpp +++ b/source/button.cpp @@ -14,11 +14,12 @@ namespace GLtk { Button::Button(const Resources &r, const std::string &t): Widget(r), + text(), icon(0), pressed(false) { - set_text(t); update_style(); + set_text(t); } void Button::set_text(const std::string &t) @@ -66,7 +67,7 @@ void Button::pointer_motion(int x, int y) void Button::render_special(const Part &part) const { if(part.get_name()=="text") - render_text(part, text); + text.render(part, geom); if(part.get_name()=="icon" && icon) { Geometry rgeom; @@ -91,16 +92,21 @@ void Button::render_special(const Part &part) const } } +void Button::on_style_change() +{ + text.set_style(style); +} + Button::Loader::Loader(Button &btn): Widget::Loader(btn) { - add("text", &Button::text); + add("text", &Loader::text); } -Button &Button::Loader::get_object() const +void Button::Loader::text(const std::string &t) { - return static_cast