1 // Created on: 2002-02-20
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Message_ProgressScale_HeaderFile
17 #define _Message_ProgressScale_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Standard_Real.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_CString.hxx>
26 class TCollection_HAsciiString;
29 //! Internal data structure for scale in ProgressIndicator
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
38 //! NOTE: There is no special protection against bad input data
39 //! like min > max etc. except cases when it can cause exception
40 class Message_ProgressScale
47 //! Creates scale ranged from 0 to 100 with step 1
48 Standard_EXPORT Message_ProgressScale();
50 void SetName (const Standard_CString theName);
53 void SetName (const Handle(TCollection_HAsciiString)& theName);
56 //! Name may be Null handle if not set
57 Handle(TCollection_HAsciiString) GetName() const;
59 //! Sets minimum value of scale
60 void SetMin (const Standard_Real theMin);
62 //! Gets minimum value of scale
63 Standard_Real GetMin() const;
65 //! Sets minimum value of scale
66 void SetMax (const Standard_Real theMax);
68 //! Gets minimum value of scale
69 Standard_Real GetMax() const;
71 //! Set both min and max
72 void SetRange (const Standard_Real min, const Standard_Real max);
75 void SetStep (const Standard_Real theStep);
78 Standard_Real GetStep() const;
80 //! Sets flag for infinite scale
81 void SetInfinite (const Standard_Boolean theInfinite = Standard_True);
83 //! Gets flag for infinite scale
84 Standard_Boolean GetInfinite() const;
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);
89 //! Defines span occupied by the scale on the basis scale
90 void SetSpan (const Standard_Real first, const Standard_Real last);
92 Standard_Real GetFirst() const;
94 //! Return information on span occupied by the scale on the base scale
95 Standard_Real GetLast() const;
97 Standard_EXPORT Standard_Real LocalToBase (const Standard_Real val) const;
99 //! Convert value from this scale to base one and back
100 Standard_EXPORT Standard_Real BaseToLocal (const Standard_Real val) const;
115 Handle(TCollection_HAsciiString) myName;
118 Standard_Real myStep;
119 Standard_Boolean myInfinite;
120 Standard_Real myFirst;
121 Standard_Real myLast;
127 #include <Message_ProgressScale.lxx>
133 #endif // _Message_ProgressScale_HeaderFile