]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/nonownedwnd.cpp
Spell contributor name correctly.
[wxWidgets.git] / src / osx / carbon / nonownedwnd.cpp
index 192f8f5a2455b658740002b4979ae547538fb556..d5b1f7457092f29c4822a9d360c310f65b00ae42 100644 (file)
@@ -254,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
@@ -537,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 ) ;
 
@@ -928,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 ;
 
@@ -1133,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 ;
@@ -1153,7 +1155,7 @@ void wxNonOwnedWindowCarbonImpl::WillBeDestroyed()
     }
 }
 
-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 );
@@ -1190,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 ;
@@ -1327,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
     {
@@ -1688,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;
+}
+