[DEV] remove onReceiveMessage fucntion (deprecated) and set work again Entry, SelectColor, List ...
This commit is contained in:
parent
29910b5cef
commit
6bf0c0f0cd
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit bee6e067208eb236f45b818fde10c99147a930b1
|
||||
Subproject commit ce3243a5f438c6dc3158b5f1c786741132a51a6f
|
@ -14,7 +14,7 @@
|
||||
std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Input& _obj) {
|
||||
_os << "{type=" << _obj.getType();
|
||||
_os << " status=" << _obj.getStatus();
|
||||
_os << " id=" << _obj.getId();
|
||||
_os << " id=" << etk::to_string(_obj.getId());
|
||||
_os << " pos=" << _obj.getPos();
|
||||
_os << "}";
|
||||
return _os;
|
||||
|
@ -91,7 +91,14 @@ namespace ewol {
|
||||
EWOL_VERBOSE(" nullptr dest");
|
||||
continue;
|
||||
}
|
||||
EWOL_DEBUG("emit signal : '" << m_name << "' to [" << destObject->getId() << "] data='" << etk::to_string(_data) << "'");
|
||||
#ifdef DEBUG
|
||||
ewol::Object* srcObject = dynamic_cast<ewol::Object*>(&m_objectLink);
|
||||
if (srcObject != nullptr) {
|
||||
EWOL_DEBUG("emit signal : " << srcObject->getObjectType() << " '" << m_name << "' to [" << destObject->getId() << "]" << destObject->getObjectType() << " data='" << etk::to_string(_data) << "'");
|
||||
} else {
|
||||
EWOL_DEBUG("emit signal : '" << m_name << "' to [" << destObject->getId() << "]" << destObject->getObjectType() << " data='" << etk::to_string(_data) << "'");
|
||||
}
|
||||
#endif
|
||||
it.second(_data);
|
||||
}
|
||||
}
|
||||
@ -165,7 +172,14 @@ namespace ewol {
|
||||
EWOL_VERBOSE(" nullptr dest");
|
||||
continue;
|
||||
}
|
||||
EWOL_DEBUG("emit signal : '" << m_name << "' to [" << destObject->getId() << "] BANG!!!");
|
||||
#ifdef DEBUG
|
||||
ewol::Object* srcObject = dynamic_cast<ewol::Object*>(&m_objectLink);
|
||||
if (srcObject != nullptr) {
|
||||
EWOL_DEBUG("emit signal : " << srcObject->getObjectType() << " '" << m_name << "' to [" << destObject->getId() << "]" << destObject->getObjectType() << " BANG!!!");
|
||||
} else {
|
||||
EWOL_DEBUG("emit signal : '" << m_name << "' to [" << destObject->getId() << "]" << destObject->getObjectType() << " BANG!!!");
|
||||
}
|
||||
#endif
|
||||
it.second();
|
||||
}
|
||||
}
|
||||
|
@ -45,12 +45,6 @@ namespace ewol {
|
||||
* @param[in] _object Object to unlink.
|
||||
*/
|
||||
void unBindAll(const std::shared_ptr<ewol::Object>& _object);
|
||||
public:
|
||||
/**
|
||||
* @brief Receive a message from an other Object with a specific eventId and data
|
||||
* @param[in] _msg Message handle
|
||||
*/
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg) { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -215,6 +215,7 @@ void ewol::widget::ButtonColor::onCallbackColorChange(const etk::Color<>& _color
|
||||
|
||||
void ewol::widget::ButtonColor::setValue(const etk::Color<>& _color) {
|
||||
m_textColorFg = _color;
|
||||
signalChange.emit(m_textColorFg);
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
@ -222,19 +223,6 @@ etk::Color<> ewol::widget::ButtonColor::getValue() {
|
||||
return m_textColorFg;
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::ButtonColor::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
EWOL_INFO("Receive MSG : " << _msg.getData());
|
||||
if (_msg.getMessage() == eventColorHasChange) {
|
||||
m_textColorFg = _msg.getData();
|
||||
// TODO : set a proper call
|
||||
//signalChange.emit(_msg.getData());
|
||||
EWOL_TODO("generate signal of change color : " << _msg.getData());
|
||||
markToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::ButtonColor::changeStatusIn(int32_t _newStatusId) {
|
||||
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
||||
periodicCallEnable();
|
||||
@ -242,8 +230,6 @@ void ewol::widget::ButtonColor::changeStatusIn(int32_t _newStatusId) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ewol::widget::ButtonColor::periodicCall(const ewol::event::Time& _event) {
|
||||
if (false == m_shaper.periodicCall(_event) ) {
|
||||
periodicCallDisable();
|
||||
|
@ -70,7 +70,6 @@ namespace ewol {
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
private:
|
||||
/**
|
||||
* @brief internal system to change the property of the current status
|
||||
|
@ -13,14 +13,6 @@
|
||||
#include <ewol/context/Context.h>
|
||||
#include <ewol/Padding.h>
|
||||
|
||||
|
||||
const char * const ewolEventEntryCut = "ewol-widget-entry-event-internal-cut";
|
||||
const char * const ewolEventEntryCopy = "ewol-widget-entry-event-internal-copy";
|
||||
const char * const ewolEventEntryPaste = "ewol-widget-entry-event-internal-paste";
|
||||
const char * const ewolEventEntryClean = "ewol-widget-entry-event-internal-clean";
|
||||
const char * const ewolEventEntrySelect = "ewol-widget-entry-event-internal-select";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "Entry"
|
||||
|
||||
@ -52,6 +44,7 @@ void ewol::widget::Entry::init(const std::string& _newData) {
|
||||
m_shaper.setString("THEME:GUI:Entry.json");
|
||||
setCanHaveFocus(true);
|
||||
m_regExp.setString(".*");
|
||||
m_regExp.get().setMaximize(true);
|
||||
markToRedraw();
|
||||
|
||||
shortCutAdd("ctrl+w", "clean");
|
||||
@ -69,7 +62,21 @@ ewol::widget::Entry::~Entry() {
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onCallbackShortCut(const std::string& _value) {
|
||||
EWOL_WARNING("Event from ShortCut : " << _value);
|
||||
if (_value == "clean") {
|
||||
onCallbackEntryClean();
|
||||
} else if (_value == "cut") {
|
||||
onCallbackCut();
|
||||
} else if (_value == "copy") {
|
||||
onCallbackCopy();
|
||||
} else if (_value == "paste") {
|
||||
onCallbackPaste();
|
||||
} else if (_value == "select:all") {
|
||||
onCallbackSelect(true);
|
||||
} else if (_value == "select:none") {
|
||||
onCallbackSelect(false);
|
||||
} else {
|
||||
EWOL_WARNING("Unknow event from ShortCut : " << _value);
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::calculateMinMaxSize() {
|
||||
@ -407,7 +414,7 @@ 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()) ) {
|
||||
if (false == m_regExp->parse(_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;
|
||||
}
|
||||
@ -445,32 +452,36 @@ void ewol::widget::Entry::onEventClipboard(enum ewol::context::clipBoard::clipbo
|
||||
signalModify.emit(m_data);
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onCallbackEntryClean() {
|
||||
m_data = "";
|
||||
m_displayStartPosition = 0;
|
||||
m_displayCursorPos = 0;
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
ewol::Widget::onReceiveMessage(_msg);
|
||||
if(_msg.getMessage() == ewolEventEntryClean) {
|
||||
m_data = "";
|
||||
m_displayStartPosition = 0;
|
||||
m_displayCursorPos = 0;
|
||||
void ewol::widget::Entry::onCallbackCut() {
|
||||
copySelectionToClipBoard(ewol::context::clipBoard::clipboardStd);
|
||||
removeSelected();
|
||||
signalModify.emit(m_data);
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onCallbackCopy() {
|
||||
copySelectionToClipBoard(ewol::context::clipBoard::clipboardStd);
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onCallbackPaste() {
|
||||
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd);
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onCallbackSelect(bool _all) {
|
||||
if(_all == true) {
|
||||
m_displayCursorPosSelection = 0;
|
||||
m_displayCursorPos = m_data->size();
|
||||
} else {
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
markToRedraw();
|
||||
} else if(_msg.getMessage() == ewolEventEntryCut) {
|
||||
copySelectionToClipBoard(ewol::context::clipBoard::clipboardStd);
|
||||
removeSelected();
|
||||
signalModify.emit(m_data);
|
||||
} else if(_msg.getMessage() == ewolEventEntryCopy) {
|
||||
copySelectionToClipBoard(ewol::context::clipBoard::clipboardStd);
|
||||
} else if(_msg.getMessage() == ewolEventEntryPaste) {
|
||||
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd);
|
||||
} else if(_msg.getMessage() == ewolEventEntrySelect) {
|
||||
if(_msg.getData() == "ALL") {
|
||||
m_displayCursorPosSelection = 0;
|
||||
m_displayCursorPos = m_data->size();
|
||||
} else {
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::markToUpdateTextPosition() {
|
||||
|
@ -166,7 +166,6 @@ namespace ewol {
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
|
||||
virtual void calculateMinMaxSize();
|
||||
protected: // Derived function
|
||||
@ -178,6 +177,11 @@ namespace ewol {
|
||||
virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
|
||||
private: // callback functions
|
||||
void onCallbackShortCut(const std::string& _value);
|
||||
void onCallbackEntryClean();
|
||||
void onCallbackCut();
|
||||
void onCallbackCopy();
|
||||
void onCallbackPaste();
|
||||
void onCallbackSelect(bool _all);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -173,7 +173,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
|
||||
}
|
||||
}
|
||||
if (_typeEvent == ewol::key::statusSingle) {
|
||||
EWOL_DEBUG("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
EWOL_VERBOSE("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
if (1 == _IdInput) {
|
||||
int32_t previousRaw = m_selectedLine;
|
||||
if (_raw > (int32_t)m_list.size()+offset ) {
|
||||
|
@ -235,9 +235,3 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::Menu::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
/*
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,8 +55,6 @@ namespace ewol {
|
||||
int32_t addTitle(std::string _label, std::string _image="", const std::string _message = "");
|
||||
int32_t add(int32_t _parent, std::string _label, std::string _image="", const std::string _message = "");
|
||||
void addSpacer();
|
||||
// Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
private:
|
||||
void onButtonPressed(std::weak_ptr<ewol::widget::Button> _button);
|
||||
};
|
||||
|
@ -109,33 +109,6 @@ etk::Color<> ewol::widget::ColorChooser::getColor() {
|
||||
return m_currentColor;
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::ColorChooser::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
//EWOL_INFO("Receive Extern Event ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" == > data=\"" << data << "\"" );
|
||||
if (eventColorBarHasChange == _msg.getMessage()) {
|
||||
// == > colorBar has change ...
|
||||
uint8_t tmpAlpha = m_currentColor.a();
|
||||
// the colorbar has no notion of the alpha == > keep it ...
|
||||
if (nullptr != m_widgetColorBar) {
|
||||
m_currentColor = m_widgetColorBar->getCurrentColor();
|
||||
}
|
||||
m_currentColor.setA(tmpAlpha);
|
||||
if (nullptr != m_widgetRed) {
|
||||
m_widgetRed->setValue(m_currentColor.r());
|
||||
}
|
||||
if (nullptr != m_widgetGreen) {
|
||||
m_widgetGreen->setValue(m_currentColor.g());
|
||||
}
|
||||
if (nullptr != m_widgetBlue) {
|
||||
m_widgetBlue->setValue(m_currentColor.b());
|
||||
}
|
||||
if (nullptr != m_widgetAlpha) {
|
||||
m_widgetAlpha->setValue(m_currentColor.a());
|
||||
}
|
||||
signalChange.emit(m_currentColor);
|
||||
}
|
||||
};
|
||||
|
||||
void ewol::widget::ColorChooser::onCallbackColorChangeRed(const int32_t& _newColor) {
|
||||
m_currentColor.setR(_newColor);
|
||||
if (nullptr != m_widgetColorBar) {
|
||||
@ -166,8 +139,21 @@ void ewol::widget::ColorChooser::onCallbackColorChangeAlpha(const int32_t& _newC
|
||||
}
|
||||
void ewol::widget::ColorChooser::onCallbackColorChange(const etk::Color<>& _newColor) {
|
||||
m_currentColor = _newColor;
|
||||
if (nullptr != m_widgetColorBar) {
|
||||
m_widgetColorBar->setCurrentColor(m_currentColor);
|
||||
// == > colorBar has change ...
|
||||
uint8_t tmpAlpha = m_currentColor.a();
|
||||
m_currentColor = _newColor;
|
||||
m_currentColor.setA(tmpAlpha);
|
||||
if (nullptr != m_widgetRed) {
|
||||
m_widgetRed->setValue(m_currentColor.r());
|
||||
}
|
||||
if (nullptr != m_widgetGreen) {
|
||||
m_widgetGreen->setValue(m_currentColor.g());
|
||||
}
|
||||
if (nullptr != m_widgetBlue) {
|
||||
m_widgetBlue->setValue(m_currentColor.b());
|
||||
}
|
||||
if (nullptr != m_widgetAlpha) {
|
||||
m_widgetAlpha->setValue(m_currentColor.a());
|
||||
}
|
||||
signalChange.emit(m_currentColor);
|
||||
}
|
@ -35,8 +35,6 @@ namespace ewol {
|
||||
public:
|
||||
DECLARE_WIDGET_FACTORY(ColorChooser, "ColorChooser");
|
||||
virtual ~ColorChooser();
|
||||
public: // Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
public:
|
||||
void setColor(etk::Color<> _newColor);
|
||||
etk::Color<> getColor();
|
||||
|
@ -183,24 +183,27 @@ void ewol::widget::FileChooser::onCallbackListFolderSelectChange(const std::stri
|
||||
|
||||
void ewol::widget::FileChooser::onCallbackListFileSelectChange(const std::string& _value) {
|
||||
setFileName(_value);
|
||||
/*
|
||||
std::string tmpFileCompleatName = m_folder;
|
||||
tmpFileCompleatName += m_file;
|
||||
// TODO : generateEventId(_msg.getMessage(), tmpFileCompleatName);
|
||||
*/
|
||||
}
|
||||
|
||||
void ewol::widget::FileChooser::onCallbackListFileValidate(const std::string& _value) {
|
||||
// select the file == > generate a validate
|
||||
setFileName(_value);
|
||||
EWOL_VERBOSE(" generate a fiel opening : \"" << m_folder << "\" / \"" << m_file << "\"");
|
||||
EWOL_VERBOSE(" generate a fiel opening : '" << m_folder << "' / '" << m_file << "'");
|
||||
signalValidate.emit(getCompleateFileName());
|
||||
autoDestroy();
|
||||
}
|
||||
|
||||
void ewol::widget::FileChooser::onCallbackListValidate() {
|
||||
if (m_file != "" ) {
|
||||
if (m_file == "" ) {
|
||||
EWOL_WARNING(" Validate : '" << m_folder << "' / '" << m_file << "' ==> error No name ...");
|
||||
return;
|
||||
}
|
||||
EWOL_VERBOSE(" generate a fiel opening : \"" << m_folder << "\" / \"" << m_file << "\"");
|
||||
EWOL_DEBUG(" generate a file opening : '" << m_folder << "' / '" << m_file << "'");
|
||||
signalValidate.emit(getCompleateFileName());
|
||||
autoDestroy();
|
||||
}
|
||||
|
@ -24,21 +24,19 @@ namespace ewol {
|
||||
* Fist global static declaration and inclusion:
|
||||
* [code style=c++]
|
||||
* #include <ewol/widget/meta/FileChooser.h>
|
||||
* static const char* const g_eventOpenFile = "appl-local-event-open-file";
|
||||
* static const char* const g_eventClosePopUp = "appl-local-event-close-pop-up";
|
||||
* [/code]
|
||||
*
|
||||
* The first step is to create the file chooser pop-up :
|
||||
* The first step is to create the file chooser pop-up : (never in the constructor!!!)
|
||||
* [code style=c++]
|
||||
* std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::object::makeShared(new ewol::Widget::FileChooser());
|
||||
* std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::Widget::FileChooser::create();
|
||||
* if (tmpWidget == nullptr) {
|
||||
* APPL_ERROR("Can not open File chooser !!! ");
|
||||
* return -1;
|
||||
* }
|
||||
* // register on the Validate event:
|
||||
* tmpWidget->registerOnEvent(this, "validate", g_eventOpenFile);
|
||||
* tmpWidget->signalValidate.bind(shared_from_this(), &****::onCallbackOpenFile);
|
||||
* // no need of this event watching ...
|
||||
* tmpWidget->registerOnEvent(this, "cancel", g_eventClosePopUp);
|
||||
* tmpWidget->signalCancel.bind(shared_from_this(), &****::onCallbackClosePopUp);
|
||||
* // set the title:
|
||||
* tmpWidget->setTitle("Open files ...");
|
||||
* // Set the validate Label:
|
||||
@ -46,7 +44,7 @@ namespace ewol {
|
||||
* // simply set a folder (by default this is the home folder)
|
||||
* //tmpWidget->setFolder("/home/me");
|
||||
* // add the widget as windows pop-up ...
|
||||
* ewol::widget::Windows* tmpWindows = getWindows();
|
||||
* std::shared_ptr<ewol::widget::Windows> tmpWindows = getWindows();
|
||||
* if (tmpWindows == nullptr) {
|
||||
* APPL_ERROR("Can not get the current windows !!! ");
|
||||
* return -1;
|
||||
@ -57,17 +55,11 @@ namespace ewol {
|
||||
* Now we just need to wait the the open event message.
|
||||
*
|
||||
* [code style=c++]
|
||||
* void ********::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
* APPL_DEBUG("Receive Message: " << _msg );
|
||||
* if (_msg.getMessage() == g_eventOpenFile) {
|
||||
* APPL_INFO("Request open file : '" << _msg.getData() << "'");
|
||||
* return;
|
||||
* }
|
||||
* if (_msg.getMessage() == g_eventClosePopUp) {
|
||||
* APPL_INFO("The File chooser has been closed");
|
||||
* // generaly nothing to do ...
|
||||
* return;
|
||||
* }
|
||||
* void ****::onCallbackOpenFile(const std::string& _value) {
|
||||
* APPL_INFO("Request open file : '" << _value << "'");
|
||||
* }
|
||||
* void ****::onCallbackClosePopUp() {
|
||||
* APPL_INFO("The File chooser has been closed");
|
||||
* }
|
||||
* [/code]
|
||||
* This is the best example of a Meta-widget.
|
||||
|
Loading…
x
Reference in New Issue
Block a user