1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: mdi.h
|
|
|
|
// Purpose: MDI (Multiple Document Interface) classes
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-05-13 21:21:04 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_MDI_H_
|
|
|
|
#define _WX_MDI_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-05-13 21:21:04 +00:00
|
|
|
#pragma interface "mdi.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/frame.h"
|
|
|
|
|
1999-04-19 17:47:19 +00:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
|
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxMDIClientWindow;
|
|
|
|
class WXDLLEXPORT wxMDIChildFrame;
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIParentFrame
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxMDIParentFrame : public wxFrame
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-05-13 21:21:04 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxMDIParentFrame();
|
|
|
|
|
|
|
|
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-19 00:53:27 +00:00
|
|
|
wxMDIChildFrame *GetActiveChild() const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// Get the client window
|
|
|
|
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// Create the client window class (don't Create the window,
|
|
|
|
// just return a new class)
|
1999-05-19 00:53:27 +00:00
|
|
|
virtual wxMDIClientWindow *OnCreateClient(void);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
WXHMENU GetWindowMenu() const { return m_windowMenu; }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// MDI operations
|
|
|
|
// --------------
|
|
|
|
virtual void Cascade();
|
|
|
|
virtual void Tile();
|
|
|
|
virtual void ArrangeIcons();
|
|
|
|
virtual void ActivateNext();
|
|
|
|
virtual void ActivatePrevious();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// handlers
|
|
|
|
// --------
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
void OnSize(wxSizeEvent& event);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleActivate(int state, bool minimized, WXHWND activate);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// override window proc for MDI-specific message processing
|
|
|
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
|
|
|
|
virtual bool MSWTranslateMessage(WXMSG* msg);
|
1999-05-10 00:42:57 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
protected:
|
1999-05-19 00:53:27 +00:00
|
|
|
virtual void InternalSetMenuBar();
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
wxMDIClientWindow * m_clientWindow;
|
|
|
|
wxMDIChildFrame * m_currentChild;
|
|
|
|
WXHMENU m_windowMenu;
|
1999-05-13 21:21:04 +00:00
|
|
|
|
|
|
|
// TRUE if MDI Frame is intercepting commands, not child
|
1999-05-19 00:53:27 +00:00
|
|
|
bool m_parentFrameActive;
|
1999-05-13 21:21:04 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class WXDLLEXPORT wxMDIChildFrame;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIChildFrame
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
class WXDLLEXPORT wxMDIChildFrame : public wxFrame
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-05-13 21:21:04 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxMDIChildFrame();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxMDIChildFrame();
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
// MDI operations
|
1999-07-16 23:06:35 +00:00
|
|
|
virtual void Maximize(bool maximize = TRUE);
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual void Restore();
|
|
|
|
virtual void Activate();
|
|
|
|
|
|
|
|
// Handlers
|
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
|
|
|
|
bool HandleSize(int x, int y, WXUINT);
|
|
|
|
bool HandleWindowPosChanging(void *lpPos);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
|
|
|
|
|
|
|
virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
virtual bool MSWTranslateMessage(WXMSG *msg);
|
|
|
|
|
|
|
|
virtual void MSWDestroyWindow();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Implementation
|
|
|
|
bool ResetWindowStyle(void *vrect);
|
1999-05-10 00:42:57 +00:00
|
|
|
|
|
|
|
protected:
|
1999-05-19 00:53:27 +00:00
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual void DoSetClientSize(int width, int height);
|
1999-05-19 00:53:27 +00:00
|
|
|
virtual void InternalSetMenuBar();
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxMDIClientWindow
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
class WXDLLEXPORT wxMDIClientWindow : public wxWindow
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
public:
|
1999-05-19 00:53:27 +00:00
|
|
|
wxMDIClientWindow() { Init(); }
|
1999-05-13 21:21:04 +00:00
|
|
|
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
|
|
|
{
|
1999-05-19 00:53:27 +00:00
|
|
|
Init();
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
CreateClient(parent, style);
|
|
|
|
}
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// Note: this is virtual, to allow overridden behaviour.
|
|
|
|
virtual bool CreateClient(wxMDIParentFrame *parent,
|
|
|
|
long style = wxVSCROLL | wxHSCROLL);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// Explicitly call default scroll behaviour
|
|
|
|
void OnScroll(wxScrollEvent& event);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
protected:
|
1999-05-19 00:53:27 +00:00
|
|
|
void Init() { m_scrollX = m_scrollY = 0; }
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
int m_scrollX, m_scrollY;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_MDI_H_
|