0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Draw / Draw_ProgressIndicator.hxx
1 // Created on: 2008-06-25
2 // Created by: data exchange team
3 // Copyright (c) 2008-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 _Draw_ProgressIndicator_HeaderFile
17 #define _Draw_ProgressIndicator_HeaderFile
18
19 #include <Standard.hxx>
20
21 #include <Message_ProgressIndicator.hxx>
22 #include <Draw_Interpretor.hxx>
23
24 class Draw_ProgressIndicator;
25 DEFINE_STANDARD_HANDLE(Draw_ProgressIndicator, Message_ProgressIndicator)
26
27 //! Implements ProgressIndicator (interface provided by Message)
28 //! for DRAW, with possibility to output to TCL window
29 //! and/or trace file
30 class Draw_ProgressIndicator : public Message_ProgressIndicator
31 {
32
33 public:
34
35   
36   //! Creates a progress indicator and remembers pointer to Draw_Interpretor
37   //!
38   //! @param theUpdateThreshold defines minimal progress (in percents) between
39   //! updates of the indicator (non-forced updates of the progress bar will be
40   //! disabled until that progress is reached since last update).
41   Standard_EXPORT Draw_ProgressIndicator(const Draw_Interpretor& di, Standard_Real theUpdateThreshold = 1.);
42   
43   //! Destructor; calls Reset()
44   Standard_EXPORT ~Draw_ProgressIndicator();
45   
46   //! Sets tcl output mode (on/off).
47   Standard_EXPORT void SetTclMode (const Standard_Boolean theTclMode);
48   
49   //! Gets tcl output mode (on/off). 
50   Standard_EXPORT Standard_Boolean GetTclMode() const;
51
52   //! Sets console output mode (on/off).
53   //! If it is on then progress is shown in the standard output.
54   Standard_EXPORT void SetConsoleMode(const Standard_Boolean theMode);
55
56   //! Gets console output mode (on/off)
57   Standard_EXPORT Standard_Boolean GetConsoleMode() const;
58
59   //! Sets graphical output mode (on/off)
60   Standard_EXPORT void SetGraphMode (const Standard_Boolean theGraphMode);
61   
62   //! Gets graphical output mode (on/off)
63   Standard_EXPORT Standard_Boolean GetGraphMode() const;
64
65   //! Clears/erases opened TCL windows if any
66   //! and sets myBreak to False
67   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
68   
69   //! Defines method Show of Progress Indicator
70   Standard_EXPORT virtual void Show (const Message_ProgressScope& theScope, 
71                                      const Standard_Boolean force = Standard_True) Standard_OVERRIDE;
72   
73   //! Redefines method UserBreak of Progress Indicator
74   Standard_EXPORT virtual Standard_Boolean UserBreak() Standard_OVERRIDE;
75   
76   //! Get/Set default value for tcl mode
77   Standard_EXPORT static Standard_Boolean& DefaultTclMode();
78
79   //! Get/Set default value for console mode
80   Standard_EXPORT static Standard_Boolean& DefaultConsoleMode();
81
82   //! Get/Set default value for graph mode
83   Standard_EXPORT static Standard_Boolean& DefaultGraphMode();
84
85   //! Internal method for implementation of UserBreak mechanism;
86   //! note that it uses static variable and thus not thread-safe! 
87   Standard_EXPORT static Standard_Address& StopIndicator();
88
89   DEFINE_STANDARD_RTTIEXT(Draw_ProgressIndicator,Message_ProgressIndicator)
90
91 private:
92   Standard_Boolean myTclMode;
93   Standard_Boolean myConsoleMode;
94   Standard_Boolean myGraphMode;
95   Draw_Interpretor* myDraw;
96   Standard_Boolean myShown;
97   Standard_Boolean myBreak;
98   Standard_Real myUpdateThreshold;
99   Standard_Real myLastPosition;
100   Standard_Size myStartTime;
101   Standard_ThreadId myGuiThreadId;
102 };
103
104 #endif // _Draw_ProgressIndicator_HeaderFile