when setting family in ns_spec_to_descriptor(). */
if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50F)
traits |= NSBoldFontMask;
- if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05F))
+ if (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05F)
traits |= NSItalicFontMask;
/* see https://web.archive.org/web/20100201175731/http://cocoadev.com/forums/comments.php?DiscussionID=74 */
id menu = [NSApp mainMenu];
for (int i = [menu numberOfItems] - 1 ; i >= 0; i--)
{
- NSMenuItem *item = [menu itemAtIndex:i];
+ NSMenuItem *item = (NSMenuItem *)[menu itemAtIndex:i];
NSString *title = [item title];
if ([ns_app_name isEqualToString:title])
if (i < [menu numberOfItems])
{
NSString *titleStr = [NSString stringWithUTF8String: wv->name];
- NSMenuItem *item = [menu itemAtIndex:i];
+ NSMenuItem *item = (NSMenuItem *)[menu itemAtIndex:i];
submenu = (EmacsMenu*)[item submenu];
[item setTitle:titleStr];
else
submenu = [menu addSubmenuWithTitle: wv->name];
+#ifdef NS_IMPL_COCOA
if ([[submenu title] isEqualToString:@"Help"])
[NSApp setHelpMenu:submenu];
+#endif
if (deep_p)
[submenu fillWithWidgetValue: wv->contents];
if (menu_separator_name_p (wv->name))
{
- item = [NSMenuItem separatorItem];
+ item = (NSMenuItem *)[NSMenuItem separatorItem];
}
else
{
needsUpdate = YES;
}
-
+#ifdef NS_IMPL_COCOA
typedef struct {
const char *from, *to;
} subst_t;
xfree (buf);
return SSDATA (result);
}
+#endif /* NS_IMPL_COCOA */
- (void)fillWithWidgetValue: (void *)wvptr
{
widget_value *first_wv = (widget_value *)wvptr;
- NSFont *menuFont = [NSFont menuFontOfSize:0];
NSDictionary *attributes = nil;
#ifdef NS_IMPL_COCOA
/* Cocoa doesn't allow multi-key sequences in its menu display, so
work around it by using tabs to split the title into two
columns. */
+ NSFont *menuFont = [NSFont menuFontOfSize:0];
NSDictionary *font_attribs = @{NSFontAttributeName: menuFont};
CGFloat maxNameWidth = 0;
CGFloat maxKeyWidth = 0;
- (EmacsMenu *)addSubmenuWithTitle: (const char *)title
{
NSString *titleStr = [NSString stringWithUTF8String: title];
- NSMenuItem *item = [self addItemWithTitle: titleStr
- action: (SEL)nil /*@selector (menuDown:) */
- keyEquivalent: @""];
+ NSMenuItem *item = (NSMenuItem *)[self addItemWithTitle: titleStr
+ action: (SEL)nil
+ keyEquivalent: @""];
EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr];
[self setSubmenu: submenu forItem: item];
[submenu release];
: Qnil;
}
+#ifdef NS_IMPL_GNUSTEP
+/* GNUstep seems to have a number of required methods in
+ NSMenuDelegate that are optional in Cocoa. */
+
+- (void) menuWillOpen:(NSMenu *)menu
+{
+}
+- (void) menuDidClose:(NSMenu *)menu
+{
+}
+- (NSRect)confinementRectForMenu:(NSMenu *)menu
+ onScreen:(NSScreen *)screen
+{
+ return NSZeroRect;
+}
+- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
+{
+}
+#endif
+
@end /* EmacsMenu */