OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mdi.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1991, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of TMDIClient and TMDIFrame classes
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_MDI_H)
10#define OWL_MDI_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/framewin.h>
18#include <owl/mdichild.h>
19#include <owl/mdi.rh>
20#include <memory>
21
22namespace owl {
23
24#include <owl/preclass.h>
25
26/// \addtogroup frame
27/// @{
28
29class _OWLCLASS TMDIFrame;
30
31//
32/// \class TMDIClient
33// ~~~~~ ~~~~~~~~~~
34/// Multiple Document Interface (MDI) client windows (represented by a TMDIClient
35/// object) manage the MDI child windows of a TMDIFrame parent. TMDIClient is a
36/// streamable class.
37class _OWLCLASS TMDIClient : public virtual TWindow {
38 public:
39 TMDIClient(TModule* module = 0);
41
42 virtual bool CloseChildren();
43 TMDIChild* GetActiveMDIChild();
44
45 // Member functions to arrange the MDI children
46 //
47 virtual void ArrangeIcons();
48 virtual void CascadeChildren();
49 virtual void TileChildren(int tile = MDITILE_VERTICAL);
50
51 // Override member functions defined by TWindow
52 //
53 auto PreProcessMsg(MSG&) -> bool override;
54 auto Create() -> bool override;
55
56 /// \name Child factory functions
57 /// @{
58 virtual TMDIChild* CreateChild();
59 virtual TMDIChild* InitChild();
60 /// @}
61
62 LPCLIENTCREATESTRUCT GetClientAttr();
63 void SetClientAttr(LPCLIENTCREATESTRUCT clientattr);
64
65 protected:
66 auto GetWindowClassName() -> TWindowClassName override;
67
68 // Menu command handlers & enabler
69 //
70 void CmCreateChild(); ///< CM_CREATECHILD
71 void CmTileChildren(); ///< CM_TILECHILDREN
72 void CmTileChildrenHoriz(); ///< CM_TILECHILDREN
73 void CmCascadeChildren(); ///< CM_CASCADECHILDREN
74 void CmArrangeIcons(); ///< CM_ARRANGEICONS
75 void CmCloseChildren(); ///< CM_CLOSECHILDREN
76 void CmChildActionEnable(TCommandEnabler& commandEnabler);
77
78 HWND EvMDICreate(MDICREATESTRUCT& createStruct);
79 void EvMDIDestroy(HWND hWnd);
80
81 void EvDropFiles(TDropInfo);
82
84/// ClientAttr holds a pointer to a structure of the MDI client window's attributes.
85 LPCLIENTCREATESTRUCT ClientAttr;
86
87 private:
88 TMDIClient(HWND hWnd, TModule* module = 0);
89
90 // Hidden to prevent accidental copying or assignment
91 //
92 TMDIClient(const TMDIClient&);
94
97
98 friend class TMDIFrame; // To allow access to private ctor
99};
100
102
104
105//
106/// \class TMDIFrame
107// ~~~~~ ~~~~~~~~~
108/// Multiple Document Interface (MDI) frame windows, represented by TMDIFrame, are
109/// overlapped windows that serve as main windows of MDI-compliant applications.
110/// TMDIFrame objects automatically handle creating and initializing an MDI client
111/// window (represented by a TMDIClient object) required by Windows. TMDIFrame sets
112/// window style WS_CLIPCHILDREN by default so that minimal flicker occurs when the
113/// MDI frame erases its background and the backgrounds of its children. TMDIFrame
114/// is a streamable class.
115/// Because TMDIFrame is derived from TFrameWindow, it inherits keyboard navigation.
116/// As a result, all children of the MDI frame acquire keyboard navigation. However,
117/// it's best to enable keyboard navigation only for those children who require it.
118///
119/// To create an OLE-enabled MDI frame window, use TOleMDIFrame, which inherits
120/// functionality from both TMDIFrame and TOleFrame.
121//
122class _OWLCLASS TMDIFrame : virtual public TFrameWindow {
123 public:
124
125 TMDIFrame(
128 std::unique_ptr<TMDIClient> clientWnd = nullptr,
129 TModule* = nullptr);
130
131 TMDIFrame(
132 const tstring& title,
134 std::unique_ptr<TMDIClient> clientWnd = nullptr,
135 TModule* = nullptr);
136
137#if defined(OWL5_COMPAT)
138
142 TModule* module = 0);
143
144 TMDIFrame(
145 const tstring& title,
148 TModule* = 0);
149
150#endif
151
153
154 // Override virtual functions defined by TFrameWindow or TWindow
155 //
156 auto SetMenu(HMENU) -> bool override;
157 auto GetClientWindow() -> TMDIClient* override;
158 auto GetCommandTarget() -> HWND override;
159
160 /// Find & return the child menu of an MDI frame's (or anyone's) menu bar.
161 //
162 static HMENU FindChildMenu(HMENU);
163
164 protected:
165 virtual TResult DefWindowProc(TMsgId, TParam1, TParam2);
166 auto PerformCreate() -> THandle override;
167
168 private:
169 /// Hidden to prevent accidental copying or assignment
170 //
171 TMDIFrame(const TMDIFrame&);
172 TMDIFrame& operator=(const TMDIFrame&);
173
176};
177
179
181
182/// @}
183
184#include <owl/posclass.h>
185
186
187//----------------------------------------------------------------------------
188// Inline implementations
189//
190
191//
192/// Returns the client create struct for the MDI client.
193//
195 return ClientAttr;
196}
197
198//
199/// Sets the client create struct for the MDI client.
200/// \todo Assumes ownership of the pointer, so it will be deleted ? And the old one is orphaned and leaks?
201//
205
206//
207/// Calls CreateChild to produce a new child window in response to a menu selection
208/// with a menu ID of CM_CREATECHILD.
210 CreateChild();
211}
212
213//
214/// Calls TileChildren in response to a menu selection with an ID of
215/// CM_TILECHILDREN.
217 TileChildren();
218}
219
220//
221/// Calls TileChildren in response to a menu selection with an ID of CM_TILECHILDREN
222/// and passes MDI child tile flag as MDITILE_HORIZONTAL.
226
227//
228/// Calls CascadeChildren in response to a menu selection with an ID of
229/// CM_CASCADECHILDREN.
233
234//
235/// Calls ArrangeIcons in response to a menu selection with an ID of
236/// CM_ARRANGEICONS.
238 ArrangeIcons();
239}
240
241//
242/// Calls CloseChildren in response to a menu selection with an ID of
243/// CM_CLOSECHILDREN.
246}
247
248
249} // OWL namespace
250
251
252#endif // OWL_MDI_H
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
TDropInfo is a simple class that supports file-name drag-and-drop operations using the WM_DROPFILES m...
Definition wsyscls.h:257
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
Definition framewin.h:96
TMDIChild defines the basic behavior of all MDI child windows.
Definition mdichild.h:42
Multiple Document Interface (MDI) client windows (represented by a TMDIClient object) manage the MDI ...
Definition mdi.h:37
LPCLIENTCREATESTRUCT GetClientAttr()
Returns the client create struct for the MDI client.
Definition mdi.h:194
virtual bool CloseChildren()
Closes the TMDIChild windows owned by this MDI client.
Definition mdiclien.cpp:217
void CmTileChildren()
CM_TILECHILDREN.
Definition mdi.h:216
void SetClientAttr(LPCLIENTCREATESTRUCT clientattr)
Sets the client create struct for the MDI client.
Definition mdi.h:202
void CmTileChildrenHoriz()
CM_TILECHILDREN.
Definition mdi.h:223
void CmArrangeIcons()
CM_ARRANGEICONS.
Definition mdi.h:237
void CmCreateChild()
CM_CREATECHILD.
Definition mdi.h:209
void CmCloseChildren()
CM_CLOSECHILDREN.
Definition mdi.h:244
virtual void TileChildren(int tile=MDITILE_VERTICAL)
Sizes and arranges all of the non-iconized MDI child windows within the MDI client window.
Definition mdiclien.cpp:138
virtual void ArrangeIcons()
Arranges the MDI child window icons at the bottom of the MDI client window.
Definition mdiclien.cpp:118
virtual TMDIChild * CreateChild()
Initializes and creates a new TMDIChild by calling InitChild and Create.
Definition mdiclien.cpp:179
void CmCascadeChildren()
CM_CASCADECHILDREN.
Definition mdi.h:230
virtual void CascadeChildren()
Sizes and arranges all of the non-iconized MDI child windows within the MDI client window.
Definition mdiclien.cpp:128
Multiple Document Interface (MDI) frame windows, represented by TMDIFrame, are overlapped windows tha...
Definition mdi.h:122
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
Definition of class TFrameWindow.
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
TMDIFrame TMdiFrame
Definition mdi.h:180
TMDIClient TMdiClient
Definition mdi.h:103
Definition of class TMDIChild.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
UINT TMsgId
Message ID type.
Definition dispatch.h:53
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
std::string tstring
Definition defs.h:79
#define public_data
Definition defs.h:207
#define _OWLCLASS
Definition defs.h:338