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
splashwi.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TSplashWindow
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_SPLASHWI_H)
10#define OWL_SPLASHWI_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/layoutwi.h>
18
19
20namespace owl {
21
22#include <owl/preclass.h>
23
24class _OWLCLASS TDib;
25class _OWLCLASS TPictureWindow;
26class _OWLCLASS TStatic;
27class _OWLCLASS TGauge;
28
29//
30/// \class TSplashWindow
31// ~~~~~ ~~~~~~~~~~~~~
32/// This class creates a layout window that contains a TPictureWindow and
33/// optionally, a TStatic and a TGauge.
34///
35/// The purpose is to display a temporary window that contains a bitmap
36/// and other information.
37///
38/// The temporary window can be closed by
39/// - a mouse click if the style has CaptureMouse turned on
40/// - a passage of time if the TimeOut data member is non-zero
41/// - explicitly deleting the TSplashWindow or calling its CloseWindow()
42//
44 public:
45 /// Styles for the splash window.
46 //
47 enum TStyle {
48 None = 0x0000, ///< No styles are applied
49 ShrinkToFit = 0x0001, ///< Resizes window to fit bitmap
50 MakeGauge = 0x0002, ///< Display a gauge to indicate progess
51 MakeStatic = 0x0004, ///< Display a text control
52 CaptureMouse = 0x0008, ///< Capture mouse clicks
53 };
54
55 // Constructor/destructor
56 //
57 TSplashWindow(const TDib& dib,
58 int width,
59 int height,
60 int style = None,
61 uint timeOut = 0, // in milliseconds
62 LPCTSTR title = 0,
63 TModule* module = 0);
64 ~TSplashWindow() override;
65
66 // Methods
67 //
68 void SetText(LPCTSTR text);
69 void SetText(const tstring& text) {SetText(text.c_str());}
70 void SetPercentDone(int percent);
71
72 // Overridden TWindow virtuals
73 //
74 auto Create() -> bool override;
75
76 protected:
77 void SetupWindow() override;
78 void CleanupWindow() override;
79
80 // Respond to messages
81 //
82 void EvLButtonDown(uint modKeys, const TPoint& point);
83 void EvTimer(uint timerId);
84
85 // Accessors
86 //
87 bool HasStyle(TStyle) const;
88 uint GetStyle() const;
89 TStatic* GetStatic();
90 TGauge* GetGauge();
91 uint GetTimeOut() const;
92
93 private:
94 uint Style;
95 TStatic* Static;
96 TGauge* Gauge;
97 TPictureWindow* PictWindow;
98 uint TimeOut;
99 bool CapturedMouse;
100
102};
103
104#include <owl/posclass.h>
105
106
107//----------------------------------------------------------------------------
108// Inline implementations
109//
110
111//
112/// Determines if the splash window has a particular style.
113//
114inline bool TSplashWindow::HasStyle(TStyle style) const
115{
116 return ToBool((GetStyle() & style) == static_cast<uint>(style));
117}
118
119//
120/// Returns the current style of the splash window.
121//
123{
124 return Style;
125}
126
127//
128/// Returns the static control used by the splash window. The static control is only
129/// created if the style includes MakeStatic.
130//
132{
133 return Static;
134}
135
136//
137/// Returns the gauge used by the splash window. The gauge control is only created
138/// if the style includes MakeGauge.
139//
141{
142 return Gauge;
143}
144
145//
146/// Returns the number of milliseconds for the splash window to automatically close.
147//
149{
150 return TimeOut;
151}
152
153
154} // OWL namespace
155
156
157#endif // OWL_SPLASHWI_H
Pseudo-GDI object Device Independent Bitmap (DIB) class.
Definition gdiobjec.h:795
A streamable class derived from TControl, TGauge defines the basic behavior of gauge controls.
Definition gauge.h:44
Derived from TWindow, TLayoutWindow provides functionality for defining the layout metrics for a wind...
Definition layoutwi.h:122
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
This class displays a dib in a window in different ways.
Definition pictwind.h:35
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
This class creates a layout window that contains a TPictureWindow and optionally, a TStatic and a TGa...
Definition splashwi.h:43
uint GetTimeOut() const
Returns the number of milliseconds for the splash window to automatically close.
Definition splashwi.h:148
void SetText(const tstring &text)
Definition splashwi.h:69
bool HasStyle(TStyle) const
Determines if the splash window has a particular style.
Definition splashwi.h:114
TStyle
Styles for the splash window.
Definition splashwi.h:47
uint GetStyle() const
Returns the current style of the splash window.
Definition splashwi.h:122
TStatic * GetStatic()
Returns the static control used by the splash window.
Definition splashwi.h:131
TGauge * GetGauge()
Returns the gauge used by the splash window.
Definition splashwi.h:140
An interface object that represents a static text interface element.
Definition static.h:36
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
Definition of classes TLayoutMetrics & TLayoutWindow.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
bool ToBool(const T &t)
Definition defs.h:291
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338