tkMacOSXInt.h
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:5k
源码类别:

通讯编程

开发平台:

Visual C++

  1. /*
  2.  * tkMacOSXInt.h --
  3.  *
  4.  * Declarations of Macintosh specific shared variables and procedures.
  5.  *
  6.  * Copyright (c) 1995-1997 Sun Microsystems, Inc.
  7.  * Copyright 2001, Apple Computer, Inc.
  8.  * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.23 2007/11/09 06:26:55 das Exp $
  14.  */
  15. #ifndef _TKMACINT
  16. #define _TKMACINT
  17. #ifndef _TKINT
  18. #include "tkInt.h"
  19. #endif
  20. #define TextStyle MacTextStyle
  21. #include <Carbon/Carbon.h>
  22. #undef TextStyle
  23. /*
  24.  * Include platform specific public interfaces.
  25.  */
  26. #ifndef _TKMAC
  27. #include "tkMacOSX.h"
  28. #endif
  29. struct TkWindowPrivate {
  30.     TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */
  31.     CGrafPtr grafPtr;
  32.     CGContextRef context;
  33.     ControlRef rootControl;
  34.     int xOff; /* X offset from toplevel window */
  35.     int yOff; /* Y offset from toplevel window */
  36.     CGSize size;
  37.     HIShapeRef visRgn; /* Visible region of window */
  38.     HIShapeRef aboveVisRgn; /* Visible region of window & its children */
  39.     CGRect drawRect; /* Clipped drawing rect */
  40.     int referenceCount; /* Don't delete toplevel until children are
  41.  * gone. */
  42.     struct TkWindowPrivate *toplevel;
  43. /* Pointer to the toplevel datastruct. */
  44.     int flags; /* Various state see defines below. */
  45. };
  46. typedef struct TkWindowPrivate MacDrawable;
  47. /*
  48.  * This list is used to keep track of toplevel windows that have a Mac
  49.  * window attached. This is useful for several things, not the least
  50.  * of which is maintaining floating windows.
  51.  */
  52. typedef struct TkMacOSXWindowList {
  53.     struct TkMacOSXWindowList *nextPtr;
  54. /* The next window in the list. */
  55.     TkWindow *winPtr; /* This window */
  56. } TkMacOSXWindowList;
  57. /*
  58.  * Defines use for the flags field of the MacDrawable data structure.
  59.  */
  60. #define TK_SCROLLBAR_GROW 0x01
  61. #define TK_CLIP_INVALID 0x02
  62. #define TK_HOST_EXISTS 0x04
  63. #define TK_DRAWN_UNDER_MENU 0x08
  64. #define TK_CLIPPED_DRAW 0x10
  65. #define TK_IS_PIXMAP 0x20
  66. #define TK_IS_BW_PIXMAP 0x40
  67. /*
  68.  * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags
  69.  * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the
  70.  * TkWindow structure for the window, but in the MacWin. This way we can
  71.  * still tell what the correct port is after the TKWindow structure has been
  72.  * freed. This actually happens when you bind destroy of a toplevel to
  73.  * Destroy of a child.
  74.  */
  75. /*
  76.  * This structure is for handling Netscape-type in process
  77.  * embedding where Tk does not control the top-level. It contains
  78.  * various functions that are needed by Mac specific routines, like
  79.  * TkMacOSXGetDrawablePort. The definitions of the function types
  80.  * are in tkMacOSX.h.
  81.  */
  82. typedef struct {
  83.     Tk_MacOSXEmbedRegisterWinProc *registerWinProc;
  84.     Tk_MacOSXEmbedGetGrafPortProc *getPortProc;
  85.     Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc;
  86.     Tk_MacOSXEmbedGetClipProc *getClipProc;
  87.     Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc;
  88. } TkMacOSXEmbedHandler;
  89. MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler;
  90. /*
  91.  * Defines used for TkMacOSXInvalidateWindow
  92.  */
  93. #define TK_WINDOW_ONLY 0
  94. #define TK_PARENT_WINDOW 1
  95. /*
  96.  * Accessor for the privatePtr flags field for the TK_HOST_EXISTS field
  97.  */
  98. #define TkMacOSXHostToplevelExists(tkwin) 
  99.     (((TkWindow *) (tkwin))->privatePtr->toplevel->flags & TK_HOST_EXISTS)
  100. /*
  101.  * Defines use for the flags argument to TkGenWMConfigureEvent.
  102.  */
  103. #define TK_LOCATION_CHANGED 1
  104. #define TK_SIZE_CHANGED 2
  105. #define TK_BOTH_CHANGED 3
  106. /*
  107.  * Globals shared among TkAqua.
  108.  */
  109. MODULE_SCOPE MenuHandle tkCurrentAppleMenu; /* Handle to current Apple Menu */
  110. MODULE_SCOPE MenuHandle tkAppleMenu; /* Handle to default Apple Menu */
  111. MODULE_SCOPE MenuHandle tkFileMenu; /* Handles to menus */
  112. MODULE_SCOPE MenuHandle tkEditMenu; /* Handles to menus */
  113. MODULE_SCOPE int tkPictureIsOpen; /* If this is 1, we are drawing to a
  114.  * picture The clipping should then be
  115.  * done relative to the bounds of the
  116.  * picture rather than the window. As
  117.  * of OS X.0.4, something is seriously
  118.  * wrong: The clipping bounds only
  119.  * seem to work if the top,left values
  120.  * are 0,0 The destination rectangle
  121.  * for CopyBits should also have
  122.  * top,left values of 0,0
  123.  */
  124. MODULE_SCOPE TkMacOSXWindowList *tkMacOSXWindowListPtr; /* List of toplevels */
  125. MODULE_SCOPE Tcl_Encoding TkMacOSXCarbonEncoding;
  126. /*
  127.  * Prototypes of internal procs not in the stubs table.
  128.  */
  129. MODULE_SCOPE void TkMacOSXDefaultStartupScript(void);
  130. #if 0
  131. MODULE_SCOPE int XSetClipRectangles(Display *d, GC gc, int clip_x_origin,
  132. int clip_y_origin, XRectangle* rectangles, int n, int ordering);
  133. #endif
  134. MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
  135. int y, int width, int height);
  136. MODULE_SCOPE void TkpRetainRegion(TkRegion r);
  137. MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
  138. /*
  139.  * Include the stubbed internal platform-specific API.
  140.  */
  141. #include "tkIntPlatDecls.h"
  142. #endif /* _TKMACINT */