]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/mdi.cpp
Return smaller images for wxART_MENU/BUTTON under OS X.
[wxWidgets.git] / src / osx / carbon / mdi.cpp
index 02b33e5cf66cac7f5c7fab87c490e9f01d5371e1..f236d572a429dfe6c3ed4ae24bacd730d9172aef 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/carbon/mdi.cpp
+// Name:        src/osx/carbon/mdi.cpp
 // Purpose:     MDI classes
 // Author:      Stefan Csomor
 // Modified by:
 // Purpose:     MDI classes
 // Author:      Stefan Csomor
 // Modified by:
@@ -34,10 +34,6 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
     EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
 END_EVENT_TABLE()
 
     EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
 END_EVENT_TABLE()
 
-BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
-    EVT_SCROLL(wxMDIClientWindow::OnScroll)
-END_EVENT_TABLE()
-
 #define TRACE_MDI "mdi"
 
 static const int IDM_WINDOWTILEHOR  = 4001;
 #define TRACE_MDI "mdi"
 
 static const int IDM_WINDOWTILEHOR  = 4001;
@@ -50,7 +46,7 @@ static const int IDM_WINDOWTILEVERT = 4005;
 
 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 {
 
 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 {
-#if 1 // TODO REMOVE
+#if wxOSX_USE_CARBON // TODO REMOVE
     if ( inWindowRef )
     {
 //        bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
     if ( inWindowRef )
     {
 //        bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
@@ -74,6 +70,10 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
         SetPort( port ) ;
 #endif
     }
         SetPort( port ) ;
 #endif
     }
+#elif defined(wxOSX_USE_COCOA)
+    wxUnusedVar(inActivate);
+    wxUnusedVar(inWindowRef);
+// TODO: implement me!
 #endif
 }
 
 #endif
 }
 
@@ -83,9 +83,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 
 void wxMDIParentFrame::Init()
 {
 
 void wxMDIParentFrame::Init()
 {
-    m_clientWindow = NULL;
-    m_currentChild = NULL;
-    m_windowMenu = (wxMenu*) NULL;
     m_parentFrameActive = true;
     m_shouldBeShown = false;
 }
     m_parentFrameActive = true;
     m_shouldBeShown = false;
 }
@@ -102,7 +99,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
     // "Window" menu
     if ( style & wxFRAME_NO_WINDOW_MENU )
     {
     // "Window" menu
     if ( style & wxFRAME_NO_WINDOW_MENU )
     {
-        m_windowMenu = (wxMenu *)NULL;
+        m_windowMenu = NULL;
         style -= wxFRAME_NO_WINDOW_MENU ;
     }
     else // normal case: we have the window menu, so construct it
         style -= wxFRAME_NO_WINDOW_MENU ;
     }
     else // normal case: we have the window menu, so construct it
@@ -123,8 +120,10 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
     m_parentFrameActive = true;
 
     m_clientWindow = OnCreateClient();
     m_parentFrameActive = true;
 
     m_clientWindow = OnCreateClient();
+    if ( !m_clientWindow || !m_clientWindow->CreateClient(this, style) )
+        return false;
 
 
-    return m_clientWindow != NULL;
+    return true;
 }
 
 wxMDIParentFrame::~wxMDIParentFrame()
 }
 
 wxMDIParentFrame::~wxMDIParentFrame()
@@ -133,8 +132,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
 
     // already deleted by DestroyChildren()
     m_clientWindow = NULL ;
 
     // already deleted by DestroyChildren()
     m_clientWindow = NULL ;
-
-    delete m_windowMenu;
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
@@ -218,7 +215,7 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
         {
             wxLogTrace(TRACE_MDI, wxT("child had been scheduled for deactivation, rehighlighting"));
 
         {
             wxLogTrace(TRACE_MDI, wxT("child had been scheduled for deactivation, rehighlighting"));
 
-            UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->MacGetWindowRef(), true);
+            UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->GetWXWindow(), true);
 
             wxLogTrace(TRACE_MDI, wxT("finished highliting child"));
 
 
             wxLogTrace(TRACE_MDI, wxT("finished highliting child"));
 
@@ -252,7 +249,9 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
         else // schedule ourselves for deactivation
         {
             if (s_macDeactivateWindow)
         else // schedule ourselves for deactivation
         {
             if (s_macDeactivateWindow)
+            {
                 wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow);
                 wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow);
+            }
             wxLogTrace(TRACE_MDI, wxT("Scheduling delayed MDI Parent deactivation"));
 
             s_macDeactivateWindow = this;
             wxLogTrace(TRACE_MDI, wxT("Scheduling delayed MDI Parent deactivation"));
 
             s_macDeactivateWindow = this;
@@ -265,19 +264,6 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
     event.Skip();
 }
 
     event.Skip();
 }
 
-// Returns the active MDI child window
-wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
-{
-    return m_currentChild ;
-}
-
-// Create the client window class (don't Create the window,
-// just return a new class)
-wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
-{
-    return new wxMDIClientWindow( this );
-}
-
 // Responds to colour changes, and passes event on to children.
 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
 // Responds to colour changes, and passes event on to children.
 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
@@ -287,32 +273,6 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
     wxFrame::OnSysColourChanged(event);
 }
 
     wxFrame::OnSysColourChanged(event);
 }
 
-// MDI operations
-void wxMDIParentFrame::Cascade()
-{
-    // TODO
-}
-
-void wxMDIParentFrame::Tile(wxOrientation WXUNUSED(orient))
-{
-    // TODO
-}
-
-void wxMDIParentFrame::ArrangeIcons()
-{
-    // TODO
-}
-
-void wxMDIParentFrame::ActivateNext()
-{
-    // TODO
-}
-
-void wxMDIParentFrame::ActivatePrevious()
-{
-    // TODO
-}
-
 bool wxMDIParentFrame::ShouldBeVisible() const
 {
     for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
 bool wxMDIParentFrame::ShouldBeVisible() const
 {
     for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
@@ -363,10 +323,6 @@ bool wxMDIParentFrame::Show( bool show )
 // Child frame
 // ----------------------------------------------------------------------------
 
 // Child frame
 // ----------------------------------------------------------------------------
 
-wxMDIChildFrame::wxMDIChildFrame()
-{
-    Init() ;
-}
 void wxMDIChildFrame::Init()
 {
 }
 void wxMDIChildFrame::Init()
 {
 }
@@ -379,17 +335,15 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
                              long style,
                              const wxString& name)
 {
                              long style,
                              const wxString& name)
 {
+    m_mdiParent = parent;
+
     SetName(name);
 
     if ( id == wxID_ANY )
     SetName(name);
 
     if ( id == wxID_ANY )
-        m_windowId = (int)NewControlId();
-    else
-        m_windowId = id;
+        id = (int)NewControlId();
 
 
-    if (parent)
-        parent->AddChild(this);
+    wxNonOwnedWindow::Create( parent, id, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
 
 
-    MacCreateRealWindow( pos , size , MacRemoveBordersFromStyle(style) , name ) ;
     SetTitle( title );
 
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
     SetTitle( title );
 
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
@@ -402,11 +356,6 @@ wxMDIChildFrame::~wxMDIChildFrame()
     DestroyChildren();
 }
 
     DestroyChildren();
 }
 
-void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
-{
-    return wxFrame::SetMenuBar( menu_bar ) ;
-}
-
 void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
 {
     wxLogTrace(TRACE_MDI, wxT("MDI child=%p  MacActivate(0x%08lx,%s)"),this, timestamp, activating ? wxT("ACTIV") : wxT("deact"));
 void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
 {
     wxLogTrace(TRACE_MDI, wxT("MDI child=%p  MacActivate(0x%08lx,%s)"),this, timestamp, activating ? wxT("ACTIV") : wxT("deact"));
@@ -420,7 +369,7 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
         {
             wxLogTrace(TRACE_MDI, wxT("parent had been scheduled for deactivation, rehighlighting"));
 
         {
             wxLogTrace(TRACE_MDI, wxT("parent had been scheduled for deactivation, rehighlighting"));
 
-            UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->MacGetWindowRef(), true);
+            UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->GetWXWindow(), true);
 
             wxLogTrace(TRACE_MDI, wxT("finished highliting parent"));
 
 
             wxLogTrace(TRACE_MDI, wxT("finished highliting parent"));
 
@@ -455,7 +404,9 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
         else // schedule ourselves for deactivation
         {
             if (s_macDeactivateWindow)
         else // schedule ourselves for deactivation
         {
             if (s_macDeactivateWindow)
+            {
                 wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow);
                 wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow);
+            }
             wxLogTrace(TRACE_MDI, wxT("Scheduling delayed deactivation"));
 
             s_macDeactivateWindow = this;
             wxLogTrace(TRACE_MDI, wxT("Scheduling delayed deactivation"));
 
             s_macDeactivateWindow = this;
@@ -464,16 +415,6 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
 }
 
 // MDI operations
 }
 
 // MDI operations
-void wxMDIChildFrame::Maximize()
-{
-    wxFrame::Maximize() ;
-}
-
-void wxMDIChildFrame::Restore()
-{
-    wxFrame::Restore() ;
-}
-
 void wxMDIChildFrame::Activate()
 {
     Raise ();
 void wxMDIChildFrame::Activate()
 {
     Raise ();
@@ -483,10 +424,6 @@ void wxMDIChildFrame::Activate()
 // wxMDIClientWindow
 //-----------------------------------------------------------------------------
 
 // wxMDIClientWindow
 //-----------------------------------------------------------------------------
 
-wxMDIClientWindow::wxMDIClientWindow()
-{
-}
-
 wxMDIClientWindow::~wxMDIClientWindow()
 {
     DestroyChildren();
 wxMDIClientWindow::~wxMDIClientWindow()
 {
     DestroyChildren();
@@ -500,15 +437,9 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
     return true;
 }
 
     return true;
 }
 
-// Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
 {
     wxDisplaySize( x , y ) ;
 }
 
 void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
 {
     wxDisplaySize( x , y ) ;
 }
 
-// Explicitly call default scroll behaviour
-void wxMDIClientWindow::OnScroll(wxScrollEvent& WXUNUSED(event))
-{
-}
-
 #endif // wxUSE_MDI
 #endif // wxUSE_MDI