]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/entry.cpp
Make keyboard event handlers indicate whether the event was handled
[libs/gltk.git] / source / entry.cpp
index cee23b02372904317419fc294a17f783fa457589..43dad5e7de46dbcb69569427c083352eee0aabac 100644 (file)
@@ -125,7 +125,7 @@ void Entry::render_special(const Part &part, GL::Renderer &renderer) const
                slider->render(renderer);
 }
 
-void Entry::key_press(unsigned key, unsigned)
+bool Entry::key_press(unsigned key, unsigned)
 {
        got_key_press = true;
        if(key==Input::KEY_LEFT)
@@ -170,16 +170,23 @@ void Entry::key_press(unsigned key, unsigned)
                else
                        signal_enter.emit();
        }
+       else
+               return false;
+
+       return true;
 }
 
-void Entry::character(wchar_t ch)
+bool Entry::character(wchar_t ch)
 {
        if(got_key_press && ch>=' ')
        {
                text.insert(edit_pos, StringCodec::encode<StringCodec::Utf8>(StringCodec::ustring(1, ch)));
                ++edit_pos;
                rebuild();
+               return true;
        }
+
+       return false;
 }
 
 void Entry::focus_out()