[DEV] change default Instance

This commit is contained in:
Edouard DUPIN 2014-08-13 22:30:47 +02:00
parent 5c7fe3bda5
commit 9cb928b973
61 changed files with 630 additions and 715 deletions

2
external/airtaudio vendored

@ -1 +1 @@
Subproject commit b0eb151df0802a1d63a5cb6b6812a4460ddd09a1
Subproject commit e15bfbe18e883fe3170a49a03732ad5dfe389fa8

2
external/egami vendored

@ -1 +1 @@
Subproject commit fdeaf2015c079735f1674b97d196e0f9a0c94a2c
Subproject commit 3698cdc92500d9e29d810fa2d7094999f4a3dfe3

2
external/ege vendored

@ -1 +1 @@
Subproject commit 36744f57e56fd7c8fd3738f6489c3a091b0aa595
Subproject commit 449d1b13d3a8e4129ee36215e6da1495a1ef012d

2
external/ejson vendored

@ -1 +1 @@
Subproject commit d9c98697edabf3ded9a46bc1cc83c58b1ab9cd62
Subproject commit 53e2f04072d64d4282bc542081312b545546837f

2
external/enet vendored

@ -1 +1 @@
Subproject commit dd76dbf0fd4ad1b16fb7c7ca360cf5c1ad1f41be
Subproject commit 5a108ecdac60de39af102d9c158a87ab1c9ee6b2

2
external/etk vendored

@ -1 +1 @@
Subproject commit 28c433bb4e598726c7caeb8edec3b50a154bb9c2
Subproject commit 4c20238d3c6a6aee05fa2819fefb9c41075510c7

2
external/ewolsa vendored

@ -1 +1 @@
Subproject commit 875e52574e5012e2ccaf2c6dbc1167b3cfe1129a
Subproject commit 33fe9dfba589f3e8b3d518790397de9828eb7617

2
external/exml vendored

@ -1 +1 @@
Subproject commit c7d2b2e8719f30b3d5a1e8330838e44f8d1a179a
Subproject commit d97fe2efa78ad3cca682c156a3ca2f036ce1e7bf

2
monk

@ -1 +1 @@
Subproject commit 85ebc5ec327c3920264de479c8b1049c1b81596c
Subproject commit 895e18786ce732e8cc1c282863677c21e1806062

View File

@ -89,28 +89,28 @@ void ewol::Dimension::set(std::string _config) {
m_data.setValue(0,0);
m_type = ewol::Dimension::Pixel;
enum distance type = ewol::Dimension::Pixel;
if (end_with(_config, "%", false) == true) {
if (etk::end_with(_config, "%", false) == true) {
type = ewol::Dimension::Pourcent;
_config.erase(_config.size()-1, 1);
} else if (end_with(_config, "px",false) == true) {
} else if (etk::end_with(_config, "px",false) == true) {
type = ewol::Dimension::Pixel;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "ft",false) == true) {
} else if (etk::end_with(_config, "ft",false) == true) {
type = ewol::Dimension::foot;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "in",false) == true) {
} else if (etk::end_with(_config, "in",false) == true) {
type = ewol::Dimension::Inch;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "km",false) == true) {
} else if (etk::end_with(_config, "km",false) == true) {
type = ewol::Dimension::Kilometer;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "mm",false) == true) {
} else if (etk::end_with(_config, "mm",false) == true) {
type = ewol::Dimension::Millimeter;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "cm",false) == true) {
} else if (etk::end_with(_config, "cm",false) == true) {
type = ewol::Dimension::Centimeter;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "m",false) == true) {
} else if (etk::end_with(_config, "m",false) == true) {
type = ewol::Dimension::Meter;
_config.erase(_config.size()-1, 1);
} else {

View File

@ -625,18 +625,18 @@ const etk::Color<float>& ewol::compositing::Shaper::getColor(int32_t _id) {
template<> std::string std::to_string<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
template<> std::string etk::to_string<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
return _obj.getSource();
}
template<> std::u32string std::to_u32string<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
return std::to_u32string(std::to_string(_obj));
template<> std::u32string etk::to_u32string<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool std::from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const std::string& _value) {
template<> bool etk::from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const std::string& _value) {
_variableRet.setSource(_value);
return true;
}
template<> bool std::from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, std::to_string(_value));
template<> bool etk::from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}

View File

@ -160,7 +160,7 @@ void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize)
_fontName = ewol::getContext().getFontDefault().getName();
}
_fontName += ":";
_fontName += std::to_string(_fontSize);
_fontName += etk::to_string(_fontSize);
EWOL_VERBOSE("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName);
// link to new one
m_font = ewol::resource::TexturedFont::create(_fontName);

View File

@ -255,7 +255,7 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
// nothing to do ...
} else if (_element->getType(iii) == exml::typeText) {
exml::Node* child = _element->getNode(iii);
htmlAddData(std::to_u32string(child->getValue()));
htmlAddData(etk::to_u32string(child->getValue()));
EWOL_VERBOSE("XML add : " << child->getValue());
continue;
} else if (_element->getType(iii)!=exml::typeElement) {
@ -267,11 +267,11 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
EWOL_ERROR("Cast error ...");
continue;
}
if(compare_no_case(elem->getValue(), "br") == true) {
if(etk::compare_no_case(elem->getValue(), "br") == true) {
htmlFlush();
EWOL_VERBOSE("XML flush & newLine");
forceLineReturn();
} else if (compare_no_case(elem->getValue(), "font") == true) {
} else if (etk::compare_no_case(elem->getValue(), "font") == true) {
EWOL_VERBOSE("XML Font ...");
TextDecoration tmpDeco = m_htmlDecoTmp;
std::string colorValue = elem->getAttribute("color");
@ -284,8 +284,8 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
}
parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco;
} else if( compare_no_case(elem->getValue(), "b") == true
|| compare_no_case(elem->getValue(), "bold") == true) {
} else if( etk::compare_no_case(elem->getValue(), "b") == true
|| etk::compare_no_case(elem->getValue(), "bold") == true) {
EWOL_VERBOSE("XML bold ...");
TextDecoration tmpDeco = m_htmlDecoTmp;
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
@ -295,8 +295,8 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
}
parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco;
} else if( compare_no_case(elem->getValue(), "i") == true
|| compare_no_case(elem->getValue(), "italic") == true) {
} else if( etk::compare_no_case(elem->getValue(), "i") == true
|| etk::compare_no_case(elem->getValue(), "italic") == true) {
EWOL_VERBOSE("XML italic ...");
TextDecoration tmpDeco = m_htmlDecoTmp;
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
@ -306,34 +306,34 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
}
parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco;
} else if( compare_no_case(elem->getValue(), "u") == true
|| compare_no_case(elem->getValue(), "underline") == true) {
} else if( etk::compare_no_case(elem->getValue(), "u") == true
|| etk::compare_no_case(elem->getValue(), "underline") == true) {
EWOL_VERBOSE("XML underline ...");
parseHtmlNode(elem);
} else if( compare_no_case(elem->getValue(), "p") == true
|| compare_no_case(elem->getValue(), "paragraph") == true) {
} else if( etk::compare_no_case(elem->getValue(), "p") == true
|| etk::compare_no_case(elem->getValue(), "paragraph") == true) {
EWOL_VERBOSE("XML paragraph ...");
htmlFlush();
m_alignement = alignLeft;
forceLineReturn();
parseHtmlNode(elem);
forceLineReturn();
} else if (compare_no_case(elem->getValue(), "center") == true) {
} else if (etk::compare_no_case(elem->getValue(), "center") == true) {
EWOL_VERBOSE("XML center ...");
htmlFlush();
m_alignement = alignCenter;
parseHtmlNode(elem);
} else if (compare_no_case(elem->getValue(), "left") == true) {
} else if (etk::compare_no_case(elem->getValue(), "left") == true) {
EWOL_VERBOSE("XML left ...");
htmlFlush();
m_alignement = alignLeft;
parseHtmlNode(elem);
} else if (compare_no_case(elem->getValue(), "right") == true) {
} else if (etk::compare_no_case(elem->getValue(), "right") == true) {
EWOL_VERBOSE("XML right ...");
htmlFlush();
m_alignement = alignRight;
parseHtmlNode(elem);
} else if (compare_no_case(elem->getValue(), "justify") == true) {
} else if (etk::compare_no_case(elem->getValue(), "justify") == true) {
EWOL_VERBOSE("XML justify ...");
htmlFlush();
m_alignement = alignJustify;
@ -396,7 +396,7 @@ void ewol::compositing::TextBase::printHTML(const std::u32string& _text) {
m_htmlDecoTmp.m_colorFg = m_defaultColorFg;
m_htmlDecoTmp.m_mode = ewol::font::Regular;
// TODO : Create an instance of xml parser to manage std::u32string...
if (doc.parse(std::to_string(_text)) == false) {
if (doc.parse(etk::to_string(_text)) == false) {
EWOL_ERROR( "can not load XML: PARSING error: Decorated text ");
return;
}

View File

@ -66,7 +66,7 @@ namespace ewol {
// herited methode
virtual void setString(const std::string& _newVal) {
// when you want to set an element in parameter you will implement the function template std::from_string
std::from_string(m_value, _newVal);
etk::from_string(m_value, _newVal);
}
// herited methode
virtual std::string getInfo() const {
@ -105,7 +105,7 @@ namespace ewol {
* @return convetion of the velue in string.
*/
std::string getValueSpecific(const MY_TYPE& _valueRequested) const {
return std::to_string(_valueRequested);
return etk::to_string(_valueRequested);
}
public:
/**
@ -116,12 +116,18 @@ namespace ewol {
set(_newVal);
return *this;
};
operator MY_TYPE() const {
operator const MY_TYPE&() const {
return m_value;
}
inline MY_TYPE& operator *() const {
MY_TYPE& operator *() const noexcept {
return m_value;
}
const MY_TYPE* operator->() const noexcept {
return &m_value;
}
MY_TYPE* operator->() noexcept {
return &m_value;
}
};
template<typename MY_TYPE> std::ostream& operator <<(std::ostream& _os, const ewol::object::Param<MY_TYPE>& _obj) {

View File

@ -140,9 +140,18 @@ namespace ewol {
set(_newVal);
return *this;
}
operator MY_TYPE() const {
operator const MY_TYPE&() const {
return m_value;
}
MY_TYPE& operator *() const noexcept {
return m_value;
}
const MY_TYPE* operator->() const noexcept {
return &m_value;
}
MY_TYPE* operator->() noexcept {
return &m_value;
}
};
template<typename MY_TYPE> std::ostream& operator <<(std::ostream& _os, const ewol::object::ParamList<MY_TYPE>& _obj) {
_os << _obj.get();

View File

@ -65,7 +65,7 @@ namespace ewol {
virtual void setString(const std::string& _newVal) {
MY_TYPE val;
// when you want to set an element in parameter you will implement the function template std::from_string
std::from_string(val, _newVal);
etk::from_string(val, _newVal);
set(val);
}
// herited methode
@ -109,7 +109,7 @@ namespace ewol {
* @return convetion of the velue in string.
*/
std::string getValueSpecific(const MY_TYPE& _valueRequested) const {
return std::to_string(_valueRequested);
return etk::to_string(_valueRequested);
}
public:
/**
@ -120,9 +120,18 @@ namespace ewol {
set(_newVal);
return *this;
};
operator MY_TYPE() const {
operator const MY_TYPE&() const {
return m_value;
}
MY_TYPE& operator *() const noexcept {
return m_value;
}
const MY_TYPE* operator->() const noexcept {
return &m_value;
}
MY_TYPE* operator->() noexcept {
return &m_value;
}
};
template<typename MY_TYPE> std::ostream& operator <<(std::ostream& _os, const ewol::object::ParamRange<MY_TYPE>& _obj) {

View File

@ -20,4 +20,11 @@ ewol::object::Parameter::Parameter(ewol::object::ParameterList& _objectLink, con
void ewol::object::Parameter::notifyChange() const {
m_objectLink.onParameterChangeValue(ewol::object::ParameterRef(this));
}
bool ewol::object::operator==(const ParameterRef& _obj, const Parameter& _obj2) noexcept {
return &_obj2 == _obj.m_ref;
}
bool ewol::object::operator==(const Parameter& _obj2, const ParameterRef& _obj) noexcept {
return &_obj2 == _obj.m_ref;
}

View File

@ -78,12 +78,8 @@ namespace ewol {
// nothing to do ...
}
};
bool operator==(const ParameterRef& _obj, const Parameter& _obj2) noexcept {
return &_obj2 == _obj.m_ref;
}
bool operator==(const Parameter& _obj2, const ParameterRef& _obj) noexcept {
return &_obj2 == _obj.m_ref;
}
bool operator==(const ParameterRef& _obj, const Parameter& _obj2) noexcept;
bool operator==(const Parameter& _obj2, const ParameterRef& _obj) noexcept;
};
};

View File

@ -52,7 +52,7 @@ void ewol::resource::DistanceFieldFont::init(const std::string& _fontName) {
// find the real Font name :
std::vector<std::string> output;
myFolder.folderGetRecursiveFiles(output);
std::vector<std::string> split = std::split(localName, ';');
std::vector<std::string> split = etk::split(localName, ';');
EWOL_INFO("try to find font named : " << split << " in: " << myFolder);
//EWOL_CRITICAL("parse string : " << split);
bool hasFindAFont = false;
@ -60,11 +60,11 @@ void ewol::resource::DistanceFieldFont::init(const std::string& _fontName) {
EWOL_INFO(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) {
//EWOL_DEBUG(" file : " << output[iii]);
if( true == end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"regular"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"r"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+".ttf", false)) {
if( true == etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+".ttf", false)) {
EWOL_INFO(" find Font [Regular] : " << output[iii]);
m_fileName = output[iii];
hasFindAFont=true;
@ -352,7 +352,7 @@ void ewol::resource::DistanceFieldFont::exportOnFile() {
if (tmpObj == nullptr) {
continue;
}
tmpObj->addString("m_UVal", std::to_string(m_listElement[iii].m_UVal));
tmpObj->addString("m_UVal", etk::to_string(m_listElement[iii].m_UVal));
tmpObj->addNumber("m_glyphIndex", m_listElement[iii].m_glyphIndex);
tmpObj->addString("m_sizeTexture", (std::string)m_listElement[iii].m_sizeTexture);
tmpObj->addString("m_bearing", (std::string)m_listElement[iii].m_bearing);
@ -403,7 +403,7 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
continue;
}
GlyphProperty prop;
prop.m_UVal = std::stoi(tmpObj->getStringValue("m_UVal", "0"));
prop.m_UVal = etk::string_to_int32_t(tmpObj->getStringValue("m_UVal", "0"));
prop.m_glyphIndex = tmpObj->getNumberValue("m_glyphIndex", 0);
prop.m_sizeTexture = tmpObj->getStringValue("m_sizeTexture", "0,0");
prop.m_bearing = tmpObj->getStringValue("m_bearing", "0,0");

View File

@ -84,7 +84,7 @@ std::shared_ptr<ewol::resource::TextureFile> ewol::resource::TextureFile::create
//EWOL_ERROR("Error Request the image size.y() =0 ???");
}
std::string TmpFilename = _filename;
if (false == end_with(_filename, ".svg") ) {
if (false == etk::end_with(_filename, ".svg") ) {
_size = ivec2(-1,-1);
}
#ifdef __TARGET_OS__MacOs
@ -97,9 +97,9 @@ std::shared_ptr<ewol::resource::TextureFile> ewol::resource::TextureFile::create
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif
TmpFilename += ":";
TmpFilename += std::to_string(_size.x());
TmpFilename += etk::to_string(_size.x());
TmpFilename += "x";
TmpFilename += std::to_string(_size.y());
TmpFilename += etk::to_string(_size.y());
}
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);

View File

@ -173,7 +173,7 @@ std::shared_ptr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const s
//EWOL_ERROR("Error Request the image size.y() =0 ???");
}
std::string TmpFilename = _filename;
if (false == end_with(_filename, ".svg") ) {
if (false == etk::end_with(_filename, ".svg") ) {
_size = ivec2(-1,-1);
}
#ifdef __TARGET_OS__MacOs
@ -186,9 +186,9 @@ std::shared_ptr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const s
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif
TmpFilename += ":";
TmpFilename += std::to_string(_size.x());
TmpFilename += etk::to_string(_size.x());
TmpFilename += "x";
TmpFilename += std::to_string(_size.y());
TmpFilename += etk::to_string(_size.y());
}
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);

View File

@ -30,9 +30,9 @@ void ewol::resource::Shader::init(const std::string& _filename) {
EWOL_DEBUG("OGL : load SHADER \"" << _filename << "\"");
// load data from file "all the time ..."
if (std::end_with(m_name, ".frag") == true) {
if (etk::end_with(m_name, ".frag") == true) {
m_type = GL_FRAGMENT_SHADER;
} else if (std::end_with(m_name, ".vert") == true) {
} else if (etk::end_with(m_name, ".vert") == true) {
m_type = GL_VERTEX_SHADER;
} else {
EWOL_ERROR("File does not have extention \".vert\" for Vertex Shader or \".frag\" for Fragment Shader. but : \"" << m_name << "\"");
@ -91,7 +91,7 @@ void ewol::resource::Shader::updateContext() {
}
EWOL_ERROR("Could not compile \"" << tmpShaderType << "\" name='" << m_name << "'");
EWOL_ERROR("Error " << l_bufferDisplayError);
std::vector<std::string> lines = std::split(m_fileData, '\n');
std::vector<std::string> lines = etk::split(m_fileData, '\n');
for (size_t iii=0 ; iii<lines.size() ; iii++) {
EWOL_ERROR("file " << (iii+1) << "|" << lines[iii]);
}

View File

@ -107,7 +107,7 @@ void ewol::resource::TexturedFont::init(const std::string& _fontName) {
// find the real Font name :
std::vector<std::string> output;
myFolder.folderGetRecursiveFiles(output);
std::vector<std::string> split = std::split(localName, ';');
std::vector<std::string> split = etk::split(localName, ';');
EWOL_INFO("try to find font named : " << split << " in: " << myFolder);
//EWOL_CRITICAL("parse string : " << split);
bool hasFindAFont = false;
@ -115,42 +115,42 @@ void ewol::resource::TexturedFont::init(const std::string& _fontName) {
EWOL_INFO(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) {
//EWOL_DEBUG(" file : " << output[iii]);
if( true == end_with(output[iii], split[jjj]+"-"+"bold"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"b"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"bd"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"bold"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"bd"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"b"+".ttf", false)) {
if( true == etk::end_with(output[iii], split[jjj]+"-"+"bold"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"b"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"bd"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"bold"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"bd"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"b"+".ttf", false)) {
EWOL_INFO(" find Font [Bold] : " << output[iii]);
m_fileName[ewol::font::Bold] = output[iii];
hasFindAFont=true;
} else if( true == end_with(output[iii], split[jjj]+"-"+"oblique"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"italic"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"Light"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"i"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"oblique"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"italic"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"light"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"i"+".ttf", false)) {
} else if( true == etk::end_with(output[iii], split[jjj]+"-"+"oblique"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"italic"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"Light"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"i"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"oblique"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"italic"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"light"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"i"+".ttf", false)) {
EWOL_INFO(" find Font [Italic] : " << output[iii]);
m_fileName[ewol::font::Italic] = output[iii];
hasFindAFont=true;
} else if( true == end_with(output[iii], split[jjj]+"-"+"bolditalic"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"boldoblique"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"bi"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"z"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"bolditalic"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"boldoblique"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"bi"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"z"+".ttf", false)) {
} else if( true == etk::end_with(output[iii], split[jjj]+"-"+"bolditalic"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"boldoblique"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"bi"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"z"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"bolditalic"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"boldoblique"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"bi"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"z"+".ttf", false)) {
EWOL_INFO(" find Font [Bold-Italic] : " << output[iii]);
m_fileName[ewol::font::BoldItalic] = output[iii];
hasFindAFont=true;
} else if( true == end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"regular"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+"r"+".ttf", false)
|| true == end_with(output[iii], split[jjj]+".ttf", false)) {
} else if( true == etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+".ttf", false)) {
EWOL_INFO(" find Font [Regular] : " << output[iii]);
m_fileName[ewol::font::Regular] = output[iii];
hasFindAFont=true;

View File

@ -218,7 +218,7 @@ void ewol::translate::autoDetectLanguage() {
std::string lang;
lang += s[0];
lang += s[1];
lang = toupper(lang);
lang = etk::toupper(lang);
getInstanceTranslation().setLanguage(lang);
}
#else

View File

@ -63,7 +63,7 @@ ewol::widget::Button::Button() :
void ewol::widget::Button::init(const std::string& _shaperName) {
ewol::widget::Container2::init();
m_shaper.get().setSource(_shaperName);
m_shaper->setSource(_shaperName);
}
@ -74,12 +74,12 @@ ewol::widget::Button::~Button() {
void ewol::widget::Button::setShaperName(const std::string& _shaperName) {
EWOL_WARNING("set shaper name : '" << _shaperName << "'");
m_shaper.get().setSource(_shaperName);
m_shaper->setSource(_shaperName);
markToRedraw();
}
void ewol::widget::Button::calculateSize(const vec2& _availlable) {
ewol::Padding padding = m_shaper.get().getPadding();
ewol::Padding padding = m_shaper->getPadding();
ewol::Padding ret = calculateSizePadded(_availlable, padding);
//EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << "");
m_selectableAreaPos = vec2(ret.xLeft(), ret.yButtom());
@ -88,13 +88,13 @@ void ewol::widget::Button::calculateSize(const vec2& _availlable) {
void ewol::widget::Button::calculateMinMaxSize() {
ewol::Padding padding = m_shaper.get().getPadding();
ewol::Padding padding = m_shaper->getPadding();
calculateMinMaxSizePadded(padding);
}
void ewol::widget::Button::onDraw() {
// draw the shaaper (if needed indeed)
m_shaper.get().draw();
m_shaper->draw();
}
void ewol::widget::Button::onRegenerateDisplay() {
@ -102,8 +102,8 @@ void ewol::widget::Button::onRegenerateDisplay() {
if (needRedraw() == false) {
return;
}
ewol::Padding padding = m_shaper.get().getPadding();
m_shaper.get().setShape(vec2(0,0),
ewol::Padding padding = m_shaper->getPadding();
m_shaper->setShape(vec2(0,0),
m_size,
vec2ClipInt32(m_selectableAreaPos+vec2(padding.xLeft(),padding.yButtom()) ),
vec2ClipInt32(m_selectableAreaSize-vec2(padding.x(),padding.y()) ) );
@ -253,12 +253,12 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
EWOL_VERBOSE(getName() << " : Generate event : " << eventPressed);
generateEventId(eventPressed);
EWOL_VERBOSE(getName() << " : Generate event : " << eventValue << " val=" << m_value );
generateEventId(eventValue, std::to_string(m_value));
generateEventId(eventValue, etk::to_string(m_value));
if( false == m_toggleMode
&& true == m_value) {
setValue(false);
EWOL_VERBOSE(getName() << " : Generate event : " << ewol::widget::Button::eventValue << " val=" << m_value);
generateEventId(eventValue, std::to_string(m_value));
generateEventId(eventValue, etk::to_string(m_value));
}
}
markToRedraw();
@ -304,7 +304,7 @@ void ewol::widget::Button::CheckStatus() {
}
void ewol::widget::Button::changeStatusIn(int32_t _newStatusId) {
if (true == m_shaper.get().changeStatusIn(_newStatusId) ) {
if (true == m_shaper->changeStatusIn(_newStatusId) ) {
periodicCallEnable();
markToRedraw();
}
@ -312,7 +312,7 @@ void ewol::widget::Button::changeStatusIn(int32_t _newStatusId) {
void ewol::widget::Button::periodicCall(const ewol::event::Time& _event) {
if (false == m_shaper.get().periodicCall(_event) ) {
if (false == m_shaper->periodicCall(_event) ) {
periodicCallDisable();
}
markToRedraw();
@ -324,26 +324,26 @@ bool ewol::widget::Button::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == configToggle) {
setToggleMode(std::stob(_conf.getData()));
setToggleMode(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configLock) {
enum buttonLock tmpLock = lockNone;
if( compare_no_case(_conf.getData(), "true") == true
|| compare_no_case(_conf.getData(), "1") == true) {
if( etk::compare_no_case(_conf.getData(), "true") == true
|| etk::compare_no_case(_conf.getData(), "1") == true) {
tmpLock = lockAccess;
} else if( compare_no_case(_conf.getData(), "down") == true
|| compare_no_case(_conf.getData(), "pressed") == true) {
} else if( etk::compare_no_case(_conf.getData(), "down") == true
|| etk::compare_no_case(_conf.getData(), "pressed") == true) {
tmpLock = lockWhenPressed;
} else if( compare_no_case(_conf.getData(), "up") == true
|| compare_no_case(_conf.getData(), "released") == true) {
} else if( etk::compare_no_case(_conf.getData(), "up") == true
|| etk::compare_no_case(_conf.getData(), "released") == true) {
tmpLock = lockWhenReleased;
}
setLock(tmpLock);
return true;
}
if (_conf.getConfig() == configValue) {
setValue(std::stob(_conf.getData()));
setValue(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShaper) {
@ -351,7 +351,7 @@ bool ewol::widget::Button::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == configEnableSingle) {
setEnableSingle(std::stob(_conf.getData()));
setEnableSingle(etk::string_to_bool(_conf.getData()));
return true;
}
return false;
@ -362,7 +362,7 @@ bool ewol::widget::Button::onGetConfig(const char* _config, std::string& _result
return true;
}
if (_config == configToggle) {
_result = std::to_string(getToggleMode());
_result = etk::to_string(getToggleMode());
return true;
}
if (_config == configLock) {
@ -384,11 +384,11 @@ bool ewol::widget::Button::onGetConfig(const char* _config, std::string& _result
return true;
}
if (_config == configValue) {
_result = std::to_string(getValue());
_result = etk::to_string(getValue());
return true;
}
if (_config == configShaper) {
_result = m_shaper.get().getSource();
_result = m_shaper->getSource();
return true;
}
if (_config == configEnableSingle) {

View File

@ -96,12 +96,12 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
(m_size.y() - m_minSize.y()) / 2.0,
0);
if (true == m_userFill.get().x()) {
if (true == m_userFill->x()) {
localSize.setX(m_size.x());
tmpOrigin.setX(0);
tmpTextOrigin.setX(0);
}
if (true == m_userFill.get().y()) {
if (true == m_userFill->y()) {
localSize.setY(m_size.y());
}
tmpOrigin += vec3(padding.xLeft(), padding.yButtom(), 0);
@ -123,7 +123,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
m_text.print(label);
if (true == m_userFill.get().y()) {
if (true == m_userFill->y()) {
tmpOrigin.setY(padding.yButtom());
}

View File

@ -15,9 +15,6 @@ const char* const ewol::widget::CheckBox::eventUp = "up";
const char* const ewol::widget::CheckBox::eventEnter = "enter";
const char* const ewol::widget::CheckBox::eventValue = "value";
const char* const ewol::widget::CheckBox::configValue = "value";
const char* const ewol::widget::CheckBox::configShaper = "shaper";
// DEFINE for the shader display system :
#define STATUS_UP (0)
@ -29,13 +26,14 @@ const char* const ewol::widget::CheckBox::configShaper = "shaper";
ewol::widget::CheckBox::CheckBox() :
m_shaper(*this, "shaper", "The display name for config file"),
m_mouseHover(false),
m_buttonPressed(false),
m_selectableAreaPos(0,0),
m_selectableAreaSize(0,0),
m_shaperIdSize(-1),
m_shaperIdSizeInsize(-1),
m_value(false) {
m_value(*this, "value", false, "Basic value of the widget") {
addObjectType("ewol::widget::CheckBox");
// add basic Event generated :
addEventId(eventPressed);
@ -43,12 +41,9 @@ ewol::widget::CheckBox::CheckBox() :
addEventId(eventUp);
addEventId(eventEnter);
addEventId(eventValue);
// add configuration
registerConfig(configValue, "bool", nullptr, "Basic value of the widget");
registerConfig(configShaper, "string", nullptr, "the display name for config file");
m_shaperIdSize = m_shaper.requestConfig("box-size");
m_shaperIdSizeInsize = m_shaper.requestConfig("box-inside");
m_shaperIdSize = m_shaper->requestConfig("box-size");
m_shaperIdSizeInsize = m_shaper->requestConfig("box-inside");
// shaper satatus update:
CheckStatus();
@ -61,7 +56,7 @@ ewol::widget::CheckBox::CheckBox() :
void ewol::widget::CheckBox::init(const std::string& _shaperName) {
ewol::widget::Container2::init();
m_shaper.setSource(_shaperName);
m_shaper->setSource(_shaperName);
}
ewol::widget::CheckBox::~CheckBox() {
@ -70,13 +65,13 @@ ewol::widget::CheckBox::~CheckBox() {
void ewol::widget::CheckBox::setShaperName(const std::string& _shaperName) {
EWOL_WARNING("set shaper name : '" << _shaperName << "'");
m_shaper.setSource(_shaperName);
m_shaper->setSource(_shaperName);
markToRedraw();
}
void ewol::widget::CheckBox::calculateSize(const vec2& _availlable) {
ewol::Padding padding = m_shaper.getPadding();
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
ewol::Padding padding = m_shaper->getPadding();
float boxSize = m_shaper->getConfigNumber(m_shaperIdSize);
padding.setXLeft(padding.xLeft()*2.0f + boxSize);
ewol::Padding ret = calculateSizePadded(_availlable, padding);
//EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << "");
@ -85,8 +80,8 @@ void ewol::widget::CheckBox::calculateSize(const vec2& _availlable) {
}
void ewol::widget::CheckBox::calculateMinMaxSize() {
ewol::Padding padding = m_shaper.getPadding();
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
ewol::Padding padding = m_shaper->getPadding();
float boxSize = m_shaper->getConfigNumber(m_shaperIdSize);
padding.setXLeft(padding.xLeft()*2.0f + boxSize);
calculateMinMaxSizePadded(padding);
if (m_size.y() < padding.y()+boxSize) {
@ -96,7 +91,7 @@ void ewol::widget::CheckBox::calculateMinMaxSize() {
void ewol::widget::CheckBox::onDraw() {
// draw the shaaper (if needed indeed)
m_shaper.draw();
m_shaper->draw();
}
void ewol::widget::CheckBox::onRegenerateDisplay() {
@ -104,20 +99,20 @@ void ewol::widget::CheckBox::onRegenerateDisplay() {
if (needRedraw() == false) {
return;
}
ewol::Padding padding = m_shaper.getPadding();
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
float boxInside = m_shaper.getConfigNumber(m_shaperIdSizeInsize);
m_shaper.clear();
ewol::Padding padding = m_shaper->getPadding();
float boxSize = m_shaper->getConfigNumber(m_shaperIdSize);
float boxInside = m_shaper->getConfigNumber(m_shaperIdSizeInsize);
m_shaper->clear();
vec2 origin(m_selectableAreaPos + vec2(0, (m_selectableAreaSize.y() - (boxSize+padding.y()))*0.5f));
vec2 size = vec2(boxSize+padding.x(), boxSize+padding.y());
vec2 origin2 = m_selectableAreaPos + vec2((boxSize-boxInside)*0.5f, (m_selectableAreaSize.y() - (boxInside+padding.y()))*0.5f);
vec2 size2 = vec2(boxInside+padding.x(), boxInside+padding.y());
m_shaper.setShape(vec2ClipInt32(origin),
vec2ClipInt32(size),
vec2ClipInt32(origin2+vec2(padding.xLeft(),padding.yButtom()) ),
vec2ClipInt32(size2-vec2(padding.x(),padding.y()) ));
m_shaper->setShape(vec2ClipInt32(origin),
vec2ClipInt32(size),
vec2ClipInt32(origin2+vec2(padding.xLeft(),padding.yButtom()) ),
vec2ClipInt32(size2-vec2(padding.x(),padding.y()) ));
}
void ewol::widget::CheckBox::setValue(bool _val) {
@ -131,7 +126,7 @@ void ewol::widget::CheckBox::setValue(bool _val) {
CheckStatus();
markToRedraw();
}
m_shaper.setActivateState(m_value==true?1:0);
m_shaper->setActivateState(m_value==true?1:0);
}
bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
@ -177,7 +172,7 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
EWOL_VERBOSE(getName() << " : Generate event : " << eventPressed);
generateEventId(eventPressed);
EWOL_VERBOSE(getName() << " : Generate event : " << eventValue << " val=" << m_value );
generateEventId(eventValue, std::to_string(m_value));
generateEventId(eventValue, etk::to_string(m_value.get()));
markToRedraw();
}
}
@ -214,7 +209,7 @@ void ewol::widget::CheckBox::CheckStatus() {
}
void ewol::widget::CheckBox::changeStatusIn(int32_t _newStatusId) {
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
if (true == m_shaper->changeStatusIn(_newStatusId) ) {
periodicCallEnable();
markToRedraw();
}
@ -222,19 +217,19 @@ void ewol::widget::CheckBox::changeStatusIn(int32_t _newStatusId) {
void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) {
if (false == m_shaper.periodicCall(_event) ) {
if (false == m_shaper->periodicCall(_event) ) {
periodicCallDisable();
}
markToRedraw();
}
/*
bool ewol::widget::CheckBox::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::Container2::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configValue) {
setValue(std::stob(_conf.getData()));
setValue(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShaper) {
@ -249,7 +244,7 @@ bool ewol::widget::CheckBox::onGetConfig(const char* _config, std::string& _resu
return true;
}
if (_config == configValue) {
_result = std::to_string(getValue());
_result = etk::to_string(getValue());
return true;
}
if (_config == configShaper) {
@ -258,5 +253,5 @@ bool ewol::widget::CheckBox::onGetConfig(const char* _config, std::string& _resu
}
return false;
}
*/

View File

@ -26,11 +26,8 @@ namespace ewol {
static const char* const eventUp;
static const char* const eventEnter;
static const char* const eventValue;
// Config list of properties
static const char* const configValue;
static const char* const configShaper;
private:
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::object::Param<ewol::compositing::Shaper> m_shaper; //!< Compositing theme.
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area :
@ -58,7 +55,7 @@ namespace ewol {
*/
void setShaperName(const std::string& _shaperName);
protected:
bool m_value; //!< Current state of the checkbox.
ewol::object::Param<bool> m_value; //!< Current state of the checkbox.
public:
/**
* @brief set the current value of the checkbox (check or not)
@ -85,8 +82,10 @@ namespace ewol {
void CheckStatus();
protected: // Derived function
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function
virtual void calculateMinMaxSize();
virtual void calculateSize(const vec2& _availlable);

View File

@ -80,11 +80,11 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
int32_t tmpOriginX = (m_size.x() - m_minSize.x()) / 2;
int32_t tmpOriginY = (m_size.y() - m_minSize.y()) / 2;
if (true == m_userFill.get().x()) {
if (true == m_userFill->x()) {
tmpSizeX = m_size.x();
tmpOriginX = 0;
}
if (true == m_userFill.get().y()) {
if (true == m_userFill->y()) {
tmpSizeY = m_size.y();
tmpOriginY = 0;
}

View File

@ -106,18 +106,18 @@ ewol::Padding ewol::widget::Container2::calculateSizePadded(const vec2& _availla
vec2 localAvaillable = _availlable - vec2(_padding.x(), _padding.y());
ewol::Widget::calculateSize(_availlable);
// set minimal size
if (m_userExpand.x() == true) {
if (m_userExpand->x() == true) {
m_size.setX(_availlable.x());
}
if (m_userExpand.y() == true) {
if (m_userExpand->y() == true) {
m_size.setY(_availlable.y());
}
// Checkin the filling properties == > for the subElements:
vec2 subElementSize = m_minSize;
if (m_userFill.get().x() == true) {
if (m_userFill->x() == true) {
subElementSize.setX(m_size.x());
}
if (m_userFill.get().y() == true) {
if (m_userFill->y() == true) {
subElementSize.setY(m_size.y());
}
vec2 origin = (m_size - subElementSize)*0.5f + vec2(_padding.xLeft(), _padding.yButtom());

View File

@ -268,7 +268,7 @@ bool ewol::widget::ContainerN::loadXML(exml::Element* _node) {
}
bool invertAdding=false;
tmpAttributeValue = _node->getAttribute("addmode");
if(compare_no_case(tmpAttributeValue, "invert")) {
if(etk::compare_no_case(tmpAttributeValue, "invert")) {
invertAdding=true;
}
// parse all the elements :

View File

@ -17,18 +17,18 @@
#define __class__ "ContextMenu"
const char* const ewol::widget::ContextMenu::configArrowPosition = "arrow-position";
const char* const ewol::widget::ContextMenu::configArrowMode = "arrow-mode";
const char* const ewol::widget::ContextMenu::configShaper = "shaper";
ewol::widget::ContextMenu::ContextMenu() {
ewol::widget::ContextMenu::ContextMenu():
m_shaper(*this, "shaper", "the display name for config file"),
m_arrowPos(*this, "arrow-position", vec2(0,0), "Position of the arrow in the pop-up"),
m_arrawBorder(*this, "arrow-mode", markTop, "position of the arrow") {
addObjectType("ewol::widget::ContextMenu");
// add basic configurations :
registerConfig(configArrowPosition, "vec2", nullptr, "position of the arrow");
registerConfig(configArrowMode, "list", "none;left;buttom;right;top", "Position of the arrow in the pop-up");
registerConfig(configShaper, "string", nullptr, "the display name for config file");
m_arrawBorder.add(markTop, "top");
m_arrawBorder.add(markRight, "right");
m_arrawBorder.add(markButtom, "buttom");
m_arrawBorder.add(markLeft, "left");
m_arrawBorder.add(markNone, "none");
m_userExpand.setValue(false,false);
m_userExpand.set(bvec2(false,false));
m_offset = 20;
@ -37,14 +37,12 @@ ewol::widget::ContextMenu::ContextMenu() {
m_colorBorder = etk::color::black;
m_colorBorder.setA(0x7F);
m_arrowPos.setValue(0,0);
m_arrawBorder = markTop;
setMouseLimit(1);
}
void ewol::widget::ContextMenu::init(const std::string& _shaperName) {
ewol::widget::Container::init();
m_shaper.setSource(_shaperName);
m_shaper.set(_shaperName);
}
ewol::widget::ContextMenu::~ContextMenu() {
@ -52,7 +50,7 @@ ewol::widget::ContextMenu::~ContextMenu() {
}
void ewol::widget::ContextMenu::setShaperName(const std::string& _shaperName) {
m_shaper.setSource(_shaperName);
m_shaper.set(_shaperName);
markToRedraw();
}
@ -61,7 +59,7 @@ void ewol::widget::ContextMenu::calculateSize(const vec2& _availlable) {
//EWOL_DEBUG("CalculateSize=" << availlable);
// pop-up fill all the display :
m_size = _availlable;
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
EWOL_VERBOSE("our origin=" << m_origin << " size=" << m_size);
if (nullptr != m_subWidget) {
vec2 subWidgetSize;
@ -82,12 +80,12 @@ void ewol::widget::ContextMenu::calculateSize(const vec2& _availlable) {
// set config to the Sub-widget
switch (m_arrawBorder) {
case markTop:
subWidgetOrigin.setX((int32_t)(m_arrowPos.x() - subWidgetSize.x()/2));
subWidgetOrigin.setY((int32_t)(m_arrowPos.y() - m_offset - subWidgetSize.y()));
subWidgetOrigin.setX((int32_t)(m_arrowPos->x() - subWidgetSize.x()/2));
subWidgetOrigin.setY((int32_t)(m_arrowPos->y() - m_offset - subWidgetSize.y()));
break;
case markButtom:
subWidgetOrigin.setX((int32_t)(m_arrowPos.x() - subWidgetSize.x()/2));
subWidgetOrigin.setY((int32_t)(m_arrowPos.y() + m_offset));
subWidgetOrigin.setX((int32_t)(m_arrowPos->x() - subWidgetSize.x()/2));
subWidgetOrigin.setY((int32_t)(m_arrowPos->y() + m_offset));
break;
case markRight:
case markLeft:
@ -101,19 +99,18 @@ void ewol::widget::ContextMenu::calculateSize(const vec2& _availlable) {
+ padding.x()) );
subWidgetOrigin.setY( (int32_t)( std::max(0, (int32_t)(subWidgetOrigin.y()-padding.y()))
+ padding.y()) );
switch (m_arrawBorder)
{
switch (m_arrawBorder) {
default:
case markTop:
case markButtom:
if (m_arrowPos.x() <= m_offset ) {
subWidgetOrigin.setX(m_arrowPos.x()+padding.xLeft());
if (m_arrowPos->x() <= m_offset ) {
subWidgetOrigin.setX(m_arrowPos->x()+padding.xLeft());
}
break;
case markRight:
case markLeft:
if (m_arrowPos.y() <= m_offset ) {
subWidgetOrigin.setY(m_arrowPos.y()+padding.yButtom());
if (m_arrowPos->y() <= m_offset ) {
subWidgetOrigin.setY(m_arrowPos->y()+padding.yButtom());
}
break;
}
@ -129,7 +126,7 @@ void ewol::widget::ContextMenu::calculateMinMaxSize() {
// call main class to calculate the min size...
ewol::widget::Container::calculateMinMaxSize();
// add padding of the display
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
m_minSize += vec2(padding.x(), padding.y());
//EWOL_DEBUG("CalculateMinSize=>>" << m_minSize);
markToRedraw();
@ -138,7 +135,7 @@ void ewol::widget::ContextMenu::calculateMinMaxSize() {
void ewol::widget::ContextMenu::onDraw() {
m_compositing.draw();
m_shaper.draw();
m_shaper->draw();
}
@ -149,8 +146,8 @@ void ewol::widget::ContextMenu::onRegenerateDisplay() {
return;
}
m_compositing.clear();
m_shaper.clear();
ewol::Padding padding = m_shaper.getPadding();
m_shaper->clear();
ewol::Padding padding = m_shaper->getPadding();
if (m_subWidget == nullptr) {
return;
@ -162,36 +159,36 @@ void ewol::widget::ContextMenu::onRegenerateDisplay() {
m_compositing.setColor(m_colorBorder);
switch (m_arrawBorder) {
case markTop:
m_compositing.setPos(vec3(m_arrowPos.x(), m_arrowPos.y(), 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x(), m_arrowPos->y(), 0.0f) );
m_compositing.addVertex();
if (m_arrowPos.x() <= tmpOrigin.x() ) {
if (m_arrowPos->x() <= tmpOrigin.x() ) {
float laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()-laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x()+laking, m_arrowPos->y()-laking, 0.0f) );
m_compositing.addVertex();
m_compositing.setPos(vec3(m_arrowPos.x(), m_arrowPos.y()-laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x(), m_arrowPos->y()-laking, 0.0f) );
m_compositing.addVertex();
} else {
float laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()-laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x()+laking, m_arrowPos->y()-laking, 0.0f) );
m_compositing.addVertex();
m_compositing.setPos(vec3(m_arrowPos.x()-laking, m_arrowPos.y()-laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x()-laking, m_arrowPos->y()-laking, 0.0f) );
m_compositing.addVertex();
}
break;
case markButtom:
m_compositing.setPos(vec3(m_arrowPos.x(), m_arrowPos.y(), 0) );
m_compositing.setPos(vec3(m_arrowPos->x(), m_arrowPos->y(), 0) );
m_compositing.addVertex();
if (m_arrowPos.x() <= tmpOrigin.x() ) {
if (m_arrowPos->x() <= tmpOrigin.x() ) {
int32_t laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()+laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x()+laking, m_arrowPos->y()+laking, 0.0f) );
m_compositing.addVertex();
m_compositing.setPos(vec3(m_arrowPos.x(), m_arrowPos.y()+laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x(), m_arrowPos->y()+laking, 0.0f) );
m_compositing.addVertex();
} else {
int32_t laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()+laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x()+laking, m_arrowPos->y()+laking, 0.0f) );
m_compositing.addVertex();
m_compositing.setPos(vec3(m_arrowPos.x()-laking, m_arrowPos.y()+laking, 0.0f) );
m_compositing.setPos(vec3(m_arrowPos->x()-laking, m_arrowPos->y()+laking, 0.0f) );
m_compositing.addVertex();
}
break;
@ -204,8 +201,8 @@ void ewol::widget::ContextMenu::onRegenerateDisplay() {
vec2 shaperOrigin = tmpOrigin-vec2(padding.xLeft(), padding.yButtom());
vec2 shaperSize = tmpSize+vec2(padding.x(), padding.y());
m_shaper.setShape(vec2ClipInt32(shaperOrigin),
vec2ClipInt32(shaperSize));
m_shaper->setShape(vec2ClipInt32(shaperOrigin),
vec2ClipInt32(shaperSize));
}
bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
@ -230,8 +227,8 @@ bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
void ewol::widget::ContextMenu::setPositionMark(enum markPosition _position, vec2 _arrowPos) {
EWOL_DEBUG("set context menu at the position : " << _arrowPos);
m_arrawBorder = _position;
m_arrowPos = _arrowPos;
m_arrawBorder.set(_position);
m_arrowPos.set(_arrowPos);
markToRedraw();
}
@ -243,7 +240,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::ContextMenu::getWidgetAtPos(const ve
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());
}
/*
bool ewol::widget::ContextMenu::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::Container::onSetConfig(_conf)) {
return true;
@ -253,13 +250,13 @@ bool ewol::widget::ContextMenu::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == configArrowMode) {
if(compare_no_case(_conf.getData(), "top") == true) {
if(etk::compare_no_case(_conf.getData(), "top") == true) {
m_arrawBorder = markTop;
} else if(compare_no_case(_conf.getData(), "right") == true) {
} else if(etk::compare_no_case(_conf.getData(), "right") == true) {
m_arrawBorder = markRight;
} else if(compare_no_case(_conf.getData(), "buttom") == true) {
} else if(etk::compare_no_case(_conf.getData(), "buttom") == true) {
m_arrawBorder = markButtom;
} else if(compare_no_case(_conf.getData(), "left") == true) {
} else if(etk::compare_no_case(_conf.getData(), "left") == true) {
m_arrawBorder = markLeft;
} else {
m_arrawBorder = markNone;
@ -308,7 +305,7 @@ bool ewol::widget::ContextMenu::onGetConfig(const char* _config, std::string& _r
}
return false;
}
*/

View File

@ -31,11 +31,6 @@ namespace ewol {
markLeft,
markNone
};
public:
// Config list of properties
static const char* const configArrowPosition;
static const char* const configArrowMode;
static const char* const configShaper;
public:
ContextMenu();
void init(const std::string& _shaperName="THEME:GUI:ContextMenu.json");
@ -43,7 +38,7 @@ namespace ewol {
DECLARE_WIDGET_FACTORY(ContextMenu, "ContextMenu");
virtual ~ContextMenu();
private:
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::object::Param<ewol::compositing::Shaper> m_shaper; //!< Compositing theme.
public:
/**
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
@ -58,8 +53,8 @@ namespace ewol {
float m_offset;
private:
vec2 m_arrowPos;
enum markPosition m_arrawBorder;
ewol::object::Param<vec2> m_arrowPos;
ewol::object::ParamList<enum markPosition> m_arrawBorder;
public:
void setPositionMark(enum markPosition position, vec2 arrowPos);
protected: // Derived function

View File

@ -33,27 +33,18 @@ const char * const ewol::widget::Entry::eventClick = "click";
const char * const ewol::widget::Entry::eventEnter = "enter";
const char * const ewol::widget::Entry::eventModify = "modify";
const char* const ewol::widget::Entry::configMaxChar = "max";
const char* const ewol::widget::Entry::configRegExp = "regExp";
const char* const ewol::widget::Entry::configEmptyMessage = "emptytext";
const char* const ewol::widget::Entry::configValue = "value";
ewol::widget::Entry::Entry() :
m_shaper("THEME:GUI:Entry.json"),
m_data(""),
m_maxCharacter(0x7FFFFFFF),
m_regExp(".*"),
m_shaper(*this, "shaper", "Shaper to display the background"),
m_data(*this, "value", "", "Value display in the entry (decorated text)"),
m_maxCharacter(*this, "max", 0x7FFFFFFF, "Maximum cgar that can be set on the Entry"),
m_regExp(*this, "regExp", "Control what it is write with a regular expression"),
m_needUpdateTextPos(true),
m_displayStartPosition(0),
m_displayCursor(false),
m_displayCursorPos(0),
m_displayCursorPosSelection(0),
m_textWhenNothing("") {
m_textWhenNothing(*this, "emptytext", "", "Text that is displayed when the Entry is empty (decorated text)") {
addObjectType("ewol::widget::Entry");
m_colorIdTextFg = m_shaper.requestColor("text-foreground");
m_colorIdTextBg = m_shaper.requestColor("text-background");
m_colorIdCursor = m_shaper.requestColor("text-cursor");
m_colorIdSelection = m_shaper.requestColor("text-selection");
setCanHaveFocus(true);
addEventId(eventClick);
addEventId(eventEnter);
@ -64,19 +55,19 @@ ewol::widget::Entry::Entry() :
shortCutAdd("ctrl+v", ewolEventEntryPaste);
shortCutAdd("ctrl+a", ewolEventEntrySelect, "ALL");
shortCutAdd("ctrl+shift+a", ewolEventEntrySelect, "NONE");
registerConfig(configMaxChar, "int", nullptr, "Maximum cgar that can be set on the Entry");
registerConfig(configRegExp, "string", nullptr, "Control what it is write with a regular expression");
registerConfig(configEmptyMessage, "string", nullptr, "Text that is displayed when the Entry is empty (decorated text)");
registerConfig(configValue, "string", nullptr, "Value display in the entry (decorated text)");
m_regExp.setString(".*");
markToRedraw();
}
void ewol::widget::Entry::init(const std::string& _newData) {
ewol::Widget::init();
setValue(_newData);
m_data.set(_newData);
m_shaper.setString("THEME:GUI:Entry.json");
m_colorIdTextFg = m_shaper->requestColor("text-foreground");
m_colorIdTextBg = m_shaper->requestColor("text-background");
m_colorIdCursor = m_shaper->requestColor("text-cursor");
m_colorIdSelection = m_shaper->requestColor("text-selection");
}
@ -98,7 +89,7 @@ void ewol::widget::Entry::calculateMinMaxSize() {
// call main class
ewol::Widget::calculateMinMaxSize();
// get generic padding
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
int32_t minHeight = m_text.calculateSize(char32_t('A')).y();
vec2 minimumSizeBase(20, minHeight);
// add padding :
@ -117,8 +108,8 @@ void ewol::widget::Entry::setValue(const std::string& _newData) {
}
// set the value with the check of the RegExp ...
setInternalValue(newData);
if (m_data == newData) {
m_displayCursorPos = m_data.size();
if (newData == m_data.get()) {
m_displayCursorPos = m_data->size();
m_displayCursorPosSelection = m_displayCursorPos;
EWOL_VERBOSE("Set : '" << newData << "'");
}
@ -127,29 +118,29 @@ void ewol::widget::Entry::setValue(const std::string& _newData) {
void ewol::widget::Entry::onDraw() {
m_shaper.draw();
m_shaper->draw();
m_text.draw();
}
void ewol::widget::Entry::onRegenerateDisplay() {
if (true == needRedraw()) {
m_shaper.clear();
m_shaper->clear();
m_text.clear();
if (m_colorIdTextFg >= 0) {
m_text.setDefaultColorFg(m_shaper.getColor(m_colorIdTextFg));
m_text.setDefaultColorBg(m_shaper.getColor(m_colorIdTextBg));
m_text.setCursorColor(m_shaper.getColor(m_colorIdCursor));
m_text.setSelectionColor(m_shaper.getColor(m_colorIdSelection));
m_text.setDefaultColorFg(m_shaper->getColor(m_colorIdTextFg));
m_text.setDefaultColorBg(m_shaper->getColor(m_colorIdTextBg));
m_text.setCursorColor(m_shaper->getColor(m_colorIdCursor));
m_text.setSelectionColor(m_shaper->getColor(m_colorIdSelection));
}
updateTextPosition();
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
vec2 tmpSizeShaper = m_minSize;
if (true == m_userFill.get().x()) {
if (true == m_userFill->x()) {
tmpSizeShaper.setX(m_size.x());
}
if (true == m_userFill.get().y()) {
if (true == m_userFill->y()) {
tmpSizeShaper.setY(m_size.y());
}
@ -175,22 +166,22 @@ void ewol::widget::Entry::onRegenerateDisplay() {
} else {
m_text.setCursorPos(m_displayCursorPos);
}
if (0!=m_data.size()) {
if (0!=m_data->size()) {
m_text.print(m_data);
} else {
if (0!=m_textWhenNothing.size()) {
if (0!=m_textWhenNothing->size()) {
m_text.printDecorated(m_textWhenNothing);
}
}
m_text.setClippingMode(false);
m_shaper.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText);
m_shaper->setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText);
}
}
void ewol::widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection) {
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
vec2 relPos = relativePosition(_pos);
relPos.setX(relPos.x()-m_displayStartPosition - padding.xLeft());
@ -200,7 +191,7 @@ void ewol::widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection
//EWOL_DEBUG("hidenSize : " << displayHidenSize);
int32_t newCursorPosition = -1;
int32_t tmpTextOriginX = padding.xLeft();
for (size_t iii=0; iii<m_data.size(); iii++) {
for (size_t iii=0; iii<m_data->size(); iii++) {
tmpDisplay = std::string(m_data, 0, iii);
int32_t tmpWidth = m_text.calculateSize(tmpDisplay).x() - displayHidenSize;
if (tmpWidth >= relPos.x()-tmpTextOriginX) {
@ -209,7 +200,7 @@ void ewol::widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection
}
}
if (newCursorPosition == -1) {
newCursorPosition = m_data.size();
newCursorPosition = m_data->size();
}
if (false == _selection) {
m_displayCursorPos = newCursorPosition;
@ -240,7 +231,7 @@ void ewol::widget::Entry::removeSelected() {
// remove data ...
m_displayCursorPos = pos1;
m_displayCursorPosSelection = pos1;
m_data.erase(pos1, pos2-pos1);
m_data->erase(pos1, pos2-pos1);
markToRedraw();
}
@ -275,19 +266,19 @@ bool ewol::widget::Entry::onEventInput(const ewol::event::Input& _event) {
// select word
m_displayCursorPosSelection = m_displayCursorPos-1;
// search forward
for (size_t iii=m_displayCursorPos; iii <= m_data.size(); iii++) {
if(iii == m_data.size()) {
for (size_t iii=m_displayCursorPos; iii <= m_data->size(); iii++) {
if(iii == m_data->size()) {
m_displayCursorPos = iii;
break;
}
if(!( ( m_data[iii] >= 'a'
&& m_data[iii] <= 'z')
|| ( m_data[iii] >= 'A'
&& m_data[iii] <= 'Z')
|| ( m_data[iii] >= '0'
&& m_data[iii] <= '9')
|| m_data[iii] == '_'
|| m_data[iii] == '-'
if(!( ( m_data.get()[iii] >= 'a'
&& m_data.get()[iii] <= 'z')
|| ( m_data.get()[iii] >= 'A'
&& m_data.get()[iii] <= 'Z')
|| ( m_data.get()[iii] >= '0'
&& m_data.get()[iii] <= '9')
|| m_data.get()[iii] == '_'
|| m_data.get()[iii] == '-'
) ) {
m_displayCursorPos = iii;
break;
@ -299,14 +290,14 @@ bool ewol::widget::Entry::onEventInput(const ewol::event::Input& _event) {
m_displayCursorPosSelection = 0;
break;
}
if(!( ( m_data[iii] >= 'a'
&& m_data[iii] <= 'z')
|| ( m_data[iii] >= 'A'
&& m_data[iii] <= 'Z')
|| ( m_data[iii] >= '0'
&& m_data[iii] <= '9')
|| m_data[iii] == '_'
|| m_data[iii] == '-'
if(!( ( m_data.get()[iii] >= 'a'
&& m_data.get()[iii] <= 'z')
|| ( m_data.get()[iii] >= 'A'
&& m_data.get()[iii] <= 'Z')
|| ( m_data.get()[iii] >= '0'
&& m_data.get()[iii] <= '9')
|| m_data.get()[iii] == '_'
|| m_data.get()[iii] == '-'
) ) {
m_displayCursorPosSelection = iii+1;
break;
@ -318,7 +309,7 @@ bool ewol::widget::Entry::onEventInput(const ewol::event::Input& _event) {
} else if (ewol::key::statusTriple == _event.getStatus()) {
keepFocus();
m_displayCursorPosSelection = 0;
m_displayCursorPos = m_data.size();
m_displayCursorPos = m_data->size();
} else if (ewol::key::statusDown == _event.getStatus()) {
keepFocus();
updateCursorPosition(_event.getPos());
@ -368,27 +359,27 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
return true;
} else if (_event.getChar() == 0x7F) {
// SUPPR :
if (m_data.size() > 0 && m_displayCursorPos < (int64_t)m_data.size()) {
m_data.erase(m_displayCursorPos, 1);
if (m_data->size() > 0 && m_displayCursorPos < (int64_t)m_data->size()) {
m_data->erase(m_displayCursorPos, 1);
m_displayCursorPos = std::max(m_displayCursorPos, 0);
m_displayCursorPosSelection = m_displayCursorPos;
}
} else if (_event.getChar() == 0x08) {
// DEL :
if (m_data.size() > 0 && m_displayCursorPos != 0) {
m_data.erase(m_displayCursorPos-1, 1);
if (m_data->size() > 0 && m_displayCursorPos != 0) {
m_data->erase(m_displayCursorPos-1, 1);
m_displayCursorPos--;
m_displayCursorPos = std::max(m_displayCursorPos, 0);
m_displayCursorPosSelection = m_displayCursorPos;
}
} else if(_event.getChar() >= 20) {
if ((int64_t)m_data.size() > m_maxCharacter) {
if ((int64_t)m_data->size() > m_maxCharacter) {
EWOL_INFO("Reject data for entry : '" << _event.getChar() << "'");
} else {
std::string newData = m_data;
newData.insert(newData.begin()+m_displayCursorPos, _event.getChar());
setInternalValue(newData);
if (m_data == newData) {
if (m_data.get() == newData) {
m_displayCursorPos++;
m_displayCursorPosSelection = m_displayCursorPos;
}
@ -413,12 +404,12 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
m_displayCursorPos = 0;
break;
case ewol::key::keyboardEnd:
m_displayCursorPos = m_data.size();
m_displayCursorPos = m_data->size();
break;
default:
return false;
}
m_displayCursorPos = std::avg(0, m_displayCursorPos, (int32_t)m_data.size());
m_displayCursorPos = std::avg(0, m_displayCursorPos, (int32_t)m_data->size());
m_displayCursorPosSelection = m_displayCursorPos;
markToRedraw();
return true;
@ -431,14 +422,14 @@ void ewol::widget::Entry::setInternalValue(const std::string& _newData) {
std::string previous = m_data;
// check the RegExp :
if (_newData.size()>0) {
if (false == m_regExp.processOneElement(_newData,0,_newData.size()) ) {
EWOL_INFO("the input data does not match with the regExp \"" << _newData << "\" RegExp=\"" << m_regExp.getRegExp() << "\" start=" << m_regExp.start() << " stop=" << m_regExp.stop() );
if (false == m_regExp->processOneElement(_newData,0,_newData.size()) ) {
EWOL_INFO("the input data does not match with the regExp \"" << _newData << "\" RegExp=\"" << m_regExp->getRegExp() << "\" start=" << m_regExp->start() << " stop=" << m_regExp->stop() );
return;
}
//EWOL_INFO("find regExp : \"" << m_data << "\" start=" << m_regExp.Start() << " stop=" << m_regExp.Stop() );
if( 0 != m_regExp.start()
|| _newData.size() != (size_t)m_regExp.stop() ) {
EWOL_INFO("The input data match not entirely with the regExp \"" << _newData << "\" RegExp=\"" << m_regExp.getRegExp() << "\" start=" << m_regExp.start() << " stop=" << m_regExp.stop() );
if( 0 != m_regExp->start()
|| _newData.size() != (size_t)m_regExp->stop() ) {
EWOL_INFO("The input data match not entirely with the regExp \"" << _newData << "\" RegExp=\"" << m_regExp->getRegExp() << "\" start=" << m_regExp->start() << " stop=" << m_regExp->stop() );
return;
}
}
@ -456,8 +447,8 @@ void ewol::widget::Entry::onEventClipboard(enum ewol::context::clipBoard::clipbo
std::string newData = m_data;
newData.insert(m_displayCursorPos, &tmpData[0]);
setInternalValue(newData);
if (m_data == newData) {
if (m_data.size() == tmpData.size()) {
if (m_data.get() == newData) {
if (m_data->size() == tmpData.size()) {
m_displayCursorPos = tmpData.size();
} else {
m_displayCursorPos += tmpData.size();
@ -489,7 +480,7 @@ void ewol::widget::Entry::onReceiveMessage(const ewol::object::Message& _msg) {
} else if(_msg.getMessage() == ewolEventEntrySelect) {
if(_msg.getData() == "ALL") {
m_displayCursorPosSelection = 0;
m_displayCursorPos = m_data.size();
m_displayCursorPos = m_data->size();
} else {
m_displayCursorPosSelection = m_displayCursorPos;
}
@ -505,10 +496,10 @@ void ewol::widget::Entry::updateTextPosition() {
if (false == m_needUpdateTextPos) {
return;
}
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
int32_t tmpSizeX = m_minSize.x();
if (true == m_userFill.get().x()) {
if (true == m_userFill->x()) {
tmpSizeX = m_size.x();
}
int32_t tmpUserSize = tmpSizeX - padding.x();
@ -551,26 +542,26 @@ void ewol::widget::Entry::onLostFocus() {
}
void ewol::widget::Entry::changeStatusIn(int32_t _newStatusId) {
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
if (true == m_shaper->changeStatusIn(_newStatusId) ) {
periodicCallEnable();
markToRedraw();
}
}
void ewol::widget::Entry::periodicCall(const ewol::event::Time& _event) {
if (false == m_shaper.periodicCall(_event) ) {
if (false == m_shaper->periodicCall(_event) ) {
periodicCallDisable();
}
markToRedraw();
}
void ewol::widget::Entry::setRegExp(const std::string& _expression) {
std::string previousRegExp = m_regExp.getRegExp();
std::string previousRegExp = m_regExp->getRegExp();
EWOL_DEBUG("change input regExp \"" << previousRegExp << "\" == > \"" << _expression << "\"");
m_regExp.compile(_expression);
if (m_regExp.getStatus() == false) {
m_regExp->compile(_expression);
if (m_regExp->getStatus() == false) {
EWOL_ERROR("error when adding regExp ... == > set the previous back ...");
m_regExp.compile(previousRegExp);
m_regExp->compile(previousRegExp);
}
}
@ -579,6 +570,7 @@ void ewol::widget::Entry::setEmptyText(const std::string& _text) {
markToRedraw();
}
/*
bool ewol::widget::Entry::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
@ -607,7 +599,7 @@ bool ewol::widget::Entry::onGetConfig(const char* _config, std::string& _result)
return true;
}
if (_config == configMaxChar) {
_result = std::to_string(getMaxChar());
_result = etk::to_string(getMaxChar());
return true;
}
if (_config == configRegExp) {
@ -624,6 +616,6 @@ bool ewol::widget::Entry::onGetConfig(const char* _config, std::string& _result)
}
return false;
}
*/

View File

@ -37,13 +37,8 @@ namespace ewol {
static const char * const eventClick;
static const char * const eventEnter;
static const char * const eventModify; // return in the data the new string inside it ...
// Config list of properties
static const char* const configMaxChar;
static const char* const configRegExp;
static const char* const configEmptyMessage;
static const char* const configValue;
private:
ewol::compositing::Shaper m_shaper;
ewol::object::Param<ewol::compositing::Shaper> m_shaper;
int32_t m_colorIdTextFg; //!< color property of the text foreground
int32_t m_colorIdTextBg; //!< color property of the text background
int32_t m_colorIdCursor; //!< color property of the text cursor
@ -64,7 +59,7 @@ namespace ewol {
virtual ~Entry();
private:
std::string m_data; //!< sting that must be displayed
ewol::object::Param<std::string> m_data; //!< sting that must be displayed
protected:
/**
* @brief internal check the value with RegExp checking
@ -86,7 +81,7 @@ namespace ewol {
};
private:
int32_t m_maxCharacter; //!< number max of xharacter in the list
ewol::object::Param<int32_t> m_maxCharacter; //!< number max of xharacter in the list
public:
/**
* @brief Limit the number of Unicode character in the entry
@ -101,7 +96,7 @@ namespace ewol {
return m_maxCharacter;
};
private:
etk::RegExp<std::string> m_regExp; //!< regular expression to limit the input of an entry
ewol::object::Param<etk::RegExp<std::string>> m_regExp; //!< regular expression to limit the input of an entry
public:
/**
* @brief Limit the input entry at a regular expression... (by default it is "*")
@ -113,7 +108,7 @@ namespace ewol {
* @param The regExp string
*/
std::string getRegExp() const {
return m_regExp.getRegExp();
return m_regExp->getRegExp();
};
private:
bool m_needUpdateTextPos; //!< text position can have change
@ -150,7 +145,7 @@ namespace ewol {
*/
virtual void removeSelected();
private:
std::string m_textWhenNothing; //!< Text to display when nothing in in the entry (decorated text...)
ewol::object::Param<std::string> m_textWhenNothing; //!< Text to display when nothing in in the entry (decorated text...)
public:
/**
* @brief set The text displayed when nothing is in the entry.
@ -177,8 +172,10 @@ namespace ewol {
virtual void onLostFocus();
virtual void changeStatusIn(int32_t _newStatusId);
virtual void periodicCall(const ewol::event::Time& _event);
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
};
};
};

View File

@ -92,8 +92,8 @@ void ewol::widget::Gird::calculateMinMaxSize() {
}
}
//EWOL_DEBUG("Update minimum size");
m_minSize = m_userMinSize.getPixel();
m_maxSize = m_userMaxSize.getPixel();
m_minSize = m_userMinSize->getPixel();
m_maxSize = m_userMaxSize->getPixel();
m_uniformSizeRow = 0;
m_minSize += m_borderSize*2;
int32_t lastLineID = 0;

View File

@ -18,30 +18,18 @@
const char * const ewol::widget::Image::eventPressed = "pressed";
const char * const ewol::widget::Image::configRatio = "ratio";
const char * const ewol::widget::Image::configSize = "size";
const char * const ewol::widget::Image::configBorder = "border";
const char * const ewol::widget::Image::configSource = "src";
const char * const ewol::widget::Image::configDistanceField = "distance-field";
const char * const ewol::widget::Image::configPartStart = "part-start";
const char * const ewol::widget::Image::configPartStop = "part-stop";
ewol::widget::Image::Image() :
m_colorProperty(nullptr),
m_colorId(-1),
m_imageSize(vec2(0.0f,0.0f)),
m_keepRatio(true),
m_posStart(0.0f,0.0f),
m_posStop(1.0f,1.0f) {
m_fileName(*this, "src", "", "Image source path"),
m_border(*this, "border", vec2(0,0), "Border of the image"),
m_imageSize(*this, "size", vec2(0,0), "Basic display size of the image"),
m_keepRatio(*this, "ratio", true, "Keep ratio of the image"),
m_posStart(*this, "part-start", vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image"),
m_posStop(*this, "part-stop", vec2(1.0f, 1.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image"),
m_distanceFieldMode(*this, "distance-field", false, "Distance field mode") {
addObjectType("ewol::widget::Image");
addEventId(eventPressed);
registerConfig(configRatio, "bool", nullptr, "Keep ratio of the image");
registerConfig(configSize, "Dimension", nullptr, "Basic display size of the image");
registerConfig(configBorder, "Dimension", nullptr, "Border of the image");
registerConfig(configSource, "string", "Image source path");
registerConfig(configDistanceField, "bool", "Distance field mode");
registerConfig(configPartStart, "vec2", nullptr, "Start display position in the image [0.0 .. 1.0]");
registerConfig(configPartStop, "vec2", nullptr, "Stop display position in the image [0.0 .. 1.0]");
m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:Image.json");
if (m_colorProperty != nullptr) {
m_colorId = m_colorProperty->request("foreground");
@ -60,20 +48,20 @@ ewol::widget::Image::~Image() {
void ewol::widget::Image::setFile(const std::string& _file) {
EWOL_VERBOSE("Set Image : " << _file);
if (m_fileName != _file) {
if (m_fileName.get() != _file) {
// copy data :
m_fileName = _file;
m_fileName.set(_file);
// force redraw all :
markToRedraw();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.setSource(m_fileName, m_imageSize.getPixel());
m_compositing.setSource(m_fileName, m_imageSize->getPixel());
}
}
void ewol::widget::Image::setBorder(const ewol::Dimension& _border) {
EWOL_VERBOSE("Set border=" << _border);
// copy data :
m_border = _border;
m_border.set(_border);
// force redraw all :
markToRedraw();
// TODO : change the size with no size requested ...
@ -81,33 +69,30 @@ void ewol::widget::Image::setBorder(const ewol::Dimension& _border) {
}
void ewol::widget::Image::setKeepRatio(bool _keep) {
if (m_keepRatio == _keep) {
if (m_keepRatio.get() == _keep) {
return;
}
// copy data :
m_keepRatio = _keep;
m_keepRatio.set(_keep);
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setStartPos(const vec2& _pos) {
if (m_posStart == _pos) {
if (m_posStart.get() == _pos) {
return;
}
// copy data :
m_posStart = _pos;
m_posStart.set(_pos);
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setStopPos(const vec2& _pos) {
if (m_posStop == _pos) {
return;
}
// copy data :
m_posStop = _pos;
m_posStop.set(_pos);
// force redraw all :
markToRedraw();
requestUpdateSize();
@ -115,20 +100,20 @@ void ewol::widget::Image::setStopPos(const vec2& _pos) {
void ewol::widget::Image::setImageSize(const ewol::Dimension& _size) {
EWOL_VERBOSE("Set Image size : " << _size);
if (_size != m_imageSize) {
m_imageSize = _size;
if (_size != m_imageSize.get()) {
m_imageSize.set(_size);
markToRedraw();
requestUpdateSize();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.setSource(m_fileName, m_imageSize.getPixel());
m_compositing.setSource(m_fileName, m_imageSize->getPixel());
}
}
void ewol::widget::Image::set(const std::string& _file, const ewol::Dimension& _border) {
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
// copy data :
if (m_border != _border) {
m_border = _border;
if (m_border.get() != _border) {
m_border.set(_border);
requestUpdateSize();
markToRedraw();
}
@ -147,21 +132,21 @@ void ewol::widget::Image::onRegenerateDisplay() {
m_compositing.setColor(m_colorProperty->get(m_colorId));
}
// calculate the new position and size :
vec2 imageBoder = m_border.getPixel();
vec2 imageBoder = m_border->getPixel();
vec2 origin = imageBoder;
imageBoder *= 2.0f;
vec2 imageRealSize = m_minSize - imageBoder;
vec2 imageRealSizeMax = m_size - imageBoder;
vec2 ratioSizeDisplayRequested = m_posStop - m_posStart;
vec2 ratioSizeDisplayRequested = m_posStop.get() - m_posStart.get();
//imageRealSizeMax *= ratioSizeDisplayRequested;
if (m_userFill.get().x() == true) {
if (m_userFill->x() == true) {
imageRealSize.setX(imageRealSizeMax.x());
} else {
origin.setX(origin.x() + (m_size.x()-m_minSize.x())*0.5f);
}
if (m_userFill.get().y() == true) {
if (m_userFill->y() == true) {
imageRealSize.setY(imageRealSizeMax.y());
} else {
origin.setY(origin.y() + (m_size.y()-m_minSize.y())*0.5f);
@ -194,19 +179,19 @@ void ewol::widget::Image::onRegenerateDisplay() {
}
void ewol::widget::Image::calculateMinMaxSize() {
vec2 imageBoder = m_border.getPixel()*2.0f;
vec2 imageSize = m_imageSize.getPixel();
vec2 imageBoder = m_border->getPixel()*2.0f;
vec2 imageSize = m_imageSize->getPixel();
if (imageSize!=vec2(0,0)) {
m_minSize = imageBoder+imageSize;
m_maxSize = m_minSize;
} else {
vec2 imageSizeReal = m_compositing.getRealSize();
vec2 min1 = imageBoder+m_userMinSize.getPixel();
vec2 min1 = imageBoder+m_userMinSize->getPixel();
m_minSize = imageBoder+imageSizeReal;
//EWOL_DEBUG(" set max : " << m_minSize << " " << min1);
m_minSize.setMax(min1);
//EWOL_DEBUG(" result : " << m_minSize);
m_maxSize = imageBoder+m_userMaxSize.getPixel();
m_maxSize = imageBoder+m_userMaxSize->getPixel();
m_minSize.setMin(m_maxSize);
}
//EWOL_DEBUG("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image size=" << imageSizeReal);
@ -234,7 +219,7 @@ bool ewol::widget::Image::loadXML(exml::Element* _node) {
std::string tmpAttributeValue = _node->getAttribute("ratio");
if (tmpAttributeValue.size()!=0) {
if (compare_no_case(tmpAttributeValue, "true") == true) {
if (etk::compare_no_case(tmpAttributeValue, "true") == true) {
m_keepRatio = true;
} else if (tmpAttributeValue == "1") {
m_keepRatio = true;
@ -264,12 +249,13 @@ bool ewol::widget::Image::loadXML(exml::Element* _node) {
return true;
}
/*
bool ewol::widget::Image::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configRatio) {
setKeepRatio(std::stob(_conf.getData()));
setKeepRatio(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configSize) {
@ -285,7 +271,7 @@ bool ewol::widget::Image::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == configDistanceField) {
setDistanceField(std::stob(_conf.getData()));
setDistanceField(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPartStart) {
@ -304,7 +290,7 @@ bool ewol::widget::Image::onGetConfig(const char* _config, std::string& _result)
return true;
}
if (_config == configRatio) {
_result = std::to_string(getKeepRatio());
_result = etk::to_string(getKeepRatio());
return true;
}
if (_config == configSize) {
@ -320,7 +306,7 @@ bool ewol::widget::Image::onGetConfig(const char* _config, std::string& _result)
return true;
}
if (_config == configDistanceField) {
_result = std::to_string(getDistanceField());
_result = etk::to_string(getDistanceField());
return true;
}
if (_config == configPartStart) {
@ -334,4 +320,4 @@ bool ewol::widget::Image::onGetConfig(const char* _config, std::string& _result)
return false;
}
*/

View File

@ -26,14 +26,6 @@ namespace ewol {
public:
// Event list of properties
static const char * const eventPressed;
// Config list of properties
static const char * const configRatio;
static const char * const configSize;
static const char * const configBorder;
static const char * const configSource;
static const char * const configDistanceField;
static const char * const configPartStart;
static const char * const configPartStop;
protected:
ewol::compositing::Image m_compositing; //!< compositing element of the image.
std::shared_ptr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property
@ -58,7 +50,7 @@ namespace ewol {
*/
void set(const std::string& _file, const ewol::Dimension& _border);
protected:
std::string m_fileName; //!< file name of the image.
ewol::object::Param<std::string> m_fileName; //!< file name of the image.
public:
/**
* @brief set the new filename
@ -73,7 +65,7 @@ namespace ewol {
return m_fileName;
};
protected:
ewol::Dimension m_border; //!< border to add at the image.
ewol::object::Param<ewol::Dimension> m_border; //!< border to add at the image.
public:
/**
* @brief set tge Border size around the image
@ -88,7 +80,7 @@ namespace ewol {
return m_border;
};
protected:
ewol::Dimension m_imageSize; //!< border to add at the image.
ewol::object::Param<ewol::Dimension> m_imageSize; //!< border to add at the image.
public:
/**
* @brief set tge Border size around the image
@ -103,7 +95,7 @@ namespace ewol {
return m_imageSize;
};
protected:
bool m_keepRatio; //!< keep the image ratio between width and hight
ewol::object::Param<bool> m_keepRatio; //!< keep the image ratio between width and hight
public:
/**
* @brief set the current status of keeping ratio.
@ -118,7 +110,7 @@ namespace ewol {
return m_keepRatio;
};
protected:
vec2 m_posStart; //!< position in the image to start the sisplay (when we want not to display all the image)
ewol::object::ParamRange<vec2> m_posStart; //!< position in the image to start the sisplay (when we want not to display all the image)
public:
/**
* @brief set the current 'start' position in the image to display.
@ -133,7 +125,7 @@ namespace ewol {
return m_posStart;
};
protected:
vec2 m_posStop; //!< position in the image to start the sisplay (when we want not to display all the image)
ewol::object::ParamRange<vec2> m_posStop; //!< position in the image to start the sisplay (when we want not to display all the image)
public:
/**
* @brief set the current 'stop' position in the image to display.
@ -147,6 +139,8 @@ namespace ewol {
vec2 getStopPos() const {
return m_posStop;
};
public:
ewol::object::Param<bool> m_distanceFieldMode; //!< to have a parameter
public:
/**
* @brief Set distance field rendering mode
@ -164,8 +158,10 @@ namespace ewol {
}
protected: // Derived function
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function
virtual void calculateMinMaxSize();
virtual void onRegenerateDisplay();

View File

@ -16,10 +16,10 @@
#define __class__ "Label"
const char * const ewol::widget::Label::eventPressed = "pressed";
const char* const ewol::widget::Label::configValue = "value";
// TODO : Remove the label name in the constructor ...
ewol::widget::Label::Label() :
m_label(*this, "value", U"", "displayed value string"),
m_colorProperty(nullptr),
m_colorDefaultFgText(-1),
m_colorDefaultBgText(-1){
@ -32,12 +32,11 @@ ewol::widget::Label::Label() :
addEventId(eventPressed);
setCanHaveFocus(false);
setMouseLimit(1);
registerConfig(configValue, "string", nullptr, "displayed value string"); // TODO : do not store in attibute...
}
void ewol::widget::Label::init(std::string _newLabel) {
ewol::Widget::init();
m_label = std::to_u32string(_newLabel);
m_label.setString(_newLabel);
}
ewol::widget::Label::~Label() {
@ -45,14 +44,14 @@ ewol::widget::Label::~Label() {
}
void ewol::widget::Label::calculateMinMaxSize() {
vec2 tmpMax = m_userMaxSize.getPixel();
vec2 tmpMin = m_userMinSize.getPixel();
vec2 tmpMax = m_userMaxSize->getPixel();
vec2 tmpMin = m_userMinSize->getPixel();
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-4, ewol::compositing::alignLeft);
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} forcez Alignement ");
}
vec3 minSize = m_text.calculateSizeDecorated(m_label);
vec3 minSize = m_text.calculateSizeDecorated(m_label.get());
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize);
m_minSize.setX(std::avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()));
@ -61,13 +60,13 @@ void ewol::widget::Label::calculateMinMaxSize() {
}
void ewol::widget::Label::setLabel(const std::string& _newLabel) {
m_label = std::to_u32string(_newLabel);
m_label.setString(_newLabel);
markToRedraw();
requestUpdateSize();
}
std::string ewol::widget::Label::getLabel() const {
return std::to_string(m_label);
return etk::to_string(m_label.get());
}
void ewol::widget::Label::onDraw() {
@ -81,7 +80,7 @@ void ewol::widget::Label::onRegenerateDisplay() {
m_text.clear();
int32_t paddingSize = 2;
vec2 tmpMax = m_userMaxSize.getPixel();
vec2 tmpMax = m_userMaxSize->getPixel();
// to know the size of one line :
vec3 minSize = m_text.calculateSize(char32_t('A'));
@ -90,7 +89,7 @@ void ewol::widget::Label::onRegenerateDisplay() {
if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::compositing::alignLeft);
}
vec3 curentTextSize = m_text.calculateSizeDecorated(m_label);
vec3 curentTextSize = m_text.calculateSizeDecorated(m_label.get());
ivec2 localSize = m_minSize;
@ -99,11 +98,11 @@ void ewol::widget::Label::onRegenerateDisplay() {
(m_size.y() - m_minSize.y()) / 2.0,
0);
if (m_userFill.get().x() == true) {
if (m_userFill->x() == true) {
localSize.setX(m_size.x());
tmpTextOrigin.setX(0);
}
if (m_userFill.get().y() == true) {
if (m_userFill->y() == true) {
localSize.setY(m_size.y());
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
}
@ -126,10 +125,10 @@ void ewol::widget::Label::onRegenerateDisplay() {
m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText));
}
m_text.setPos(tmpTextOrigin);
EWOL_VERBOSE("[" << getId() << "] {" << m_label << "} display at pos : " << tmpTextOrigin);
EWOL_VERBOSE("[" << getId() << "] {" << m_label.get() << "} display at pos : " << tmpTextOrigin);
m_text.setTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::compositing::alignLeft);
m_text.setClipping(drawClippingPos, drawClippingSize);
m_text.printDecorated(m_label);
m_text.printDecorated(m_label.get());
}
bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) {
@ -155,7 +154,7 @@ bool ewol::widget::Label::loadXML(exml::Element* _node) {
return true;
}
/*
bool ewol::widget::Label::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
@ -177,5 +176,5 @@ bool ewol::widget::Label::onGetConfig(const char* _config, std::string& _result)
}
return false;
}
*/

View File

@ -25,11 +25,9 @@ namespace ewol {
public:
// Event list of properties
static const char * const eventPressed;
// Config list of properties
static const char* const configValue;
private:
ewol::compositing::Text m_text; //!< Compositing text element.
std::u32string m_label; //!< decorated text to display.
ewol::object::Param<std::u32string> m_label; //!< decorated text to display.
std::shared_ptr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property
int32_t m_colorDefaultFgText; //!< Default color of the text
int32_t m_colorDefaultBgText; //!< Default Background color of the text
@ -66,8 +64,10 @@ namespace ewol {
};
protected: // Derived function
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function
virtual void calculateMinMaxSize();
virtual void onRegenerateDisplay();

View File

@ -20,20 +20,15 @@ const char * const ewol::widget::ListFileSystem::eventFileValidate = "file-val
const char * const ewol::widget::ListFileSystem::eventFolderSelect = "folder-select";
const char * const ewol::widget::ListFileSystem::eventFolderValidate = "folder-validate";
const char* const ewol::widget::ListFileSystem::configShowHidden = "show-hidden";
const char* const ewol::widget::ListFileSystem::configShowFile = "show-file";
const char* const ewol::widget::ListFileSystem::configShowFolder = "show-folder";
const char* const ewol::widget::ListFileSystem::configShowTemporary = "show-temporary";
const char* const ewol::widget::ListFileSystem::configPath = "path";
const char* const ewol::widget::ListFileSystem::configSelect = "select";
ewol::widget::ListFileSystem::ListFileSystem() :
m_selectedLine(-1),
m_folder ("/"),
m_showFile(true),
m_showFolder(true),
m_showHidden(true),
m_showTemporaryFile(true) {
m_folder(*this, "path", "/", "Path to display"),
m_selectFile(*this, "select", "", "selection af a specific file"),
m_showFile(*this, "show-file", true, "display files"),
m_showFolder(*this, "show-folder", true, "display folders"),
m_showHidden(*this, "show-hidden", true, "Show the hidden element (file, folder, ...)"),
m_showTemporaryFile(*this, "show-temporary", true, "display temporary files") {
addObjectType("ewol::widget::ListFileSystem");
#if defined(__TARGET_OS__Windows)
m_folder = "c:/";
@ -50,13 +45,6 @@ ewol::widget::ListFileSystem::ListFileSystem() :
addEventId(eventFolderSelect);
addEventId(eventFolderValidate);
registerConfig(configShowHidden, "bool", nullptr, "Show the hidden element (file, folder, ...)");
registerConfig(configShowFile, "bool", nullptr, "display files");
registerConfig(configShowFolder, "bool", nullptr, "display folders");
registerConfig(configShowTemporary, "bool", nullptr, "display temporary files");
registerConfig(configPath, "string", nullptr, "Path to display");
registerConfig(configSelect, "string", nullptr, "selection af a specific file");
setMouseLimit(1);
};
@ -88,7 +76,7 @@ void ewol::widget::ListFileSystem::regenerateView() {
m_selectedLine = -1;
m_list.clear();
m_originScrooled.setValue(0,0);
etk::FSNode tmpFolder(m_folder);
etk::FSNode tmpFolder(m_folder.get());
// get the new list :
m_list = tmpFolder.folderGetSubList(m_showHidden, m_showFolder, m_showFile, m_showTemporaryFile);
// request a redraw ...
@ -134,7 +122,7 @@ bool ewol::widget::ListFileSystem::getTitle(int32_t _colomn, std::string &_myTit
uint32_t ewol::widget::ListFileSystem::getNuberOfRaw() {
int32_t offset = 0;
if (m_showFolder == true) {
if (m_folder == "/") {
if (m_folder.get() == "/") {
offset = 1;
} else {
offset = 2;
@ -146,7 +134,7 @@ uint32_t ewol::widget::ListFileSystem::getNuberOfRaw() {
bool ewol::widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
int32_t offset = 0;
if (m_showFolder == true) {
if (m_folder == "/") {
if (m_folder.get() == "/") {
offset = 1;
} else {
offset = 2;
@ -154,7 +142,7 @@ bool ewol::widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std
if (_raw == 0) {
_myTextToWrite = ".";
} else if ( _raw == 1
&& m_folder != "/") {
&& m_folder.get() != "/") {
_myTextToWrite = "..";
}
}
@ -185,7 +173,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
float _y) {
int32_t offset = 0;
if (m_showFolder == true) {
if (m_folder == "/") {
if (m_folder.get() == "/") {
offset = 1;
} else {
offset = 2;
@ -259,25 +247,25 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
return false;
}
/*
bool ewol::widget::ListFileSystem::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::List::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configShowHidden) {
setShowHidden(std::stob(_conf.getData()));
setShowHidden(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShowFile) {
setShowFiles(std::stob(_conf.getData()));
setShowFiles(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShowFolder) {
setShowFolder(std::stob(_conf.getData()));
setShowFolder(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShowTemporary) {
setShowTemporaryFiles(std::stob(_conf.getData()));
setShowTemporaryFiles(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPath) {
@ -296,19 +284,19 @@ bool ewol::widget::ListFileSystem::onGetConfig(const char* _config, std::string&
return true;
}
if (_config == configShowHidden) {
_result = std::to_string(getShowHidden());
_result = etk::to_string(getShowHidden());
return true;
}
if (_config == configShowFile) {
_result = std::to_string(getShowFiles());
_result = etk::to_string(getShowFiles());
return true;
}
if (_config == configShowFolder) {
_result = std::to_string(getShowFolder());
_result = etk::to_string(getShowFolder());
return true;
}
if (_config == configShowTemporary) {
_result = std::to_string(getShowTemporaryFiles());
_result = etk::to_string(getShowTemporaryFiles());
return true;
}
if (_config == configPath) {
@ -321,5 +309,5 @@ bool ewol::widget::ListFileSystem::onGetConfig(const char* _config, std::string&
}
return false;
}
*/

View File

@ -25,14 +25,6 @@ namespace ewol {
static const char * const eventFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element
static const char * const eventFolderSelect;
static const char * const eventFolderValidate;
// Config list of properties
static const char* const configShowHidden; //!< @config "show-hidden"
static const char* const configShowFile;
static const char* const configShowFolder;
static const char* const configShowTemporary;
static const char* const configPath;
static const char* const configSelect;
// TODO : Add a standalone configuration ..
protected:
ListFileSystem();
void init();
@ -76,7 +68,8 @@ namespace ewol {
*/
std::string getSelect() const ;
protected:
std::string m_folder; //!< Current folder that display point on.
ewol::object::Param<std::string> m_folder; //!< Current folder that display point on.
ewol::object::Param<std::string> m_selectFile; //!< current selected file
public:
/**
* @brief Set a folder to display (might be a valid folder !!!)
@ -94,7 +87,7 @@ namespace ewol {
return m_folder;
};
protected:
bool m_showFile; //!< Show files elements
ewol::object::Param<bool> m_showFile; //!< Show files elements
public:
/**
* @brief Set the status of the displaying files or Not.
@ -112,7 +105,7 @@ namespace ewol {
return m_showFile;
};
protected:
bool m_showFolder; //!< Display the folders elements
ewol::object::Param<bool> m_showFolder; //!< Display the folders elements
public:
/**
* @brief Set the status of the displaying fodlers or Not.
@ -130,7 +123,7 @@ namespace ewol {
return m_showFile;
};
protected:
bool m_showHidden; //!< Display hidden elements
ewol::object::Param<bool> m_showHidden; //!< Display hidden elements
public:
/**
* @brief Set the status of the displaying hidden files or folder or Not.
@ -148,7 +141,7 @@ namespace ewol {
return m_showFile;
};
protected:
bool m_showTemporaryFile; //!< show the temporary files elements (XXX~, XXX.bck, XXX.pyc ...)
ewol::object::Param<bool> m_showTemporaryFile; //!< show the temporary files elements (XXX~, XXX.bck, XXX.pyc ...)
public:
/**
* @brief Set the status of the displaying temporary file (xxx~, xxx.bck, xxx.pyc) or Not.

View File

@ -268,7 +268,7 @@ void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
return;
}
//Keep name in lower case :
std::string nameLower = std::tolower(_name);
std::string nameLower = etk::tolower(_name);
if (true == m_creatorList.exist(nameLower)) {
EWOL_WARNING("Replace Creator of a specify widget : " << nameLower);
m_creatorList[nameLower] = _pointer;
@ -279,7 +279,7 @@ void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
}
std::shared_ptr<ewol::Widget> ewol::widget::Manager::create(const std::string& _name) {
std::string nameLower = std::tolower(_name);
std::string nameLower = etk::tolower(_name);
if (m_creatorList.exist(nameLower) == true) {
ewol::widget::Manager::creator_tf pointerFunction = m_creatorList[nameLower];
if (pointerFunction != nullptr) {
@ -291,7 +291,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Manager::create(const std::string& _
}
bool ewol::widget::Manager::exist(const std::string& _name) {
std::string nameLower = std::tolower(_name);
std::string nameLower = etk::tolower(_name);
return m_creatorList.exist(nameLower);
}

View File

@ -92,7 +92,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
}
if (tmpObject->m_image.size()!=0) {
std::string composeString ="<sizer mode=\"hori\">\n";
if (std::end_with(tmpObject->m_image, ".edf") == true) {
if (etk::end_with(tmpObject->m_image, ".edf") == true) {
composeString+=" <image src=\"" + tmpObject->m_image + "\" size=\"8,8mm\" distance-field='true'/>\n";
} else {
composeString+=" <image src=\"" + tmpObject->m_image + "\" size=\"8,8mm\"/>\n";
@ -200,7 +200,7 @@ void ewol::widget::Menu::onReceiveMessage(const ewol::object::Message& _msg) {
std::string composeString = "<composer expand=\"true,false\" fill=\"true,true\">\n";
composeString+= " <sizer mode=\"hori\" expand=\"true,false\" fill=\"true,true\" lock=\"true\">\n";
if (std::end_with(m_listElement[jjj]->m_image, ".edf") == true) {
if (etk::end_with(m_listElement[jjj]->m_image, ".edf") == true) {
composeString+=" <image src=\"" + m_listElement[jjj]->m_image + "\" size=\"8,8mm\" distance-field='true'/>\n";
} else {
composeString+=" <image src=\"" + m_listElement[jjj]->m_image + "\" size=\"8,8mm\"/>\n";

View File

@ -15,31 +15,22 @@
#undef __class__
#define __class__ "PopUp"
const char* const ewol::widget::PopUp::configShaper="shaper";
const char* const ewol::widget::PopUp::configRemoveOnExternClick="out-click-remove";
const char* const ewol::widget::PopUp::configAnimation="animation";
const char* const ewol::widget::PopUp::configLockExpand="lock";
static const char* annimationIncrease = "increase";
ewol::widget::PopUp::PopUp() :
m_lockExpand(true,true),
m_closeOutEvent(false) {
m_shaper(*this, "shaper", "The shaper properties"),
m_lockExpand(*this, "lock", bvec2(true,true), "Lock expand contamination"),
m_closeOutEvent(*this, "out-click-remove", false, "Remove the widget if the use click outside") {
addObjectType("ewol::widget::PopUp");
m_userExpand.setValue(false, false);
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
registerConfig(configShaper, "string", nullptr, "The shaper properties");
registerConfig(configRemoveOnExternClick, "bool", nullptr, "Remove the widget if the use click outside");
registerConfig(configLockExpand, "bool", nullptr, "Lock expand contamination");
registerConfig(configAnimation, "list", "none;increase", "Annimation type");
// Add annimations :
addAnnimationType(ewol::Widget::annimationModeEnableAdd, annimationIncrease);
}
void ewol::widget::PopUp::init(const std::string& _shaperName) {
ewol::widget::Container::init();
m_shaper.setSource(_shaperName);
m_shaper.setString(_shaperName);
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
m_userExpand.set(bvec2(false, false));
}
ewol::widget::PopUp::~PopUp() {
@ -54,24 +45,24 @@ void ewol::widget::PopUp::lockExpand(const bvec2& _lockExpand) {
}
void ewol::widget::PopUp::setShaperName(const std::string& _shaperName) {
m_shaper.setSource(_shaperName);
m_shaper.setString(_shaperName);
markToRedraw();
}
void ewol::widget::PopUp::calculateSize(const vec2& _available) {
ewol::Widget::calculateSize(_available);
if (nullptr != m_subWidget) {
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
vec2 subWidgetSize = m_subWidget->getCalculateMinSize();
if (true == m_subWidget->canExpand().x()) {
if (m_lockExpand.x() == true) {
if (m_lockExpand->x() == true) {
subWidgetSize.setX(m_minSize.x());
} else {
subWidgetSize.setX(m_size.x()-padding.xLeft());
}
}
if (true == m_subWidget->canExpand().y()) {
if (m_lockExpand.y() == true) {
if (m_lockExpand->y() == true) {
subWidgetSize.setY(m_minSize.y());
} else {
subWidgetSize.setY(m_size.y()-padding.yButtom());
@ -99,8 +90,8 @@ void ewol::widget::PopUp::systemDraw(const ewol::DrawProperty& _displayProp) {
}
ewol::Widget::systemDraw(_displayProp);
if (nullptr!=m_subWidget) {
if( m_shaper.getNextDisplayedStatus() == -1
&& m_shaper.getTransitionStatus() >= 1.0) {
if( m_shaper->getNextDisplayedStatus() == -1
&& m_shaper->getTransitionStatus() >= 1.0) {
ewol::DrawProperty prop = _displayProp;
prop.limit(m_origin, m_size);
m_subWidget->systemDraw(prop);
@ -109,13 +100,13 @@ void ewol::widget::PopUp::systemDraw(const ewol::DrawProperty& _displayProp) {
}
void ewol::widget::PopUp::onDraw() {
m_shaper.draw();
m_shaper->draw();
}
void ewol::widget::PopUp::onRegenerateDisplay() {
if (true == needRedraw()) {
m_shaper.clear();
ewol::Padding padding = m_shaper.getPadding();
m_shaper->clear();
ewol::Padding padding = m_shaper->getPadding();
vec2 tmpSize(0,0);
bvec2 expand = canExpand();
bvec2 fill = canFill();
@ -131,10 +122,10 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
tmpSize.setMax(m_minSize);
vec2 tmpOrigin = (m_size-tmpSize)/2.0f;
m_shaper.setShape(vec2(0,0),
vec2ClipInt32(m_size),
vec2ClipInt32(tmpOrigin-vec2(padding.xLeft(), padding.yButtom())),
vec2ClipInt32(tmpSize + vec2(padding.x(), padding.y())));
m_shaper->setShape(vec2(0,0),
vec2ClipInt32(m_size),
vec2ClipInt32(tmpOrigin-vec2(padding.xLeft(), padding.yButtom())),
vec2ClipInt32(tmpSize + vec2(padding.x(), padding.y())));
}
// SUBwIDGET GENERATION ...
if (nullptr != m_subWidget) {
@ -150,6 +141,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::PopUp::getWidgetAtPos(const vec2& _p
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());
}
/*
bool ewol::widget::PopUp::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::Container::onSetConfig(_conf)) {
return true;
@ -159,7 +151,7 @@ bool ewol::widget::PopUp::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == configRemoveOnExternClick) {
setRemoveOnExternClick(std::stob(_conf.getData()));
setRemoveOnExternClick(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configLockExpand) {
@ -182,16 +174,17 @@ bool ewol::widget::PopUp::onGetConfig(const char* _config, std::string& _result)
return true;
}
if (_config == configRemoveOnExternClick) {
_result = std::to_string(getRemoveOnExternClick());
_result = etk::to_string(getRemoveOnExternClick());
return true;
}
return false;
}
*/
bool ewol::widget::PopUp::onEventInput(const ewol::event::Input& _event) {
if (0 != _event.getId()) {
if (true == m_closeOutEvent) {
ewol::Padding padding = m_shaper.getPadding();
ewol::Padding padding = m_shaper->getPadding();
vec2 tmpSize(0,0);
if (nullptr != m_subWidget) {
vec2 tmpSize = m_subWidget->getSize();
@ -216,10 +209,21 @@ bool ewol::widget::PopUp::onEventInput(const ewol::event::Input& _event) {
bool ewol::widget::PopUp::onStartAnnimation(enum ewol::Widget::annimationMode _mode) {
if (m_annimationType[_mode] != annimationIncrease) {
return false;
if (_mode==0) {
/*
if (m_annimationTypeStart.get() != annimationIncrease) {
return false;
}
*/
} else {
/*
if (m_annimationTypeStop.get() != annimationIncrease) {
return false;
}
*/
}
if (true == m_shaper.changeStatusIn(1) ) {
return false;
if (true == m_shaper->changeStatusIn(1) ) {
periodicCallEnable();
return true;
}
@ -231,7 +235,7 @@ void ewol::widget::PopUp::onStopAnnimation() {
}
void ewol::widget::PopUp::periodicCall(const ewol::event::Time& _event) {
if (false == m_shaper.periodicCall(_event) ) {
if (false == m_shaper->periodicCall(_event) ) {
stopAnnimation();
}
markToRedraw();

View File

@ -23,14 +23,8 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class PopUp : public ewol::widget::Container {
public:
// Config list of properties
static const char* const configShaper;
static const char* const configRemoveOnExternClick;
static const char* const configAnimation;
static const char* const configLockExpand;
protected:
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::object::Param<ewol::compositing::Shaper> m_shaper; //!< Compositing theme.
protected:
/**
* @brief Constructor
@ -50,7 +44,7 @@ namespace ewol {
*/
void setShaperName(const std::string& _shaperName);
protected:
bvec2 m_lockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
ewol::object::Param<bvec2> m_lockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
public:
/**
* @brief Limit the expend properties to the current widget (no contamination)
@ -58,7 +52,7 @@ namespace ewol {
*/
void lockExpand(const bvec2& _lockExpand);
private:
bool m_closeOutEvent; //!< ratio progression of a sliding
ewol::object::Param<bool> m_closeOutEvent; //!< ratio progression of a sliding
public:
/**
* @brief Request the Auto-remove when the event input is set outside the widget
@ -76,8 +70,10 @@ namespace ewol {
};
protected: // Derived function
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function
virtual void periodicCall(const ewol::event::Time& _event);
virtual void systemDraw(const ewol::DrawProperty& _displayProp);

View File

@ -14,29 +14,15 @@
#undef __class__
#define __class__ "ProgressBar"
const char* const ewol::widget::ProgressBar::configColorBg = "color-bg";
const char* const ewol::widget::ProgressBar::configColorFgOn = "color-on";
const char* const ewol::widget::ProgressBar::configColorFgOff = "color-off";
const char* const ewol::widget::ProgressBar::configValue = "value";
const int32_t dotRadius = 6;
ewol::widget::ProgressBar::ProgressBar() {
ewol::widget::ProgressBar::ProgressBar() :
m_value(*this, "value", 0.0f, "Value of the progress bar"),
m_textColorFg(*this, "color-bg", etk::color::black, "Background color"),
m_textColorBgOn(*this, "color-on", etk::Color<>(0x00, 0xFF, 0x00, 0xFF), "Color of the true value"),
m_textColorBgOff(*this, "color-off", etk::color::none, "Color of the false value") {
addObjectType("ewol::widget::ProgressBar");
m_value = 0.0;
m_textColorFg = etk::color::black;
m_textColorBgOn = etk::Color<>(0x00, 0xFF, 0x00, 0xFF);
m_textColorBgOff = etk::color::black;
m_textColorBgOff.setA(0x3F);
setCanHaveFocus(true);
registerConfig(configColorBg, "color", nullptr, "Background color");
registerConfig(configColorFgOn, "color", nullptr, "Corlor of the true value");
registerConfig(configColorFgOff, "color", nullptr, "Corlor of the false value");
registerConfig(configValue, "integer", nullptr, "Value of the progress bar");
}
void ewol::widget::ProgressBar::init() {
@ -48,7 +34,7 @@ ewol::widget::ProgressBar::~ProgressBar() {
}
void ewol::widget::ProgressBar::calculateMinMaxSize() {
vec2 tmpMin = m_userMinSize.getPixel();
vec2 tmpMin = m_userMinSize->getPixel();
m_minSize.setValue( std::max(tmpMin.x(), 40.0f),
std::max(tmpMin.y(), dotRadius*2.0f) );
markToRedraw();
@ -88,6 +74,7 @@ void ewol::widget::ProgressBar::onRegenerateDisplay() {
}
/*
bool ewol::widget::ProgressBar::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
@ -139,4 +126,6 @@ bool ewol::widget::ProgressBar::onGetConfig(const char* _config, std::string& _r
return false;
}
*/

View File

@ -22,13 +22,6 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class ProgressBar : public ewol::Widget {
public:
static void init(ewol::widget::Manager& _widgetManager);
// Config list of properties
static const char* const configColorBg;
static const char* const configColorFgOn;
static const char* const configColorFgOff;
static const char* const configValue;
private:
ewol::compositing::Drawing m_draw; // basic drawing element
protected:
@ -45,14 +38,16 @@ namespace ewol {
m_textColorFg = _newColor;
};
private:
float m_value; //!< % used
etk::Color<> m_textColorFg; //!< forder bar color
etk::Color<> m_textColorBgOn; //!< bar color enable
etk::Color<> m_textColorBgOff; //!< bar color disable
ewol::object::Param<float> m_value; //!< % used
ewol::object::Param<etk::Color<>> m_textColorFg; //!< forder bar color
ewol::object::Param<etk::Color<>> m_textColorBgOn; //!< bar color enable
ewol::object::Param<etk::Color<>> m_textColorBgOff; //!< bar color disable
protected: // Derived function
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function
virtual void onRegenerateDisplay();
virtual void calculateMinMaxSize();

View File

@ -14,17 +14,14 @@
#undef __class__
#define __class__ "Scroll"
const char* const ewol::widget::Scroll::configLimit = "limit";
ewol::widget::Scroll::Scroll() :
m_limit(0.15,0.5),
m_limit(*this, "limit", vec2(0.15,0.5), vec2(0.0,0.0), vec2(1.0,1.0), "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end"),
m_pixelScrolling(20),
m_highSpeedStartPos(0,0),
m_highSpeedMode(speedModeDisable),
m_highSpeedButton(-1),
m_highSpeedType(ewol::key::typeUnknow) {
addObjectType("ewol::widget::Scroll");
registerConfig(configLimit, "vec2", nullptr, "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end");
}
void ewol::widget::Scroll::init(const std::string& _shaperName) {
@ -39,7 +36,7 @@ ewol::widget::Scroll::~Scroll() {
}
void ewol::widget::Scroll::setLimit(const vec2& _limit) {
m_limit = _limit;
m_limit.set(_limit);
markToRedraw();
}
@ -92,7 +89,7 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|| scrollOffset.y()!=0) {
float lenScrollBar = m_size.y()*m_size.y() / scrollSize.y();
lenScrollBar = std::avg(10.0f, lenScrollBar, m_size.y());
float originScrollBar = scrollOffset.y() / (scrollSize.y()-m_size.y()*m_limit.y());
float originScrollBar = scrollOffset.y() / (scrollSize.y()-m_size.y()*m_limit->y());
originScrollBar = std::avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (m_size.y()-lenScrollBar);
m_shaperV.setShape(vec2(m_size.x() - paddingVert.x(), 0),
@ -104,7 +101,7 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|| scrollOffset.x()!=0) {
float lenScrollBar = (m_size.x()-paddingHori.xLeft())*(m_size.x()-paddingVert.x()) / scrollSize.x();
lenScrollBar = std::avg(10.0f, lenScrollBar, (m_size.x()-paddingVert.x()));
float originScrollBar = scrollOffset.x() / (scrollSize.x()-m_size.x()*m_limit.x());
float originScrollBar = scrollOffset.x() / (scrollSize.x()-m_size.x()*m_limit->x());
originScrollBar = std::avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (m_size.x()-paddingHori.xRight()-lenScrollBar);
m_shaperH.setShape(vec2(0, 0),
@ -142,7 +139,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
m_highSpeedButton = 1;
// force direct scrolling in this case
scrollOffset.setY((int32_t)(scrollSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2)));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit.y())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y())));
markToRedraw();
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
@ -159,7 +156,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
m_highSpeedButton = 1;
// force direct scrolling in this case
scrollOffset.setX((int32_t)(scrollSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2)));
scrollOffset.setY(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit.x())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit->x())));
markToRedraw();
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
@ -172,7 +169,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
&& _event.getStatus() == ewol::key::statusUp) {
if(m_size.y() < scrollSize.y()) {
scrollOffset.setY(scrollOffset.y()-m_pixelScrolling);
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit.y())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y())));
markToRedraw();
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
@ -183,7 +180,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
&& _event.getStatus() == ewol::key::statusUp) {
if(m_size.y() < scrollSize.y()) {
scrollOffset.setY(scrollOffset.y()+m_pixelScrolling);
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit.y())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y())));
markToRedraw();
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
@ -253,7 +250,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
}
markToRedraw();
}
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit.y())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y())));
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
}
@ -262,7 +259,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
if( m_highSpeedMode == speedModeEnableHorizontal
&& _event.getStatus() == ewol::key::statusMove) {
scrollOffset.setX((int32_t)(scrollSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2)));
scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit.x() )));
scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit->x() )));
markToRedraw();
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
@ -272,7 +269,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
if( m_highSpeedMode == speedModeEnableVertical
&& _event.getStatus() == ewol::key::statusMove) {
scrollOffset.setY((int32_t)(scrollSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2)));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit.x())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->x())));
markToRedraw();
if (nullptr!=m_subWidget) {
m_subWidget->setOffset(scrollOffset);
@ -314,13 +311,13 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
&& ewol::key::statusMove == _event.getStatus()) {
EWOL_VERBOSE("SCROOL == > INIT scrollOffset=" << scrollOffset.y() << " relativePos=" << relativePos.y() << " m_highSpeedStartPos=" << m_highSpeedStartPos.y());
//scrollOffset.x = (int32_t)(scrollSize.x * x / m_size.x);
if (m_limit.x() != 0.0f) {
if (m_limit->x() != 0.0f) {
scrollOffset.setX(scrollOffset.x() + (relativePos.x() - m_highSpeedStartPos.x()));
scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit.x())));
scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit->x())));
}
if (m_limit.y() != 0.0f) {
if (m_limit->y() != 0.0f) {
scrollOffset.setY(scrollOffset.y() - (relativePos.y() - m_highSpeedStartPos.y()));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit.y())));
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y())));
}
// update current position:
m_highSpeedStartPos = relativePos;
@ -353,7 +350,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Scroll::getWidgetAtPos(const vec2& _
}
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());;
}
/*
bool ewol::widget::Scroll::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::Container::onSetConfig(_conf)) {
return true;
@ -375,5 +372,5 @@ bool ewol::widget::Scroll::onGetConfig(const char* _config, std::string& _result
}
return false;
}
*/

View File

@ -31,14 +31,11 @@ namespace ewol {
speedModeEnableVertical, // Specific for mouse
speedModeGrepEndEvent
};
public:
// Cinfig parameter list:
static const char* const configLimit;
private:
ewol::compositing::Shaper m_shaperH; //!< Compositing theme Horizontal.
ewol::compositing::Shaper m_shaperV; //!< Compositing theme Vertical.
protected:
vec2 m_limit;
ewol::object::ParamRange<vec2> m_limit;
private:
float m_pixelScrolling;
vec2 m_highSpeedStartPos;
@ -71,8 +68,10 @@ namespace ewol {
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
protected: // Derived function
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
};
};
};

View File

@ -10,26 +10,22 @@
#include <ewol/widget/Sizer.h>
#include <ewol/widget/Manager.h>
const char* const ewol::widget::Sizer::configBorder = "border";
const char* const ewol::widget::Sizer::configMode = "mode";
#undef __class__
#define __class__ "Sizer"
ewol::widget::Sizer::Sizer() :
m_mode(ewol::widget::Sizer::modeHori),
m_borderSize(),
m_mode(*this, "mode", modeHori, "The display mode"),
m_borderSize(*this, "border", vec2(0,0), "The sizer border size"),
m_animation(animationNone),
m_animationTime(0) {
addObjectType("ewol::widget::Sizer");
registerConfig(configBorder, "dimension", nullptr, "The sizer border size");
registerConfig(configMode, "list", "{vert,hori}", "The display mode");
m_mode.add(modeHori, "hori");
m_mode.add(modeVert, "vert");
}
void ewol::widget::Sizer::init(enum displayMode _mode) {
ewol::widget::ContainerN::init();
m_mode = _mode;
m_mode.set(_mode);
}
ewol::widget::Sizer::~Sizer() {
@ -41,20 +37,20 @@ ewol::widget::Sizer::~Sizer() {
void ewol::widget::Sizer::setBorderSize(const ewol::Dimension& _newBorderSize) {
m_borderSize = _newBorderSize;
m_borderSize.set(_newBorderSize);
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Sizer::setMode(enum displayMode _mode) {
m_mode = _mode;
m_mode.set(_mode);
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
ewol::Widget::calculateSize(_availlable);
vec2 tmpBorderSize = m_borderSize.getPixel();
vec2 tmpBorderSize = m_borderSize->getPixel();
EWOL_VERBOSE("[" << getId() << "] update size : " << _availlable << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
m_size -= tmpBorderSize*2;
// calculate unExpandable size :
@ -128,8 +124,8 @@ void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
void ewol::widget::Sizer::calculateMinMaxSize() {
EWOL_VERBOSE("[" << getId() << "] update minimum size");
m_subExpend.setValue(false, false);
m_minSize = m_userMinSize.getPixel();
vec2 tmpBorderSize = m_borderSize.getPixel();
m_minSize = m_userMinSize->getPixel();
vec2 tmpBorderSize = m_borderSize->getPixel();
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
m_minSize += tmpBorderSize*2;
for (auto &it : m_subWidget) {
@ -193,7 +189,7 @@ void ewol::widget::Sizer::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidg
// TODO : ...
ewol::widget::ContainerN::subWidgetUnLink(_newWidget);
}
/*
bool ewol::widget::Sizer::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::ContainerN::onSetConfig(_conf)) {
return true;
@ -231,5 +227,5 @@ bool ewol::widget::Sizer::onGetConfig(const char* _config, std::string& _result)
}
return false;
}
*/

View File

@ -25,16 +25,13 @@ namespace ewol {
* @brief Main call of recording the widget on the List of "widget named creator"
*/
static void init(ewol::widget::Manager& _widgetManager);
// Config list of properties
static const char* const configBorder;
static const char* const configMode;
public:
enum displayMode {
modeVert, //!< Vertical mode
modeHori, //!< Horizontal mode
};
private:
enum displayMode m_mode; //!< Methode to display the widget list (vert/hory ...)
ewol::object::ParamList<enum displayMode> m_mode; //!< Methode to display the widget list (vert/hory ...)
protected:
/**
* @brief Constructor
@ -61,7 +58,7 @@ namespace ewol {
return m_mode;
}
private:
ewol::Dimension m_borderSize; //!< Border size needed for all the display
ewol::object::Param<ewol::Dimension> m_borderSize; //!< Border size needed for all the display
public:
/**
* @brief set the current border size of the current element:
@ -126,8 +123,10 @@ namespace ewol {
virtual int32_t subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget);
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget);
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget);
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
};
};
};

View File

@ -43,7 +43,7 @@ ewol::widget::Slider::~Slider() {
}
void ewol::widget::Slider::calculateMinMaxSize() {
vec2 minTmp = m_userMinSize.getPixel();
vec2 minTmp = m_userMinSize->getPixel();
m_minSize.setValue(std::max(minTmp.x(), 40.0f),
std::max(minTmp.y(), dotRadius*2.0f) );
markToRedraw();
@ -109,7 +109,7 @@ bool ewol::widget::Slider::onEventInput(const ewol::event::Input& _event) {
m_value = std::max(std::min(m_value, m_max), m_min);
if (oldValue != m_value) {
EWOL_DEBUG(" new value : " << m_value << " in [" << m_min << ".." << m_max << "]");
generateEventId(eventChange, std::to_string(m_value));
generateEventId(eventChange, etk::to_string(m_value));
markToRedraw();
}
return true;

View File

@ -14,15 +14,11 @@
#undef __class__
#define __class__ "Spacer"
const char* const ewol::widget::Spacer::configColor = "color";
ewol::widget::Spacer::Spacer() {
ewol::widget::Spacer::Spacer() :
m_color(*this, "color", etk::color::none, "background of the spacer") {
addObjectType("ewol::widget::Spacer");
m_userMinSize = ewol::Dimension(vec2(10,10));
setCanHaveFocus(false);
m_color = etk::color::black;
m_color.setA(0);
registerConfig(configColor, "color", nullptr, "background of the spacer");
}
void ewol::widget::Spacer::init() {
@ -44,14 +40,14 @@ void ewol::widget::Spacer::onRegenerateDisplay() {
}
m_draw.clear();
if (m_color.a() == 0) {
if (m_color->a() == 0) {
return;
}
m_draw.setColor(m_color);
m_draw.setPos(vec3(0, 0, 0) );
m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) );
}
/*
bool ewol::widget::Spacer::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
@ -74,5 +70,5 @@ bool ewol::widget::Spacer::onGetConfig(const char* _config, std::string& _result
}
return false;
}
*/

View File

@ -22,9 +22,6 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class Spacer : public ewol::Widget {
public:
// Config list of properties
static const char* const configColor;
private:
ewol::compositing::Drawing m_draw; //!< Compositing drawing element
protected:
@ -40,7 +37,7 @@ namespace ewol {
*/
virtual ~Spacer();
protected:
etk::Color<> m_color; //!< Background color
ewol::object::Param<etk::Color<>> m_color; //!< Background color
public:
/**
* @brief Spziby the background color (basicly transparent)
@ -54,8 +51,10 @@ namespace ewol {
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos) { return nullptr; };
virtual void onRegenerateDisplay();
virtual void onDraw();
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
};
};
};

View File

@ -36,15 +36,14 @@ ewol::widget::WSlider::WSlider() :
m_windowsDestination(0),
m_windowsRequested(-1),
m_slidingProgress(1.0f),
m_transitionSpeed(1.0f),
m_transitionSlide(sladingTransitionHori) {
m_selectNewWidget(*this, "select", "", "Select the requested widget to display"),
m_transitionSpeed(*this, "speed", 1.0f, 0.0f, 200.0f, "Transition speed of the slider"),
m_transitionSlide(*this, "mode", sladingTransitionHori, "Transition mode of the slider") {
addObjectType("ewol::widget::WSlider");
addEventId(eventStartSlide);
addEventId(eventStopSlide);
// add configuration
registerConfig(configMode, "list", "vert;hori", "Transition mode of the slider");
registerConfig(configSpeed, "float", nullptr, "Transition speed of the slider");
registerConfig(configSelect, "strin", nullptr, "Select the requested widget to display");
m_transitionSlide.add(sladingTransitionVert, "vert");
m_transitionSlide.add(sladingTransitionHori, "hori");
}
ewol::widget::WSlider::~WSlider() {
@ -270,23 +269,23 @@ void ewol::widget::WSlider::onRegenerateDisplay() {
}
}
}
/*
bool ewol::widget::WSlider::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::ContainerN::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configMode) {
enum sladingMode tmpTransition = sladingTransitionHori;
if(compare_no_case(_conf.getData(), "vert") == true) {
if(etk::compare_no_case(_conf.getData(), "vert") == true) {
tmpTransition = sladingTransitionVert;
} else if(compare_no_case(_conf.getData(), "hori") == true) {
} else if(etk::compare_no_case(_conf.getData(), "hori") == true) {
tmpTransition = sladingTransitionHori;
}
setTransitionMode(tmpTransition);
return true;
}
if (_conf.getConfig() == configSpeed) {
setTransitionSpeed(std::stof(_conf.getData()));
setTransitionSpeed(etk::string_to_float(_conf.getData()));
return true;
}
if (_conf.getConfig() == configSelect) {
@ -313,7 +312,7 @@ bool ewol::widget::WSlider::onGetConfig(const char* _config, std::string& _resul
return true;
}
if (_config == configMode) {
_result = std::to_string(getTransitionSpeed());
_result = etk::to_string(getTransitionSpeed());
return true;
}
if (_config == configSelect) {
@ -327,6 +326,7 @@ bool ewol::widget::WSlider::onGetConfig(const char* _config, std::string& _resul
}
return false;
}
*/
std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2& _pos) {
if (true == isHide()) {

View File

@ -47,6 +47,7 @@ namespace ewol {
int32_t m_windowsDestination; //!< widget destinated viewed
int32_t m_windowsRequested; //!< widget destination requested when change in modification in progress
float m_slidingProgress; //!< ratio progression of a sliding
ewol::object::Param<std::string> m_selectNewWidget; // input config requesting
protected:
/**
* @brief Generate the move on the specific vector ID (This is not a public acces, because the vector can have some null pointer inside ...)
@ -70,14 +71,14 @@ namespace ewol {
*/
void subWidgetSelectSet(const std::string& _widgetName);
private:
float m_transitionSpeed; //!< speed of the transition (default 1 == > 1s)
ewol::object::ParamRange<float> m_transitionSpeed; //!< speed of the transition (default 1 == > 1s)
public:
/**
* @brief set transition speed element.
* @param[in] _timeSecond number of second needed to do the transition.
*/
void setTransitionSpeed(float _timeSecond) {
m_transitionSpeed = _timeSecond;
m_transitionSpeed.set(_timeSecond);
};
/**
* @brief get transition speed element.
@ -87,7 +88,7 @@ namespace ewol {
return m_transitionSpeed;
};
private:
enum sladingMode m_transitionSlide; //!< mode to slide the widgets
ewol::object::ParamList<enum sladingMode> m_transitionSlide; //!< mode to slide the widgets
public:
/**
* @brief set a new mode of sliding element
@ -107,8 +108,10 @@ namespace ewol {
virtual void onRegenerateDisplay();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
virtual void periodicCall(const ewol::event::Time& _event);
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
};
};
std::ostream& operator <<(std::ostream& _os, const enum ewol::widget::WSlider::sladingMode _obj);

View File

@ -86,14 +86,6 @@ std::ostream& ewol::operator <<(std::ostream& _os, const enum ewol::gravity _obj
#undef __class__
#define __class__ "Widget"
// TODO : Event config :
const char* const ewol::Widget::configFocus = "focus";
// configuration :
const char* const ewol::Widget::configAnnimationAddType = "annimation-start-type";
const char* const ewol::Widget::configAnnimationAddTime = "annimation-start-time";
const char* const ewol::Widget::configAnnimationRemoveType = "annimation-remove-type";
const char* const ewol::Widget::configAnnimationRemoveTime = "annimation-remove-time";
// event generated :
const char* const ewol::Widget::eventAnnimationStart = "annimation-start";
const char* const ewol::Widget::eventAnnimationRatio = "annimation-ratio";
@ -113,7 +105,7 @@ ewol::Widget::Widget() :
m_hide(*this, "hide", false, "The widget start hided"),
m_gravity(*this, "gravity", ewol::gravityButtomLeft, "Gravity orientation"),
m_hasFocus(false),
m_canFocus(false),
m_canFocus(*this, "focus", false, "enable the widget to have the focus capacity"), // TODO : je pense que c'est une erreur, c'st surement un event to get the cocus ...
m_limitMouseEvent(3),
m_allowRepeateKeyboardEvent(true),
m_periodicCallDeltaTime(-1),
@ -123,17 +115,11 @@ ewol::Widget::Widget() :
m_cursorDisplay(ewol::context::cursorArrow),
m_annimationMode(annimationModeDisable),
m_annimationratio(0.0f),
m_annimationTypeStart(*this, "annimation-start-type", "Annimation type, when adding/show a widget"),
m_annimationTimeStart(*this, "annimation-start-time", "Annimation time in second, when adding/show a widget", 0.2f, 0.0f, 200.0f),
m_annimationTypeStop(*this, "annimation-stop-type", "Annimation type, when removing/hide a widget"),
m_annimationTimeStop(*this, "annimation-stop-time", "Annimation time in second, when removing/hide a widget", 0.2f, 0.0f, 200.0f){
m_annimationType[0] = nullptr;
m_annimationType[1] = nullptr;
m_annimationTime[0] = 0.1f; // annimation will be 100ms at the first state
m_annimationTime[1] = 0.1f; // annimation will be 100ms at the first state
m_annimationTypeStart(*this, "annimation-start-type", 0, "Annimation type, when adding/show a widget"),
m_annimationTimeStart(*this, "annimation-start-time", 0.1f, 0.0f, 200.0f, "Annimation time in second, when adding/show a widget"),
m_annimationTypeStop(*this, "annimation-stop-type", 0, "Annimation type, when removing/hide a widget"),
m_annimationTimeStop(*this, "annimation-stop-time", 0.1f, 0.0f, 200.0f, "Annimation time in second, when removing/hide a widget"){
addObjectType("ewol::Widget");
// set all the config in the list :
registerConfig(ewol::Widget::configFocus, "bool", nullptr, "The widget request focus");
// TODO : Set a static interface for list ==> this methode create a multiple allocation
m_gravity.add(ewol::gravityCenter, "center");
@ -145,13 +131,8 @@ ewol::Widget::Widget() :
m_gravity.add(ewol::gravityButtom, "buttom");
m_gravity.add(ewol::gravityButtomLeft, "buttom-left");
m_gravity.add(ewol::gravityLeft, "left");
m_annimationTypeStart.add(0, "none");
m_annimationTypeStart.setDefault(0);
m_annimationTypeStop.add(0, "none");
m_annimationTypeStop.setDefault(0);
addEventId(eventAnnimationStart);
addEventId(eventAnnimationRatio);
@ -415,9 +396,9 @@ vec2 ewol::Widget::relativePosition(const vec2& _pos) {
}
void ewol::Widget::calculateMinMaxSize() {
m_minSize = m_userMinSize.getPixel();
m_minSize = m_userMinSize->getPixel();
//EWOL_ERROR("[" << getId() << "] convert in min size : " << m_userMinSize << " out=" << m_minSize);
m_maxSize = m_userMaxSize.getPixel();
m_maxSize = m_userMaxSize->getPixel();
markToRedraw();
}
@ -437,7 +418,7 @@ vec2 ewol::Widget::getCalculateMaxSize() {
void ewol::Widget::setMinSize(const ewol::Dimension& _size) {
vec2 pixelMin = _size.getPixel();
vec2 pixelMax = m_userMaxSize.getPixel();
vec2 pixelMax = m_userMaxSize->getPixel();
// check minimum & maximum compatibility :
bool error=false;
if (pixelMin.x()>pixelMax.x()) {
@ -455,17 +436,17 @@ void ewol::Widget::setMinSize(const ewol::Dimension& _size) {
}
void ewol::Widget::setNoMinSize() {
m_userMinSize.set(vec2(0,0),ewol::Dimension::Pixel);
m_userMinSize.set(ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel));
}
void ewol::Widget::checkMinSize() {
vec2 pixelSize = m_userMinSize.getPixel();
vec2 pixelSize = m_userMinSize->getPixel();
m_minSize.setX(std::max(m_minSize.x(), pixelSize.x()));
m_minSize.setY(std::max(m_minSize.y(), pixelSize.y()));
}
void ewol::Widget::setMaxSize(const ewol::Dimension& _size) {
vec2 pixelMin = m_userMinSize.getPixel();
vec2 pixelMin = m_userMinSize->getPixel();
vec2 pixelMax = _size.getPixel();
// check minimum & maximum compatibility :
bool error=false;
@ -484,11 +465,11 @@ void ewol::Widget::setMaxSize(const ewol::Dimension& _size) {
}
void ewol::Widget::setNoMaxSize() {
m_userMaxSize.set(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel);
m_userMaxSize.set(ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel));
}
void ewol::Widget::checkMaxSize() {
vec2 pixelSize = m_userMaxSize.getPixel();
vec2 pixelSize = m_userMaxSize->getPixel();
m_maxSize.setX(std::min(m_maxSize.x(), pixelSize.x()));
m_maxSize.setY(std::min(m_maxSize.y(), pixelSize.y()));
}
@ -501,9 +482,9 @@ vec2 ewol::Widget::getSize() {
}
void ewol::Widget::setExpand(const bvec2& _newExpand) {
if( m_userExpand.x() != _newExpand.x()
|| m_userExpand.y() != _newExpand.y()) {
m_userExpand = _newExpand;
if( m_userExpand->x() != _newExpand.x()
|| m_userExpand->y() != _newExpand.y()) {
m_userExpand.set(_newExpand);
requestUpdateSize();
markToRedraw();
}
@ -517,8 +498,8 @@ bvec2 ewol::Widget::canExpand() {
}
void ewol::Widget::setFill(const bvec2& _newFill) {
if( m_userFill.get().x() != _newFill.x()
|| m_userFill.get().y() != _newFill.y()) {
if( m_userFill->x() != _newFill.x()
|| m_userFill->y() != _newFill.y()) {
m_userFill = _newFill;
requestUpdateSize();
markToRedraw();
@ -526,7 +507,7 @@ void ewol::Widget::setFill(const bvec2& _newFill) {
}
const bvec2& ewol::Widget::canFill() {
return m_userFill.get();
return m_userFill;
}
// ----------------------------------------------------------------------------------------------------------------
@ -743,6 +724,7 @@ void ewol::Widget::setGravity(enum gravity _gravity) {
markToRedraw();
}
/*
bool ewol::Widget::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Object::onSetConfig(_conf)) {
return true;
@ -756,7 +738,7 @@ bool ewol::Widget::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == ewol::Widget::configHide) {
if(true == std::stob(_conf.getData())) {
if(true == etk::string_to_bool(_conf.getData())) {
hide();
} else {
show();
@ -764,7 +746,7 @@ bool ewol::Widget::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == ewol::Widget::configFocus) {
if(true == std::stob(_conf.getData())) {
if(true == etk::string_to_bool(_conf.getData())) {
keepFocus();
} else {
//nothing to do ...
@ -788,7 +770,7 @@ bool ewol::Widget::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == ewol::Widget::configAnnimationAddTime) {
setAnnimationTime(ewol::Widget::annimationModeEnableAdd, std::stof(_conf.getData()));
setAnnimationTime(ewol::Widget::annimationModeEnableAdd, etk::string_to_float(_conf.getData()));
return true;
}
if (_conf.getConfig() == ewol::Widget::configAnnimationRemoveType) {
@ -796,7 +778,7 @@ bool ewol::Widget::onSetConfig(const ewol::object::Config& _conf) {
return true;
}
if (_conf.getConfig() == ewol::Widget::configAnnimationRemoveTime) {
setAnnimationTime(ewol::Widget::annimationModeEnableRemove, std::stof(_conf.getData()));
setAnnimationTime(ewol::Widget::annimationModeEnableRemove, etk::string_to_float(_conf.getData()));
return true;
}
return false;
@ -807,7 +789,7 @@ bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const
return true;
}
if (_config == ewol::Widget::configFill) {
_result = m_userFill.get();
_result = m_userFill;
return true;
}
if (_config == ewol::Widget::configExpand) {
@ -815,7 +797,7 @@ bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const
return true;
}
if (_config == ewol::Widget::configHide) {
_result = std::to_string(m_hide);
_result = etk::to_string(m_hide);
return true;
}
if (_config == ewol::Widget::configMinSize) {
@ -840,7 +822,7 @@ bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const
return true;
}
if (_config == ewol::Widget::configAnnimationAddTime) {
_result = std::to_string(m_annimationType[ewol::Widget::annimationModeEnableAdd]);
_result = etk::to_string(m_annimationType[ewol::Widget::annimationModeEnableAdd]);
return true;
}
if (_config == ewol::Widget::configAnnimationRemoveType) {
@ -853,11 +835,12 @@ bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const
return true;
}
if (_config == ewol::Widget::configAnnimationRemoveTime) {
_result = std::to_string(m_annimationType[ewol::Widget::annimationModeEnableRemove]);
_result = etk::to_string(m_annimationType[ewol::Widget::annimationModeEnableRemove]);
return true;
}
return false;
}
*/
void ewol::Widget::requestUpdateSize() {
getContext().requestUpdateSize();
@ -884,36 +867,29 @@ void ewol::Widget::addAnnimationType(enum ewol::Widget::annimationMode _mode, co
EWOL_CRITICAL("Not suported mode ==> only for internal properties");
return;
}
/*
for (size_t iii = 0; iii < m_annimationList[_mode].size(); ++iii) {
if (m_annimationList[_mode][iii] == _type) {
return;
}
}
m_annimationList[_mode].push_back(_type);
*/
}
void ewol::Widget::setAnnimationType(enum ewol::Widget::annimationMode _mode, const std::string& _type) {
if (_mode == ewol::Widget::annimationModeDisable) {
EWOL_CRITICAL("Not suported mode ==> only for internal properties");
return;
if (_mode==0) {
m_annimationTypeStart.setString(_type);
} else {
m_annimationTypeStop.setString(_type);
}
for (size_t iii = 0; iii < m_annimationList[_mode].size(); ++iii) {
if (compare_no_case(m_annimationList[_mode][iii], _type) == true) {
m_annimationType[_mode] = m_annimationList[_mode][iii];
return;
}
}
EWOL_ERROR("Can not find annimation type='" << _type << "'");
}
void ewol::Widget::setAnnimationTime(enum ewol::Widget::annimationMode _mode, float _time) {
if (_mode == ewol::Widget::annimationModeDisable) {
EWOL_CRITICAL("Not suported mode ==> only for internal properties");
return;
}
m_annimationTime[_mode] = _time;
if (m_annimationTime[_mode] > 36000.0f) {
EWOL_WARNING("Are you kidding ? Your annimation time : " << m_annimationTime[_mode] << " s is greater than 10 hours");
if (_mode==0) {
m_annimationTimeStart.set(_time);
} else {
m_annimationTimeStop.set(_time);
}
}

View File

@ -323,7 +323,7 @@ namespace ewol {
* @return bvec2 repensent the capacity to x&y filling (set by the user)
*/
virtual const bvec2& getFill() {
return m_userFill.get();
return m_userFill;
};
/**
* @brief get the filling capabilities x&y
@ -351,7 +351,7 @@ namespace ewol {
};
protected:
ewol::object::Param<enum ewol::gravity> m_gravity; //!< Gravity of the widget
ewol::object::ParamList<enum ewol::gravity> m_gravity; //!< Gravity of the widget
public:
/**
* @brief set the widget gravity
@ -688,8 +688,10 @@ namespace ewol {
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {};
virtual bool loadXML(exml::Element* _node);
protected: // Derived function
/*
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public:
/**
* @brief need to be call When the size of the current widget have change == > this force the system to recalculate all the widget positions
@ -721,9 +723,9 @@ namespace ewol {
float m_annimationratio; //!< Ratio of the annimation [0..1]
protected:
ewol::object::ParamList<int32_t> m_annimationTypeStart; //!< type of start annimation
ewol::object::Param<float> m_annimationTimeStart; //!< time to produce start annimation
ewol::object::ParamRange<float> m_annimationTimeStart; //!< time to produce start annimation
ewol::object::ParamList<int32_t> m_annimationTypeStop; //!< type of start annimation
ewol::object::Param<float> m_annimationTimeStop; //!< time to produce start annimation
ewol::object::ParamRange<float> m_annimationTimeStop; //!< time to produce start annimation
protected:
/**
* @brief Add a annimation type capabilities of this widget.

View File

@ -58,26 +58,26 @@ void ewol::widget::FileChooser::init() {
+ "<popup >\n"
+ " <sizer mode='vert' lock='true' fill='true' expand='true'>\n"
+ " <sizer mode='hori'>\n"
+ " <checkbox name='[" + std::to_string(getId()) + "]file-shooser:show-hiden-file'>\n"
+ " <checkbox name='[" + etk::to_string(getId()) + "]file-shooser:show-hiden-file'>\n"
+ " <label>" + TRANSLATE("ShowHiddenFiles") + "</label>\n"
+ " </checkbox>\n"
+ " <spacer expand='true,false'/>\n"
+ " <button name='[" + std::to_string(getId()) + "]file-shooser:button-validate'>\n"
+ " <button name='[" + etk::to_string(getId()) + "]file-shooser:button-validate'>\n"
+ " <sizer mode='hori'>\n"
+ " <image src='THEME:GUI:Load.edf' fill='true' size='7,7mm' distance-field='true'/>\n"
+ " <label name='[" + std::to_string(getId()) + "]file-shooser:validate-label'>" + TRANSLATE("Validate") + "</label>\n"
+ " <label name='[" + etk::to_string(getId()) + "]file-shooser:validate-label'>" + TRANSLATE("Validate") + "</label>\n"
+ " </sizer>\n"
+ " </button>\n"
+ " <button name='[" + std::to_string(getId()) + "]file-shooser:button-cancel'>\n"
+ " <button name='[" + etk::to_string(getId()) + "]file-shooser:button-cancel'>\n"
+ " <sizer mode='hori'>\n"
+ " <image src='THEME:GUI:Remove.edf' fill='true' size='7,7mm' distance-field='true'/>\n"
+ " <label name='[" + std::to_string(getId()) + "]file-shooser:cancel-label'>" + TRANSLATE("Cancel") + "</label>\n"
+ " <label name='[" + etk::to_string(getId()) + "]file-shooser:cancel-label'>" + TRANSLATE("Cancel") + "</label>\n"
+ " </sizer>\n"
+ " </button>\n"
+ " </sizer>\n"
+ " <sizer mode='hori'>\n"
+ " <spacer min-size='2,2mm'/>\n"
+ " <ListFileSystem name='[" + std::to_string(getId()) + "]file-shooser:list-folder'\n"
+ " <ListFileSystem name='[" + etk::to_string(getId()) + "]file-shooser:list-folder'\n"
+ " min-size='20,0%'\n"
+ " expand='false,true'\n"
+ " show-hidden='false'\n"
@ -85,7 +85,7 @@ void ewol::widget::FileChooser::init() {
+ " show-folder='true'\n"
+ " show-temporary='false'/>\n"
+ " <spacer min-size='2,2mm'/>\n"
+ " <ListFileSystem name='[" + std::to_string(getId()) + "]file-shooser:list-files'\n"
+ " <ListFileSystem name='[" + etk::to_string(getId()) + "]file-shooser:list-files'\n"
+ " expand='true,true'\n"
+ " show-hidden='false'\n"
+ " show-file='true'\n"
@ -94,29 +94,29 @@ void ewol::widget::FileChooser::init() {
+ " <spacer min-size='2,2mm'/>\n"
+ " </sizer>\n"
+ " <sizer mode='hori'>\n"
+ " <image name='[" + std::to_string(getId()) + "]file-shooser:img-file' src='THEME:GUI:File.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " <entry name='[" + std::to_string(getId()) + "]file-shooser:entry-file' expand='true,false' fill='true,false'/>\n"
+ " <image name='[" + etk::to_string(getId()) + "]file-shooser:img-file' src='THEME:GUI:File.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " <entry name='[" + etk::to_string(getId()) + "]file-shooser:entry-file' expand='true,false' fill='true,false'/>\n"
+ " </sizer>\n"
+ " <sizer mode='hori'>\n"
+ " <image name='[" + std::to_string(getId()) + "]file-shooser:img-folder' src='THEME:GUI:Folder.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " <entry name='[" + std::to_string(getId()) + "]file-shooser:entry-folder' expand='true,false' fill='true,false'/>\n"
+ " <image name='[" + std::to_string(getId()) + "]file-shooser:img-home' src='THEME:GUI:Home.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " <image name='[" + etk::to_string(getId()) + "]file-shooser:img-folder' src='THEME:GUI:Folder.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " <entry name='[" + etk::to_string(getId()) + "]file-shooser:entry-folder' expand='true,false' fill='true,false'/>\n"
+ " <image name='[" + etk::to_string(getId()) + "]file-shooser:img-home' src='THEME:GUI:Home.edf' expand='false' size='8,8mm' distance-field='true'/>\n"
+ " </sizer>\n"
+ " <label name='[" + std::to_string(getId()) + "]file-shooser:title-label'>" + TRANSLATE("FileChooser") + "</label>\n"
+ " <label name='[" + etk::to_string(getId()) + "]file-shooser:title-label'>" + TRANSLATE("FileChooser") + "</label>\n"
+ " </sizer>\n"
+ "</popup>";
loadFromString(myDescription);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:show-hiden-file", "value", ewolEventFileChooserHidenFileChange);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:button-validate", "pressed", eventValidate);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:button-cancel", "pressed", eventCancel);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:list-folder", "folder-validate", ewolEventFileChooserListFolder);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:list-files", "file-select", ewolEventFileChooserListFile);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:list-files", "file-validate", ewolEventFileChooserListFileValidate);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:entry-file", "modify", ewolEventFileChooserEntryFile);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:entry-file", "enter", ewolEventFileChooserEntryFileEnter);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:entry-folder", "modify", ewolEventFileChooserEntryFolder);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:entry-folder", "enter", ewolEventFileChooserEntryFolderEnter);
registerOnEventNameWidget("[" + std::to_string(getId()) + "]file-shooser:img-home", "pressed", ewolEventFileChooserHome);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:show-hiden-file", "value", ewolEventFileChooserHidenFileChange);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:button-validate", "pressed", eventValidate);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:button-cancel", "pressed", eventCancel);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "folder-validate", ewolEventFileChooserListFolder);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:list-files", "file-select", ewolEventFileChooserListFile);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:list-files", "file-validate", ewolEventFileChooserListFileValidate);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "modify", ewolEventFileChooserEntryFile);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "enter", ewolEventFileChooserEntryFileEnter);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:entry-folder", "modify", ewolEventFileChooserEntryFolder);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:entry-folder", "enter", ewolEventFileChooserEntryFolderEnter);
registerOnEventNameWidget("[" + etk::to_string(getId()) + "]file-shooser:img-home", "pressed", ewolEventFileChooserHome);
// set the default Folder properties:
updateCurrentFolder();
setCanHaveFocus(true);
@ -124,7 +124,7 @@ void ewol::widget::FileChooser::init() {
void ewol::widget::FileChooser::onGetFocus() {
// transfert focus on a specific widget...
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:entry-file", "focus", "true");
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "focus", "true");
}
ewol::widget::FileChooser::~FileChooser() {
@ -132,15 +132,15 @@ ewol::widget::FileChooser::~FileChooser() {
}
void ewol::widget::FileChooser::setTitle(const std::string& _label) {
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:title-label", "value", _label);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:title-label", "value", _label);
}
void ewol::widget::FileChooser::setValidateLabel(const std::string& _label) {
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:validate-label", "value", _label);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:validate-label", "value", _label);
}
void ewol::widget::FileChooser::setCancelLabel(const std::string& _label) {
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:cancel-label", "value", _label);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:cancel-label", "value", _label);
}
void ewol::widget::FileChooser::setFolder(const std::string& _folder) {
@ -150,7 +150,7 @@ void ewol::widget::FileChooser::setFolder(const std::string& _folder) {
void ewol::widget::FileChooser::setFileName(const std::string& _filename) {
m_file = _filename;
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:entry-file", "value", _filename);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "value", _filename);
}
void ewol::widget::FileChooser::onReceiveMessage(const ewol::object::Message& _msg) {
@ -162,18 +162,18 @@ void ewol::widget::FileChooser::onReceiveMessage(const ewol::object::Message& _m
// == > change the file name
m_file = _msg.getData();
// update the selected file in the list :
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-files", "select", m_file);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "select", m_file);
} else if (eventCancel == _msg.getMessage()) {
// == > Auto remove ...
generateEventId(_msg.getMessage());
autoDestroy();
} else if (_msg.getMessage() == ewolEventFileChooserHidenFileChange) {
if (_msg.getData() == "true") {
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "true");
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "true");
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "true");
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "true");
} else {
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "false");
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "false");
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "false");
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "false");
}
} else if (_msg.getMessage() == ewolEventFileChooserListFolder) {
// == > this is an internal event ...
@ -216,9 +216,9 @@ void ewol::widget::FileChooser::updateCurrentFolder() {
m_folder += "/";
}
}
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-files", "path", m_folder);
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:list-folder", "path", m_folder);
setConfigNamed("[" + std::to_string(getId()) + "]file-shooser:entry-folder", "value", m_folder);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "path", m_folder);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "path", m_folder);
setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-folder", "value", m_folder);
markToRedraw();
}

View File

@ -192,7 +192,7 @@ bool ewol::widget::ParameterList::onEventInput(const ewol::event::Input& _event)
if (rawID >= 0 && (size_t)rawID < m_list.size()) {
if (m_list[rawID]!=nullptr) {
if (m_list[rawID]->m_refId >= 0) {
generateEventId(eventSelect, std::to_string(m_list[rawID]->m_refId));
generateEventId(eventSelect, etk::to_string(m_list[rawID]->m_refId));
m_idSelected = rawID;
markToRedraw();
return true;