]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/nonownedwnd.cpp
Spell contributor name correctly.
[wxWidgets.git] / src / osx / carbon / nonownedwnd.cpp
index cab04631f5a7522d74224c8eb6f75c0f0b0d3302..d5b1f7457092f29c4822a9d360c310f65b00ae42 100644 (file)
@@ -51,6 +51,21 @@ void wxNonOwnedWindowCarbonImpl::Lower()
     ::SendBehind( m_macWindow , NULL ) ;
 }
 
+void wxNonOwnedWindowCarbonImpl::ShowWithoutActivating()
+{
+    bool plainTransition = true;
+
+#if wxUSE_SYSTEM_OPTIONS
+    if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
+        plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
+#endif
+
+    if ( plainTransition )
+       ::ShowWindow( (WindowRef)m_macWindow );
+    else
+       ::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL );
+}
+
 bool wxNonOwnedWindowCarbonImpl::Show(bool show)
 {
     bool plainTransition = true;
@@ -62,14 +77,8 @@ bool wxNonOwnedWindowCarbonImpl::Show(bool show)
 
     if (show)
     {
-#if wxOSX_USE_CARBON
-        if ( plainTransition )
-           ::ShowWindow( (WindowRef)m_macWindow );
-        else
-           ::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL );
-
+        ShowWithoutActivating();
         ::SelectWindow( (WindowRef)m_macWindow ) ;
-#endif
     }
     else
     {
@@ -245,6 +254,7 @@ void wxNonOwnedWindowCarbonImpl::MacSetUnifiedAppearance( bool set )
 
 static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
 
+void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent );
 
 // ---------------------------------------------------------------------------
 // Carbon Events
@@ -528,8 +538,9 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
                     break ;
             }
             break ;
-
-     case kEventMouseWheelMoved :
+     // TODO http://developer.apple.com/qa/qa2005/qa1453.html
+     // add declaration for 10.4 and change to kEventMouseScroll
+    case kEventMouseWheelMoved :
         {
             wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
 
@@ -919,7 +930,7 @@ wxNonOwnedWindowEventHandler(EventHandlerCallRef WXUNUSED(handler),
 // mix this in from window.cpp
 pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) ;
 
-pascal OSStatus wxNonOwnedEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+static pascal OSStatus wxNonOwnedEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     OSStatus result = eventNotHandledErr ;
 
@@ -1124,7 +1135,7 @@ wxNonOwnedWindowCarbonImpl::~wxNonOwnedWindowCarbonImpl()
         m_macEventHandler = NULL ;
     }
 
-    if ( m_macWindow )
+    if ( m_macWindow && !m_wxPeer->IsNativeWindowWrapper())
         DisposeWindow( m_macWindow );
 
     FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
@@ -1135,18 +1146,16 @@ wxNonOwnedWindowCarbonImpl::~wxNonOwnedWindowCarbonImpl()
 
 }
 
-void wxNonOwnedWindowCarbonImpl::Destroy()
+void wxNonOwnedWindowCarbonImpl::WillBeDestroyed()
 {
     if ( m_macEventHandler )
     {
         ::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
         m_macEventHandler = NULL ;
     }
-
-    wxPendingDelete.Append( new wxDeferredObjectDeleter( this ) ) ;
 }
 
-void wxNonOwnedWindowInstallTopLevelWindowEventHandler(WindowRef window, EventHandlerRef* handler, void *ref)
+static void wxNonOwnedWindowInstallTopLevelWindowEventHandler(WindowRef window, EventHandlerRef* handler, void *ref)
 {
     InstallWindowEventHandler(window, GetwxNonOwnedEventHandlerUPP(),
         GetEventTypeCount(eventList), eventList, ref, handler );
@@ -1183,11 +1192,18 @@ void wxNonOwnedWindowCarbonImpl::MacInstallTopLevelWindowEventHandler()
 }
 
 void wxNonOwnedWindowCarbonImpl::Create(
-    wxWindow* parent,
-    const wxPoint& pos,
-    const wxSize& size,
-    long style, long extraStyle,
-    const wxString& WXUNUSED(name) )
+    wxWindow* WXUNUSED(parent),
+    WXWindow nativeWindow )
+{
+    m_macWindow = nativeWindow;
+}
+
+void wxNonOwnedWindowCarbonImpl::Create(
+                                        wxWindow* parent,
+                                        const wxPoint& pos,
+                                        const wxSize& size,
+                                        long style, long extraStyle,
+                                        const wxString& WXUNUSED(name) )
 {
 
     OSStatus err = noErr ;
@@ -1320,13 +1336,13 @@ void wxNonOwnedWindowCarbonImpl::Create(
         customWindowDefSpec.defType = kWindowDefProcPtr;
         customWindowDefSpec.u.defProc =
 #ifdef __LP64__
-            (WindowDefUPP) wxShapedMacWindowDef;
+        (WindowDefUPP) wxShapedMacWindowDef;
 #else
-            NewWindowDefUPP(wxShapedMacWindowDef);
+        NewWindowDefUPP(wxShapedMacWindowDef);
 #endif
         err = ::CreateCustomWindow( &customWindowDefSpec, wclass,
-                              attr, &theBoundsRect,
-                              (WindowRef*) &m_macWindow);
+                                   attr, &theBoundsRect,
+                                   (WindowRef*) &m_macWindow);
     }
     else
     {
@@ -1669,6 +1685,11 @@ void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
         *y = (int)p.y;
 }
 
+bool wxNonOwnedWindowCarbonImpl::IsActive()
+{
+    return ActiveNonFloatingWindow() == m_macWindow;
+}
+
 wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
     long style, long extraStyle, const wxString& name )
 {
@@ -1676,3 +1697,11 @@ wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWind
     now->Create( parent, pos, size, style , extraStyle, name );
     return now;
 }
+
+wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow nativeWindow )
+{
+    wxNonOwnedWindowCarbonImpl* now = new wxNonOwnedWindowCarbonImpl( wxpeer );
+    now->Create( parent, nativeWindow );
+    return now;
+}
+