Is called whenever a new window gets focus to adjust the menu to window specific settings */
| 3346 | specific settings |
| 3347 | */ |
| 3348 | void CsvApplication::updateMenu(int winIndex) { |
| 3349 | #ifndef __APPLE__ |
| 3350 | // Windows/Linux: Set app menu bar to the current top windows menu bar |
| 3351 | appMenuBar = windows[winIndex].getWinMenuBar(); |
| 3352 | #endif |
| 3353 | // find item containing "Disable Undo" or "Enable Undo" |
| 3354 | int disableUndoItem = appMenuBar->find_index("&Edit/" TCRUNCHER_MENU_BAR_DISABLE_UNDO_STRING); |
| 3355 | int undoItem = appMenuBar->find_index("&Edit/&Undo"); |
| 3356 | if( disableUndoItem == -1 ) { |
| 3357 | disableUndoItem = appMenuBar->find_index("&Edit/" TCRUNCHER_MENU_BAR_ENABLE_UNDO_STRING); |
| 3358 | } |
| 3359 | if( undoItem >= 0 ) { |
| 3360 | if( windows[winIndex].isUndoDisabled() ) { |
| 3361 | appMenuBar->replace(disableUndoItem, TCRUNCHER_MENU_BAR_ENABLE_UNDO_STRING); |
| 3362 | int flags = appMenuBar->mode(undoItem); |
| 3363 | appMenuBar->mode(undoItem, flags | FL_MENU_INACTIVE); |
| 3364 | } else { |
| 3365 | appMenuBar->replace(disableUndoItem, TCRUNCHER_MENU_BAR_DISABLE_UNDO_STRING); |
| 3366 | int flags = appMenuBar->mode(undoItem); |
| 3367 | appMenuBar->mode(undoItem, flags & ~FL_MENU_INACTIVE); |
| 3368 | } |
| 3369 | } |
| 3370 | // update recent files |
| 3371 | appMenuBar->updateOpenRecentMenu(recentFiles.getRecentFiles()); |
| 3372 | // update the widget |
| 3373 | appMenuBar->hide(); |
| 3374 | Fl::redraw(); |
| 3375 | appMenuBar->show(); |
| 3376 | Fl::redraw(); |
| 3377 | } |
| 3378 | |
| 3379 | |
| 3380 |
no test coverage detected