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
statusba.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 TStatusBar.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_STATUSBA_H)
10#define OWL_STATUSBA_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/messageb.h>
18#include <owl/textgadg.h>
19
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup gadgets
26/// @{
27//
28/// \class TStatusBar
29// ~~~~~ ~~~~~~~~~~
30/// Status bars have more options than a plain message bar: you can have
31/// multiple text gadgets, different style borders, and you can reserve space
32/// for mode indicators
33//
35 public:
36/// Enumerates the keyboard modes. By default, these are arranged horizontally on
37/// the status bar from left to right. Sets the extended selection, CapsLock,
38/// NumLock, ScrollLock, Overtype, recording macro, and size grip indicators.
40 ExtendSelection = 1,
41 CapsLock = 1 << 1,
42 NumLock = 1 << 2,
43 ScrollLock = 1 << 3,
44 Overtype = 1 << 4,
45 RecordingMacro = 1 << 5,
46 SizeGrip = 1 << 6
47 };
48
49 TStatusBar(TWindow* parent = 0,
50 TGadget::TBorderStyle borderStyle = TGadget::Recessed,
52 TFont* font = 0,
53 TModule* module = 0);
54
55 /// By default, adds "gadget" after the existing text gadgets and before
56 /// the mode indicator gadgets. Sets the border style to the style specified
57 /// during construction.
58 //
59 void Insert(TGadget&, TPlacement = After, TGadget* sibling = nullptr) override;
60
61 /// Overriden method of TMessageBar to use our own text gadget
62 /// Set (or clear if 0) menu/command item hint text displayed in/on bar
63 //
64 void SetHintText(LPCTSTR text) override;
65
66 // Access string-aware overload
67 //
68 using TMessageBar::SetHintText;
69
70 // In order for the mode indicator status to appear you must have
71 // specified the mode when the window was constructed
72 //
73 bool GetModeIndicator(TModeIndicator i) const;
74 void SetModeIndicator(TModeIndicator, bool state);
75 void ToggleModeIndicator(TModeIndicator);
76
82
83 /// Sets the spacing to be used between mode indicator gadgets
84 //
85 void SetSpacing(const TSpacing& spacing);
86
87 /// Control whether hint text is display over the whole window or in
88 /// a text gadget.
89 //
90 void SetWideHints(bool on);
91
92 protected:
93 void PositionGadget(TGadget* previous, TGadget* next, TPoint&) override;
94 TSpacing& GetSpacing();
95
96 uint GetNumModeIndicators();
97 uint GetModeIndicators() const;
98 void SetModeIndicators(uint modeindicators);
99
100 ///BGM SetModeIndicators is nearly useless; after construction, TStatusBar
101 ///BGM pays almost no attention to the ModeIndicators member
102
103 void EvOwlFrameSize(uint sizeType, const TSize&);
104 uint EvNCHitTest(const TPoint& point);
105
107/// One of the enumerated border styles--None, Plain, Raised, Recessed, or
108/// Embossed--used by the mode indicators on the status bar.
109 TGadget::TBorderStyle BorderStyle;
110
111/// Specifies the spacing between mode indicators on the status bar.
112 TSpacing Spacing;
113
114/// Specifies the number of mode indicators, which can range from 1 to 5.
115 uint NumModeIndicators;
116
117/// The ModeIndicators bit field indicates which mode indicators have been created
118/// for the status bar.
119 uint ModeIndicators;
120
121/// Specifies the mode of the status bar. This can be any one of the values of
122/// TModeIndicator enum, such as CapsLock, NumLock, ScrollLock, Overtype,
123/// RecordingMacro, or ExtendSelection.
124 uint ModeIndicatorState;
125
126 bool WideHintText;
127
128 private:
129 bool GetGadgetAndStrings(TModeIndicator mode, TTextGadget*& gadget,
130 LPCTSTR& strOn);
131 bool IsModeIndicator(TGadget* gadget);
132
133 void InsertSizeGrip(void);
134
135 // Hidden to prevent accidental copying or assignment
136 //
137 TStatusBar(const TStatusBar&);
139
141
143};
144
145/// @}
146
147#include <owl/posclass.h>
148
149
150//----------------------------------------------------------------------------
151// Inline implementations
152//
153//
154
155//
156/// Returns the current status bar mode indicator.
157//
159 return (ModeIndicatorState & i) ? 1 : 0;
160}
161
162//
163/// Initialize spacing.
164//
169
170//
171/// Uses the TSpacing values to set the spacing to be used between mode indicator
172/// gadgets. TSpacing sets the status-bar margins in layout units. Typically, the
173/// message indicator (the leftmost text gadget) is left-justified on the status bar
174/// and the other indicators are right-justified. See TLayoutMetrics for a detailed
175/// explanation of layout units and constraints.
176/// \code
177/// struct TSpacing {
178/// TMargins::TUnits Units;
179/// int Value;
180/// TSpacing() { Units = TMargins::LayoutUnits; Value = 0;}
181/// };
182/// \endcode
184 Spacing = spacing;
185}
186
187//
188/// Returns the spacing between the mode indicator gadgets.
189//
191 return Spacing;
192}
193
194//
195/// Returns the number of mode indicators that are on.
196//
198 return NumModeIndicators;
199}
200
201//
202/// Returns the bit flags for which indicator is on.
203//
205 return ModeIndicators;
206}
207
208//
209/// Sets the bit flags for which indicator is on.
210//
212 ModeIndicators = modeindicators;
213}
214
215//
216/// Informs the StatusBar whether hints should be displayed in a text gadget
217/// (on == false) or over the area of the whole statusbar (on == true).
218//
219inline void TStatusBar::SetWideHints(bool on) {
220 WideHintText = on;
221}
222
223} // OWL namespace
224
225
226#endif // OWL_STATUSBA_H
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
Definition gdiobjec.h:296
TGadget is the base class for the following derived gadget classes:
Definition gadget.h:120
TBorderStyle
Gadget border styles.
Definition gadget.h:127
Derived from TGadgetWindow, TMessageBar implements a message bar with one text gadget as wide as the ...
Definition messageb.h:36
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
Status bars have more options than a plain message bar: you can have multiple text gadgets,...
Definition statusba.h:34
TModeIndicator
Enumerates the keyboard modes.
Definition statusba.h:39
uint GetModeIndicators() const
Returns the bit flags for which indicator is on.
Definition statusba.h:204
void SetWideHints(bool on)
Control whether hint text is display over the whole window or in a text gadget.
Definition statusba.h:219
void SetSpacing(const TSpacing &spacing)
Sets the spacing to be used between mode indicator gadgets.
Definition statusba.h:183
bool GetModeIndicator(TModeIndicator i) const
Returns the current status bar mode indicator.
Definition statusba.h:158
TSpacing & GetSpacing()
Returns the spacing between the mode indicator gadgets.
Definition statusba.h:190
uint GetNumModeIndicators()
Returns the number of mode indicators that are on.
Definition statusba.h:197
void SetModeIndicators(uint modeindicators)
Sets the bit flags for which indicator is on.
Definition statusba.h:211
Derived from TGadget, TTextGadget is a text gadget object.
Definition textgadg.h:37
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_CASTABLE
Definition objstrm.h:1440
Definition of class TMessageBar.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned int uint
Definition number.h:25
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338
TMargins::TUnits Units
Definition statusba.h:78
TSpacing()
Initialize spacing.
Definition statusba.h:165
Definition of text gadget class TGadget.