Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:24

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 
0035   
0036   //! Creates a progress indicator and remembers pointer to Draw_Interpretor
0037   //!
0038   //! @param theUpdateThreshold defines minimal progress (in percents) between
0039   //! updates of the indicator (non-forced updates of the progress bar will be
0040   //! disabled until that progress is reached since last update).
0041   Standard_EXPORT Draw_ProgressIndicator(const Draw_Interpretor& di, Standard_Real theUpdateThreshold = 1.);
0042   
0043   //! Destructor; calls Reset()
0044   Standard_EXPORT ~Draw_ProgressIndicator();
0045   
0046   //! Sets tcl output mode (on/off).
0047   Standard_EXPORT void SetTclMode (const Standard_Boolean theTclMode);
0048   
0049   //! Gets tcl output mode (on/off). 
0050   Standard_EXPORT Standard_Boolean GetTclMode() const;
0051 
0052   //! Sets console output mode (on/off).
0053   //! If it is on then progress is shown in the standard output.
0054   Standard_EXPORT void SetConsoleMode(const Standard_Boolean theMode);
0055 
0056   //! Gets console output mode (on/off)
0057   Standard_EXPORT Standard_Boolean GetConsoleMode() const;
0058 
0059   //! Sets graphical output mode (on/off)
0060   Standard_EXPORT void SetGraphMode (const Standard_Boolean theGraphMode);
0061   
0062   //! Gets graphical output mode (on/off)
0063   Standard_EXPORT Standard_Boolean GetGraphMode() const;
0064 
0065   //! Clears/erases opened TCL windows if any
0066   //! and sets myBreak to False
0067   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
0068   
0069   //! Defines method Show of Progress Indicator
0070   Standard_EXPORT virtual void Show (const Message_ProgressScope& theScope, 
0071                                      const Standard_Boolean force = Standard_True) Standard_OVERRIDE;
0072   
0073   //! Redefines method UserBreak of Progress Indicator
0074   Standard_EXPORT virtual Standard_Boolean UserBreak() Standard_OVERRIDE;
0075   
0076   //! Get/Set default value for tcl mode
0077   Standard_EXPORT static Standard_Boolean& DefaultTclMode();
0078 
0079   //! Get/Set default value for console mode
0080   Standard_EXPORT static Standard_Boolean& DefaultConsoleMode();
0081 
0082   //! Get/Set default value for graph mode
0083   Standard_EXPORT static Standard_Boolean& DefaultGraphMode();
0084 
0085   //! Internal method for implementation of UserBreak mechanism;
0086   //! note that it uses static variable and thus not thread-safe! 
0087   Standard_EXPORT static Standard_Address& StopIndicator();
0088 
0089   DEFINE_STANDARD_RTTIEXT(Draw_ProgressIndicator,Message_ProgressIndicator)
0090 
0091 private:
0092   Standard_Boolean myTclMode;
0093   Standard_Boolean myConsoleMode;
0094   Standard_Boolean myGraphMode;
0095   Draw_Interpretor* myDraw;
0096   Standard_Boolean myShown;
0097   Standard_Boolean myBreak;
0098   Standard_Real myUpdateThreshold;
0099   Standard_Real myLastPosition;
0100   Standard_Size myStartTime;
0101   Standard_ThreadId myGuiThreadId;
0102 };
0103 
0104 #endif // _Draw_ProgressIndicator_HeaderFile