]> git.saurik.com Git - wxWidgets.git/commitdiff
Generic list and tree ctrl should not use the focused selection color when the top...
authorKevin Ollivier <kevino@theolliviers.com>
Sun, 7 Jan 2007 01:15:20 +0000 (01:15 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Sun, 7 Jan 2007 01:15:20 +0000 (01:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp
src/generic/treectlg.cpp
src/mac/carbon/window.cpp

index a7485c2a2e1561065639a121c27a8dbf0d08ed5a..c485403edb4bf1df2e528953a0fae2bf91bfed2f 100644 (file)
@@ -1410,7 +1410,11 @@ bool wxListLineData::SetAttributes(wxDC *dc,
     if ( highlighted )
 #ifdef __WXMAC__
     {
-        if (m_owner->HasFocus())
+        if (m_owner->HasFocus()
+#ifdef __WXMAC__
+                && IsControlActive( (ControlRef)m_owner->GetHandle() )
+#endif
+        )
             colText = *wxWHITE;
         else
             colText = *wxBLACK;
@@ -1470,7 +1474,11 @@ void wxListLineData::Draw( wxDC *dc )
         if (highlighted)
         {
             int flags = wxCONTROL_SELECTED;
-            if (m_owner->HasFocus())
+            if (m_owner->HasFocus()
+#ifdef __WXMAC__
+                && IsControlActive( (ControlRef)m_owner->GetHandle() )
+#endif
+            )
                 flags |= wxCONTROL_FOCUSED;
             wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, m_gi->m_rectHighlight, flags );
 
@@ -1529,7 +1537,11 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
         if (highlighted)
         {
             int flags = wxCONTROL_SELECTED;
-            if (m_owner->HasFocus())
+            if (m_owner->HasFocus()
+#ifdef __WXMAC__
+                && IsControlActive( (ControlRef)m_owner->GetHandle() )
+#endif
+            )
                 flags |= wxCONTROL_FOCUSED;
             wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
         }
index 7b29dca54f673b1df91dd7dfcbea5b866e51fae9..98097d6a8e8897cc50ef252bb3ffada8c8739ed3 100644 (file)
@@ -2232,7 +2232,11 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
         else
         {
             int flags = wxCONTROL_SELECTED;
-            if (m_hasFocus)
+            if (m_hasFocus
+#ifdef __WXMAC__
+                && IsControlActive( (ControlRef)GetHandle() )
+#endif
+            )
                 flags |= wxCONTROL_FOCUSED;
             if ((item == m_current) && (m_hasFocus))
                 flags |= wxCONTROL_CURRENT;
@@ -2374,7 +2378,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
             // rectangle, so we want to make sure that the text is visible
             // against the normal background, not the highlightbackground, so
             // don't use the highlight text colour unless we have the focus.
-             && m_hasFocus
+             && m_hasFocus && IsControlActive( (ControlRef)GetHandle() )
 #endif
             )
         {
index 5764a89abfcd1ba51d10e62211490e7ac7912e0e..b8a268cd53b1b07e06602330c2374f1ffac5a7f9 100644 (file)
@@ -33,6 +33,8 @@
     #include "wx/layout.h"
     #include "wx/statusbr.h"
     #include "wx/menuitem.h"
+    #include "wx/treectrl.h"
+    #include "wx/listctrl.h"
 #endif
 
 #include "wx/tooltip.h"
@@ -167,6 +169,9 @@ static const EventTypeSpec eventList[] =
     { kEventClassControl , kEventControlVisibilityChanged } ,
     { kEventClassControl , kEventControlEnabledStateChanged } ,
     { kEventClassControl , kEventControlHiliteChanged } ,
+
+    { kEventClassControl , kEventControlActivate } ,
+    { kEventClassControl , kEventControlDeactivate } ,
 #endif
     { kEventClassControl , kEventControlSetFocusPart } ,
 
@@ -294,6 +299,16 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
         case kEventControlHiliteChanged :
             thisWindow->MacHiliteChanged() ;
             break ;
+            
+        case kEventControlActivate :
+        case kEventControlDeactivate :
+            if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) ) 
+                    || thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) ) 
+                )
+                thisWindow->Refresh();
+            
+            //thisWindow->MacActivateStateChanged() ;
+            break ;
 #endif
 
         // we emulate this event under Carbon CFM