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