1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/os2/mdi.h
// Purpose: MDI (Multiple Document Interface) classes.
// This doesn't have to be implemented just like Windows,
// it could be a tabbed design as in wxGTK.
// Author: David Webster
// Modified by:
// Created: 10/10/99
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MDI_H_
#define _WX_MDI_H_
#include "wx/frame.h"
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
{
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
public:
wxMDIParentFrame();
inline wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
const wxString& name = wxFrameNameStr)
{
Create(parent, id, title, pos, size, style, name);
}
virtual ~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)
wxMDIChildFrame *GetActiveChild() const;
// Get the client window
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
// Create the client window class (don't Create the window,
// just return a new class)
virtual wxMDIClientWindow *OnCreateClient(void);
wxMenu* GetWindowMenu() const { return m_windowMenu; }
// void SetWindowMenu(wxMwnu* pMenu);
// MDI operations
// --------------
virtual void Cascade();
virtual void Tile();
virtual void ArrangeIcons();
virtual void ActivateNext();
virtual void ActivatePrevious();
// handlers
// --------
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnSize(wxSizeEvent& event);
bool HandleActivate(int state, bool minimized, WXHWND activate);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
// override window proc for MDI-specific message processing
virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual MRESULT OS2DefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
virtual bool OS2TranslateMessage(WXMSG* msg);
protected:
virtual void InternalSetMenuBar();
wxMDIClientWindow * m_clientWindow;
wxMDIChildFrame * m_currentChild;
wxMenu* m_windowMenu;
// TRUE if MDI Frame is intercepting commands, not child
bool m_parentFrameActive;
private:
DECLARE_EVENT_TABLE()
};
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
{
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
public:
wxMDIChildFrame();
inline 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);
}
virtual ~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
virtual void Maximize(bool maximize = TRUE);
virtual void Restore();
virtual void Activate();
// Handlers
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 MRESULT OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual MRESULT OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual bool OS2TranslateMessage(WXMSG *msg);
virtual void OS2DestroyWindow();
// Implementation
bool ResetWindowStyle(void *vrect);
protected:
virtual void DoGetPosition(int *x, int *y) const;
virtual void DoSetClientSize(int width, int height);
virtual void InternalSetMenuBar();
};
/* The client window is a child of the parent MDI frame, and itself
* contains the child MDI frames.
* However, you create the MDI children as children of the MDI parent:
* only in the implementation does the client window become the parent
* of the children. Phew! So the children are sort of 'adopted'...
*/
class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
{
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
public:
wxMDIClientWindow() { Init(); }
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
{
Init();
CreateClient(parent, style);
}
// Note: this is virtual, to allow overridden behaviour.
virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL);
// Explicitly call default scroll behaviour
void OnScroll(wxScrollEvent& event);
protected:
void Init() { m_scrollX = m_scrollY = 0; }
int m_scrollX, m_scrollY;
private:
DECLARE_EVENT_TABLE()
};
#endif
// _WX_MDI_H_
|