mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
CHANGES IN FLTK 1.1.8
|
CHANGES IN FLTK 1.1.8
|
||||||
|
|
||||||
|
- OS X system menu bar itop level attribute support
|
||||||
|
improved (STR #1505)
|
||||||
- Fixed Quartz image drawing bug (STR #1438)
|
- Fixed Quartz image drawing bug (STR #1438)
|
||||||
- Fixed Quartz fl_read_image
|
- Fixed Quartz fl_read_image
|
||||||
- Overlay drawing is now avoiding XOR mode (STR #1438)
|
- Overlay drawing is now avoiding XOR mode (STR #1438)
|
||||||
|
|||||||
+11
-8
@@ -178,8 +178,6 @@ static void catMenuFlags( const Fl_Menu_Item *m, char *dst )
|
|||||||
{
|
{
|
||||||
if ( !m->flags )
|
if ( !m->flags )
|
||||||
return;
|
return;
|
||||||
while ( *dst )
|
|
||||||
dst++;
|
|
||||||
if ( m->flags & FL_MENU_INACTIVE )
|
if ( m->flags & FL_MENU_INACTIVE )
|
||||||
strcat( dst, "(" );
|
strcat( dst, "(" );
|
||||||
}
|
}
|
||||||
@@ -245,27 +243,32 @@ void Fl_Sys_Menu_Bar::menu(const Fl_Menu_Item *m)
|
|||||||
fl_sys_menu_bar = this;
|
fl_sys_menu_bar = this;
|
||||||
|
|
||||||
char buf[255];
|
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;
|
const Fl_Menu_Item *mm = m;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if ( !mm->text )
|
if ( !mm || !mm->text )
|
||||||
break;
|
break;
|
||||||
|
char visible = mm->visible() ? 1 : 0;
|
||||||
buf[1] = 0;
|
buf[1] = 0;
|
||||||
catMenuText( mm->text, buf+1 );
|
catMenuText( mm->text, buf+1 );
|
||||||
buf[0] = strlen( buf+1 );
|
buf[0] = strlen( buf+1 );
|
||||||
MenuHandle mh = NewMenu( ++cnt, (unsigned char*)buf );
|
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 )
|
if ( mm->flags & FL_SUBMENU )
|
||||||
createSubMenu( mh, cnt, ++mm );
|
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_;
|
const Fl_Menu_Item *smm = (Fl_Menu_Item*)mm->user_data_;
|
||||||
createSubMenu( mh, cnt, smm );
|
createSubMenu( mh, cnt, smm );
|
||||||
}
|
}
|
||||||
|
if ( visible ) {
|
||||||
InsertMenu( mh, 0 );
|
InsertMenu( mh, 0 );
|
||||||
if ( mm->flags & FL_MENU_INACTIVE ) DisableMenuItem( mh, 0 );
|
}
|
||||||
mm++;
|
mm++;
|
||||||
}
|
}
|
||||||
DrawMenuBar();
|
DrawMenuBar();
|
||||||
|
|||||||
Reference in New Issue
Block a user