tkMacOSXInt.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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-2009, Apple Inc.
  8. * Copyright (c) 2005-2009 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. #ifndef _TKMACINT
  14. #define _TKMACINT
  15. #ifndef _TKINT
  16. #include "tkInt.h"
  17. #endif
  18. /*
  19. * Include platform specific public interfaces.
  20. */
  21. #ifndef _TKMAC
  22. #include "tkMacOSX.h"
  23. #import <Cocoa/Cocoa.h>
  24. #endif
  25. /*
  26. * Define compatibility platform types used in the structures below so that
  27. * this header can be included without pulling in the platform headers.
  28. */
  29. #ifndef _TKMACPRIV
  30. # ifndef CGGEOMETRY_H_
  31. # ifndef CGFLOAT_DEFINED
  32. # if __LP64__
  33. # define CGFloat double
  34. # else
  35. # define CGFloat float
  36. # endif
  37. # endif
  38. # define CGSize struct {CGFloat width; CGFloat height;}
  39. # endif
  40. # ifndef CGCONTEXT_H_
  41. # define CGContextRef void *
  42. # endif
  43. # ifndef CGCOLOR_H_
  44. # define CGColorRef void *
  45. # endif
  46. # ifndef __HISHAPE__
  47. # define HIShapeRef void *
  48. # endif
  49. # ifndef _APPKITDEFINES_H
  50. # define NSView void *
  51. # endif
  52. #endif
  53. struct TkWindowPrivate {
  54. TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */
  55. NSView *view;
  56. CGContextRef context;
  57. int xOff; /* X offset from toplevel window */
  58. int yOff; /* Y offset from toplevel window */
  59. CGSize size;
  60. HIShapeRef visRgn; /* Visible region of window */
  61. HIShapeRef aboveVisRgn; /* Visible region of window & its children */
  62. HIShapeRef drawRgn; /* Clipped drawing region */
  63. int referenceCount; /* Don't delete toplevel until children are
  64. * gone. */
  65. struct TkWindowPrivate *toplevel;
  66. /* Pointer to the toplevel datastruct. */
  67. CGFloat fillRGBA[4]; /* Background used by the ttk FillElement */
  68. int flags; /* Various state see defines below. */
  69. };
  70. typedef struct TkWindowPrivate MacDrawable;
  71. /*
  72. * Defines use for the flags field of the MacDrawable data structure.
  73. */
  74. #define TK_SCROLLBAR_GROW 0x01
  75. #define TK_CLIP_INVALID 0x02
  76. #define TK_HOST_EXISTS 0x04
  77. #define TK_DRAWN_UNDER_MENU 0x08
  78. #define TK_IS_PIXMAP 0x10
  79. #define TK_IS_BW_PIXMAP 0x20
  80. #define TK_DO_NOT_DRAW 0x40
  81. #define TTK_HAS_CONTRASTING_BG 0x80
  82. /*
  83. * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags
  84. * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the
  85. * TkWindow structure for the window, but in the MacWin. This way we can
  86. * still tell what the correct port is after the TKWindow structure has been
  87. * freed. This actually happens when you bind destroy of a toplevel to
  88. * Destroy of a child.
  89. */
  90. /*
  91. * This structure is for handling Netscape-type in process
  92. * embedding where Tk does not control the top-level. It contains
  93. * various functions that are needed by Mac specific routines, like
  94. * TkMacOSXGetDrawablePort. The definitions of the function types
  95. * are in tkMacOSX.h.
  96. */
  97. typedef struct {
  98. Tk_MacOSXEmbedRegisterWinProc *registerWinProc;
  99. Tk_MacOSXEmbedGetGrafPortProc *getPortProc;
  100. Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc;
  101. Tk_MacOSXEmbedGetClipProc *getClipProc;
  102. Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc;
  103. } TkMacOSXEmbedHandler;
  104. MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler;
  105. /*
  106. * Undef compatibility platform types defined above.
  107. */
  108. #ifndef _TKMACPRIV
  109. # ifndef CGGEOMETRY_H_
  110. # ifndef CGFLOAT_DEFINED
  111. # undef CGFloat
  112. # endif
  113. # undef CGSize
  114. # endif
  115. # ifndef CGCONTEXT_H_
  116. # undef CGContextRef
  117. # endif
  118. # ifndef CGCOLOR_H_
  119. # undef CGColorRef
  120. # endif
  121. # ifndef __HISHAPE__
  122. # undef HIShapeRef
  123. # endif
  124. # ifndef _APPKITDEFINES_H
  125. # undef NSView
  126. # endif
  127. #endif
  128. /*
  129. * Defines used for TkMacOSXInvalidateWindow
  130. */
  131. #define TK_WINDOW_ONLY 0
  132. #define TK_PARENT_WINDOW 1
  133. /*
  134. * Accessor for the privatePtr flags field for the TK_HOST_EXISTS field
  135. */
  136. #define TkMacOSXHostToplevelExists(tkwin) \
  137. (((TkWindow *) (tkwin))->privatePtr->toplevel->flags & TK_HOST_EXISTS)
  138. /*
  139. * Defines used for the flags argument to TkGenWMConfigureEvent.
  140. */
  141. #define TK_LOCATION_CHANGED 1
  142. #define TK_SIZE_CHANGED 2
  143. #define TK_BOTH_CHANGED 3
  144. #define TK_MACOSX_HANDLE_EVENT_IMMEDIATELY 1024
  145. /*
  146. * Defines for tkTextDisp.c and tkFont.c
  147. */
  148. #define TK_LAYOUT_WITH_BASE_CHUNKS 1
  149. #define TK_DRAW_IN_CONTEXT 1
  150. /*
  151. * Prototypes of internal procs not in the stubs table.
  152. */
  153. MODULE_SCOPE void TkMacOSXDefaultStartupScript(void);
  154. MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
  155. int y, int width, int height);
  156. MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
  157. MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable);
  158. /*
  159. * Include the stubbed internal platform-specific API.
  160. */
  161. #include "tkIntPlatDecls.h"
  162. #endif /* _TKMACINT */
  163. /*
  164. * Local Variables:
  165. * mode: objc
  166. * c-basic-offset: 4
  167. * fill-column: 79
  168. * coding: utf-8
  169. * End:
  170. */