Gorgon Game Engine
Progressbar.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Slider.h"
4 
5 namespace Gorgon { namespace Widgets {
6 
7 
21  template<
22  class T_,
23  float(*DIV_)(T_, T_, T_) = FloatDivider<T_>,
24  T_(*VAL_)(float, T_, T_) = FloatToValue<T_>,
25  template<class C_, class PT_, PT_(C_::*Getter_)() const, void(C_::*Setter_)(const PT_ &)> class P_ = Gorgon::NumericProperty
26  >
29  public:
30 
31  Progressor(const Progressor &) = delete;
32 
33  explicit Progressor(T_ cur, T_ max, Registry::TemplateType type = Registry::Progress_Regular) :
34  Progressor(Registry::Active()[type], cur, max)
35  {
36  }
37 
39  Progressor(Registry::Active()[type], cur)
40  {
41  }
42 
43  explicit Progressor(const UI::Template &temp, T_ cur = T_{}) : Progressor(temp, cur, T_{100}) { }
44 
45  Progressor(const UI::Template &temp, T_ cur, T_ max) : Base(temp, cur, max)
46  { }
47 
48  using Base::SetValue;
49  using Base::GetValue;
50 
51  using Base::SetMaximum;
52  using Base::GetMaximum;
53 
54  using Base::operator =;
55  using Base::operator T_;
56 
57  using Base::DisableSmoothChange;
58  using Base::SetSmoothChangeSpeed;
59  using Base::SetSmoothChangeSpeedRatio;
60  using Base::GetSmoothChangeSpeed;
61  using Base::GetSmoothChangeSpeedRatio;
62  using Base::IsSmoothChangeEnabled;
63 
64  using Base::Maximum;
65 
68 
69  protected:
70  virtual void valuechanged(T_ value) override {
71  ValueChanged(value);
72  }
73 
74  virtual bool allowfocus() const override { return false; }
75  };
76 
84 
85 } }
Gorgon::NumericProperty
Supports arithmetic operators including +, * ..., +=, ...
Definition: Property.h:108
Gorgon::Widgets::Progressor::Progressor
Progressor(const UI::Template &temp, T_ cur, T_ max)
Definition: Progressbar.h:45
Gorgon::Widgets::SliderBase
This is an internal basis for slider.
Definition: Slider.h:59
Gorgon::Event
This class provides event mechanism.
Definition: Event.h:134
Gorgon::UI::Template
This class stores visual information about a widget template.
Definition: Template.h:392
Gorgon::Widgets::Progressor::allowfocus
virtual bool allowfocus() const override
Should return true if the widget can be focused.
Definition: Progressbar.h:74
Gorgon::Widgets::Progressor
This widget displays a progress bar to track progress of an on going process.
Definition: Progressbar.h:27
Gorgon::Widgets::Registry::Active
static Registry & Active()
Definition: Registry.h:73
Gorgon::Widgets::Registry::TemplateType
TemplateType
This enum lists all possible template types.
Definition: Registry.h:18
Gorgon::Widgets::Progressor::Progressor
Progressor(T_ cur=T_{}, Registry::TemplateType type=Registry::Progress_Regular)
Definition: Progressbar.h:38
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Widgets::Progressor::valuechanged
virtual void valuechanged(T_ value) override
Definition: Progressbar.h:70
Gorgon::Widgets::Registry::Progress_Regular
@ Progress_Regular
Definition: Registry.h:39
Gorgon::Widgets::Progressor::Progressor
Progressor(const Progressor &)=delete
Gorgon::Widgets::Progressor::Progressor
Progressor(T_ cur, T_ max, Registry::TemplateType type=Registry::Progress_Regular)
Definition: Progressbar.h:33
Gorgon::UI::Active
@ Active
This is for widgets that can be activated, like a count down timer.
Definition: Template.h:245
Slider.h
Gorgon::Widgets::Registry
This class stores templates for elements.
Definition: Registry.h:12
Gorgon::Widgets::Progressor::Progressor
Progressor(const UI::Template &temp, T_ cur=T_{})
Definition: Progressbar.h:43