rewrite to avoid unnecessary redraws

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-05-30 20:46:00 +00:00
parent 87dde0b5fc
commit fdaf613add
44 changed files with 234 additions and 409 deletions

View File

@@ -28,10 +28,14 @@
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#endif #endif
#else #else
#define UMA_USE_APPEARANCE 0 #define UMA_USE_APPEARANCE 1
#define UMA_USE_WINDOWMGR 0 #define UMA_USE_WINDOWMGR 0
#endif #endif
#if UMA_USE_APPEARANCE == 0
#pragma error "wxMac needs appearance"
#endif
#if !UMA_USE_8_6 && UMA_USE_WINDOWMGR #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
#undef UMA_USE_WINDOWMGR #undef UMA_USE_WINDOWMGR
#define UMA_USE_WINDOWMGR 0 #define UMA_USE_WINDOWMGR 0
@@ -101,6 +105,8 @@ void UMACloseWindow(WindowRef inWindowRef) ;
void UMADrawControl( ControlHandle inControl ) ; void UMADrawControl( ControlHandle inControl ) ;
void UMAEnableControl( ControlHandle inControl ) ;
void UMADisableControl( ControlHandle inControl ) ;
void UMAActivateControl( ControlHandle inControl ) ; void UMAActivateControl( ControlHandle inControl ) ;
void UMADeactivateControl( ControlHandle inControl ) ; void UMADeactivateControl( ControlHandle inControl ) ;
void UMAApplyThemeBackground (ThemeBackgroundKind inKind, void UMAApplyThemeBackground (ThemeBackgroundKind inKind,

View File

@@ -48,6 +48,7 @@ public:
WindowRef m_macWindow ; WindowRef m_macWindow ;
ControlHandle m_macRootControl ; ControlHandle m_macRootControl ;
wxWindow* m_macFocus ; wxWindow* m_macFocus ;
bool m_macHasReceivedFirstActivate ;
} MacWindowData ; } MacWindowData ;

View File

@@ -57,7 +57,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ; 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 + kControlBehaviorOffsetContents +
( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0, ( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ; (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;

View File

@@ -35,7 +35,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -57,7 +57,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ; 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 + kControlBehaviorOffsetContents +
( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0, ( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ; (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;

View File

@@ -35,7 +35,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -34,7 +34,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -44,7 +44,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ; m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;

View File

@@ -40,7 +40,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlPopupButtonProc , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ; m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;

View File

@@ -136,6 +136,7 @@ void wxControl::SetLabel(const wxString& title)
#endif #endif
::SetControlTitle( m_macControl , maclabel ) ; ::SetControlTitle( m_macControl , maclabel ) ;
} }
Refresh() ;
} }
wxSize wxControl::DoGetBestSize() const wxSize wxControl::DoGetBestSize() const
@@ -270,6 +271,7 @@ void wxControl::MacPostControlCreate()
m_macControlIsShown = true ; m_macControlIsShown = true ;
MacAdjustControlRect() ; MacAdjustControlRect() ;
wxAssociateControlWithMacControl( m_macControl , this ) ; wxAssociateControlWithMacControl( m_macControl , this ) ;
UMAShowControl( m_macControl ) ;
} }
void wxControl::MacAdjustControlRect() void wxControl::MacAdjustControlRect()
@@ -358,15 +360,7 @@ void wxControl::MacSuperChangedPosition()
if ( mac_x != former_mac_x || mac_y != former_mac_y ) 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 ) ; 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 ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{ {
@@ -494,15 +488,7 @@ void wxControl::DoSetSize(int x, int y,
if ( mac_x != former_mac_x || mac_y != former_mac_y ) 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 ) ; 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 ( actualX != former_x || actualY != former_y )
@@ -578,22 +564,11 @@ bool wxControl::Enable(bool enable)
return FALSE; return FALSE;
if ( m_macControl ) if ( m_macControl )
{
if ( UMAHasAppearance() )
{ {
if ( enable ) if ( enable )
::ActivateControl( m_macControl ) ; UMAActivateControl( m_macControl ) ;
else else
::DeactivateControl( m_macControl ) ; UMADeactivateControl( m_macControl ) ;
}
else
{
if ( enable )
::HiliteControl( m_macControl , 0 ) ;
else
::HiliteControl( m_macControl , 255 ) ;
}
} }
return TRUE ; return TRUE ;
} }

View File

@@ -41,7 +41,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ; 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 ) ; kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -67,7 +67,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlListBoxProc , (long) this ) ;
long result ; long result ;

View File

@@ -116,7 +116,7 @@ bool wxNotebook::Create(wxWindow *parent,
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -111,7 +111,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
MacPreControlCreate( parent , id , label , pos , size ,style, val , name , &bounds , title ) ; 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 ) ; kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -32,7 +32,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlRadioButtonProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;
@@ -67,9 +67,11 @@ void wxRadioButton::SetValue(bool val)
{ {
int i; int i;
wxRadioButton *cycle; wxRadioButton *cycle;
if ( GetControlValue( m_macControl ) == val )
return ;
::SetControlValue( m_macControl , val ) ; ::SetControlValue( m_macControl , val ) ;
Refresh() ;
if (val) if (val)
{ {
cycle=this->NextInCycle(); cycle=this->NextInCycle();

View File

@@ -41,7 +41,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlScrollBarLiveProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -133,7 +133,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
} }
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , 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 ) ; kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -49,7 +49,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
MacPreControlCreate( parent , id , "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ; 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 ) ; kControlLittleArrowsProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -41,7 +41,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -54,7 +54,7 @@ bool wxStaticLine::Create( wxWindow *parent,
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlSeparatorLineProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -39,7 +39,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -107,7 +107,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ; 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 ) ; ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -310,7 +310,7 @@ bool wxToolBar::Realize()
if ( icon ) if ( icon )
{ {
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ; behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
ControlButtonContentInfo info ; ControlButtonContentInfo info ;
@@ -321,9 +321,10 @@ bool wxToolBar::Realize()
} }
else else
{ {
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ; behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
} }
UMAShowControl( m_macToolHandle ) ;
m_macToolHandles.Add( m_macToolHandle ) ; m_macToolHandles.Add( m_macToolHandle ) ;
tool->m_index = m_macToolHandles.Count() -1 ; tool->m_index = m_macToolHandles.Count() -1 ;
if ( !tool->IsEnabled() ) if ( !tool->IsEnabled() )

View File

@@ -425,6 +425,7 @@ void UMAGetWTitleC( WindowRef inWindowRef , char *title )
void UMAShowWindow( WindowRef inWindowRef ) void UMAShowWindow( WindowRef inWindowRef )
{ {
ShowWindow( inWindowRef ) ; ShowWindow( inWindowRef ) ;
} }
void UMAHideWindow( WindowRef inWindowRef ) void UMAHideWindow( WindowRef inWindowRef )
@@ -459,20 +460,20 @@ void UMACloseWindow(WindowRef inWindowRef)
void UMAActivateControl( ControlHandle inControl ) 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 UMA_USE_APPEARANCE
if ( UMAHasAppearance() ) if ( UMAHasAppearance() )
{ {
if ( !UMAIsControlActive( inControl ) )
{
bool visible = IsControlVisible( inControl ) ;
if ( visible )
SetControlVisibility( inControl , false , false ) ;
::ActivateControl( inControl ) ; ::ActivateControl( inControl ) ;
if ( visible ) {
SetControlVisibility( inControl , true , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
}
} }
else else
#endif #endif
@@ -484,15 +485,6 @@ void UMAActivateControl( ControlHandle inControl )
{ {
} }
#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 UMADrawControl( ControlHandle inControl )
@@ -533,111 +525,54 @@ void UMADrawControl( ControlHandle inControl )
void UMAMoveControl( ControlHandle inControl , short x , short y ) 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() ) if ( UMAHasAppearance() )
{ {
bool visible = UMAIsControlVisible( inControl ) ;
if ( visible ) {
SetControlVisibility( inControl , false , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
::MoveControl( inControl , x , y ) ; ::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 ) 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() ) if ( UMAHasAppearance() )
{ {
bool visible = UMAIsControlVisible( inControl ) ;
if ( visible ) {
SetControlVisibility( inControl , false , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
::SizeControl( inControl , x , y ) ; ::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 ) 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 ( UMAHasAppearance() )
{ {
if ( UMAIsControlActive( inControl ) )
{
bool visible = IsControlVisible( inControl ) ;
if ( visible )
SetControlVisibility( inControl , false , false ) ;
::DeactivateControl( inControl ) ; ::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 UMASetThemeWindowBackground (WindowRef inWindow,
@@ -733,16 +668,6 @@ void UMADisposeControl (ControlHandle theControl)
void UMAHiliteControl (ControlHandle inControl, void UMAHiliteControl (ControlHandle inControl,
ControlPartCode hiliteState) 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() ) if ( UMAHasAppearance() )
{ {
::HiliteControl( inControl , hiliteState ) ; ::HiliteControl( inControl , hiliteState ) ;
@@ -751,45 +676,23 @@ void UMAHiliteControl (ControlHandle inControl,
{ {
::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) 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() ) if ( UMAHasAppearance() )
{ {
::ShowControl( inControl ) ; SetControlVisibility( inControl , true , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
} }
else 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) void UMAHideControl (ControlHandle inControl)
{ {
if ( UMAHasAppearance() ) if ( UMAHasAppearance() )
@@ -841,7 +744,13 @@ bool UMAIsControlVisible (ControlHandle inControl)
{ {
return IsControlVisible( inControl ) ; return IsControlVisible( inControl ) ;
} }
else
#endif #endif
{
#if !TARGET_CARBON
return (**inControl).contrlVis == 255 ;
#endif
}
return true ; return true ;
} }
@@ -1538,5 +1447,6 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
{ {
} }
#endif #endif
return noErr ;
} }

View File

@@ -152,6 +152,20 @@ void wxWindow::Init()
// Destructor // Destructor
wxWindow::~wxWindow() 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; m_isBeingDeleted = TRUE;
if ( s_lastMouseWindow == this ) if ( s_lastMouseWindow == this )
@@ -754,11 +768,7 @@ bool wxWindow::Show(bool show)
} }
MacSuperShown( show ) ; MacSuperShown( show ) ;
Refresh() ; Refresh() ;
/*
// this will be done by the activate event
if(m_macWindowData)
MacUpdateImmediately() ;
*/
return TRUE; return TRUE;
} }
@@ -899,6 +909,9 @@ void wxWindow::MacEraseBackground( Rect *rect )
void wxWindow::Refresh(bool eraseBack, const wxRect *rect) void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
{ {
// if ( !IsShown() )
// return ;
wxMacDrawingHelper focus( this ) ; wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() ) if ( focus.Ok() )
{ {
@@ -1143,6 +1156,7 @@ void wxWindow::MacCreateRealWindow( const wxString& title,
UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ; UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
m_macWindowData->m_macFocus = NULL ; m_macWindowData->m_macFocus = NULL ;
m_macWindowData->m_macHasReceivedFirstActivate = true ;
} }
void wxWindow::MacPaint( wxPaintEvent &event ) void wxWindow::MacPaint( wxPaintEvent &event )
@@ -1694,8 +1708,12 @@ void wxWindow::MacFireMouseEvent( EventRecord *ev )
else else
event.SetEventType(wxEVT_LEFT_DCLICK ) ; event.SetEventType(wxEVT_LEFT_DCLICK ) ;
} }
lastWhen = 0 ;
} }
else
{
lastWhen = ev->when ; lastWhen = ev->when ;
}
lastWhere = localwhere ; lastWhere = localwhere ;
} }
@@ -1768,15 +1786,18 @@ void wxWindow::MacMouseMoved( EventRecord *ev , short part)
} }
void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating ) void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating )
{ {
if ( !m_macWindowData->m_macHasReceivedFirstActivate )
m_macWindowData->m_macHasReceivedFirstActivate = true ;
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
event.m_timeStamp = ev->when ; event.m_timeStamp = ev->when ;
event.SetEventObject(this); event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(event);
UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
Refresh() ; Refresh() ;
MacUpdateImmediately() ; UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
// MacUpdateImmediately() ;
} }
void wxWindow::MacRedraw( RgnHandle updatergn , long time) void wxWindow::MacRedraw( RgnHandle updatergn , long time)
@@ -1942,7 +1963,7 @@ void wxWindow::MacUpdateImmediately()
GetPortVisibleRegion( GetWindowPort( window ), region ); GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out // 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 ) ; win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
} }
@@ -1973,7 +1994,7 @@ void wxWindow::MacUpdate( EventRecord *ev )
GetPortVisibleRegion( GetWindowPort( window ), region ); GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out // if windowshade gives incompatibility , take the follwing out
if ( !EmptyRgn( region ) ) if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
{ {
MacRedraw( region , ev->when ) ; MacRedraw( region , ev->when ) ;
} }

View File

@@ -34,7 +34,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -44,7 +44,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ; m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;

View File

@@ -40,7 +40,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlPopupButtonProc , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ; m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;

View File

@@ -136,6 +136,7 @@ void wxControl::SetLabel(const wxString& title)
#endif #endif
::SetControlTitle( m_macControl , maclabel ) ; ::SetControlTitle( m_macControl , maclabel ) ;
} }
Refresh() ;
} }
wxSize wxControl::DoGetBestSize() const wxSize wxControl::DoGetBestSize() const
@@ -270,6 +271,7 @@ void wxControl::MacPostControlCreate()
m_macControlIsShown = true ; m_macControlIsShown = true ;
MacAdjustControlRect() ; MacAdjustControlRect() ;
wxAssociateControlWithMacControl( m_macControl , this ) ; wxAssociateControlWithMacControl( m_macControl , this ) ;
UMAShowControl( m_macControl ) ;
} }
void wxControl::MacAdjustControlRect() void wxControl::MacAdjustControlRect()
@@ -358,15 +360,7 @@ void wxControl::MacSuperChangedPosition()
if ( mac_x != former_mac_x || mac_y != former_mac_y ) 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 ) ; 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 ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{ {
@@ -494,15 +488,7 @@ void wxControl::DoSetSize(int x, int y,
if ( mac_x != former_mac_x || mac_y != former_mac_y ) 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 ) ; 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 ( actualX != former_x || actualY != former_y )
@@ -578,22 +564,11 @@ bool wxControl::Enable(bool enable)
return FALSE; return FALSE;
if ( m_macControl ) if ( m_macControl )
{
if ( UMAHasAppearance() )
{ {
if ( enable ) if ( enable )
::ActivateControl( m_macControl ) ; UMAActivateControl( m_macControl ) ;
else else
::DeactivateControl( m_macControl ) ; UMADeactivateControl( m_macControl ) ;
}
else
{
if ( enable )
::HiliteControl( m_macControl , 0 ) ;
else
::HiliteControl( m_macControl , 255 ) ;
}
} }
return TRUE ; return TRUE ;
} }

View File

@@ -41,7 +41,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ; 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 ) ; kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -67,7 +67,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlListBoxProc , (long) this ) ;
long result ; long result ;

View File

@@ -116,7 +116,7 @@ bool wxNotebook::Create(wxWindow *parent,
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -111,7 +111,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
MacPreControlCreate( parent , id , label , pos , size ,style, val , name , &bounds , title ) ; 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 ) ; kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -32,7 +32,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlRadioButtonProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;
@@ -67,9 +67,11 @@ void wxRadioButton::SetValue(bool val)
{ {
int i; int i;
wxRadioButton *cycle; wxRadioButton *cycle;
if ( GetControlValue( m_macControl ) == val )
return ;
::SetControlValue( m_macControl , val ) ; ::SetControlValue( m_macControl , val ) ;
Refresh() ;
if (val) if (val)
{ {
cycle=this->NextInCycle(); cycle=this->NextInCycle();

View File

@@ -41,7 +41,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; 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 ) ; kControlScrollBarLiveProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -133,7 +133,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
} }
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , 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 ) ; kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -49,7 +49,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
MacPreControlCreate( parent , id , "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ; 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 ) ; kControlLittleArrowsProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;

View File

@@ -41,7 +41,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlGroupBoxTextTitleProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -54,7 +54,7 @@ bool wxStaticLine::Create( wxWindow *parent,
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlSeparatorLineProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -39,7 +39,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; 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 ) ; kControlTabSmallProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -107,7 +107,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ; 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 ) ; ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
MacPostControlCreate() ; MacPostControlCreate() ;

View File

@@ -310,7 +310,7 @@ bool wxToolBar::Realize()
if ( icon ) if ( icon )
{ {
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ; behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
ControlButtonContentInfo info ; ControlButtonContentInfo info ;
@@ -321,9 +321,10 @@ bool wxToolBar::Realize()
} }
else else
{ {
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 , m_macToolHandle = UMANewControl( window , &toolrect , "\p" , false , 0 ,
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ; behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
} }
UMAShowControl( m_macToolHandle ) ;
m_macToolHandles.Add( m_macToolHandle ) ; m_macToolHandles.Add( m_macToolHandle ) ;
tool->m_index = m_macToolHandles.Count() -1 ; tool->m_index = m_macToolHandles.Count() -1 ;
if ( !tool->IsEnabled() ) if ( !tool->IsEnabled() )

View File

@@ -425,6 +425,7 @@ void UMAGetWTitleC( WindowRef inWindowRef , char *title )
void UMAShowWindow( WindowRef inWindowRef ) void UMAShowWindow( WindowRef inWindowRef )
{ {
ShowWindow( inWindowRef ) ; ShowWindow( inWindowRef ) ;
} }
void UMAHideWindow( WindowRef inWindowRef ) void UMAHideWindow( WindowRef inWindowRef )
@@ -459,20 +460,20 @@ void UMACloseWindow(WindowRef inWindowRef)
void UMAActivateControl( ControlHandle inControl ) 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 UMA_USE_APPEARANCE
if ( UMAHasAppearance() ) if ( UMAHasAppearance() )
{ {
if ( !UMAIsControlActive( inControl ) )
{
bool visible = IsControlVisible( inControl ) ;
if ( visible )
SetControlVisibility( inControl , false , false ) ;
::ActivateControl( inControl ) ; ::ActivateControl( inControl ) ;
if ( visible ) {
SetControlVisibility( inControl , true , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
}
} }
else else
#endif #endif
@@ -484,15 +485,6 @@ void UMAActivateControl( ControlHandle inControl )
{ {
} }
#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 UMADrawControl( ControlHandle inControl )
@@ -533,111 +525,54 @@ void UMADrawControl( ControlHandle inControl )
void UMAMoveControl( ControlHandle inControl , short x , short y ) 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() ) if ( UMAHasAppearance() )
{ {
bool visible = UMAIsControlVisible( inControl ) ;
if ( visible ) {
SetControlVisibility( inControl , false , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
::MoveControl( inControl , x , y ) ; ::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 ) 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() ) if ( UMAHasAppearance() )
{ {
bool visible = UMAIsControlVisible( inControl ) ;
if ( visible ) {
SetControlVisibility( inControl , false , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
}
::SizeControl( inControl , x , y ) ; ::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 ) 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 ( UMAHasAppearance() )
{ {
if ( UMAIsControlActive( inControl ) )
{
bool visible = IsControlVisible( inControl ) ;
if ( visible )
SetControlVisibility( inControl , false , false ) ;
::DeactivateControl( inControl ) ; ::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 UMASetThemeWindowBackground (WindowRef inWindow,
@@ -733,16 +668,6 @@ void UMADisposeControl (ControlHandle theControl)
void UMAHiliteControl (ControlHandle inControl, void UMAHiliteControl (ControlHandle inControl,
ControlPartCode hiliteState) 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() ) if ( UMAHasAppearance() )
{ {
::HiliteControl( inControl , hiliteState ) ; ::HiliteControl( inControl , hiliteState ) ;
@@ -751,45 +676,23 @@ void UMAHiliteControl (ControlHandle inControl,
{ {
::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) 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() ) if ( UMAHasAppearance() )
{ {
::ShowControl( inControl ) ; SetControlVisibility( inControl , true , false ) ;
InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
} }
else 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) void UMAHideControl (ControlHandle inControl)
{ {
if ( UMAHasAppearance() ) if ( UMAHasAppearance() )
@@ -841,7 +744,13 @@ bool UMAIsControlVisible (ControlHandle inControl)
{ {
return IsControlVisible( inControl ) ; return IsControlVisible( inControl ) ;
} }
else
#endif #endif
{
#if !TARGET_CARBON
return (**inControl).contrlVis == 255 ;
#endif
}
return true ; return true ;
} }
@@ -1538,5 +1447,6 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
{ {
} }
#endif #endif
return noErr ;
} }

View File

@@ -152,6 +152,20 @@ void wxWindow::Init()
// Destructor // Destructor
wxWindow::~wxWindow() 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; m_isBeingDeleted = TRUE;
if ( s_lastMouseWindow == this ) if ( s_lastMouseWindow == this )
@@ -754,11 +768,7 @@ bool wxWindow::Show(bool show)
} }
MacSuperShown( show ) ; MacSuperShown( show ) ;
Refresh() ; Refresh() ;
/*
// this will be done by the activate event
if(m_macWindowData)
MacUpdateImmediately() ;
*/
return TRUE; return TRUE;
} }
@@ -899,6 +909,9 @@ void wxWindow::MacEraseBackground( Rect *rect )
void wxWindow::Refresh(bool eraseBack, const wxRect *rect) void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
{ {
// if ( !IsShown() )
// return ;
wxMacDrawingHelper focus( this ) ; wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() ) if ( focus.Ok() )
{ {
@@ -1143,6 +1156,7 @@ void wxWindow::MacCreateRealWindow( const wxString& title,
UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ; UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
m_macWindowData->m_macFocus = NULL ; m_macWindowData->m_macFocus = NULL ;
m_macWindowData->m_macHasReceivedFirstActivate = true ;
} }
void wxWindow::MacPaint( wxPaintEvent &event ) void wxWindow::MacPaint( wxPaintEvent &event )
@@ -1694,8 +1708,12 @@ void wxWindow::MacFireMouseEvent( EventRecord *ev )
else else
event.SetEventType(wxEVT_LEFT_DCLICK ) ; event.SetEventType(wxEVT_LEFT_DCLICK ) ;
} }
lastWhen = 0 ;
} }
else
{
lastWhen = ev->when ; lastWhen = ev->when ;
}
lastWhere = localwhere ; lastWhere = localwhere ;
} }
@@ -1768,15 +1786,18 @@ void wxWindow::MacMouseMoved( EventRecord *ev , short part)
} }
void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating ) void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating )
{ {
if ( !m_macWindowData->m_macHasReceivedFirstActivate )
m_macWindowData->m_macHasReceivedFirstActivate = true ;
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
event.m_timeStamp = ev->when ; event.m_timeStamp = ev->when ;
event.SetEventObject(this); event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(event);
UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
Refresh() ; Refresh() ;
MacUpdateImmediately() ; UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
// MacUpdateImmediately() ;
} }
void wxWindow::MacRedraw( RgnHandle updatergn , long time) void wxWindow::MacRedraw( RgnHandle updatergn , long time)
@@ -1942,7 +1963,7 @@ void wxWindow::MacUpdateImmediately()
GetPortVisibleRegion( GetWindowPort( window ), region ); GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out // 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 ) ; win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
} }
@@ -1973,7 +1994,7 @@ void wxWindow::MacUpdate( EventRecord *ev )
GetPortVisibleRegion( GetWindowPort( window ), region ); GetPortVisibleRegion( GetWindowPort( window ), region );
// if windowshade gives incompatibility , take the follwing out // if windowshade gives incompatibility , take the follwing out
if ( !EmptyRgn( region ) ) if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
{ {
MacRedraw( region , ev->when ) ; MacRedraw( region , ev->when ) ;
} }