Another update by Manolo.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6989 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2010-01-04 16:57:11 +00:00
parent 339c8e972e
commit e5fed1d0fa

View File

@ -2896,19 +2896,26 @@ static void createAppleMenu(void)
fl_sys_menu_bar->picked(item);
if ( item->flags & FL_MENU_TOGGLE ) {// update the menu toggle symbol
[self setState:(item->value() ? NSOnState : NSOffState)];
}
}
else if ( item->flags & FL_MENU_RADIO ) {// update the menu radio symbols
int from = flRank;
while(from > 0 && items[from - 1].flags & FL_MENU_RADIO) from--;
while( from > 0 && items[from - 1].label() && (items[from - 1].flags & FL_MENU_RADIO) &&
!(items[from - 1].flags & FL_MENU_DIVIDER) ) {
from--;
}
int to = flRank;
while(items[to + 1].flags & FL_MENU_RADIO) to++;
while( !(items[to].flags & FL_MENU_DIVIDER) && items[to + 1].label() &&
(items[to + 1].flags & FL_MENU_RADIO) ) {
to++;
}
NSMenu *nsmenu = [self menu];
int nsrank = (int)[nsmenu indexOfItem:self];
for(int i = from - flRank + nsrank ; i <= to - flRank + nsrank; i++) {
[[nsmenu itemAtIndex:i] setState:NSOffState];
}
if(item->value()) [self setState:NSOnState];
NSMenuItem *nsitem = [nsmenu itemAtIndex:i];
if(nsitem != self) [nsitem setState:NSOffState];
else [nsitem setState:(item->value() ? NSOnState : NSOffState) ];
}
}
}
}
- (void) directCallback:(id)unused