1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Universal MacOS API
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: LGPL licence
10 /////////////////////////////////////////////////////////////////////////////
15 // define this to be 1 if you have the 8.6 libs (weak linked)
19 // define this to be 1 if you have the carbon libs (weak linked or PreCarbon.lib)
21 #define UMA_USE_CARBON 0
23 #define UMA_USE_APPEARANCE 1
24 #define UMA_USE_WINDOWMGR 1
26 #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
27 #undef UMA_USE_WINDOWMGR
28 #define UMA_USE_WINDOWMGR 0
32 typedef short MenuItemIndex
;
35 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
36 bool UMAHasAppearance() ;
37 long UMAGetAppearanceVersion() ;
41 long UMAGetProcessMode() ;
42 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
46 void UMASetMenuTitle( MenuRef menu
, ConstStr255Param title
) ;
47 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
48 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
49 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
52 void UMAShowWatchCursor() ;
53 void UMAShowArrowCursor() ;
57 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
58 void UMADisposeWindow( WindowRef inWindowRef
) ;
59 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
60 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
62 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
63 void UMAShowWindow( WindowRef inWindowRef
) ;
64 void UMAHideWindow( WindowRef inWindowRef
) ;
65 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
66 void UMASelectWindow( WindowRef inWindowRef
) ;
67 void UMABringToFront( WindowRef inWindowRef
) ;
68 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
) ;
69 void UMACloseWindow(WindowRef inWindowRef
) ;
73 void UMADrawControl( ControlHandle inControl
) ;
75 void UMAActivateControl( ControlHandle inControl
) ;
76 void UMADeactivateControl( ControlHandle inControl
) ;
77 void UMASetThemeWindowBackground (WindowRef inWindow
,
80 ControlHandle
UMANewControl(WindowPtr owningWindow
,
81 const Rect
* boundsRect
,
82 ConstStr255Param controlTitle
,
83 Boolean initiallyVisible
,
88 SInt32 controlReference
) ;
89 void UMADisposeControl (ControlHandle theControl
) ;
90 void UMAHiliteControl (ControlHandle theControl
,
91 ControlPartCode hiliteState
) ;
92 void UMAShowControl (ControlHandle theControl
) ;
93 void UMAHideControl (ControlHandle theControl
);
94 void UMASetControlVisibility (ControlHandle inControl
,
98 bool UMAIsControlActive (ControlHandle inControl
);
99 bool UMAIsControlVisible (ControlHandle inControl
);
100 void UMAActivateControl (ControlHandle inControl
);
101 void UMADeactivateControl (ControlHandle inControl
);
103 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
105 SInt16
* outBaseLineOffset
);
106 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
107 const ControlFontStyleRec
* inStyle
) ;
110 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
111 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
114 OSErr
UMACreateRootControl (WindowPtr inWindow
,
115 ControlHandle
* outControl
) ;
117 OSErr
UMAEmbedControl (ControlHandle inControl
,
118 ControlHandle inContainer
);
121 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
122 ControlHandle inControl
,
123 ControlFocusPart inPart
) ;
128 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
131 ControlActionUPP inAction
) ;
132 SInt16
UMAHandleControlKey (ControlHandle inControl
,
137 void UMAIdleControls (WindowPtr inWindow
) ;
139 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
140 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
142 // handling control data
144 OSErr
UMASetControlData (ControlHandle inControl
,
145 ControlPartCode inPart
,
150 OSErr
UMAGetControlData (ControlHandle inControl
,
151 ControlPartCode inPart
,
155 Size
* outActualSize
) ;
156 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
157 ControlPartCode inPart
,
164 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
) ;
165 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
) ;
166 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
) ;
167 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
) ;
168 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
) ;
169 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
) ;
170 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
) ;
174 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
) ;
175 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
) ;
176 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
) ;
178 void UMAShowFloatingWindows() ;
179 void UMAHideFloatingWindows() ;
180 Boolean
UMAAreFloatingWindowsVisible() ;
181 WindowRef
UMAFrontWindow() ;
182 WindowRef
UMAFrontNonFloatingWindow() ;
186 bool UMAIsWindowFloating( WindowRef inWindow
) ;
187 bool UMAIsWindowModal( WindowRef inWindow
) ;
188 WindowRef
UMAGetActiveWindow() ;
189 WindowRef
UMAGetActiveNonFloatingWindow() ;
191 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;