mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Rename all member functions from p_ to m_
This commit is contained in:
+14
-14
@@ -1,9 +1,9 @@
|
||||
#include "UI_slider.hpp"
|
||||
|
||||
UI_slider::UI_slider(std::string id, std::string text, Color fg_color, Color bg_color, double min, double max, double value, std::function<void(std::string, double)> on_change)
|
||||
: UI_item(id, UI_SLIDER_TYPE, text, 12, fg_color, bg_color), p_min(min), p_max(max), p_value(value)
|
||||
: UI_item(id, UI_SLIDER_TYPE, text, 12, fg_color, bg_color), m_min(min), m_max(max), m_value(value)
|
||||
{
|
||||
this->p_on_change = on_change;
|
||||
this->m_on_change = on_change;
|
||||
}
|
||||
|
||||
UI_slider::UI_slider(const json& j)
|
||||
@@ -14,37 +14,37 @@ UI_slider::UI_slider(const json& j)
|
||||
|
||||
void UI_slider::set_value(double value)
|
||||
{
|
||||
if (value < p_min || value > p_max)
|
||||
if (value < m_min || value > m_max)
|
||||
return;
|
||||
if (value == p_value)
|
||||
if (value == m_value)
|
||||
return;
|
||||
|
||||
if (p_on_change != nullptr)
|
||||
if (m_on_change != nullptr)
|
||||
{
|
||||
this->p_value = value;
|
||||
p_on_change(p_id, value);
|
||||
this->m_value = value;
|
||||
m_on_change(m_id, value);
|
||||
}
|
||||
}
|
||||
|
||||
double UI_slider::value() const
|
||||
{
|
||||
return p_value;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void UI_slider::from_json(const json& j)
|
||||
{
|
||||
UI_item::from_json(j);
|
||||
|
||||
this->p_min = j["min"];
|
||||
this->p_max = j["max"];
|
||||
this->p_value = j["value"];
|
||||
this->m_min = j["min"];
|
||||
this->m_max = j["max"];
|
||||
this->m_value = j["value"];
|
||||
}
|
||||
|
||||
json UI_slider::to_json() const
|
||||
{
|
||||
json j = UI_item::to_json();
|
||||
j["min"] = this->p_min;
|
||||
j["max"] = this->p_max;
|
||||
j["value"] = this->p_value;
|
||||
j["min"] = this->m_min;
|
||||
j["max"] = this->m_max;
|
||||
j["value"] = this->m_value;
|
||||
return j;
|
||||
}
|
||||
Reference in New Issue
Block a user