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
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_MDI_H_
|
|
|
|
#define _WX_MDI_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#include "wx/frame.h"
|
|
|
|
|
2007-11-12 16:37:46 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const char) wxStatusLineNameStr[];
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIParentFrame
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxMDIParentFrame : public wxFrame
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-05-13 17:21:04 -04:00
|
|
|
public:
|
|
|
|
wxMDIParentFrame();
|
|
|
|
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);
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
|
|
|
|
// Get the active MDI child window (Windows only)
|
1999-05-18 20:53:27 -04:00
|
|
|
wxMDIChildFrame *GetActiveChild() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Get the client window
|
|
|
|
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Create the client window class (don't Create the window,
|
|
|
|
// just return a new class)
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual wxMDIClientWindow *OnCreateClient(void);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-01-12 20:26:04 -05:00
|
|
|
// MDI windows menu
|
2007-04-14 05:58:37 -04:00
|
|
|
wxMenu* GetWindowMenu() const { return m_windowMenu; }
|
2000-02-01 10:48:44 -05:00
|
|
|
void SetWindowMenu(wxMenu* menu) ;
|
2004-09-01 05:16:21 -04:00
|
|
|
virtual void DoMenuUpdates(wxMenu* menu = NULL);
|
2005-01-21 13:15:42 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// MDI operations
|
|
|
|
// --------------
|
|
|
|
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
|
|
|
|
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);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
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
|
|
|
|
2007-05-18 13:03:38 -04:00
|
|
|
// override wxFrameBase function to also look in the active child menu bar
|
|
|
|
virtual const wxMenuItem *FindItemInMenuBar(int menuId) const;
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
protected:
|
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();
|
|
|
|
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
wxMDIClientWindow * m_clientWindow;
|
|
|
|
wxMDIChildFrame * m_currentChild;
|
2000-02-01 10:48:44 -05:00
|
|
|
wxMenu* m_windowMenu;
|
1999-05-13 17:21:04 -04:00
|
|
|
|
2004-08-30 06:18:55 -04:00
|
|
|
// true if MDI Frame is intercepting commands, not child
|
1999-05-18 20:53:27 -04:00
|
|
|
bool m_parentFrameActive;
|
1999-05-13 17:21:04 -04:00
|
|
|
|
|
|
|
private:
|
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)
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_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
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
class WXDLLEXPORT wxMDIChildFrame : public wxFrame
|
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);
|
|
|
|
}
|
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxMDIChildFrame();
|
1999-05-13 17:21:04 -04:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2004-08-30 06:18:55 -04:00
|
|
|
virtual bool IsTopLevel() const { return false; }
|
2000-02-24 18:33:15 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// MDI operations
|
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();
|
|
|
|
virtual void Activate();
|
|
|
|
|
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);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
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
|
|
|
|
2004-09-29 17:07:48 -04:00
|
|
|
virtual bool Show(bool show = true);
|
2000-07-15 15:51:35 -04: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
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
class WXDLLEXPORT wxMDIClientWindow : public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
1999-05-18 20:53:27 -04:00
|
|
|
wxMDIClientWindow() { Init(); }
|
1999-05-13 17:21:04 -04:00
|
|
|
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
|
|
|
{
|
1999-05-18 20:53:27 -04:00
|
|
|
Init();
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
CreateClient(parent, style);
|
|
|
|
}
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_MDI_H_
|