/* Definitions and headers for communication with NeXT/Open/GNUstep API.
- Copyright (C) 1989, 1993, 2005, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1993, 2005, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "frame.h"
#include "character.h"
#include "font.h"
+#include "sysselect.h"
#ifdef HAVE_NS
@class EmacsToolbar;
-@interface EmacsView : NSView <NSTextInput>
+@interface EmacsView : NSView <NSTextInput> /* 10.6+: NSWindowDelegate */
{
char *old_title;
BOOL windowClosing;
========================================================================== */
-@interface EmacsMenu : NSMenu
+@interface EmacsMenu : NSMenu /* 10.6+: <NSMenuDelegate> */
{
struct frame *frame;
unsigned long keyEquivModMask;
- initWithTitle: (NSString *)title frame: (struct frame *)f;
- (void)setFrame: (struct frame *)f;
- (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
-- (NSString *)parseKeyEquiv: (char *)key;
+- (NSString *)parseKeyEquiv: (const char *)key;
- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
- (void)fillWithWidgetValue: (void *)wvptr;
-- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f;
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
- (void) clear;
- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
keymaps: (int)keymaps;
@class EmacsImage;
-@interface EmacsToolbar : NSToolbar
+@interface EmacsToolbar : NSToolbar /* 10.6+: <NSToolbarDelegate> */
{
EmacsView *emacsView;
NSMutableDictionary *identifierToItem;
- (void) clearActive;
- (BOOL) changed;
- (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx
- helpText: (char *)help
+ helpText: (const char *)help
enabled: (BOOL)enabled;
/* delegate methods */
- (NSToolbarItem *)toolbar: (NSToolbar *)toolbar
- (Lisp_Object)runDialogAt: (NSPoint)p;
@end
-@interface EmacsTooltip : NSObject
+@interface EmacsTooltip : NSObject /* 10.6+: <NSWindowDelegate> */
{
NSWindow *win;
NSTextField *textField;
@end
#endif /* NS_IMPL_COCOA */
-
-/* ==========================================================================
-
- Running the preferences window
-
- ========================================================================== */
-
-@interface EmacsPrefsController : NSObject
-{
- struct frame *frame;
- IBOutlet NSWindow *prefsWindow;
- IBOutlet NSPopUpButton *alternateModMenu;
- IBOutlet NSPopUpButton *commandModMenu;
-#ifdef NS_IMPL_COCOA
- IBOutlet NSPopUpButton *controlModMenu;
- IBOutlet NSPopUpButton *functionModMenu;
-#endif
- IBOutlet NSMatrix *cursorTypeMatrix;
- IBOutlet NSSlider *cursorBlinkSlider;
- IBOutlet NSSlider *expandSpaceSlider;
-#ifdef NS_IMPL_COCOA
- IBOutlet NSButton *smoothFontsCheck;
- IBOutlet NSButton *useQuickdrawCheck;
- IBOutlet NSButton *useSysHiliteCheck;
- Lisp_Object prevUseHighlightColor;
-#endif
- float prevExpandSpace;
- float prevBlinkRate;
-}
-- (IBAction)cancel: (id)sender;
-- (IBAction)ok: (id)sender;
-- (IBAction)resetToDefaults: (id)sender;
-- (IBAction)runHelp: (id)sender;
-- (IBAction)setColors: (id)sender;
-- (IBAction)setDefaultFont: (id)sender;
-
-- (void) showForFrame: (struct frame *)f;
-- (void) setPanelFromValues;
-- (void) setPanelFromDefaultValues;
-- (void) setValuesFromPanel;
-@end
-
extern NSArray *ns_send_types, *ns_return_types;
+extern NSString *ns_app_name;
extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
/* Apple removed the declaration, but kept the implementation */
#endif
#ifndef NS_HAVE_NSINTEGER
+#if defined(__LP64__) && __LP64__
+typedef double CGFloat;
typedef long NSInteger;
typedef unsigned long NSUInteger;
+#else
+typedef float CGFloat;
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif /* not LP64 */
#endif /* not NS_HAVE_NSINTEGER */
#endif /* __OBJC__ */
========================================================================== */
+/* Special keycodes that we pass down the event chain */
+#define KEY_NS_POWER_OFF ((1<<28)|(0<<16)|1)
+#define KEY_NS_OPEN_FILE ((1<<28)|(0<<16)|2)
+#define KEY_NS_OPEN_TEMP_FILE ((1<<28)|(0<<16)|3)
+#define KEY_NS_DRAG_FILE ((1<<28)|(0<<16)|4)
+#define KEY_NS_DRAG_COLOR ((1<<28)|(0<<16)|5)
+#define KEY_NS_DRAG_TEXT ((1<<28)|(0<<16)|6)
+#define KEY_NS_CHANGE_FONT ((1<<28)|(0<<16)|7)
+#define KEY_NS_OPEN_FILE_LINE ((1<<28)|(0<<16)|8)
+#define KEY_NS_PUT_WORKING_TEXT ((1<<28)|(0<<16)|9)
+#define KEY_NS_UNPUT_WORKING_TEXT ((1<<28)|(0<<16)|10)
+#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11)
+#define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
+#define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13)
+#define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14)
+
/* could use list to store these, but rest of emacs has a big infrastructure
for managing a table of bitmap "records" */
struct ns_bitmap_record
#define NS_FACE_FOREGROUND(f) ((f)->foreground)
#define NS_FACE_BACKGROUND(f) ((f)->background)
#define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height)
-#define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
+#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
#define FONT_WIDTH(f) ((f)->max_width)
#define FONT_HEIGHT(f) ((f)->height)
/* In nsfont, for debugging */
struct glyph_string;
-void dump_glyphstring (struct glyph_string *s);
+void ns_dump_glyphstring (struct glyph_string *s);
/* Implemented in nsterm, published in or needed from nsfns. */
extern Lisp_Object Qfontsize;
extern int ns_lisp_to_cursor_type ();
extern Lisp_Object ns_cursor_type_to_lisp (int arg);
extern Lisp_Object Qnone;
+extern void ns_set_name_as_filename (struct frame *f);
+extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg);
-/* XColor defined in dispextern.h (we use color_def->pixel = NSColor id), but
- this causes an #include snafu, so we can't declare it. */
extern int
-ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc,
+ns_defined_color (struct frame *f,
+ const char *name,
+ XColor *color_def, int alloc,
char makeIndex);
+extern void
+ns_query_color (void *col, XColor *color_def, int setPixel);
#ifdef __OBJC__
extern Lisp_Object ns_color_to_lisp (NSColor *col);
extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
Lisp_Object header);
-/* two more prototypes that should be moved to a more general include file */
+/* More prototypes that should be moved to a more general include file */
extern void set_frame_menubar (struct frame *f, int first_time, int deep_p);
extern void x_set_window_size (struct frame *f, int change_grav,
int cols, int rows);
+extern void x_sync (struct frame *);
+extern Lisp_Object x_get_focus_frame (struct frame *);
+extern void x_set_mouse_position (struct frame *f, int h, int v);
+extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
+extern void x_make_frame_visible (struct frame *f);
+extern void x_make_frame_invisible (struct frame *f);
+extern void x_iconify_frame (struct frame *f);
+extern int x_char_width (struct frame *f);
+extern int x_char_height (struct frame *f);
+extern int x_pixel_width (struct frame *f);
+extern int x_pixel_height (struct frame *f);
+extern void x_set_frame_alpha (struct frame *f);
+extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_tool_bar_lines (struct frame *f,
+ Lisp_Object value,
+ Lisp_Object oldval);
+extern void x_activate_menubar (struct frame *);
+extern void free_frame_menubar (struct frame *);
+
+extern void ns_init_paths (void);
+extern void syms_of_nsterm (void);
+extern void syms_of_nsfns (void);
+extern void syms_of_nsmenu (void);
+extern void syms_of_nsselect (void);
/* From nsimage.m, needed in image.c */
struct image;
extern void ns_put_pixel (void *img, int x, int y, unsigned long argb);
extern void ns_set_alpha (void *img, int x, int y, unsigned char a);
-extern int x_display_pixel_height P_ ((struct ns_display_info *));
-extern int x_display_pixel_width P_ ((struct ns_display_info *));
+extern int x_display_pixel_height (struct ns_display_info *);
+extern int x_display_pixel_width (struct ns_display_info *);
/* This in nsterm.m */
+extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout);
extern unsigned long ns_get_rgb_color (struct frame *f,
float r, float g, float b, float a);
extern NSPoint last_mouse_motion_position;