OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
tinycapt.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5//----------------------------------------------------------------------------
6
7#if !defined(OWL_TINYCAPT_H)
8#define OWL_TINYCAPT_H
9
10#include <owl/private/defs.h>
11#if defined(BI_HAS_PRAGMA_ONCE)
12# pragma once
13#endif
14
15#include <owl/window.h>
16
17
18namespace owl {
19
20class _OWLCLASS TFont;
21
22#include <owl/preclass.h>
23
24/// \addtogroup mixin
25/// @{
26//
27/// \class TTinyCaption
28// ~~~~~ ~~~~~~~~~~~~
29/// Derived from TWindow, TTinyCaption is a mix-in class that handles a set of
30/// non-client events to produce a smaller caption bar for a window. Whenever it
31/// displays the caption bar, TTinyCaption checks the window style and handles the
32/// WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX display attributes. Thus, you can use
33/// TTinyCaption to set the attributes of the tiny caption bar before enabling the
34/// caption. For example,
35/// \code
36/// Attr.Style = WS_POPUP | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX |
37/// WS_MAXIMIZEBOX;
38/// \endcode
39/// TTinyCaption provides functions that let you manipulate frame types, border
40/// styles, and menus. You can adjust the height of the caption bar or accept the
41/// default height, which is about one-half the height of a standard caption bar. If
42/// you set CloseBox to true, then the window will close when you click the close
43/// box instead of displaying the system menu.
44/// The sample program OWLCMD.CPP on BC5.02 distribution disk displays the following
45/// tiny caption bar:
46/// \image html bm263.BMP
47///
48/// If you are using TTinyCaption as a mix-in class that does partial event
49/// handling, call the DoXxxx function in the mix-in class (instead of the EvXxxx
50/// function) to avoid duplicating default processing. The following example from
51/// OWLCMD.CPP (a sample program on your distribution disk) illustrates this
52/// process:
53/// \code
54/// void TMyFrame::EvSysCommand(uint cmdType,TPoint& p)
55/// {
56/// if (TTinyCaption::DoSysCommand(cmdType, p) == esPartial)
57/// FrameWindow::EvSysCommand(cmdType, p);
58/// \endcode
59/// The TFLoatingFrame class can be used with TTinyCaption to produce a close box.
60/// See the sample programs OWLCMD.CPP and MDIFILE.CPP on BC5.0x distribution disk for
61/// examples of how to use TTinyCaption.
62//
63class _OWLCLASS TTinyCaption : public virtual TWindow {
64 protected:
66 ~TTinyCaption() override;
67
68 /// Pass closeBox=true to replace SystemMenu box with a box that will
69 /// close window when clicked
70 /// Used for floating palettes, etc.
71 //
72 void EnableTinyCaption(int ch=0, bool closeBox=false);
73
74 // Controller class must handle events that call these mixin handlers
75 //
76 TEventStatus DoNCHitTest(const TPoint& screenPt, uint& evRes);
77 TEventStatus DoNCPaint();
78 TEventStatus DoNCCalcSize(bool calcValidRects,
80 TEventStatus DoNCLButtonDown(uint hitTest, const TPoint& screenPt);
81 TEventStatus DoMouseMove(uint hitTest, const TPoint& screenPt);
82 TEventStatus DoLButtonUp(uint hitTest, const TPoint& screenPt);
83 TEventStatus DoNCActivate(bool active, bool& evRes);
85 TEventStatus DoSysCommand(uint cmdType, const TPoint& p);
86
87 void PaintButton(TDC& dc, TRect& boxRect, bool pressed);
88 void PaintCloseBox(TDC& dc, TRect& boxRect, bool pressed);
89 void PaintSysBox(TDC& dc, TRect& boxRect, bool pressed);
90 void PaintMinBox(TDC& dc, TRect& boxRect, bool pressed);
91 void PaintMaxBox(TDC& dc, TRect& boxRect, bool pressed);
92 void PaintCaption(bool active);
93 void DoSysMenu();
94
95 TRect GetCaptionRect(); // Get caption area for hit test or paint
96 TRect GetSysBoxRect(); // Same for close box
97 TRect GetMinBoxRect();
98 TRect GetMaxBoxRect();
99
100 uint EvNCHitTest(const TPoint& screenPt);
101 void EvNCPaint(HRGN);
102 uint EvNCCalcSize(bool calcValidRects, NCCALCSIZE_PARAMS & calcSize);
103 void EvNCLButtonDown(uint hitTest, const TPoint& screenPt);
104 void EvMouseMove(uint hitTest, const TPoint& screenPt);
105 void EvLButtonUp(uint hitTest, const TPoint& screenPt);
106 bool EvNCActivate(bool active);
107 auto EvCommand(uint id, HWND hWndCtl, uint notifyCode) -> TResult override;
108 void EvSysCommand(uint cmdType, const TPoint& p);
109
111 // Cache system metrics
112 //
113 TSize Border; ///< Thin frame border size for dividers
114 TSize Frame; ///< Actual Left and Right, Top and Bottom frame size
115
116 bool CloseBox; ///< True for special close box
117 bool TCEnabled; ///< Is true if the tiny caption bar is displayed.
118 int CaptionHeight; ///< Height of the caption bar.
119 TFont* CaptionFont; ///< Tiny font for caption bar
120 uint DownHit; ///< Mouse down hit test result
121 bool IsPressed; ///< Is a button currently pressed
122 bool WaitingForSysCmd; ///< Is true if TTinyCaption is ready to receive system messages.
123
124 private:
125 // Hidden to prevent accidental copying or assignment
126 //
129
132};
133
135
136/// @}
137
138#include <owl/posclass.h>
139
140
141} // OWL namespace
142
143
144#endif // OWL_TINYCAPT_H
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
Definition gdiobjec.h:296
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
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
#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
LRESULT TResult
Result type.
Definition dispatch.h:52
unsigned int uint
Definition number.h:25
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338
Base window class TWindow definition, including HWND encapsulation.