* Calls window callback function with 0 (for ESC or red Close Win Button) or TCRUNCHER_MYFLCHOICE_MAGICAL for pressing ENTER */
| 131 | * Calls window callback function with 0 (for ESC or red Close Win Button) or TCRUNCHER_MYFLCHOICE_MAGICAL for pressing ENTER |
| 132 | */ |
| 133 | int My_Fl_Small_Window::handle(int event) { |
| 134 | switch( event ) { |
| 135 | case FL_KEYBOARD: |
| 136 | if( Fl::event_command() && Fl::event_key() == 'w' && !Fl::event_shift() && !Fl::event_ctrl() && !Fl::event_alt() ) { |
| 137 | do_callback(this, -1); // the same as pressing ESC |
| 138 | return 1; // TODO needed? |
| 139 | } |
| 140 | if( Fl::event_key() == FL_Enter && !Fl::event_command() && !Fl::event_shift() && !Fl::event_ctrl() && !Fl::event_alt() ) { |
| 141 | // https://www.fltk.org/doc-1.3/classFl__Widget.html#a8bf5537fae51a9891a330d4c6b6e499b |
| 142 | // Call the callback with the magical number => Enter has been pressed |
| 143 | do_callback(this, TCRUNCHER_MYFLCHOICE_MAGICAL); |
| 144 | return 1; // TODO needed? |
| 145 | } |
| 146 | if( Fl::event_key() == '+' && Fl::event_command() && !Fl::event_shift() && !Fl::event_ctrl() && !Fl::event_alt() ) { |
| 147 | // override CMD plus |
| 148 | return 1; |
| 149 | } |
| 150 | if( Fl::event_key() == '-' && Fl::event_command() && !Fl::event_shift() && !Fl::event_ctrl() && !Fl::event_alt() ) { |
| 151 | // override CMD minus |
| 152 | return 1; |
| 153 | } |
| 154 | break; |
| 155 | case FL_FOCUS: |
| 156 | gotFocus(); |
| 157 | break; |
| 158 | } |
| 159 | if( !windows[app.getTopWindow()].grid->areEventsAllowed() ) { |
| 160 | return 1; |
| 161 | } else { |
| 162 | return(Fl_Window::handle(event)); |
| 163 | } |
| 164 | } |
| 165 | void My_Fl_Small_Window::gotFocus() { |
| 166 | // can be overwritten for single windows |
| 167 | // printf("A Small Window got focus!\n"); |
nothing calls this directly
no test coverage detected