0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()
[occt.git] / src / Message / Message_ProgressScale.hxx
CommitLineData
42cf5bc1 1// Created on: 2002-02-20
2// Created by: Andrey BETENEV
3// Copyright (c) 2002-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _Message_ProgressScale_HeaderFile
17#define _Message_ProgressScale_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Real.hxx>
24#include <Standard_Boolean.hxx>
25#include <Standard_CString.hxx>
26class TCollection_HAsciiString;
27
28
29//! Internal data structure for scale in ProgressIndicator
30//!
31//! Basically it defines three things:
32//! - name that can be used for generating user messages
33//! - limits and characteristics of the current scale,
34//! along with derived coefficients to map it into basic scale [0-1]
35//! - methods for conversion of values from current scale
36//! to basic one and back
37//!
38//! NOTE: There is no special protection against bad input data
39//! like min > max etc. except cases when it can cause exception
40class Message_ProgressScale
41{
42public:
43
44 DEFINE_STANDARD_ALLOC
45
46
47 //! Creates scale ranged from 0 to 100 with step 1
48 Standard_EXPORT Message_ProgressScale();
49
50 void SetName (const Standard_CString theName);
51
52 //! Sets scale name
53 void SetName (const Handle(TCollection_HAsciiString)& theName);
54
55 //! Gets scale name
56 //! Name may be Null handle if not set
57 Handle(TCollection_HAsciiString) GetName() const;
58
59 //! Sets minimum value of scale
60 void SetMin (const Standard_Real theMin);
61
62 //! Gets minimum value of scale
63 Standard_Real GetMin() const;
64
65 //! Sets minimum value of scale
66 void SetMax (const Standard_Real theMax);
67
68 //! Gets minimum value of scale
69 Standard_Real GetMax() const;
70
71 //! Set both min and max
72 void SetRange (const Standard_Real min, const Standard_Real max);
73
74 //! Sets default step
75 void SetStep (const Standard_Real theStep);
76
77 //! Gets default step
78 Standard_Real GetStep() const;
79
80 //! Sets flag for infinite scale
81 void SetInfinite (const Standard_Boolean theInfinite = Standard_True);
82
83 //! Gets flag for infinite scale
84 Standard_Boolean GetInfinite() const;
85
86 //! Set all scale parameters
87 void SetScale (const Standard_Real min, const Standard_Real max, const Standard_Real step, const Standard_Boolean theInfinite = Standard_True);
88
89 //! Defines span occupied by the scale on the basis scale
90 void SetSpan (const Standard_Real first, const Standard_Real last);
91
92 Standard_Real GetFirst() const;
93
94 //! Return information on span occupied by the scale on the base scale
95 Standard_Real GetLast() const;
96
97 Standard_EXPORT Standard_Real LocalToBase (const Standard_Real val) const;
98
99 //! Convert value from this scale to base one and back
100 Standard_EXPORT Standard_Real BaseToLocal (const Standard_Real val) const;
101
102
103
104
105protected:
106
107
108
109
110
111private:
112
113
114
115 Handle(TCollection_HAsciiString) myName;
116 Standard_Real myMin;
117 Standard_Real myMax;
118 Standard_Real myStep;
119 Standard_Boolean myInfinite;
120 Standard_Real myFirst;
121 Standard_Real myLast;
122
123
124};
125
126
127#include <Message_ProgressScale.lxx>
128
129
130
131
132
133#endif // _Message_ProgressScale_HeaderFile