973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <Message_ProgressScale.hxx> |
15 | #include <TCollection_HAsciiString.hxx> |
b311480e |
16 | |
7fd59977 |
17 | //======================================================================= |
18 | //function : SetName |
19 | //purpose : |
20 | //======================================================================= |
21 | |
22 | inline void Message_ProgressIndicator::SetName (const Standard_CString name) |
23 | { |
24 | if (name != 0) |
25 | myScopes.ChangeValue(1).SetName ( name ); |
26 | } |
27 | |
28 | //======================================================================= |
29 | //function : SetName |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | inline void Message_ProgressIndicator::SetName (const Handle(TCollection_HAsciiString) &name) |
34 | { |
35 | if (!name.IsNull()) |
36 | myScopes.ChangeValue(1).SetName ( name ); |
37 | } |
38 | |
39 | //======================================================================= |
40 | //function : SetRange |
41 | //purpose : |
42 | //======================================================================= |
43 | |
44 | inline void Message_ProgressIndicator::SetRange (const Standard_Real min, |
45 | const Standard_Real max) |
46 | { |
47 | myScopes.ChangeValue(1).SetRange ( min, max ); |
48 | } |
49 | |
50 | //======================================================================= |
51 | //function : SetStep |
52 | //purpose : |
53 | //======================================================================= |
54 | |
55 | inline void Message_ProgressIndicator::SetStep (const Standard_Real step) |
56 | { |
57 | myScopes.ChangeValue(1).SetStep ( step ); |
58 | } |
59 | |
60 | //======================================================================= |
61 | //function : SetInfinite |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | inline void Message_ProgressIndicator::SetInfinite (const Standard_Boolean isInf) |
66 | { |
67 | myScopes.ChangeValue(1).SetInfinite ( isInf ); |
68 | } |
69 | |
70 | //======================================================================= |
71 | //function : SetScale |
72 | //purpose : |
73 | //======================================================================= |
74 | |
75 | inline void Message_ProgressIndicator::SetScale (const Standard_CString name, |
76 | const Standard_Real min, |
77 | const Standard_Real max, |
78 | const Standard_Real step, |
79 | const Standard_Boolean isInf) |
80 | { |
81 | SetName ( name ); |
82 | SetScale ( min, max, step, isInf ); |
83 | } |
84 | |
85 | //======================================================================= |
86 | //function : Increment |
87 | //purpose : |
88 | //======================================================================= |
89 | |
90 | inline void Message_ProgressIndicator::Increment () |
91 | { |
92 | Increment ( myScopes(1).GetStep() ); |
93 | } |
94 | |
95 | //======================================================================= |
96 | //function : Increment |
97 | //purpose : |
98 | //======================================================================= |
99 | |
100 | inline void Message_ProgressIndicator::Increment (const Standard_Real step) |
101 | { |
102 | SetValue ( GetValue() + step ); |
103 | } |
104 | |
105 | //======================================================================= |
106 | //function : NewScope |
107 | //purpose : |
108 | //======================================================================= |
109 | |
110 | inline Standard_Boolean Message_ProgressIndicator::NewScope (const Standard_CString name) |
111 | { |
112 | return NewScope ( name ? new TCollection_HAsciiString ( name ) : 0 ); |
113 | } |
114 | |
115 | //======================================================================= |
116 | //function : NewScope |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | inline Standard_Boolean Message_ProgressIndicator::NewScope (const Handle(TCollection_HAsciiString) &name) |
121 | { |
122 | return NewScope ( myScopes(1).GetStep(), name ); |
123 | } |
124 | |
125 | //======================================================================= |
126 | //function : NewScope |
127 | //purpose : |
128 | //======================================================================= |
129 | |
130 | inline Standard_Boolean Message_ProgressIndicator::NewScope (const Standard_Real span, |
131 | const Standard_CString name) |
132 | { |
133 | return NewScope ( span, name ? new TCollection_HAsciiString ( name ) : 0 ); |
134 | } |
135 | |
136 | //======================================================================= |
137 | //function : NextScope |
138 | //purpose : |
139 | //======================================================================= |
140 | |
141 | inline Standard_Boolean Message_ProgressIndicator::NextScope (const Standard_CString name) |
142 | { |
143 | return NextScope ( myScopes.Length() >1 ? myScopes(1).GetStep() : 1., name ); |
144 | } |
145 | |
146 | //======================================================================= |
147 | //function : GetPosition |
148 | //purpose : |
149 | //======================================================================= |
150 | |
151 | inline Standard_Real Message_ProgressIndicator::GetPosition () const |
152 | { |
153 | return myPosition; |
154 | } |
155 | |
156 | //======================================================================= |
157 | //function : GetNbScopes |
158 | //purpose : |
159 | //======================================================================= |
160 | |
161 | inline Standard_Integer Message_ProgressIndicator::GetNbScopes () const |
162 | { |
163 | return myScopes.Length(); |
164 | } |
165 | |
166 | //======================================================================= |
167 | //function : GetScope |
168 | //purpose : |
169 | //======================================================================= |
170 | |
171 | inline const Message_ProgressScale &Message_ProgressIndicator::GetScope (const Standard_Integer index) const |
172 | { |
173 | return myScopes(index); |
174 | } |