Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
progressbar.hpp
1 //////////////////////////////
2 //
3 // File: lxs/windowing/progressbar.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: May 30 2014
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LXS_PROGBAR_WINDOW__
15 #define __LXS_PROGBAR_WINDOW__
16 #include "helper/opengl.h"
17 #include "helper/tr1.h"
18 #include <string>
19 #include "lxs/windowing/containerwindow.hpp"
20 namespace LxS
21 {
22  namespace CoreGraphics
23  {
24  class Font;
25  }
26  namespace Windowing
27  {
28  class Rectangle2D;
29  class Label;
30  //! typical progress bar
31  class ProgressBar: public Label
32  {
33  private:
34  // called by all variants of constructor;
35  void ConstructorCommon();
36  protected:
37  //! actual progressbar texture (displayed over the background)
39  //! bar texture path
40  std::string bar_background;
41  //! progress rate (0-1)
42  float progress;
43  //! position bar_background (progressbar proper) over background inherited from label class object
44  void PositionBackground();// {PrepareText();}
45  public:
46  //! initializing constructor
47  ProgressBar(const std::string & text, const std::string & background, const std::string & _bar_background);
48  ProgressBar();
49  ~ProgressBar();
50  //! 0-1
51  void SetProgress(float p); /// 0-1
52  //! 0-1
53  float GetProgress() { return progress;}
54  //! \brief set a background of progressbar
55  //! (BarBackground is displayed over Background;
56  //! covers it fully if Progress is 100% (1.0))
57  void SetBarBackground(const std::string & bg) { bar_background.assign(bg);}
58  void UnloadResources() ;
59  void Initialize();
60  void Render(Rendermode mode);
61  unsigned long GetTexelsCount();
62  unsigned long GetFacesCount();
63  };
64  }
65 }
66 #endif