]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/entry.cpp
Add an input method subsystem
[libs/gltk.git] / source / entry.cpp
index cee23b02372904317419fc294a17f783fa457589..16954a70f5774858b34b86622de200abe2a4376b 100644 (file)
@@ -25,6 +25,7 @@ Entry::Entry(const string &t):
        slider(0),
        got_key_press(false)
 {
+       input_type = INPUT_TEXT;
        set_text(t);
 }
 
@@ -125,7 +126,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 +171,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()