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
messageb.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 TMessageBar.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_MESSAGEB_H)
10#define OWL_MESSAGEB_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/gadgetwi.h>
18#include <map>
19
20namespace owl {
21
22
23#include <owl/preclass.h>
24
25const int IDW_STATUSBAR = 32040; // Window ID used to locate status bars
26
27/// \addtogroup gadgets
28/// @{
29/// \class TMessageBar
30// ~~~~~ ~~~~~~~~~~~
31/// Derived from TGadgetWindow, TMessageBar implements a message bar with one text
32/// gadget as wide as the window and no border. Normally positioned at the bottom of
33/// the window, the message bar uses the default gadget window font and draws a
34/// highlighted line at the top.
35//
37 public:
38 TMessageBar(TWindow* parent = nullptr,
39 TFont* font = nullptr,
40 TModule* module = nullptr);
41
42 // Set the text for the default text message gadget or a text gadget by id
43 //
44 void SetText(const tstring& text);
45 void SetMessageText(int id, const tstring& text);
46
47 /// Sets the hint text displayed on the messagebar.
48 /// The hint text overlaps the messagebar contents, so it is only meant to be displayed temporarily.
49 /// Call ClearHintText to remove the hint text and restore the messagebar.
50 /// Note: If a null-pointer or an empty string is passed, the hint text is cleared.
51 //
52 virtual void SetHintText(LPCTSTR text);
53
54 /// String-aware overload
55 //
56 void SetHintText(const tstring& text) {SetHintText(text.c_str());}
57
58 /// Clears the hint text, thus restoring the underlying content on the messagebar.
59 //
60 void ClearHintText();
61
62 protected:
63 // Compensate for highlight line
64 //
65 void GetInnerRect(TRect& rect);
66 void GetDesiredSize(TSize& rect);
67
68 // Draw highlight line, then HintText if any, or gadgets
69 //
70 void PaintGadgets(TDC& dc, bool erase, TRect& rect);
71
72 bool GetHighlightLine() const;
73 void SetHighlightLine(bool highlightline);
74
75 LPCTSTR GetHintText() const;
76
78 bool HighlightLine; ///< does this bar have a upper highlight line?
79 tstring HintText; ///< current command hint being displayed, if any
80
81 private:
82 std::map<const TGadget*, bool> GadgetVisibilityCache;
83
84 // Hidden to prevent accidental copying or assignment
85 //
88
90};
91
92/// @}
93
94#include <owl/posclass.h>
95
96
97//----------------------------------------------------------------------------
98// Inline implementations
99//
100
101//
102/// Returns true if the message bar has an upper highlight line.
103//
104inline bool TMessageBar::GetHighlightLine() const {
105 return HighlightLine;
106}
107
108//
109/// Sets the flag for the message bar to have an upper highlight line.
110//
112 HighlightLine = highlightline;
113}
114
115//
116/// Returns the cached hint text for the current message.
117//
119 return HintText.c_str();
120}
121
122
123} // OWL namespace
124
125
126#endif // OWL_MESSAGEB_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
Derived from TWindow, TGadgetWindow maintains a list of tiled gadgets for a window and lets you dynam...
Definition gadgetwi.h:122
Derived from TGadgetWindow, TMessageBar implements a message bar with one text gadget as wide as the ...
Definition messageb.h:36
void SetHintText(const tstring &text)
String-aware overload.
Definition messageb.h:56
bool GetHighlightLine() const
Returns true if the message bar has an upper highlight line.
Definition messageb.h:104
LPCTSTR GetHintText() const
Returns the cached hint text for the current message.
Definition messageb.h:118
void SetHighlightLine(bool highlightline)
Sets the flag for the message bar to have an upper highlight line.
Definition messageb.h:111
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
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
Definition of TGadgetList, TGadgetWindow & TGadgetWindowFont A list holding gadgets,...
#define DECLARE_CASTABLE
Definition objstrm.h:1440
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
const int IDW_STATUSBAR
Definition messageb.h:25
std::string tstring
Definition defs.h:79
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338