corrected hiding/showing of native mac controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
19ff2a7bd5
commit
c809f3be86
@ -103,6 +103,7 @@ protected:
|
||||
protected:
|
||||
// For controls like radiobuttons which are really composite
|
||||
ControlHandle m_macControl ;
|
||||
bool m_macControlIsShown ;
|
||||
wxList m_subControls;
|
||||
int m_macHorizontalBorder ;
|
||||
int m_macVerticalBorder ;
|
||||
|
@ -255,6 +255,7 @@ public :
|
||||
static long MacRemoveBordersFromStyle( long style ) ;
|
||||
virtual void MacSuperChangedPosition() ;
|
||||
virtual void MacSuperShown( bool show ) ;
|
||||
bool MacIsReallyShown() const ;
|
||||
/*
|
||||
bool MacSetupFocusPort() ;
|
||||
bool MacSetupDrawingPort() ;
|
||||
|
@ -266,6 +266,7 @@ void wxControl::MacPostControlCreate()
|
||||
ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
|
||||
wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
|
||||
::UMAEmbedControl( m_macControl , container ) ;
|
||||
m_macControlIsShown = true ;
|
||||
MacAdjustControlRect() ;
|
||||
wxAssociateControlWithMacControl( m_macControl , this ) ;
|
||||
}
|
||||
@ -416,12 +417,19 @@ void wxControl::MacSuperShown( bool show )
|
||||
{
|
||||
if ( !show )
|
||||
{
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
if ( m_macControlIsShown )
|
||||
{
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
m_macControlIsShown = false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_isShown )
|
||||
if ( MacIsReallyShown() && !m_macControlIsShown )
|
||||
{
|
||||
::UMAShowControl( m_macControl ) ;
|
||||
m_macControlIsShown = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,10 +549,22 @@ bool wxControl::Show(bool show)
|
||||
|
||||
if ( m_macControl )
|
||||
{
|
||||
if ( show )
|
||||
::UMAShowControl( m_macControl ) ;
|
||||
if ( !show )
|
||||
{
|
||||
if ( m_macControlIsShown )
|
||||
{
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
m_macControlIsShown = false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
{
|
||||
if ( MacIsReallyShown() && !m_macControlIsShown )
|
||||
{
|
||||
::UMAShowControl( m_macControl ) ;
|
||||
m_macControlIsShown = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE ;
|
||||
}
|
||||
|
@ -667,11 +667,11 @@ void UMAHideControl (ControlHandle theControl)
|
||||
{
|
||||
if ( UMAHasAppearance() )
|
||||
{
|
||||
::HideControl( theControl ) ;
|
||||
::HideControl( theControl ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
::HideControl( theControl ) ;
|
||||
::HideControl( theControl ) ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1359,16 +1359,26 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
||||
{
|
||||
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
|
||||
// if ( inActivate != isHightlited )
|
||||
HiliteWindow( inWindowRef , inActivate ) ;
|
||||
ControlHandle control = NULL ;
|
||||
UMAGetRootControl( inWindowRef , & control ) ;
|
||||
if ( control )
|
||||
{
|
||||
if ( inActivate )
|
||||
UMAActivateControl( control ) ;
|
||||
else
|
||||
UMADeactivateControl( control ) ;
|
||||
}
|
||||
GrafPtr port ;
|
||||
GetPort( &port ) ;
|
||||
#if TARGET_CARBON
|
||||
SetPort( GetWindowPort( inWindowRef ) ) ;
|
||||
#else
|
||||
SetPort( inWindowRef ) ;
|
||||
#endif
|
||||
SetOrigin( 0 , 0 ) ;
|
||||
HiliteWindow( inWindowRef , inActivate ) ;
|
||||
ControlHandle control = NULL ;
|
||||
UMAGetRootControl( inWindowRef , & control ) ;
|
||||
if ( control )
|
||||
{
|
||||
if ( inActivate )
|
||||
UMAActivateControl( control ) ;
|
||||
else
|
||||
UMADeactivateControl( control ) ;
|
||||
}
|
||||
SetPort( port ) ;
|
||||
wxDC::MacInvalidateSetup() ;
|
||||
}
|
||||
}
|
||||
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/tabctrl.h"
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/statusbr.h"
|
||||
// TODO remove the line below, just for lookup-up convenience CS
|
||||
#include "wx/window.h"
|
||||
|
||||
@ -194,7 +195,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
m_width = WidthDefault( size.x );
|
||||
m_height = HeightDefault( size.y ) ;
|
||||
|
||||
if ( ! IsKindOf( CLASSINFO ( wxControl ) ) )
|
||||
if ( ! IsKindOf( CLASSINFO ( wxControl ) ) && ! IsKindOf( CLASSINFO( wxStatusBar ) ) )
|
||||
{
|
||||
MacCreateScrollBars( style ) ;
|
||||
}
|
||||
@ -584,7 +585,8 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if ( doResize )
|
||||
::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height , true);
|
||||
|
||||
// the OS takes care of invalidating and erasing
|
||||
// the OS takes care of invalidating and erasing the new area
|
||||
// we have erased the old one
|
||||
|
||||
if ( IsKindOf( CLASSINFO( wxFrame ) ) )
|
||||
{
|
||||
@ -710,6 +712,18 @@ void wxWindow::MacSuperShown( bool show )
|
||||
}
|
||||
}
|
||||
|
||||
bool wxWindow::MacIsReallyShown() const
|
||||
{
|
||||
bool status = m_isShown ;
|
||||
wxWindow * win = this ;
|
||||
while ( status && win->m_parent != NULL )
|
||||
{
|
||||
win = win->m_parent ;
|
||||
status = win->m_isShown ;
|
||||
}
|
||||
return status ;
|
||||
}
|
||||
|
||||
int wxWindow::GetCharHeight() const
|
||||
{
|
||||
wxClientDC dc ( (wxWindow*)this ) ;
|
||||
|
@ -266,6 +266,7 @@ void wxControl::MacPostControlCreate()
|
||||
ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
|
||||
wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
|
||||
::UMAEmbedControl( m_macControl , container ) ;
|
||||
m_macControlIsShown = true ;
|
||||
MacAdjustControlRect() ;
|
||||
wxAssociateControlWithMacControl( m_macControl , this ) ;
|
||||
}
|
||||
@ -416,12 +417,19 @@ void wxControl::MacSuperShown( bool show )
|
||||
{
|
||||
if ( !show )
|
||||
{
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
if ( m_macControlIsShown )
|
||||
{
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
m_macControlIsShown = false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_isShown )
|
||||
if ( MacIsReallyShown() && !m_macControlIsShown )
|
||||
{
|
||||
::UMAShowControl( m_macControl ) ;
|
||||
m_macControlIsShown = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,10 +549,22 @@ bool wxControl::Show(bool show)
|
||||
|
||||
if ( m_macControl )
|
||||
{
|
||||
if ( show )
|
||||
::UMAShowControl( m_macControl ) ;
|
||||
if ( !show )
|
||||
{
|
||||
if ( m_macControlIsShown )
|
||||
{
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
m_macControlIsShown = false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
::UMAHideControl( m_macControl ) ;
|
||||
{
|
||||
if ( MacIsReallyShown() && !m_macControlIsShown )
|
||||
{
|
||||
::UMAShowControl( m_macControl ) ;
|
||||
m_macControlIsShown = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE ;
|
||||
}
|
||||
|
@ -667,11 +667,11 @@ void UMAHideControl (ControlHandle theControl)
|
||||
{
|
||||
if ( UMAHasAppearance() )
|
||||
{
|
||||
::HideControl( theControl ) ;
|
||||
::HideControl( theControl ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
::HideControl( theControl ) ;
|
||||
::HideControl( theControl ) ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1359,16 +1359,26 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
||||
{
|
||||
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
|
||||
// if ( inActivate != isHightlited )
|
||||
HiliteWindow( inWindowRef , inActivate ) ;
|
||||
ControlHandle control = NULL ;
|
||||
UMAGetRootControl( inWindowRef , & control ) ;
|
||||
if ( control )
|
||||
{
|
||||
if ( inActivate )
|
||||
UMAActivateControl( control ) ;
|
||||
else
|
||||
UMADeactivateControl( control ) ;
|
||||
}
|
||||
GrafPtr port ;
|
||||
GetPort( &port ) ;
|
||||
#if TARGET_CARBON
|
||||
SetPort( GetWindowPort( inWindowRef ) ) ;
|
||||
#else
|
||||
SetPort( inWindowRef ) ;
|
||||
#endif
|
||||
SetOrigin( 0 , 0 ) ;
|
||||
HiliteWindow( inWindowRef , inActivate ) ;
|
||||
ControlHandle control = NULL ;
|
||||
UMAGetRootControl( inWindowRef , & control ) ;
|
||||
if ( control )
|
||||
{
|
||||
if ( inActivate )
|
||||
UMAActivateControl( control ) ;
|
||||
else
|
||||
UMADeactivateControl( control ) ;
|
||||
}
|
||||
SetPort( port ) ;
|
||||
wxDC::MacInvalidateSetup() ;
|
||||
}
|
||||
}
|
||||
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/tabctrl.h"
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/statusbr.h"
|
||||
// TODO remove the line below, just for lookup-up convenience CS
|
||||
#include "wx/window.h"
|
||||
|
||||
@ -194,7 +195,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
m_width = WidthDefault( size.x );
|
||||
m_height = HeightDefault( size.y ) ;
|
||||
|
||||
if ( ! IsKindOf( CLASSINFO ( wxControl ) ) )
|
||||
if ( ! IsKindOf( CLASSINFO ( wxControl ) ) && ! IsKindOf( CLASSINFO( wxStatusBar ) ) )
|
||||
{
|
||||
MacCreateScrollBars( style ) ;
|
||||
}
|
||||
@ -584,7 +585,8 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if ( doResize )
|
||||
::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height , true);
|
||||
|
||||
// the OS takes care of invalidating and erasing
|
||||
// the OS takes care of invalidating and erasing the new area
|
||||
// we have erased the old one
|
||||
|
||||
if ( IsKindOf( CLASSINFO( wxFrame ) ) )
|
||||
{
|
||||
@ -710,6 +712,18 @@ void wxWindow::MacSuperShown( bool show )
|
||||
}
|
||||
}
|
||||
|
||||
bool wxWindow::MacIsReallyShown() const
|
||||
{
|
||||
bool status = m_isShown ;
|
||||
wxWindow * win = this ;
|
||||
while ( status && win->m_parent != NULL )
|
||||
{
|
||||
win = win->m_parent ;
|
||||
status = win->m_isShown ;
|
||||
}
|
||||
return status ;
|
||||
}
|
||||
|
||||
int wxWindow::GetCharHeight() const
|
||||
{
|
||||
wxClientDC dc ( (wxWindow*)this ) ;
|
||||
|
Loading…
Reference in New Issue
Block a user