[DEBUG] when remove a pop up composer, the composer widget is not removed ... add property to do it

This commit is contained in:
Edouard DUPIN 2016-03-15 21:38:55 +01:00
parent c2b77dea53
commit 7bddada9b8
2 changed files with 14 additions and 1 deletions

View File

@ -16,7 +16,8 @@
#undef __class__ #undef __class__
#define __class__ "ewol::widget::Composer" #define __class__ "ewol::widget::Composer"
ewol::widget::Composer::Composer() { ewol::widget::Composer::Composer() :
propertyRemoveIfUnderRemove(this, "remove-if-under-remove", true, "Demand the remove iof the widget if the subObject demand a remove") {
addObjectType("ewol::widget::Composer"); addObjectType("ewol::widget::Composer");
// nothing to do ... // nothing to do ...
} }
@ -129,3 +130,11 @@ bool ewol::widget::Composer::loadFromString(const std::string& _composerXmlStrin
requestUpdateSize(); requestUpdateSize();
return true; return true;
} }
void ewol::widget::Composer::requestDestroyFromChild(const ewol::ObjectShared& _child) {
ewol::widget::Container::requestDestroyFromChild(_child);
if (*propertyRemoveIfUnderRemove == true) {
EWOL_DEBUG("Child widget remove ==> auto-remove");
autoDestroy();
}
}

View File

@ -21,6 +21,8 @@ namespace ewol {
* @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree * @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
*/ */
class Composer : public ewol::widget::Container { class Composer : public ewol::widget::Container {
public:
eproperty::Value<bool> propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
@ -46,6 +48,8 @@ namespace ewol {
* @return false == > some error occured * @return false == > some error occured
*/ */
bool loadFromString(const std::string& _composerXmlString); bool loadFromString(const std::string& _composerXmlString);
private:
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
}; };
ewol::WidgetShared composerGenerateString(const std::string& _data = ""); ewol::WidgetShared composerGenerateString(const std::string& _data = "");
ewol::WidgetShared composerGenerateFile(const std::string& _data = ""); ewol::WidgetShared composerGenerateFile(const std::string& _data = "");