Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
SimplePluginProgress.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef SIMPLEPLUGINPROGRESS_H
23 #define SIMPLEPLUGINPROGRESS_H
24 
25 #include <tulip/PluginProgress.h>
26 #include <string>
27 namespace tlp {
28 /**
29  * @brief Basic implementation for PluginProgress interface.
30  *
31  **/
32 class TLP_SCOPE SimplePluginProgress : public PluginProgress {
33 public:
34 
35  SimplePluginProgress();
36  virtual ProgressState progress(int step, int max_step);
37  virtual void cancel();
38  virtual void stop();
39  virtual bool isPreviewMode() const ;
40  virtual void setPreviewMode(bool);
41  virtual void showPreview(bool);
42  virtual ProgressState state() const;
43  virtual std::string getError() {
44  return _error;
45  }
46  virtual void setError(const std::string& error) {
47  _error = error;
48  }
49  virtual void setComment(const std::string&) {}
50 
51 protected:
52  virtual void progress_handler(int step, int max_step);
53  //call when the _preview variable change.
54  virtual void preview_handler(bool);
55 private:
56  ProgressState _state;
57  bool _preview;
58  std::string _error;
59 };
60 }
61 #endif // SIMPLEPLUGINPROGRESS_H
62 ///@endcond