2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-11 00:23:16 +00:00
|
|
|
#include "CGuiCompoundWidget.hpp"
|
2016-03-17 22:19:25 +00:00
|
|
|
#include <functional>
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2017-01-22 01:40:12 +00:00
|
|
|
class CSimplePool;
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-11 00:23:16 +00:00
|
|
|
class CGuiSliderGroup : public CGuiCompoundWidget
|
|
|
|
{
|
2017-01-13 00:16:26 +00:00
|
|
|
public:
|
|
|
|
enum class EState
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
Decreasing,
|
|
|
|
Increasing
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
float xb8_minVal;
|
|
|
|
float xbc_maxVal;
|
|
|
|
float xc0_roundedCurVal;
|
|
|
|
float xc4_curVal;
|
|
|
|
float xc8_increment;
|
|
|
|
CGuiWidget* xcc_sliderRangeWidgets[2] = {};
|
|
|
|
std::function<void(CGuiSliderGroup*, float)> xd8_changeCallback;
|
|
|
|
EState xf0_state = EState::None;
|
|
|
|
union {
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool xf4_24_inputPending : 1;
|
|
|
|
};
|
|
|
|
u8 _dummy = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
void StartDecreasing();
|
|
|
|
void StartIncreasing();
|
|
|
|
|
2016-03-11 00:23:16 +00:00
|
|
|
public:
|
2016-03-17 22:19:25 +00:00
|
|
|
CGuiSliderGroup(const CGuiWidgetParms& parms, float a, float b, float c, float d);
|
2017-01-29 03:58:16 +00:00
|
|
|
FourCC GetWidgetTypeID() const { return FOURCC('SLGP'); }
|
2016-03-11 00:23:16 +00:00
|
|
|
|
2017-01-13 00:16:26 +00:00
|
|
|
EState GetState() const { return xf0_state; }
|
2017-01-10 07:15:49 +00:00
|
|
|
void SetSelectionChangedCallback(std::function<void(CGuiSliderGroup*, float)>&& func);
|
2017-01-13 00:16:26 +00:00
|
|
|
void SetIncrement(float inc) { xc8_increment = inc; }
|
|
|
|
void SetMinVal(float min) { xb8_minVal = min; SetCurVal(xc0_roundedCurVal); }
|
|
|
|
void SetMaxVal(float max) { xbc_maxVal = max; SetCurVal(xc0_roundedCurVal); }
|
2016-03-17 22:19:25 +00:00
|
|
|
void SetCurVal(float cur);
|
2017-01-13 00:16:26 +00:00
|
|
|
float GetGurVal() const { return xc0_roundedCurVal; }
|
|
|
|
|
|
|
|
void ProcessUserInput(const CFinalInput& input);
|
|
|
|
void Update(float dt);
|
2016-03-17 22:19:25 +00:00
|
|
|
|
|
|
|
bool AddWorkerWidget(CGuiWidget* worker);
|
2018-05-25 06:39:38 +00:00
|
|
|
CGuiWidget* GetWorkerWidget(int id) const;
|
2016-03-17 22:19:25 +00:00
|
|
|
|
2017-01-22 01:40:12 +00:00
|
|
|
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
|
2016-03-11 00:23:16 +00:00
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|