]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/mdi.h
added more reserved functions
[wxWidgets.git] / include / wx / palmos / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/mdi.h
3 // Purpose: MDI (Multiple Document Interface) classes
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MDI_H_
13 #define _WX_MDI_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "mdi.h"
17 #endif
18
19 #include "wx/frame.h"
20
21 WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
22 WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
23
24 class WXDLLEXPORT wxMDIClientWindow;
25 class WXDLLEXPORT wxMDIChildFrame;
26
27 // ---------------------------------------------------------------------------
28 // wxMDIParentFrame
29 // ---------------------------------------------------------------------------
30
31 class WXDLLEXPORT wxMDIParentFrame : public wxFrame
32 {
33 public:
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
59 // Get the active MDI child window (Windows only)
60 wxMDIChildFrame *GetActiveChild() const;
61
62 // Get the client window
63 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
64
65 // Create the client window class (don't Create the window,
66 // just return a new class)
67 virtual wxMDIClientWindow *OnCreateClient(void);
68
69 // MDI windows menu
70 wxMenu* GetWindowMenu() const { return m_windowMenu; };
71 void SetWindowMenu(wxMenu* menu) ;
72
73 // MDI operations
74 // --------------
75 virtual void Cascade();
76 virtual void Tile();
77 virtual void ArrangeIcons();
78 virtual void ActivateNext();
79 virtual void ActivatePrevious();
80
81 // handlers
82 // --------
83
84 void OnSize(wxSizeEvent& event);
85
86 // override window proc for MDI-specific message processing
87 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
88
89 virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
90 virtual bool MSWTranslateMessage(WXMSG* msg);
91
92 protected:
93 #if wxUSE_MENUS_NATIVE
94 virtual void InternalSetMenuBar();
95 #endif // wxUSE_MENUS_NATIVE
96
97 virtual WXHICON GetDefaultIcon() const;
98
99 wxMDIClientWindow * m_clientWindow;
100 wxMDIChildFrame * m_currentChild;
101 wxMenu* m_windowMenu;
102
103 // true if MDI Frame is intercepting commands, not child
104 bool m_parentFrameActive;
105
106 private:
107 friend class WXDLLEXPORT wxMDIChildFrame;
108
109 DECLARE_EVENT_TABLE()
110 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
111 DECLARE_NO_COPY_CLASS(wxMDIParentFrame)
112 };
113
114 // ---------------------------------------------------------------------------
115 // wxMDIChildFrame
116 // ---------------------------------------------------------------------------
117
118 class WXDLLEXPORT wxMDIChildFrame : public wxFrame
119 {
120 public:
121 wxMDIChildFrame() { Init(); }
122 wxMDIChildFrame(wxMDIParentFrame *parent,
123 wxWindowID id,
124 const wxString& title,
125 const wxPoint& pos = wxDefaultPosition,
126 const wxSize& size = wxDefaultSize,
127 long style = wxDEFAULT_FRAME_STYLE,
128 const wxString& name = wxFrameNameStr)
129 {
130 Init();
131
132 Create(parent, id, title, pos, size, style, name);
133 }
134
135 ~wxMDIChildFrame();
136
137 bool Create(wxMDIParentFrame *parent,
138 wxWindowID id,
139 const wxString& title,
140 const wxPoint& pos = wxDefaultPosition,
141 const wxSize& size = wxDefaultSize,
142 long style = wxDEFAULT_FRAME_STYLE,
143 const wxString& name = wxFrameNameStr);
144
145 virtual bool IsTopLevel() const { return false; }
146
147 // MDI operations
148 virtual void Maximize(bool maximize = true);
149 virtual void Restore();
150 virtual void Activate();
151
152 // Implementation only from now on
153 // -------------------------------
154
155 // Handlers
156 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
157 bool HandleWindowPosChanging(void *lpPos);
158
159 virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
160 virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
161 virtual bool MSWTranslateMessage(WXMSG *msg);
162
163 virtual void MSWDestroyWindow();
164
165 bool ResetWindowStyle(void *vrect);
166
167 void OnIdle(wxIdleEvent& event);
168
169 protected:
170 virtual void DoGetPosition(int *x, int *y) const;
171 virtual void DoSetClientSize(int width, int height);
172 virtual void InternalSetMenuBar();
173 virtual bool IsMDIChild() const { return true; }
174
175 virtual WXHICON GetDefaultIcon() const;
176
177 // common part of all ctors
178 void Init();
179
180 private:
181 bool m_needsResize; // flag which tells us to artificially resize the frame
182
183 DECLARE_EVENT_TABLE()
184 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
185 };
186
187 // ---------------------------------------------------------------------------
188 // wxMDIClientWindow
189 // ---------------------------------------------------------------------------
190
191 class WXDLLEXPORT wxMDIClientWindow : public wxWindow
192 {
193 public:
194 wxMDIClientWindow() { Init(); }
195 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
196 {
197 Init();
198
199 CreateClient(parent, style);
200 }
201
202 // Note: this is virtual, to allow overridden behaviour.
203 virtual bool CreateClient(wxMDIParentFrame *parent,
204 long style = wxVSCROLL | wxHSCROLL);
205
206 // Explicitly call default scroll behaviour
207 void OnScroll(wxScrollEvent& event);
208
209 virtual void DoSetSize(int x, int y,
210 int width, int height,
211 int sizeFlags = wxSIZE_AUTO);
212 protected:
213 void Init() { m_scrollX = m_scrollY = 0; }
214
215 int m_scrollX, m_scrollY;
216
217 private:
218 DECLARE_EVENT_TABLE()
219 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
220 };
221
222 #endif
223 // _WX_MDI_H_