]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/window_osx.cpp
Return raw text, not markup, from wxWebViewWebKit::GetSelectedText().
[wxWidgets.git] / src / osx / window_osx.cpp
index e8337f8c67ff7c07415976cce3239732a441c5c1..bba95e6e8a8b774daf545d098876a66228583ad5 100644 (file)
@@ -614,12 +614,14 @@ void wxWindowMac::OSXSimulateFocusEvents()
         {
             wxFocusEvent event( wxEVT_KILL_FOCUS, former->GetId());
             event.SetEventObject(former);
+            event.SetWindow(this);
             former->HandleWindowEvent(event) ;
         }
 
         {
             wxFocusEvent event(wxEVT_SET_FOCUS, former->GetId());
             event.SetEventObject(former);
+            event.SetWindow(this);
             former->HandleWindowEvent(event);
         }
     }
@@ -870,9 +872,22 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const
 
 #endif
     if (x)
-       *x = ww;
+    {
+        // we shouldn't return invalid width
+        if ( ww < 0 )
+            ww = 0;
+        
+        *x = ww;
+    }
+    
     if (y)
-       *y = hh;
+    {
+        // we shouldn't return invalid height
+        if ( hh < 0 )
+            hh = 0;
+        
+        *y = hh;
+    }
 }
 
 bool wxWindowMac::SetCursor(const wxCursor& cursor)
@@ -1058,11 +1073,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         if ( doResize )
         {
             MacRepositionScrollBars() ;
-            MacOnInternalSize();
-            wxSize size(actualWidth, actualHeight);
-            wxSizeEvent event(size, m_windowId);
-            event.SetEventObject(this);
-            HandleWindowEvent(event);
+            SendSizeEvent();
         }
     }
 }
@@ -1116,6 +1127,12 @@ wxSize wxWindowMac::DoGetBestSize() const
     }
 }
 
+void wxWindowMac::SendSizeEvent(int flags)
+{
+    MacOnInternalSize();
+    wxWindowBase::SendSizeEvent(flags);
+}
+
 // set the size of the window: if the dimensions are positive, just use them,
 // but if any of them is equal to -1, it means that we must find the value for
 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
@@ -1142,10 +1159,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 
         if (sizeFlags & wxSIZE_FORCE_EVENT)
         {
-            MacOnInternalSize();
-            wxSizeEvent event( wxSize(width,height), GetId() );
-            event.SetEventObject( this );
-            HandleWindowEvent( event );
+            SendSizeEvent();
         }
 
         return;
@@ -1218,7 +1232,7 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight)
     }
 }
 
-float wxWindowMac::GetContentScaleFactor() const 
+double wxWindowMac::GetContentScaleFactor() const 
 {
     return GetPeer()->GetContentScaleFactor();
 }
@@ -1676,10 +1690,7 @@ void wxWindowMac::DoUpdateScrollbarVisibility()
     MacRepositionScrollBars() ;
     if ( triggerSizeEvent )
     {
-        MacOnInternalSize();
-        wxSizeEvent event(GetSize(), m_windowId);
-        event.SetEventObject(this);
-        HandleWindowEvent(event);
+        SendSizeEvent();
     }
 #endif
 }
@@ -2776,6 +2787,10 @@ bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event )
 // wxWidgetImpl
 //
 
+// we are maintaining a n:1 map from native controls (ControlRef / NSView*) to their wxWidgetImpl
+// n:1 because we might have an embedded view eg within a scrollview, both being part of the same impl
+// the impl is calling Associate with its newly created native control(s), e.g. in InstallHandler
+
 WX_DECLARE_HASH_MAP(WXWidget, wxWidgetImpl*, wxPointerHash, wxPointerEqual, MacControlMap);
 
 static MacControlMap wxWinMacControlList;