1 // Created on: 2008-06-25
2 // Created by: data exchange team
3 // Copyright (c) 2008-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 _Draw_ProgressIndicator_HeaderFile
17 #define _Draw_ProgressIndicator_HeaderFile
19 #include <Standard.hxx>
21 #include <Message_ProgressIndicator.hxx>
22 #include <Draw_Interpretor.hxx>
24 class Draw_ProgressIndicator;
25 DEFINE_STANDARD_HANDLE(Draw_ProgressIndicator, Message_ProgressIndicator)
27 //! Implements ProgressIndicator (interface provided by Message)
28 //! for DRAW, with possibility to output to TCL window
30 class Draw_ProgressIndicator : public Message_ProgressIndicator
36 //! Creates a progress indicator and remembers pointer to Draw_Interpretor
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.);
43 //! Destructor; calls Reset()
44 Standard_EXPORT ~Draw_ProgressIndicator();
46 //! Sets text output mode (on/off)
47 Standard_EXPORT void SetTextMode (const Standard_Boolean theTextMode);
49 //! Gets text output mode (on/off)
50 Standard_EXPORT Standard_Boolean GetTextMode() const;
52 //! Sets graphical output mode (on/off)
53 Standard_EXPORT void SetGraphMode (const Standard_Boolean theGraphMode);
55 //! Gets graphical output mode (on/off)
56 Standard_EXPORT Standard_Boolean GetGraphMode() const;
58 //! Clears/erases opened TCL windows if any
59 //! and sets myBreak to False
60 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
62 //! Defines method Show of Progress Indicator
63 Standard_EXPORT virtual Standard_Boolean Show (const Standard_Boolean force = Standard_True) Standard_OVERRIDE;
65 //! Redefines method UserBreak of Progress Indicator
66 Standard_EXPORT virtual Standard_Boolean UserBreak() Standard_OVERRIDE;
68 Standard_EXPORT static Standard_Boolean& DefaultTextMode();
70 //! Get/Set default values for output modes
71 Standard_EXPORT static Standard_Boolean& DefaultGraphMode();
73 //! Internal method for implementation of UserBreak mechanism;
74 //! note that it uses static variable and thus not thread-safe!
75 Standard_EXPORT static Standard_Address& StopIndicator();
77 DEFINE_STANDARD_RTTIEXT(Draw_ProgressIndicator,Message_ProgressIndicator)
80 Standard_Boolean myTextMode;
81 Standard_Boolean myGraphMode;
82 Standard_Address myDraw;
83 Standard_Boolean myShown;
84 Standard_Boolean myBreak;
85 Standard_Real myUpdateThreshold;
86 Standard_Real myLastPosition;
87 Standard_Size myStartTime;
90 #endif // _Draw_ProgressIndicator_HeaderFile