1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2000-07-15 15:51:35 -04:00
|
|
|
// Name: wx/msw/mdi.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: MDI (Multiple Document Interface) classes
|
|
|
|
// Author: Julian Smart
|
2008-11-03 21:46:19 -05:00
|
|
|
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
1998-05-20 10:12:05 -04:00
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2008-11-03 21:46:19 -05:00
|
|
|
// Copyright: (c) 1997 Julian Smart
|
|
|
|
// (c) 2008 Vadim Zeitlin
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
#ifndef _WX_MSW_MDI_H_
|
|
|
|
#define _WX_MSW_MDI_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#include "wx/frame.h"
|
|
|
|
|
2009-01-27 11:47:41 -05:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable;
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIParentFrame
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-05-13 17:21:04 -04:00
|
|
|
public:
|
2009-01-27 11:47:41 -05:00
|
|
|
wxMDIParentFrame() { }
|
1999-05-13 17:21:04 -04:00
|
|
|
wxMDIParentFrame(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
|
|
|
const wxString& name = wxFrameNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxMDIParentFrame();
|
1999-05-13 17:21:04 -04:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
|
|
|
const wxString& name = wxFrameNameStr);
|
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
// override/implement base class [pure] virtual methods
|
|
|
|
// ----------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
static bool IsTDI() { return false; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
// we don't store the active child in m_currentChild so override this
|
|
|
|
// function to find it dynamically
|
|
|
|
virtual wxMDIChildFrame *GetActiveChild() const;
|
2005-01-21 13:15:42 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void Cascade();
|
2005-03-21 07:27:49 -05:00
|
|
|
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void ArrangeIcons();
|
|
|
|
virtual void ActivateNext();
|
|
|
|
virtual void ActivatePrevious();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
#if wxUSE_MENUS
|
|
|
|
virtual void SetWindowMenu(wxMenu* menu);
|
|
|
|
|
|
|
|
virtual void DoMenuUpdates(wxMenu* menu = NULL);
|
2009-01-26 18:18:47 -05:00
|
|
|
|
|
|
|
// return the active child menu, if any
|
|
|
|
virtual WXHMENU MSWGetActiveMenu() const;
|
2008-11-03 21:46:19 -05:00
|
|
|
#endif // wxUSE_MENUS
|
2008-09-04 08:47:53 -04:00
|
|
|
|
2009-01-26 18:18:47 -05:00
|
|
|
|
2008-09-04 08:47:53 -04:00
|
|
|
// implementation only from now on
|
|
|
|
|
|
|
|
// MDI helpers
|
|
|
|
// -----------
|
|
|
|
|
2009-01-26 18:38:08 -05:00
|
|
|
#if wxUSE_MENUS
|
2008-09-04 08:47:53 -04:00
|
|
|
// called by wxMDIChildFrame after it was successfully created
|
|
|
|
virtual void AddMDIChild(wxMDIChildFrame *child);
|
|
|
|
|
|
|
|
// called by wxMDIChildFrame just before it is destroyed
|
|
|
|
virtual void RemoveMDIChild(wxMDIChildFrame *child);
|
2009-01-26 18:38:08 -05:00
|
|
|
#endif // wxUSE_MENUS
|
2008-09-04 08:47:53 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// handlers
|
|
|
|
// --------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
void OnSize(wxSizeEvent& event);
|
2005-08-11 09:24:56 -04:00
|
|
|
void OnIconized(wxIconizeEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
bool HandleActivate(int state, bool minimized, WXHWND activate);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// override window proc for MDI-specific message processing
|
2004-02-25 05:45:02 -05:00
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2004-02-25 05:45:02 -05:00
|
|
|
virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual bool MSWTranslateMessage(WXMSG* msg);
|
1999-05-09 20:42:57 -04:00
|
|
|
|
2009-01-26 18:18:47 -05:00
|
|
|
#if wxUSE_MENUS
|
2007-05-18 13:03:38 -04:00
|
|
|
// override wxFrameBase function to also look in the active child menu bar
|
2009-01-28 04:14:07 -05:00
|
|
|
// and the "Window" menu
|
|
|
|
virtual wxMenuItem *FindItemInMenuBar(int menuId) const;
|
2009-01-26 18:18:47 -05:00
|
|
|
#endif // wxUSE_MENUS
|
2007-05-18 13:03:38 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
protected:
|
2009-02-26 10:24:03 -05:00
|
|
|
// override to pass menu/toolbar events to the active child first
|
2009-02-26 11:16:31 -05:00
|
|
|
virtual bool TryBefore(wxEvent& event);
|
2009-02-26 10:24:03 -05:00
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if wxUSE_MENUS_NATIVE
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual void InternalSetMenuBar();
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_MENUS_NATIVE
|
1999-05-18 20:53:27 -04:00
|
|
|
|
2001-09-23 20:34:14 -04:00
|
|
|
virtual WXHICON GetDefaultIcon() const;
|
|
|
|
|
2005-08-11 09:24:56 -04:00
|
|
|
// set the size of the MDI client window to match the frame size
|
|
|
|
void UpdateClientSize();
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
private:
|
2009-01-26 18:18:47 -05:00
|
|
|
#if wxUSE_MENUS
|
2009-01-27 11:47:41 -05:00
|
|
|
// "Window" menu commands event handlers
|
|
|
|
void OnMDICommand(wxCommandEvent& event);
|
|
|
|
void OnMDIChild(wxCommandEvent& event);
|
|
|
|
|
|
|
|
|
2008-09-04 08:47:53 -04:00
|
|
|
// add/remove window menu if we have it (i.e. m_windowMenu != NULL)
|
|
|
|
void AddWindowMenu();
|
|
|
|
void RemoveWindowMenu();
|
|
|
|
|
2009-01-26 18:18:47 -05:00
|
|
|
// update the window menu (if we have it) to enable or disable the commands
|
|
|
|
// which only make sense when we have more than one child
|
|
|
|
void UpdateWindowMenu(bool enable);
|
2009-01-27 11:47:41 -05:00
|
|
|
|
|
|
|
#if wxUSE_ACCEL
|
|
|
|
wxAcceleratorTable *m_accelWindowMenu;
|
|
|
|
#endif // wxUSE_ACCEL
|
2009-01-26 18:18:47 -05:00
|
|
|
#endif // wxUSE_MENUS
|
|
|
|
|
2008-09-04 08:47:53 -04:00
|
|
|
// return the number of child frames we currently have (maybe 0)
|
|
|
|
int GetChildFramesCount() const;
|
|
|
|
|
2009-01-26 18:18:47 -05:00
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
1999-05-13 17:21:04 -04:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2001-09-23 20:34:14 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxMDIParentFrame);
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIChildFrame
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-05-13 17:21:04 -04:00
|
|
|
public:
|
2000-07-15 15:51:35 -04:00
|
|
|
wxMDIChildFrame() { Init(); }
|
1999-05-13 17:21:04 -04:00
|
|
|
wxMDIChildFrame(wxMDIParentFrame *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr)
|
|
|
|
{
|
2000-07-15 15:51:35 -04:00
|
|
|
Init();
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxMDIParentFrame *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr);
|
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
virtual ~wxMDIChildFrame();
|
2000-02-24 18:33:15 -05:00
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
// implement MDI operations
|
|
|
|
virtual void Activate();
|
|
|
|
|
|
|
|
// Override some frame operations too
|
2004-08-30 06:18:55 -04:00
|
|
|
virtual void Maximize(bool maximize = true);
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void Restore();
|
2008-11-03 21:46:19 -05:00
|
|
|
|
|
|
|
virtual bool Show(bool show = true);
|
1999-05-13 17:21:04 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// Implementation only from now on
|
|
|
|
// -------------------------------
|
1999-05-13 17:21:04 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// Handlers
|
1999-05-18 20:53:27 -04:00
|
|
|
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
|
|
|
|
bool HandleWindowPosChanging(void *lpPos);
|
2001-06-15 21:36:35 -04:00
|
|
|
bool HandleGetMinMaxInfo(void *mmInfo);
|
1999-05-18 20:53:27 -04:00
|
|
|
|
2004-02-25 05:45:02 -05:00
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual bool MSWTranslateMessage(WXMSG *msg);
|
|
|
|
|
|
|
|
virtual void MSWDestroyWindow();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
bool ResetWindowStyle(void *vrect);
|
1999-05-09 20:42:57 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
void OnIdle(wxIdleEvent& event);
|
2005-01-21 13:15:42 -05:00
|
|
|
|
1999-05-09 20:42:57 -04:00
|
|
|
protected:
|
2007-01-07 11:42:00 -05:00
|
|
|
virtual void DoGetScreenPosition(int *x, int *y) const;
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void DoSetClientSize(int width, int height);
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual void InternalSetMenuBar();
|
2004-08-30 06:18:55 -04:00
|
|
|
virtual bool IsMDIChild() const { return true; }
|
2006-02-08 16:47:09 -05:00
|
|
|
virtual void DetachMenuBar();
|
2000-02-24 18:33:15 -05:00
|
|
|
|
2001-09-23 20:34:14 -04:00
|
|
|
virtual WXHICON GetDefaultIcon() const;
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
private:
|
2004-09-29 17:07:48 -04:00
|
|
|
bool m_needsInitialShow; // Show must be called in idle time after Creation
|
2000-07-15 15:51:35 -04:00
|
|
|
bool m_needsResize; // flag which tells us to artificially resize the frame
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIClientWindow
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-05-18 20:53:27 -04:00
|
|
|
wxMDIClientWindow() { Init(); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Note: this is virtual, to allow overridden behaviour.
|
|
|
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
|
|
|
long style = wxVSCROLL | wxHSCROLL);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Explicitly call default scroll behaviour
|
|
|
|
void OnScroll(wxScrollEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2006-02-08 16:47:09 -05:00
|
|
|
protected:
|
2000-02-25 10:16:39 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2006-02-08 16:47:09 -05:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
void Init() { m_scrollX = m_scrollY = 0; }
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
int m_scrollX, m_scrollY;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
2008-11-03 21:46:19 -05:00
|
|
|
#endif // _WX_MSW_MDI_H_
|