Implement the keyboard focus for the text widget.

Now it should be clear which widget has the keyboard focus.
This commit is contained in:
Mark de Wever 2009-02-10 19:47:39 +00:00
parent c2894fd803
commit 9efa34b263
3 changed files with 20 additions and 2 deletions

View file

@ -89,8 +89,6 @@
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
{_GUI_DRAW_CURSOR ({X_OFFSET}) }
[/draw]
[/state_enabled]

View file

@ -61,6 +61,20 @@ void ttext_::mouse_middle_button_click(tevent_handler&)
}
void ttext_::recieve_keyboard_focus(tevent_handler& /*event_handler*/)
{
DBG_G_E << "Text: recieve focus.\n";
set_state(FOCUSSED);
}
void ttext_::lose_keyboard_focus(tevent_handler& /*event_handler*/)
{
DBG_G_E << "Text: lose focus.\n";
set_state(ENABLED);
}
void ttext_::key_press(tevent_handler& /*event*/,
bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode)
{

View file

@ -55,6 +55,12 @@ public:
/** Inherited from tevent_executor. */
void mouse_middle_button_click(tevent_handler&);
/** Inherited from tevent_executor. */
void recieve_keyboard_focus(tevent_handler& event_handler);
/** Inherited from tevent_executor. */
void lose_keyboard_focus(tevent_handler& event_handler);
/** Inherited from tevent_executor. */
void key_press(tevent_handler& event,
bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode);