diff options
| author | Fabien Costantini <fabien@onepost.net> | 2008-12-16 16:30:26 +0000 |
|---|---|---|
| committer | Fabien Costantini <fabien@onepost.net> | 2008-12-16 16:30:26 +0000 |
| commit | 76bcfdd4dec21466a9aa5ffad3fc3a819255d25c (patch) | |
| tree | c71fec307bb957997dccc146f0e4c7c3ee910346 /src/Fl_Button.cxx | |
| parent | 21b8d6aa1a6c1fbf98df5d11507a6629a528ae82 (diff) | |
patch from STR2026 for testing
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6584 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Button.cxx')
| -rw-r--r-- | src/Fl_Button.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index 044d1e443..3c137db37 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -135,6 +135,13 @@ int Fl_Button::handle(int event) { value(!value()); set_changed(); if (when() & FL_WHEN_CHANGED) do_callback(); + } else if ( (type() == FL_NORMAL_BUTTON) && when()&FL_WHEN_CHANGED) { + // Not already active by GUI push + if ( !value_ ) { + value_ = !oldval; + set_changed(); + do_callback(); + } } else if (when() & FL_WHEN_RELEASE) do_callback(); return 1; case FL_FOCUS : @@ -164,6 +171,36 @@ int Fl_Button::handle(int event) { if (when() & FL_WHEN_RELEASE) do_callback(); return 1; } + return 0; + + case FL_KEYUP : + if ( (type() == FL_NORMAL_BUTTON) && when()&FL_WHEN_CHANGED) { + + int key = Fl::event_key(); + + // Check for a shortcut that includes state keys(FL_SHIFT, FL_CTRL or FL_ALT) and + // the state key is released + if ( (shortcut()&FL_SHIFT && ((key == FL_Shift_L) || (key == FL_Shift_R))) || + (shortcut()&FL_CTRL && ((key == FL_Control_L) || (key == FL_Control_R))) || + (shortcut()&FL_ALT && ((key == FL_Alt_L) || (key == FL_Alt_R))) ) { + value(oldval); + set_changed(); + do_callback(); + return 0; // In case multiple shortcut keys are pressed that use state keys + } + // shortcut key alone + else if ( !(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut())) { + return 0; + } + // disable button + else if ( value_ ) { + value(oldval); + set_changed(); + do_callback(); + return 1; + } + } + default: return 0; } |
