]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/mdi.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / os2 / mdi.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/os2/mdi.h
0e320a79
DW
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
75f11ad7 9// Copyright: (c) David Webster
65571936 10// Licence: wxWindows licence
0e320a79
DW
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_MDI_H_
14#define _WX_MDI_H_
15
0e320a79
DW
16#include "wx/frame.h"
17
b5dbe15d
VS
18class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
19class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
0e320a79 20
53a2db12 21class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
0e320a79
DW
22{
23DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
24
b5dbe15d 25 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
0e320a79
DW
26public:
27
28 wxMDIParentFrame();
29 inline wxMDIParentFrame(wxWindow *parent,
30 wxWindowID id,
31 const wxString& title,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
35 const wxString& name = wxFrameNameStr)
36 {
37 Create(parent, id, title, pos, size, style, name);
38 }
39
d3c7fc99 40 virtual ~wxMDIParentFrame();
0e320a79
DW
41
42 bool Create(wxWindow *parent,
43 wxWindowID id,
44 const wxString& title,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
48 const wxString& name = wxFrameNameStr);
49
75f11ad7
DW
50 // accessors
51 // ---------
52
53 // Get the active MDI child window (Windows only)
54 wxMDIChildFrame *GetActiveChild() const;
55
56 // Get the client window
57 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
58
59 // Create the client window class (don't Create the window,
60 // just return a new class)
61 virtual wxMDIClientWindow *OnCreateClient(void);
62
289b2951
DW
63 wxMenu* GetWindowMenu() const { return m_windowMenu; }
64// void SetWindowMenu(wxMwnu* pMenu);
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;
289b2951 96 wxMenu* 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
53a2db12 105class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
0e320a79
DW
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
d3c7fc99 122 virtual ~wxMDIChildFrame();
0e320a79
DW
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
53a2db12 166class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
0e320a79
DW
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_