1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/mdi.h
3 // Purpose: MDI (Multiple Document Interface) classes
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "mdi.h"
21 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
22 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
24 class WXDLLEXPORT wxMDIClientWindow
;
25 class WXDLLEXPORT wxMDIChildFrame
;
27 // ---------------------------------------------------------------------------
29 // ---------------------------------------------------------------------------
31 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
35 wxMDIParentFrame(wxWindow
*parent
,
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
)
43 Create(parent
, id
, title
, pos
, size
, style
, name
);
48 bool Create(wxWindow
*parent
,
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
);
59 // Get the active MDI child window (Windows only)
60 wxMDIChildFrame
*GetActiveChild() const;
62 // Get the client window
63 wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; }
65 // Create the client window class (don't Create the window,
66 // just return a new class)
67 virtual wxMDIClientWindow
*OnCreateClient(void);
70 wxMenu
* GetWindowMenu() const { return m_windowMenu
; };
71 void SetWindowMenu(wxMenu
* menu
) ;
75 virtual void Cascade();
77 virtual void ArrangeIcons();
78 virtual void ActivateNext();
79 virtual void ActivatePrevious();
84 void OnSize(wxSizeEvent
& event
);
86 // override window proc for MDI-specific message processing
87 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
89 virtual WXLRESULT
MSWDefWindowProc(WXUINT
, WXWPARAM
, WXLPARAM
);
90 virtual bool MSWTranslateMessage(WXMSG
* msg
);
93 #if wxUSE_MENUS_NATIVE
94 virtual void InternalSetMenuBar();
95 #endif // wxUSE_MENUS_NATIVE
97 virtual WXHICON
GetDefaultIcon() const;
99 wxMDIClientWindow
* m_clientWindow
;
100 wxMDIChildFrame
* m_currentChild
;
101 wxMenu
* m_windowMenu
;
103 // true if MDI Frame is intercepting commands, not child
104 bool m_parentFrameActive
;
107 friend class WXDLLEXPORT wxMDIChildFrame
;
109 DECLARE_EVENT_TABLE()
110 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
111 DECLARE_NO_COPY_CLASS(wxMDIParentFrame
)
114 // ---------------------------------------------------------------------------
116 // ---------------------------------------------------------------------------
118 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
121 wxMDIChildFrame() { Init(); }
122 wxMDIChildFrame(wxMDIParentFrame
*parent
,
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
)
132 Create(parent
, id
, title
, pos
, size
, style
, name
);
137 bool Create(wxMDIParentFrame
*parent
,
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
);
145 virtual bool IsTopLevel() const { return false; }
148 virtual void Maximize(bool maximize
= true);
149 virtual void Restore();
150 virtual void Activate();
152 // Implementation only from now on
153 // -------------------------------
156 bool HandleMDIActivate(long bActivate
, WXHWND
, WXHWND
);
157 bool HandleWindowPosChanging(void *lpPos
);
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
);
163 virtual void MSWDestroyWindow();
165 bool ResetWindowStyle(void *vrect
);
167 void OnIdle(wxIdleEvent
& event
);
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; }
175 virtual WXHICON
GetDefaultIcon() const;
177 // common part of all ctors
181 bool m_needsResize
; // flag which tells us to artificially resize the frame
183 DECLARE_EVENT_TABLE()
184 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame
)
187 // ---------------------------------------------------------------------------
189 // ---------------------------------------------------------------------------
191 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
194 wxMDIClientWindow() { Init(); }
195 wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
199 CreateClient(parent
, style
);
202 // Note: this is virtual, to allow overridden behaviour.
203 virtual bool CreateClient(wxMDIParentFrame
*parent
,
204 long style
= wxVSCROLL
| wxHSCROLL
);
206 // Explicitly call default scroll behaviour
207 void OnScroll(wxScrollEvent
& event
);
209 virtual void DoSetSize(int x
, int y
,
210 int width
, int height
,
211 int sizeFlags
= wxSIZE_AUTO
);
213 void Init() { m_scrollX
= m_scrollY
= 0; }
215 int m_scrollX
, m_scrollY
;
218 DECLARE_EVENT_TABLE()
219 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow
)