Tulip  5.7.4
Large graphs analysis and drawing
SimplePluginProgress.h
1 /*
2  *
3  * This file is part of Tulip (https://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  void showStops(bool) override;
41  ProgressState state() const override;
42  std::string getError() override {
43  return _error;
44  }
45  void setError(const std::string &error) override {
46  _error = error;
47  }
48  void setComment(const std::string &) override {}
49  void setTitle(const std::string &) override {}
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 
56 private:
57  ProgressState _state;
58  bool _preview;
59  std::string _error;
60 };
61 } // namespace tlp
62 #endif // SIMPLEPLUGINPROGRESS_H
63 ///@endcond
ProgressState
This enum describes callback actions for the underlying system when calling tlp::PluginProgress::prog...