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