Tulip  4.3.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 #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 color the color of the progress bar
46  */
47  GlProgressBar(const Coord &centerPosition, const unsigned int width, const unsigned int height, const Color &color);
48  ~GlProgressBar();
49 
50  /**
51  * This method allow to set a comment message above the progress bar
52  * \param msg the text of the comment to display
53  */
54  void setComment(const std::string& msg) {
55  comment = msg;
56  }
57 protected:
58  void progress_handler(int step, int max_step);
59 
60 private :
61 
62  float width, height;
63  Color color, percentLabelAndFrameColor;
64  float progressBarMaxWidth, progressBarHeight;
65  float commentWidth, commentHeight;
66  Coord progressBarTLCorner;
67  Coord commentLabelCenter;
68 
69  unsigned int currentPercent;
70  std::string comment;
71 };
72 
73 }
74 #endif /* GLPROGRESSBAR_H_ */
75 ///@endcond