OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
oleframe.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 TOleFrame.
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/oleframe.h>
14#include <ocf/olewindo.h>
15#include <owl/commctrl.h>
16
17namespace ocf {
18
19using namespace owl;
20
21using namespace std;
22
24//DIAG_DECLARE_GROUP(OwlCmd);
26
27//#define DEBUG_PADS
28// define to make pads paint red for debugging time in MS for idle action polling
29const int DllIdleTime = 200;
30
31// Four edge locations for inplace-server space negotiation
32//
39
40//----------------------------------------------------------------------------
41/// An empty no-erase window that inserts itself into its decorated frame
42/// parent
43//
44
45class TPadWindow : public TWindow {
46 public:
47 TPadWindow(TWindow* parent, int edge, TModule* module = 0)
48 : TWindow(parent, 0, module)
49 {
50 Attr.Id = IDW_PADDECORATION+edge;
51 Attr.Style = WS_CHILD | WS_VISIBLE;
52 Attr.W = Attr.H = 0; // takeup no space until needed [bugs:#51]
53#if defined(DEBUG_PADS)
54 SetBkgndColor(TColor(255,0,0)); // to help Debug toolbar negotiations
55 strstream s;
56 s << _T("Pad") << (_T('0') + edge);
57 Title = strnewdup(s.str());
58#else
59 SetBkgndColor(NoErase); // Don't erase--to avoid flicker
60#endif
61 }
62};
63
64//
65/// \class TRemViewBucket
66// ~~~~~ ~~~~~~~~~~~~~~
67/// A small window class to act as a holder for the unattached remote server
68/// view windows
69//
70class TRemViewBucket : public TFrameWindow {
71 public:
72 TRemViewBucket(TWindow* parent);
73
74 // Overriden virtuals of base class
75 //
76 bool SetDocTitle(LPCTSTR, int);
77
78 // Override handlers to act as pass-thru on behalf of remove server view
79 //
80 TResult EvCommand(uint id, THandle hWndCtl, uint notifyCode);
81 TResult EvNotify(uint id, TNotify & notifyInfo);
82 void EvCommandEnable(TCommandEnabler& ce);
83 TWindow* FindRemoteWindow();
84};
85
86//
87//
88//
89TRemViewBucket::TRemViewBucket(TWindow* parent)
90 :TFrameWindow(parent, _T("RemViewBucket"))
91{
92 Attr.Style = WS_CHILD | WS_DISABLED;
93 Attr.Id = IDW_REMVIEWBUCKET;
94}
95
96//
97//
98//
99bool
100TRemViewBucket::SetDocTitle(LPCTSTR, int)
101{
102 return true;
103}
104
105//
106//
107//
108TWindow*
109TRemViewBucket::FindRemoteWindow()
110{
111 // Check if we can find the object representing the remote window object by
112 // traversing the focus window tree
113 //
114 TWindow* remote = 0;
115 HWND focusHwnd = GetFocus();
116 HWND hwnd = focusHwnd;
117 while (hwnd) {
118 remote = GetWindowPtr(hwnd);
119 if (remote) {
120 // The remote window has the remViewBucket as its parent
121 //
122 if (remote->GetParentO() == this)
123 break;
124 else
125 remote = 0;
126 }
127 hwnd = ::GetParent(hwnd);
128 }
129 return remote;
130}
131
132//
133//
134//
136TRemViewBucket::EvCommand(uint id, THandle hWndCtl, uint notifyCode)
137{
138 // Find remote view
139 //
140 TWindow* handler = FindRemoteWindow();
141
142 // Default to parent if none was found
143 //
144 if (!handler)
145 handler = GetParentO();
146
147 // Forward event
148 //
149 CHECK(handler);
150 return handler->EvCommand(id, hWndCtl, notifyCode);
151}
152
153//
154//
155//
157TRemViewBucket::EvNotify(uint id, TNotify & notifyInfo)
158{
159 // Find remote view
160 //
161 TWindow* handler = FindRemoteWindow();
162
163 // Default to parent if none was found
164 //
165 if (!handler)
166 handler = GetParentO();
167
168 // Forward event
169 //
170 CHECK(handler);
171 return handler->EvNotify(id, notifyInfo);
172}
173
174//
175//
176//
177void
178TRemViewBucket::EvCommandEnable(TCommandEnabler& ce)
179{
180 // Find remote view
181 //
182 TWindow* handler = FindRemoteWindow();
183
184 // Default to parent if none was found
185 //
186 if (!handler)
187 handler = GetParentO();
188
189 // Forward event
190 //
191 CHECK(handler);
192 handler->EvCommandEnable(ce);
193}
194
199
211
212//
213/// Constructs a TOleFrame object with the specified caption for the frame window
214/// (title), the client window (clientWnd), and module instance. The
215/// trackMenuSelection parameter indicates whether or not the frame window should
216/// track menu selections (that is, display hint text in the status bar of the
217/// window when a menu item is highlighted).
218//
219TOleFrame::TOleFrame(LPCTSTR title,
220 TWindow* clientWnd,
221 bool trackMenuSelection,
222 TModule* module)
223:
224 TDecoratedFrame(0, title, clientWnd, trackMenuSelection, module),
225 TFrameWindow(0, title, clientWnd, false, module),
226 TWindow(0, title, module),
227 HOldMenu(0),
228 OcApp(0),
229 StashCount(0),
230 OcShutDown(DontCare)
231{
232 new TRemViewBucket(this); // Construct bucket to hold hidden server windows
233
234 // Retrieve the OcApp ptr from our owning application if it is a TOcAppHost
235 //
237 if (ocm)
238 SetOcApp(ocm->OcApp);
239}
240
241//
242/// Destroys a TOleFrame object.
243//
244/// Let the OC app go. It will delete itself when it can
245//
249
250//
251/// Initial set of OcApp being passed to us to use.
252//
253/// Sets the ObjectComponents application associated with this frame window to the
254/// applications specified in the app parameter.
255//
256void
258{
259 PRECONDITION(ocApp);
260 OcApp = ocApp;
261
262 // Initialize OLE 2 clipboard format names
263 //
264 TCHAR f[] = _T("%s");
268}
269
270//
271/// Associates the ObjectComponents application with the window's HWND so that the
272/// TOcApp and the window can communicate. Prepares a place to insert the server's
273/// toolbars when in-place editing of the embedded object occurs.
274//
275void
277{
280 OcApp->SetupWindow(GetHandle());
281
282 // Insert the four pad windows for in-place server toolbars. Inserting last
283 // will place them as the inner-most decorations, which is needed with the
284 // status bar
285 //
286 for (int edge = 0; edge < 4; edge++)
287 Insert(*new TPadWindow(this, edge), ::ocf:: SpaceLoc[edge]);
288
289 // Create a timer to allow us to poll for idle time when we are a dll server
290 //
291 if (!OcApp->IsOptionSet(amExeMode))
293}
294
295//
296/// Performs normal window cleanup of any HWND-related resources. For DLL servers,
297/// CleanupWindow destroys the idle timer.
298//
299void
301{
302 if (!OcApp->IsOptionSet(amExeMode))
304}
305
306//
307/// Adds user defined formats and the corresponding names to the list of Clipboard
308/// formats. Use this function if you want to associate a Clipboard data format
309/// (name) with the description of the data format as it appears to users in the
310/// Help text of the Paste Special dialog box (resultName). To use a standard
311/// Clipboard format, set the id parameter to an appropriate constant (for example,
312/// CF_TEXT). Otherwise, if the format is identified by a string, pass the string as
313/// the name and omit the ID.
314//
315void
316TOleFrame::AddUserFormatName(LPCTSTR name, LPCTSTR resultName,
317 LPCTSTR id)
318{
320 OcApp->AddUserFormatName(name, resultName, id);
321}
322
323//
324/// Sets the OcShutDown data member to ViewInitiated (if close is true and
325/// OcShutDown = DontCare) or DontCare (if close if false and OcShutDown =
326/// ViewInitiated.
327//
328void
330{
331 if (close && OcShutDown == DontCare) {
332 OcShutDown = ViewInitiated;
333 }
334 else if (!close && OcShutDown == ViewInitiated) {
335 OcShutDown = DontCare;
336 }
337}
338
339namespace {
340
341/// Disconnect document servers with their clients.
342/// Document servers can be documents with objects copied on the clipboard or
343/// documents brought up though linking.
344//
345void DisconnectDocServer_(TWindow& win)
346{
347 for (auto& child : win.GetChildren())
348 DisconnectDocServer_(child);
349
350 TOleWindow* oleWin = TYPESAFE_DOWNCAST(&win, TOleWindow);
351 if (oleWin)
352 oleWin->OleShutDown();
353}
354
355} // namespace
356
357//
358/// Checks with all the connected servers to ensure that they can close before
359/// destroying the frame window. If the user closes the application with objects
360/// still embedded, Destroy hides the frame window instead of destroying it.
361//
362void
364{
365 if (!GetHandle() || OcShutDown == UserInitiated)
366 return;
367
368 // Disconnect document servers with their clients if user shuts down the app
369 //
370 if (OcShutDown == DontCare) {
371 OcShutDown = UserInitiated;
372 for (auto& child : GetChildren())
373 DisconnectDocServer_(child);
374 }
375
376 if (!OcApp->CanClose()) {
377 OcApp->SetOption(amEmbedding, true);
378 OcShutDown = DontCare; // reset the shutdown flag
379 ShowWindow(SW_HIDE);
380 }
381 else {
382 bool dllServer = !OcApp->IsOptionSet(amExeMode);
383
385
386 // If user shuts down the DLL server (as in the case of open-editing,
387 // we need to set the mainwindow flag to 0 so that only the application
388 // will be destroyed. All windows are destroyed in previous calls.
389 //
390 if (dllServer && OcShutDown != ServerInitiated) {
391// GetApplication()->SetMainWindow(0);
392 GetApplication()->ClearMainWindow();
393 delete GetApplication();
394 }
395 }
396}
397
398//
399/// Passes a WM_SIZE message to TLayoutWindow.
400//
401/// Responds to an EV_WM_SIZE message indicating a change in the frame window's size
402/// and forwards this information to the TOcApp, which then notifies any in-place
403/// server. The server uses this information to change the size of its toolbar, if
404/// necessary.
405//
406void
407TOleFrame::EvSize(uint sizeType, const TSize& size)
408{
409 TDecoratedFrame::EvSize(sizeType, size);
410 if (OcApp)
411 OcApp->EvResize();
412}
413
414//
415/// Responds to a EV_WM_ACTIVATEAPP message sent when a window is activated or
416/// deactivated. If active is true, the window is being activated.
417/// This message is sent to the top-level window being deactivated before it is sent
418/// to the top-level window being activated. hTask is a handle to the current
419/// process.
420/// This event is forwarded to the TOcApp object, which activates an in-place server
421/// if one exists.
422//
423void
424TOleFrame::EvActivateApp(bool active, DWORD threadId)
425{
426 OcApp->EvActivate(active);
427 TDecoratedFrame::EvActivateApp(active, threadId);
428}
429
430//
431/// If this is a DLL server, EvTimer responds to a timer message by running an idle
432/// loop if the message queue is empty.
433//
434void
436{
437 if (timerId == IDT_DLLIDLE)
438 GetApplication()->PostDispatchAction();
439 TWindow::EvTimer(timerId);
440}
441
442//
443/// Responds to a WM_OCEVENT message and subdispatches it to one of the EvOcXxxx
444/// event-handling functions based on the value of wParam. WM_OCEVENT messages are
445/// sent by ObjectComponents when it needs to communicate with an OLE-generated
446/// event; for example, if a server wants to display toolbars.
447//
450{
451 TEventHandler::TEventInfo eventInfo(WM_OCEVENT, static_cast<uint>(param1));
452
453 // Give the client window the first chance at it
454 //
455 TWindow* receiver = GetClientWindow();
456 if (receiver->Find(eventInfo))
457 return receiver->Dispatch(eventInfo, param1, param2);
458
459 // Then try this frame
460 //
461 if (Find(eventInfo))
462 return Dispatch(eventInfo, param1, param2);
463
464 // Last, try the application in case it wants to override events
465 //
466 if (GetApplication()->Find(eventInfo))
467 return GetApplication()->Dispatch(eventInfo, param1, param2);
468 return 0;
469}
470
471//
472/// Responds to an EV_OC_APPINSMENUS message by merging the container's menu into
473/// the shared menu. The sharedMenu parameter refers to this merged menu.
474//
475bool
477{
478 if (HOldMenu) {
479 TRACEX(OcfOleMenu, 0, _T("EvOcAppInsMenus called while HOldMenu is ") << hex <<
480 static_cast<void*>(HOldMenu));
481 return true;
482 }
483
484 // Recreate a temporary composite menu for frame
485 //
486 TMenuDescr compMenuDesc; // empty menudescr
487 if (GetMenuDescr()) {
488 compMenuDesc.Merge(*GetMenuDescr());
489
490 // Mask off the server menus
491 //
492 compMenuDesc.Merge(TMenuDescr(0, 0, -1, 0, -1, 0, -1));
493 }
494 else
495 return false; // stop menu negotiation if we don't have menu
496
497 // Merge into the OLE shared menubar
498 //
499 TMenuDescr shMenuDescr(sharedMenu.HMenu,
500 sharedMenu.Width[0],
501 sharedMenu.Width[1],
502 sharedMenu.Width[2],
503 sharedMenu.Width[3],
504 sharedMenu.Width[4],
505 sharedMenu.Width[5]);
506 shMenuDescr.Merge(compMenuDesc);
507
508 // Copy the shared menu widths back to the OC struct
509 //
510 for (int i = 0; i < 6; i++)
511 sharedMenu.Width[i] = shMenuDescr.GetGroupCount(i);
512
513 // Save the container popups so they can be destroyed later
514 //
515 StashContainerPopups(shMenuDescr);
516
517 TRACEX(OcfOleMenu, 0, _T("Merged menu ") << hex << static_cast<void*>(sharedMenu.HMenu));
518 return true;
519}
520
521//
522/// Responds to an OC_OCAPPMENUS sent to the container. The response is to install a
523/// merged menu bar.
524//
525bool
527{
528 if (!appMenus.HMenu) {
529 if (HOldMenu) {
530 TRACEX(OcfOleMenu, 0, _T("EvOcAppMenus(0) resetting Old ") << hex <<
531 static_cast<void*>(HOldMenu));
532 TMenu oleMenu(GetHandle());
533 SetMenu(HOldMenu); // assumes we are just restoring the old owl menu
534 HOldMenu = 0;
535 }
536 DestroyStashedPopups(); // destroy the popup copies we made
537 return true;
538 }
539
540 // Don't set the menu again if we are holding a merged one already
541 //
542 if (HOldMenu) {
543 TRACEX(OcfOleMenu, 0, _T("EvOcAppMenus called while HOldMenu is ") << hex <<
544 static_cast<void*>(HOldMenu));
545 return true;
546 }
547
548 HOldMenu = GetMenu();
549 TRACEX(OcfOleMenu, 0, _T("Saved Old ") << hex << static_cast<void*>(HOldMenu));
550
551 SetMenu(appMenus.HMenu);
552 TRACEX(OcfOleMenu, 0, _T("Set merged ") << hex << static_cast<void*>(appMenus.HMenu));
553
554 return true;
555}
556
557//
558/// Responds to an EV_OC_APPROCESSMSG message sent to the container asking the server
559/// to process accelerators and other messages from the container's message queue.
560//
561bool
563{
564 return GetApplication()->ProcessAppMsg(*msg);
565}
566
567//
568/// Responds to an OC_APPFRAMERECT message sent to a container. The response is to
569/// get the coordinates of the client area rectangle of the application's main window.
570//
571bool
573{
574 PRECONDITION(rect);
575 *rect = GetClientRect();
577 if (sb) {
578 TRect sbr = sb->GetClientRect();
579 rect->bottom -= sbr.bottom+1;
580 }
581 return true;
582}
583
584//
585/// Responds to an OC_APPBORDERSPACEREQ message sent to a container. The response is
586/// to ask the container if it can give border space in its frame window to the
587/// server.
588//
589bool
591{
592 return true;
593}
594
595//
596/// Responds to an OC_APPBORDERSPACESET message by making room in the container's
597/// frame window for the border space that the server has requested.
598//
599bool
601{
602 // Resize pad decorations based on edges requested. Unused pads take no space;
603 // otherwise they would leave an unpainted strip around the client [bugs:#51].
604 //
605 int* edges = (int*)space; // treat space as array of 4 int edges
606 bool needLayout = false;
607 for (int i = 0; i < 4; i++) {
609 if (pad) {
610 int edge = edges && edges[i] ? edges[i]+1 : 0;
611 if ((i%2 == 0 && pad->GetWindowAttr().W != edge) || // left & right edge
612 (i%2 == 1 && pad->GetWindowAttr().H != edge)) { // top & bottom edge
614 GetChildLayoutMetrics(*pad, m);
615 pad->GetWindowAttr().H = pad->GetWindowAttr().W = edge; // set both axis, one will be stretched
616 SetChildLayoutMetrics(*pad, m);
617 needLayout = true;
618 }
619 }
620 }
621
622 // Turn on/off control bar as needed
623 //
625 if (tb)
626 if ((space && tb->IsWindowVisible()) || (!space && !tb->IsWindowVisible())) {
627 SendMessage(WM_COMMAND, IDW_TOOLBAR); // toggle tool bar on/off
628 needLayout = false; // layout already done now by decorated frame.
629 }
630
631 // Now do layout once at the end to reduce repaint
632 //
633 if (needLayout)
634 Layout();
635
636 return true;
637}
638
639//
640/// Responds to an OC_APPSTATUSTEXT message by displaying text from the server on
641/// this container's status bar.
642//
643void
645{
646 PRECONDITION(text);
648 if (mb) {
649 //mb->SetHintText(text); // is the text a hint, or general status??
650 mb->SetText(text);
651 }
652}
653
654//
655/// Stores a local copy of the pop-up menus so they can be used for menu merging and
656/// then destroyed later by DestroyStashedPopups. shMenuDescr is the shared menu
657/// descriptor to be stored. Increments StashCount each time the pop-up menus are saved.
658//
660{
661 StashCount++;
662
663 int m = 0;
664 for (int i = 0; i < 6; i++) {
665 if (i%2 == 0)
666 for (int j = 0; j < shMenuDescr.GetGroupCount(i); j++) {
667 uint state = shMenuDescr.GetMenuState(m+j, MF_BYPOSITION);
668 if (state == uint(-1))
669 continue;
670 TRACEX(OcfOleMenu, 1, _T("Stashing ") << hex << static_cast<void*>(shMenuDescr.GetSubMenu(m+j)));
671 StashedContainerPopups.AppendMenu(state, TMenu(shMenuDescr.GetSubMenu(m+j)), _T(""));
672 }
673 m += shMenuDescr.GetGroupCount(i);
674 }
675}
676
677//
678/// Destroys the previously stored shared pop-up menus. Checks to see if StashCount
679/// is 0 before destroying the menus.
680//
682{
683 if (--StashCount)
684 return;
685
686 while (StashedContainerPopups.GetMenuItemCount()) {
687 TRACEX(OcfOleMenu, 1, _T("Destroying ") << hex << static_cast<void*>(StashedContainerPopups.GetSubMenu(0)));
688 StashedContainerPopups.DeleteMenu(0, MF_BYPOSITION);
689 }
690}
691
692//
693/// Responds to an OC_APPRESTOREUI message by restoring the container's normal menu
694/// and borders because in-place editing has finished.
695//
696void
698{
699 // Only restore the old menu if we are holding a merged one
700 //
701 if (HOldMenu) {
702 TRACEX(OcfOleMenu, 0, _T("EvOcAppRestoreUI resetting Old ") << hex <<
703 static_cast<void*>(HOldMenu));
704 TMenu oleMenu(GetHandle());
705 SetMenu(HOldMenu); // assumes we are just restoring the old owl menu
706 HOldMenu = 0;
707 }
708
709 // Remove pad decorations & restore our toobar if we have one
710 //
712}
713
714//
715/// Responds to an OC_APPSHUTDOWN message indicating that the last embedded object
716/// has been closed. The response is to shut down the server.
717//
718bool
720{
721 // If TOleFrame was created purely for embedded server, then
722 // we want to shut down the app when nobody is using the server.
723 // The amEmbedding flag will be set to false if user created normal
724 // document in this frame.
725 //
726 if (OcShutDown == DontCare && OcApp->IsOptionSet(amEmbedding)) {
727 // The shut down is initiated by OCF
728 //
729 OcShutDown = ServerInitiated;
730
731 // Post frame close to kill the app later
732 //
733 PostMessage(WM_CLOSE);
734
735 return true;
736 }
737 else {
738
739 // If the last view closing caused the ocapp to shutdown, then close this
740 // frame.
741 //
742 if (OcApp->IsOptionSet(amEmbedding) && OcShutDown == ViewInitiated)
743 PostMessage(WM_CLOSE);
744
745 return false; // Shut down initiated by user
746 }
747}
748
749} // OCF namespace
750
751//==============================================================================
752
#define CHECK(condition)
Definition checks.h:239
#define PRECONDITION(condition)
Definition checks.h:227
#define TRACEX(group, level, message)
Definition checks.h:263
OCF Application host class. Owner of & host for a TOcApp object.
Definition ocapp.h:367
TOcApp * OcApp
Definition ocapp.h:382
OCF Application class.
Definition ocapp.h:144
void SetOcApp(TOcApp *app)
Initial set of OcApp being passed to us to use.
Definition oleframe.cpp:257
HMENU HOldMenu
Stores the handle to the container's previously saved copy of the menu.
Definition oleframe.h:115
owl::TResult EvOcEvent(owl::TParam1 param1, owl::TParam2 param2)
Responds to a WM_OCEVENT message and subdispatches it to one of the EvOcXxxx event-handling functions...
Definition oleframe.cpp:449
int StashCount
Holds the number of menu bars that have been stored.
Definition oleframe.h:112
void EvSize(owl::uint sizeType, const owl::TSize &size)
Passes a WM_SIZE message to TLayoutWindow.
Definition oleframe.cpp:407
owl::TMenu StashedContainerPopups
Holds the stored, shared pop-up menus.
Definition oleframe.h:108
void Destroy(int retVal) override
Checks with all the connected servers to ensure that they can close before destroying the frame windo...
Definition oleframe.cpp:363
void EvActivateApp(bool active, DWORD threadId)
Responds to a EV_WM_ACTIVATEAPP message sent when a window is activated or deactivated.
Definition oleframe.cpp:424
TOleFrame(LPCTSTR title, owl::TWindow *clientWnd, bool trackMenuSelection=false, owl::TModule *module=0)
Constructs a TOleFrame object with the specified caption for the frame window (title),...
Definition oleframe.cpp:219
bool EvOcAppBorderSpaceReq(owl::TRect *rect)
Responds to an OC_APPBORDERSPACEREQ message sent to a container.
Definition oleframe.cpp:590
void EvOcAppRestoreUI()
Responds to an OC_APPRESTOREUI message by restoring the container's normal menu and borders because i...
Definition oleframe.cpp:697
~TOleFrame()
Destroys a TOleFrame object.
Definition oleframe.cpp:246
bool EvOcAppProcessMsg(MSG *msg)
Responds to an EV_OC_APPROCESSMSG message sent to the container asking the server to process accelera...
Definition oleframe.cpp:562
void DestroyStashedPopups()
Destroys the previously stored shared pop-up menus.
Definition oleframe.cpp:681
TOcApp * OcApp
Points to the ObjectComponents application associated with this frame window.
Definition oleframe.h:105
void AddUserFormatName(LPCTSTR name, LPCTSTR resultName, LPCTSTR id)
Adds user defined formats and the corresponding names to the list of Clipboard formats.
Definition oleframe.cpp:316
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
bool EvOcAppInsMenus(TOcMenuDescr &sharedMenu)
Responds to an EV_OC_APPINSMENUS message by merging the container's menu into the shared menu.
Definition oleframe.cpp:476
bool EvOcAppShutdown()
Responds to an OC_APPSHUTDOWN message indicating that the last embedded object has been closed.
Definition oleframe.cpp:719
void EvTimer(owl::uint timerId)
If this is a DLL server, EvTimer responds to a timer message by running an idle loop if the message q...
Definition oleframe.cpp:435
bool EvOcAppFrameRect(owl::TRect *rect)
Responds to an OC_APPFRAMERECT message sent to a container.
Definition oleframe.cpp:572
void SetupWindow() override
Associates the ObjectComponents application with the window's HWND so that the TOcApp and the window ...
Definition oleframe.cpp:276
bool EvOcAppMenus(TOcMenuDescr &md)
Responds to an OC_OCAPPMENUS sent to the container.
Definition oleframe.cpp:526
void OleViewClosing(bool close)
Sets the OcShutDown data member to ViewInitiated (if close is true and OcShutDown = DontCare) or Dont...
Definition oleframe.cpp:329
void EvOcAppStatusText(LPCTSTR rect)
Responds to an OC_APPSTATUSTEXT message by displaying text from the server on this container's status...
Definition oleframe.cpp:644
void CleanupWindow() override
Performs normal window cleanup of any HWND-related resources.
Definition oleframe.cpp:300
bool EvOcAppBorderSpaceSet(owl::TRect *rect)
Responds to an OC_APPBORDERSPACESET message by making room in the container's frame window for the bo...
Definition oleframe.cpp:600
The generic OLE2 window. Use as a client of a frame window.
Definition olewindo.h:91
virtual bool OleShutDown()
Shuts down the associated ObjectComponents partners, if possible.
TColor()
Construct a null color.
Definition color.h:509
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
TDecoratedFrame automatically positions its client window (you must supply a client window) so that i...
Definition decframe.h:74
TDecoratedFrame(TWindow *parent, LPCTSTR title, TWindow *clientWnd, bool trackMenuSelection=false, TModule *module=0)
Constructs a TDecoratedFrame object with the specified parent window (parent), window caption (title)...
Definition decframe.cpp:62
void EvSize(uint sizeType, const TSize &size)
Forward our size event to the layout window base, and not the frame base.
Definition decframe.cpp:460
TLocation
Enumeration describing the possible locations of a Gadgetwindow [Used mainly for location of Toolbar ...
Definition decframe.h:88
@ Bottom
Refers to bottom edge of frame.
Definition decframe.h:91
@ Top
Refers to top edge of frame.
Definition decframe.h:90
@ Left
Refers to left edge of frame.
Definition decframe.h:92
@ Right
Refers to right edge of frame.
Definition decframe.h:93
void SetupWindow() override
Override SetupWindow in order to layout & position decorations Calls TLayoutWindow::Layout to size an...
Definition decframe.cpp:148
virtual void Insert(TWindow &decoration, TLocation location=Top)
Insert a decoration window into position at one of the four edges.
Definition decframe.cpp:899
A nested class, TEventInfo provides specific information about the type of message sent,...
Definition eventhan.h:170
virtual bool Find(TEventInfo &info, TEqualOperator op=0)
Searches the list of response table entries looking for a match.
Definition eventhan.cpp:371
TResult Dispatch(TEventInfo &info, TParam1, TParam2=0)
Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handl...
Definition eventhan.cpp:396
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
Definition framewin.h:96
virtual TWindow * GetClientWindow()
Returns a pointer to the client window.
Definition framewin.cpp:592
virtual bool SetMenu(HMENU newMenu)
Overrides TWindow's non-virtual SetMenu function, thus allowing derived classes the opportunity to im...
Definition framewin.cpp:472
const TMenuDescr * GetMenuDescr() const
Returns a pointer to the menu descriptor for the frame window.
Definition framewin.h:316
When specifying the layout metrics for a window, four layout constraints are needed.
Definition layoutwi.h:54
virtual void Layout()
Causes the window to resize and position its children according to the specified metrics.
Definition layoutwi.cpp:351
bool GetChildLayoutMetrics(const TWindow &child, TLayoutMetrics &metrics)
Gets the layout metrics of the child window.
Definition layoutwi.cpp:500
void SetChildLayoutMetrics(TWindow &child, const TLayoutMetrics &metrics)
Sets the metrics for the window and removes any existing ones.
Definition layoutwi.cpp:465
Menu with information used to allow merging.
Definition menu.h:206
int GetGroupCount(int group) const
Gets the number of menus in a specified group within the menu bar.
Definition menu.h:303
bool Merge(const TMenuDescr &sourceMenuDescr)
Merges the functional groups of another menu descriptor into this menu descriptor.
Definition menudesc.cpp:329
The TMenu class encapsulates window menus.
Definition menu.h:77
uint GetMenuState(uint item, uint flags) const
Returns the menu flags for the menu item specified by item.
Definition menu.h:430
HMENU GetSubMenu(int posItem) const
Returns the handle of the menu specified by posItem.
Definition menu.h:446
Derived from TGadgetWindow, TMessageBar implements a message bar with one text gadget as wide as the ...
Definition messageb.h:36
void SetText(const tstring &text)
Forwards the message in the message bar to the text gadget for formatting.
Definition messageb.cpp:96
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:78
TNotify is a thin wrapper around the NMHDR structure.
Definition commctrl.h:91
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
bool KillTimer(UINT_PTR timerId)
Gets rid of the timer and removes any WM_TIMER messages from the message queue.
Definition window.h:3325
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
Definition window.h:1855
void SetBkgndColor(TColor color, bool shouldUpdate=true)
Sets the background color for the window.
Definition window.h:1925
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...
Definition window.cpp:341
virtual void EvCommandEnable(TCommandEnabler &ce)
Called by WindowProc to handle WM_COMMAND_ENABLE messages, EvCommandEnable calls the CmXxxx command-h...
Definition window.cpp:1135
auto GetChildren()
Returns a TWindow::TChildrenRange that can be iterated by standard means.
Definition window.h:550
virtual void Destroy(int retVal=0)
Destroys an MS-Windows element associated with the TWindow.
Definition window.cpp:2160
void EvActivateApp(bool active, DWORD threadId)
The default message handler for WM_ACTIVATEAPP.
Definition window.h:3587
TWindow * GetParentO() const
Return the OWL's parent for this window.
Definition window.h:2006
TWindowAttr & GetWindowAttr()
Returns the TWindowAttr structure, which contains the window's creation attributes.
Definition window.h:1886
HMENU GetMenu() const
Returns the handle to the menu of the indicated window.
Definition window.h:3244
UINT_PTR SetTimer(UINT_PTR timerId, uint timeout, TIMERPROC proc=0)
Creates a timer object associated with this window.
Definition window.h:3339
virtual TResult EvCommand(uint id, HWND hWndCtl, uint notifyCode)
WindowProc calls EvCommand to handle WM_COMMAND messages.
Definition window.cpp:999
virtual TResult EvNotify(uint id, TNotify &notifyInfo)
Handles WM_NOTIFY and subdispatch messages from child controls.
Definition window.cpp:1075
bool PostMessage(TMsgId, TParam1=0, TParam2=0)
Posts a message (msg) to the window in the application's message queue.
Definition window.h:2103
bool IsWindowVisible() const
Returns true if the window is visible.
Definition window.h:2605
virtual bool ShowWindow(int cmdShow)
Displays this TWindow in a given state.
Definition window.cpp:3713
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
Definition window.cpp:3288
void EvTimer(uint timerId)
The default message handler for WM_TIMER.
Definition window.h:4178
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
Definition window.cpp:3624
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
auto ChildWithId(int id) const -> const TWindow *
Definition window.h:681
Definition of classes for CommonControl encapsulation.
char TCHAR
Definition cygwin.h:42
#define _T(x)
Definition cygwin.h:51
Definition of TDecoratedMDIFrame class.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition eventhan.h:492
#define NoErase
don't erase, wait for Paint
Definition window.h:116
#define ocrEmbedSource
Definition registry.h:638
#define ocrLinkSource
Definition registry.h:640
#define ocrEmbeddedObject
Definition registry.h:639
Include for OC, gets common headers when precompiled headers are enabled.
char * strnewdup(const char *s, size_t minAllocSize=0)
Definition memory.cpp:25
Object Component Framework (COM encapsulation).
Definition appdesc.h:22
const int IDT_DLLIDLE
Definition oleframe.h:33
EV_OC_APPFRAMERECT
Definition oleframe.cpp:204
EV_OC_APPMENUS
Definition oleframe.cpp:202
EV_OC_APPPROCESSMSG
Definition oleframe.cpp:203
const TDecoratedFrame::TLocation SpaceLoc[]
Definition oleframe.cpp:33
EV_OC_APPSTATUSTEXT
Definition oleframe.cpp:207
EV_OC_APPSHUTDOWN
Definition oleframe.cpp:209
EV_OC_APPBORDERSPACEREQ
Definition oleframe.cpp:205
const int IDW_REMVIEWBUCKET
Definition oleframe.h:32
EV_OC_APPINSMENUS
Definition oleframe.cpp:201
EV_OC_APPBORDERSPACESET
Definition oleframe.cpp:206
_T("!ForeColor")
const int DllIdleTime
Definition oleframe.cpp:29
EV_OC_APPRESTOREUI
Definition oleframe.cpp:208
const int IDW_PADDECORATION
Definition oleframe.h:31
@ amExeMode
may be overridden per instance if running DLL
Definition ocreg.h:88
@ amEmbedding
cmdline, overridden per Instance if embedded DLL
Definition ocreg.h:82
const int IDW_TOOLBAR
Definition decframe.h:24
TWindow * GetWindowPtr(HWND, const TApplication *)
Raw function to retrieve a TWindow pointer given an HWND from the a given app, or any app (app==0).
Definition window.cpp:1557
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
const int IDW_STATUSBAR
Definition messageb.h:25
LRESULT TResult
Result type.
Definition dispatch.h:52
EV_WM_TIMER
Definition propsht.cpp:34
unsigned int uint
Definition number.h:25
DIAG_DEFINE_GROUP_INIT(OWL_INI, OwlApp, 1, 0)
EV_MESSAGE(BM_SETSTYLE, BMSetStyle)
EV_WM_SIZE
Definition decframe.cpp:34
#define WM_OCEVENT
Definition ocapp.h:337
Definition of OWL signatures for ObjectComponents messages.
TOleWindow - Class encapsulating a window which can be an OLE container or server window.
#define OWL_INI
Definition defs.h:170
#define TYPESAFE_DOWNCAST(object, toClass)
Definition defs.h:269
Definition of class TStatusBar.
int W
width of the window
Definition window.h:341
int H
height of the window
Definition window.h:342