X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fentry.cpp;h=16954a70f5774858b34b86622de200abe2a4376b;hb=4b52d16bc895f9d969383d7a7d6a3558c1972cc5;hp=cee23b02372904317419fc294a17f783fa457589;hpb=1afb4f8d6379ad1bf832692fbfedef9714ee3ff5;p=libs%2Fgltk.git diff --git a/source/entry.cpp b/source/entry.cpp index cee23b0..16954a7 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -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::ustring(1, ch))); ++edit_pos; rebuild(); + return true; } + + return false; } void Entry::focus_out()