Tulip  4.2.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 1 and Inria Bordeaux - Sud Ouest
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 
28 const std::string SLIDER_TEXTURE_NAME = "cylinderTexture.png";
29 
30 namespace tlp {
31 /**
32  * This class allows to display a progress bar in OpenGL
33  */
34 class TLP_GL_SCOPE GlProgressBar : public GlComposite, public SimplePluginProgress {
35 
36 public :
37 
38  /**
39  * GlProgressBar constructor
40  * \param centerPosition the position of the center of the frame containing the progress bar
41  * \param width the width of the frame containing the progress bar
42  * \param height the height of the frame containing the progress bar
43  * \param color the color of the progress bar
44  */
45  GlProgressBar(const Coord &centerPosition, const unsigned int width, const unsigned int height, const Color &color);
46  ~GlProgressBar();
47 
48  /**
49  * This method allow to set a comment message above the progress bar
50  * \param msg the text of the comment to display
51  */
52  void setComment(const std::string& msg) {
53  comment = msg;
54  }
55 protected:
56  void progress_handler(int step, int max_step);
57 
58 private :
59 
60  float width, height;
61  Color color, percentLabelAndFrameColor;
62  float progressBarMaxWidth, progressBarHeight;
63  float commentWidth, commentHeight;
64  Coord progressBarTLCorner;
65  Coord commentLabelCenter;
66 
67  unsigned int currentPercent;
68  std::string comment;
69 };
70 
71 }
72 #endif /* GLPROGRESSBAR_H_ */
73 ///@endcond