From: Mikko Rasa Date: Fri, 23 Nov 2007 16:01:17 +0000 (+0000) Subject: Support loading Buttons from datafiles X-Git-Tag: 0.9~26 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a38c924ff32081f5cd67c2b0e2d5ca61f0e99de2;p=libs%2Fgltk.git Support loading Buttons from datafiles Support repeated borders in Graphic Fix coordinate handling in Root Use the HOVER state in Button --- diff --git a/source/button.cpp b/source/button.cpp index 2c8bedb..543782e 100644 --- a/source/button.cpp +++ b/source/button.cpp @@ -26,12 +26,26 @@ void Button::button_release(int x, int y, unsigned btn) { if(btn==1) { - state=NORMAL; if(geom.is_inside(x, y)) + { signal_clicked.emit(); + state=HOVER; + } + else + state=NORMAL; } } +void Button::pointer_enter() +{ + state=HOVER; +} + +void Button::pointer_leave() +{ + state=NORMAL; +} + void Button::render_part(const Part &part) const { if(part.get_name()=="text") @@ -40,5 +54,17 @@ void Button::render_part(const Part &part) const Widget::render_part(part); } + +Button::Loader::Loader(Button &btn): + Widget::Loader(btn) +{ + add("text", &Button::text); +} + +Button &Button::Loader::get_object() const +{ + return static_cast