Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlProgressBar.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 GLPROGRESSBAR_H_
00023 #define GLPROGRESSBAR_H_
00024 
00025 #include <tulip/GlComposite.h>
00026 #include <tulip/SimplePluginProgress.h>
00027 #include <tulip/Color.h>
00028 #include <tulip/Coord.h>
00029 
00030 const std::string SLIDER_TEXTURE_NAME = "cylinderTexture.png";
00031 
00032 namespace tlp {
00033 /**
00034  *  This class allows to display a progress bar in OpenGL
00035  */
00036 class TLP_GL_SCOPE GlProgressBar : public GlComposite, public SimplePluginProgress {
00037 
00038 public :
00039 
00040   /**
00041    * GlProgressBar constructor
00042    * \param centerPosition the position of the center of the frame containing the progress bar
00043    * \param width the width of the frame containing the progress bar
00044    * \param height the height of the frame containing the progress bar
00045    * \param progressBarColor the color of the progress bar
00046    * \param commentColor the color of the comment and the frame
00047    */
00048   GlProgressBar(const Coord &centerPosition, const unsigned int width, const unsigned int height, const Color& progressBarcolor, const Color& commentColor = Color(0, 0, 0));
00049 
00050   ~GlProgressBar();
00051 
00052   /**
00053    * This method allow to set a comment message above the progress bar
00054    * \param msg the text of the comment to display
00055    */
00056   void setComment(const std::string& msg) {
00057     comment = msg;
00058   }
00059 protected:
00060   void progress_handler(int step, int max_step);
00061 
00062 private :
00063 
00064   Color progressBarColor, commentColor;
00065   float progressBarMaxWidth, progressBarHeight;
00066   float commentWidth, commentHeight;
00067   Coord progressBarTLCorner;
00068   Coord commentLabelCenter;
00069 
00070   unsigned int currentPercent;
00071   std::string comment;
00072 };
00073 
00074 }
00075 #endif /* GLPROGRESSBAR_H_ */
00076 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties