bool SystemKeyboardInput::key_press(unsigned key)
{
+ if(!root.is_visible())
+ return false;
+
// TODO modifiers
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;
}
bool SystemKeyboardInput::key_release(unsigned key)
{
- return root.key_release(key, 0);
+ if(root.is_visible())
+ return root.key_release(key, 0);
+ else
+ return false;
}
bool SystemKeyboardInput::character(StringCodec::unichar ch)
{
- return root.character(ch);
+ if(root.is_visible())
+ return root.character(ch);
+ else
+ return false;
}
} // namespace GLtk