OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [mac/] [tkMacInt.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
2
 * tkMacInt.h --
3
 *
4
 *      Declarations of Macintosh specific shared variables and procedures.
5
 *
6
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
7
 *
8
 * See the file "license.terms" for information on usage and redistribution
9
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
 *
11
 * RCS: @(#) $Id: tkMacInt.h,v 1.1.1.1 2002-01-16 10:25:55 markom Exp $
12
 */
13
 
14
#ifndef _TKMACINT
15
#define _TKMACINT
16
 
17
#include "tkInt.h"
18
#include "tkPort.h"
19
 
20
#ifndef _TKMAC
21
#    include "tkMac.h"
22
#endif /* _TKMAC */
23
 
24
 
25
#include <AppleEvents.h>
26
#include <Windows.h>
27
#include <QDOffscreen.h>
28
#include <Menus.h>
29
 
30
#define TK_MAC_68K_STACK_GROWTH (256*1024)
31
 
32
struct TkWindowPrivate {
33
    TkWindow *winPtr;           /* Ptr to tk window or NULL if Pixmap */
34
    GWorldPtr portPtr;          /* Either WindowRef or off screen world */
35
    int xOff;                   /* X offset from toplevel window */
36
    int yOff;                   /* Y offset from toplevel window */
37
    RgnHandle clipRgn;          /* Visable region of window */
38
    RgnHandle aboveClipRgn;     /* Visable region of window & it's children */
39
    int referenceCount;         /* Don't delete toplevel until children are
40
                                 * gone. */
41
    struct TkWindowPrivate *toplevel;   /* Pointer to the toplevel
42
                                         * datastruct. */
43
    int flags;                  /* Various state see defines below. */
44
};
45
typedef struct TkWindowPrivate MacDrawable;
46
 
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
 
53
typedef struct TkMacWindowList {
54
    struct TkMacWindowList *nextPtr;    /* The next window in the list. */
55
    TkWindow *winPtr;                   /* This window */
56
} TkMacWindowList;
57
 
58
/*
59
 * Defines use for the flags field of the MacDrawable data structure.
60
 */
61
 
62
#define TK_SCROLLBAR_GROW       1
63
#define TK_CLIP_INVALID         2
64
#define TK_HOST_EXISTS          4
65
#define TK_DRAWN_UNDER_MENU     8
66
 
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 still tell
71
 * what the correct port is after the TKWindow  structure has been freed.  This
72
 * actually happens when you bind destroy of a toplevel to Destroy of a child.
73
 */
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
 * TkMacGetDrawablePort.  The definitions of the function types
80
 * are in tclMac.h.
81
 */
82
 
83
typedef struct {
84
        Tk_MacEmbedRegisterWinProc *registerWinProc;
85
        Tk_MacEmbedGetGrafPortProc *getPortProc;
86
        Tk_MacEmbedMakeContainerExistProc *containerExistProc;
87
        Tk_MacEmbedGetClipProc *getClipProc;
88
        Tk_MacEmbedGetOffsetInParentProc *getOffsetProc;
89
} TkMacEmbedHandler;
90
 
91
extern TkMacEmbedHandler *gMacEmbedHandler;
92
 
93
/*
94
 * Defines used for TkMacInvalidateWindow
95
 */
96
 
97
#define TK_WINDOW_ONLY 0
98
#define TK_PARENT_WINDOW 1
99
 
100
/*
101
 * Accessor for the privatePtr flags field for the TK_HOST_EXISTS field
102
 */
103
 
104
#define TkMacHostToplevelExists(tkwin) \
105
    (((TkWindow *) (tkwin))->privatePtr->toplevel->flags & TK_HOST_EXISTS)
106
 
107
/*
108
 * Defines use for the flags argument to TkGenWMConfigureEvent.
109
 */
110
 
111
#define TK_LOCATION_CHANGED     1
112
#define TK_SIZE_CHANGED         2
113
#define TK_BOTH_CHANGED         3
114
 
115
/*
116
 * Variables shared among various Mac Tk modules but are not
117
 * exported to the outside world.
118
 */
119
 
120
extern int tkMacAppInFront;
121
 
122
/*
123
 * Globals shared among Macintosh Tk
124
 */
125
 
126
extern MenuHandle tkAppleMenu;          /* Handle to the Apple Menu */
127
extern MenuHandle tkFileMenu;           /* Handles to menus */
128
extern MenuHandle tkEditMenu;           /* Handles to menus */
129
extern RgnHandle tkMenuCascadeRgn;      /* A region to clip with. */
130
extern int tkUseMenuCascadeRgn;         /* If this is 1, clipping code
131
                                         * should intersect tkMenuCascadeRgn
132
                                         * before drawing occurs.
133
                                         * tkMenuCascadeRgn will only
134
                                         * be valid when the value of this
135
                                         * variable is 1. */
136
extern TkMacWindowList *tkMacWindowListPtr;
137
                                        /* The list of toplevels */
138
 
139
/*
140
 * The following types and defines are for MDEF support.
141
 */
142
 
143
#if STRUCTALIGNMENTSUPPORTED
144
#pragma options align=mac8k
145
#endif
146
typedef struct TkMenuLowMemGlobals {
147
    long menuDisable;                   /* A combination of the menu and the item
148
                                         * that the mouse is currently over. */
149
    short menuTop;                      /* Where in global coords the top of the
150
                                         * menu is. */
151
    short menuBottom;                   /* Where in global coords the bottom of
152
                                         * the menu is. */
153
    Rect itemRect;                      /* This is the rectangle of the currently
154
                                         * selected item. */
155
    short scrollFlag;                   /* This is used by the MDEF and the
156
                                         * Menu Manager to control when scrolling
157
                                         * starts. With hierarchicals, an
158
                                         * mChooseMsg can come before an
159
                                         * mDrawMsg, and scrolling should not
160
                                         * occur until after the mDrawMsg.
161
                                         * The mDrawMsg sets this flag;
162
                                         * mChooseMsg checks the flag and
163
                                         * does not scroll if it is set;
164
                                         * and then resets the flag. */
165
} TkMenuLowMemGlobals;
166
#if STRUCTALIGNMENTSUPPORTED
167
#pragma options align=reset
168
#endif
169
 
170
typedef pascal void (*TkMenuDefProcPtr) (short message, MenuHandle theMenu,
171
        Rect *menuRectPtr, Point hitPt, short *whichItemPtr,
172
        TkMenuLowMemGlobals *globalsPtr);
173
enum {
174
    tkUppMenuDefProcInfo = kPascalStackBased
175
            | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
176
            | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(MenuRef)))
177
            | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
178
            | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Point)))
179
            | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(short*)))
180
            | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(TkMenuLowMemGlobals *)))
181
};
182
 
183
#if GENERATINGCFM
184
typedef UniversalProcPtr TkMenuDefUPP;
185
#else
186
typedef TkMenuDefProcPtr TkMenuDefUPP;
187
#endif
188
 
189
#if GENERATINGCFM
190
#define TkNewMenuDefProc(userRoutine)   \
191
        (TkMenuDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
192
        tkUppMenuDefProcInfo, GetCurrentArchitecture())
193
#else
194
#define TkNewMenuDefProc(userRoutine)   \
195
        ((TkMenuDefUPP) (userRoutine))
196
#endif
197
 
198
#if GENERATINGCFM
199
#define TkCallMenuDefProc(userRoutine, message, theMenu, menuRectPtr, hitPt, \
200
        whichItemPtr, globalsPtr) \
201
        CallUniversalProc((UniversalProcPtr)(userRoutine), TkUppMenuDefProcInfo, \
202
        (message), (theMenu), (menuRectPtr), (hitPt), (whichItemPtr), \
203
        (globalsPtr))
204
#else
205
#define TkCallMenuDefProc(userRoutine, message, theMenu, menuRectPtr, hitPt, \
206
        whichItemPtr, globalsPtr) \
207
        (*(userRoutine))((message), (theMenu), (menuRectPtr), (hitPt), \
208
        (whichItemPtr), (globalsPtr))
209
#endif
210
 
211
/*
212
 * Internal procedures shared among Macintosh Tk modules but not exported
213
 * to the outside world:
214
 */
215
 
216
extern int              HandleWMEvent _ANSI_ARGS_((EventRecord *theEvent));
217
extern void             TkAboutDlg _ANSI_ARGS_((void));
218
extern void             TkCreateMacEventSource _ANSI_ARGS_((void));
219
extern void             TkFontList _ANSI_ARGS_((Tcl_Interp *interp,
220
                            Display *display));
221
extern Window           TkGetTransientMaster _ANSI_ARGS_((TkWindow *winPtr));
222
extern int              TkGenerateButtonEvent _ANSI_ARGS_((int x, int y,
223
                            Window window, unsigned int state));
224
extern int              TkGetCharPositions _ANSI_ARGS_((
225
                            XFontStruct *font_struct, char *string,
226
                            int count, short *buffer));
227
extern void             TkGenWMDestroyEvent _ANSI_ARGS_((Tk_Window tkwin));
228
extern void             TkGenWMConfigureEvent _ANSI_ARGS_((Tk_Window tkwin,
229
                            int x, int y, int width, int height, int flags));
230
extern unsigned int     TkMacButtonKeyState _ANSI_ARGS_((void));
231
extern void             TkMacClearMenubarActive _ANSI_ARGS_((void));
232
extern int              TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr));
233
extern int              TkMacDispatchMenuEvent _ANSI_ARGS_((int menuID,
234
                            int index));
235
extern void             TkMacInstallCursor _ANSI_ARGS_((int resizeOverride));
236
extern int              TkMacConvertTkEvent _ANSI_ARGS_((EventRecord *eventPtr,
237
                            Window window));
238
extern void             TkMacHandleTearoffMenu _ANSI_ARGS_((void));
239
extern void             tkMacInstallMWConsole _ANSI_ARGS_((
240
                            Tcl_Interp *interp));
241
extern void             TkMacInvalClipRgns _ANSI_ARGS_((TkWindow *winPtr));
242
extern void             TkMacDoHLEvent _ANSI_ARGS_((EventRecord *theEvent));
243
extern void             TkMacFontInfo _ANSI_ARGS_((Font fontId, short *family,
244
                            short *style, short *size));
245
extern Time             TkMacGenerateTime _ANSI_ARGS_(());
246
extern GWorldPtr        TkMacGetDrawablePort _ANSI_ARGS_((Drawable drawable));
247
extern TkWindow *       TkMacGetScrollbarGrowWindow _ANSI_ARGS_((
248
                            TkWindow *winPtr));
249
extern Window           TkMacGetXWindow _ANSI_ARGS_((WindowRef macWinPtr));
250
extern int              TkMacGrowToplevel _ANSI_ARGS_((WindowRef whichWindow,
251
                            Point start));
252
extern void             TkMacHandleMenuSelect _ANSI_ARGS_((long mResult,
253
                            int optionKeyPressed));
254
extern int              TkMacHaveAppearance _ANSI_ARGS_((void));
255
extern void             TkMacInitAppleEvents _ANSI_ARGS_((Tcl_Interp *interp));
256
extern void             TkMacInitMenus _ANSI_ARGS_((Tcl_Interp  *interp));
257
extern void             TkMacInvalidateWindow _ANSI_ARGS_((MacDrawable *macWin, int flag));
258
extern int              TkMacIsCharacterMissing _ANSI_ARGS_((Tk_Font tkfont,
259
                            unsigned int searchChar));
260
extern void             TkMacMakeRealWindowExist _ANSI_ARGS_((
261
                            TkWindow *winPtr));
262
extern BitMapPtr        TkMacMakeStippleMap(Drawable, Drawable);
263
extern void             TkMacMenuClick _ANSI_ARGS_((void));
264
extern void             TkMacRegisterOffScreenWindow _ANSI_ARGS_((Window window,
265
                            GWorldPtr portPtr));
266
extern int              TkMacResizable _ANSI_ARGS_((TkWindow *winPtr));
267
extern void             TkMacSetEmbedRgn _ANSI_ARGS_((TkWindow *winPtr, RgnHandle rgn));
268
extern void             TkMacSetHelpMenuItemCount _ANSI_ARGS_((void));
269
extern void             TkMacSetScrollbarGrow _ANSI_ARGS_((TkWindow *winPtr,
270
                            int flag));
271
extern void             TkMacSetUpClippingRgn _ANSI_ARGS_((Drawable drawable));
272
extern void             TkMacSetUpGraphicsPort _ANSI_ARGS_((GC gc));
273
extern void             TkMacUpdateClipRgn _ANSI_ARGS_((TkWindow *winPtr));
274
extern void             TkMacUnregisterMacWindow _ANSI_ARGS_((GWorldPtr portPtr));
275
extern int              TkMacUseMenuID _ANSI_ARGS_((short macID));
276
extern RgnHandle        TkMacVisableClipRgn _ANSI_ARGS_((TkWindow *winPtr));
277
extern void             TkMacWinBounds _ANSI_ARGS_((TkWindow *winPtr,
278
                            Rect *geometry));
279
extern void             TkMacWindowOffset _ANSI_ARGS_((WindowRef wRef,
280
                            int *xOffset, int *yOffset));
281
extern void             TkResumeClipboard _ANSI_ARGS_((void));
282
extern int              TkSetMacColor _ANSI_ARGS_((unsigned long pixel,
283
                            RGBColor *macColor));
284
extern void             TkSetWMName _ANSI_ARGS_((TkWindow *winPtr,
285
                            Tk_Uid titleUid));
286
extern void             TkSuspendClipboard _ANSI_ARGS_((void));
287
extern int              TkWMGrowToplevel _ANSI_ARGS_((WindowRef whichWindow,
288
                            Point start));
289
extern int              TkMacZoomToplevel _ANSI_ARGS_((WindowPtr whichWindow,
290
                            Point where, short zoomPart));
291
extern Tk_Window        Tk_TopCoordsToWindow _ANSI_ARGS_((Tk_Window tkwin,
292
                            int rootX, int rootY, int *newX, int *newY));
293
extern MacDrawable *    TkMacContainerId _ANSI_ARGS_((TkWindow *winPtr));
294
extern MacDrawable *    TkMacGetHostToplevel  _ANSI_ARGS_((TkWindow *winPtr));
295
 
296
#endif /* _TKMACINT */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.