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