]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
Fixed a confusion between window and client size that could lead to
[wxWidgets.git] / src / mac / carbon / window.cpp
index 3183451f176ff190d5be6d3744c68f9f567d65d9..2a6f6dfd9c0a602835557386e07dafa9f5e89031 100644 (file)
     #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"
 #include "wx/spinctrl.h"
 #include "wx/geometry.h"
 
+#if wxUSE_LISTCTRL
+    #include "wx/listctrl.h"
+#endif
+
+#if wxUSE_TREECTRL
+    #include "wx/treectrl.h"
+#endif
+
 #if wxUSE_CARET
     #include "wx/caret.h"
 #endif
@@ -156,6 +166,7 @@ static const EventTypeSpec eventList[] =
     { kEventClassCommand, kEventProcessCommand } ,
     { kEventClassCommand, kEventCommandUpdateStatus } ,
 
+    { kEventClassControl , kEventControlGetClickActivation } ,
     { kEventClassControl , kEventControlHit } ,
 
     { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
@@ -166,6 +177,9 @@ static const EventTypeSpec eventList[] =
     { kEventClassControl , kEventControlVisibilityChanged } ,
     { kEventClassControl , kEventControlEnabledStateChanged } ,
     { kEventClassControl , kEventControlHiliteChanged } ,
+
+    { kEventClassControl , kEventControlActivate } ,
+    { kEventClassControl , kEventControlDeactivate } ,
 #endif
     { kEventClassControl , kEventControlSetFocusPart } ,
 
@@ -293,7 +307,20 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
         case kEventControlHiliteChanged :
             thisWindow->MacHiliteChanged() ;
             break ;
+            
+        case kEventControlActivate :
+        case kEventControlDeactivate :
+            // FIXME: we should have a virtual function for this!
+#if wxUSE_TREECTRL
+            if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) ) )
+                thisWindow->Refresh();
+#endif
+#if wxUSE_LISTCTRL
+            if ( thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) ) )
+                thisWindow->Refresh();
 #endif
+            break ;
+#endif // TARGET_API_MAC_OSX
 
         // we emulate this event under Carbon CFM
         case kEventControlSetFocusPart :
@@ -350,6 +377,18 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
             result = thisWindow->MacControlHit( handler , event ) ;
             break ;
 
+        case kEventControlGetClickActivation :
+            {
+               // fix to always have a proper activation for DataBrowser controls (stay in bkgnd otherwise)
+                WindowRef owner = cEvent.GetParameter<WindowRef>(kEventParamWindowRef);
+                if ( !IsWindowActive(owner) )
+                {
+                    cEvent.SetParameter(kEventParamClickActivation,(UInt32) kActivateAndIgnoreClick) ;
+                    result = noErr ;
+                }
+            }
+            break ;
+
         default :
             break ;
     }
@@ -1095,7 +1134,7 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
     m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics) ) ;
 
     if (!m_macIsUserPane)
-        SetInitialBestSize(size);
+        SetInitialSize(size);
 
     SetCursor( *wxSTANDARD_CURSOR ) ;
 }
@@ -1661,10 +1700,10 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const
 
 bool wxWindowMac::SetCursor(const wxCursor& cursor)
 {
-    if (m_cursor == cursor)
+    if (m_cursor.IsSameAs(cursor))
         return false;
 
-    if (wxNullCursor == cursor)
+    if (!cursor.IsOk())
     {
         if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
             return false ;
@@ -2692,7 +2731,7 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event )
         Rect rect ;
 
         m_peer->GetRect( &rect ) ;
-        // auf den umgebenden Rahmen zur\9fck
+        // auf den umgebenden Rahmen zurÂ\9fck
         InsetRect( &rect, -1 , -1 ) ;
 
         wxTopLevelWindowMac* top = MacGetTopLevelWindow();