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
olemdifr.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of class TOleMDIFrame.
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9
10#include <owl/decmdifr.h>
11#include <owl/statusba.h>
12#include <ocf/ocfevent.h>
13#include <ocf/olemdifr.h>
14#include <type_traits>
15
16namespace ocf {
17
18using namespace owl;
19
20using namespace std;
21
24
29
30//
31/// Constructs a TOleMDIFrame object with the indicated title, menu resource ID,
32/// client window, and module instance. By default, because trackMenuSelection is
33/// false, menu hint text is not displayed. (These parameters coincide with those of
34/// TMDIFrame's constructor.)
35///
36/// \note If nullptr is passed for `clientWnd`, then a default TMDIClient is created.
37//
42
43//
44/// String-aware overload.
45//
49
50#if defined(OWL5_COMPAT)
51
52//
53/// Old OWL 5 constructor.
54/// Use the new safe constructor instead.
55//
60 TModule* module)
63// !CQ when did this change?
64// ,TFrameWindow(0, title, &clientWnd, false, module),
65// TWindow(0, title, module)
66{
67}
68
69#endif
70
71//
72/// Destroys the OLE MDI frame window object.
73//
77
78//
79/// Responds to a message indicating that the frame window of this application
80/// (hTask) is going to be either activated (active is true) or deactivated (active
81/// is false), and forwards this information to the TOcApp object.
82//
83void
85{
87 TMDIFrame::EvActivateApp(active, threadId);
88}
89
90//
91/// Inserts menus into a provided menu bar, or merges them with a child window and
92/// servers. To do this, EvOcAppInsMenus creates a temporary composite menu for the
93/// frame and MDI child windows, then copies the shared menu widths to the
94/// ObjectComponents structure. It saves the container popups so they can be
95/// destroyed later.
96//
97bool
99{
100 if (HOldMenu)
101 return true;
102
103 // Recreate a temporary composite menu for frame and MDI child
104 //
105 TMenuDescr compMenuDesc; // empty menudescr
106 if (GetMenuDescr())
107 compMenuDesc.Merge(*GetMenuDescr());
108
109 const TMenuDescr* childMenu = GetClientWindow()->GetActiveMDIChild()->GetMenuDescr();
110
111 if (childMenu)
112 compMenuDesc.Merge(*childMenu);
113
114 // Mask off the server menus
115 //
116 compMenuDesc.Merge(TMenuDescr(0, 0, -1, 0, -1, 0, -1));
117
118 // Merge into the OLE shared menubar
119 //
121 sharedMenu.Width[0],
122 sharedMenu.Width[1],
123 sharedMenu.Width[2],
124 sharedMenu.Width[3],
125 sharedMenu.Width[4],
126 sharedMenu.Width[5]);
128
129 // Copy the shared menu widths back to the OC struct
130 //
131 for (int i = 0; i < 6; i++)
132 sharedMenu.Width[i] = shMenuDescr.GetGroupCount(i);
133
134 // Save the container popups so they can be destroyed later
135 //
137
138 TRACEX(OcfOleMenu, 0, _T("MDI merged menu ") << hex << static_cast<void*>(sharedMenu.HMenu));
139 return true;
140}
141
142//
143/// Allows default processing for all messages except for a resizing message
144/// concerning the frame window, in which case, DefWindowProc returns nothing.
145//
148{
149 //
150 // ::DefFrameProc() will response to WM_SIZE by making the MDI client the
151 // same size as the client rectangle; this conflicts with what TLayoutWindow
152 // has done
153 //
154 return message == WM_SIZE ?
155 0 :
157}
158
159} // OCF namespace
160
161//==============================================================================
162
#define DIAG_DECLARE_GROUP(group)
Definition checks.h:404
#define TRACEX(group, level, message)
Definition checks.h:263
void EvActivate(bool)
Let BOle know that the main window has [de]activated.
Definition ocapp.cpp:326
Decorated frame that supports OLE 2 using OCF.
Definition oleframe.h:65
HMENU HOldMenu
Stores the handle to the container's previously saved copy of the menu.
Definition oleframe.h:115
TOcApp * OcApp
Points to the ObjectComponents application associated with this frame window.
Definition oleframe.h:105
void StashContainerPopups(const owl::TMenuDescr &shMenuDescr)
Stores a local copy of the pop-up menus so they can be used for menu merging and then destroyed later...
Definition oleframe.cpp:659
Decorated MDI frame that supports OLE 2 using OCF.
Definition olemdifr.h:52
virtual owl::TResult DefWindowProc(owl::TMsgId message, owl::TParam1, owl::TParam2)
Allows default processing for all messages except for a resizing message concerning the frame window,...
Definition olemdifr.cpp:147
bool EvOcAppInsMenus(TOcMenuDescr &sharedMenu)
Inserts menus into a provided menu bar, or merges them with a child window and servers.
Definition olemdifr.cpp:98
~TOleMDIFrame()
Destroys the OLE MDI frame window object.
Definition olemdifr.cpp:74
void EvActivateApp(bool active, DWORD threadId)
Responds to a message indicating that the frame window of this application (hTask) is going to be eit...
Definition olemdifr.cpp:84
TOleMDIFrame(LPCTSTR title, owl::TResId menuResId, std::unique_ptr< owl::TMDIClient > clientWnd=nullptr, bool trackMenuSelection=false, owl::TModule *=nullptr)
Constructs a TOleMDIFrame object with the indicated title, menu resource ID, client window,...
Definition olemdifr.cpp:38
const TMenuDescr * GetMenuDescr() const
Returns a pointer to the menu descriptor for the frame window.
Definition framewin.h:316
Multiple Document Interface (MDI) client windows (represented by a TMDIClient object) manage the MDI ...
Definition mdi.h:37
Multiple Document Interface (MDI) frame windows, represented by TMDIFrame, are overlapped windows tha...
Definition mdi.h:122
auto GetClientWindow() -> TMDIClient *override
Returns a pointer to the MDI client window.
Definition mdiframe.cpp:215
virtual TResult DefWindowProc(TMsgId, TParam1, TParam2)
Overrides TWindow::DefWindowProc and provides default processing for any incoming message the MDI fra...
Definition mdiframe.cpp:243
Menu with information used to allow merging.
Definition menu.h:206
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
#define _T(x)
Definition cygwin.h:51
Definition of TDecoratedMDIFrame class.
#define DEFINE_RESPONSE_TABLE2(cls, base1, base2)
Macro to define a response table for a class with two bases.
Definition eventhan.h:506
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
EV_OC_APPINSMENUS
Definition oleframe.cpp:202
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
UINT TMsgId
Message ID type.
Definition dispatch.h:53
EV_WM_ACTIVATEAPP
Definition floatfra.cpp:32
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
OWL_DIAGINFO
Definition animctrl.cpp:14
END_RESPONSE_TABLE
Definition button.cpp:26
LRESULT TResult
Result type.
Definition dispatch.h:52
std::string tstring
Definition defs.h:79
Definition of OWL signatures for ObjectComponents messages.
Definition of class TStatusBar.