]> code.delx.au - gnu-emacs/blobdiff - src/nsterm.h
Merge from emacs-24
[gnu-emacs] / src / nsterm.h
index 115d7ac6779f1716733ea8bf8f2fbfb884ca4a97..c3841a40f59a1d7a69f6e1c3408f4ee892b9b260 100644 (file)
@@ -27,12 +27,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_NS
 
 #ifdef NS_IMPL_COCOA
-#ifndef MAC_OS_X_VERSION_10_4
-#define MAC_OS_X_VERSION_10_4 1040
-#endif
-#ifndef MAC_OS_X_VERSION_10_5
-#define MAC_OS_X_VERSION_10_5 1050
-#endif
 #ifndef MAC_OS_X_VERSION_10_6
 #define MAC_OS_X_VERSION_10_6 1060
 #endif
@@ -58,21 +52,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    versions.
    On Cocoa >= 10.5, functions expect CGFloat*. Make compatible type.  */
 #ifdef NS_IMPL_COCOA
-
-#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 */
-
 typedef CGFloat EmacsCGFloat;
-
 #elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22
 typedef CGFloat EmacsCGFloat;
 #else
@@ -139,7 +119,7 @@ typedef float EmacsCGFloat;
 
 @class EmacsToolbar;
 
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
 @interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
 #else
 @interface EmacsView : NSView <NSTextInput>
@@ -217,7 +197,7 @@ typedef float EmacsCGFloat;
 
    ========================================================================== */
 
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
 @interface EmacsMenu : NSMenu  <NSMenuDelegate>
 #else
 @interface EmacsMenu : NSMenu
@@ -249,7 +229,7 @@ typedef float EmacsCGFloat;
 
 @class EmacsImage;
 
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
 @interface EmacsToolbar : NSToolbar <NSToolbarDelegate>
 #else
 @interface EmacsToolbar : NSToolbar
@@ -305,7 +285,7 @@ typedef float EmacsCGFloat;
 - (void)timeout_handler: (NSTimer *)timedEntry;
 @end
 
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+#ifdef NS_IMPL_COCOA
 @interface EmacsTooltip : NSObject <NSWindowDelegate>
 #else
 @interface EmacsTooltip : NSObject
@@ -358,16 +338,11 @@ typedef float EmacsCGFloat;
 
 @interface EmacsImage : NSImage
 {
-  id imageListNext;
-  int refCount;
   NSBitmapImageRep *bmRep; /* used for accessing pixel data */
   unsigned char *pixmapData[5]; /* shortcut to access pixel data */
   NSColor *stippleMask;
 }
 + allocInitFromFile: (Lisp_Object)file;
-- reference;
-- imageListSetNext: (id)arg;
-- imageListNext;
 - (void)dealloc;
 - initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
          flip: (BOOL)flip;
@@ -401,7 +376,7 @@ typedef float EmacsCGFloat;
    CGFloat last_mouse_offset;
    float min_portion;
    int pixel_height;
-   int last_hit_part;
+   enum scroll_bar_part last_hit_part;
 
    BOOL condemned;
 
@@ -413,7 +388,6 @@ typedef float EmacsCGFloat;
 
 - initFrame: (NSRect )r window: (Lisp_Object)win;
 - (void)setFrame: (NSRect)r;
-- (void)dealloc;
 
 - setPosition: (int) position portion: (int) portion whole: (int) whole;
 - (int) checkSamePosition: (int)position portion: (int)portion
@@ -605,6 +579,9 @@ struct ns_display_info
   /* The cursor to use for vertical scroll bars. */
   Cursor vertical_scroll_bar_cursor;
 
+  /* The cursor to use for horizontal scroll bars. */
+  Cursor horizontal_scroll_bar_cursor;
+
   /* Information about the range of text currently shown in
      mouse-face.  */
   Mouse_HLInfo mouse_highlight;
@@ -745,12 +722,20 @@ struct x_output
 #endif
 
 /* Compute pixel size for vertical scroll bars */
-#define NS_SCROLL_BAR_WIDTH(f)                              \
-(FRAME_HAS_VERTICAL_SCROLL_BARS (f)                          \
- ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0               \
-        ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f)                 \
-        : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)))   \
- : 0)
+#define NS_SCROLL_BAR_WIDTH(f)                                         \
+  (FRAME_HAS_VERTICAL_SCROLL_BARS (f)                                  \
+   ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0                       \
+          ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f)                          \
+          : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)))      \
+   : 0)
+
+/* Compute pixel size for horizontal scroll bars */
+#define NS_SCROLL_BAR_HEIGHT(f)                                                \
+  (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)                                        \
+   ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0                      \
+          ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f)                         \
+          : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)))      \
+   : 0)
 
 /* Difference btwn char-column-calculated and actual SB widths.
    This is only a concern for rendering when SB on left. */
@@ -759,6 +744,13 @@ struct x_output
     (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)        \
         - NS_SCROLL_BAR_WIDTH (f)) : 0)
 
+/* Difference btwn char-line-calculated and actual SB heights.
+   This is only a concern for rendering when SB on top. */
+#define NS_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f)                \
+  (WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ?             \
+   (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \
+    - NS_SCROLL_BAR_HEIGHT (f)) : 0)
+
 /* XXX: fix for GNUstep inconsistent accounting for titlebar */
 #ifdef NS_IMPL_GNUSTEP
 #define NS_TOP_POS(f) ((f)->top_pos + 18)
@@ -776,8 +768,8 @@ struct x_output
 
 /* First position where characters can be shown (instead of scrollbar, if
    it is on left. */
-#define FIRST_CHAR_POSITION(f) \
-  (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
+#define FIRST_CHAR_POSITION(f)                         \
+  (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0  \
    : FRAME_SCROLL_BAR_COLS (f))
 
 extern struct ns_display_info *ns_term_init (Lisp_Object display_name);
@@ -854,7 +846,7 @@ extern void find_and_call_menu_selection (struct frame *f,
 extern Lisp_Object find_and_return_menu_selection (struct frame *f,
                                                    bool keymaps,
                                                    void *client_data);
-extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object header,
+extern Lisp_Object ns_popup_dialog (struct frame *, Lisp_Object header,
                                     Lisp_Object contents);
 
 #define NSAPP_DATA2_RUNASSCRIPT 10
@@ -895,6 +887,9 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
 extern unsigned long ns_get_rgb_color (struct frame *f,
                                        float r, float g, float b, float a);
 
+extern void ns_init_events ();
+extern void ns_finish_events ();
+
 #ifdef __OBJC__
 /* From nsterm.m, needed in nsfont.m. */
 extern void
@@ -918,6 +913,7 @@ extern char gnustep_base_version[];  /* version tracking */
 #define SCREENMAX 16000
 
 #define NS_SCROLL_BAR_WIDTH_DEFAULT     [EmacsScroller scrollerWidth]
+#define NS_SCROLL_BAR_HEIGHT_DEFAULT    [EmacsScroller scrollerHeight]
 /* This is to match emacs on other platforms, ugly though it is. */
 #define NS_SELECTION_BG_COLOR_DEFAULT  @"LightGoldenrod2";
 #define NS_SELECTION_FG_COLOR_DEFAULT  @"Black";