Files
wxWidgets/src/qt/mdi.cpp
Sean D'Epagnier 35bc8f449b Improve build and widget storage
There are no longer any qt headers included in wx/qt headers.
Applications do not need to link with qt librarys anymore, only wxqt libraries.
wxWindow and derived widgets only contain one pointer to their qtwidget, no longer
  carrying both base and derived pointers in parallel as was before.
2017-11-06 02:05:40 +01:00

156 lines
4.0 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/mdi.cpp
// Author: Mariano Reingart, Peter Most
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_MDI
#include "wx/mdi.h"
#include "wx/qt/private/utils.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMainWindow>
// Main MDI window helper
class wxQtMDIParentFrame : public wxQtEventSignalHandler< QMainWindow, wxMDIParentFrame >
{
public:
wxQtMDIParentFrame( wxWindow *parent, wxMDIParentFrame *handler );
private:
};
// Central widget helper (container to show scroll bars and receive events):
class wxQtMdiArea : public wxQtEventSignalHandler< QMdiArea, wxMDIClientWindow >
{
public:
wxQtMdiArea( wxWindow *parent, wxMDIClientWindow *handler );
};
wxIMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame);
wxMDIParentFrame::wxMDIParentFrame()
{
}
wxMDIParentFrame::wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
(void)Create(parent, id, title, pos, size, style, name);
}
bool wxMDIParentFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
m_qtWindow = new wxQtMDIParentFrame( parent, this );
if (!wxFrameBase::Create( parent, id, title, pos, size, style, name ))
return false;
wxMDIClientWindow *client = OnCreateClient();
m_clientWindow = client;
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
return false;
GetQMainWindow()->setCentralWidget( client->GetHandle() );
PostCreation();
return true;
}
void wxMDIParentFrame::ActivateNext()
{
}
void wxMDIParentFrame::ActivatePrevious()
{
}
//##############################################################################
wxMDIChildFrame::wxMDIChildFrame()
{
}
wxMDIChildFrame::wxMDIChildFrame(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
Create(parent, id, title, pos, size, style, name);
}
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
m_mdiParent = parent;
bool ok = wxFrame::Create(parent->GetClientWindow(), id,
title,
pos, size, style, name);
if (ok)
{
// Add the window to the internal MDI client area:
static_cast<QMdiArea*>(parent->GetQMainWindow()->centralWidget())->addSubWindow(GetHandle());
}
return ok;
}
void wxMDIChildFrame::Activate()
{
}
//##############################################################################
wxMDIClientWindow::wxMDIClientWindow()
{
}
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long WXUNUSED(style))
{
// create the MDI client area where the children window are displayed:
m_qtWindow = new wxQtMdiArea( parent, this );
return true;
}
// Helper implementation:
wxQtMDIParentFrame::wxQtMDIParentFrame( wxWindow *parent, wxMDIParentFrame *handler )
: wxQtEventSignalHandler< QMainWindow, wxMDIParentFrame >( parent, handler )
{
}
wxQtMdiArea::wxQtMdiArea(wxWindow *parent, wxMDIClientWindow *handler )
: wxQtEventSignalHandler< QMdiArea, wxMDIClientWindow >( parent, handler )
{
}
#endif // wxUSE_MDI