Update comment and set the handled flag properly.

This commit is contained in:
Mark de Wever 2009-07-10 21:01:57 +00:00
parent d6dcef068c
commit 4613a2f5ac
2 changed files with 15 additions and 2 deletions

View file

@ -91,7 +91,9 @@ void ttext_::key_press(tevent_handler& /*event*/,
#endif
if(key_press_callback_) {
if(key_press_callback_(this, key, modifier, unicode)) return;
if((handled = key_press_callback_(this, key, modifier, unicode))) {
return;
}
}
switch(key) {

View file

@ -396,7 +396,18 @@ protected:
virtual void handle_key_default(
bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode);
/** Key press callback */
/**
* Key press callback.
*
* This callback is called in key_press before the other functions. The
* return value of this function sets the handled flag. If handled the
* key_press function will stop its execution. The parameters to the
* function are:
* - The widget invoking the callback
* - The SDL key code, needed for special keys.
* - The keyboard modifiers when the key was pressed.
* - The unicode for the pressed key.
*/
boost::function< bool (twidget*, SDLKey, SDLMod, Uint16) > key_press_callback_;
};