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
|
1999-05-13 17:21:04 -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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-05-13 17:21:04 -04:00
|
|
|
#pragma interface "mdi.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/frame.h"
|
|
|
|
|
1999-04-19 13:47:19 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
|
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxMDIClientWindow;
|
|
|
|
class WXDLLEXPORT wxMDIChildFrame;
|
|
|
|
|
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
|
|
|
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-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
|
|
|
|
2000-02-01 10:48:44 -05:00
|
|
|
// WXHMENU GetWindowHMENU() const { return m_windowMenu; }
|
|
|
|
wxMenu* GetWindowMenu() const { return m_windowMenu; };
|
|
|
|
void SetWindowMenu(wxMenu* menu) ;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// MDI operations
|
|
|
|
// --------------
|
|
|
|
virtual void Cascade();
|
|
|
|
virtual void Tile();
|
|
|
|
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);
|
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
|
|
|
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
|
|
|
|
virtual bool MSWTranslateMessage(WXMSG* msg);
|
1999-05-09 20:42:57 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
protected:
|
1999-05-18 20:53:27 -04:00
|
|
|
virtual void InternalSetMenuBar();
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
wxMDIClientWindow * m_clientWindow;
|
|
|
|
wxMDIChildFrame * m_currentChild;
|
2000-02-01 10:48:44 -05:00
|
|
|
// WXHMENU m_windowMenu;
|
|
|
|
wxMenu* m_windowMenu;
|
1999-05-13 17:21:04 -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:
|
|
|
|
friend class WXDLLEXPORT wxMDIChildFrame;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
~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);
|
|
|
|
|
1999-11-05 10:54:10 -05: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
|
1999-07-16 19:06:35 -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);
|
|
|
|
|
|
|
|
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 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);
|
|
|
|
|
1999-05-09 20:42:57 -04:00
|
|
|
protected:
|
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();
|
2000-11-25 18:13:29 -05:00
|
|
|
virtual bool IsMDIChild() const { return TRUE; }
|
2000-02-24 18:33:15 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_needsResize; // flag which tells us to artificially resize the frame
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2000-02-24 18:33:15 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(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
|
|
|
|
2000-02-25 10:16:39 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
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()
|
2000-07-15 15:51:35 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_MDI_H_
|