summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXPrivate.h
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2012-09-12 03:05:29 (GMT)
committerKevin Walzer <kw@codebykevin.com>2012-09-12 03:05:29 (GMT)
commit4d00df90e7901e55bc22ae2b9589a9c005f6d9f7 (patch)
tree531b9edd57ee78802a71cb6c0fd09a0367f59211 /macosx/tkMacOSXPrivate.h
parent799666382d309825a9bd5d7205fd05662a742391 (diff)
downloadtk-4d00df90e7901e55bc22ae2b9589a9c005f6d9f7.zip
tk-4d00df90e7901e55bc22ae2b9589a9c005f6d9f7.tar.gz
tk-4d00df90e7901e55bc22ae2b9589a9c005f6d9f7.tar.bz2
Review branch for merge of Tk-Cocoa into Tk 8.5 main branch
Diffstat (limited to 'macosx/tkMacOSXPrivate.h')
-rw-r--r--macosx/tkMacOSXPrivate.h422
1 files changed, 226 insertions, 196 deletions
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 0059038..034c450 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -3,88 +3,38 @@
*
* Macros and declarations that are purely internal & private to TkAqua.
*
- * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright 2008-2009, Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id$
*/
#ifndef _TKMACPRIV
#define _TKMACPRIV
-#ifndef _TKMACINT
-#include "tkMacOSXInt.h"
+#if !__OBJC__
+#error Objective-C compiler required
#endif
-/* Define constants only available on Mac OS X 10.3 or later */
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
- #define kEventAppAvailableWindowBoundsChanged 110
- #define kEventParamTransactionID 'trns'
- #define kEventParamWindowPartCode 'wpar'
- #define typeWindowPartCode 'wpar'
- #define kMenuAttrDoNotUseUserCommandKeys (1 << 7)
- #define kSimpleWindowClass 18
- #define kWindowDoesNotCycleAttribute (1L << 15)
- #define kWindowAsyncDragAttribute (1L << 23)
- #define kThemeBrushAlternatePrimaryHighlightColor -5
- #define kThemeResizeUpCursor 19
- #define kThemeResizeDownCursor 19
- #define kThemeResizeUpDownCursor 19
- #define kThemePoofCursor 19
- #define kThemeBackgroundMetal 6
- #define kThemeIncDecButtonSmall 21
- #define kThemeIncDecButtonMini 22
- #define kThemeComboBox 16
- #define kThemeMiniSystemFont 109
- #define kAppearancePartUpButton 20
- #define kAppearancePartDownButton 21
- #define kAppearancePartPageUpArea 22
- #define kAppearancePartPageDownArea 23
- #define kAppearancePartIndicator 129
- #define kUIModeAllSuppressed 4
- #define FixedToInt(a) ((short)(((Fixed)(a) + fixed1/2) >> 16))
- #define IntToFixed(a) ((Fixed)(a) << 16)
-#endif
-/* Define constants only available on Mac OS X 10.4 or later */
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
- #define kWindowNoTitleBarAttribute (1L << 9)
- #define kWindowMetalNoContentSeparatorAttribute (1L << 11)
- #define kThemeDisclosureTriangle 6
- #define kThemeBrushListViewOddRowBackground 56
- #define kThemeBrushListViewEvenRowBackground 57
- #define kThemeBrushListViewColumnDivider 58
- #define kThemeMetricScrollBarMinThumbHeight 132
- #define kThemeMetricSmallScrollBarMinThumbHeight 134
- #define kThemeScrollBarMedium kThemeMediumScrollBar
- #define kThemeScrollBarSmall kThemeSmallScrollBar
- #ifdef __BIG_ENDIAN__
- #define kCGBitmapByteOrder32Host (4 << 12)
- #else
- #define kCGBitmapByteOrder32Host (2 << 12)
- #endif
-#endif
-/* Define constants only available on Mac OS X 10.5 or later */
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
- #define kWindowUnifiedTitleAndToolbarAttribute (1L << 7)
- #define kWindowTexturedSquareCornersAttribute (1L << 10)
+#define TextStyle MacTextStyle
+#import <ApplicationServices/ApplicationServices.h>
+#import <Cocoa/Cocoa.h>
+#ifndef NO_CARBON_H
+#import <Carbon/Carbon.h>
#endif
-/* HIToolbox version constants */
-#ifndef kHIToolboxVersionNumber10_3
- #define kHIToolboxVersionNumber10_3 (145)
-#endif
-#ifndef kHIToolboxVersionNumber10_4
- #define kHIToolboxVersionNumber10_4 (219)
+#undef TextStyle
+#import <objc/runtime.h> /* for sel_isEqual() */
+
+#ifndef _TKMACINT
+#include "tkMacOSXInt.h"
#endif
-#ifndef kHIToolboxVersionNumber10_5
- #define kHIToolboxVersionNumber10_5 (343)
+#ifndef _TKMACDEFAULT
+#include "tkMacOSXDefault.h"
#endif
-/* Macros for HIToolbox runtime version checking */
-MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
-#define TK_IF_HI_TOOLBOX(vers, ...) \
- tk_if_mac_os_x_min_10_##vers(tkMacOSXToolboxVersionNumber >= \
- kHIToolboxVersionNumber10_##vers, 1, __VA_ARGS__)
-#define TK_ELSE_HI_TOOLBOX(vers, ...) \
- tk_else_mac_os_x_min_10_##vers(__VA_ARGS__)
+
/* Macros for Mac OS X API availability checking */
#define TK_IF_MAC_OS_X_API(vers, symbol, ...) \
tk_if_mac_os_x_10_##vers(symbol != NULL, 1, __VA_ARGS__)
@@ -110,46 +60,6 @@ MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
#define tk_else_mac_os_x_no(...) \
} else { __VA_ARGS__
/* Private mapping macros defined according to Mac OS X version requirements */
-/* 10.3 Panther */
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1030
-#define tk_if_mac_os_x_min_10_3 tk_if_mac_os_x_yes
-#define tk_else_mac_os_x_min_10_3 tk_else_mac_os_x_yes
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_yes
-#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_yes
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
-#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
-#define tk_if_mac_os_x_min_10_3 tk_if_mac_os_x_chk
-#define tk_else_mac_os_x_min_10_3 tk_else_mac_os_x_chk
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_chk
-#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_chk
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
-#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
-#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_no
-#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_no
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
-/* 10.4 Tiger */
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1040
-#define tk_if_mac_os_x_min_10_4 tk_if_mac_os_x_yes
-#define tk_else_mac_os_x_min_10_4 tk_else_mac_os_x_yes
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_yes
-#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_yes
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
-#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
-#define tk_if_mac_os_x_min_10_4 tk_if_mac_os_x_chk
-#define tk_else_mac_os_x_min_10_4 tk_else_mac_os_x_chk
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_chk
-#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_chk
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
-#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
-#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_no
-#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_no
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
/* 10.5 Leopard */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_yes
@@ -185,26 +95,25 @@ MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
*/
#ifdef TK_MAC_DEBUG
+#define TKLog(f, ...) NSLog(f, ##__VA_ARGS__)
+
/*
* Macro to do debug message output.
*/
-#define TkMacOSXDbgMsg(m, ...) do { \
- fprintf(stderr, "%s:%d: %s(): " m "\n", strrchr(__FILE__, '/')+1, \
- __LINE__, __func__, ##__VA_ARGS__); \
- } while (0)
+#define TkMacOSXDbgMsg(m, ...) \
+ do { \
+ TKLog(@"%s:%d: %s(): " m, strrchr(__FILE__, '/')+1, \
+ __LINE__, __func__, ##__VA_ARGS__); \
+ } while (0)
+
/*
* Macro to do debug API failure message output.
*/
-#if !defined(DEBUGLEVEL) || !DEBUGLEVEL
-#define TkMacOSXDbgOSErr(f, err) do { \
- TkMacOSXDbgMsg("%s failed: %ld", #f, err); \
- } while (0)
-#else
-#define TkMacOSXDbgOSErr(f, err) do { \
- DEBUG_ASSERT_MESSAGE(kComponentSignatureString, #f " failed:", \
- __func__, 0, strrchr(__FILE__, '/')+1, __LINE__, err); \
- } while (0)
-#endif
+#define TkMacOSXDbgOSErr(f, err) \
+ do { \
+ TkMacOSXDbgMsg("%s failed: %d", #f, (int)(err)); \
+ } while (0)
+
/*
* Macro to do very common check for noErr return from given API and output
* debug message in case of failure.
@@ -215,19 +124,12 @@ MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
TkMacOSXDbgOSErr(f, err); \
} \
err;})
-/*
- * Macro to check emptyness of shared QD tmp region before use in debug builds.
- */
-#define TkMacOSXCheckTmpQdRgnEmpty() do { \
- if (!EmptyRgn(tkMacOSXtmpQdRgn)) { \
- Tcl_Panic("tkMacOSXtmpQdRgn nonempty"); \
- } \
- } while(0)
+
#else /* TK_MAC_DEBUG */
+#define TKLog(f, ...)
#define TkMacOSXDbgMsg(m, ...)
#define TkMacOSXDbgOSErr(f, err)
#define ChkErr(f, ...) ({f(__VA_ARGS__);})
-#define TkMacOSXCheckTmpQdRgnEmpty()
#endif /* TK_MAC_DEBUG */
/*
@@ -238,10 +140,25 @@ MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
if (symbol == (void*)(-1L)) { \
symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), \
- STRINGIFY(_##symbol)); \
+ STRINGIFY(symbol)); \
}
-MODULE_SCOPE void* TkMacOSXGetNamedSymbol(const char* module,
- const char* symbol);
+
+/*
+ * Macros for GC
+ */
+
+#define TkMacOSXMakeUncollectable(x) ({ id o = (id)(x); \
+ if (o) { if(tkMacOSXGCEnabled) CFRetain(o); } o; })
+#define TkMacOSXMakeUncollectableAndRetain(x) ({ id o = (id)(x); \
+ if (o) { if(tkMacOSXGCEnabled) CFRetain(o); else [o retain]; } o; })
+#define TkMacOSXMakeCollectable(x) ({ id o = (id)(x); \
+ if (o) { x = nil; if (tkMacOSXGCEnabled) CFRelease(o); } o; })
+#define TkMacOSXMakeCollectableAndRelease(x) ({ id o = (id)(x); \
+ if (o) { x = nil; if (tkMacOSXGCEnabled) CFRelease(o); \
+ else [o release]; } o; })
+#define TkMacOSXMakeCollectableAndAutorelease(x) ({ id o = (id)(x); \
+ if (o) { x = nil; if (tkMacOSXGCEnabled) CFRelease(o); \
+ else [o autorelease]; } o; })
/*
* Structure encapsulating current drawing environment.
@@ -249,90 +166,203 @@ MODULE_SCOPE void* TkMacOSXGetNamedSymbol(const char* module,
typedef struct TkMacOSXDrawingContext {
CGContextRef context;
- CGrafPtr port, savePort;
- ThemeDrawingState saveState;
- RgnHandle saveClip;
+ NSView *view;
HIShapeRef clipRgn;
- PixPatHandle penPat;
- Rect portBounds;
- Boolean portChanged;
+ CGRect portBounds;
+ int focusLocked;
} TkMacOSXDrawingContext;
/*
* Variables internal to TkAqua.
*/
-MODULE_SCOPE RgnHandle tkMacOSXtmpQdRgn;
-MODULE_SCOPE int tkMacOSXUseCGDrawing;
+MODULE_SCOPE CGFloat tkMacOSXZeroScreenHeight;
+MODULE_SCOPE CGFloat tkMacOSXZeroScreenTop;
+MODULE_SCOPE int tkMacOSXGCEnabled;
+MODULE_SCOPE long tkMacOSXMacOSXVersion;
+#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS
+MODULE_SCOPE int tkMacOSXUseCompatibilityMetrics;
+#endif
/*
* Prototypes for TkMacOSXRegion.c.
*/
#if 0
-MODULE_SCOPE void TkMacOSXEmtpyRegion(TkRegion r);
-MODULE_SCOPE int TkMacOSXIsEmptyRegion(TkRegion r);
+MODULE_SCOPE void TkMacOSXEmtpyRegion(TkRegion r);
+MODULE_SCOPE int TkMacOSXIsEmptyRegion(TkRegion r);
#endif
-MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
-MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r, HIShapeRef rgn);
-MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy);
-MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
+MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
+MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r,
+ HIShapeRef rgn);
+MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy);
+MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect(
- const CGRect *inRect);
-MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape(
- HIMutableShapeRef inDestShape, HIShapeRef inSrcShape);
+ const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape(
+ HIMutableShapeRef inDestShape,
+ HIShapeRef inSrcShape);
#if 0
-MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithRect(HIMutableShapeRef inShape,
- const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithRect(HIMutableShapeRef inShape,
+ const CGRect *inRect);
#endif
-MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect(
- HIMutableShapeRef inShape, const CGRect *inRect);
-MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape,
- const CGRect *inRect);
-MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1,
- HIShapeRef inShape2, HIMutableShapeRef outResult);
+MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect(
+ HIMutableShapeRef inShape, const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape,
+ const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1,
+ HIShapeRef inShape2, HIMutableShapeRef outResult);
/*
* Prototypes of TkAqua internal procs.
*/
-MODULE_SCOPE void TkMacOSXDisplayChanged(Display *display);
-MODULE_SCOPE void TkMacOSXInitScrollbarMetrics(void);
-MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable);
-MODULE_SCOPE void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
-MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable,
- int antiAlias);
-MODULE_SCOPE void TkMacOSXInitKeyboard(Tcl_Interp *interp);
-MODULE_SCOPE int TkMacOSXGenerateFocusEvent(Window window, int activeFlag);
-MODULE_SCOPE int TkMacOSXGenerateParentMenuSelectEvent(MenuRef menu);
-MODULE_SCOPE int TkMacOSXGenerateMenuSelectEvent(MenuRef menu,
- MenuItemIndex index);
-MODULE_SCOPE void TkMacOSXClearActiveMenu(MenuRef menu);
+MODULE_SCOPE void * TkMacOSXGetNamedSymbol(const char *module,
+ const char *symbol);
+MODULE_SCOPE void TkMacOSXDisplayChanged(Display *display);
+MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp,
+ int enable);
+MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable,
+ int antiAlias);
+MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr,
+ int activeFlag);
MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr);
-MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr);
-MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window);
+MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr);
+MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window);
MODULE_SCOPE EventModifiers TkMacOSXModifierState(void);
-MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
- TkMacOSXDrawingContext *dcPtr);
-MODULE_SCOPE void TkMacOSXRestoreDrawingContext(TkMacOSXDrawingContext *dcPtr);
-MODULE_SCOPE void TkMacOSXSetColorInPort(unsigned long pixel, int fg,
- PixPatHandle penPat, CGrafPtr port);
-MODULE_SCOPE void TkMacOSXSetColorInContext(unsigned long pixel,
- CGContextRef context);
-MODULE_SCOPE int TkMacOSXRunTclEventLoop(void);
-MODULE_SCOPE OSStatus TkMacOSXStartTclEventLoopCarbonTimer(void);
-MODULE_SCOPE OSStatus TkMacOSXStopTclEventLoopCarbonTimer(void);
-MODULE_SCOPE void TkMacOSXTrackingLoop(int tracking);
-MODULE_SCOPE OSStatus TkMacOSXReceiveAndDispatchEvent(void);
-MODULE_SCOPE void TkMacOSXInstallWindowCarbonEventHandler(Tcl_Interp *interp,
- WindowRef window);
-MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, WindowRef window,
- int fullscreen, Tcl_Interp *interp);
-MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr, int active);
-MODULE_SCOPE void TkMacOSXBringWindowForward(WindowRef wRef);
-MODULE_SCOPE WindowRef TkMacOSXDrawableWindow(Drawable drawable);
-MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
-MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
-MODULE_SCOPE Tcl_Obj* TkMacOSXGetStringObjFromCFString(CFStringRef str);
+MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc,
+ int useCG, TkMacOSXDrawingContext *dcPtr);
+MODULE_SCOPE void TkMacOSXRestoreDrawingContext(
+ TkMacOSXDrawingContext *dcPtr);
+MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel,
+ CGContextRef context);
+MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr,
+ NSWindow *window, int fullscreen,
+ Tcl_Interp *interp);
+MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr,
+ int active);
+MODULE_SCOPE NSWindow* TkMacOSXDrawableWindow(Drawable drawable);
+MODULE_SCOPE NSView* TkMacOSXDrawableView(MacDrawable *macWin);
+MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
+MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
+MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view,
+ HIShapeRef rgn);
+MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithDrawable(Drawable drawable);
+MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithTkImage(Display *display,
+ Tk_Image image, int width, int height);
+MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithBitmap(Display *display,
+ Pixmap bitmap, GC gc, int width, int height);
+MODULE_SCOPE CGColorRef TkMacOSXCreateCGColor(GC gc, unsigned long pixel);
+MODULE_SCOPE NSColor* TkMacOSXGetNSColor(GC gc, unsigned long pixel);
+MODULE_SCOPE Tcl_Obj * TkMacOSXGetStringObjFromCFString(CFStringRef str);
+MODULE_SCOPE TkWindow* TkMacOSXGetTkWindow(NSWindow *w);
+MODULE_SCOPE NSFont* TkMacOSXNSFontForFont(Tk_Font tkfont);
+MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont(Tk_Font tkfont);
+MODULE_SCOPE NSModalSession TkMacOSXGetModalSession(void);
+MODULE_SCOPE void TkMacOSXSelDeadWindow(TkWindow *winPtr);
+MODULE_SCOPE void TkMacOSXApplyWindowAttributes(TkWindow *winPtr,
+ NSWindow *macWindow);
+MODULE_SCOPE int TkMacOSXStandardAboutPanelObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+MODULE_SCOPE int TkMacOSXIconBitmapObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+
+#pragma mark Private Objective-C Classes
+
+#define VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
+
+enum { tkMainMenu = 1, tkApplicationMenu, tkWindowsMenu, tkHelpMenu};
+
+VISIBILITY_HIDDEN
+@interface TKMenu : NSMenu {
+@private
+ void *_tkMenu;
+ NSUInteger _tkOffset, _tkItemCount, _tkSpecial;
+}
+- (void)setSpecial:(NSUInteger)special;
+- (BOOL)isSpecial:(NSUInteger)special;
+@end
+
+VISIBILITY_HIDDEN
+@interface TKApplication : NSApplication {
+@private
+ Tcl_Interp *_eventInterp;
+ NSMenu *_servicesMenu;
+ TKMenu *_defaultMainMenu, *_defaultApplicationMenu;
+ NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems;
+ NSArray *_defaultHelpMenuItems;
+}
+@end
+@interface TKApplication(TKInit)
+- (NSString *)tkFrameworkImagePath:(NSString*)image;
+@end
+@interface TKApplication(TKEvent)
+- (NSEvent *)tkProcessEvent:(NSEvent *)theEvent;
+@end
+@interface TKApplication(TKMouseEvent)
+- (NSEvent *)tkProcessMouseEvent:(NSEvent *)theEvent;
+@end
+@interface TKApplication(TKKeyEvent)
+- (NSEvent *)tkProcessKeyEvent:(NSEvent *)theEvent;
+@end
+@interface TKApplication(TKMenu)
+- (void)tkSetMainMenu:(TKMenu *)menu;
+@end
+@interface TKApplication(TKClipboard)
+- (void)tkProvidePasteboard:(TkDisplay *)dispPtr;
+- (void)tkCheckPasteboard;
+@end
+
+VISIBILITY_HIDDEN
+@interface TKContentView : NSView <NSTextInput> {
+@private
+ id _savedSubviews;
+ BOOL _subviewsSetAside;
+ NSString *_workingText;
+}
+@end
+
+@interface TKContentView(TKKeyEvent)
+- (void) deleteWorkingText;
+@end
+
+VISIBILITY_HIDDEN
+@interface TKWindow : NSWindow
+@end
+
+#pragma mark NSMenu & NSMenuItem Utilities
+
+@interface NSMenu(TKUtils)
++ (id)menuWithTitle:(NSString *)title;
++ (id)menuWithTitle:(NSString *)title menuItems:(NSArray *)items;
++ (id)menuWithTitle:(NSString *)title submenus:(NSArray *)submenus;
+- (NSMenuItem *)itemWithSubmenu:(NSMenu *)submenu;
+- (NSMenuItem *)itemInSupermenu;
+@end
+
+@interface NSMenuItem(TKUtils)
++ (id)itemWithSubmenu:(NSMenu *)submenu;
++ (id)itemWithTitle:(NSString *)title submenu:(NSMenu *)submenu;
++ (id)itemWithTitle:(NSString *)title action:(SEL)action;
++ (id)itemWithTitle:(NSString *)title action:(SEL)action
+ target:(id)target;
++ (id)itemWithTitle:(NSString *)title action:(SEL)action
+ keyEquivalent:(NSString *)keyEquivalent;
++ (id)itemWithTitle:(NSString *)title action:(SEL)action
+ target:(id)target keyEquivalent:(NSString *)keyEquivalent;
++ (id)itemWithTitle:(NSString *)title action:(SEL)action
+ keyEquivalent:(NSString *)keyEquivalent
+ keyEquivalentModifierMask:(NSUInteger)keyEquivalentModifierMask;
++ (id)itemWithTitle:(NSString *)title action:(SEL)action
+ target:(id)target keyEquivalent:(NSString *)keyEquivalent
+ keyEquivalentModifierMask:(NSUInteger)keyEquivalentModifierMask;
+@end
+
+/* From WebKit/WebKit/mac/WebCoreSupport/WebChromeClient.mm: */
+@interface NSWindow(TKGrowBoxRect)
+- (NSRect)_growBoxRect;
+@end
#endif /* _TKMACPRIV */