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
floatfra.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TFloatingFrame.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_FLOATFRA_H)
10#define OWL_FLOATFRA_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/tinycapt.h>
19
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup frame
26/// @{
27//
28/// \class TFloatingFrame
29// ~~~~~ ~~~~~~~~~~~~~~
30/// Derived from TFrameWindow and TTinyCaption, TFloatingFrame implements a floating
31/// frame that can be positioned anywhere in the parent window. Except for the
32/// addition of a tiny caption bar, the default behavior of TFrameWindow and
33/// TFloatingFrame is the same. Therefore, an application that uses TFrameWindow can
34/// easily gain the functionality of TFloatingFrame by just changing the name of the
35/// class to TFloatingFrame.
36///
37/// If there is a client window, the floating frame shrinks to fit the client
38/// window, leaving room for margins on the top, bottom, left, and right of the
39/// frame. Because the floating frame expects the client window to paint its own
40/// background, it does nothing in response to a WM_ERASEBKGND message. However, if
41/// there is no client window, the floating frame erases the client area background
42/// using TColor::SysUIFace.
43///
44/// If popupPalette is true then, dragFrame is enabled, styles are set to popup
45/// with a tiny close box, and a border.
46///
47/// When dragFrame mode is enabled the floating frame adds an extra non-client
48/// margin around the outside to allow moving of the frame. This works well with
49/// a thin frame and is nice when the client area is too full to allow dragging
50/// from there.
51//
53 public:
54 TFloatingFrame(TWindow* parent,
55 LPCTSTR title = 0,
56 TWindow* clientWnd = 0,
57 bool shrinkToClient = false,
58 int captionHeight = DefaultCaptionHeight,
59 bool popupPalette = false,
60 TModule* module = 0);
61
63 TWindow* parent,
64 const tstring& title,
65 TWindow* client = 0,
66 bool shrinkToClient = false,
67 int captionHeight = DefaultCaptionHeight,
68 bool popupPalette = false,
69 TModule* = 0);
70
71 void SetMargins(const TSize& margin);
72 void SetDragFrame(bool dragFrame);
73
74 // Nameless union to declare a constant that is class scoped.
75 //
76 enum {
77 DefaultCaptionHeight = 0
78 };
79
80 protected:
81
82 void Init(int captionHeight, bool popupPalette);
83
84 // Override TWindow & TFrameWindow virtuals
85 //
86 auto GetCommandTarget() -> HWND override;
87 void EvCommandEnable(TCommandEnabler&) override;
88 auto EvCommand(uint id, HWND hWndCtl, uint notifyCode) -> TResult override;
89
90 /// Event handler helper
91 //
92 TEventStatus DoNCHitTest(const TPoint& screenPt, uint& evRes);
93
94 // Event Handlers
95 //
96 void EvSysCommand(uint cmdType, const TPoint& p);
97 uint EvNCCalcSize(bool calcValidRects, NCCALCSIZE_PARAMS & calcSize);
98 void EvNCPaint(HRGN);
99 uint EvNCHitTest(const TPoint& screenPt);
100 bool EvNCActivate(bool active);
101 uint EvMouseActivate(HWND hTopLevel, uint hitCode, TMsgId);
102 void EvActivateApp(bool active, DWORD taskId);
103
104 private:
105 TSize Margin; ///< Left and right, top and bottom
106 bool DragFrame; ///< True if frame edges are used to drag, not size window
107 bool AppearActive; ///< Current fake-activation appearance flag
108
111};
112/// @}
113
115
116#include <owl/posclass.h>
117
118//----------------------------------------------------------------------------
119// Inline implementations
120//
121
122//
123/// Sets the margins of the floating palette window to the size specified in margin
124/// and sets the height of the tiny caption bar.
125//
127{
128 Margin = margin;
129}
130
131//
132/// Sets the flag for additional dragging area.
133//
135{
136 DragFrame = dragFrame;
137}
138
139} // OWL namespace
140
141
142#endif // OWL_FLOATFRA_H
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
Derived from TFrameWindow and TTinyCaption, TFloatingFrame implements a floating frame that can be po...
Definition floatfra.h:52
void SetMargins(const TSize &margin)
Sets the margins of the floating palette window to the size specified in margin and sets the height o...
Definition floatfra.h:126
void SetDragFrame(bool dragFrame)
Sets the flag for additional dragging area.
Definition floatfra.h:134
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
Definition framewin.h:96
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
The tagSIZE struct is defined as.
Definition geometry.h:234
Derived from TWindow, TTinyCaption is a mix-in class that handles a set of non-client events to produ...
Definition tinycapt.h:63
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
TEventStatus
Mixin window event implementation return status.
Definition window.h:107
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
UINT TMsgId
Message ID type.
Definition dispatch.h:53
LRESULT TResult
Result type.
Definition dispatch.h:52
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338