59 Attr.Style |= MDIS_ALLCHILDSTYLES | WS_GROUP | WS_TABSTOP | WS_CLIPCHILDREN|
60 WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL | WS_BORDER;
62 Attr.Style &= ~WS_BORDER;
65 ClientAttr =
new CLIENTCREATESTRUCT;
66 ClientAttr->hWindowMenu =
nullptr;
69 Attr.Param =
reinterpret_cast<LPVOID
>(ClientAttr);
152 if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
153 return TranslateMDISysAccel(
GetHandle(), &msg);
220 const auto canClose = std::all_of(c.begin(), c.end(), [](
TWindow& w) { return w.CanClose(); });
221 if (!canClose)
return false;
230 auto cv = std::vector<TWindow*>{};
233 for (
const auto w : cv)
255 if ((Attr.Style&MDIS_ALLCHILDSTYLES) && !createStruct.style)
257 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
258 WS_SYSMENU | WS_CAPTION | WS_THICKFRAME |
259 WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
264 uint32 origStyle = createStruct.style;
265 if (createStruct.style & WS_MAXIMIZE)
266 createStruct.style &= ~(WS_MAXIMIZE | WS_VISIBLE);
272 if (
THandle(result) && (origStyle & WS_MAXIMIZE)) {
277 return reinterpret_cast<HWND
>(result);
290 const auto unhide = [&](
TWindow& child)
292 if (child.GetHandle() == w || !child.IsWindow())
294 if (!child.IsWindowVisible())
296 child.SetWindowPos(
nullptr,
TRect(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
299 if (!child.IsWindowEnabled())
301 child.EnableWindow(
true);
306 const auto rehide = [&](
TWindow& child)
308 if (child.GetHandle() == w || !child.IsWindow())
313 child.ShowWindow(SW_HIDE);
318 child.EnableWindow(
false);
336 Parent->ForwardMessage();
353#if OWL_PERSISTENT_STREAMS
363 if (GetObject()->ClientAttr == 0)
364 GetObject()->ClientAttr =
new CLIENTCREATESTRUCT;
368 GetObject()->ClientAttr->idFirstChild = idFirstChild;
369 GetObject()->ClientAttr->hWindowMenu = (HMENU) 0;
370 GetObject()->Attr.Param =
reinterpret_cast<LPVOID
>(GetObject()->ClientAttr);
379TMDIClient::Streamer::Write(opstream& os)
const
382 os << GetObject()->ClientAttr->idFirstChild;
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
virtual void Enable(bool enable=true)
Enables or disables the command sender.
TDropInfo is a simple class that supports file-name drag-and-drop operations using the WM_DROPFILES m...
TMDIChild defines the basic behavior of all MDI child windows.
TMDIChild(TMDIClient &parent, LPCTSTR title=0, TWindow *clientWnd=0, bool shrinkToClient=false, TModule *module=0)
Constructor for a TMDIChild.
Multiple Document Interface (MDI) client windows (represented by a TMDIClient object) manage the MDI ...
virtual bool CloseChildren()
Closes the TMDIChild windows owned by this MDI client.
TMDIClient(TModule *module=0)
Constructor for a TMDIClient.
void CmChildActionEnable(TCommandEnabler &commandEnabler)
If there are MDI child windows, CmChildActionEnalbe enables any one of the child window action menu i...
void EvDropFiles(TDropInfo)
Forwards dropped file messages by default to the parent (MDI Frame) where they can be handled,...
TMDIChild * GetActiveMDIChild()
Use the Windows message to get the active mdi child, and then down cast to our MDI child derived clas...
virtual TMDIChild * InitChild()
Constructs an instance of a TMDIChild with this TMDIClient as parent.
virtual void TileChildren(int tile=MDITILE_VERTICAL)
Sizes and arranges all of the non-iconized MDI child windows within the MDI client window.
virtual void ArrangeIcons()
Arranges the MDI child window icons at the bottom of the MDI client window.
~TMDIClient()
Frees the memory associated with ClientAttr.
virtual TMDIChild * CreateChild()
Initializes and creates a new TMDIChild by calling InitChild and Create.
HWND EvMDICreate(MDICREATESTRUCT &createStruct)
Intercepts the WM_MDICREATE message sent when MDI child windows are created, and, if the client's sty...
virtual void CascadeChildren()
Sizes and arranges all of the non-iconized MDI child windows within the MDI client window.
auto PreProcessMsg(MSG &) -> bool override
Preprocess messages in order to translate MDI accelerator keys.
void EvMDIDestroy(HWND hWnd)
Destroys an MDI child window.
static HMENU FindChildMenu(HMENU)
Find & return the child menu of an MDI frame's (or anyone's) menu bar.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TRect()
Default constructor that does nothing.
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
auto GetChildren()
Returns a TWindow::TChildrenRange that can be iterated by standard means.
virtual void Destroy(int retVal=0)
Destroys an MS-Windows element associated with the TWindow.
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
TWindow * GetWindowPtr(HWND hWnd) const
Calls TApplication:GetWindowPtr on the application associated with this window.
virtual auto GetWindowClassName() -> TWindowClassName
void Init(TWindow *parent, LPCTSTR title, TModule *module)
Normal initialization of a default constructed TWindow.
void SetFlag(uint mask)
Sets the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
TWindow * GetParentO() const
Return the OWL's parent for this window.
HMENU GetMenu() const
Returns the handle to the menu of the indicated window.
TResult HandleMessage(TMsgId, TParam1=0, TParam2=0)
Dispatches the given message using the response table.
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
TWindow * GetFirstChild()
Returns a pointer to the first child window, which is the first window created in the interface objec...
HWND THandle
TWindow encapsulates an HWND.
HWND GetHandle() const
Returns the handle of the window.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
void ReadBaseObject(Base *base, ipstream &in)
void WriteBaseObject(Base *base, opstream &out)
@ wfUnDisabled
Used temporarily when destroying MDI child.
@ wfUnHidden
Used temporarily when destroying MDI child.
@ wfStreamTop
This window is the topmost one to stream.
Definition of TMDIClient and TMDIFrame classes.
Object Windows Library (OWLNext Core).
const unsigned int IDW_MDICLIENT
ID of MDI client window.
WPARAM TParam1
First parameter type.
LRESULT TResult
Result type.
EV_COMMAND_ENABLE(CM_FILENEW, CeFileNew)
const unsigned int IDW_FIRSTMDICHILD
child window IDs, 32 max to 32032
IMPLEMENT_STREAMABLE1(TApplication, TModule)
EV_COMMAND(IDOK, CmOkCancel)
#define TYPESAFE_DOWNCAST(object, toClass)