Tulip  5.2.0
Large graphs analysis and drawing
SimplePluginProgress.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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 #ifndef SIMPLEPLUGINPROGRESS_H
22 #define SIMPLEPLUGINPROGRESS_H
23 
24 #include <tulip/PluginProgress.h>
25 #include <string>
26 namespace tlp {
27 /**
28  * @brief Basic implementation for PluginProgress interface.
29  *
30  **/
31 class TLP_SCOPE SimplePluginProgress : public PluginProgress {
32 public:
33  SimplePluginProgress();
34  ProgressState progress(int step, int max_step) override;
35  void cancel() override;
36  void stop() override;
37  bool isPreviewMode() const override;
38  void setPreviewMode(bool) override;
39  void showPreview(bool) override;
40  ProgressState state() const override;
41  std::string getError() override {
42  return _error;
43  }
44  void setError(const std::string &error) override {
45  _error = error;
46  }
47  void setComment(const std::string &) override {}
48  void setTitle(const std::string &) override {}
49 
50 protected:
51  virtual void progress_handler(int step, int max_step);
52  // call when the _preview variable change.
53  virtual void preview_handler(bool);
54 
55 private:
56  ProgressState _state;
57  bool _preview;
58  std::string _error;
59 };
60 }
61 #endif // SIMPLEPLUGINPROGRESS_H
62 ///@endcond
ProgressState
This enum describes callback actions for the underlaying system when calling tlp::PluginProgress::pro...