added hilite change notification

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-03-29 08:39:31 +00:00
parent 8155488b31
commit 8ab505498d
5 changed files with 104 additions and 49 deletions

View File

@@ -41,6 +41,8 @@ class WXDLLEXPORT wxStatusBarMac : public wxStatusBarGeneric
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Implementation // Implementation
virtual void MacHiliteChanged() ;
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
protected: protected:

View File

@@ -182,9 +182,11 @@ public:
virtual void MacVisibilityChanged() ; virtual void MacVisibilityChanged() ;
virtual void MacEnabledStateChanged() ; virtual void MacEnabledStateChanged() ;
virtual void MacHiliteChanged() ;
bool MacIsReallyShown() ; bool MacIsReallyShown() ;
bool MacIsReallyEnabled() ; bool MacIsReallyEnabled() ;
bool MacIsReallyHilited() ;
bool MacIsUserPane() { return m_macIsUserPane; } bool MacIsUserPane() { return m_macIsUserPane; }
@@ -241,8 +243,10 @@ protected:
void MacCreateScrollBars( long style ) ; void MacCreateScrollBars( long style ) ;
void MacRepositionScrollBars() ; void MacRepositionScrollBars() ;
void MacUpdateControlFont() ; void MacUpdateControlFont() ;
void MacPropagateVisibilityChanged() ; void MacPropagateVisibilityChanged() ;
void MacPropagateEnabledStateChanged() ; void MacPropagateEnabledStateChanged() ;
void MacPropagateHiliteChanged() ;
#if WXWIN_COMPATIBILITY_2_4 #if WXWIN_COMPATIBILITY_2_4

View File

@@ -67,7 +67,7 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
wxRect rect; wxRect rect;
GetFieldRect(i, rect); GetFieldRect(i, rect);
if ( !MacGetTopLevelWindow()->MacGetMetalAppearance() && !IsWindowHilited( MAC_WXHWND( MacGetTopLevelWindowRef() ) ) ) if ( !MacIsReallyHilited() )
{ {
dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
} }
@@ -79,7 +79,10 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
dc.GetTextExtent(text, &x, &y); dc.GetTextExtent(text, &x, &y);
int xpos = rect.x + leftMargin + 1 ; int xpos = rect.x + leftMargin + 1 ;
int ypos = 2 ; int ypos = 1 ;
if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
ypos++ ;
dc.SetClippingRegion(rect.x, 0, rect.width, h); dc.SetClippingRegion(rect.x, 0, rect.width, h);
@@ -119,7 +122,7 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
int w, h ; int w, h ;
GetSize( &w , &h ) ; GetSize( &w , &h ) ;
if ( IsWindowHilited( MAC_WXHWND( MacGetTopLevelWindowRef() ) ) || MacGetTopLevelWindow()->MacGetMetalAppearance() ) if ( MacIsReallyHilited() )
{ {
wxPen white( wxWHITE , 1 , wxSOLID ) ; wxPen white( wxWHITE , 1 , wxSOLID ) ;
if (major >= 10 ) if (major >= 10 )
@@ -161,3 +164,9 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
for ( i = 0; i < m_nFields; i ++ ) for ( i = 0; i < m_nFields; i ++ )
DrawField(dc, i); DrawField(dc, i);
} }
void wxStatusBarMac::MacHiliteChanged()
{
Refresh() ;
Update() ;
}

View File

@@ -1013,6 +1013,7 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating )
if(s_macDeactivateWindow==this) if(s_macDeactivateWindow==this)
s_macDeactivateWindow=NULL; s_macDeactivateWindow=NULL;
MacDelayedDeactivation(timestamp); MacDelayedDeactivation(timestamp);
MacPropagateHiliteChanged() ;
} }
void wxTopLevelWindowMac::SetTitle(const wxString& title) void wxTopLevelWindowMac::SetTitle(const wxString& title)

View File

@@ -1503,6 +1503,41 @@ wxString wxWindowMac::GetTitle() const
return m_label ; return m_label ;
} }
bool wxWindowMac::Show(bool show)
{
if ( !wxWindowBase::Show(show) )
return FALSE;
// TODO use visibilityChanged Carbon Event for OSX
bool former = MacIsReallyShown() ;
SetControlVisibility( (ControlRef) m_macControl , show , true ) ;
if ( former != MacIsReallyShown() )
MacPropagateVisibilityChanged() ;
return TRUE;
}
bool wxWindowMac::Enable(bool enable)
{
wxASSERT( m_macControl != NULL ) ;
if ( !wxWindowBase::Enable(enable) )
return FALSE;
bool former = MacIsReallyEnabled() ;
if ( enable )
EnableControl( (ControlRef) m_macControl ) ;
else
DisableControl( (ControlRef) m_macControl ) ;
if ( former != MacIsReallyEnabled() )
MacPropagateEnabledStateChanged() ;
return TRUE;
}
//
// status change propagations (will be not necessary for OSX later )
//
void wxWindowMac::MacPropagateVisibilityChanged() void wxWindowMac::MacPropagateVisibilityChanged()
{ {
MacVisibilityChanged() ; MacVisibilityChanged() ;
@@ -1517,19 +1552,53 @@ void wxWindowMac::MacPropagateVisibilityChanged()
} }
} }
bool wxWindowMac::Show(bool show) void wxWindowMac::MacPropagateEnabledStateChanged( )
{ {
if ( !wxWindowBase::Show(show) ) MacEnabledStateChanged() ;
return FALSE;
// TODO use visibilityChanged Carbon Event for OSX wxWindowListNode *node = GetChildren().GetFirst();
bool former = MacIsReallyShown() ; while ( node )
{
SetControlVisibility( (ControlRef) m_macControl , show , true ) ; wxWindowMac *child = node->GetData();
if ( former != MacIsReallyShown() ) if ( child->IsEnabled() )
MacPropagateVisibilityChanged() ; child->MacPropagateEnabledStateChanged() ;
return TRUE; node = node->GetNext();
} }
}
void wxWindowMac::MacPropagateHiliteChanged( )
{
MacHiliteChanged() ;
wxWindowListNode *node = GetChildren().GetFirst();
while ( node )
{
wxWindowMac *child = node->GetData();
// if ( child->IsEnabled() )
child->MacPropagateHiliteChanged() ;
node = node->GetNext();
}
}
//
// status change notifications
//
void wxWindowMac::MacVisibilityChanged()
{
}
void wxWindowMac::MacHiliteChanged()
{
}
void wxWindowMac::MacEnabledStateChanged()
{
}
//
// status queries on the inherited window's state
//
bool wxWindowMac::MacIsReallyShown() bool wxWindowMac::MacIsReallyShown()
{ {
@@ -1552,50 +1621,20 @@ bool wxWindowMac::MacIsReallyShown()
#endif #endif
} }
void wxWindowMac::MacVisibilityChanged()
{
}
void wxWindowMac::MacPropagateEnabledStateChanged( )
{
MacEnabledStateChanged() ;
wxWindowListNode *node = GetChildren().GetFirst();
while ( node )
{
wxWindowMac *child = node->GetData();
if ( child->IsEnabled() )
child->MacPropagateEnabledStateChanged() ;
node = node->GetNext();
}
}
bool wxWindowMac::Enable(bool enable)
{
wxASSERT( m_macControl != NULL ) ;
if ( !wxWindowBase::Enable(enable) )
return FALSE;
bool former = MacIsReallyEnabled() ;
if ( enable )
UMAActivateControl( (ControlRef) m_macControl ) ;
else
UMADeactivateControl( (ControlRef) m_macControl ) ;
if ( former != MacIsReallyEnabled() )
MacPropagateEnabledStateChanged() ;
return TRUE;
}
bool wxWindowMac::MacIsReallyEnabled() bool wxWindowMac::MacIsReallyEnabled()
{ {
return IsControlEnabled( (ControlRef) m_macControl ) ; return IsControlEnabled( (ControlRef) m_macControl ) ;
} }
void wxWindowMac::MacEnabledStateChanged() bool wxWindowMac::MacIsReallyHilited()
{ {
return IsControlActive( (ControlRef) m_macControl ) ;
} }
//
//
//
int wxWindowMac::GetCharHeight() const int wxWindowMac::GetCharHeight() const
{ {
wxClientDC dc ( (wxWindowMac*)this ) ; wxClientDC dc ( (wxWindowMac*)this ) ;