1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Universal MacOS API
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__POWERPC__)
16 #if defined(__DARWIN__)
17 #include <Carbon/Carbon.h>
22 // this is now defined in the latest headers
23 // typedef short MenuItemIndex ;
26 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
27 void UMACleanupToolbox() ;
28 bool UMAHasAppearance() ;
29 long UMAGetAppearanceVersion() ;
30 bool UMAHasWindowManager() ;
31 long UMAGetWindowManagerAttr() ;
35 long UMAGetProcessMode() ;
36 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
40 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
41 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
42 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
43 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
44 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
45 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
46 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
47 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
48 // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ;
50 // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ;
51 // void UMADisposeMenu( MenuRef menu ) ;
53 // handling the menubar
55 // void UMADeleteMenu( SInt16 menuId ) ;
56 // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ;
57 // void UMADrawMenuBar() ;
61 void UMAShowWatchCursor() ;
62 void UMAShowArrowCursor() ;
64 #if TARGET_CARBON && PM_USE_SESSION_APIS
65 OSStatus
UMAPrOpen(PMPrintSession
*macPrintSession
) ;
66 OSStatus
UMAPrClose(PMPrintSession
*macPrintSession
) ;
68 OSStatus
UMAPrOpen() ;
69 OSStatus
UMAPrClose() ;
74 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
75 void UMADisposeWindow( WindowRef inWindowRef
) ;
76 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
77 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
79 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
80 //void UMAShowWindow( WindowRef inWindowRef ) ;
81 //void UMAHideWindow( WindowRef inWindowRef ) ;
82 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
83 //void UMASelectWindow( WindowRef inWindowRef ) ;
84 //void UMABringToFront( WindowRef inWindowRef ) ;
85 //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
86 // void UMACloseWindow(WindowRef inWindowRef) ;
90 void UMADrawControl( ControlHandle inControl
) ;
92 void UMAEnableControl( ControlHandle inControl
) ;
93 void UMADisableControl( ControlHandle inControl
) ;
94 void UMAActivateControl( ControlHandle inControl
) ;
95 void UMADeactivateControl( ControlHandle inControl
) ;
96 //void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
97 // const Rect * bounds,
98 // ThemeDrawState inState,
100 // Boolean inColorDev);
101 //void UMASetThemeWindowBackground (WindowRef inWindow,
102 // ThemeBrush inBrush,
103 // Boolean inUpdate) ;
105 ControlHandle ::NewControl(WindowPtr owningWindow,
106 const Rect * boundsRect,
107 ConstStr255Param controlTitle,
108 Boolean initiallyVisible,
113 SInt32 controlReference) ;
115 //void UMADisposeControl (ControlHandle theControl) ;
116 //void UMAHiliteControl (ControlHandle theControl,
117 // ControlPartCode hiliteState) ;
118 void UMAShowControl (ControlHandle theControl
) ;
119 //void UMAHideControl (ControlHandle theControl);
120 //void UMASetControlVisibility (ControlHandle inControl,
121 // Boolean inIsVisible,
122 // Boolean inDoDraw);
124 //bool UMAIsControlActive (ControlHandle inControl);
125 //bool UMAIsControlVisible (ControlHandle inControl);
126 void UMAActivateControl (ControlHandle inControl
);
127 void UMADeactivateControl (ControlHandle inControl
);
129 //OSErr UMAGetBestControlRect (ControlHandle inControl,
131 // SInt16 * outBaseLineOffset);
132 //OSErr UMASetControlFontStyle (ControlHandle inControl,
133 // const ControlFontStyleRec * inStyle) ;
136 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
137 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
140 //OSErr UMACreateRootControl (WindowPtr inWindow,
141 // ControlHandle * outControl) ;
143 //OSErr UMAEmbedControl (ControlHandle inControl,
144 // ControlHandle inContainer);
147 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
148 ControlHandle inControl
,
149 ControlFocusPart inPart
) ;
154 //ControlPartCode UMAHandleControlClick (ControlHandle inControl,
156 // SInt16 inModifiers,
157 // ControlActionUPP inAction) ;
158 //SInt16 UMAHandleControlKey (ControlHandle inControl,
160 // SInt16 inCharCode,
161 // SInt16 inModifiers);
163 //void UMAIdleControls (WindowPtr inWindow) ;
165 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
166 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
168 // handling control data
170 OSErr ::SetControlData (ControlHandle inControl,
171 ControlPartCode inPart,
176 OSErr ::GetControlData (ControlHandle inControl,
177 ControlPartCode inPart,
181 Size * outActualSize) ;
182 OSErr ::GetControlDataSize (ControlHandle inControl,
183 ControlPartCode inPart,
190 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
191 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
192 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
193 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
194 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
195 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
196 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
200 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
201 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
202 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
204 void UMAShowFloatingWindows() ;
205 void UMAHideFloatingWindows() ;
206 Boolean UMAAreFloatingWindowsVisible() ;
207 WindowRef UMAFrontWindow() ;
208 WindowRef UMAFrontNonFloatingWindow() ;
212 bool UMAIsWindowFloating( WindowRef inWindow
) ;
213 bool UMAIsWindowModal( WindowRef inWindow
) ;
215 WindowRef UMAGetActiveWindow() ;
216 WindowRef UMAGetActiveNonFloatingWindow() ;
218 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
221 #define GetPortTextFont( p) ((p)->txFont )
222 #define GetPortTextSize( p) ((p)->txSize )
223 #define GetPortTextFace( p) ((p)->txFace )
224 #define GetPortTextMode( p) ((p)->txMode )
225 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
226 #define GetPortBounds( p , b) ((*b) = p->portRect )
227 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
228 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
229 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
230 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
231 #define GetQDGlobalsScreenBits( a ) ((*a) = qd.screenBits)
232 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
233 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
234 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
235 #define GetControlOwner( control ) ((**control).contrlOwner)
236 #define InvalWindowRgn( window , rgn ) InvalRgn( rgn )
237 #define GetPortPenMode( p ) (p->pnMode)
238 #define SetPortPenMode( p , mode ) (p->pnMode = mode )
241 #define GetControlReference( control ) ((**control).contrlRfCon)
245 #define SetListSelectionFlags( list , options ) (**list).selFlags = options
246 #define GetListRefCon( list ) (**list).refCon
250 #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )
252 // Appearance Drawing
254 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;