]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/systemkeyboardinput.cpp
Implement keyboard navigation for most widgets
[libs/gltk.git] / source / systemkeyboardinput.cpp
index cedddd1817d170b21c6f34eb3ac7fec07d3951ec..fe803a6ddd2e407abbe1cdbcadaed5ec4ce989da 100644 (file)
@@ -20,6 +20,18 @@ bool SystemKeyboardInput::key_press(unsigned key)
        if(root.key_press(key, 0))
                return true;
        
+       switch(key)
+       {
+       case Input::KEY_LEFT: return root.navigate(NAV_LEFT);
+       case Input::KEY_RIGHT: return root.navigate(NAV_RIGHT);
+       case Input::KEY_UP: return root.navigate(NAV_UP);
+       case Input::KEY_DOWN: return root.navigate(NAV_DOWN);
+       case Input::KEY_TAB: return root.navigate(NAV_NEXT);
+       case Input::KEY_SPACE: return root.navigate(NAV_ACTIVATE);
+       case Input::KEY_ENTER: return root.navigate(NAV_ACCEPT);
+       case Input::KEY_ESC: return root.navigate(NAV_CANCEL);
+       }
+
        return false;
 }