diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2007-01-18 19:20:13 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2007-01-18 19:20:13 +0000 |
| commit | 4ee2c1fafa0c72e396a9f91816325b4a8ec6dfbb (patch) | |
| tree | 07043ce9490b0f914471c802338ae07b4b9d8d32 /src | |
| parent | 49e0997c9dff2b2f0852cae58e0157b22d668798 (diff) | |
Somewhat improved the system menu bar for OS X (STR #1505)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5617 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Sys_Menu_Bar.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/Fl_Sys_Menu_Bar.cxx b/src/Fl_Sys_Menu_Bar.cxx index 002689917..e0a464bc7 100644 --- a/src/Fl_Sys_Menu_Bar.cxx +++ b/src/Fl_Sys_Menu_Bar.cxx @@ -178,8 +178,6 @@ static void catMenuFlags( const Fl_Menu_Item *m, char *dst ) { if ( !m->flags ) return; - while ( *dst ) - dst++; if ( m->flags & FL_MENU_INACTIVE ) strcat( dst, "(" ); } @@ -245,27 +243,32 @@ void Fl_Sys_Menu_Bar::menu(const Fl_Menu_Item *m) fl_sys_menu_bar = this; char buf[255]; - int cnt = 1; // first menu is no 2. no 1 is the Apple Menu + int cnt = 1; // first menu is no 2. no 1 is the Apple Menu const Fl_Menu_Item *mm = m; for (;;) { - if ( !mm->text ) + if ( !mm || !mm->text ) break; + char visible = mm->visible() ? 1 : 0; buf[1] = 0; catMenuText( mm->text, buf+1 ); buf[0] = strlen( buf+1 ); MenuHandle mh = NewMenu( ++cnt, (unsigned char*)buf ); + if ( mm->flags & FL_MENU_INACTIVE ) { + ChangeMenuAttributes(mh, kMenuAttrAutoDisable, 0); + DisableAllMenuItems(mh); + DisableMenuItem(mh, 0); + } if ( mm->flags & FL_SUBMENU ) createSubMenu( mh, cnt, ++mm ); - else if ( mm->flags & FL_SUBMENU_POINTER ) - { + else if ( mm->flags & FL_SUBMENU_POINTER ) { const Fl_Menu_Item *smm = (Fl_Menu_Item*)mm->user_data_; createSubMenu( mh, cnt, smm ); } - - InsertMenu( mh, 0 ); - if ( mm->flags & FL_MENU_INACTIVE ) DisableMenuItem( mh, 0 ); + if ( visible ) { + InsertMenu( mh, 0 ); + } mm++; } DrawMenuBar(); |
