]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
don't pass NULL pointer to printf(), this crashes Solaris printf
[wxWidgets.git] / include / wx / msw / mdi.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
f6bcfd97 2// Name: wx/msw/mdi.h
2bda0e17
KB
3// Purpose: MDI (Multiple Document Interface) classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_MDI_H_
13#define _WX_MDI_H_
2bda0e17 14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
a23fd0e1 16 #pragma interface "mdi.h"
2bda0e17
KB
17#endif
18
19#include "wx/frame.h"
20
ef359b43
WS
21extern WXDLLEXPORT_DATA(const wxChar*) wxFrameNameStr;
22extern WXDLLEXPORT_DATA(const wxChar*) wxStatusLineNameStr;
2bda0e17
KB
23
24class WXDLLEXPORT wxMDIClientWindow;
25class WXDLLEXPORT wxMDIChildFrame;
26
a23fd0e1
VZ
27// ---------------------------------------------------------------------------
28// wxMDIParentFrame
29// ---------------------------------------------------------------------------
30
31class WXDLLEXPORT wxMDIParentFrame : public wxFrame
2bda0e17 32{
a23fd0e1
VZ
33public:
34 wxMDIParentFrame();
35 wxMDIParentFrame(wxWindow *parent,
36 wxWindowID id,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
41 const wxString& name = wxFrameNameStr)
42 {
43 Create(parent, id, title, pos, size, style, name);
44 }
45
46 ~wxMDIParentFrame();
47
48 bool Create(wxWindow *parent,
49 wxWindowID id,
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
54 const wxString& name = wxFrameNameStr);
55
56 // accessors
57 // ---------
58
a23fd0e1 59 // Get the active MDI child window (Windows only)
42e69d6b 60 wxMDIChildFrame *GetActiveChild() const;
2bda0e17 61
a23fd0e1
VZ
62 // Get the client window
63 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
2bda0e17 64
a23fd0e1
VZ
65 // Create the client window class (don't Create the window,
66 // just return a new class)
42e69d6b 67 virtual wxMDIClientWindow *OnCreateClient(void);
2bda0e17 68
4e152a23 69 // MDI windows menu
df61c009
JS
70 wxMenu* GetWindowMenu() const { return m_windowMenu; };
71 void SetWindowMenu(wxMenu* menu) ;
6aca4628 72 virtual void DoMenuUpdates(wxMenu* menu = NULL);
ef359b43 73
a23fd0e1
VZ
74 // MDI operations
75 // --------------
76 virtual void Cascade();
0d97c090 77 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
a23fd0e1
VZ
78 virtual void ArrangeIcons();
79 virtual void ActivateNext();
80 virtual void ActivatePrevious();
2bda0e17 81
a23fd0e1
VZ
82 // handlers
83 // --------
2bda0e17 84
a23fd0e1
VZ
85 // Responds to colour changes
86 void OnSysColourChanged(wxSysColourChangedEvent& event);
2bda0e17 87
a23fd0e1 88 void OnSize(wxSizeEvent& event);
6bbe97b7 89 void OnIconized(wxIconizeEvent& event);
2bda0e17 90
42e69d6b
VZ
91 bool HandleActivate(int state, bool minimized, WXHWND activate);
92 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
2bda0e17 93
a23fd0e1 94 // override window proc for MDI-specific message processing
c140b7e7 95 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
2bda0e17 96
c140b7e7 97 virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
a23fd0e1 98 virtual bool MSWTranslateMessage(WXMSG* msg);
cc2b7472 99
a23fd0e1 100protected:
1e6feb95 101#if wxUSE_MENUS_NATIVE
42e69d6b 102 virtual void InternalSetMenuBar();
1e6feb95 103#endif // wxUSE_MENUS_NATIVE
42e69d6b 104
82c9f85c
VZ
105 virtual WXHICON GetDefaultIcon() const;
106
6bbe97b7
VZ
107 // set the size of the MDI client window to match the frame size
108 void UpdateClientSize();
109
110
2bda0e17
KB
111 wxMDIClientWindow * m_clientWindow;
112 wxMDIChildFrame * m_currentChild;
df61c009 113 wxMenu* m_windowMenu;
a23fd0e1 114
598ddd96 115 // true if MDI Frame is intercepting commands, not child
42e69d6b 116 bool m_parentFrameActive;
a23fd0e1
VZ
117
118private:
119 friend class WXDLLEXPORT wxMDIChildFrame;
120
121 DECLARE_EVENT_TABLE()
82c9f85c 122 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
22f3361e 123 DECLARE_NO_COPY_CLASS(wxMDIParentFrame)
2bda0e17
KB
124};
125
a23fd0e1
VZ
126// ---------------------------------------------------------------------------
127// wxMDIChildFrame
128// ---------------------------------------------------------------------------
2bda0e17 129
a23fd0e1 130class WXDLLEXPORT wxMDIChildFrame : public wxFrame
2bda0e17 131{
a23fd0e1 132public:
f6bcfd97 133 wxMDIChildFrame() { Init(); }
a23fd0e1
VZ
134 wxMDIChildFrame(wxMDIParentFrame *parent,
135 wxWindowID id,
136 const wxString& title,
137 const wxPoint& pos = wxDefaultPosition,
138 const wxSize& size = wxDefaultSize,
139 long style = wxDEFAULT_FRAME_STYLE,
140 const wxString& name = wxFrameNameStr)
141 {
f6bcfd97
BP
142 Init();
143
a23fd0e1
VZ
144 Create(parent, id, title, pos, size, style, name);
145 }
146
147 ~wxMDIChildFrame();
148
149 bool Create(wxMDIParentFrame *parent,
150 wxWindowID id,
151 const wxString& title,
152 const wxPoint& pos = wxDefaultPosition,
153 const wxSize& size = wxDefaultSize,
154 long style = wxDEFAULT_FRAME_STYLE,
155 const wxString& name = wxFrameNameStr);
156
598ddd96 157 virtual bool IsTopLevel() const { return false; }
225fe9d6 158
a23fd0e1 159 // MDI operations
598ddd96 160 virtual void Maximize(bool maximize = true);
a23fd0e1
VZ
161 virtual void Restore();
162 virtual void Activate();
163
f6bcfd97
BP
164 // Implementation only from now on
165 // -------------------------------
a23fd0e1 166
f6bcfd97 167 // Handlers
42e69d6b 168 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
42e69d6b
VZ
169 bool HandleWindowPosChanging(void *lpPos);
170 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
3ebcfb76 171 bool HandleGetMinMaxInfo(void *mmInfo);
42e69d6b 172
c140b7e7
JS
173 virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
174 virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
42e69d6b
VZ
175 virtual bool MSWTranslateMessage(WXMSG *msg);
176
177 virtual void MSWDestroyWindow();
2bda0e17 178
2bda0e17 179 bool ResetWindowStyle(void *vrect);
cc2b7472 180
f6bcfd97 181 void OnIdle(wxIdleEvent& event);
ef359b43 182
2596e9fb 183 virtual bool Show(bool show = true);
f6bcfd97 184
cc2b7472 185protected:
42e69d6b 186 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 187 virtual void DoSetClientSize(int width, int height);
42e69d6b 188 virtual void InternalSetMenuBar();
598ddd96 189 virtual bool IsMDIChild() const { return true; }
225fe9d6 190
82c9f85c
VZ
191 virtual WXHICON GetDefaultIcon() const;
192
f6bcfd97
BP
193 // common part of all ctors
194 void Init();
195
196private:
2596e9fb 197 bool m_needsInitialShow; // Show must be called in idle time after Creation
f6bcfd97 198 bool m_needsResize; // flag which tells us to artificially resize the frame
6bbe97b7 199 virtual void DetachMenuBar() ;
f6bcfd97
BP
200
201 DECLARE_EVENT_TABLE()
fc7a2a60 202 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
2bda0e17
KB
203};
204
a23fd0e1
VZ
205// ---------------------------------------------------------------------------
206// wxMDIClientWindow
207// ---------------------------------------------------------------------------
2bda0e17 208
a23fd0e1
VZ
209class WXDLLEXPORT wxMDIClientWindow : public wxWindow
210{
a23fd0e1 211public:
42e69d6b 212 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
213 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
214 {
42e69d6b
VZ
215 Init();
216
a23fd0e1
VZ
217 CreateClient(parent, style);
218 }
2bda0e17 219
a23fd0e1
VZ
220 // Note: this is virtual, to allow overridden behaviour.
221 virtual bool CreateClient(wxMDIParentFrame *parent,
222 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 223
a23fd0e1
VZ
224 // Explicitly call default scroll behaviour
225 void OnScroll(wxScrollEvent& event);
2bda0e17 226
ec06b234
JS
227 virtual void DoSetSize(int x, int y,
228 int width, int height,
229 int sizeFlags = wxSIZE_AUTO);
2bda0e17 230protected:
42e69d6b
VZ
231 void Init() { m_scrollX = m_scrollY = 0; }
232
a23fd0e1
VZ
233 int m_scrollX, m_scrollY;
234
235private:
236 DECLARE_EVENT_TABLE()
fc7a2a60 237 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
2bda0e17
KB
238};
239
240#endif
bbcdf8bc 241 // _WX_MDI_H_