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