Tulip  5.3.0
Large graphs analysis and drawing
GlProgressBar.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
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 #ifndef GLPROGRESSBAR_H_
22 #define GLPROGRESSBAR_H_
23 
24 #include <tulip/GlComposite.h>
25 #include <tulip/SimplePluginProgress.h>
26 #include <tulip/Color.h>
27 #include <tulip/Coord.h>
28 
29 const std::string SLIDER_TEXTURE_NAME = "cylinderTexture.png";
30 
31 namespace tlp {
32 /**
33  * This class allows to display a progress bar in OpenGL
34  */
35 class TLP_GL_SCOPE GlProgressBar : public GlComposite, public SimplePluginProgress {
36 
37 public:
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 progressBarColor the color of the progress bar
44  * \param commentColor the color of the comment and the frame
45  */
46  GlProgressBar(const Coord &centerPosition, const unsigned int width, const unsigned int height,
47  const Color &progressBarcolor, const Color &commentColor = Color(0, 0, 0));
48 
49  ~GlProgressBar() override;
50 
51  /**
52  * This method allow to set a comment message above the progress bar
53  * \param msg the text of the comment to display
54  */
55  void setComment(const std::string &msg) override {
56  comment = msg;
57  }
58 
59 protected:
60  void progress_handler(int step, int max_step) override;
61 
62 private:
63  Color progressBarColor, commentColor;
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 } // namespace tlp
73 #endif /* GLPROGRESSBAR_H_ */
74 ///@endcond