#include <Carbon/Carbon.h>
#endif
#else
- #define UMA_USE_APPEARANCE 0
+ #define UMA_USE_APPEARANCE 1
#define UMA_USE_WINDOWMGR 0
#endif
+#if UMA_USE_APPEARANCE == 0
+ #pragma error "wxMac needs appearance"
+#endif
+
#if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
#undef UMA_USE_WINDOWMGR
#define UMA_USE_WINDOWMGR 0
void UMADrawControl( ControlHandle inControl ) ;
+void UMAEnableControl( ControlHandle inControl ) ;
+void UMADisableControl( ControlHandle inControl ) ;
void UMAActivateControl( ControlHandle inControl ) ;
void UMADeactivateControl( ControlHandle inControl ) ;
void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
WindowRef m_macWindow ;
ControlHandle m_macRootControl ;
wxWindow* m_macFocus ;
+ bool m_macHasReceivedFirstActivate ;
} MacWindowData ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 ,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 ,
kControlBehaviorOffsetContents +
( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 ,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 ,
kControlBehaviorOffsetContents +
( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 ,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0,
kControlPopupButtonProc , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
#endif
::SetControlTitle( m_macControl , maclabel ) ;
}
+ Refresh() ;
}
wxSize wxControl::DoGetBestSize() const
m_macControlIsShown = true ;
MacAdjustControlRect() ;
wxAssociateControlWithMacControl( m_macControl , this ) ;
+ UMAShowControl( m_macControl ) ;
}
void wxControl::MacAdjustControlRect()
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
}
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( macrootwindow, &inval ) ;
- }
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect(macrootwindow, &inval ) ;
- }
}
if ( actualX != former_x || actualY != former_y )
if ( m_macControl )
{
-
- if ( UMAHasAppearance() )
- {
- if ( enable )
- ::ActivateControl( m_macControl ) ;
- else
- ::DeactivateControl( m_macControl ) ;
- }
+ if ( enable )
+ UMAActivateControl( m_macControl ) ;
else
- {
- if ( enable )
- ::HiliteControl( m_macControl , 0 ) ;
- else
- ::HiliteControl( m_macControl , 255 ) ;
- }
+ UMADeactivateControl( m_macControl ) ;
}
return TRUE ;
}
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , range,
kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , kwxMacListWithVerticalScrollbar , 0 , 0,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , kwxMacListWithVerticalScrollbar , 0 , 0,
kControlListBoxProc , (long) this ) ;
long result ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , label , pos , size ,style, val , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlRadioButtonProc , (long) this ) ;
MacPostControlCreate() ;
{
int i;
wxRadioButton *cycle;
-
+ if ( GetControlValue( m_macControl ) == val )
+ return ;
+
::SetControlValue( m_macControl , val ) ;
-
+ Refresh() ;
if (val)
{
cycle=this->NextInCycle();
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
- SetValue(true) ;
+ SetValue(true) ;
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
event.SetEventObject(this);
event.SetInt( GetValue() );
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 100,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 100,
kControlScrollBarLiveProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds ,
- title , true , value , minValue , maxValue,
+ title , false , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPreControlCreate( parent , id , "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 100,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 100,
kControlLittleArrowsProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlSeparatorLineProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , false , 0 , 0 , 1,
( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
MacPostControlCreate() ;
if ( icon )
{
- m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
+ m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
ControlButtonContentInfo info ;
}
else
{
- m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
+ m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
}
+ UMAShowControl( m_macToolHandle ) ;
m_macToolHandles.Add( m_macToolHandle ) ;
tool->m_index = m_macToolHandles.Count() -1 ;
if ( !tool->IsEnabled() )
void UMAShowWindow( WindowRef inWindowRef )
{
ShowWindow( inWindowRef ) ;
+
}
void UMAHideWindow( WindowRef inWindowRef )
void UMAActivateControl( ControlHandle inControl )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
- {
+ {
+ if ( !UMAIsControlActive( inControl ) )
+ {
+ bool visible = IsControlVisible( inControl ) ;
+ if ( visible )
+ SetControlVisibility( inControl , false , false ) ;
::ActivateControl( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
+ }
}
else
#endif
{
}
#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
-DisposeRgn( updateRgn ) ;
-
}
void UMADrawControl( ControlHandle inControl )
void UMAMoveControl( ControlHandle inControl , short x , short y )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
+ bool visible = UMAIsControlVisible( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , false , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
::MoveControl( inControl , x , y ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
}
- else
-#endif
-#if !TARGET_CARBON
- {
- AGAMoveControl( inControl , x ,y ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
void UMASizeControl( ControlHandle inControl , short x , short y )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
+ bool visible = UMAIsControlVisible( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , false , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
::SizeControl( inControl , x , y ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
}
- else
-#endif
-#if !TARGET_CARBON
- {
- AGASizeControl( inControl , x ,y ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
-
}
void UMADeactivateControl( ControlHandle inControl )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
+ if ( UMAIsControlActive( inControl ) )
+ {
+ bool visible = IsControlVisible( inControl ) ;
+ if ( visible )
+ SetControlVisibility( inControl , false , false ) ;
::DeactivateControl( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
+ }
}
- else
-#endif
-#if !TARGET_CARBON
- {
- AGADeactivateControl( inControl ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
void UMASetThemeWindowBackground (WindowRef inWindow,
void UMAHiliteControl (ControlHandle inControl,
ControlPartCode hiliteState)
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
if ( UMAHasAppearance() )
{
::HiliteControl( inControl , hiliteState ) ;
{
::HiliteControl( inControl , hiliteState ) ;
}
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
+// shows the control and adds the region to the update region
void UMAShowControl (ControlHandle inControl)
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
if ( UMAHasAppearance() )
{
- ::ShowControl( inControl ) ;
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
else
{
- ::ShowControl( inControl ) ;
+ (**inControl).contrlVis = 255 ;
}
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
-
+// Hides the control and adds the region to the update region
void UMAHideControl (ControlHandle inControl)
{
if ( UMAHasAppearance() )
{
return IsControlVisible( inControl ) ;
}
+ else
#endif
+ {
+#if !TARGET_CARBON
+ return (**inControl).contrlVis == 255 ;
+#endif
+ }
return true ;
}
{
}
#endif
+ return noErr ;
}
// Destructor
wxWindow::~wxWindow()
{
+ // deleting a window while it is shown invalidates the region
+ if ( IsShown() ) {
+ wxWindow* iter = this ;
+ while( iter ) {
+ if ( iter->m_macWindowData )
+ {
+ Refresh() ;
+ break ;
+ }
+ iter = iter->GetParent() ;
+
+ }
+ }
+
m_isBeingDeleted = TRUE;
if ( s_lastMouseWindow == this )
}
MacSuperShown( show ) ;
Refresh() ;
- /*
- // this will be done by the activate event
- if(m_macWindowData)
- MacUpdateImmediately() ;
- */
+
return TRUE;
}
void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
{
+// if ( !IsShown() )
+// return ;
+
wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() )
{
UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
m_macWindowData->m_macFocus = NULL ;
+ m_macWindowData->m_macHasReceivedFirstActivate = true ;
}
void wxWindow::MacPaint( wxPaintEvent &event )
else
event.SetEventType(wxEVT_LEFT_DCLICK ) ;
}
+ lastWhen = 0 ;
+ }
+ else
+ {
+ lastWhen = ev->when ;
}
- lastWhen = ev->when ;
lastWhere = localwhere ;
}
}
void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating )
{
+ if ( !m_macWindowData->m_macHasReceivedFirstActivate )
+ m_macWindowData->m_macHasReceivedFirstActivate = true ;
+
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
event.m_timeStamp = ev->when ;
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
+ Refresh() ;
UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
- Refresh() ;
- MacUpdateImmediately() ;
+// MacUpdateImmediately() ;
}
void wxWindow::MacRedraw( RgnHandle updatergn , long time)
GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out
- if ( !EmptyRgn( region ) )
+ if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
{
win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
}
GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out
- if ( !EmptyRgn( region ) )
+ if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
{
MacRedraw( region , ev->when ) ;
}
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 ,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0,
kControlPopupButtonProc , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
#endif
::SetControlTitle( m_macControl , maclabel ) ;
}
+ Refresh() ;
}
wxSize wxControl::DoGetBestSize() const
m_macControlIsShown = true ;
MacAdjustControlRect() ;
wxAssociateControlWithMacControl( m_macControl , this ) ;
+ UMAShowControl( m_macControl ) ;
}
void wxControl::MacAdjustControlRect()
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
}
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( macrootwindow, &inval ) ;
- }
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect(macrootwindow, &inval ) ;
- }
}
if ( actualX != former_x || actualY != former_y )
if ( m_macControl )
{
-
- if ( UMAHasAppearance() )
- {
- if ( enable )
- ::ActivateControl( m_macControl ) ;
- else
- ::DeactivateControl( m_macControl ) ;
- }
+ if ( enable )
+ UMAActivateControl( m_macControl ) ;
else
- {
- if ( enable )
- ::HiliteControl( m_macControl , 0 ) ;
- else
- ::HiliteControl( m_macControl , 255 ) ;
- }
+ UMADeactivateControl( m_macControl ) ;
}
return TRUE ;
}
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , range,
kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , kwxMacListWithVerticalScrollbar , 0 , 0,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , kwxMacListWithVerticalScrollbar , 0 , 0,
kControlListBoxProc , (long) this ) ;
long result ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , label , pos , size ,style, val , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlRadioButtonProc , (long) this ) ;
MacPostControlCreate() ;
{
int i;
wxRadioButton *cycle;
-
+ if ( GetControlValue( m_macControl ) == val )
+ return ;
+
::SetControlValue( m_macControl , val ) ;
-
+ Refresh() ;
if (val)
{
cycle=this->NextInCycle();
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
- SetValue(true) ;
+ SetValue(true) ;
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
event.SetEventObject(this);
event.SetInt( GetValue() );
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 100,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 100,
kControlScrollBarLiveProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds ,
- title , true , value , minValue , maxValue,
+ title , false , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPreControlCreate( parent , id , "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 100,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 100,
kControlLittleArrowsProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlSeparatorLineProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ;
MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ;
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , false , 0 , 0 , 1,
( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
MacPostControlCreate() ;
if ( icon )
{
- m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
+ m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
ControlButtonContentInfo info ;
}
else
{
- m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
+ m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
}
+ UMAShowControl( m_macToolHandle ) ;
m_macToolHandles.Add( m_macToolHandle ) ;
tool->m_index = m_macToolHandles.Count() -1 ;
if ( !tool->IsEnabled() )
void UMAShowWindow( WindowRef inWindowRef )
{
ShowWindow( inWindowRef ) ;
+
}
void UMAHideWindow( WindowRef inWindowRef )
void UMAActivateControl( ControlHandle inControl )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
- {
+ {
+ if ( !UMAIsControlActive( inControl ) )
+ {
+ bool visible = IsControlVisible( inControl ) ;
+ if ( visible )
+ SetControlVisibility( inControl , false , false ) ;
::ActivateControl( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
+ }
}
else
#endif
{
}
#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
-DisposeRgn( updateRgn ) ;
-
}
void UMADrawControl( ControlHandle inControl )
void UMAMoveControl( ControlHandle inControl , short x , short y )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
+ bool visible = UMAIsControlVisible( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , false , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
::MoveControl( inControl , x , y ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
}
- else
-#endif
-#if !TARGET_CARBON
- {
- AGAMoveControl( inControl , x ,y ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
void UMASizeControl( ControlHandle inControl , short x , short y )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
+ bool visible = UMAIsControlVisible( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , false , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
::SizeControl( inControl , x , y ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
}
- else
-#endif
-#if !TARGET_CARBON
- {
- AGASizeControl( inControl , x ,y ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
-
}
void UMADeactivateControl( ControlHandle inControl )
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
+ if ( UMAIsControlActive( inControl ) )
+ {
+ bool visible = IsControlVisible( inControl ) ;
+ if ( visible )
+ SetControlVisibility( inControl , false , false ) ;
::DeactivateControl( inControl ) ;
+ if ( visible ) {
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+ }
+ }
}
- else
-#endif
-#if !TARGET_CARBON
- {
- AGADeactivateControl( inControl ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
void UMASetThemeWindowBackground (WindowRef inWindow,
void UMAHiliteControl (ControlHandle inControl,
ControlPartCode hiliteState)
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
if ( UMAHasAppearance() )
{
::HiliteControl( inControl , hiliteState ) ;
{
::HiliteControl( inControl , hiliteState ) ;
}
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
+// shows the control and adds the region to the update region
void UMAShowControl (ControlHandle inControl)
{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#if TARGET_CARBON
- GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
-#else
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
-#endif
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
if ( UMAHasAppearance() )
{
- ::ShowControl( inControl ) ;
+ SetControlVisibility( inControl , true , false ) ;
+ InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
else
{
- ::ShowControl( inControl ) ;
+ (**inControl).contrlVis = 255 ;
}
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
}
-
+// Hides the control and adds the region to the update region
void UMAHideControl (ControlHandle inControl)
{
if ( UMAHasAppearance() )
{
return IsControlVisible( inControl ) ;
}
+ else
#endif
+ {
+#if !TARGET_CARBON
+ return (**inControl).contrlVis == 255 ;
+#endif
+ }
return true ;
}
{
}
#endif
+ return noErr ;
}
// Destructor
wxWindow::~wxWindow()
{
+ // deleting a window while it is shown invalidates the region
+ if ( IsShown() ) {
+ wxWindow* iter = this ;
+ while( iter ) {
+ if ( iter->m_macWindowData )
+ {
+ Refresh() ;
+ break ;
+ }
+ iter = iter->GetParent() ;
+
+ }
+ }
+
m_isBeingDeleted = TRUE;
if ( s_lastMouseWindow == this )
}
MacSuperShown( show ) ;
Refresh() ;
- /*
- // this will be done by the activate event
- if(m_macWindowData)
- MacUpdateImmediately() ;
- */
+
return TRUE;
}
void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
{
+// if ( !IsShown() )
+// return ;
+
wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() )
{
UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
m_macWindowData->m_macFocus = NULL ;
+ m_macWindowData->m_macHasReceivedFirstActivate = true ;
}
void wxWindow::MacPaint( wxPaintEvent &event )
else
event.SetEventType(wxEVT_LEFT_DCLICK ) ;
}
+ lastWhen = 0 ;
+ }
+ else
+ {
+ lastWhen = ev->when ;
}
- lastWhen = ev->when ;
lastWhere = localwhere ;
}
}
void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating )
{
+ if ( !m_macWindowData->m_macHasReceivedFirstActivate )
+ m_macWindowData->m_macHasReceivedFirstActivate = true ;
+
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
event.m_timeStamp = ev->when ;
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
+ Refresh() ;
UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
- Refresh() ;
- MacUpdateImmediately() ;
+// MacUpdateImmediately() ;
}
void wxWindow::MacRedraw( RgnHandle updatergn , long time)
GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out
- if ( !EmptyRgn( region ) )
+ if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
{
win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
}
GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out
- if ( !EmptyRgn( region ) )
+ if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
{
MacRedraw( region , ev->when ) ;
}