Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-25 09:13:34

0001 // Created on: 2008-06-25
0002 // Created by: data exchange team
0003 // Copyright (c) 2008-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Draw_ProgressIndicator_HeaderFile
0017 #define _Draw_ProgressIndicator_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <Message_ProgressIndicator.hxx>
0022 #include <Draw_Interpretor.hxx>
0023 
0024 class Draw_ProgressIndicator;
0025 DEFINE_STANDARD_HANDLE(Draw_ProgressIndicator, Message_ProgressIndicator)
0026 
0027 //! Implements ProgressIndicator (interface provided by Message)
0028 //! for DRAW, with possibility to output to TCL window
0029 //! and/or trace file
0030 class Draw_ProgressIndicator : public Message_ProgressIndicator
0031 {
0032 
0033 public:
0034   //! Creates a progress indicator and remembers pointer to Draw_Interpretor
0035   //!
0036   //! @param theUpdateThreshold defines minimal progress (in percents) between
0037   //! updates of the indicator (non-forced updates of the progress bar will be
0038   //! disabled until that progress is reached since last update).
0039   Standard_EXPORT Draw_ProgressIndicator(const Draw_Interpretor& di,
0040                                          Standard_Real           theUpdateThreshold = 1.);
0041 
0042   //! Destructor; calls Reset()
0043   Standard_EXPORT ~Draw_ProgressIndicator();
0044 
0045   //! Sets tcl output mode (on/off).
0046   Standard_EXPORT void SetTclMode(const Standard_Boolean theTclMode);
0047 
0048   //! Gets tcl output mode (on/off).
0049   Standard_EXPORT Standard_Boolean GetTclMode() const;
0050 
0051   //! Sets console output mode (on/off).
0052   //! If it is on then progress is shown in the standard output.
0053   Standard_EXPORT void SetConsoleMode(const Standard_Boolean theMode);
0054 
0055   //! Gets console output mode (on/off)
0056   Standard_EXPORT Standard_Boolean GetConsoleMode() const;
0057 
0058   //! Sets graphical output mode (on/off)
0059   Standard_EXPORT void SetGraphMode(const Standard_Boolean theGraphMode);
0060 
0061   //! Gets graphical output mode (on/off)
0062   Standard_EXPORT Standard_Boolean GetGraphMode() const;
0063 
0064   //! Clears/erases opened TCL windows if any
0065   //! and sets myBreak to False
0066   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
0067 
0068   //! Defines method Show of Progress Indicator
0069   Standard_EXPORT virtual void Show(const Message_ProgressScope& theScope,
0070                                     const Standard_Boolean force = Standard_True) Standard_OVERRIDE;
0071 
0072   //! Redefines method UserBreak of Progress Indicator
0073   Standard_EXPORT virtual Standard_Boolean UserBreak() Standard_OVERRIDE;
0074 
0075   //! Get/Set default value for tcl mode
0076   Standard_EXPORT static Standard_Boolean& DefaultTclMode();
0077 
0078   //! Get/Set default value for console mode
0079   Standard_EXPORT static Standard_Boolean& DefaultConsoleMode();
0080 
0081   //! Get/Set default value for graph mode
0082   Standard_EXPORT static Standard_Boolean& DefaultGraphMode();
0083 
0084   //! Internal method for implementation of UserBreak mechanism;
0085   //! note that it uses static variable and thus not thread-safe!
0086   Standard_EXPORT static Standard_Address& StopIndicator();
0087 
0088   DEFINE_STANDARD_RTTIEXT(Draw_ProgressIndicator, Message_ProgressIndicator)
0089 
0090 private:
0091   Standard_Boolean  myTclMode;
0092   Standard_Boolean  myConsoleMode;
0093   Standard_Boolean  myGraphMode;
0094   Draw_Interpretor* myDraw;
0095   Standard_Boolean  myShown;
0096   Standard_Boolean  myBreak;
0097   Standard_Real     myUpdateThreshold;
0098   Standard_Real     myLastPosition;
0099   Standard_Size     myStartTime;
0100   Standard_ThreadId myGuiThreadId;
0101 };
0102 
0103 #endif // _Draw_ProgressIndicator_HeaderFile