]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/mdi.h
added #define wxToolBar wxToolBarGTK for wxGTK
[wxWidgets.git] / include / wx / msw / mdi.h
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
21 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
22 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
23
24 class WXDLLEXPORT wxMDIClientWindow;
25 class WXDLLEXPORT wxMDIChildFrame;
26
27 class 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,
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(void);
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 /*
57 #if WXWIN_COMPATIBILITY
58 virtual void OldOnActivate(bool flag);
59 virtual void OldOnSize(int x, int y);
60 #endif
61 */
62
63 void OnSize(wxSizeEvent& event);
64 void OnActivate(wxActivateEvent& event);
65
66 // Toolbar (currently, for use by Windows MDI parent frames ONLY)
67 virtual inline void SetToolBar(wxWindow *toolbar) { m_frameToolBar = toolbar; }
68 virtual inline wxWindow *GetToolBar(void) const { return m_frameToolBar; }
69
70 void SetMenuBar(wxMenuBar *menu_bar);
71
72 // Gets the size available for subwindows after menu size, toolbar size
73 // and status bar size have been subtracted. If you want to manage your own
74 // toolbar(s), don't call SetToolBar.
75 void GetClientSize(int *width, int *height) const;
76
77 // Get the active MDI child window (Windows only)
78 wxMDIChildFrame *GetActiveChild(void) const ;
79
80 // Get the client window
81 inline wxMDIClientWindow *GetClientWindow(void) const ;
82
83 // Create the client window class (don't Create the window,
84 // just return a new class)
85 virtual wxMDIClientWindow *OnCreateClient(void) ;
86
87 inline WXHMENU GetWindowMenu(void) const ;
88
89 // MDI operations
90 virtual void Cascade(void);
91 virtual void Tile(void);
92 virtual void ArrangeIcons(void);
93 virtual void ActivateNext(void);
94 virtual void ActivatePrevious(void);
95
96 // Handlers
97 void MSWOnSize(int x, int y, WXUINT flag);
98 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
99 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
100 bool MSWProcessMessage(WXMSG *msg);
101 void MSWOnCreate(WXLPCREATESTRUCT cs);
102 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
103 bool MSWOnEraseBkgnd(WXHDC pDC);
104 bool MSWOnDestroy(void);
105 bool MSWOnActivate(int state, bool minimized, WXHWND activate);
106
107 // Responds to colour changes
108 void OnSysColourChanged(wxSysColourChangedEvent& event);
109
110 protected:
111 wxMDIClientWindow * m_clientWindow;
112 wxMDIChildFrame * m_currentChild;
113 WXHMENU m_windowMenu;
114 bool m_parentFrameActive; // TRUE if MDI Frame is intercepting
115 // commands, not child
116 wxWindow * m_frameToolBar ;
117 DECLARE_EVENT_TABLE()
118 };
119
120 // Inlines
121 inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
122 inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
123
124 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
125 {
126 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
127 public:
128
129 wxMDIChildFrame(void);
130 inline wxMDIChildFrame(wxMDIParentFrame *parent,
131 wxWindowID id,
132 const wxString& title,
133 const wxPoint& pos = wxDefaultPosition,
134 const wxSize& size = wxDefaultSize,
135 long style = wxDEFAULT_FRAME_STYLE,
136 const wxString& name = wxFrameNameStr)
137 {
138 Create(parent, id, title, pos, size, style, name);
139 }
140
141 ~wxMDIChildFrame(void);
142
143 bool Create(wxMDIParentFrame *parent,
144 wxWindowID id,
145 const wxString& title,
146 const wxPoint& pos = wxDefaultPosition,
147 const wxSize& size = wxDefaultSize,
148 long style = wxDEFAULT_FRAME_STYLE,
149 const wxString& name = wxFrameNameStr);
150
151 // Set menu bar
152 void SetMenuBar(wxMenuBar *menu_bar);
153 void SetClientSize(int width, int height);
154 void GetPosition(int *x, int *y) const ;
155
156 // MDI operations
157 virtual void Maximize(void);
158 virtual void Restore(void);
159 virtual void Activate(void);
160
161 // Handlers
162
163 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
164 void MSWOnSize(int x, int y, WXUINT);
165 void MSWOnWindowPosChanging(void *lpPos);
166 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
167 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
168 bool MSWProcessMessage(WXMSG *msg);
169 void MSWDestroyWindow(void);
170
171 // Implementation
172 bool ResetWindowStyle(void *vrect);
173 protected:
174 // bool m_active;
175 };
176
177 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
178 {
179 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
180 public:
181
182 wxMDIClientWindow(void) ;
183 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
184 {
185 CreateClient(parent, style);
186 }
187
188 ~wxMDIClientWindow(void);
189
190 // Note: this is virtual, to allow overridden behaviour.
191 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
192
193 // Explicitly call default scroll behaviour
194 void OnScroll(wxScrollEvent& event);
195
196 // Window procedure
197 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
198
199 // Calls an appropriate default window procedure
200 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
201
202 // Should hand the message to the default proc
203 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
204
205 protected:
206 int m_scrollX;
207 int m_scrollY;
208 DECLARE_EVENT_TABLE()
209 };
210
211 #endif
212 // __MDIH__