X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbutton.cpp;h=fadd00a0cafedc4dd0d1996f8be7a0ec6ae8fdaf;hb=HEAD;hp=86b73c9daa0c3f8ba9a689ebf628f102667c97f7;hpb=b3234ca0277c5e282a2a0a2558b58edb25750653;p=libs%2Fgltk.git diff --git a/source/button.cpp b/source/button.cpp index 86b73c9..0dd20c7 100644 --- a/source/button.cpp +++ b/source/button.cpp @@ -8,11 +8,9 @@ using namespace std; namespace Msp { namespace GLtk { -Button::Button(const std::string &t): - text(), - icon(0), - pressed(false) +Button::Button(const std::string &t) { + input_type = INPUT_NAVIGATION; set_text(t); } @@ -32,13 +30,13 @@ void Button::set_text(const std::string &t) { text = t; signal_autosize_changed.emit(); - rebuild(); + mark_rebuild(); } void Button::set_icon(const GL::Texture2D *i) { icon = i; - rebuild(); + mark_rebuild(); } void Button::rebuild_special(const Part &part) @@ -102,6 +100,16 @@ void Button::pointer_motion(int x, int y) } } +bool Button::navigate(Navigation nav) +{ + if(nav==NAV_ACTIVATE) + signal_clicked.emit(); + else + return false; + + return true; +} + void Button::on_style_change() { text.set_style(style);