From 1c469f7f4e85bd5212bf0409be0384a7b89405df Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 20 Dec 2001 07:50:22 +0000 Subject: [PATCH] MacOS conforming activate/deactivate git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/statusbr.h | 3 ++- src/mac/app.cpp | 25 +++++++++++++++---------- src/mac/carbon/app.cpp | 25 +++++++++++++++---------- src/mac/carbon/control.cpp | 31 +------------------------------ src/mac/carbon/statbrma.cpp | 24 ++++++++++++++++++++++-- src/mac/carbon/stattext.cpp | 4 ++++ src/mac/carbon/toplevel.cpp | 4 +--- src/mac/carbon/window.cpp | 6 ++++++ src/mac/control.cpp | 31 +------------------------------ src/mac/statbrma.cpp | 24 ++++++++++++++++++++++-- src/mac/stattext.cpp | 4 ++++ src/mac/toplevel.cpp | 4 +--- src/mac/window.cpp | 6 ++++++ 13 files changed, 100 insertions(+), 91 deletions(-) diff --git a/include/wx/mac/statusbr.h b/include/wx/mac/statusbr.h index da50c5951e..0f11fb91ef 100644 --- a/include/wx/mac/statusbr.h +++ b/include/wx/mac/statusbr.h @@ -38,10 +38,11 @@ class WXDLLEXPORT wxStatusBarMac : public wxStatusBarGeneric virtual void DrawFieldText(wxDC& dc, int i); virtual void DrawField(wxDC& dc, int i); virtual void SetStatusText(const wxString& text, int number = 0) ; - //////////////////////////////////////////////////////////////////////// // Implementation + virtual void MacSuperEnabled( bool enable ) ; + void OnPaint(wxPaintEvent& event); protected: diff --git a/src/mac/app.cpp b/src/mac/app.cpp index 1ba9086062..0257b8c607 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -976,19 +976,24 @@ bool wxApp::Yield(bool onlyIfNeeded) 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() ; - if ( window ) - window->MacActivate( MacGetCurrentEvent() , false ) ; + wxNode* node = wxTopLevelWindows.First(); + while (node) + { + wxTopLevelWindow* win = (wxTopLevelWindow*) node->Data(); + win->MacActivate( MacGetCurrentEvent() , false ) ; - s_lastMouseDown = 0 ; - if( convertClipboard ) - { - MacConvertPrivateToPublicScrap() ; - } + node = node->Next(); + } + + s_lastMouseDown = 0 ; + if( convertClipboard ) + { + MacConvertPrivateToPublicScrap() ; + } - ::HideFloatingWindows() ; + ::HideFloatingWindows() ; } void wxApp::MacResume( bool convertClipboard ) diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 1ba9086062..0257b8c607 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -976,19 +976,24 @@ bool wxApp::Yield(bool onlyIfNeeded) 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() ; - if ( window ) - window->MacActivate( MacGetCurrentEvent() , false ) ; + wxNode* node = wxTopLevelWindows.First(); + while (node) + { + wxTopLevelWindow* win = (wxTopLevelWindow*) node->Data(); + win->MacActivate( MacGetCurrentEvent() , false ) ; - s_lastMouseDown = 0 ; - if( convertClipboard ) - { - MacConvertPrivateToPublicScrap() ; - } + node = node->Next(); + } + + s_lastMouseDown = 0 ; + if( convertClipboard ) + { + MacConvertPrivateToPublicScrap() ; + } - ::HideFloatingWindows() ; + ::HideFloatingWindows() ; } void wxApp::MacResume( bool convertClipboard ) diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index 1c7030c6b8..55263a3a6b 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -438,37 +438,8 @@ void wxControl::MacSuperChangedPosition() void wxControl::MacSuperEnabled( bool enabled ) { + Refresh(FALSE) ; 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 ) diff --git a/src/mac/carbon/statbrma.cpp b/src/mac/carbon/statbrma.cpp index a88dc6f72c..f0d2b9bfa4 100644 --- a/src/mac/carbon/statbrma.cpp +++ b/src/mac/carbon/statbrma.cpp @@ -55,6 +55,11 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i) wxRect rect; GetFieldRect(i, rect); + + if ( !IsWindowHilited( MacGetRootWindow() ) ) + { + dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; + } wxString text(GetStatusText(i)); @@ -101,7 +106,10 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number) void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) { wxPaintDC dc(this); - wxPen black( wxBLACK , 1 , wxSOLID ) ; + + if ( IsWindowHilited( MacGetRootWindow() ) ) + { + wxPen black( wxBLACK , 1 , wxSOLID ) ; wxPen white( wxWHITE , 1 , wxSOLID ) ; dc.SetPen(black); @@ -110,7 +118,13 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) dc.SetPen(white); dc.DrawLine(0, 1 , m_width , 1); - + } + else + { + dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID)); + dc.DrawLine(0, 0 , + m_width , 0); + } int i; if ( GetFont().Ok() ) @@ -124,3 +138,9 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) dc.SetFont(wxNullFont); # endif // MSW } + +void wxStatusBarMac::MacSuperEnabled( bool enabled ) +{ + Refresh(FALSE) ; + wxWindow::MacSuperEnabled( enabled ) ; +} \ No newline at end of file diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index bb9b15ad7f..88b0edf3f9 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -128,6 +128,10 @@ void wxStaticText::OnDraw( wxDC &dc ) if (m_width <= 0 || m_height <= 0) return; + if ( !IsWindowHilited( MacGetRootWindow() ) ) + { + dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; + } wxString paragraph; int i = 0 ; wxString text = m_label; diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 296aa8dfe0..14afc2d959 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -500,9 +500,7 @@ void wxTopLevelWindowMac::MacActivate( EventRecord *ev , bool inIsActivating ) UMAHighlightAndActivateWindow( m_macWindow , inIsActivating ) ; - Refresh( FALSE ) ; -// MacSuperEnabled( inIsActivating ) ; -// MacUpdateImmediately() ; + MacSuperEnabled( inIsActivating ) ; } void wxTopLevelWindowMac::MacKeyDown( EventRecord *ev ) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index a71937cd82..29b6fc6f0f 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -720,6 +720,12 @@ void wxWindowMac::MacSuperShown( bool show ) 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(); while ( node ) { diff --git a/src/mac/control.cpp b/src/mac/control.cpp index 1c7030c6b8..55263a3a6b 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -438,37 +438,8 @@ void wxControl::MacSuperChangedPosition() void wxControl::MacSuperEnabled( bool enabled ) { + Refresh(FALSE) ; 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 ) diff --git a/src/mac/statbrma.cpp b/src/mac/statbrma.cpp index a88dc6f72c..f0d2b9bfa4 100644 --- a/src/mac/statbrma.cpp +++ b/src/mac/statbrma.cpp @@ -55,6 +55,11 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i) wxRect rect; GetFieldRect(i, rect); + + if ( !IsWindowHilited( MacGetRootWindow() ) ) + { + dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; + } wxString text(GetStatusText(i)); @@ -101,7 +106,10 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number) void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) { wxPaintDC dc(this); - wxPen black( wxBLACK , 1 , wxSOLID ) ; + + if ( IsWindowHilited( MacGetRootWindow() ) ) + { + wxPen black( wxBLACK , 1 , wxSOLID ) ; wxPen white( wxWHITE , 1 , wxSOLID ) ; dc.SetPen(black); @@ -110,7 +118,13 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) dc.SetPen(white); dc.DrawLine(0, 1 , m_width , 1); - + } + else + { + dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID)); + dc.DrawLine(0, 0 , + m_width , 0); + } int i; if ( GetFont().Ok() ) @@ -124,3 +138,9 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) ) dc.SetFont(wxNullFont); # endif // MSW } + +void wxStatusBarMac::MacSuperEnabled( bool enabled ) +{ + Refresh(FALSE) ; + wxWindow::MacSuperEnabled( enabled ) ; +} \ No newline at end of file diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index bb9b15ad7f..88b0edf3f9 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -128,6 +128,10 @@ void wxStaticText::OnDraw( wxDC &dc ) if (m_width <= 0 || m_height <= 0) return; + if ( !IsWindowHilited( MacGetRootWindow() ) ) + { + dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; + } wxString paragraph; int i = 0 ; wxString text = m_label; diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp index 296aa8dfe0..14afc2d959 100644 --- a/src/mac/toplevel.cpp +++ b/src/mac/toplevel.cpp @@ -500,9 +500,7 @@ void wxTopLevelWindowMac::MacActivate( EventRecord *ev , bool inIsActivating ) UMAHighlightAndActivateWindow( m_macWindow , inIsActivating ) ; - Refresh( FALSE ) ; -// MacSuperEnabled( inIsActivating ) ; -// MacUpdateImmediately() ; + MacSuperEnabled( inIsActivating ) ; } void wxTopLevelWindowMac::MacKeyDown( EventRecord *ev ) diff --git a/src/mac/window.cpp b/src/mac/window.cpp index a71937cd82..29b6fc6f0f 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -720,6 +720,12 @@ void wxWindowMac::MacSuperShown( bool show ) 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(); while ( node ) { -- 2.47.2