Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/SimplePluginProgress.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 
00022 #ifndef SIMPLEPLUGINPROGRESS_H
00023 #define SIMPLEPLUGINPROGRESS_H
00024 
00025 #include <tulip/PluginProgress.h>
00026 #include <string>
00027 namespace tlp {
00028 /**
00029   * @brief Basic implementation for PluginProgress interface.
00030   *
00031   **/
00032 class TLP_SCOPE SimplePluginProgress : public PluginProgress {
00033 public:
00034 
00035   SimplePluginProgress();
00036   virtual ProgressState progress(int step, int max_step);
00037   virtual void cancel();
00038   virtual void stop();
00039   virtual bool isPreviewMode() const ;
00040   virtual void setPreviewMode(bool);
00041   virtual void showPreview(bool);
00042   virtual ProgressState state() const;
00043   virtual std::string getError() {
00044     return _error;
00045   }
00046   virtual void setError(const std::string& error) {
00047     _error = error;
00048   }
00049   virtual void setComment(const std::string&) {}
00050   virtual void setTitle(const std::string&) {}
00051 
00052 
00053 protected:
00054   virtual void progress_handler(int step, int max_step);
00055   //call when the _preview variable change.
00056   virtual void preview_handler(bool);
00057 private:
00058   ProgressState _state;
00059   bool _preview;
00060   std::string _error;
00061 };
00062 }
00063 #endif // SIMPLEPLUGINPROGRESS_H
00064 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties