JNR
uiProgress.h
1 /*
2 
3 Jump'n'Run Engine
4 http://www.atanaslaskov.com/jnr/
5 
6 BSD LICENSE
7 Copyright (c) 2007-2013, Atanas Laskov
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14 2. Redistributions in binary form must reproduce the above copyright notice,
15 this list of conditions and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL ATANAS LASKOV BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 */
29 
31 
32 
38 
39 class uiProgress :
40  public uiWindow
41 {
42 protected:
43 
44  //Textrues
45  laTexture _tBorder;
46  laTexture _tProgress;
47 
48  //Progress
49  double _dMin;
50  double _dMax;
51  double _dCurrent;
52 
53  laProgressiveTask* _pTask;
54 
55 protected:
56 
57  // Internal construction method,
58  // called by create() and load()
59  virtual void init();
60 
61  //Make sure the value is within range
62  void limitValue()
63  {
64  if( _dCurrent > _dMax) _dCurrent = _dMax;
65  if( _dCurrent < _dMin) _dCurrent = _dMin;
66  }
67 
68 public:
69 
70  //Constructor/destructor
71  uiProgress(void);
72  ~uiProgress(void);
73 
74  //Create/destroy
75  virtual void create(laPoint3 pos, laPoint3 size);
76  virtual void kill();
77 
78  // Load
79  virtual void load(class laFileParser *fp);
80 
81  //Set/get
82  void setRange( double min, double max);
83  void setValue( double val);
84  double getValue() { return _dCurrent; }
85  double getMax() { return _dMax; }
86  double getMin() { return _dMin; }
87 
88  //Use a taks object to specify the progress
89  void setTask(laProgressiveTask* pt){
90  _pTask = pt;
91  }
92 
93  //Draw & reply methods
94  void draw();
95 };
96 
virtual void kill()
Discard window and all children.
Definition: uiProgress.cpp:79
void draw()
Display the window.
Definition: uiProgress.cpp:85
virtual void create(laPoint3 pos, laPoint3 size)
Create new empty window.
Definition: uiProgress.cpp:56
virtual void load(class laFileParser *fp)
Load a dialog layout form .cui file.
Definition: uiProgress.cpp:65
GUI Progress Bar.
Definition: uiProgress.h:39
2D Texture
Definition: laTexture.h:45
Base class for GUI windows.
Definition: uiWindow.h:45
File Parser.
Definition: laFileParser.h:41
Progressive Task.