[DEV] add an api to add event of other widget than the composer itself

This commit is contained in:
Edouard DUPIN 2013-05-25 10:56:21 +02:00
parent e0cd309140
commit 31b6134640
2 changed files with 25 additions and 1 deletions

View File

@ -107,11 +107,20 @@ void widget::Composer::RegisterOnEventNameWidget(const etk::UString& _subWidgetN
const char * _eventId,
const char * _eventIdgenerated,
const etk::UString& _overloadData)
{
RegisterOnEventNameWidget(this, _subWidgetName, _eventId, _eventIdgenerated, _overloadData);
}
void widget::Composer::RegisterOnEventNameWidget(ewol::EObject * _destinationObject,
const etk::UString& _subWidgetName,
const char * _eventId,
const char * _eventIdgenerated,
const etk::UString& _overloadData)
{
ewol::Widget* tmpWidget = GetWidgetNamed(_subWidgetName);
if (NULL != tmpWidget) {
//EWOL_DEBUG("Find widget named : \"" << _subWidgetName << "\" register event=\"" << _eventId << "\"");
tmpWidget->RegisterOnEvent(this, _eventId, _eventIdgenerated, _overloadData);
tmpWidget->RegisterOnEvent(_destinationObject, _eventId, _eventIdgenerated, _overloadData);
} else {
EWOL_WARNING("[" << GetId() << "] {" << GetObjectType() << "} Can not register event : \"" << _eventId << "\" the widget named=\"" << _subWidgetName << "\" does not exist");
}

View File

@ -61,11 +61,26 @@ namespace widget
* @param[in] _eventId Event generate inside the object.
* @param[in] _eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...)
* @param[in] _overloadData When the user prever to receive a data specificly for this event ...
* @note : To used when herited from this object.
*/
void RegisterOnEventNameWidget(const etk::UString& _subWidgetName,
const char * _eventId,
const char * _eventIdgenerated = NULL,
const etk::UString& _overloadData="");
/**
* @brief Register an Event an named widget. @see RegisterOnEvent
* @param[in] _destinationObject pointer on the object that might be call when an event is generated
* @param[in] _subWidgetName Name of the subWidget.
* @param[in] _eventId Event generate inside the object.
* @param[in] _eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...)
* @param[in] _overloadData When the user prever to receive a data specificly for this event ...
* @note : To used when NOT herited from this object.
*/
void RegisterOnEventNameWidget(ewol::EObject * _destinationObject,
const etk::UString& _subWidgetName,
const char * _eventId,
const char * _eventIdgenerated = NULL,
const etk::UString& _overloadData="");
private:
/**
* @brief Load a composition with a file.