/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/carbon/mdi.cpp
+// Name: src/osx/carbon/mdi.cpp
// Purpose: MDI classes
// Author: Stefan Csomor
// Modified by:
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;
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
{
-#if 1 // TODO REMOVE
+#if wxOSX_USE_CARBON // TODO REMOVE
if ( inWindowRef )
{
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
SetPort( port ) ;
#endif
}
+#elif defined(wxOSX_USE_COCOA)
+ wxUnusedVar(inActivate);
+ wxUnusedVar(inWindowRef);
+// TODO: implement me!
#endif
}
void wxMDIParentFrame::Init()
{
- m_clientWindow = NULL;
- m_currentChild = NULL;
- m_windowMenu = (wxMenu*) NULL;
m_parentFrameActive = true;
m_shouldBeShown = false;
}
// "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
m_parentFrameActive = true;
m_clientWindow = OnCreateClient();
+ if ( !m_clientWindow || !m_clientWindow->CreateClient(this, style) )
+ return false;
- return m_clientWindow != NULL;
+ return true;
}
wxMDIParentFrame::~wxMDIParentFrame()
// already deleted by DestroyChildren()
m_clientWindow = NULL ;
-
- delete m_windowMenu;
}
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
{
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"));
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("Scheduling delayed MDI Parent deactivation"));
s_macDeactivateWindow = this;
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)
{
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();
// Child frame
// ----------------------------------------------------------------------------
-wxMDIChildFrame::wxMDIChildFrame()
-{
- Init() ;
-}
void wxMDIChildFrame::Init()
{
}
long style,
const wxString& name)
{
+ m_mdiParent = parent;
+
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));
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"));
{
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"));
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("Scheduling delayed deactivation"));
s_macDeactivateWindow = this;
}
// MDI operations
-void wxMDIChildFrame::Maximize()
-{
- wxFrame::Maximize() ;
-}
-
-void wxMDIChildFrame::Restore()
-{
- wxFrame::Restore() ;
-}
-
void wxMDIChildFrame::Activate()
{
Raise ();
// wxMDIClientWindow
//-----------------------------------------------------------------------------
-wxMDIClientWindow::wxMDIClientWindow()
-{
-}
-
wxMDIClientWindow::~wxMDIClientWindow()
{
DestroyChildren();
return true;
}
-// Get size *available for subwindows* i.e. excluding menu bar.
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