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 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
18 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
20 class WXDLLEXPORT wxMDIClientWindow
;
21 class WXDLLEXPORT wxMDIChildFrame
;
23 // ---------------------------------------------------------------------------
25 // ---------------------------------------------------------------------------
27 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
31 wxMDIParentFrame(wxWindow
*parent
,
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
)
39 Create(parent
, id
, title
, pos
, size
, style
, name
);
44 bool Create(wxWindow
*parent
,
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
);
55 // Get the active MDI child window (Windows only)
56 wxMDIChildFrame
*GetActiveChild() const;
58 // Get the client window
59 wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; }
61 // Create the client window class (don't Create the window,
62 // just return a new class)
63 virtual wxMDIClientWindow
*OnCreateClient(void);
66 wxMenu
* GetWindowMenu() const { return m_windowMenu
; };
67 void SetWindowMenu(wxMenu
* menu
) ;
71 virtual void Cascade();
73 virtual void ArrangeIcons();
74 virtual void ActivateNext();
75 virtual void ActivatePrevious();
80 void OnSize(wxSizeEvent
& event
);
82 // override window proc for MDI-specific message processing
83 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
85 virtual WXLRESULT
MSWDefWindowProc(WXUINT
, WXWPARAM
, WXLPARAM
);
86 virtual bool MSWTranslateMessage(WXMSG
* msg
);
89 #if wxUSE_MENUS_NATIVE
90 virtual void InternalSetMenuBar();
91 #endif // wxUSE_MENUS_NATIVE
93 virtual WXHICON
GetDefaultIcon() const;
95 wxMDIClientWindow
* m_clientWindow
;
96 wxMDIChildFrame
* m_currentChild
;
99 // true if MDI Frame is intercepting commands, not child
100 bool m_parentFrameActive
;
103 friend class WXDLLEXPORT wxMDIChildFrame
;
105 DECLARE_EVENT_TABLE()
106 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
107 DECLARE_NO_COPY_CLASS(wxMDIParentFrame
)
110 // ---------------------------------------------------------------------------
112 // ---------------------------------------------------------------------------
114 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
117 wxMDIChildFrame() { Init(); }
118 wxMDIChildFrame(wxMDIParentFrame
*parent
,
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
)
128 Create(parent
, id
, title
, pos
, size
, style
, name
);
133 bool Create(wxMDIParentFrame
*parent
,
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
);
141 virtual bool IsTopLevel() const { return false; }
144 virtual void Maximize(bool maximize
= true);
145 virtual void Restore();
146 virtual void Activate();
148 // Implementation only from now on
149 // -------------------------------
152 bool HandleMDIActivate(long bActivate
, WXHWND
, WXHWND
);
153 bool HandleWindowPosChanging(void *lpPos
);
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
);
159 virtual void MSWDestroyWindow();
161 bool ResetWindowStyle(void *vrect
);
163 void OnIdle(wxIdleEvent
& event
);
166 virtual void DoGetPosition(int *x
, int *y
) const;
167 virtual void DoSetClientSize(int width
, int height
);
168 virtual void InternalSetMenuBar();
169 virtual bool IsMDIChild() const { return true; }
171 virtual WXHICON
GetDefaultIcon() const;
173 // common part of all ctors
177 bool m_needsResize
; // flag which tells us to artificially resize the frame
179 DECLARE_EVENT_TABLE()
180 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame
)
183 // ---------------------------------------------------------------------------
185 // ---------------------------------------------------------------------------
187 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
190 wxMDIClientWindow() { Init(); }
191 wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
195 CreateClient(parent
, style
);
198 // Note: this is virtual, to allow overridden behaviour.
199 virtual bool CreateClient(wxMDIParentFrame
*parent
,
200 long style
= wxVSCROLL
| wxHSCROLL
);
202 // Explicitly call default scroll behaviour
203 void OnScroll(wxScrollEvent
& event
);
205 virtual void DoSetSize(int x
, int y
,
206 int width
, int height
,
207 int sizeFlags
= wxSIZE_AUTO
);
209 void Init() { m_scrollX
= m_scrollY
= 0; }
211 int m_scrollX
, m_scrollY
;
214 DECLARE_EVENT_TABLE()
215 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow
)