(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
[bpt/emacs.git] / src / macgui.h
index 2990537..6b8e560 100644 (file)
@@ -1,13 +1,13 @@
 /* Definitions and headers for communication on the Mac OS.
    Copyright (C) 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007 Free Software Foundation, Inc.
+                 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,9 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Contributed by Andrew Choi (akochoi@mac.com).  */
 
@@ -71,7 +69,7 @@ typedef unsigned long Time;
 #undef Z
 #define Z (current_buffer->text->z)
 #else /* not HAVE_CARBON */
-#include <QuickDraw.h>         /* for WindowRef */
+#include <Quickdraw.h>         /* for WindowRef */
 #include <QDOffscreen.h>       /* for GWorldPtr */
 #include <Appearance.h>                /* for ThemeCursor */
 #include <Windows.h>
@@ -81,11 +79,13 @@ typedef unsigned long Time;
 
 /* Whether to use ATSUI (Apple Type Services for Unicode Imaging) for
    text drawing.  */
+#if 0 /* Don't enable by default on the emacs-unicode-2 branch.  */
 #ifndef USE_ATSUI
 #ifdef MAC_OSX
 #define USE_ATSUI 1
 #endif
 #endif
+#endif
 
 /* Whether to use low-level Quartz 2D (aka Core Graphics) text drawing
    in preference to ATSUI for ASCII and Latin-1 characters.  */
@@ -124,8 +124,46 @@ typedef unsigned long Time;
 #endif
 #endif
 
+#ifndef CGFLOAT_DEFINED
+typedef float CGFloat;
+#endif
+
 typedef WindowRef Window;
+#if TARGET_API_MAC_CARBON
+typedef ScrapRef Selection;
+#else
+typedef int Selection;
+#endif
+#define mac_set_window_title   SetWindowTitleWithCFString
+#define mac_set_window_modified        SetWindowModified
+#define mac_is_window_visible  IsWindowVisible
+#define mac_is_window_collapsed        IsWindowCollapsed
+#define mac_bring_window_to_front      BringToFront
+#define mac_send_window_behind SendBehind
+#define mac_hide_window                HideWindow
+#define mac_show_window                ShowWindow
+#define mac_collapse_window    CollapseWindow
+#define mac_front_non_floating_window  FrontNonFloatingWindow
+#define mac_active_non_floating_window ActiveNonFloatingWindow
+#define mac_activate_window    ActivateWindow
+#define mac_move_window_structure      MoveWindowStructure
+#define mac_move_window                MoveWindow
+#define mac_size_window                SizeWindow
+#define mac_get_global_mouse   GetGlobalMouse
+#define mac_is_window_toolbar_visible  IsWindowToolbarVisible
+#define mac_rect_make(f, x, y, w, h)   CGRectMake (x, y, w, h)
+
+#if USE_MAC_IMAGE_IO
+typedef struct _XImage
+{
+  int width, height;           /* size of image */
+  char *data;                  /* pointer to image data */
+  int bytes_per_line;          /* accelarator to next line */
+  int bits_per_pixel;          /* bits per pixel (ZPixmap) */
+} *Pixmap;
+#else
 typedef GWorldPtr Pixmap;
+#endif
 
 #define Cursor ThemeCursor
 #define No_Cursor (-1)
@@ -361,6 +399,97 @@ typedef struct {
    (nr).right = ((nr).left + (width)),         \
    (nr).bottom = ((nr).top + (height)))
 
+/* Definitions copied from lwlib.h */
+
+typedef void * XtPointer;
+
+enum button_type
+{
+  BUTTON_TYPE_NONE,
+  BUTTON_TYPE_TOGGLE,
+  BUTTON_TYPE_RADIO
+};
+
+/* This structure is based on the one in ../lwlib/lwlib.h, modified
+   for Mac OS.  */
+typedef struct _widget_value
+{
+  /* name of widget */
+  Lisp_Object   lname;
+  char*                name;
+  /* value (meaning depend on widget type) */
+  char*                value;
+  /* keyboard equivalent. no implications for XtTranslations */
+  Lisp_Object   lkey;
+  char*                key;
+  /* Help string or nil if none.
+     GC finds this string through the frame's menu_bar_vector
+     or through menu_items.  */
+  Lisp_Object  help;
+  /* true if enabled */
+  Boolean      enabled;
+  /* true if selected */
+  Boolean      selected;
+  /* The type of a button.  */
+  enum button_type button_type;
+  /* true if menu title */
+  Boolean       title;
+#if 0
+  /* true if was edited (maintained by get_value) */
+  Boolean      edited;
+  /* true if has changed (maintained by lw library) */
+  change_type  change;
+  /* true if this widget itself has changed,
+     but not counting the other widgets found in the `next' field.  */
+  change_type   this_one_change;
+#endif
+  /* Contents of the sub-widgets, also selected slot for checkbox */
+  struct _widget_value*        contents;
+  /* data passed to callback */
+  XtPointer    call_data;
+  /* next one in the list */
+  struct _widget_value*        next;
+#if 0
+  /* slot for the toolkit dependent part.  Always initialize to NULL. */
+  void* toolkit_data;
+  /* tell us if we should free the toolkit data slot when freeing the
+     widget_value itself. */
+  Boolean free_toolkit_data;
+
+  /* we resource the widget_value structures; this points to the next
+     one on the free list if this one has been deallocated.
+   */
+  struct _widget_value *free_list;
+#endif
+} widget_value;
+
+#if MAC_OS8
+#define M_APPLE 234
+#define I_ABOUT 1
+
+#define EXTRA_STACK_ALLOC (256 * 1024)
+
+#define ARGV_STRING_LIST_ID 129
+#define RAM_TOO_LARGE_ALERT_ID 129
+#define ABOUT_ALERT_ID 128
+#endif
+
+#define DIALOG_LEFT_MARGIN (112)
+#define DIALOG_TOP_MARGIN (24)
+#define DIALOG_RIGHT_MARGIN (24)
+#define DIALOG_BOTTOM_MARGIN (20)
+#define DIALOG_MIN_INNER_WIDTH (338)
+#define DIALOG_MAX_INNER_WIDTH (564)
+#define DIALOG_BUTTON_BUTTON_HORIZONTAL_SPACE (12)
+#define DIALOG_BUTTON_BUTTON_VERTICAL_SPACE (12)
+#define DIALOG_BUTTON_MIN_WIDTH (68)
+#define DIALOG_TEXT_MIN_HEIGHT (50)
+#define DIALOG_TEXT_BUTTONS_VERTICAL_SPACE (10)
+#define DIALOG_ICON_WIDTH (64)
+#define DIALOG_ICON_HEIGHT (64)
+#define DIALOG_ICON_LEFT_MARGIN (24)
+#define DIALOG_ICON_TOP_MARGIN (15)
+
 #endif /* EMACS_MACGUI_H */
 
 /* arch-tag: 5a0da49a-35e2-418b-a58c-8a55778ae849