Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlProgressBar.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
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 GLPROGRESSBAR_H_
23 #define GLPROGRESSBAR_H_
24 
25 #include <tulip/GlComposite.h>
26 #include <tulip/SimplePluginProgress.h>
27 #include <tulip/Color.h>
28 #include <tulip/Coord.h>
29 
30 const std::string SLIDER_TEXTURE_NAME = "cylinderTexture.png";
31 
32 namespace tlp {
33 /**
34  * This class allows to display a progress bar in OpenGL
35  */
36 class TLP_GL_SCOPE GlProgressBar : public GlComposite, public SimplePluginProgress {
37 
38 public :
39 
40  /**
41  * GlProgressBar constructor
42  * \param centerPosition the position of the center of the frame containing the progress bar
43  * \param width the width of the frame containing the progress bar
44  * \param height the height of the frame containing the progress bar
45  * \param progressBarColor the color of the progress bar
46  * \param commentColor the color of the comment and the frame
47  */
48  GlProgressBar(const Coord &centerPosition, const unsigned int width, const unsigned int height, const Color& progressBarcolor, const Color& commentColor = Color(0, 0, 0));
49 
50  ~GlProgressBar();
51 
52  /**
53  * This method allow to set a comment message above the progress bar
54  * \param msg the text of the comment to display
55  */
56  void setComment(const std::string& msg) {
57  comment = msg;
58  }
59 protected:
60  void progress_handler(int step, int max_step);
61 
62 private :
63 
64  Color progressBarColor, commentColor;
65  float progressBarMaxWidth, progressBarHeight;
66  float commentWidth, commentHeight;
67  Coord progressBarTLCorner;
68  Coord commentLabelCenter;
69 
70  unsigned int currentPercent;
71  std::string comment;
72 };
73 
74 }
75 #endif /* GLPROGRESSBAR_H_ */
76 ///@endcond