]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
Some manual updates; in MDI sample, child frames now have default size/position ...
[wxWidgets.git] / include / wx / msw / mdi.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.h
3// Purpose: MDI (Multiple Document Interface) classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __MDIH__
13#define __MDIH__
14
15#ifdef __GNUG__
16#pragma interface "mdi.h"
17#endif
18
19#include "wx/frame.h"
20
21WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
22WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
23
24class WXDLLEXPORT wxMDIClientWindow;
25class WXDLLEXPORT wxMDIChildFrame;
26
27class WXDLLEXPORT wxMDIParentFrame: public wxFrame
28{
29 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
30
31 friend class WXDLLEXPORT wxMDIChildFrame;
32 public:
33
34 wxMDIParentFrame(void);
35 inline wxMDIParentFrame(wxWindow *parent,
debe6624 36 wxWindowID id,
2bda0e17
KB
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
debe6624 40 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
2bda0e17
KB
41 const wxString& name = wxFrameNameStr)
42 {
43 Create(parent, id, title, pos, size, style, name);
44 }
45
46 ~wxMDIParentFrame(void);
47
48 bool Create(wxWindow *parent,
debe6624 49 wxWindowID id,
2bda0e17
KB
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
debe6624 53 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
2bda0e17
KB
54 const wxString& name = wxFrameNameStr);
55
debe6624 56/*
2bda0e17
KB
57#if WXWIN_COMPATIBILITY
58 virtual void OldOnActivate(bool flag);
59 virtual void OldOnSize(int x, int y);
60#endif
debe6624 61*/
2bda0e17
KB
62
63 void OnSize(wxSizeEvent& event);
64 void OnActivate(wxActivateEvent& event);
65
2bda0e17
KB
66 void SetMenuBar(wxMenuBar *menu_bar);
67
68 // Gets the size available for subwindows after menu size, toolbar size
69 // and status bar size have been subtracted. If you want to manage your own
70 // toolbar(s), don't call SetToolBar.
71 void GetClientSize(int *width, int *height) const;
72
73 // Get the active MDI child window (Windows only)
74 wxMDIChildFrame *GetActiveChild(void) const ;
75
76 // Get the client window
77 inline wxMDIClientWindow *GetClientWindow(void) const ;
78
79 // Create the client window class (don't Create the window,
80 // just return a new class)
81 virtual wxMDIClientWindow *OnCreateClient(void) ;
82
83 inline WXHMENU GetWindowMenu(void) const ;
84
85 // MDI operations
86 virtual void Cascade(void);
87 virtual void Tile(void);
88 virtual void ArrangeIcons(void);
89 virtual void ActivateNext(void);
90 virtual void ActivatePrevious(void);
91
92 // Handlers
debe6624
JS
93 void MSWOnSize(int x, int y, WXUINT flag);
94 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
95 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
2bda0e17
KB
96 bool MSWProcessMessage(WXMSG *msg);
97 void MSWOnCreate(WXLPCREATESTRUCT cs);
98 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
debe6624 99 bool MSWOnEraseBkgnd(WXHDC pDC);
2bda0e17 100 bool MSWOnDestroy(void);
debe6624 101 bool MSWOnActivate(int state, bool minimized, WXHWND activate);
2bda0e17
KB
102
103 // Responds to colour changes
104 void OnSysColourChanged(wxSysColourChangedEvent& event);
105
106 protected:
107 wxMDIClientWindow * m_clientWindow;
108 wxMDIChildFrame * m_currentChild;
109 WXHMENU m_windowMenu;
110 bool m_parentFrameActive; // TRUE if MDI Frame is intercepting
111 // commands, not child
2bda0e17
KB
112DECLARE_EVENT_TABLE()
113};
114
115// Inlines
116inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
117inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
118
119class WXDLLEXPORT wxMDIChildFrame: public wxFrame
120{
121 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
122 public:
123
124 wxMDIChildFrame(void);
125 inline wxMDIChildFrame(wxMDIParentFrame *parent,
debe6624 126 wxWindowID id,
2bda0e17
KB
127 const wxString& title,
128 const wxPoint& pos = wxDefaultPosition,
129 const wxSize& size = wxDefaultSize,
debe6624 130 long style = wxDEFAULT_FRAME_STYLE,
2bda0e17
KB
131 const wxString& name = wxFrameNameStr)
132 {
133 Create(parent, id, title, pos, size, style, name);
134 }
135
136 ~wxMDIChildFrame(void);
137
138 bool Create(wxMDIParentFrame *parent,
debe6624 139 wxWindowID id,
2bda0e17
KB
140 const wxString& title,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
debe6624 143 long style = wxDEFAULT_FRAME_STYLE,
2bda0e17
KB
144 const wxString& name = wxFrameNameStr);
145
146 // Set menu bar
147 void SetMenuBar(wxMenuBar *menu_bar);
debe6624 148 void SetClientSize(int width, int height);
2bda0e17
KB
149 void GetPosition(int *x, int *y) const ;
150
151 // MDI operations
152 virtual void Maximize(void);
153 virtual void Restore(void);
154 virtual void Activate(void);
155
156 // Handlers
157
debe6624
JS
158 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
159 void MSWOnSize(int x, int y, WXUINT);
2bda0e17 160 void MSWOnWindowPosChanging(void *lpPos);
debe6624 161 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
2bda0e17
KB
162 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
163 bool MSWProcessMessage(WXMSG *msg);
164 void MSWDestroyWindow(void);
165
166 // Implementation
167 bool ResetWindowStyle(void *vrect);
168 protected:
169// bool m_active;
170};
171
172class WXDLLEXPORT wxMDIClientWindow: public wxWindow
173{
174 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
175 public:
176
177 wxMDIClientWindow(void) ;
debe6624 178 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
2bda0e17
KB
179 {
180 CreateClient(parent, style);
181 }
182
183 ~wxMDIClientWindow(void);
184
185 // Note: this is virtual, to allow overridden behaviour.
debe6624 186 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
2bda0e17
KB
187
188 // Explicitly call default scroll behaviour
189 void OnScroll(wxScrollEvent& event);
190
191 // Window procedure
192 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
193
194 // Calls an appropriate default window procedure
195 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
196
197 // Should hand the message to the default proc
debe6624 198 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
2bda0e17
KB
199
200protected:
201 int m_scrollX;
202 int m_scrollY;
203DECLARE_EVENT_TABLE()
204};
205
206#endif
207 // __MDIH__