msflags &= ~WS_HSCROLL;
if ( !wxWindow::MSWCreate(wxMDIFrameClassName,
- title,
+ title.wx_str(),
pos, size,
msflags,
exflags) )
}
}
+const wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const
+{
+ const wxMenuItem *item = wxFrame::FindItemInMenuBar(menuId);
+ if ( !item && m_currentChild )
+ {
+ item = m_currentChild->FindItemInMenuBar(menuId);
+ }
+
+ return item;
+}
+
void wxMDIParentFrame::UpdateClientSize()
{
if ( GetClientWindow() )
rc = true;
break;
- case WM_MENUSELECT:
- {
- WXWORD item, flags;
- WXHMENU hmenu;
- UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
-
- if ( m_parentFrameActive )
- {
- processed = HandleMenuSelect(item, flags, hmenu);
- }
- else if (m_currentChild)
- {
- processed = m_currentChild->
- HandleMenuSelect(item, flags, hmenu);
- }
- }
- break;
-
case WM_SIZE:
// though we don't (usually) resize the MDI client to exactly fit the
// client area we need to pass this one to DefFrameProc to allow the children to show
{
wxActivateEvent event(wxEVT_ACTIVATE, true, m_currentChild->GetId());
event.SetEventObject( m_currentChild );
- if ( m_currentChild->GetEventHandler()->ProcessEvent(event) )
+ if ( m_currentChild->HandleWindowEvent(event) )
processed = true;
}
wxWindow *child = node->GetData();
if ( child->GetHWND() )
{
- long childId = wxGetWindowId(child->GetHWND());
- if (childId == (long)id)
+ int childId = wxGetWindowId(child->GetHWND());
+ if ( childId == (signed short)id )
{
::SendMessage( GetWinHwnd(GetClientWindow()),
WM_MDIACTIVATE,
if ( id != wxID_ANY )
m_windowId = id;
else
- m_windowId = (int)NewControlId();
+ m_windowId = NewControlId();
if ( parent )
{
mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE
? wxMDIChildFrameClassName
: wxMDIChildFrameClassNameNoRedraw;
- mcs.szTitle = title;
+ mcs.szTitle = title.wx_str();
mcs.hOwner = wxGetInstance();
if (x != wxDefaultCoord)
mcs.x = x;
wxWindowCreationHook hook(this);
m_hWnd = (WXHWND)::SendMessage(GetWinHwnd(parent->GetClientWindow()),
- WM_MDICREATE, 0, (LONG)(LPSTR)&mcs);
+ WM_MDICREATE, 0, (LPARAM)&mcs);
if ( !m_hWnd )
{
// we need to refresh the MDI frame window menu to include (or exclude if
// we've been hidden) this frame
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
MDISetMenu(parent->GetClientWindow(), NULL, NULL);
return true;
// If there's an MDI parent, must subtract the parent's top left corner
// since MoveWindow moves relative to the parent
- wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *mdiParent = GetMDIParent();
::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true);
wxSize size(width, height);
wxSizeEvent event(size, m_windowId);
event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
}
// Unlike other wxTopLevelWindowBase, the mdi child's "GetPosition" is not the
// Since we now have the absolute screen coords,
// if there's a parent we must subtract its top left corner
- wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *mdiParent = GetMDIParent();
::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
if (x)
void wxMDIChildFrame::InternalSetMenuBar()
{
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
InsertWindowMenu(parent->GetClientWindow(),
m_hMenu, GetMDIWindowMenu(parent));
void wxMDIChildFrame::Maximize(bool maximize)
{
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
if ( parent && parent->GetClientWindow() )
{
::SendMessage(GetWinHwnd(parent->GetClientWindow()),
void wxMDIChildFrame::Restore()
{
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
if ( parent && parent->GetClientWindow() )
{
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE,
void wxMDIChildFrame::Activate()
{
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
if ( parent && parent->GetClientWindow() )
{
::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE,
WXHWND hwndAct,
WXHWND hwndDeact)
{
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
HMENU menuToSet = 0;
ResetWindowStyle((void *)NULL);
- return GetEventHandler()->ProcessEvent(event);
+ return HandleWindowEvent(event);
}
bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
{
// we must pass the parent frame to ::TranslateAccelerator(), otherwise it
// doesn't do its job correctly for MDI child menus
- return MSWDoTranslateMessage((wxMDIChildFrame *)GetParent(), msg);
+ return MSWDoTranslateMessage(GetMDIParent(), msg);
}
// ---------------------------------------------------------------------------
void wxMDIChildFrame::MSWDestroyWindow()
{
- wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame *parent = GetMDIParent();
// Must make sure this handle is invalidated (set to NULL) since all sorts
// of things could happen after the child client is destroyed, but before
bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
{
RECT *rect = (RECT *)vrect;
- wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
+ wxMDIParentFrame* pFrameWnd = GetMDIParent();
wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
if (!pChild || (pChild == this))
(WPARAM)hmenuFrame,
(LPARAM)hmenuWindow) )
{
- wxLogLastError(_T("SendMessage(WM_MDISETMENU)"));
+#ifdef __WXDEBUG__
+ DWORD err = ::GetLastError();
+ if ( err )
+ wxLogApiError(_T("SendMessage(WM_MDISETMENU)"), err);
+#endif // __WXDEBUG__
}
}
{
success = true;
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
- (UINT)subMenu, _("&Window"));
+ (UINT_PTR)subMenu, _("&Window").wx_str());
break;
}
}
if ( !success )
{
- ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window"));
+ ::AppendMenu(hmenu, MF_POPUP,
+ (UINT_PTR)subMenu, _("&Window").wx_str());
}
}