MacOS conforming activate/deactivate

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-12-20 07:50:22 +00:00
parent 422644a317
commit 1c469f7f4e
13 changed files with 100 additions and 91 deletions

View File

@@ -38,10 +38,11 @@ class WXDLLEXPORT wxStatusBarMac : public wxStatusBarGeneric
virtual void DrawFieldText(wxDC& dc, int i); virtual void DrawFieldText(wxDC& dc, int i);
virtual void DrawField(wxDC& dc, int i); virtual void DrawField(wxDC& dc, int i);
virtual void SetStatusText(const wxString& text, int number = 0) ; virtual void SetStatusText(const wxString& text, int number = 0) ;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Implementation // Implementation
virtual void MacSuperEnabled( bool enable ) ;
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
protected: protected:

View File

@@ -976,19 +976,24 @@ bool wxApp::Yield(bool onlyIfNeeded)
void wxApp::MacSuspend( bool convertClipboard ) void wxApp::MacSuspend( bool convertClipboard )
{ {
// we have to deactive the window manually // we have to deactive the top level windows manually
wxTopLevelWindow* window = (wxTopLevelWindow*) GetTopWindow() ; wxNode* node = wxTopLevelWindows.First();
if ( window ) while (node)
window->MacActivate( MacGetCurrentEvent() , false ) ; {
wxTopLevelWindow* win = (wxTopLevelWindow*) node->Data();
win->MacActivate( MacGetCurrentEvent() , false ) ;
s_lastMouseDown = 0 ; node = node->Next();
if( convertClipboard ) }
{
MacConvertPrivateToPublicScrap() ;
}
::HideFloatingWindows() ; s_lastMouseDown = 0 ;
if( convertClipboard )
{
MacConvertPrivateToPublicScrap() ;
}
::HideFloatingWindows() ;
} }
void wxApp::MacResume( bool convertClipboard ) void wxApp::MacResume( bool convertClipboard )

View File

@@ -976,19 +976,24 @@ bool wxApp::Yield(bool onlyIfNeeded)
void wxApp::MacSuspend( bool convertClipboard ) void wxApp::MacSuspend( bool convertClipboard )
{ {
// we have to deactive the window manually // we have to deactive the top level windows manually
wxTopLevelWindow* window = (wxTopLevelWindow*) GetTopWindow() ; wxNode* node = wxTopLevelWindows.First();
if ( window ) while (node)
window->MacActivate( MacGetCurrentEvent() , false ) ; {
wxTopLevelWindow* win = (wxTopLevelWindow*) node->Data();
win->MacActivate( MacGetCurrentEvent() , false ) ;
s_lastMouseDown = 0 ; node = node->Next();
if( convertClipboard ) }
{
MacConvertPrivateToPublicScrap() ;
}
::HideFloatingWindows() ; s_lastMouseDown = 0 ;
if( convertClipboard )
{
MacConvertPrivateToPublicScrap() ;
}
::HideFloatingWindows() ;
} }
void wxApp::MacResume( bool convertClipboard ) void wxApp::MacResume( bool convertClipboard )

View File

@@ -438,37 +438,8 @@ void wxControl::MacSuperChangedPosition()
void wxControl::MacSuperEnabled( bool enabled ) void wxControl::MacSuperEnabled( bool enabled )
{ {
Refresh(FALSE) ;
wxWindow::MacSuperEnabled( enabled ) ; wxWindow::MacSuperEnabled( enabled ) ;
/*
if ( m_macControl )
{
if ( UMAHasAppearance() )
{
if ( !enabled )
{
::DeactivateControl( m_macControl ) ;
}
else
{
if ( m_macEnabled )
::ActivateControl( m_macControl ) ;
}
}
else
{
if ( !enabled )
{
::HiliteControl( m_macControl , 255 ) ;
}
else
{
if ( m_macEnabled )
::HiliteControl( m_macControl , 0 ) ;
}
}
}
wxWindow::MacSuperEnabled( enabled ) ;
*/
} }
void wxControl::MacSuperShown( bool show ) void wxControl::MacSuperShown( bool show )

View File

@@ -55,6 +55,11 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
wxRect rect; wxRect rect;
GetFieldRect(i, rect); GetFieldRect(i, rect);
if ( !IsWindowHilited( MacGetRootWindow() ) )
{
dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
}
wxString text(GetStatusText(i)); wxString text(GetStatusText(i));
@@ -101,7 +106,10 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number)
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
wxPen black( wxBLACK , 1 , wxSOLID ) ;
if ( IsWindowHilited( MacGetRootWindow() ) )
{
wxPen black( wxBLACK , 1 , wxSOLID ) ;
wxPen white( wxWHITE , 1 , wxSOLID ) ; wxPen white( wxWHITE , 1 , wxSOLID ) ;
dc.SetPen(black); dc.SetPen(black);
@@ -110,7 +118,13 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
dc.SetPen(white); dc.SetPen(white);
dc.DrawLine(0, 1 , dc.DrawLine(0, 1 ,
m_width , 1); m_width , 1);
}
else
{
dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));
dc.DrawLine(0, 0 ,
m_width , 0);
}
int i; int i;
if ( GetFont().Ok() ) if ( GetFont().Ok() )
@@ -124,3 +138,9 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
dc.SetFont(wxNullFont); dc.SetFont(wxNullFont);
# endif // MSW # endif // MSW
} }
void wxStatusBarMac::MacSuperEnabled( bool enabled )
{
Refresh(FALSE) ;
wxWindow::MacSuperEnabled( enabled ) ;
}

View File

@@ -128,6 +128,10 @@ void wxStaticText::OnDraw( wxDC &dc )
if (m_width <= 0 || m_height <= 0) if (m_width <= 0 || m_height <= 0)
return; return;
if ( !IsWindowHilited( MacGetRootWindow() ) )
{
dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
}
wxString paragraph; wxString paragraph;
int i = 0 ; int i = 0 ;
wxString text = m_label; wxString text = m_label;

View File

@@ -500,9 +500,7 @@ void wxTopLevelWindowMac::MacActivate( EventRecord *ev , bool inIsActivating )
UMAHighlightAndActivateWindow( m_macWindow , inIsActivating ) ; UMAHighlightAndActivateWindow( m_macWindow , inIsActivating ) ;
Refresh( FALSE ) ; MacSuperEnabled( inIsActivating ) ;
// MacSuperEnabled( inIsActivating ) ;
// MacUpdateImmediately() ;
} }
void wxTopLevelWindowMac::MacKeyDown( EventRecord *ev ) void wxTopLevelWindowMac::MacKeyDown( EventRecord *ev )

View File

@@ -720,6 +720,12 @@ void wxWindowMac::MacSuperShown( bool show )
void wxWindowMac::MacSuperEnabled( bool enabled ) void wxWindowMac::MacSuperEnabled( bool enabled )
{ {
if ( !IsTopLevel() )
{
// to be absolutely correct we'd have to invalidate (with eraseBkground
// because unter MacOSX the frames are drawn with an addXXX mode)
// the borders area
}
wxNode *node = GetChildren().First(); wxNode *node = GetChildren().First();
while ( node ) while ( node )
{ {

View File

@@ -438,37 +438,8 @@ void wxControl::MacSuperChangedPosition()
void wxControl::MacSuperEnabled( bool enabled ) void wxControl::MacSuperEnabled( bool enabled )
{ {
Refresh(FALSE) ;
wxWindow::MacSuperEnabled( enabled ) ; wxWindow::MacSuperEnabled( enabled ) ;
/*
if ( m_macControl )
{
if ( UMAHasAppearance() )
{
if ( !enabled )
{
::DeactivateControl( m_macControl ) ;
}
else
{
if ( m_macEnabled )
::ActivateControl( m_macControl ) ;
}
}
else
{
if ( !enabled )
{
::HiliteControl( m_macControl , 255 ) ;
}
else
{
if ( m_macEnabled )
::HiliteControl( m_macControl , 0 ) ;
}
}
}
wxWindow::MacSuperEnabled( enabled ) ;
*/
} }
void wxControl::MacSuperShown( bool show ) void wxControl::MacSuperShown( bool show )

View File

@@ -55,6 +55,11 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
wxRect rect; wxRect rect;
GetFieldRect(i, rect); GetFieldRect(i, rect);
if ( !IsWindowHilited( MacGetRootWindow() ) )
{
dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
}
wxString text(GetStatusText(i)); wxString text(GetStatusText(i));
@@ -101,7 +106,10 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number)
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
wxPen black( wxBLACK , 1 , wxSOLID ) ;
if ( IsWindowHilited( MacGetRootWindow() ) )
{
wxPen black( wxBLACK , 1 , wxSOLID ) ;
wxPen white( wxWHITE , 1 , wxSOLID ) ; wxPen white( wxWHITE , 1 , wxSOLID ) ;
dc.SetPen(black); dc.SetPen(black);
@@ -110,7 +118,13 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
dc.SetPen(white); dc.SetPen(white);
dc.DrawLine(0, 1 , dc.DrawLine(0, 1 ,
m_width , 1); m_width , 1);
}
else
{
dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));
dc.DrawLine(0, 0 ,
m_width , 0);
}
int i; int i;
if ( GetFont().Ok() ) if ( GetFont().Ok() )
@@ -124,3 +138,9 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
dc.SetFont(wxNullFont); dc.SetFont(wxNullFont);
# endif // MSW # endif // MSW
} }
void wxStatusBarMac::MacSuperEnabled( bool enabled )
{
Refresh(FALSE) ;
wxWindow::MacSuperEnabled( enabled ) ;
}

View File

@@ -128,6 +128,10 @@ void wxStaticText::OnDraw( wxDC &dc )
if (m_width <= 0 || m_height <= 0) if (m_width <= 0 || m_height <= 0)
return; return;
if ( !IsWindowHilited( MacGetRootWindow() ) )
{
dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
}
wxString paragraph; wxString paragraph;
int i = 0 ; int i = 0 ;
wxString text = m_label; wxString text = m_label;

View File

@@ -500,9 +500,7 @@ void wxTopLevelWindowMac::MacActivate( EventRecord *ev , bool inIsActivating )
UMAHighlightAndActivateWindow( m_macWindow , inIsActivating ) ; UMAHighlightAndActivateWindow( m_macWindow , inIsActivating ) ;
Refresh( FALSE ) ; MacSuperEnabled( inIsActivating ) ;
// MacSuperEnabled( inIsActivating ) ;
// MacUpdateImmediately() ;
} }
void wxTopLevelWindowMac::MacKeyDown( EventRecord *ev ) void wxTopLevelWindowMac::MacKeyDown( EventRecord *ev )

View File

@@ -720,6 +720,12 @@ void wxWindowMac::MacSuperShown( bool show )
void wxWindowMac::MacSuperEnabled( bool enabled ) void wxWindowMac::MacSuperEnabled( bool enabled )
{ {
if ( !IsTopLevel() )
{
// to be absolutely correct we'd have to invalidate (with eraseBkground
// because unter MacOSX the frames are drawn with an addXXX mode)
// the borders area
}
wxNode *node = GetChildren().First(); wxNode *node = GetChildren().First();
while ( node ) while ( node )
{ {