X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c78e7c70271608b076b1dbed201b1204e6898d4..3dec57adfdb2469b7679930092f0bd9c8569d62c:/src/qt/mdi.cpp diff --git a/src/qt/mdi.cpp b/src/qt/mdi.cpp index f5d5573bab..7ece99f432 100644 --- a/src/qt/mdi.cpp +++ b/src/qt/mdi.cpp @@ -1,10 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: mdi.cpp -// Purpose: -// Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Purpose: MDI classes +// Author: AUTHOR +// Modified by: +// Created: ??/??/98 +// RCS-ID: $Id$ +// Copyright: (c) AUTHOR // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,217 +14,248 @@ #endif #include "wx/mdi.h" -#include "wx/dialog.h" -#include "wx/menu.h" -//----------------------------------------------------------------------------- +extern wxList wxModelessWindows; -extern wxList wxPendingDelete; +IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) -//----------------------------------------------------------------------------- -// wxMDIParentFrame -//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) + EVT_SIZE(wxMDIParentFrame::OnSize) + EVT_ACTIVATE(wxMDIParentFrame::OnActivate) + EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) +END_EVENT_TABLE() -//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) + EVT_SCROLL(wxMDIClientWindow::OnScroll) +END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) -BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) -END_EVENT_TABLE() +// Parent frame -wxMDIParentFrame::wxMDIParentFrame(void) +wxMDIParentFrame::wxMDIParentFrame() { - m_clientWindow = NULL; - m_currentChild = NULL; - m_parentFrameActive = TRUE; -}; +} -wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +bool wxMDIParentFrame::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { - m_clientWindow = NULL; - m_currentChild = NULL; - m_parentFrameActive = TRUE; - Create( parent, id, title, pos, size, style, name ); -}; + if (!parent) + wxTopLevelWindows.Append(this); + + SetName(name); + m_windowStyle = style; + + if (parent) parent->AddChild(this); -wxMDIParentFrame::~wxMDIParentFrame(void) + if ( id > -1 ) + m_windowId = id; + else + m_windowId = (int)NewControlId(); + + // TODO: create MDI parent frame + + wxModelessWindows.Append(this); + + return TRUE; +} + +wxMDIParentFrame::~wxMDIParentFrame() { -}; +} -bool wxMDIParentFrame::Create( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +// Get size *available for subwindows* i.e. excluding menu bar. +void wxMDIParentFrame::GetClientSize(int *x, int *y) const { - wxFrame::Create( parent, id, title, pos, size, style, name ); - - OnCreateClient(); - - return TRUE; -}; + // TODO +} -void wxMDIParentFrame::GetClientSize(int *width, int *height ) const +void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar) { - wxFrame::GetClientSize( width, height ); -}; + // TODO + if (!menu_bar) + { + m_frameMenuBar = NULL; + return; + } + + if (menu_bar->m_menuBarFrame) + return; -wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const + m_frameMenuBar = menu_bar; +} + +void wxMDIParentFrame::OnSize(wxSizeEvent& event) { - return m_currentChild; -}; +#if wxUSE_CONSTRAINTS + if (GetAutoLayout()) + Layout(); +#endif + int x = 0; + int y = 0; + int width, height; + GetClientSize(&width, &height); + + if ( GetClientWindow() ) + GetClientWindow()->SetSize(x, y, width, height); +} -wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const +void wxMDIParentFrame::OnActivate(wxActivateEvent& event) { - return m_clientWindow; -}; + // Do nothing +} -wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void) +// Returns the active MDI child window +wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const { - m_clientWindow = new wxMDIClientWindow( this ); - return m_clientWindow; -}; + // TODO + return NULL; +} -void wxMDIParentFrame::ActivateNext(void) +// Create the client window class (don't Create the window, +// just return a new class) +wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() { -}; + return new wxMDIClientWindow ; +} -void wxMDIParentFrame::ActivatePrevious(void) +// Responds to colour changes, and passes event on to children. +void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { -}; + // TODO -void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) + // Propagate the event to the non-top-level children + wxFrame::OnSysColourChanged(event); +} + +// MDI operations +void wxMDIParentFrame::Cascade() { -}; + // TODO +} -void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) ) +void wxMDIParentFrame::Tile() { -}; + // TODO +} -//----------------------------------------------------------------------------- -// wxMDIChildFrame -//----------------------------------------------------------------------------- +void wxMDIParentFrame::ArrangeIcons() +{ + // TODO +} -IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) - -BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) - EVT_ACTIVATE(wxMDIChildFrame::OnActivate) -END_EVENT_TABLE() +void wxMDIParentFrame::ActivateNext() +{ + // TODO +} -wxMDIChildFrame::wxMDIChildFrame(void) +void wxMDIParentFrame::ActivatePrevious() { -}; + // TODO +} + +// Child frame -wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, - wxWindowID id, const wxString& title, - const wxPoint& WXUNUSED(pos), const wxSize& size, - long style, const wxString& name ) +wxMDIChildFrame::wxMDIChildFrame() { - Create( parent, id, title, wxDefaultPosition, size, style, name ); -}; +} -wxMDIChildFrame::~wxMDIChildFrame(void) +bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { -}; + SetName(name); + + if ( id > -1 ) + m_windowId = id; + else + m_windowId = (int)NewControlId(); + + if (parent) parent->AddChild(this); + + // TODO: create child frame -bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, - wxWindowID id, const wxString& title, - const wxPoint& WXUNUSED(pos), const wxSize& size, - long style, const wxString& name ) + wxModelessWindows.Append(this); + return FALSE; +} + +wxMDIChildFrame::~wxMDIChildFrame() { - m_title = title; - return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); -}; +} -void wxMDIChildFrame::GetClientSize( int *width, int *height ) const +// Set the client size (i.e. leave the calculation of borders etc. +// to wxWindows) +void wxMDIChildFrame::SetClientSize(int width, int height) { - wxWindow::GetClientSize( width, height ); + // TODO } -void wxMDIChildFrame::AddChild( wxWindow *child ) +void wxMDIChildFrame::GetPosition(int *x, int *y) const { - wxWindow::AddChild( child ); + // TODO } - -static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) -{ - menu->SetInvokingWindow( win ); - wxNode *node = menu->m_items.First(); - while (node) - { - wxMenuItem *menuitem = (wxMenuItem*)node->Data(); - if (menuitem->IsSubMenu()) - SetInvokingWindow( menuitem->GetSubMenu(), win ); - node = node->Next(); - }; -}; - -void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) -{ - m_menuBar = menu_bar; - - if (m_menuBar) - { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; - - if (m_menuBar->m_parent != this) + +void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar) +{ + // TODO + if (!menu_bar) { - wxNode *node = m_menuBar->m_menus.First(); - while (node) - { - wxMenu *menu = (wxMenu*)node->Data(); - SetInvokingWindow( menu, this ); - node = node->Next(); - }; - - m_menuBar->m_parent = mdi_frame; + m_frameMenuBar = NULL; + return; } - mdi_frame->SetMDIMenuBar( m_menuBar ); - - } -}; + + if (menu_bar->m_menuBarFrame) + return; + m_frameMenuBar = menu_bar; +} -wxMenuBar *wxMDIChildFrame::GetMenuBar() +// MDI operations +void wxMDIChildFrame::Maximize() { - return m_menuBar; -}; + // TODO +} -void wxMDIChildFrame::Activate(void) +void wxMDIChildFrame::Restore() { -}; + // TODO +} -void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) ) +void wxMDIChildFrame::Activate() { -}; - -//----------------------------------------------------------------------------- -// wxMDIClientWindow -//----------------------------------------------------------------------------- + // TODO +} -IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow) +// Client window -wxMDIClientWindow::wxMDIClientWindow(void) +wxMDIClientWindow::wxMDIClientWindow() { -}; +} -wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style ) +wxMDIClientWindow::~wxMDIClientWindow() { - CreateClient( parent, style ); -}; +} -wxMDIClientWindow::~wxMDIClientWindow(void) +bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) { -}; + // TODO create client window + m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE); -bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *WXUNUSED(parent), long WXUNUSED(style) ) -{ - return TRUE; -}; + return FALSE; +} -void wxMDIClientWindow::AddChild( wxWindow *WXUNUSED(child) ) +// Explicitly call default scroll behaviour +void wxMDIClientWindow::OnScroll(wxScrollEvent& event) { -}; - + Default(); // Default processing +}