jpayne@69: /* jpayne@69: * tkMacOSXInt.h -- jpayne@69: * jpayne@69: * Declarations of Macintosh specific shared variables and procedures. jpayne@69: * jpayne@69: * Copyright (c) 1995-1997 Sun Microsystems, Inc. jpayne@69: * Copyright 2001-2009, Apple Inc. jpayne@69: * Copyright (c) 2005-2009 Daniel A. Steffen jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution jpayne@69: * of this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMACINT jpayne@69: #define _TKMACINT jpayne@69: jpayne@69: #ifndef _TKINT jpayne@69: #include "tkInt.h" jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Include platform specific public interfaces. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMAC jpayne@69: #include "tkMacOSX.h" jpayne@69: #import jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Define compatibility platform types used in the structures below so that jpayne@69: * this header can be included without pulling in the platform headers. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMACPRIV jpayne@69: # ifndef CGGEOMETRY_H_ jpayne@69: # ifndef CGFLOAT_DEFINED jpayne@69: # if __LP64__ jpayne@69: # define CGFloat double jpayne@69: # else jpayne@69: # define CGFloat float jpayne@69: # endif jpayne@69: # endif jpayne@69: # define CGSize struct {CGFloat width; CGFloat height;} jpayne@69: # endif jpayne@69: # ifndef CGCONTEXT_H_ jpayne@69: # define CGContextRef void * jpayne@69: # endif jpayne@69: # ifndef CGCOLOR_H_ jpayne@69: # define CGColorRef void * jpayne@69: # endif jpayne@69: # ifndef __HISHAPE__ jpayne@69: # define HIShapeRef void * jpayne@69: # endif jpayne@69: # ifndef _APPKITDEFINES_H jpayne@69: # define NSView void * jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: struct TkWindowPrivate { jpayne@69: TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */ jpayne@69: NSView *view; jpayne@69: CGContextRef context; jpayne@69: int xOff; /* X offset from toplevel window */ jpayne@69: int yOff; /* Y offset from toplevel window */ jpayne@69: CGSize size; jpayne@69: HIShapeRef visRgn; /* Visible region of window */ jpayne@69: HIShapeRef aboveVisRgn; /* Visible region of window & its children */ jpayne@69: HIShapeRef drawRgn; /* Clipped drawing region */ jpayne@69: int referenceCount; /* Don't delete toplevel until children are jpayne@69: * gone. */ jpayne@69: struct TkWindowPrivate *toplevel; jpayne@69: /* Pointer to the toplevel datastruct. */ jpayne@69: CGFloat fillRGBA[4]; /* Background used by the ttk FillElement */ jpayne@69: int flags; /* Various state see defines below. */ jpayne@69: }; jpayne@69: typedef struct TkWindowPrivate MacDrawable; jpayne@69: jpayne@69: /* jpayne@69: * Defines use for the flags field of the MacDrawable data structure. jpayne@69: */ jpayne@69: jpayne@69: #define TK_SCROLLBAR_GROW 0x01 jpayne@69: #define TK_CLIP_INVALID 0x02 jpayne@69: #define TK_HOST_EXISTS 0x04 jpayne@69: #define TK_DRAWN_UNDER_MENU 0x08 jpayne@69: #define TK_IS_PIXMAP 0x10 jpayne@69: #define TK_IS_BW_PIXMAP 0x20 jpayne@69: #define TK_DO_NOT_DRAW 0x40 jpayne@69: #define TTK_HAS_CONTRASTING_BG 0x80 jpayne@69: jpayne@69: /* jpayne@69: * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags jpayne@69: * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the jpayne@69: * TkWindow structure for the window, but in the MacWin. This way we can jpayne@69: * still tell what the correct port is after the TKWindow structure has been jpayne@69: * freed. This actually happens when you bind destroy of a toplevel to jpayne@69: * Destroy of a child. jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * This structure is for handling Netscape-type in process jpayne@69: * embedding where Tk does not control the top-level. It contains jpayne@69: * various functions that are needed by Mac specific routines, like jpayne@69: * TkMacOSXGetDrawablePort. The definitions of the function types jpayne@69: * are in tkMacOSX.h. jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: Tk_MacOSXEmbedRegisterWinProc *registerWinProc; jpayne@69: Tk_MacOSXEmbedGetGrafPortProc *getPortProc; jpayne@69: Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc; jpayne@69: Tk_MacOSXEmbedGetClipProc *getClipProc; jpayne@69: Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc; jpayne@69: } TkMacOSXEmbedHandler; jpayne@69: jpayne@69: MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler; jpayne@69: jpayne@69: /* jpayne@69: * Undef compatibility platform types defined above. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMACPRIV jpayne@69: # ifndef CGGEOMETRY_H_ jpayne@69: # ifndef CGFLOAT_DEFINED jpayne@69: # undef CGFloat jpayne@69: # endif jpayne@69: # undef CGSize jpayne@69: # endif jpayne@69: # ifndef CGCONTEXT_H_ jpayne@69: # undef CGContextRef jpayne@69: # endif jpayne@69: # ifndef CGCOLOR_H_ jpayne@69: # undef CGColorRef jpayne@69: # endif jpayne@69: # ifndef __HISHAPE__ jpayne@69: # undef HIShapeRef jpayne@69: # endif jpayne@69: # ifndef _APPKITDEFINES_H jpayne@69: # undef NSView jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Defines used for TkMacOSXInvalidateWindow jpayne@69: */ jpayne@69: jpayne@69: #define TK_WINDOW_ONLY 0 jpayne@69: #define TK_PARENT_WINDOW 1 jpayne@69: jpayne@69: /* jpayne@69: * Accessor for the privatePtr flags field for the TK_HOST_EXISTS field jpayne@69: */ jpayne@69: jpayne@69: #define TkMacOSXHostToplevelExists(tkwin) \ jpayne@69: (((TkWindow *) (tkwin))->privatePtr->toplevel->flags & TK_HOST_EXISTS) jpayne@69: jpayne@69: /* jpayne@69: * Defines used for the flags argument to TkGenWMConfigureEvent. jpayne@69: */ jpayne@69: jpayne@69: #define TK_LOCATION_CHANGED 1 jpayne@69: #define TK_SIZE_CHANGED 2 jpayne@69: #define TK_BOTH_CHANGED 3 jpayne@69: #define TK_MACOSX_HANDLE_EVENT_IMMEDIATELY 1024 jpayne@69: jpayne@69: /* jpayne@69: * Defines for tkTextDisp.c and tkFont.c jpayne@69: */ jpayne@69: jpayne@69: #define TK_LAYOUT_WITH_BASE_CHUNKS 1 jpayne@69: #define TK_DRAW_IN_CONTEXT 1 jpayne@69: jpayne@69: /* jpayne@69: * Prototypes of internal procs not in the stubs table. jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE void TkMacOSXDefaultStartupScript(void); jpayne@69: MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, jpayne@69: int y, int width, int height); jpayne@69: MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); jpayne@69: MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable); jpayne@69: jpayne@69: /* jpayne@69: * Include the stubbed internal platform-specific API. jpayne@69: */ jpayne@69: jpayne@69: #include "tkIntPlatDecls.h" jpayne@69: jpayne@69: #endif /* _TKMACINT */ jpayne@69: jpayne@69: /* jpayne@69: * Local Variables: jpayne@69: * mode: objc jpayne@69: * c-basic-offset: 4 jpayne@69: * fill-column: 79 jpayne@69: * coding: utf-8 jpayne@69: * End: jpayne@69: */