]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/mdi.h
Fix wxOSX warnings about int-to-void* casts.
[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 // Copyright: (c) David Webster
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_MDI_H_
14 #define _WX_MDI_H_
15
16 #include "wx/frame.h"
17
18 class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
19 class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
20
21 class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
22 {
23 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
24
25 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
26 public:
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
40 virtual ~wxMDIParentFrame();
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
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
63 wxMenu* GetWindowMenu() const { return m_windowMenu; }
64 // void SetWindowMenu(wxMwnu* pMenu);
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
91 protected:
92 virtual void InternalSetMenuBar();
93
94 wxMDIClientWindow * m_clientWindow;
95 wxMDIChildFrame * m_currentChild;
96 wxMenu* m_windowMenu;
97
98 // TRUE if MDI Frame is intercepting commands, not child
99 bool m_parentFrameActive;
100
101 private:
102 DECLARE_EVENT_TABLE()
103 };
104
105 class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
106 {
107 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
108 public:
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 virtual ~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
153 protected:
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
166 class WXDLLIMPEXP_CORE 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
187 protected:
188 void Init() { m_scrollX = m_scrollY = 0; }
189
190 int m_scrollX, m_scrollY;
191
192 private:
193 DECLARE_EVENT_TABLE()
194 };
195
196 #endif
197 // _WX_MDI_H_