[DEV] add value set config in entry element

This commit is contained in:
Edouard DUPIN 2014-01-04 17:20:01 +01:00
parent f3d7d3a6e6
commit ab979adf2a
3 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,7 @@ namespace ewol {
*/
class Button : public ewol::Widget {
public:
//! @not-in-doc
static void init(ewol::widget::Manager& _widgetManager);
// Event list of properties
static const char* const eventPressed;

View File

@ -45,6 +45,7 @@ const char* const ewol::widget::Entry::configRegExp = "regExp";
const char* const ewol::widget::Entry::configColorFg = "color";
const char* const ewol::widget::Entry::configColorBg = "background";
const char* const ewol::widget::Entry::configEmptyMessage = "emptytext";
const char* const ewol::widget::Entry::configValue = "value";
ewol::widget::Entry::Entry(std::string _newData) :
m_shaper("THEME:GUI:widgetEntry.conf"),
@ -77,6 +78,7 @@ ewol::widget::Entry::Entry(std::string _newData) :
registerConfig(configColorFg, "color", NULL, "Color of the text displayed");
registerConfig(configColorBg, "color", NULL, "Color of the text selected");
registerConfig(configEmptyMessage, "string", NULL, "Text that is displayed when the Entry is empty (decorated text)");
registerConfig(configValue, "string", NULL, "Value display in the entry (decorated text)");
setValue(_newData);
markToRedraw();
@ -123,7 +125,7 @@ void ewol::widget::Entry::setValue(const std::string& _newData) {
if (m_data == newData) {
m_displayCursorPos = m_data.size();
m_displayCursorPosSelection = m_displayCursorPos;
EWOL_DEBUG("Set ... " << newData);
EWOL_VERBOSE("Set : '" << newData << "'");
}
markToRedraw();
}
@ -609,6 +611,10 @@ bool ewol::widget::Entry::onSetConfig(const ewol::object::Config& _conf) {
setEmptyText(_conf.getData());
return true;
}
if (_conf.getConfig() == configValue) {
setValue(_conf.getData());
return true;
}
return false;
}
@ -636,6 +642,10 @@ bool ewol::widget::Entry::onGetConfig(const char* _config, std::string& _result)
_result = getEmptyText();
return true;
}
if (_config == configValue) {
_result = getValue();
return true;
}
return false;
}

View File

@ -43,6 +43,7 @@ namespace ewol {
static const char* const configColorFg;
static const char* const configColorBg;
static const char* const configEmptyMessage;
static const char* const configValue;
public:
static void init(ewol::widget::Manager& _widgetManager);
private: