0028478: Scope Names Are Swallowed in Message_ProgressSentry Constructors
[occt.git] / src / Draw / Draw_ProgressIndicator.hxx
CommitLineData
42cf5bc1 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>
42cf5bc1 20
42cf5bc1 21#include <Message_ProgressIndicator.hxx>
22#include <Draw_Interpretor.hxx>
23
42cf5bc1 24class Draw_ProgressIndicator;
25DEFINE_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
30class Draw_ProgressIndicator : public Message_ProgressIndicator
31{
32
33public:
34
35
6b55f8e3 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.);
42cf5bc1 42
43 //! Destructor; calls Reset()
6b55f8e3 44 Standard_EXPORT ~Draw_ProgressIndicator();
42cf5bc1 45
46 //! Sets text output mode (on/off)
47 Standard_EXPORT void SetTextMode (const Standard_Boolean theTextMode);
48
49 //! Gets text output mode (on/off)
50 Standard_EXPORT Standard_Boolean GetTextMode() const;
51
52 //! Sets graphical output mode (on/off)
53 Standard_EXPORT void SetGraphMode (const Standard_Boolean theGraphMode);
54
55 //! Gets graphical output mode (on/off)
56 Standard_EXPORT Standard_Boolean GetGraphMode() const;
57
58 //! Clears/erases opened TCL windows if any
59 //! and sets myBreak to False
60 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
61
62 //! Defines method Show of Progress Indicator
63 Standard_EXPORT virtual Standard_Boolean Show (const Standard_Boolean force = Standard_True) Standard_OVERRIDE;
64
65 //! Redefines method UserBreak of Progress Indicator
66 Standard_EXPORT virtual Standard_Boolean UserBreak() Standard_OVERRIDE;
67
68 Standard_EXPORT static Standard_Boolean& DefaultTextMode();
69
70 //! Get/Set default values for output modes
71 Standard_EXPORT static Standard_Boolean& DefaultGraphMode();
72
68299304 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();
42cf5bc1 76
92efcf78 77 DEFINE_STANDARD_RTTIEXT(Draw_ProgressIndicator,Message_ProgressIndicator)
42cf5bc1 78
42cf5bc1 79private:
42cf5bc1 80 Standard_Boolean myTextMode;
81 Standard_Boolean myGraphMode;
82 Standard_Address myDraw;
83 Standard_Boolean myShown;
84 Standard_Boolean myBreak;
6b55f8e3 85 Standard_Real myUpdateThreshold;
86 Standard_Real myLastPosition;
42cf5bc1 87 Standard_Size myStartTime;
42cf5bc1 88};
89
42cf5bc1 90#endif // _Draw_ProgressIndicator_HeaderFile