]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/os2/mdi.h
Committing in .
[wxWidgets.git] / include / wx / os2 / mdi.h
... / ...
CommitLineData
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.
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
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
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; }
65
66 // MDI operations
67 // --------------
68 virtual void Cascade();
69 virtual void Tile();
70 virtual void ArrangeIcons();
71 virtual void ActivateNext();
72 virtual void ActivatePrevious();
73
74 // handlers
75 // --------
76
77 // Responds to colour changes
78 void OnSysColourChanged(wxSysColourChangedEvent& event);
79
80 void OnSize(wxSizeEvent& event);
81
82 bool HandleActivate(int state, bool minimized, WXHWND activate);
83 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
84
85 // override window proc for MDI-specific message processing
86 virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
87
88 virtual MRESULT OS2DefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
89 virtual bool OS2TranslateMessage(WXMSG* msg);
90
91protected:
92 virtual void InternalSetMenuBar();
93
94 wxMDIClientWindow * m_clientWindow;
95 wxMDIChildFrame * m_currentChild;
96 WXHMENU m_windowMenu;
97
98 // TRUE if MDI Frame is intercepting commands, not child
99 bool m_parentFrameActive;
100
101private:
102 DECLARE_EVENT_TABLE()
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
132 // MDI operations
133 virtual void Maximize(bool maximize = TRUE);
134 virtual void Restore();
135 virtual void Activate();
136
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
144 virtual MRESULT OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
145 virtual MRESULT OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
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();
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)
169
170 public:
171
172 wxMDIClientWindow() { Init(); }
173 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
174 {
175 Init();
176
177 CreateClient(parent, style);
178 }
179
180 // Note: this is virtual, to allow overridden behaviour.
181 virtual bool CreateClient(wxMDIParentFrame *parent,
182 long style = wxVSCROLL | wxHSCROLL);
183
184 // Explicitly call default scroll behaviour
185 void OnScroll(wxScrollEvent& event);
186
187protected:
188 void Init() { m_scrollX = m_scrollY = 0; }
189
190 int m_scrollX, m_scrollY;
191
192private:
193 DECLARE_EVENT_TABLE()
194};
195
196#endif
197 // _WX_MDI_H_