[DEV] add basic parameter structure
This commit is contained in:
parent
babbf2bcd1
commit
70487330ce
@ -31,11 +31,6 @@ Dependency packages
|
|||||||
# on 64 bits processor for compatibility
|
# on 64 bits processor for compatibility
|
||||||
sudo apt-get install ia32-libs
|
sudo apt-get install ia32-libs
|
||||||
|
|
||||||
Copyright (c)
|
|
||||||
=============
|
|
||||||
|
|
||||||
2011, Edouard DUPIN
|
|
||||||
|
|
||||||
License (APACHE v2.0)
|
License (APACHE v2.0)
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
2
build
2
build
@ -1 +1 @@
|
|||||||
Subproject commit 9d6418eed9d24b85823aca4f3393e15a8edeb0cb
|
Subproject commit db4a587a44ee03fd3be36afadf5101e4993b1356
|
2
external/egami
vendored
2
external/egami
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 6a409ac838f57e14da5274ea8506c1129f7cf955
|
Subproject commit fdeaf2015c079735f1674b97d196e0f9a0c94a2c
|
2
external/ege
vendored
2
external/ege
vendored
@ -1 +1 @@
|
|||||||
Subproject commit e555759d9ccf2bd1e6de7650f138623baf8a599e
|
Subproject commit 36744f57e56fd7c8fd3738f6489c3a091b0aa595
|
2
external/ejson
vendored
2
external/ejson
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b10040303a4c1dc28ae0cd5d565965fffa90bd28
|
Subproject commit d9c98697edabf3ded9a46bc1cc83c58b1ab9cd62
|
2
external/enet
vendored
2
external/enet
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 22baa22bc23e1202285de3e640911047ea7b395d
|
Subproject commit dd76dbf0fd4ad1b16fb7c7ca360cf5c1ad1f41be
|
2
external/esvg
vendored
2
external/esvg
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ac34d1f5317c3fd952b67d5c01ee4183914ae166
|
Subproject commit 738ee25fb8016e9fd7a3d62ac28a85eb99b4f197
|
2
external/ewolsa
vendored
2
external/ewolsa
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 11788c2afcb64a906a6a489d1ee96fbfbcdb832d
|
Subproject commit c25640d80e675d25660a78dc2dc0a4f20831d4e2
|
2
external/exml
vendored
2
external/exml
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5b41f40739e920276b382254d7d768beaf8237e4
|
Subproject commit 3ae5e16d48318ebbd158a6a7f7936000ff64b83f
|
2
monk
2
monk
@ -1 +1 @@
|
|||||||
Subproject commit 895e18786ce732e8cc1c282863677c21e1806062
|
Subproject commit 85ebc5ec327c3920264de479c8b1049c1b81596c
|
@ -50,6 +50,7 @@ void ewol::Object::removeParent() {
|
|||||||
ewol::Object::Object() :
|
ewol::Object::Object() :
|
||||||
m_objectHasBeenInit(false),
|
m_objectHasBeenInit(false),
|
||||||
m_static(false),
|
m_static(false),
|
||||||
|
m_name(*this, "name", ""),
|
||||||
m_isResource(false) {
|
m_isResource(false) {
|
||||||
// note this is nearly atomic ... (but it is enough)
|
// note this is nearly atomic ... (but it is enough)
|
||||||
m_uniqueId = m_valUID++;
|
m_uniqueId = m_valUID++;
|
||||||
@ -67,6 +68,7 @@ ewol::Object::~Object() {
|
|||||||
|
|
||||||
void ewol::Object::init() {
|
void ewol::Object::init() {
|
||||||
getObjectManager().add(shared_from_this());
|
getObjectManager().add(shared_from_this());
|
||||||
|
parameterDisplay();
|
||||||
m_objectHasBeenInit = true;
|
m_objectHasBeenInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ namespace ewol {
|
|||||||
#include <ewol/object/Config.h>
|
#include <ewol/object/Config.h>
|
||||||
#include <ewol/object/ConfigElement.h>
|
#include <ewol/object/ConfigElement.h>
|
||||||
#include <ewol/object/Message.h>
|
#include <ewol/object/Message.h>
|
||||||
|
#include <ewol/object/ParameterList.h>
|
||||||
|
#include <ewol/object/Param.h>
|
||||||
|
#include <ewol/object/ParamList.h>
|
||||||
|
|
||||||
#define DECLARE_FACTORY(className) \
|
#define DECLARE_FACTORY(className) \
|
||||||
template<typename ... T> static std::shared_ptr<className> create( T&& ... all ) { \
|
template<typename ... T> static std::shared_ptr<className> create( T&& ... all ) { \
|
||||||
@ -62,7 +65,7 @@ namespace ewol {
|
|||||||
* @brief Basic message classes for ewol system
|
* @brief Basic message classes for ewol system
|
||||||
* this class mermit at every Object to communicate between them.
|
* this class mermit at every Object to communicate between them.
|
||||||
*/
|
*/
|
||||||
class Object : public std::enable_shared_from_this<Object> {
|
class Object : public std::enable_shared_from_this<Object>, public ewol::object::ParameterList {
|
||||||
private:
|
private:
|
||||||
static size_t m_valUID; //!< stic used for the unique ID definition
|
static size_t m_valUID; //!< stic used for the unique ID definition
|
||||||
public:
|
public:
|
||||||
@ -263,14 +266,14 @@ namespace ewol {
|
|||||||
std::string getConfig(const char* _config) const;
|
std::string getConfig(const char* _config) const;
|
||||||
std::string getConfig(const std::string& _config) const; // need search
|
std::string getConfig(const std::string& _config) const; // need search
|
||||||
protected:
|
protected:
|
||||||
std::string m_name; //!< name of the element ...
|
ewol::object::Param<std::string> m_name; //!< name of the element ...
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief get the Object name
|
* @brief get the Object name
|
||||||
* @return The requested name
|
* @return The requested name
|
||||||
*/
|
*/
|
||||||
const std::string& getName() const {
|
const std::string& getName() const {
|
||||||
return m_name;
|
return m_name.get();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief get the Widget name
|
* @brief get the Widget name
|
||||||
|
154
sources/ewol/object/Param.cpp
Normal file
154
sources/ewol/object/Param.cpp
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/object/Param.h>
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// int16_t
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<int16_t>::getType() {
|
||||||
|
return "int16_t";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<int16_t>::getValueSpecific(const int16_t& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<int16_t>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stoi(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// uint32_t
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<uint32_t>::getType() {
|
||||||
|
return "uint32_t";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<uint32_t>::getValueSpecific(const uint32_t& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<uint32_t>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stoul(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// int32_t
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<int32_t>::getType() {
|
||||||
|
return "int32_t";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<int32_t>::getValueSpecific(const int32_t& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<int32_t>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stol(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// uint64_t
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<uint64_t>::getType() {
|
||||||
|
return "uint64_t";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<uint64_t>::getValueSpecific(const uint64_t& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<uint64_t>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stoull(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Int64_t
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<int64_t>::getType() {
|
||||||
|
return "int64_t";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<int64_t>::getValueSpecific(const int64_t& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<int64_t>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stoll(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Float
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<float>::getType() {
|
||||||
|
return "float";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<float>::getValueSpecific(const float& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<float>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stof(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Double
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template<> std::string ewol::object::Param<double>::getType() {
|
||||||
|
return "double";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<double>::getValueSpecific(const double& _valueRequested) {
|
||||||
|
return std::to_string(_valueRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<double>::setString(const std::string& _newVal) {
|
||||||
|
set(std::stod(_newVal));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Boolean
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<bool>::getValueSpecific(const bool& _valueRequested) {
|
||||||
|
if (_valueRequested == true) {
|
||||||
|
return "true";
|
||||||
|
}
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<bool>::setString(const std::string& _newVal) {
|
||||||
|
if( std::tolower(_newVal) == "true"
|
||||||
|
|| std::tolower(_newVal) == "enable"
|
||||||
|
|| _newVal == "1") {
|
||||||
|
set(true);
|
||||||
|
} else {
|
||||||
|
set(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// string
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
template<> std::string ewol::object::Param<std::string>::getValueSpecific(const std::string& _valueRequested) {
|
||||||
|
return _valueRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void ewol::object::Param<std::string>::setString(const std::string& _newVal) {
|
||||||
|
set(_newVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
169
sources/ewol/object/Param.h
Normal file
169
sources/ewol/object/Param.h
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_PARAM_TYPE_H__
|
||||||
|
#define __EWOL_PARAM_TYPE_H__
|
||||||
|
|
||||||
|
#include <ewol/object/ParameterList.h>
|
||||||
|
#include <ewol/object/Parameter.h>
|
||||||
|
#include <etk/math/Vector2D.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace object {
|
||||||
|
template<typename MY_TYPE> class Param : public Parameter {
|
||||||
|
private:
|
||||||
|
MY_TYPE m_value; //!< Current value.
|
||||||
|
MY_TYPE m_min; //!< Minimum value.
|
||||||
|
MY_TYPE m_max; //!< Maximum value.
|
||||||
|
MY_TYPE m_default; //!< Default value.
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Create a parameter with a specific type.
|
||||||
|
* @param[in] blockLink Pointer on the reference block (must be define for upper class.
|
||||||
|
* @param[in] name Static name of the parameter.
|
||||||
|
* @param[in] defaultValue Default value of the parameter.
|
||||||
|
* @param[in] min Minumum value.
|
||||||
|
* @param[in] max Maximum value
|
||||||
|
*/
|
||||||
|
template<typename TYPE, typename = typename
|
||||||
|
std::enable_if< std::is_same<std::string, TYPE>::value
|
||||||
|
|| std::is_same<char[1], TYPE>::value
|
||||||
|
|| std::is_same<bvec2, TYPE>::value
|
||||||
|
|| std::is_same<bvec3, TYPE>::value
|
||||||
|
|| std::is_same<vec2, TYPE>::value
|
||||||
|
|| std::is_same<vec3, TYPE>::value
|
||||||
|
|| std::is_same<ivec2, TYPE>::value
|
||||||
|
|| std::is_same<ivec3, TYPE>::value
|
||||||
|
|| std::is_same<uivec2, TYPE>::value
|
||||||
|
|| std::is_same<uivec3, TYPE>::value>::type>
|
||||||
|
Param(ewol::object::ParameterList& _objectLink,
|
||||||
|
const std::string& _name,
|
||||||
|
const TYPE& _defaultValue) :
|
||||||
|
Parameter(_objectLink, _name),
|
||||||
|
m_value(_defaultValue),
|
||||||
|
m_default(_defaultValue) {
|
||||||
|
|
||||||
|
};
|
||||||
|
template<typename TYPE, typename = typename std::enable_if<!std::is_same<std::string, TYPE>::value>::type>
|
||||||
|
Param(ewol::object::ParameterList& _objectLink,
|
||||||
|
const std::string& _name,
|
||||||
|
const TYPE& _defaultValue,
|
||||||
|
const TYPE& _min,
|
||||||
|
const TYPE& _max) :
|
||||||
|
Parameter(_objectLink, _name),
|
||||||
|
m_value(_defaultValue),
|
||||||
|
m_min(_min),
|
||||||
|
m_max(_max),
|
||||||
|
m_default(_defaultValue) {
|
||||||
|
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @brief Destructor.
|
||||||
|
*/
|
||||||
|
virtual ~Param() { };
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getType();
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getString() {
|
||||||
|
return getValueSpecific(m_value);
|
||||||
|
};
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getDefault() {
|
||||||
|
return getValueSpecific(m_default);
|
||||||
|
};
|
||||||
|
// herited methode
|
||||||
|
virtual void setString(const std::string& _newVal);
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getInfo();
|
||||||
|
// herited methode
|
||||||
|
virtual bool isDefault() {
|
||||||
|
return m_value == m_default;
|
||||||
|
}
|
||||||
|
// herited methode
|
||||||
|
virtual void setDefault() {
|
||||||
|
m_value = m_default;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Get the value of the current parameter.
|
||||||
|
* @note For performence, this function must be inline
|
||||||
|
* @return the Reference value
|
||||||
|
*/
|
||||||
|
const inline MY_TYPE& get() const {
|
||||||
|
return m_value;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @brief Set a new value for this parameter
|
||||||
|
* @param[in] newVal New value to set (set the nearest value if range is set)
|
||||||
|
*/
|
||||||
|
void set(const MY_TYPE& _newVal);
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Get the string of the specify value.
|
||||||
|
* @return convetion of the velue in string.
|
||||||
|
*/
|
||||||
|
std::string getValueSpecific(const MY_TYPE& _valueRequested);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief assignement operator.
|
||||||
|
* @param[in] newVal The new value of the parameter.
|
||||||
|
*/
|
||||||
|
const Param<MY_TYPE>& operator= (const MY_TYPE& _newVal) {
|
||||||
|
set(_newVal);
|
||||||
|
return *this;
|
||||||
|
};
|
||||||
|
operator MY_TYPE() {
|
||||||
|
return m_value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<> std::string Param<bool>::getType() {
|
||||||
|
return "bool";
|
||||||
|
}
|
||||||
|
template<> std::string Param<std::string>::getType() {
|
||||||
|
return "string";
|
||||||
|
}
|
||||||
|
template<>
|
||||||
|
std::string Param<bool>::getInfo() {
|
||||||
|
return getType() + " default=" + (m_default?"true":"false");
|
||||||
|
}
|
||||||
|
template<>
|
||||||
|
std::string Param<std::string>::getInfo() {
|
||||||
|
return getType() + " default=" + m_default;
|
||||||
|
}
|
||||||
|
template<typename MY_TYPE>
|
||||||
|
std::string Param<MY_TYPE>::getInfo() {
|
||||||
|
return getType() + " default= (heterogen type)";
|
||||||
|
/*
|
||||||
|
if (m_min == m_max) {
|
||||||
|
return getType() + " default=" + std::to_string(m_default);
|
||||||
|
}
|
||||||
|
return getType() + " [" + std::to_string(m_min) + ".." + std::to_string(m_max) + "] default=" + std::to_string(m_default);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Param<std::string>::set(const std::string& _newVal) {
|
||||||
|
m_value = _newVal;
|
||||||
|
};
|
||||||
|
template<typename MY_TYPE>
|
||||||
|
void Param<MY_TYPE>::set(const MY_TYPE& _newVal) {
|
||||||
|
if (m_min == m_max) {
|
||||||
|
m_value = _newVal;
|
||||||
|
} else {
|
||||||
|
m_value = std::avg(m_min, _newVal, m_max);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename MY_TYPE> std::ostream& operator <<(std::ostream& _os, const ewol::object::Param<MY_TYPE>& _obj) {
|
||||||
|
_os << _obj.get();
|
||||||
|
return _os;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
70
sources/ewol/object/ParamList.cpp
Normal file
70
sources/ewol/object/ParamList.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/object/ParamList.h>
|
||||||
|
|
||||||
|
void ewol::object::ParamList::add(int64_t _value, const std::string& _name, const std::string& _description) {
|
||||||
|
auto it = m_list.find(_name);
|
||||||
|
if (it != m_list.end()) {
|
||||||
|
it->second = _value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_list.insert(std::make_pair(_name, _value));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ewol::object::ParamList::getElement(int64_t _intValue) {
|
||||||
|
for (auto &it : m_list) {
|
||||||
|
if (it.second == _intValue) {
|
||||||
|
return it.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ewol::object::ParamList::getString() {
|
||||||
|
return getElement(m_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ewol::object::ParamList::getDefault() {
|
||||||
|
return getElement(m_default);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ewol::object::ParamList::getInfo() {
|
||||||
|
return "List default=" + getElement(m_default);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::object::ParamList::setString(const std::string& _newVal) {
|
||||||
|
auto it = m_list.find(_newVal);
|
||||||
|
if (it != m_list.end()) {
|
||||||
|
m_value = it->second;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EWOL_WARNING("paramList value='" << _newVal << "' is not un the list ... ==> no change");
|
||||||
|
for (auto &it : m_list) {
|
||||||
|
EWOL_DEBUG(" element : " << it.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::object::ParamList::set(int64_t _newVal) {
|
||||||
|
for (auto &it : m_list) {
|
||||||
|
if (it.second == _newVal) {
|
||||||
|
m_value = it.second;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EWOL_WARNING("paramList value=" << _newVal << " is not un the list ... ==> no change");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream& ewol::object::operator <<(std::ostream& _os, const ewol::object::ParamList& _obj) {
|
||||||
|
_os << _obj.get();
|
||||||
|
return _os;
|
||||||
|
}
|
||||||
|
|
99
sources/ewol/object/ParamList.h
Normal file
99
sources/ewol/object/ParamList.h
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_PARAM_LIST_H__
|
||||||
|
#define __EWOL_PARAM_LIST_H__
|
||||||
|
|
||||||
|
#include <ewol/object/ParameterList.h>
|
||||||
|
#include <ewol/object/Parameter.h>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace object {
|
||||||
|
class ParamList : public Parameter {
|
||||||
|
private:
|
||||||
|
int64_t m_value; //!< Element value ==> can be directly used.
|
||||||
|
int64_t m_default; //!< Default value.
|
||||||
|
std::map<std::string, int64_t> m_list; //!< pointer on the list of all elements.
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Create a parameter with List of element parameter.
|
||||||
|
* @param[in] blockLink Pointer on the reference block (must be define for upper class).
|
||||||
|
* @param[in] name Static name of the parameter.
|
||||||
|
*/
|
||||||
|
ParamList(ewol::object::ParameterList& _objectLink,
|
||||||
|
const std::string& _name) :
|
||||||
|
Parameter(_objectLink, _name),
|
||||||
|
m_value(0),
|
||||||
|
m_default(0) {
|
||||||
|
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @brief Destructor.
|
||||||
|
*/
|
||||||
|
virtual ~ParamList() {
|
||||||
|
|
||||||
|
};
|
||||||
|
void add(int64_t _value, const std::string& _name, const std::string& _description = "");
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getType() {
|
||||||
|
return "list";
|
||||||
|
};
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getString();
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getDefault();
|
||||||
|
// herited methode
|
||||||
|
virtual void setString(const std::string& _newVal);
|
||||||
|
// herited methode
|
||||||
|
virtual std::string getInfo();
|
||||||
|
// herited methode
|
||||||
|
virtual bool isDefault() {
|
||||||
|
return m_value == m_default;
|
||||||
|
}
|
||||||
|
// herited methode
|
||||||
|
virtual void setDefault() {
|
||||||
|
m_value = m_default;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Get the value of the current parameter.
|
||||||
|
* @return the Reference value
|
||||||
|
*/
|
||||||
|
const inline int64_t& get() const {
|
||||||
|
return m_value;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @brief Set the value of the current parameter.
|
||||||
|
* @param[in] _newVal New value of the parameter. (not set if out of range)
|
||||||
|
*/
|
||||||
|
void set(int64_t _newVal);
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Get the element description from real Value.
|
||||||
|
* @param[in] _intValue value that might be converted in string.
|
||||||
|
* @return the description string coresponding to this ID.
|
||||||
|
*/
|
||||||
|
std::string getElement(int64_t _intValue);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief assignement operator.
|
||||||
|
* @param[in] newVal The new value of the parameter.
|
||||||
|
*/
|
||||||
|
const ParamList& operator= (int64_t _newVal) {
|
||||||
|
set(_newVal);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
operator int64_t() {
|
||||||
|
return m_value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
std::ostream& operator <<(std::ostream& _os, const ewol::object::ParamList& _obj);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
19
sources/ewol/object/Parameter.cpp
Normal file
19
sources/ewol/object/Parameter.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/object/ParameterList.h>
|
||||||
|
#include <ewol/object/Parameter.h>
|
||||||
|
|
||||||
|
|
||||||
|
ewol::object::Parameter::Parameter(ewol::object::ParameterList& _objectLink, const std::string& _name) :
|
||||||
|
m_name(_name) {
|
||||||
|
// add a reference on the current parameter ...
|
||||||
|
_objectLink.parameterAdd(this);
|
||||||
|
}
|
||||||
|
|
69
sources/ewol/object/Parameter.h
Normal file
69
sources/ewol/object/Parameter.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/object/ParameterList.h>
|
||||||
|
|
||||||
|
#ifndef __EWOL_PARAMETER_H__
|
||||||
|
#define __EWOL_PARAMETER_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace object {
|
||||||
|
class Parameter {
|
||||||
|
private:
|
||||||
|
std::string m_name;
|
||||||
|
public:
|
||||||
|
Parameter(ewol::object::ParameterList& _objectLink, const std::string& _name);
|
||||||
|
virtual ~Parameter() { };
|
||||||
|
/**
|
||||||
|
* @brief Get the name of the parameter.
|
||||||
|
* @return The name of the parameter
|
||||||
|
*/
|
||||||
|
virtual std::string getName() {
|
||||||
|
return m_name;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @brief Get the type of the parameter in string mode.
|
||||||
|
* @return The string type of the parameter.
|
||||||
|
*/
|
||||||
|
virtual std::string getType() = 0;
|
||||||
|
/**
|
||||||
|
* @brief Get the string of the current value of the parameter.
|
||||||
|
* @return The string description of the value.
|
||||||
|
*/
|
||||||
|
virtual std::string getString() = 0;
|
||||||
|
/**
|
||||||
|
* @brief Get the string of the default value of the parameter.
|
||||||
|
* @return the string decription of the default value.
|
||||||
|
*/
|
||||||
|
virtual std::string getDefault() = 0;
|
||||||
|
/**
|
||||||
|
* @brief Set a new value of the parameter (with string interface).
|
||||||
|
* @param[in] _newVal New value of the parameters.
|
||||||
|
*/
|
||||||
|
virtual void setString(const std::string& _newVal) = 0;
|
||||||
|
/**
|
||||||
|
* @brief Description of the parameters.
|
||||||
|
* @return Descriptive information of the parameter (for remote UI).
|
||||||
|
*/
|
||||||
|
virtual std::string getInfo() = 0;
|
||||||
|
/**
|
||||||
|
* @brief Check if the value is the default
|
||||||
|
* @return true : the vakue is the default one, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool isDefault() = 0;
|
||||||
|
/**
|
||||||
|
* @brief Reset the value to the default value.
|
||||||
|
*/
|
||||||
|
virtual void setDefault() = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
75
sources/ewol/object/ParameterList.cpp
Normal file
75
sources/ewol/object/ParameterList.cpp
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/object/ParameterList.h>
|
||||||
|
#include <ewol/object/Parameter.h>
|
||||||
|
|
||||||
|
ewol::object::ParameterList::ParameterList() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ewol::object::ParameterList::~ParameterList() {
|
||||||
|
parameterClean();
|
||||||
|
}
|
||||||
|
|
||||||
|
// note this pointer is not allocated and not free at the end of the class
|
||||||
|
void ewol::object::ParameterList::parameterAdd(Parameter* _pointerOnParameter) {
|
||||||
|
if (_pointerOnParameter == nullptr) {
|
||||||
|
EWOL_ERROR("Try to link a nullptr parameters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_list.push_back(_pointerOnParameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::object::ParameterList::parameterClean() {
|
||||||
|
// remove all pointer on these parameters
|
||||||
|
m_list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note no lock is needed at this level, because the lock is done is the upper elements ...
|
||||||
|
// the parameter set might be done with a pool of parameter, allone, the overhed is bigger ...
|
||||||
|
bool ewol::object::ParameterList::parameterSet(const std::string& _parameter, const std::string& _value) {
|
||||||
|
for (auto &it : m_list) {
|
||||||
|
if( it != nullptr
|
||||||
|
&& it->getName() == _parameter) {
|
||||||
|
it->setString(_value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// can not find the parameters :
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ewol::object::ParameterList::parameterGet(const std::string& _parameter) {
|
||||||
|
for (auto &it : m_list) {
|
||||||
|
if( it != nullptr
|
||||||
|
&& it->getName() == _parameter) {
|
||||||
|
return it->getString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::object::ParameterList::parameterDisplay(bool _changeOnly) {
|
||||||
|
EWOL_INFO(" Object parameters:");
|
||||||
|
for (auto &it : m_list) {
|
||||||
|
if(it != nullptr) {
|
||||||
|
std::string paramName = it->getName();
|
||||||
|
std::string paramVal = it->getString();
|
||||||
|
std::string paramInfo = it->getInfo();
|
||||||
|
if ( _changeOnly == false
|
||||||
|
|| it->isDefault() == false) {
|
||||||
|
EWOL_INFO(" | param='" << paramName << "' value=" << paramVal << " (" << paramInfo << ")");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
EWOL_INFO(" | param=nullptr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
65
sources/ewol/object/ParameterList.h
Normal file
65
sources/ewol/object/ParameterList.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __EWOL_PARAMETER_LIST_H__
|
||||||
|
#define __EWOL_PARAMETER_LIST_H__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace object {
|
||||||
|
class Parameter;
|
||||||
|
class ParameterList {
|
||||||
|
friend class ewol::object::Parameter; // to register parameter in the list.
|
||||||
|
private:
|
||||||
|
std::vector<ewol::object::Parameter*> m_list; //!< list of availlable Parameters
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor.
|
||||||
|
*/
|
||||||
|
ParameterList();
|
||||||
|
/**
|
||||||
|
* @brief Destructor.
|
||||||
|
*/
|
||||||
|
~ParameterList();
|
||||||
|
/**
|
||||||
|
* @brief Register a parameter class pointer in the List of parameters
|
||||||
|
* @note This class does not destroy the parameter pointer!!!
|
||||||
|
* @param[in] pointerOnParameter Pointer on the parameter that might be added.
|
||||||
|
*/
|
||||||
|
void parameterAdd(Parameter* _pointerOnParameter);
|
||||||
|
/**
|
||||||
|
* @brief Remove all the parameter reference in this class.
|
||||||
|
* @note no delete, just clean and inform that a parameter has not been removed.
|
||||||
|
*/
|
||||||
|
void parameterClean();
|
||||||
|
/**
|
||||||
|
* @brief Set a specific value to the parameter reference name.
|
||||||
|
* @param[in] parameter The parameter string name.
|
||||||
|
* @param[in] value The new value of the parameter (string).
|
||||||
|
* @return true Parameter update.
|
||||||
|
* @return false Parameter not update.
|
||||||
|
*/
|
||||||
|
bool parameterSet(const std::string& _parameter, const std::string& _value);
|
||||||
|
/**
|
||||||
|
* @brief Get a specific value of the parameter reference name.
|
||||||
|
* @param[in] parameter The parameter string name.
|
||||||
|
* @return The value of the parameter (string).
|
||||||
|
*/
|
||||||
|
std::string parameterGet(const std::string& _parameter);
|
||||||
|
/**
|
||||||
|
* @brief Display all the parameter value with there name.
|
||||||
|
* @param[in] changeOnly check at true if the user want to display only parameter that are not at default value.
|
||||||
|
*/
|
||||||
|
void parameterDisplay(bool _changeOnly = false);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -96,12 +96,12 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
|||||||
(m_size.y() - m_minSize.y()) / 2.0,
|
(m_size.y() - m_minSize.y()) / 2.0,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (true == m_userFill.x()) {
|
if (true == m_userFill.get().x()) {
|
||||||
localSize.setX(m_size.x());
|
localSize.setX(m_size.x());
|
||||||
tmpOrigin.setX(0);
|
tmpOrigin.setX(0);
|
||||||
tmpTextOrigin.setX(0);
|
tmpTextOrigin.setX(0);
|
||||||
}
|
}
|
||||||
if (true == m_userFill.y()) {
|
if (true == m_userFill.get().y()) {
|
||||||
localSize.setY(m_size.y());
|
localSize.setY(m_size.y());
|
||||||
}
|
}
|
||||||
tmpOrigin += vec3(padding.xLeft(), padding.yButtom(), 0);
|
tmpOrigin += vec3(padding.xLeft(), padding.yButtom(), 0);
|
||||||
@ -123,7 +123,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
|||||||
m_text.print(label);
|
m_text.print(label);
|
||||||
|
|
||||||
|
|
||||||
if (true == m_userFill.y()) {
|
if (true == m_userFill.get().y()) {
|
||||||
tmpOrigin.setY(padding.yButtom());
|
tmpOrigin.setY(padding.yButtom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
|
|||||||
int32_t tmpOriginX = (m_size.x() - m_minSize.x()) / 2;
|
int32_t tmpOriginX = (m_size.x() - m_minSize.x()) / 2;
|
||||||
int32_t tmpOriginY = (m_size.y() - m_minSize.y()) / 2;
|
int32_t tmpOriginY = (m_size.y() - m_minSize.y()) / 2;
|
||||||
|
|
||||||
if (true == m_userFill.x()) {
|
if (true == m_userFill.get().x()) {
|
||||||
tmpSizeX = m_size.x();
|
tmpSizeX = m_size.x();
|
||||||
tmpOriginX = 0;
|
tmpOriginX = 0;
|
||||||
}
|
}
|
||||||
if (true == m_userFill.y()) {
|
if (true == m_userFill.get().y()) {
|
||||||
tmpSizeY = m_size.y();
|
tmpSizeY = m_size.y();
|
||||||
tmpOriginY = 0;
|
tmpOriginY = 0;
|
||||||
}
|
}
|
||||||
|
@ -114,10 +114,10 @@ ewol::Padding ewol::widget::Container2::calculateSizePadded(const vec2& _availla
|
|||||||
}
|
}
|
||||||
// Checkin the filling properties == > for the subElements:
|
// Checkin the filling properties == > for the subElements:
|
||||||
vec2 subElementSize = m_minSize;
|
vec2 subElementSize = m_minSize;
|
||||||
if (m_userFill.x() == true) {
|
if (m_userFill.get().x() == true) {
|
||||||
subElementSize.setX(m_size.x());
|
subElementSize.setX(m_size.x());
|
||||||
}
|
}
|
||||||
if (m_userFill.y() == true) {
|
if (m_userFill.get().y() == true) {
|
||||||
subElementSize.setY(m_size.y());
|
subElementSize.setY(m_size.y());
|
||||||
}
|
}
|
||||||
vec2 origin = (m_size - subElementSize)*0.5f + vec2(_padding.xLeft(), _padding.yButtom());
|
vec2 origin = (m_size - subElementSize)*0.5f + vec2(_padding.xLeft(), _padding.yButtom());
|
||||||
|
@ -146,10 +146,10 @@ void ewol::widget::Entry::onRegenerateDisplay() {
|
|||||||
ewol::Padding padding = m_shaper.getPadding();
|
ewol::Padding padding = m_shaper.getPadding();
|
||||||
|
|
||||||
vec2 tmpSizeShaper = m_minSize;
|
vec2 tmpSizeShaper = m_minSize;
|
||||||
if (true == m_userFill.x()) {
|
if (true == m_userFill.get().x()) {
|
||||||
tmpSizeShaper.setX(m_size.x());
|
tmpSizeShaper.setX(m_size.x());
|
||||||
}
|
}
|
||||||
if (true == m_userFill.y()) {
|
if (true == m_userFill.get().y()) {
|
||||||
tmpSizeShaper.setY(m_size.y());
|
tmpSizeShaper.setY(m_size.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ void ewol::widget::Entry::updateTextPosition() {
|
|||||||
ewol::Padding padding = m_shaper.getPadding();
|
ewol::Padding padding = m_shaper.getPadding();
|
||||||
|
|
||||||
int32_t tmpSizeX = m_minSize.x();
|
int32_t tmpSizeX = m_minSize.x();
|
||||||
if (true == m_userFill.x()) {
|
if (true == m_userFill.get().x()) {
|
||||||
tmpSizeX = m_size.x();
|
tmpSizeX = m_size.x();
|
||||||
}
|
}
|
||||||
int32_t tmpUserSize = tmpSizeX - padding.x();
|
int32_t tmpUserSize = tmpSizeX - padding.x();
|
||||||
|
@ -156,12 +156,12 @@ void ewol::widget::Image::onRegenerateDisplay() {
|
|||||||
vec2 ratioSizeDisplayRequested = m_posStop - m_posStart;
|
vec2 ratioSizeDisplayRequested = m_posStop - m_posStart;
|
||||||
//imageRealSizeMax *= ratioSizeDisplayRequested;
|
//imageRealSizeMax *= ratioSizeDisplayRequested;
|
||||||
|
|
||||||
if (m_userFill.x() == true) {
|
if (m_userFill.get().x() == true) {
|
||||||
imageRealSize.setX(imageRealSizeMax.x());
|
imageRealSize.setX(imageRealSizeMax.x());
|
||||||
} else {
|
} else {
|
||||||
origin.setX(origin.x() + (m_size.x()-m_minSize.x())*0.5f);
|
origin.setX(origin.x() + (m_size.x()-m_minSize.x())*0.5f);
|
||||||
}
|
}
|
||||||
if (m_userFill.y() == true) {
|
if (m_userFill.get().y() == true) {
|
||||||
imageRealSize.setY(imageRealSizeMax.y());
|
imageRealSize.setY(imageRealSizeMax.y());
|
||||||
} else {
|
} else {
|
||||||
origin.setY(origin.y() + (m_size.y()-m_minSize.y())*0.5f);
|
origin.setY(origin.y() + (m_size.y()-m_minSize.y())*0.5f);
|
||||||
|
@ -99,11 +99,11 @@ void ewol::widget::Label::onRegenerateDisplay() {
|
|||||||
(m_size.y() - m_minSize.y()) / 2.0,
|
(m_size.y() - m_minSize.y()) / 2.0,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (m_userFill.x() == true) {
|
if (m_userFill.get().x() == true) {
|
||||||
localSize.setX(m_size.x());
|
localSize.setX(m_size.x());
|
||||||
tmpTextOrigin.setX(0);
|
tmpTextOrigin.setX(0);
|
||||||
}
|
}
|
||||||
if (m_userFill.y() == true) {
|
if (m_userFill.get().y() == true) {
|
||||||
localSize.setY(m_size.y());
|
localSize.setY(m_size.y());
|
||||||
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
|
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ ewol::Widget::Widget() :
|
|||||||
m_userMinSize(vec2(0,0),ewol::Dimension::Pixel),
|
m_userMinSize(vec2(0,0),ewol::Dimension::Pixel),
|
||||||
m_userMaxSize(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel),
|
m_userMaxSize(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel),
|
||||||
m_userExpand(false,false),
|
m_userExpand(false,false),
|
||||||
m_userFill(false,false),
|
m_userFill(*this, "fill", bvec2(false,false)),
|
||||||
m_hide(false),
|
m_hide(false),
|
||||||
m_gravity(ewol::gravityButtomLeft),
|
m_gravity(ewol::gravityButtomLeft),
|
||||||
m_hasFocus(false),
|
m_hasFocus(false),
|
||||||
@ -509,8 +509,8 @@ bvec2 ewol::Widget::canExpand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Widget::setFill(const bvec2& _newFill) {
|
void ewol::Widget::setFill(const bvec2& _newFill) {
|
||||||
if( m_userFill.x() != _newFill.x()
|
if( m_userFill.get().x() != _newFill.x()
|
||||||
|| m_userFill.y() != _newFill.y()) {
|
|| m_userFill.get().y() != _newFill.y()) {
|
||||||
m_userFill = _newFill;
|
m_userFill = _newFill;
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -518,7 +518,7 @@ void ewol::Widget::setFill(const bvec2& _newFill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bvec2& ewol::Widget::canFill() {
|
const bvec2& ewol::Widget::canFill() {
|
||||||
return m_userFill;
|
return m_userFill.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
@ -799,7 +799,7 @@ bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_config == ewol::Widget::configFill) {
|
if (_config == ewol::Widget::configFill) {
|
||||||
_result = m_userFill;
|
_result = m_userFill.get();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_config == ewol::Widget::configExpand) {
|
if (_config == ewol::Widget::configExpand) {
|
||||||
|
@ -311,7 +311,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
virtual bvec2 canExpand();
|
virtual bvec2 canExpand();
|
||||||
protected:
|
protected:
|
||||||
bvec2 m_userFill;
|
ewol::object::Param<bvec2> m_userFill;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief set the x&y filling capacity
|
* @brief set the x&y filling capacity
|
||||||
@ -323,7 +323,7 @@ namespace ewol {
|
|||||||
* @return bvec2 repensent the capacity to x&y filling (set by the user)
|
* @return bvec2 repensent the capacity to x&y filling (set by the user)
|
||||||
*/
|
*/
|
||||||
virtual const bvec2& getFill() {
|
virtual const bvec2& getFill() {
|
||||||
return m_userFill;
|
return m_userFill.get();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief get the filling capabilities x&y
|
* @brief get the filling capabilities x&y
|
||||||
|
@ -94,7 +94,11 @@ def create(target):
|
|||||||
'ewol/object/Message.cpp',
|
'ewol/object/Message.cpp',
|
||||||
'ewol/object/MultiCast.cpp',
|
'ewol/object/MultiCast.cpp',
|
||||||
'ewol/object/Object.cpp',
|
'ewol/object/Object.cpp',
|
||||||
'ewol/object/RemoveEvent.cpp'
|
'ewol/object/RemoveEvent.cpp',
|
||||||
|
'ewol/object/Parameter.cpp',
|
||||||
|
'ewol/object/ParameterList.cpp',
|
||||||
|
'ewol/object/ParamList.cpp',
|
||||||
|
'ewol/object/Param.cpp'
|
||||||
])
|
])
|
||||||
|
|
||||||
# OpenGL interface :
|
# OpenGL interface :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user