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 /////////////////////////////////////////////////////////////////////////////
17 WXDLLIMPEXP_DATA_CORE(extern const wxChar
) wxStatusLineNameStr
[];
19 class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow
;
20 class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame
;
22 // ---------------------------------------------------------------------------
24 // ---------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE wxMDIParentFrame
: public wxFrame
30 wxMDIParentFrame(wxWindow
*parent
,
32 const wxString
& title
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
36 const wxString
& name
= wxFrameNameStr
)
38 Create(parent
, id
, title
, pos
, size
, style
, name
);
41 virtual ~wxMDIParentFrame();
43 bool Create(wxWindow
*parent
,
45 const wxString
& title
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
48 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
49 const wxString
& name
= wxFrameNameStr
);
54 // Get the active MDI child window (Windows only)
55 wxMDIChildFrame
*GetActiveChild() const;
57 // Get the client window
58 wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; }
60 // Create the client window class (don't Create the window,
61 // just return a new class)
62 virtual wxMDIClientWindow
*OnCreateClient(void);
65 wxMenu
* GetWindowMenu() const { return m_windowMenu
; };
66 void SetWindowMenu(wxMenu
* menu
) ;
70 virtual void Cascade();
72 virtual void ArrangeIcons();
73 virtual void ActivateNext();
74 virtual void ActivatePrevious();
79 void OnSize(wxSizeEvent
& event
);
81 // override window proc for MDI-specific message processing
82 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
84 virtual WXLRESULT
MSWDefWindowProc(WXUINT
, WXWPARAM
, WXLPARAM
);
85 virtual bool MSWTranslateMessage(WXMSG
* msg
);
88 #if wxUSE_MENUS_NATIVE
89 virtual void InternalSetMenuBar();
90 #endif // wxUSE_MENUS_NATIVE
92 virtual WXHICON
GetDefaultIcon() const;
94 wxMDIClientWindow
* m_clientWindow
;
95 wxMDIChildFrame
* m_currentChild
;
98 // true if MDI Frame is intercepting commands, not child
99 bool m_parentFrameActive
;
102 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame
;
104 DECLARE_EVENT_TABLE()
105 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
106 wxDECLARE_NO_COPY_CLASS(wxMDIParentFrame
);
109 // ---------------------------------------------------------------------------
111 // ---------------------------------------------------------------------------
113 class WXDLLIMPEXP_CORE wxMDIChildFrame
: public wxFrame
116 wxMDIChildFrame() { Init(); }
117 wxMDIChildFrame(wxMDIParentFrame
*parent
,
119 const wxString
& title
,
120 const wxPoint
& pos
= wxDefaultPosition
,
121 const wxSize
& size
= wxDefaultSize
,
122 long style
= wxDEFAULT_FRAME_STYLE
,
123 const wxString
& name
= wxFrameNameStr
)
127 Create(parent
, id
, title
, pos
, size
, style
, name
);
130 virtual ~wxMDIChildFrame();
132 bool Create(wxMDIParentFrame
*parent
,
134 const wxString
& title
,
135 const wxPoint
& pos
= wxDefaultPosition
,
136 const wxSize
& size
= wxDefaultSize
,
137 long style
= wxDEFAULT_FRAME_STYLE
,
138 const wxString
& name
= wxFrameNameStr
);
140 virtual bool IsTopLevel() const { return false; }
143 virtual void Maximize(bool maximize
= true);
144 virtual void Restore();
145 virtual void Activate();
147 // Implementation only from now on
148 // -------------------------------
151 bool HandleMDIActivate(long bActivate
, WXHWND
, WXHWND
);
152 bool HandleWindowPosChanging(void *lpPos
);
154 virtual WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
155 virtual WXLRESULT
MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
156 virtual bool MSWTranslateMessage(WXMSG
*msg
);
158 virtual void MSWDestroyWindow();
160 bool ResetWindowStyle(void *vrect
);
162 void OnIdle(wxIdleEvent
& event
);
165 virtual void DoGetPosition(int *x
, int *y
) const;
166 virtual void DoSetClientSize(int width
, int height
);
167 virtual void InternalSetMenuBar();
168 virtual bool IsMDIChild() const { return true; }
170 virtual WXHICON
GetDefaultIcon() const;
172 // common part of all ctors
176 bool m_needsResize
; // flag which tells us to artificially resize the frame
178 DECLARE_EVENT_TABLE()
179 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame
)
182 // ---------------------------------------------------------------------------
184 // ---------------------------------------------------------------------------
186 class WXDLLIMPEXP_CORE wxMDIClientWindow
: public wxWindow
189 wxMDIClientWindow() { Init(); }
190 wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
194 CreateClient(parent
, style
);
197 // Note: this is virtual, to allow overridden behaviour.
198 virtual bool CreateClient(wxMDIParentFrame
*parent
,
199 long style
= wxVSCROLL
| wxHSCROLL
);
201 // Explicitly call default scroll behaviour
202 void OnScroll(wxScrollEvent
& event
);
204 virtual void DoSetSize(int x
, int y
,
205 int width
, int height
,
206 int sizeFlags
= wxSIZE_AUTO
);
208 void Init() { m_scrollX
= m_scrollY
= 0; }
210 int m_scrollX
, m_scrollY
;
213 DECLARE_EVENT_TABLE()
214 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow
)