summaryrefslogtreecommitdiff
path: root/src/Fl_MacOS_Sys_Menu_Bar.mm
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-01 18:03:10 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-06 20:28:20 +0200
commitf09e17c3c564e8310125a10c03397cbf473ff643 (patch)
tree8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/Fl_MacOS_Sys_Menu_Bar.mm
parentb0e0c355edaa2e23148cb0260ada907aec930f05 (diff)
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files - update .fl files and generated files accordingly - replace 'http://www.fltk.org' URL's with 'https://...' - replace bug report URL 'str.php' with 'bugs.php' - remove trailing whitespace - fix other whitespace errors flagged by Git - add and/or fix missing or wrong standard headers - convert tabs to spaces in all source files The only relevant code changes are in the fluid/ folder where some .fl files and other source files were used to generate the '$Id' headers and footers.
Diffstat (limited to 'src/Fl_MacOS_Sys_Menu_Bar.mm')
-rw-r--r--src/Fl_MacOS_Sys_Menu_Bar.mm46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/Fl_MacOS_Sys_Menu_Bar.mm b/src/Fl_MacOS_Sys_Menu_Bar.mm
index f75db1d81..7f7abba2e 100644
--- a/src/Fl_MacOS_Sys_Menu_Bar.mm
+++ b/src/Fl_MacOS_Sys_Menu_Bar.mm
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// MacOS system menu bar widget for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
@@ -9,11 +7,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
#if defined(__APPLE__)
@@ -115,10 +113,10 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
const Fl_Menu_Item *item = [self getFlItem];
menu->picked(item);
Fl::flush();
- if ( item->flags & FL_MENU_TOGGLE ) { // update the menu toggle symbol
+ 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
+ else if ( item->flags & FL_MENU_RADIO ) { // update the menu radio symbols
NSMenu* this_menu = [self menu];
NSInteger flRank = [this_menu indexOfItem:self];
NSInteger last = [this_menu numberOfItems] - 1;
@@ -174,11 +172,11 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
{
// Separate key and modifier
int mod = key;
- mod &= ~FL_KEY_MASK; // modifier(s)
- key &= FL_KEY_MASK; // key
+ mod &= ~FL_KEY_MASK; // modifier(s)
+ key &= FL_KEY_MASK; // key
unichar mac_key = (unichar)key;
if ( (key >= (FL_F+1)) && (key <= FL_F_Last) ) { // Handle function keys
- int fkey_num = (key - FL_F); // 1,2..
+ int fkey_num = (key - FL_F); // 1,2..
mac_key = NSF1FunctionKey + fkey_num - 1;
}
[self setKeyEquivalent:[NSString stringWithCharacters:&mac_key length:1]];
@@ -190,8 +188,8 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
NSString *title = NSLocalizedString([NSString stringWithUTF8String:name], nil);
free(name);
FLMenuItem *item = [[FLMenuItem alloc] initWithTitle:title
- action:selector
- keyEquivalent:@""];
+ action:selector
+ keyEquivalent:@""];
// >= 0 if mitem is in the menu items of fl_sys_menu_bar, -1 if not
NSInteger index = (fl_sys_menu_bar ? fl_sys_menu_bar->find_index(mitem) : -1);
[item setTag:index];
@@ -239,7 +237,7 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
#endif
@end
-
+
void Fl_MacOS_Sys_Menu_Bar_Driver::about( Fl_Callback *cb, void *user_data)
{
Fl_Menu_Item aboutItem;
@@ -249,9 +247,9 @@ void Fl_MacOS_Sys_Menu_Bar_Driver::about( Fl_Callback *cb, void *user_data)
NSMenu *appleMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu];
CFStringRef cfname = CFStringCreateCopy(NULL, (CFStringRef)[[appleMenu itemAtIndex:0] title]);
[appleMenu removeItemAtIndex:0];
- FLMenuItem *item = [[[FLMenuItem alloc] initWithTitle:(NSString*)cfname
- action:@selector(directCallback)
- keyEquivalent:@""] autorelease];
+ FLMenuItem *item = [[[FLMenuItem alloc] initWithTitle:(NSString*)cfname
+ action:@selector(directCallback)
+ keyEquivalent:@""] autorelease];
NSData *pointer = [NSData dataWithBytes:&aboutItem length:sizeof(Fl_Menu_Item)];
[item setRepresentedObject:pointer];
[appleMenu insertItem:item atIndex:0];
@@ -264,7 +262,7 @@ void Fl_MacOS_Sys_Menu_Bar_Driver::about( Fl_Callback *cb, void *user_data)
*/
static void setMenuShortcut( NSMenu* mh, int miCnt, const Fl_Menu_Item *m )
{
- if ( !m->shortcut_ )
+ if ( !m->shortcut_ )
return;
if ( m->flags & FL_SUBMENU )
return;
@@ -319,7 +317,7 @@ static void createSubMenu( NSMenu *mh, pFl_Menu_Item &mm, const Fl_Menu_Item *m
{
NSMenu *submenu;
int miCnt, flags;
-
+
if (mitem) {
NSMenuItem *menuItem;
char *ts = remove_ampersand(mitem->text);
@@ -327,7 +325,7 @@ static void createSubMenu( NSMenu *mh, pFl_Menu_Item &mm, const Fl_Menu_Item *m
free(ts);
submenu = [[NSMenu alloc] initWithTitle:(NSString*)title];
[submenu setAutoenablesItems:NO];
-
+
int cnt;
cnt = [mh numberOfItems];
cnt--;
@@ -335,7 +333,7 @@ static void createSubMenu( NSMenu *mh, pFl_Menu_Item &mm, const Fl_Menu_Item *m
[menuItem setSubmenu:submenu];
[submenu release];
} else submenu = mh;
-
+
while ( mm->text ) {
if (!mm->visible() ) { // skip invisible items and submenus
mm = mm->next(0);
@@ -365,7 +363,7 @@ static void createSubMenu( NSMenu *mh, pFl_Menu_Item &mm, const Fl_Menu_Item *m
mm++;
}
}
-
+
/*
* convert a complete Fl_Menu_Item array into a series of menus in the top menu bar
@@ -490,7 +488,7 @@ int Fl_MacOS_Sys_Menu_Bar_Driver::insert(int index, const char* label, int short
/** \class Fl_Mac_App_Menu
Mac OS-specific class allowing to customize and localize the application menu.
-
+
The public class attributes are used to build the application menu. They can be localized
at run time to any UTF-8 text by placing instructions such as this before fl_open_display()
gets called:
@@ -666,7 +664,3 @@ void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut) {
}
#endif /* __APPLE__ */
-
-//
-// End of "$Id$".
-//