]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/button.cpp
Implement keyboard navigation for most widgets
[libs/gltk.git] / source / button.cpp
index 86b73c9daa0c3f8ba9a689ebf628f102667c97f7..fadd00a0cafedc4dd0d1996f8be7a0ec6ae8fdaf 100644 (file)
@@ -13,6 +13,7 @@ Button::Button(const std::string &t):
        icon(0),
        pressed(false)
 {
+       input_type = INPUT_NAVIGATION;
        set_text(t);
 }
 
@@ -102,6 +103,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);