]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
Added OnEraseBackground to wxNotebook on wxMSW to avoid black background;
[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$
bbcdf8bc
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_MDI_H_
13#define _WX_MDI_H_
2bda0e17
KB
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 96 bool MSWProcessMessage(WXMSG *msg);
57a7b7c1 97 bool MSWTranslateMessage(WXMSG *msg);
2bda0e17
KB
98 void MSWOnCreate(WXLPCREATESTRUCT cs);
99 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
debe6624 100 bool MSWOnEraseBkgnd(WXHDC pDC);
2bda0e17 101 bool MSWOnDestroy(void);
debe6624 102 bool MSWOnActivate(int state, bool minimized, WXHWND activate);
2bda0e17
KB
103
104 // Responds to colour changes
105 void OnSysColourChanged(wxSysColourChangedEvent& event);
106
107 protected:
108 wxMDIClientWindow * m_clientWindow;
109 wxMDIChildFrame * m_currentChild;
110 WXHMENU m_windowMenu;
111 bool m_parentFrameActive; // TRUE if MDI Frame is intercepting
112 // commands, not child
2bda0e17
KB
113DECLARE_EVENT_TABLE()
114};
115
116// Inlines
117inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
118inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
119
120class WXDLLEXPORT wxMDIChildFrame: public wxFrame
121{
122 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
123 public:
124
125 wxMDIChildFrame(void);
126 inline wxMDIChildFrame(wxMDIParentFrame *parent,
debe6624 127 wxWindowID id,
2bda0e17
KB
128 const wxString& title,
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize,
debe6624 131 long style = wxDEFAULT_FRAME_STYLE,
2bda0e17
KB
132 const wxString& name = wxFrameNameStr)
133 {
134 Create(parent, id, title, pos, size, style, name);
135 }
136
137 ~wxMDIChildFrame(void);
138
139 bool Create(wxMDIParentFrame *parent,
debe6624 140 wxWindowID id,
2bda0e17
KB
141 const wxString& title,
142 const wxPoint& pos = wxDefaultPosition,
143 const wxSize& size = wxDefaultSize,
debe6624 144 long style = wxDEFAULT_FRAME_STYLE,
2bda0e17
KB
145 const wxString& name = wxFrameNameStr);
146
147 // Set menu bar
148 void SetMenuBar(wxMenuBar *menu_bar);
debe6624 149 void SetClientSize(int width, int height);
2bda0e17
KB
150 void GetPosition(int *x, int *y) const ;
151
152 // MDI operations
153 virtual void Maximize(void);
154 virtual void Restore(void);
155 virtual void Activate(void);
156
157 // Handlers
158
debe6624
JS
159 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
160 void MSWOnSize(int x, int y, WXUINT);
2bda0e17 161 void MSWOnWindowPosChanging(void *lpPos);
debe6624 162 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
2bda0e17
KB
163 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
164 bool MSWProcessMessage(WXMSG *msg);
57a7b7c1 165 bool MSWTranslateMessage(WXMSG *msg);
2bda0e17
KB
166 void MSWDestroyWindow(void);
167
168 // Implementation
169 bool ResetWindowStyle(void *vrect);
170 protected:
171// bool m_active;
172};
173
174class WXDLLEXPORT wxMDIClientWindow: public wxWindow
175{
176 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
177 public:
178
179 wxMDIClientWindow(void) ;
debe6624 180 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
2bda0e17
KB
181 {
182 CreateClient(parent, style);
183 }
184
185 ~wxMDIClientWindow(void);
186
187 // Note: this is virtual, to allow overridden behaviour.
debe6624 188 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
2bda0e17
KB
189
190 // Explicitly call default scroll behaviour
191 void OnScroll(wxScrollEvent& event);
192
193 // Window procedure
194 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
195
196 // Calls an appropriate default window procedure
197 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
198
199 // Should hand the message to the default proc
debe6624 200 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
2bda0e17
KB
201
202protected:
203 int m_scrollX;
204 int m_scrollY;
205DECLARE_EVENT_TABLE()
206};
207
208#endif
bbcdf8bc 209 // _WX_MDI_H_