diff --git a/sources/ewol/eObject/EObjectManager.cpp b/sources/ewol/eObject/EObjectManager.cpp index 5702b33c..0a27ece3 100644 --- a/sources/ewol/eObject/EObjectManager.cpp +++ b/sources/ewol/eObject/EObjectManager.cpp @@ -63,6 +63,12 @@ void informOneObjectIsRemoved(ewol::EObject* object) m_eObjectList[iii]->OnObjectRemove(object); } } + for (int32_t iii=0; iiiOnObjectRemove(object); + } + } // call input event manager to remove linked widget ... eSystem::OnObjectRemove(object); } @@ -82,6 +88,14 @@ void ewol::EObjectManager::Rm(ewol::EObject* object) return; } } + // check if the object has not been auto removed ... or remove in defered time ... + for (int32_t iii=0; iii +#include +#include + + +#undef __class__ +#define __class__ "Gird" + + +widget::Gird::Gird(int32_t colNumber) : + m_tmpWidget(NULL), + m_sizeRow(0), + m_borderSize(0,0) +{ + SetColNumber(colNumber); + ewol::RequestUpdateSize(); +} + +widget::Gird::~Gird(void) +{ + EWOL_DEBUG("[" << GetId() << "]={" << GetObjectType() << "} Gird : destroy"); + SubWidgetRemoveAll(); +} + +void widget::Gird::SetBorderSize(const ivec2& newBorderSize) +{ + m_borderSize = newBorderSize; + if (m_borderSize.x() < 0) { + EWOL_ERROR("Try to set a border size <0 on x : " << m_borderSize.x() << " ==> restore to 0"); + m_borderSize.setX(0); + } + if (m_borderSize.y() < 0) { + EWOL_ERROR("Try to set a border size <0 on y : " << m_borderSize.y() << " ==> restore to 0"); + m_borderSize.setY(0); + } + MarkToRedraw(); + ewol::RequestUpdateSize(); +} + +bool widget::Gird::CalculateSize(float availlableX, float availlableY) +{ + //EWOL_DEBUG("Update Size"); + m_size.setValue(availlableX, availlableY); + m_size -= m_borderSize*2; + // calculate unExpendable Size : + float unexpendableSize=0.0; + int32_t nbWidgetFixedSize=0; + int32_t nbWidgetNotFixedSize=0; + + for (int32_t iii=0; iii0) { + m_minSize.setX(m_userMinSize.x()); + } + if (m_userMinSize.y()>0) { + m_minSize.setY(m_userMinSize.y()); + } + m_uniformSizeRow = 0; + m_minSize += m_borderSize*2; + int32_t lastLineID = 0; + for (int32_t iii=0; iii lastLineID) { + // change of line : + lastLineID = m_subWidget[iii].row; + } + if (NULL != m_subWidget[iii].widget) { + m_subWidget[iii].widget->CalculateMinSize(); + vec2 tmpSize = m_subWidget[iii].widget->GetMinSize(); + EWOL_DEBUG(" [" << iii << "] subWidgetMinSize=" << tmpSize); + // for all we get the max Size : + m_uniformSizeRow = etk_max(tmpSize.y(), m_uniformSizeRow); + // for the colomn size : We set the autamatic value in negative : + if (m_sizeCol[m_subWidget[iii].col] <= 0) { + m_sizeCol[m_subWidget[iii].col] = etk_min(m_sizeCol[m_subWidget[iii].col], -tmpSize.x() ); + } + } + } + + if (m_sizeRow > 0) { + m_uniformSizeRow = m_sizeRow; + } + int32_t tmpSizeWidth = 0; + for (int32_t iii=0; iii it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + m_subWidget[iii].widget = NULL; + } + } else { + EWOL_WARNING("[" << GetId() << "] Must not have null pointer on the subWidget list ..."); + m_subWidget.Erase(iii); + } + errorControl = m_subWidget.Size(); + } + } + // just add the col size: + m_sizeCol.Erase(m_sizeCol.Size()-1, 0x7FFFFFFF); + } else { + // just add the col size: + for (int32_t iii=m_sizeCol.Size()-1; iii colId) { + m_sizeCol[colId] = size; + } else { + EWOL_ERROR("Can not set the Colomn size : " << colId+1 << " at " << size << "px we have "<< m_sizeCol.Size() << " colomn"); + } +} + +void widget::Gird::SetRowSize(int32_t size) +{ + m_sizeRow = size; +} + +int32_t widget::Gird::GetColSize(int32_t colId) +{ + if (m_sizeCol.Size() > colId) { + if (m_sizeCol[colId] <= 0) { + return 0; + } + return m_sizeCol[colId]; + } + EWOL_ERROR("Can not get the Colomn size : " << colId+1 << " we have "<< m_sizeCol.Size() << " colomn"); + return 0; +} + +int32_t widget::Gird::GetRowSize(void) +{ + return m_sizeRow; +} + +void widget::Gird::SubWidgetRemoveAll(void) +{ + int32_t errorControl = m_subWidget.Size(); + // the size automaticly decrement with the auto call of the OnObjectRemove function + while (m_subWidget.Size() > 0 ) { + if (NULL != m_subWidget[0].widget) { + delete(m_subWidget[0].widget); + // no remove, this element is removed with the function OnObjectRemove ==> it does not exist anymore ... + if (errorControl == m_subWidget.Size()) { + EWOL_CRITICAL("[" << GetId() << "] The number of element might have been reduced ... ==> it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + m_subWidget[0].widget = NULL; + } + } else { + EWOL_WARNING("[" << GetId() << "] Must not have null pointer on the subWidget list ..."); + m_subWidget.Erase(0); + } + errorControl = m_subWidget.Size(); + } + m_subWidget.Clear(); +} + + +void widget::Gird::SubWidgetAdd(int32_t colId, int32_t rowId, ewol::Widget* newWidget) +{ + if (NULL == newWidget) { + return; + } + GirdProperties prop; + prop.row = rowId; + prop.col = colId; + prop.widget = newWidget; + + // need to find the correct position : + for (int32_t iii=0; iii prop.row) { + // find a new position; + m_subWidget.Insert(iii, prop); + return; + } else { + if (m_subWidget[iii].col < prop.col) { + continue; + } else if (m_subWidget[iii].col > prop.col) { + // find a new position; + m_subWidget.Insert(iii, prop); + return; + } else { + // The element already exist ==> replace it ... + m_tmpWidget = m_subWidget[iii].widget; + m_subWidget[iii].widget = newWidget; + if (NULL != m_tmpWidget) { + delete(m_tmpWidget); + if (m_tmpWidget != NULL) { + EWOL_CRITICAL("[" << GetId() << "] Error while replacing a widget ... ==> never call when free"); + m_tmpWidget = NULL; + } + } + } + } + } + // not find ==> just adding it ... + m_subWidget.PushBack(prop); +} + +void widget::Gird::SubWidgetRemove(ewol::Widget* newWidget) +{ + if (NULL == newWidget) { + return; + } + int32_t errorControl = m_subWidget.Size(); + for (int32_t iii=0; iii it does not exist anymore ... + if (errorControl == m_subWidget.Size()) { + EWOL_CRITICAL("[" << GetId() << "] The number of element might have been reduced ... ==> it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + m_subWidget[iii].widget = NULL; + m_subWidget.Erase(iii); + } + return; + } + } + EWOL_WARNING("[" << GetId() << "] Can not remove unExistant widget"); +} + +void widget::Gird::SubWidgetRemove(int32_t colId, int32_t rowId) +{ + if (colId<0 || rowId<0) { + EWOL_WARNING("[" << GetId() << "] try to remove widget with id < 0 col=" << colId << " row=" << rowId); + return; + } + int32_t errorControl = m_subWidget.Size(); + // try to find it ... + for (int32_t iii=0; iii replace it ... + if (NULL != m_subWidget[iii].widget) { + delete(m_subWidget[iii].widget); + if (errorControl == m_subWidget.Size()) { + EWOL_CRITICAL("[" << GetId() << "] The number of element might have been reduced ... ==> it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + m_subWidget[iii].widget = NULL; + m_subWidget.Erase(iii); + } + } + } + return; + } + } + EWOL_WARNING("[" << GetId() << "] Can not remove unExistant widget"); +} + +void widget::Gird::SubWidgetUnLink(ewol::Widget* newWidget) +{ + if (NULL == newWidget) { + return; + } + for (int32_t iii=0; iiiGenDraw(displayProp); + } + } +} + +void widget::Gird::OnRegenerateDisplay(void) +{ + // TODO : Only display the Widget inside the view ... + for (int32_t iii=0; iiiOnRegenerateDisplay(); + } + } +} + +ewol::Widget * widget::Gird::GetWidgetAtPos(vec2 pos) +{ + if (true == IsHide()) { + return NULL; + } + // for all element in the sizer ... + for (int32_t iii=0; iiiGetSize(); + vec2 tmpOrigin = m_subWidget[iii].widget->GetOrigin(); + if( (tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) + && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y()) ) + { + ewol::Widget * tmpWidget = m_subWidget[iii].widget->GetWidgetAtPos(pos); + if (NULL != tmpWidget) { + return tmpWidget; + } + // stop searching + break; + } + } + } + return NULL; +} + +void widget::Gird::OnObjectRemove(ewol::EObject * removeObject) +{ + // First step call parrent : + ewol::Widget::OnObjectRemove(removeObject); + // second step find if in all the elements ... + for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) { + if(m_subWidget[iii].widget == removeObject) { + EWOL_VERBOSE("[" << GetId() << "]={" << GetObjectType() << "} Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object"); + m_subWidget[iii].widget = NULL; + m_subWidget.Erase(iii); + } + } + if (m_tmpWidget == removeObject) { + m_tmpWidget = NULL; + } +} diff --git a/sources/ewol/widget/Gird.h b/sources/ewol/widget/Gird.h new file mode 100644 index 00000000..98ea3cf5 --- /dev/null +++ b/sources/ewol/widget/Gird.h @@ -0,0 +1,128 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_WIDGET_GIRD_H__ +#define __EWOL_WIDGET_GIRD_H__ + +#include +#include +#include +#include + +namespace widget { + class Gird :public ewol::Widget + { + private: + class GirdProperties { + public: + ewol::Widget* widget; + int32_t row; + int32_t col; + }; + int32_t m_sizeRow; //!< size of all Lines (row) (if set (otherwise 0)) ==> we have a only one size ==> multiple size will have no use ... + int32_t m_uniformSizeRow; + etk::Vector m_sizeCol; //!< size of all colomn (if set (otherwise 0)) + etk::Vector m_subWidget; //!< all sub widget are contained in this element + ewol::Widget* m_tmpWidget; //!< use when replace a widget ... + public: + /** + * @brief Constructor + */ + Gird(int32_t colNumber=1); + /** + * @brief Desstructor + */ + virtual ~Gird(void); + /** + * @brief Set the number of colomn + * @param[in] colNumber Nuber of colomn + */ + void SetColNumber(int32_t colNumber); + /** + * @brief Change a size view of a colomn. + * @param[in] colId Id of the colomn [0..x]. + * @param[in] size Size of the colomn. + */ + void SetColSize(int32_t colId, int32_t size); + /** + * @brief Change a size view of a Line. + * @param[in] size Size of the line. + */ + void SetRowSize(int32_t size); + /** + * @brief Get the size view of a colomn. + * @param[in] colId Id of the colomn [0..x]. + * @return The size of the colomn. + */ + int32_t GetColSize(int32_t colId); + /** + * @brief Get the size view of the Lines. + * @return The size of the lines. + */ + int32_t GetRowSize(void); + public: + /** + * @brief Remove all sub element from the widget. + */ + virtual void SubWidgetRemoveAll(void); + /** + * @brief Add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right) + * @param[in] colId Id of the colomn [0..x]. + * @param[in] rowId Id of the row [0..y]. + * @param[in] newWidget the element pointer + */ + virtual void SubWidgetAdd(int32_t colId, int32_t rowId, ewol::Widget* newWidget); + /** + * @brief Remove definitly a widget from the system and this Gird. + * @param[in] newWidget the element pointer. + */ + virtual void SubWidgetRemove(ewol::Widget* newWidget); + /** + * @brief Remove definitly a widget from the system and this Gird. + * @param[in] colId Id of the colomn [0..x]. + * @param[in] rowId Id of the row [0..y]. + */ + virtual void SubWidgetRemove(int32_t colId, int32_t rowId); + /** + * @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). + * @param[in] newWidget the element pointer. + */ + virtual void SubWidgetUnLink(ewol::Widget* newWidget); + /** + * @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). + * @param[in] colId Id of the colomn [0..x]. + * @param[in] rowId Id of the row [0..y]. + */ + virtual void SubWidgetUnLink(int32_t colId, int32_t rowId); + private: + ivec2 m_borderSize; //!< Border size needed for all the display + public: + /** + * @brief Set the current border size of the current element: + * @param[in] newBorderSize The border size to set (0 if not used) + */ + void SetBorderSize(const ivec2& newBorderSize); + /** + * @brief Get the current border size of the current element: + * @return the border size (0 if not used) + */ + const ivec2& GetBorderSize(void) { return m_borderSize; }; + protected: // Derived function + virtual void OnDraw(ewol::DrawProperty& displayProp); + public: // Derived function + virtual void OnRegenerateDisplay(void); + virtual ewol::Widget* GetWidgetAtPos(vec2 pos); + virtual void OnObjectRemove(ewol::EObject* removeObject); + virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; }; + virtual bool CalculateSize(float availlableX, float availlableY); + virtual bool CalculateMinSize(void); + }; + +}; + +#endif diff --git a/sources/ewol/widget/Label.h b/sources/ewol/widget/Label.h index 01922518..1fa62813 100644 --- a/sources/ewol/widget/Label.h +++ b/sources/ewol/widget/Label.h @@ -43,7 +43,7 @@ namespace widget { */ etk::UString GetLabel(void); // Derived function - virtual const char * const GetObjectType(void) { return "EwolLabel"; }; + virtual const char * const GetObjectType(void) { return "Ewol::Label"; }; // Derived function virtual bool CalculateMinSize(void); // Derived function diff --git a/sources/ewol/widget/Layer.cpp b/sources/ewol/widget/Layer.cpp index 19fb4093..3d29d113 100644 --- a/sources/ewol/widget/Layer.cpp +++ b/sources/ewol/widget/Layer.cpp @@ -22,6 +22,7 @@ widget::Layer::Layer(void) widget::Layer::~Layer(void) { + EWOL_DEBUG("[" << GetId() << "] Layer : destroy"); SubWidgetRemoveAll(); } @@ -207,7 +208,7 @@ void widget::Layer::OnObjectRemove(ewol::EObject * removeObject) // second step find if in all the elements ... for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) { if(m_subWidget[iii] == removeObject) { - EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); + EWOL_DEBUG("Remove layer sub Element [" << iii << "] ==> destroyed object"); m_subWidget[iii] = NULL; m_subWidget.Erase(iii); } diff --git a/sources/ewol/widget/Layer.h b/sources/ewol/widget/Layer.h index 043543f6..6403f5ac 100644 --- a/sources/ewol/widget/Layer.h +++ b/sources/ewol/widget/Layer.h @@ -23,24 +23,23 @@ namespace widget { virtual const char * const GetObjectType(void) { return "EwolLayer"; }; public: // Derived function - virtual bool CalculateSize(float availlableX, float availlableY); - // Derived function - virtual bool CalculateMinSize(void); - virtual void SetMinSise(float x=-1, float y=-1); - virtual void SetExpendX(bool newExpend=false); - virtual bool CanExpentX(void); - virtual void SetExpendY(bool newExpend=false); - virtual bool CanExpentY(void); - void LockExpendContamination(bool lockExpend=false); + virtual bool CalculateSize(float availlableX, float availlableY); + virtual bool CalculateMinSize(void); + virtual void SetMinSise(float x=-1, float y=-1); + virtual void SetExpendX(bool newExpend=false); + virtual bool CanExpentX(void); + virtual void SetExpendY(bool newExpend=false); + virtual bool CanExpentY(void); + void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; + bool m_lockExpendContamination; etk::Vector m_subWidget; public: - virtual void SubWidgetRemoveAll(void); - virtual void SubWidgetAdd(ewol::Widget* newWidget); - virtual void SubWidgetAddFront(ewol::Widget* newWidget); - virtual void SubWidgetRemove(ewol::Widget* newWidget); - virtual void SubWidgetUnLink(ewol::Widget* newWidget); + virtual void SubWidgetRemoveAll(void); + virtual void SubWidgetAdd(ewol::Widget* newWidget); + virtual void SubWidgetAddFront(ewol::Widget* newWidget); + virtual void SubWidgetRemove(ewol::Widget* newWidget); + virtual void SubWidgetUnLink(ewol::Widget* newWidget); protected: // Derived function virtual void OnDraw(ewol::DrawProperty& displayProp); diff --git a/sources/ewol/widget/List.h b/sources/ewol/widget/List.h index 178dff01..ca760cec 100644 --- a/sources/ewol/widget/List.h +++ b/sources/ewol/widget/List.h @@ -28,8 +28,8 @@ namespace widget { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::Vector m_listOObject; //!< generic element to display... - etk::Vector m_lineSize; + etk::Vector m_listOObject; //!< generic element to display... + etk::Vector m_lineSize; public: void AddOObject(ewol::Compositing* newObject, int32_t pos=-1); void ClearOObjectList(void); @@ -38,10 +38,10 @@ namespace widget { virtual void OnDraw(ewol::DrawProperty& displayProp); // list properties ... private: - int32_t m_paddingSizeX; - int32_t m_paddingSizeY; - int32_t m_displayStartRaw; //!< Current starting diaplayed raw - int32_t m_displayCurrentNbLine; //!< Number of line in the display + int32_t m_paddingSizeX; + int32_t m_paddingSizeY; + int32_t m_displayStartRaw; //!< Current starting diaplayed raw + int32_t m_displayCurrentNbLine; //!< Number of line in the display public: // Derived function virtual void OnRegenerateDisplay(void); diff --git a/sources/ewol/widget/Sizer.cpp b/sources/ewol/widget/Sizer.cpp index 16e90043..26dbed57 100644 --- a/sources/ewol/widget/Sizer.cpp +++ b/sources/ewol/widget/Sizer.cpp @@ -6,6 +6,7 @@ * @license BSD v3 (see license file) */ +#include #include #include @@ -16,20 +17,39 @@ widget::Sizer::Sizer(widget::Sizer::displayMode_te mode): m_mode(mode), - m_lockExpendContamination(false,false) + m_lockExpendContamination(false,false), + m_borderSize(0,0) { } widget::Sizer::~Sizer(void) { + EWOL_DEBUG("[" << GetId() << "]={" << GetObjectType() << "} Sizer : destroy (mode=" << (m_mode==widget::Sizer::modeVert?"Vert":"Hori") << ")"); SubWidgetRemoveAll(); } + +void widget::Sizer::SetBorderSize(const ivec2& newBorderSize) +{ + m_borderSize = newBorderSize; + if (m_borderSize.x() < 0) { + EWOL_ERROR("Try to set a border size <0 on x : " << m_borderSize.x() << " ==> restore to 0"); + m_borderSize.setX(0); + } + if (m_borderSize.y() < 0) { + EWOL_ERROR("Try to set a border size <0 on y : " << m_borderSize.y() << " ==> restore to 0"); + m_borderSize.setY(0); + } + MarkToRedraw(); + ewol::RequestUpdateSize(); +} + void widget::Sizer::SetMode(widget::Sizer::displayMode_te mode) { m_mode = mode; MarkToRedraw(); + ewol::RequestUpdateSize(); } widget::Sizer::displayMode_te widget::Sizer::GetMode(void) @@ -41,6 +61,7 @@ bool widget::Sizer::CalculateSize(float availlableX, float availlableY) { //EWOL_DEBUG("Update Size"); m_size.setValue(availlableX, availlableY); + m_size -= m_borderSize*2; // calculate unExpendable Size : float unexpendableSize=0.0; int32_t nbWidgetFixedSize=0; @@ -78,7 +99,7 @@ bool widget::Sizer::CalculateSize(float availlableX, float availlableY) sizeToAddAtEveryOne=0; } } - vec2 tmpOrigin = m_origin; + vec2 tmpOrigin = m_origin + m_borderSize; for (int32_t iii=0; iiiGetMinSize(); @@ -105,6 +126,7 @@ bool widget::Sizer::CalculateSize(float availlableX, float availlableY) } } } + m_size += m_borderSize*2; MarkToRedraw(); return true; } @@ -115,6 +137,13 @@ bool widget::Sizer::CalculateMinSize(void) //EWOL_DEBUG("Update minimum Size"); m_userExpend.setValue(false, false); m_minSize.setValue(0,0); + if (m_userMinSize.x()>0) { + m_minSize.setX(m_userMinSize.x()); + } + if (m_userMinSize.y()>0) { + m_minSize.setY(m_userMinSize.y()); + } + m_minSize += m_borderSize*2; for (int32_t iii=0; iiiCalculateMinSize(); @@ -146,12 +175,12 @@ bool widget::Sizer::CalculateMinSize(void) void widget::Sizer::SetMinSize(float x, float y) { - EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)"); + EWOL_ERROR("[" << GetId() << "] Sizer can not have a user Minimum size (herited from under elements)"); } void widget::Sizer::SetExpendX(bool newExpend) { - EWOL_ERROR("Sizer can not have a user expend settings X (herited from under elements)"); + EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings X (herited from under elements)"); } bool widget::Sizer::CanExpentX(void) @@ -164,7 +193,7 @@ bool widget::Sizer::CanExpentX(void) void widget::Sizer::SetExpendY(bool newExpend) { - EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)"); + EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings Y (herited from under elements)"); } bool widget::Sizer::CanExpentY(void) @@ -190,12 +219,21 @@ void widget::Sizer::LockExpendContaminationHori(bool lockExpend) void widget::Sizer::SubWidgetRemoveAll(void) { + int32_t errorControl = m_subWidget.Size(); // the size automaticly decrement with the auto call of the OnObjectRemove function while (m_subWidget.Size() > 0 ) { if (NULL != m_subWidget[0]) { delete(m_subWidget[0]); // no remove, this element is removed with the function OnObjectRemove ==> it does not exist anymore ... + if (errorControl == m_subWidget.Size()) { + EWOL_CRITICAL("[" << GetId() << "] The number of element might have been reduced ... ==> it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + m_subWidget[0] = NULL; + } + } else { + EWOL_WARNING("[" << GetId() << "] Must not have null pointer on the subWidget list ..."); + m_subWidget.Erase(0); } + errorControl = m_subWidget.Size(); } m_subWidget.Clear(); } @@ -223,11 +261,16 @@ void widget::Sizer::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } + int32_t errorControl = m_subWidget.Size(); for (int32_t iii=0; iii it does not exist anymore ... + if (errorControl == m_subWidget.Size()) { + EWOL_CRITICAL("[" << GetId() << "] The number of element might have been reduced ... ==> it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + m_subWidget[iii] = NULL; + m_subWidget.Erase(iii); + } return; } } @@ -304,7 +347,7 @@ void widget::Sizer::OnObjectRemove(ewol::EObject * removeObject) // second step find if in all the elements ... for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) { if(m_subWidget[iii] == removeObject) { - EWOL_VERBOSE("Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object"); + EWOL_VERBOSE("[" << GetId() << "]={" << GetObjectType() << "} Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object"); m_subWidget[iii] = NULL; m_subWidget.Erase(iii); } diff --git a/sources/ewol/widget/Sizer.h b/sources/ewol/widget/Sizer.h index eb13060e..33d47b5f 100644 --- a/sources/ewol/widget/Sizer.h +++ b/sources/ewol/widget/Sizer.h @@ -18,8 +18,8 @@ namespace widget { { public: typedef enum { - modeVert, - modeHori, + modeVert, //!< Vertical mode + modeHori, //!< Horizontal mode } displayMode_te; private: etk::Vector m_subWidget; //!< all sub widget are contained in this element @@ -45,7 +45,7 @@ namespace widget { */ displayMode_te GetMode(void); private: - etk::Vector2D m_lockExpendContamination; //!< If some sub-widget request the expend==> this permit to unpropagate the problem + bvec2 m_lockExpendContamination; //!< If some sub-widget request the expend==> this permit to unpropagate the problem public: /** * @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget) @@ -87,31 +87,32 @@ namespace widget { * @param[in] newWidget the element pointer. */ virtual void SubWidgetUnLink(ewol::Widget* newWidget); - protected: - // Derived function - virtual void OnDraw(ewol::DrawProperty& displayProp); + private: + ivec2 m_borderSize; //!< Border size needed for all the display public: - // Derived function + /** + * @brief Set the current border size of the current element: + * @param[in] newBorderSize The border size to set (0 if not used) + */ + void SetBorderSize(const ivec2& newBorderSize); + /** + * @brief Get the current border size of the current element: + * @return the border size (0 if not used) + */ + const ivec2& GetBorderSize(void) { return m_borderSize; }; + protected: // Derived function + virtual void OnDraw(ewol::DrawProperty& displayProp); + public: // Derived function virtual void OnRegenerateDisplay(void); - // Derived function virtual ewol::Widget* GetWidgetAtPos(vec2 pos); - // Derived function virtual void OnObjectRemove(ewol::EObject* removeObject); - // Derived function - virtual const char * const GetObjectType(void) { return "EwolSizerVert"; }; - // Derived function + virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; }; virtual bool CalculateSize(float availlableX, float availlableY); - // Derived function virtual bool CalculateMinSize(void); - // Derived function virtual void SetMinSize(float x=-1, float y=-1); - // Derived function virtual void SetExpendX(bool newExpend=false); - // Derived function virtual bool CanExpentX(void); - // Derived function virtual void SetExpendY(bool newExpend=false); - // Derived function virtual bool CanExpentY(void); }; diff --git a/sources/file.mk b/sources/file.mk index d2673f62..4b920127 100644 --- a/sources/file.mk +++ b/sources/file.mk @@ -58,6 +58,7 @@ FILE_LIST+= ewol/widget/Widget.cpp \ ewol/widget/WidgetManager.cpp \ ewol/widget/Windows.cpp \ ewol/widget/Button.cpp \ + ewol/widget/Gird.cpp \ ewol/widget/Image.cpp \ ewol/widget/ButtonColor.cpp \ ewol/widget/CheckBox.cpp \