]> git.saurik.com Git - wxWidgets.git/commitdiff
MacOS conforming activate/deactivate
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 20 Dec 2001 07:50:22 +0000 (07:50 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 20 Dec 2001 07:50:22 +0000 (07:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
include/wx/mac/statusbr.h
src/mac/app.cpp
src/mac/carbon/app.cpp
src/mac/carbon/control.cpp
src/mac/carbon/statbrma.cpp
src/mac/carbon/stattext.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/window.cpp
src/mac/control.cpp
src/mac/statbrma.cpp
src/mac/stattext.cpp
src/mac/toplevel.cpp
src/mac/window.cpp

index da50c5951e9d60ba54a23356ef729693e3884ea8..0f11fb91ef0e8a4a10b8bd84d7832228ea00391d 100644 (file)
@@ -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:
 
index 1ba90860626f7168f3095d5593c77f736cea0968..0257b8c6070640fad78cb421e475d6dd3ba6272f 100644 (file)
@@ -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 )
index 1ba90860626f7168f3095d5593c77f736cea0968..0257b8c6070640fad78cb421e475d6dd3ba6272f 100644 (file)
@@ -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 )
index 1c7030c6b86044d3fd0beb617f77528e62d2b75d..55263a3a6b09fd3372f635002dd46090c3d127e2 100644 (file)
@@ -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 ) 
index a88dc6f72cc19fc3caf4eddb9b62b2e4ec4c8341..f0d2b9bfa46ca1da42086d7ea27e34a127f1c5f8 100644 (file)
@@ -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
index bb9b15ad7fc1ef77dd9c941d9d19190e5336ceb9..88b0edf3f9b5564cc832cbde0f6b70553a469857 100644 (file)
@@ -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;
index 296aa8dfe0f323625b20b97485a601ac3ada9d07..14afc2d9599c804d9597e5e4be190e74f159bb72 100644 (file)
@@ -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 ) 
index a71937cd829ea7d34761c290d38244f2452e3fc1..29b6fc6f0f0c03b3a81fff79239de1d3e4dd36bd 100644 (file)
@@ -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 )
     {
index 1c7030c6b86044d3fd0beb617f77528e62d2b75d..55263a3a6b09fd3372f635002dd46090c3d127e2 100644 (file)
@@ -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 ) 
index a88dc6f72cc19fc3caf4eddb9b62b2e4ec4c8341..f0d2b9bfa46ca1da42086d7ea27e34a127f1c5f8 100644 (file)
@@ -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
index bb9b15ad7fc1ef77dd9c941d9d19190e5336ceb9..88b0edf3f9b5564cc832cbde0f6b70553a469857 100644 (file)
@@ -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;
index 296aa8dfe0f323625b20b97485a601ac3ada9d07..14afc2d9599c804d9597e5e4be190e74f159bb72 100644 (file)
@@ -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 ) 
index a71937cd829ea7d34761c290d38244f2452e3fc1..29b6fc6f0f0c03b3a81fff79239de1d3e4dd36bd 100644 (file)
@@ -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 )
     {