[DEV] change the message data between widget to the const data

This commit is contained in:
Edouard DUPIN 2013-03-22 23:06:41 +01:00
parent 1c5b6159cc
commit 9a18f605d9
19 changed files with 38 additions and 36 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 3d4b4123b758fa2ae9421041503e86b56f599826 Subproject commit 3b6cd4880c0273e48092b5e0bdf493577a054f60

View File

@ -74,7 +74,7 @@ static void MultiCastRm(ewol::EObject* object)
} }
} }
static void MultiCastSend(ewol::EObject* object, const char* const message, etk::UString& data) static void MultiCastSend(ewol::EObject* object, const char* const message, const etk::UString& data)
{ {
EWOL_VERBOSE("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :"); EWOL_VERBOSE("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :");
@ -92,7 +92,7 @@ static void MultiCastSend(ewol::EObject* object, const char* const message, etk:
} }
} }
void ewol::EObjectMessageMultiCast::AnonymousSend(const char* const messageId, etk::UString& data) void ewol::EObjectMessageMultiCast::AnonymousSend(const char* const messageId, const etk::UString& data)
{ {
MultiCastSend(NULL, messageId, data); MultiCastSend(NULL, messageId, data);
} }
@ -148,7 +148,7 @@ void ewol::EObject::AddEventId(const char * generateEventId)
} }
void ewol::EObject::GenerateEventId(const char * generateEventId, const etk::UString data) void ewol::EObject::GenerateEventId(const char * generateEventId, const etk::UString& data)
{ {
// for every element registered ... // for every element registered ...
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) { for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
@ -164,7 +164,7 @@ void ewol::EObject::GenerateEventId(const char * generateEventId, const etk::USt
} }
void ewol::EObject::SendMultiCast(const char* const messageId, etk::UString data) void ewol::EObject::SendMultiCast(const char* const messageId, const etk::UString& data)
{ {
MultiCastSend(this, messageId, data); MultiCastSend(this, messageId, data);
} }

View File

@ -15,9 +15,9 @@
namespace ewol { namespace ewol {
namespace EObjectMessageMultiCast { namespace EObjectMessageMultiCast {
void Init( void); void Init(void);
void UnInit(void); void UnInit(void);
void AnonymousSend(const char* const messageId, etk::UString& data); void AnonymousSend(const char* const messageId, const etk::UString& data);
}; };
class EObject; class EObject;
@ -26,9 +26,9 @@ namespace ewol {
*/ */
class EventExtGen { class EventExtGen {
public: public:
const char* localEventId; //!< local event Id generation const char* localEventId; //!< local event Id generation
ewol::EObject* destEObject; //!< destination widget that might be call ewol::EObject* destEObject; //!< destination widget that might be call
const char* destEventId; //!< Generated event ID on the distant widget const char* destEventId; //!< Generated event ID on the distant widget
}; };
/** /**
@ -38,9 +38,9 @@ namespace ewol {
*/ */
class EObject { class EObject {
private: private:
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed
etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -87,7 +87,7 @@ namespace ewol {
* @param[in] data data associated with the event * @param[in] data data associated with the event
* @return --- * @return ---
*/ */
void GenerateEventId(const char * generateEventId, const etk::UString data = ""); void GenerateEventId(const char * generateEventId, const etk::UString& data = "");
/** /**
* @brief Generate Multicast event on all EObject requested the event * @brief Generate Multicast event on all EObject requested the event
@ -95,7 +95,7 @@ namespace ewol {
* @param[in] data String that is send at all the destinations * @param[in] data String that is send at all the destinations
* @return --- * @return ---
*/ */
void SendMultiCast(const char* const messageId, etk::UString data = ""); void SendMultiCast(const char* const messageId, const etk::UString& data = "");
/** /**
* @brief Register of the arrival of a Multicast message * @brief Register of the arrival of a Multicast message
@ -128,7 +128,7 @@ namespace ewol {
* @param[in] data Data registered by this class * @param[in] data Data registered by this class
* @return --- * @return ---
*/ */
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) { }; virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) { };
}; };
}; };

View File

@ -280,7 +280,8 @@ void guiInterface::SetTitle(etk::UString& title)
{ {
X11_INFO("X11: Set Title (START)"); X11_INFO("X11: Set Title (START)");
XTextProperty tp; XTextProperty tp;
tp.value = (unsigned char *)title.c_str(); etk::Char tmpChar = title.c_str();
tp.value = (unsigned char *)((const char*)tmpChar);
tp.encoding = XA_WM_NAME; tp.encoding = XA_WM_NAME;
tp.format = 8; tp.format = 8;
tp.nitems = strlen((const char*)tp.value); tp.nitems = strlen((const char*)tp.value);

View File

@ -11,14 +11,14 @@
#include <ewol/renderer/resources/ConfigFile.h> #include <ewol/renderer/resources/ConfigFile.h>
void ewol::SimpleConfigElement::Parse(etk::UString value) void ewol::SimpleConfigElement::Parse(const etk::UString& value)
{ {
char* tmp = value.c_str(); etk::Char tmp = value.c_str();
m_valueInt = 0; m_valueInt = 0;
m_valuefloat = 0; m_valuefloat = 0;
sscanf(tmp, "%d", &m_valueInt); sscanf(tmp, "%d", &m_valueInt);
sscanf(tmp, "%f", &m_valuefloat); sscanf(tmp, "%f", &m_valuefloat);
m_value = tmp; m_value = value;
} }

View File

@ -24,13 +24,13 @@ namespace ewol
int32_t m_valueInt; int32_t m_valueInt;
float m_valuefloat; float m_valuefloat;
public: public:
SimpleConfigElement(etk::UString name) : SimpleConfigElement(const etk::UString& name) :
m_paramName(name), m_paramName(name),
m_value(""), m_value(""),
m_valueInt(0), m_valueInt(0),
m_valuefloat(0.0) { }; m_valuefloat(0.0) { };
~SimpleConfigElement(void) { }; ~SimpleConfigElement(void) { };
void Parse(etk::UString value); void Parse(const etk::UString& value);
int32_t GetInteger(void) { return m_valueInt; }; int32_t GetInteger(void) { return m_valueInt; };
float GetFloat(void) { return m_valuefloat; }; float GetFloat(void) { return m_valuefloat; };
etk::UString& GetString(void) { return m_value; }; etk::UString& GetString(void) { return m_value; };

View File

@ -69,8 +69,9 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
int32_t tmpSize = 0; int32_t tmpSize = 0;
// extarct name and size : // extarct name and size :
char * tmpData = fontName.c_str(); etk::Char tmpChar = fontName.c_str();
char * tmpPos = strchr(tmpData, ':'); const char * tmpData = tmpChar;
const char * tmpPos = strchr(tmpData, ':');
if (tmpPos==NULL) { if (tmpPos==NULL) {
m_size = 1; m_size = 1;

View File

@ -219,7 +219,7 @@ draw::Color widget::ButtonColor::GetValue(void)
} }
void widget::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void widget::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{ {
EWOL_INFO("Receive MSG : \"" << eventId << "\" ==> data=\"" << data << "\"" ); EWOL_INFO("Receive MSG : \"" << eventId << "\" ==> data=\"" << data << "\"" );
if (eventId == ewolEventColorChooserChange) { if (eventId == ewolEventColorChooserChange) {

View File

@ -70,7 +70,7 @@ namespace widget {
// Derived function // Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
private: private:
/** /**
* @brief Internal system to Change the property of the current status * @brief Internal system to Change the property of the current status

View File

@ -413,7 +413,7 @@ void widget::Entry::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboar
} }
void widget::Entry::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void widget::Entry::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{ {
ewol::Widget::OnReceiveMessage(CallerObject, eventId, data); ewol::Widget::OnReceiveMessage(CallerObject, eventId, data);
if(eventId == ewolEventEntryClean) { if(eventId == ewolEventEntryClean) {

View File

@ -74,7 +74,7 @@ namespace widget {
// Derived function // Derived function
virtual bool OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent); virtual bool OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent);
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
// Derived function // Derived function
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID); virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
protected: protected:

View File

@ -105,7 +105,7 @@ void widget::Menu::AddSpacer(void)
} }
void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{ {
/* /*
if (true == ewol::SizerHori::OnReceiveMessage(CallerObject, eventId, data)) { if (true == ewol::SizerHori::OnReceiveMessage(CallerObject, eventId, data)) {

View File

@ -51,7 +51,7 @@ namespace widget {
int32_t Add(int32_t parent, etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = ""); int32_t Add(int32_t parent, etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
void AddSpacer(void); void AddSpacer(void);
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
}; };

View File

@ -130,7 +130,7 @@ draw::Color widget::ColorChooser::GetColor(void)
} }
void widget::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void widget::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{ {
if (NULL == CallerObject) { if (NULL == CallerObject) {
return; return;

View File

@ -30,7 +30,7 @@ namespace widget {
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "widget::ColorChooser"; }; virtual const char * const GetObjectType(void) { return "widget::ColorChooser"; };
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);

View File

@ -317,7 +317,7 @@ void widget::FileChooser::SetFileName(etk::UString filename)
* @param[in] data Data registered by this class * @param[in] data Data registered by this class
* @return --- * @return ---
*/ */
void widget::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void widget::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{ {
EWOL_INFO("Receive Event from the LIST ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" ); EWOL_INFO("Receive Event from the LIST ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" );
if (ewolEventFileChooserEntryFolder == eventId) { if (ewolEventFileChooserEntryFolder == eventId) {

View File

@ -30,7 +30,7 @@ namespace widget {
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolFileChooser"; }; virtual const char * const GetObjectType(void) { return "EwolFileChooser"; };
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
void SetTitle(etk::UString label); void SetTitle(etk::UString label);

View File

@ -168,7 +168,7 @@ void widget::Parameter::SetTitle(etk::UString label)
} }
void widget::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void widget::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{ {
widget::PopUp::OnReceiveMessage(CallerObject, eventId, data); widget::PopUp::OnReceiveMessage(CallerObject, eventId, data);
EWOL_DEBUG("event on the parameter : " << eventId << " data=\"" << data << "\""); EWOL_DEBUG("event on the parameter : " << eventId << " data=\"" << data << "\"");

View File

@ -31,7 +31,7 @@ namespace widget {
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolParameter"; }; virtual const char * const GetObjectType(void) { return "EwolParameter"; };
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);