m_clientWindow = (wxMDIClientWindow*) NULL;
m_activeChild = (wxMDIChildFrame*) NULL;
m_activeMenuBar = (wxMenuBar*) NULL;
m_clientWindow = (wxMDIClientWindow*) NULL;
m_activeChild = (wxMDIChildFrame*) NULL;
m_activeMenuBar = (wxMenuBar*) NULL;
bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
if (success)
{
// TODO: app cannot override OnCreateClient since
// wxMDIParentFrame::OnCreateClient will still be called
// (we're in the constructor). How to resolve?
bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
if (success)
{
// TODO: app cannot override OnCreateClient since
// wxMDIParentFrame::OnCreateClient will still be called
// (we're in the constructor). How to resolve?
// Uses own style for client style
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
// Uses own style for client style
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
int w, h;
GetClientSize(& w, & h);
m_clientWindow->SetSize(0, 0, w, h);
int w, h;
GetClientSize(& w, & h);
m_clientWindow->SetSize(0, 0, w, h);
if ( GetClientWindow() )
GetClientWindow()->SetSize(x, y, width, height);
}
void wxMDIParentFrame::GetClientSize(int *width, int *height) const
{
if ( GetClientWindow() )
GetClientWindow()->SetSize(x, y, width, height);
}
void wxMDIParentFrame::GetClientSize(int *width, int *height) const
{
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
{
wxMenuBar* oldMenuBar = m_activeMenuBar;
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
{
wxMenuBar* oldMenuBar = m_activeMenuBar;
if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
{
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
{
// if (m_activeMenuBar)
// m_activeMenuBar->DestroyMenuBar();
if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
{
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
{
// if (m_activeMenuBar)
// m_activeMenuBar->DestroyMenuBar();
bool res = FALSE;
if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
{
res = m_activeChild->GetEventHandler()->ProcessEvent(event);
}
bool res = FALSE;
if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
{
res = m_activeChild->GetEventHandler()->ProcessEvent(event);
}
- return wxWindow::DoSetSize(x, y, width, height, sizeFlags);
+ wxWindow::DoSetSize(x, y, width, height, sizeFlags);
}
// Responds to colour changes, and passes event on to children.
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
{
// TODO
}
// Responds to colour changes, and passes event on to children.
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
{
// TODO
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK;
// This time we'll try a bog-standard bulletin board for
// the 'frame'. A main window doesn't seem to work.
// This time we'll try a bog-standard bulletin board for
// the 'frame'. A main window doesn't seem to work.
m_mainWidget = (WXWidget) XtVaCreateWidget("client",
xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(),
XmNmarginWidth, 0,
m_mainWidget = (WXWidget) XtVaCreateWidget("client",
xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(),
XmNmarginWidth, 0,
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
if (m_mainWidget)
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
if (m_mainWidget)
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
if (parentFrame->GetActiveChild() == this)
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
if (parentFrame->GetActiveChild() == this)
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
parentFrame->SetActiveChild(this);
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
parentFrame->SetActiveChild(this);
if (oldActiveChild)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
event.SetEventObject( oldActiveChild );
oldActiveChild->GetEventHandler()->ProcessEvent(event);
}
if (oldActiveChild)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
event.SetEventObject( oldActiveChild );
oldActiveChild->GetEventHandler()->ProcessEvent(event);
}
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
event.SetEventObject( this );
this->GetEventHandler()->ProcessEvent(event);
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
event.SetEventObject( this );
this->GetEventHandler()->ProcessEvent(event);
{
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
{
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
if (oldActiveChild == this)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
if (oldActiveChild == this)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
// Don't create the underlying menubar yet; need to recreate
// it every time the child is activated.
m_frameMenuBar = menuBar;
// Don't create the underlying menubar yet; need to recreate
// it every time the child is activated.
m_frameMenuBar = menuBar;
// We make the assumption that if you're setting the menubar,
// this is the currently active child.
GetMDIParentFrame()->SetChildMenuBar(this);
// We make the assumption that if you're setting the menubar,
// this is the currently active child.
GetMDIParentFrame()->SetChildMenuBar(this);
// By the time this destructor is called, the child frames will have been
// deleted and removed from the notebook/client window.
DestroyChildren();
// By the time this destructor is called, the child frames will have been
// deleted and removed from the notebook/client window.
DestroyChildren();
{
// m_windowParent = parent;
// m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
{
// m_windowParent = parent;
// m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
if (success)
{
bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
if (success)
{
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
event.SetEventObject( activeChild );
activeChild->GetEventHandler()->ProcessEvent(event);
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
event.SetEventObject( activeChild );
activeChild->GetEventHandler()->ProcessEvent(event);