#include "wx/defs.h"
#include "wx/dc.h"
#include "wx/mac/uma.h"
+#include <MacTextEditor.h>
#ifndef __DARWIN__
#include <Navigation.h>
// windows manager, control manager, navigation services etc. are
// present
+#define wxUSE_MLTE 0
+
static bool sUMAHasAppearance = false ;
static long sUMAAppearanceVersion = 0 ;
extern int gAGABackgroundColor ;
{
NavUnload() ;
}
+#if wxUSE_MLTE
+ TXNTerminateTextension( ) ;
+#endif
}
void UMAInitToolbox( UInt16 inMoreMastersCalls )
{
{
NavLoad() ;
}
+
+#if wxUSE_MLTE
+ TXNMacOSPreferredFontDescription defaults;
+ defaults.fontID = kFontIDGeneva ;
+ defaults.pointSize = (10 << 16) ;
+ defaults.fontStyle = kTXNDefaultFontStyle;
+ defaults.encoding = kTXNSystemDefaultEncoding;
+ TXNInitTextension(&defaults, 1, (kTXNAlwaysUseQuickDrawTextMask | kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask));
+#endif
}
// process manager
void UMAActivateControl( ControlHandle inControl )
{
- if ( !IsControlActive( inControl ) )
- {
+ // we have to add the control after again to the update rgn
+ // otherwise updates get lost
+ if ( !IsControlActive( inControl ) )
+ {
bool visible = IsControlVisible( inControl ) ;
if ( visible )
SetControlVisibility( inControl , false , false ) ;
Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
}
- }
+ }
}
void UMADrawControl( ControlHandle inControl )
WindowRef theWindow = GetControlOwner(inControl) ;
RgnHandle updateRgn = NewRgn() ;
GetWindowUpdateRgn( theWindow , updateRgn ) ;
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
- ::DrawControlInCurrentPort( inControl ) ;
- InvalWindowRgn( theWindow, updateRgn) ;
- DisposeRgn( updateRgn ) ;
-
+ Point zero = { 0 , 0 } ;
+ LocalToGlobal( &zero ) ;
+ OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
+ ::DrawControlInCurrentPort( inControl ) ;
+ InvalWindowRgn( theWindow, updateRgn) ;
+ DisposeRgn( updateRgn ) ;
}
void UMAMoveControl( ControlHandle inControl , short x , short y )
SetControlVisibility( inControl , false , false ) ;
Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
+ }
::SizeControl( inControl , x , y ) ;
if ( visible ) {
SetControlVisibility( inControl , true , false ) ;
void UMADeactivateControl( ControlHandle inControl )
{
- if ( IsControlActive( inControl ) )
- {
+ // we have to add the control after again to the update rgn
+ // otherwise updates get lost
bool visible = IsControlVisible( inControl ) ;
if ( visible )
SetControlVisibility( inControl , false , false ) ;
Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
}
- }
}
// shows the control and adds the region to the update region
void UMAShowControl (ControlHandle inControl)
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
}
+// shows the control and adds the region to the update region
+void UMAHideControl (ControlHandle inControl)
+{
+ SetControlVisibility( inControl , false , false ) ;
+ Rect ctrlBounds ;
+ InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+}
// keyboard focus
OSErr UMASetKeyboardFocus (WindowPtr inWindow,
ControlHandle inControl,
SetPortWindowPort( inWindow ) ;
- SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ;
return err ;
GrafPtr port ;
GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ;
- SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ;
return ::DrawThemePlacard( inRect , inState ) ;
}
+static OSStatus helpMenuStatus = noErr ;
+static MenuRef helpMenuHandle = NULL ;
+static MenuItemIndex firstCustomItemIndex = 0 ;
+
+OSStatus UMAGetHelpMenu(
+ MenuRef * outHelpMenu,
+ MenuItemIndex * outFirstCustomItemIndex)
+{
+#if TARGET_CARBON
+ return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
+#else
+ if ( helpMenuHandle == NULL )
+ {
+ helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
+ if ( helpMenuStatus == noErr )
+ {
+ firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
+ }
+ }
+ if ( outFirstCustomItemIndex )
+ {
+ *outFirstCustomItemIndex = firstCustomItemIndex ;
+ }
+ *outHelpMenu = helpMenuHandle ;
+ return helpMenuStatus ;
+#endif
+}