diff options
author | Sebastian Geerken <devnull@localhost> | 2013-01-29 18:28:36 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-01-29 18:28:36 +0100 |
commit | ff62d018ba1434f9e9d5beb3a2c82fb1c4ed0f85 (patch) | |
tree | fa3e74abe72781b63468677ed024f68cf62aff06 /dw/fltkui.cc | |
parent | b8270ee350357ef491fa9ba92cf6250258d3099c (diff) | |
parent | d8f1e1bcfa59947b0dabc7a1ec61232d2eb5535e (diff) |
Merge with main repo.
Diffstat (limited to 'dw/fltkui.cc')
-rw-r--r-- | dw/fltkui.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 69473cb9..f5a2339b 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -107,8 +107,11 @@ int CustChoice::handle(int e) this, e, active(), (Fl::focus() == this)); if (Fl::focus() != this) { ; // Not Focused, let FLTK handle it - } else if (e == FL_KEYDOWN) { - if (modifier == 0 && isalnum(k)) { + } else if (e == FL_KEYDOWN && modifier == 0) { + if (k == FL_Enter || k == FL_Down) { + return Fl_Choice::handle(FL_PUSH); // activate menu + + } else if (isalnum(k)) { // try key as shortcut to menuitem int t = value()+1 >= size() ? 0 : value()+1; while (t != value()) { const Fl_Menu_Item *mi = &(menu()[t]); @@ -700,6 +703,20 @@ void FltkEntryResource::setMaxLength (int maxlen) // ---------------------------------------------------------------------- +static int kf_backspace_word (int c, Fl_Text_Editor *e) +{ + int p1, p2 = e->insert_position(); + + e->previous_word(); + p1 = e->insert_position(); + e->buffer()->remove(p1, p2); + e->show_insert_position(); + e->set_changed(); + if (e->when() & FL_WHEN_CHANGED) + e->do_callback(); + return 0; +} + FltkMultiLineTextResource::FltkMultiLineTextResource (FltkPlatform *platform, int cols, int rows): FltkSpecificResource <dw::core::ui::MultiLineTextResource> (platform) @@ -741,6 +758,9 @@ Fl_Widget *FltkMultiLineTextResource::createNewWidget (core::Allocation allocation->ascent + allocation->descent); text->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0); text->buffer (buffer); + text->remove_key_binding(FL_BackSpace, FL_TEXT_EDITOR_ANY_STATE); + text->add_key_binding(FL_BackSpace, 0, Fl_Text_Editor::kf_backspace); + text->add_key_binding(FL_BackSpace, FL_CTRL, kf_backspace_word); return text; } |