Remove the double buffering system ...

This commit is contained in:
Edouard DUPIN 2012-08-10 16:26:48 +02:00
parent de3cff6ad5
commit 665a350fa1
36 changed files with 437 additions and 789 deletions

View File

@ -134,7 +134,7 @@ namespace ewol {
* @param[in,out] listOfEffects Reference on the list where the display must be done for every effects * @param[in,out] listOfEffects Reference on the list where the display must be done for every effects
* @return --- * @return ---
*/ */
virtual void Draw(int32_t currentCreateId) { }; virtual void Draw(void) { };
/** /**
* @brief an element has been remove, just remove reference on it or ID on IT, it can be replace whith an other that have no link * @brief an element has been remove, just remove reference on it or ID on IT, it can be replace whith an other that have no link
* @param[in] idOfElement Id of the element that has been removed * @param[in] idOfElement Id of the element that has been removed

View File

@ -787,10 +787,10 @@ bool ewol::GameElementLua::Process(int64_t time, int32_t deltaTime)
} }
void ewol::GameElementLua::Draw(int32_t currentCreateId) void ewol::GameElementLua::Draw(void)
{ {
tmpObj = this; tmpObj = this;
tmpSprite = &m_sceneElement.animated[currentCreateId]; tmpSprite = &m_sceneElement.animated;
if (NULL != m_luaState) { if (NULL != m_luaState) {
// call the Draw function // call the Draw function
lua_getglobal(m_luaState, "Draw"); lua_getglobal(m_luaState, "Draw");

View File

@ -46,7 +46,7 @@ namespace ewol {
virtual void Init(void); virtual void Init(void);
virtual void UnInit(void); virtual void UnInit(void);
virtual bool Process(int64_t time, int32_t deltaTime); virtual bool Process(int64_t time, int32_t deltaTime);
virtual void Draw(int32_t currentCreateId); virtual void Draw(void);
virtual bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size); virtual bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power); virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
virtual void Message(etk::UString control, etk::UString message); virtual void Message(etk::UString control, etk::UString message);

View File

@ -80,15 +80,13 @@ ewol::SceneElement::~SceneElement(void)
} }
listAnimatedElements[iii].Clear(); listAnimatedElements[iii].Clear();
} }
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { for (int32_t jjj=0; jjj<animated.Size(); jjj++) {
for (int32_t jjj=0; jjj<animated[iii].Size(); jjj++) { if (NULL != animated[jjj]) {
if (NULL != animated[iii][jjj]) { delete(animated[jjj]);
delete(animated[iii][jjj]); animated[jjj] = NULL;
animated[iii][jjj] = NULL;
}
} }
animated[iii].Clear();
} }
animated.Clear();
} }
void ewol::SceneElement::RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString) void ewol::SceneElement::RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString)
@ -324,26 +322,25 @@ void ewol::SceneElement::SetEventExternJoystick(uint32_t id, int32_t joyId, floa
*/ */
int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize) int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
{ {
for (int32_t iii=0; iii<animated[0].Size(); iii++) { for (int32_t iii=0; iii<animated.Size(); iii++) {
if (animated[0][iii] != NULL) { if (animated[iii] != NULL) {
if (animated[0][iii]->HasName(fileName) == true) { if (animated[iii]->HasName(fileName) == true) {
// count the number of element registered ... // count the number of element registered ...
animated[0][iii]->IncreaseLoadedTime(); animated[iii]->IncreaseLoadedTime();
return iii; return iii;
} }
} }
} }
for(int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { // we did not find the sprite ==> created it ...
// we did not find the sprite ==> created it ... ewol::Sprite* tmpSprite = new ewol::Sprite(fileName, maxSize, maxSize);
ewol::Sprite* tmpSprite = new ewol::Sprite(fileName, maxSize, maxSize); if (NULL == tmpSprite) {
if (NULL == tmpSprite) { EWOL_ERROR("Allocation error on the sprite : " << fileName);
EWOL_ERROR("Allocation error on the sprite : " << fileName); return -1;
return -1;
}
// add it :
animated[iii].PushBack(tmpSprite);
} }
return animated[0].Size() -1; // add it :
animated.PushBack(tmpSprite);
return animated.Size() -1;
} }
/** /**
@ -354,15 +351,13 @@ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
*/ */
void ewol::SceneElement::UnLoadSprite(int32_t spriteId) void ewol::SceneElement::UnLoadSprite(int32_t spriteId)
{ {
if (spriteId >= 0 && spriteId < animated[0].Size()) { if (spriteId >= 0 && spriteId < animated.Size()) {
if (animated[0][spriteId] != NULL) { if (animated[spriteId] != NULL) {
// count the number of element registered ... // count the number of element registered ...
if (true == animated[0][spriteId]->DecreaseLoadedTime() ) { if (true == animated[spriteId]->DecreaseLoadedTime() ) {
// must remove the sprite ==> pb with the double buffer ... // must remove the sprite ==> pb with the double buffer ...
// TODO : ==> for all double buffer ... delete(animated[spriteId]);
for(int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { animated[spriteId] = NULL;
}
} }
} }
} }

View File

@ -54,7 +54,7 @@ namespace ewol {
int32_t numberOfGroup; //!< curent scene number of group int32_t numberOfGroup; //!< curent scene number of group
etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups
int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy
etk::VectorType<ewol::Sprite*> animated[NB_BOUBLE_BUFFER]; //!< element that must be display the second etk::VectorType<ewol::Sprite*> animated; //!< element that must be display the second
etk::VectorType<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group etk::VectorType<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group
etk::VectorType<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free etk::VectorType<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free
etk::VectorType<listRegisteElement*> listCreatorElement; //!< list of all creatable elements etk::VectorType<listRegisteElement*> listCreatorElement; //!< list of all creatable elements

View File

@ -84,9 +84,6 @@ ewol::Widget::Widget(void)
{ {
m_limitMouseEvent = 3; m_limitMouseEvent = 3;
m_needRegenerateDisplay = true; m_needRegenerateDisplay = true;
m_currentDrawId = 0;
m_currentCreateId = 1;
m_needFlipFlop = true;
m_origin.x = 0.0; m_origin.x = 0.0;
m_origin.y = 0.0; m_origin.y = 0.0;
m_size.x = 10.0; m_size.x = 10.0;
@ -102,9 +99,7 @@ ewol::Widget::Widget(void)
SetFillY(); SetFillY();
m_canFocus = false; m_canFocus = false;
m_hasFocus = false; m_hasFocus = false;
for(int32_t iii=0 ; iii<NB_BOUBLE_BUFFER ; iii++) { m_hide = false;
m_hide[iii] = false;
}
} }
@ -115,7 +110,7 @@ ewol::Widget::Widget(void)
*/ */
void ewol::Widget::Hide(void) void ewol::Widget::Hide(void)
{ {
m_hide[m_currentCreateId] = true; m_hide = true;
MarkToReedraw(); MarkToReedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
} }
@ -128,7 +123,7 @@ void ewol::Widget::Hide(void)
*/ */
void ewol::Widget::Show(void) void ewol::Widget::Show(void)
{ {
m_hide[m_currentCreateId] = false; m_hide = false;
MarkToReedraw(); MarkToReedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
} }
@ -166,31 +161,6 @@ bool ewol::Widget::CalculateSize(float availlableX, float availlableY)
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::Widget::OnFlipFlopEvent(void)
{
if (true == m_needFlipFlop) {
bool save = m_hide[m_currentCreateId];
m_currentDrawId++;
if (NB_BOUBLE_BUFFER<=m_currentDrawId) {
m_currentDrawId = 0;
}
m_currentCreateId++;
if (NB_BOUBLE_BUFFER<=m_currentCreateId) {
m_currentCreateId = 0;
}
m_needFlipFlop = false;
m_hide[m_currentCreateId] = save;
}
}
/** /**
* @brief Set focus on this widget * @brief Set focus on this widget
* @param --- * @param ---
@ -255,7 +225,7 @@ void ewol::Widget::KeepFocus(void)
*/ */
void ewol::Widget::GenDraw(DrawProperty displayProp) void ewol::Widget::GenDraw(DrawProperty displayProp)
{ {
if (true==m_hide[m_currentDrawId]){ if (true==m_hide){
// widget is hidden ... // widget is hidden ...
return; return;
} }

View File

@ -27,8 +27,6 @@
#include <ewol/EObject.h> #include <ewol/EObject.h>
#define NB_BOUBLE_BUFFER (1)
namespace ewol { namespace ewol {
class Widget; class Widget;
}; };
@ -142,7 +140,7 @@ namespace ewol {
// -- Widget Size: // -- Widget Size:
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private: private:
bool m_hide[NB_BOUBLE_BUFFER]; //!< hide a widget on the display bool m_hide; //!< hide a widget on the display
protected: protected:
// internal element calculated by the system // internal element calculated by the system
Vector2D<float> m_origin; //!< internal ... I do not really known how i can use it ... Vector2D<float> m_origin; //!< internal ... I do not really known how i can use it ...
@ -277,7 +275,7 @@ namespace ewol {
* @param --- * @param ---
* @return true: if the widget is hiden, false: it is visible * @return true: if the widget is hiden, false: it is visible
*/ */
bool IsHide(void) { return m_hide[m_currentCreateId]; }; bool IsHide(void) { return m_hide; };
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
@ -422,9 +420,6 @@ namespace ewol {
// -- Drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... // -- Drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
protected: protected:
int8_t m_currentDrawId; //!< Id of the element that might be displayed by the Gui thread
int8_t m_currentCreateId; //!< Id of the element might be modify
bool m_needFlipFlop; //!< A flip flop need to be done
bool m_needRegenerateDisplay; //!< the display might be done the next regeneration bool m_needRegenerateDisplay; //!< the display might be done the next regeneration
/** /**
* @brief The widget mark itself that it need to regenerate the nest time. * @brief The widget mark itself that it need to regenerate the nest time.
@ -439,19 +434,6 @@ namespace ewol {
* @return false if we have no need to redraw * @return false if we have no need to redraw
*/ */
bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; }; bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; };
public:
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/**
* @brief Request a flip-flop of the double buffer
* @param ---
* @return ---
*/
void NeedFlipFlop(void) { m_needFlipFlop = true; };
public: public:
/** /**
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) * @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
@ -477,11 +459,8 @@ namespace ewol {
virtual void OnRegenerateDisplay(void) { }; virtual void OnRegenerateDisplay(void) { };
}; // end of the class Widget declaration }; // end of the class Widget declaration
extern const char * const TYPE_EOBJECT_WIDGET;
};// end of namespace };// end of namespace
#define EWOL_CAST_WIDGET(curentPointer) EWOL_CAST(ewol::TYPE_EOBJECT_WIDGET,ewol::Widget,curentPointer)
#endif #endif

View File

@ -47,27 +47,25 @@ extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKey
ewol::Windows::Windows(void) ewol::Windows::Windows(void)
{ {
SetCanHaveFocus(true); SetCanHaveFocus(true);
for(int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { m_subWidget = NULL;
m_subWidget[iii] = NULL;
}
SetDecorationDisable(); SetDecorationDisable();
//KeyboardShow(KEYBOARD_MODE_CODE); //KeyboardShow(KEYBOARD_MODE_CODE);
} }
ewol::Windows::~Windows(void) ewol::Windows::~Windows(void)
{ {
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->MarkToRemove(); m_subWidget->MarkToRemove();
m_subWidget[m_currentCreateId]=NULL; m_subWidget=NULL;
} }
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) { for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) { if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[m_currentCreateId][iii]->MarkToRemove(); m_popUpWidgetList[iii]->MarkToRemove();
m_popUpWidgetList[m_currentCreateId][iii]=NULL; m_popUpWidgetList[iii]=NULL;
} }
} }
m_popUpWidgetList[m_currentCreateId].Clear(); m_popUpWidgetList.Clear();
} }
@ -76,16 +74,16 @@ bool ewol::Windows::CalculateSize(float availlableX, float availlableY)
//EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId); //EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId);
m_size.x = availlableX; m_size.x = availlableX;
m_size.y = availlableY; m_size.y = availlableY;
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->CalculateMinSize(); m_subWidget->CalculateMinSize();
// TODO : Check if min Size is possible ... // TODO : Check if min Size is possible ...
// TODO : Herited from MinSize .. and expand ??? // TODO : Herited from MinSize .. and expand ???
m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y); m_subWidget->CalculateSize(m_size.x, m_size.y);
} }
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) { for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) { if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[m_currentCreateId][iii]->CalculateMinSize(); m_popUpWidgetList[iii]->CalculateMinSize();
m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); m_popUpWidgetList[iii]->CalculateSize(m_size.x, m_size.y);
} }
} }
return true; return true;
@ -102,15 +100,15 @@ ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D<float> pos)
// calculate relative position // calculate relative position
Vector2D<float> relativePos = RelativePosition(pos); Vector2D<float> relativePos = RelativePosition(pos);
// event go directly on the pop-up // event go directly on the pop-up
if (0 < m_popUpWidgetList[m_currentCreateId].Size()) { if (0 < m_popUpWidgetList.Size()) {
if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) { if (NULL == m_popUpWidgetList[m_popUpWidgetList.Size()-1]) {
m_popUpWidgetList[m_currentCreateId].PopBack(); m_popUpWidgetList.PopBack();
} else { } else {
return m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]->GetWidgetAtPos(pos); return m_popUpWidgetList[m_popUpWidgetList.Size()-1]->GetWidgetAtPos(pos);
} }
// otherwise in the normal windows // otherwise in the normal windows
} else if (NULL != m_subWidget[m_currentCreateId]) { } else if (NULL != m_subWidget) {
return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos); return m_subWidget->GetWidgetAtPos(pos);
} }
// otherwise the event go to this widget ... // otherwise the event go to this widget ...
return this; return this;
@ -140,12 +138,12 @@ void ewol::Windows::SysDraw(void)
void ewol::Windows::OnRegenerateDisplay(void) void ewol::Windows::OnRegenerateDisplay(void)
{ {
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); m_subWidget->OnRegenerateDisplay();
} }
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) { for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) { if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[m_currentCreateId][iii]->OnRegenerateDisplay(); m_popUpWidgetList[iii]->OnRegenerateDisplay();
} }
} }
} }
@ -160,14 +158,14 @@ void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
//EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId); //EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId);
// first display the windows on the display // first display the windows on the display
if (NULL != m_subWidget[m_currentDrawId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentDrawId]->GenDraw(displayProp); m_subWidget->GenDraw(displayProp);
//EWOL_DEBUG("Draw Windows"); //EWOL_DEBUG("Draw Windows");
} }
// second display the pop-up // second display the pop-up
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) { for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[m_currentDrawId][iii]) { if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[m_currentDrawId][iii]->GenDraw(displayProp); m_popUpWidgetList[iii]->GenDraw(displayProp);
//EWOL_DEBUG("Draw Pop-up"); //EWOL_DEBUG("Draw Pop-up");
} }
} }
@ -177,54 +175,25 @@ void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
void ewol::Windows::SetSubWidget(ewol::Widget * widget) void ewol::Windows::SetSubWidget(ewol::Widget * widget)
{ {
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
EWOL_INFO("Remove current main windows Widget..."); EWOL_INFO("Remove current main windows Widget...");
m_subWidget[m_currentCreateId]->MarkToRemove(); m_subWidget->MarkToRemove();
m_subWidget[m_currentCreateId] = NULL; m_subWidget = NULL;
} }
m_subWidget[m_currentCreateId] = widget; m_subWidget = widget;
// Regenerate the size calculation : // Regenerate the size calculation :
CalculateSize(m_size.x, m_size.y); CalculateSize(m_size.x, m_size.y);
m_needFlipFlop = true;
} }
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget) void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
{ {
m_popUpWidgetList[m_currentCreateId].PushBack(widget); m_popUpWidgetList.PushBack(widget);
// Regenerate the size calculation : // Regenerate the size calculation :
CalculateSize(m_size.x, m_size.y); CalculateSize(m_size.x, m_size.y);
m_needFlipFlop = true;
ewol::eventInput::NewLayerSet(); ewol::eventInput::NewLayerSet();
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::Windows::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
m_popUpWidgetList[m_currentCreateId] = m_popUpWidgetList[m_currentDrawId];
}
// in every case, we propagate the flip-flop EVENT
if (NULL != m_subWidget[m_currentDrawId]) {
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
}
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) {
if(NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
m_popUpWidgetList[m_currentDrawId][iii]->OnFlipFlopEvent();
}
}
}
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
@ -237,17 +206,15 @@ void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject)
ewol::Widget::OnObjectRemove(removeObject); ewol::Widget::OnObjectRemove(removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...
if (m_subWidget[m_currentCreateId] == removeObject) { if (m_subWidget == removeObject) {
EWOL_DEBUG("Remove main element of the windows ==> destroyed object"); EWOL_DEBUG("Remove main element of the windows ==> destroyed object");
m_subWidget[m_currentCreateId] = NULL; m_subWidget = NULL;
m_needFlipFlop = true;
} }
for(int32_t iii=m_popUpWidgetList[m_currentCreateId].Size()-1; iii>=0; iii--) { for(int32_t iii=m_popUpWidgetList.Size()-1; iii>=0; iii--) {
if(m_popUpWidgetList[m_currentCreateId][iii] == removeObject) { if(m_popUpWidgetList[iii] == removeObject) {
EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object"); EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object");
m_popUpWidgetList[m_currentCreateId][iii] = NULL; m_popUpWidgetList[iii] = NULL;
m_popUpWidgetList[m_currentCreateId].Erase(iii); m_popUpWidgetList.Erase(iii);
m_needFlipFlop = true;
} }
} }
} }

View File

@ -78,8 +78,8 @@ namespace ewol {
m_hasDecoration = true; m_hasDecoration = true;
} }
private: private:
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; ewol::Widget* m_subWidget;
etk::VectorType<ewol::Widget*> m_popUpWidgetList[NB_BOUBLE_BUFFER]; etk::VectorType<ewol::Widget*> m_popUpWidgetList;
public: public:
void SetSubWidget(ewol::Widget * widget); void SetSubWidget(ewol::Widget * widget);
void PopUpWidgetPush(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget);
@ -88,12 +88,6 @@ namespace ewol {
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: public:
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject

View File

@ -81,8 +81,6 @@ void EWOL_NativeRegenerateDisplay(void)
gui_uniqueWindows->OnRegenerateDisplay(); gui_uniqueWindows->OnRegenerateDisplay();
// Keep Inter-thread-lock-mutex // Keep Inter-thread-lock-mutex
ewol::widgetManager::DoubleBufferLock(); ewol::widgetManager::DoubleBufferLock();
// flip-flop all needed double-buffer in all widget
gui_uniqueWindows->OnFlipFlopEvent();
// Inform the main thread of openGl draw that somthing to display // Inform the main thread of openGl draw that somthing to display
ewol::widgetManager::SetDoubleBufferNeedDraw(); ewol::widgetManager::SetDoubleBufferNeedDraw();
// Release Inter-thread-lock-mutex // Release Inter-thread-lock-mutex

View File

@ -55,12 +55,10 @@ ewol::ButtonImage::ButtonImage(etk::UString imageName, color_ts col)
m_value = false; m_value = false;
m_image = imageName; m_image = imageName;
m_color = col; m_color = col;
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { m_OOImage = NULL;
m_OOImage[iii] = NULL; m_OOImageBg1 = NULL;
m_OOImageBg1[iii] = NULL; m_OOImageBG2 = NULL;
m_OOImageBG2[iii] = NULL; m_resetNeeded = false;
m_resetNeeded[iii] = false;
}
m_toggleMode = false; m_toggleMode = false;
} }
@ -74,9 +72,7 @@ void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col)
{ {
m_image = imageName; m_image = imageName;
m_color = col; m_color = col;
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { m_resetNeeded = true;
m_resetNeeded[iii] = true;
}
MarkToReedraw(); MarkToReedraw();
} }
@ -84,9 +80,7 @@ void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col)
{ {
m_imageBg1 = imageName; m_imageBg1 = imageName;
m_colorBg1 = col; m_colorBg1 = col;
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { m_resetNeeded = true;
m_resetNeeded[iii] = true;
}
MarkToReedraw(); MarkToReedraw();
} }
@ -94,9 +88,7 @@ void ewol::ButtonImage::SetImageSelected(etk::UString imageName, color_ts col)
{ {
m_imageBg2 = imageName; m_imageBg2 = imageName;
m_colorBg2 = col; m_colorBg2 = col;
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { m_resetNeeded = true;
m_resetNeeded[iii] = true;
}
MarkToReedraw(); MarkToReedraw();
} }
@ -147,28 +139,28 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
tmpOriginY = 0; tmpOriginY = 0;
} }
if (NULL == m_OOImageBG2[m_currentCreateId]) { if (NULL == m_OOImageBG2) {
if(m_imageBg2 != "") { if(m_imageBg2 != "") {
m_OOImageBG2[m_currentCreateId] = new ewol::OObject2DTextured(m_imageBg2, tmpSizeX, tmpSizeY); m_OOImageBG2 = new ewol::OObject2DTextured(m_imageBg2, tmpSizeX, tmpSizeY);
} }
} }
if (NULL == m_OOImageBg1[m_currentCreateId]) { if (NULL == m_OOImageBg1) {
if(m_imageBg1 != "") { if(m_imageBg1 != "") {
m_OOImageBg1[m_currentCreateId] = new ewol::OObject2DTextured(m_imageBg1, tmpSizeX, tmpSizeY); m_OOImageBg1 = new ewol::OObject2DTextured(m_imageBg1, tmpSizeX, tmpSizeY);
} }
} }
if (NULL == m_OOImage[m_currentCreateId]) { if (NULL == m_OOImage) {
if(m_image != "") { if(m_image != "") {
m_OOImage[m_currentCreateId] = new ewol::OObject2DTextured(m_image, tmpSizeX, tmpSizeY); m_OOImage = new ewol::OObject2DTextured(m_image, tmpSizeX, tmpSizeY);
} }
} }
if (false == m_toggleMode) { if (false == m_toggleMode) {
float tmpval = 0.0; float tmpval = 0.0;
if (NULL != m_OOImageBG2[m_currentCreateId]) { if (NULL != m_OOImageBG2) {
m_OOImageBG2[m_currentCreateId]->Clear(); m_OOImageBG2->Clear();
if( m_down == true if( m_down == true
|| m_over == true ) { || m_over == true ) {
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); m_OOImageBG2->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
} }
tmpval = tmpSizeX * 0.2; tmpval = tmpSizeX * 0.2;
tmpSizeX -= tmpval; tmpSizeX -= tmpval;
@ -177,9 +169,9 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
tmpSizeY -= tmpval; tmpSizeY -= tmpval;
tmpOriginY += tmpval/2; tmpOriginY += tmpval/2;
} }
if (NULL != m_OOImageBg1[m_currentCreateId]) { if (NULL != m_OOImageBg1) {
m_OOImageBg1[m_currentCreateId]->Clear(); m_OOImageBg1->Clear();
m_OOImageBg1[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); m_OOImageBg1->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
tmpval = tmpSizeX * 0.2; tmpval = tmpSizeX * 0.2;
tmpSizeX -= tmpval; tmpSizeX -= tmpval;
tmpOriginX += tmpval/2; tmpOriginX += tmpval/2;
@ -187,28 +179,27 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
tmpSizeY -= tmpval; tmpSizeY -= tmpval;
tmpOriginY += tmpval/2; tmpOriginY += tmpval/2;
} }
if (NULL != m_OOImage[m_currentCreateId]) { if (NULL != m_OOImage) {
m_OOImage[m_currentCreateId]->Clear(); m_OOImage->Clear();
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); m_OOImage->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
} }
} else { } else {
if (NULL != m_OOImage[m_currentCreateId]) { if (NULL != m_OOImage) {
m_OOImage[m_currentCreateId]->Clear(); m_OOImage->Clear();
} }
if (NULL != m_OOImageBG2[m_currentCreateId]) { if (NULL != m_OOImageBG2) {
m_OOImageBG2[m_currentCreateId]->Clear(); m_OOImageBG2->Clear();
} }
if(m_value == true) { if(m_value == true) {
if (NULL != m_OOImage[m_currentCreateId]) { if (NULL != m_OOImage) {
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_color); m_OOImage->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_color);
} }
} else { } else {
if (NULL != m_OOImageBG2[m_currentCreateId]) { if (NULL != m_OOImageBG2) {
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_colorBg2); m_OOImageBG2->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_colorBg2);
} }
} }
} }
m_needFlipFlop = true;
} }
} }
@ -318,44 +309,14 @@ bool ewol::ButtonImage::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unic
void ewol::ButtonImage::OnDraw(DrawProperty& displayProp) void ewol::ButtonImage::OnDraw(DrawProperty& displayProp)
{ {
if (NULL != m_OOImageBG2[m_currentDrawId]) { if (NULL != m_OOImageBG2) {
m_OOImageBG2[m_currentDrawId]->Draw(); m_OOImageBG2->Draw();
} }
if (NULL != m_OOImageBg1[m_currentDrawId]) { if (NULL != m_OOImageBg1) {
m_OOImageBg1[m_currentDrawId]->Draw(); m_OOImageBg1->Draw();
} }
if (NULL != m_OOImage[m_currentDrawId]) { if (NULL != m_OOImage) {
m_OOImage[m_currentDrawId]->Draw(); m_OOImage->Draw();
} }
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::ButtonImage::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
if (m_resetNeeded[m_currentCreateId] == true) {
m_resetNeeded[m_currentCreateId] = false;
if (NULL != m_OOImageBG2[m_currentCreateId]) {
delete(m_OOImageBG2[m_currentCreateId]);
m_OOImageBG2[m_currentCreateId] = NULL;
}
if (NULL != m_OOImageBg1[m_currentCreateId]) {
delete(m_OOImageBg1[m_currentCreateId]);
m_OOImageBg1[m_currentCreateId] = NULL;
}
if (NULL != m_OOImage[m_currentCreateId]) {
delete(m_OOImage[m_currentCreateId]);
m_OOImage[m_currentCreateId] = NULL;
}
}
}
}

View File

@ -53,16 +53,16 @@ namespace ewol {
bool GetToggleMode(void); bool GetToggleMode(void);
private: private:
etk::UString m_image; etk::UString m_image;
bool m_resetNeeded[NB_BOUBLE_BUFFER]; bool m_resetNeeded;
ewol::OObject2DTextured* m_OOImage[NB_BOUBLE_BUFFER]; ewol::OObject2DTextured* m_OOImage;
color_ts m_color; color_ts m_color;
etk::UString m_imageBg1; etk::UString m_imageBg1;
ewol::OObject2DTextured* m_OOImageBg1[NB_BOUBLE_BUFFER]; ewol::OObject2DTextured* m_OOImageBg1;
color_ts m_colorBg1; color_ts m_colorBg1;
etk::UString m_imageBg2; etk::UString m_imageBg2;
ewol::OObject2DTextured* m_OOImageBG2[NB_BOUBLE_BUFFER]; ewol::OObject2DTextured* m_OOImageBG2;
color_ts m_colorBg2; color_ts m_colorBg2;
bool m_over; bool m_over;
@ -83,12 +83,6 @@ namespace ewol {
*/ */
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos); virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
virtual void OnDraw(DrawProperty& displayProp); virtual void OnDraw(DrawProperty& displayProp);
}; };

View File

@ -63,14 +63,14 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY)
m_size.x = availlableX; m_size.x = availlableX;
m_size.y = availlableY; m_size.y = availlableY;
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
Vector2D<float> subWidgetSize; Vector2D<float> subWidgetSize;
Vector2D<float> subWidgetOrigin; Vector2D<float> subWidgetOrigin;
subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize(); subWidgetSize = m_subWidget->GetMinSize();
if (true == m_subWidget[m_currentCreateId]->CanExpentX()) { if (true == m_subWidget->CanExpentX()) {
subWidgetSize.x = m_size.x; subWidgetSize.x = m_size.x;
} }
if (true == m_subWidget[m_currentCreateId]->CanExpentY()) { if (true == m_subWidget->CanExpentY()) {
subWidgetSize.y = m_size.y; subWidgetSize.y = m_size.y;
} }
int32_t minWidth = 100; int32_t minWidth = 100;
@ -123,8 +123,8 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY)
} }
break; break;
} }
m_subWidget[m_currentCreateId]->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y); m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y); m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
} }
MarkToReedraw(); MarkToReedraw();
return true; return true;
@ -138,9 +138,9 @@ bool ewol::ContextMenu::CalculateMinSize(void)
m_userExpendY=false; m_userExpendY=false;
m_minSize.x = 50.0; m_minSize.x = 50.0;
m_minSize.y = 50.0; m_minSize.y = 50.0;
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->CalculateMinSize(); m_subWidget->CalculateMinSize();
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget->GetMinSize();
m_minSize.x = tmpSize.x; m_minSize.x = tmpSize.x;
m_minSize.y = tmpSize.y; m_minSize.y = tmpSize.y;
} }
@ -170,15 +170,15 @@ void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
m_subWidget[m_currentCreateId] = newWidget; m_subWidget = newWidget;
} }
void ewol::ContextMenu::SubWidgetRemove(void) void ewol::ContextMenu::SubWidgetRemove(void)
{ {
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->MarkToRemove(); m_subWidget->MarkToRemove();
m_subWidget[m_currentCreateId] = NULL; m_subWidget = NULL;
} }
} }
@ -186,8 +186,8 @@ void ewol::ContextMenu::OnDraw(DrawProperty& displayProp)
{ {
//EWOL_DEBUG("On Draw " << m_currentDrawId); //EWOL_DEBUG("On Draw " << m_currentDrawId);
ewol::Drawable::OnDraw(displayProp); ewol::Drawable::OnDraw(displayProp);
if (NULL != m_subWidget[m_currentDrawId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentDrawId]->GenDraw(displayProp); m_subWidget->GenDraw(displayProp);
} }
} }
@ -201,9 +201,9 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
AddOObject(BGOObjects); AddOObject(BGOObjects);
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize(); Vector2D<float> tmpSize = m_subWidget->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
// display border ... // display border ...
BGOObjects->SetColor(m_colorBorder); BGOObjects->SetColor(m_colorBorder);
@ -245,8 +245,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
BGOObjects->SetColor(m_colorBackGroung); BGOObjects->SetColor(m_colorBackGroung);
BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y);
} }
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); m_subWidget->OnRegenerateDisplay();
} }
} }
@ -262,13 +262,13 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D<float> pos)
// calculate relative position // calculate relative position
Vector2D<float> relativePos = RelativePosition(pos); Vector2D<float> relativePos = RelativePosition(pos);
// Check for sub Element // Check for sub Element
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize(); Vector2D<float> tmpSize = m_subWidget->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x) if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) ) && (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
{ {
return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos); return m_subWidget->GetWidgetAtPos(pos);
} }
} }
return this; return this;
@ -312,24 +312,3 @@ void ewol::ContextMenu::SetPositionMark(markPosition_te position, Vector2D<float
MarkToReedraw(); MarkToReedraw();
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::ContextMenu::OnFlipFlopEvent(void)
{
//EWOL_DEBUG("Flip-Flop");
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Drawable::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
}
// in every case, we propagate the flip-flop EVENT
if (NULL != m_subWidget[m_currentDrawId]) {
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
}
}

View File

@ -63,7 +63,7 @@ namespace ewol {
Vector2D<float> m_arrowPos; Vector2D<float> m_arrowPos;
float m_offset; float m_offset;
markPosition_te m_arrawBorder; markPosition_te m_arrawBorder;
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; ewol::Widget* m_subWidget;
public: public:
void SubWidgetSet(ewol::Widget* newWidget); void SubWidgetSet(ewol::Widget* newWidget);
void SubWidgetRemove(void); void SubWidgetRemove(void);
@ -90,12 +90,6 @@ namespace ewol {
* @return false the event is not used * @return false the event is not used
*/ */
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos); virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
}; };
}; };

View File

@ -33,13 +33,12 @@ ewol::Drawable::Drawable(void)
ewol::Drawable::~Drawable(void) ewol::Drawable::~Drawable(void)
{ {
//clean all the object //clean all the object
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) { delete(m_listOObject[iii]);
delete(m_listOObject[jjj][iii]); m_listOObject[iii] = NULL;
m_listOObject[jjj][iii] = NULL;
}
m_listOObject[jjj].Clear();
} }
m_listOObject.Clear();
} }
@ -50,29 +49,28 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
EWOL_ERROR("Try to add an empty object in the Widget generic display system"); EWOL_ERROR("Try to add an empty object in the Widget generic display system");
return; return;
} }
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) { if (pos < 0 || pos >= m_listOObject.Size() ) {
m_listOObject[m_currentCreateId].PushBack(newObject); m_listOObject.PushBack(newObject);
} else { } else {
m_listOObject[m_currentCreateId].Insert(pos, newObject); m_listOObject.Insert(pos, newObject);
} }
m_needFlipFlop = true;
} }
void ewol::Drawable::ClearOObjectList(void) void ewol::Drawable::ClearOObjectList(void)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
delete(m_listOObject[m_currentCreateId][iii]); delete(m_listOObject[iii]);
m_listOObject[m_currentCreateId][iii] = NULL; m_listOObject[iii] = NULL;
} }
m_listOObject[m_currentCreateId].Clear(); m_listOObject.Clear();
} }
void ewol::Drawable::OnDraw(DrawProperty& displayProp) void ewol::Drawable::OnDraw(DrawProperty& displayProp)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
if (NULL != m_listOObject[m_currentDrawId][iii]) { if (NULL != m_listOObject[iii]) {
m_listOObject[m_currentDrawId][iii]->Draw(); m_listOObject[iii]->Draw();
} }
} }
} }

View File

@ -44,7 +44,7 @@ namespace ewol {
virtual const char * const GetObjectType(void) { return "EwolDrawable"; }; virtual const char * const GetObjectType(void) { return "EwolDrawable"; };
private: private:
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);

View File

@ -48,10 +48,10 @@ bool ewol::Layer::CalculateSize(float availlableX, float availlableY)
//EWOL_DEBUG("Update Size"); //EWOL_DEBUG("Update Size");
m_size.x = availlableX; m_size.x = availlableX;
m_size.y = availlableY; m_size.y = availlableY;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y); m_subWidget[iii]->SetOrigin(m_origin.x, m_origin.y);
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
} }
} }
MarkToReedraw(); MarkToReedraw();
@ -65,16 +65,16 @@ bool ewol::Layer::CalculateMinSize(void)
m_userExpendY=false; m_userExpendY=false;
m_minSize.x = 0.0; m_minSize.x = 0.0;
m_minSize.y = 0.0; m_minSize.y = 0.0;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->CalculateMinSize(); m_subWidget[iii]->CalculateMinSize();
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpentX()) {
m_userExpendX = true; m_userExpendX = true;
} }
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpentY()) {
m_userExpendY = true; m_userExpendY = true;
} }
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
m_minSize.x = etk_max(tmpSize.x, m_minSize.x); m_minSize.x = etk_max(tmpSize.x, m_minSize.x);
m_minSize.y = etk_max(tmpSize.y, m_minSize.y); m_minSize.y = etk_max(tmpSize.y, m_minSize.y);
} }
@ -122,11 +122,11 @@ void ewol::Layer::LockExpendContamination(bool lockExpend)
void ewol::Layer::SubWidgetRemoveAll(void) void ewol::Layer::SubWidgetRemoveAll(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
} }
m_subWidget[m_currentCreateId].Clear(); m_subWidget.Clear();
} }
@ -135,7 +135,7 @@ void ewol::Layer::SubWidgetAdd(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
m_subWidget[m_currentCreateId].PushBack(newWidget); m_subWidget.PushBack(newWidget);
} }
@ -144,11 +144,11 @@ void ewol::Layer::SubWidgetRemove(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
return; return;
} }
} }
@ -159,10 +159,10 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
return; return;
} }
} }
@ -172,9 +172,9 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
void ewol::Layer::OnDraw(DrawProperty& displayProp) void ewol::Layer::OnDraw(DrawProperty& displayProp)
{ {
// draw is done in the invert sense of inserting ... the first element inserted is on the top and the last is on the buttom // draw is done in the invert sense of inserting ... the first element inserted is on the top and the last is on the buttom
for (int32_t iii=m_subWidget[m_currentDrawId].Size()-1; iii>=0; iii--) { for (int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if (NULL != m_subWidget[m_currentDrawId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); m_subWidget[iii]->GenDraw(displayProp);
} }
} }
} }
@ -183,9 +183,9 @@ void ewol::Layer::OnDraw(DrawProperty& displayProp)
void ewol::Layer::OnRegenerateDisplay(void) void ewol::Layer::OnRegenerateDisplay(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); m_subWidget[iii]->OnRegenerateDisplay();
} }
} }
} }
@ -200,14 +200,14 @@ void ewol::Layer::OnRegenerateDisplay(void)
ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D<float> pos) ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D<float> pos)
{ {
// for all element in the sizer ... // for all element in the sizer ...
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
{ {
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos); ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
if (NULL != tmpWidget) { if (NULL != tmpWidget) {
return tmpWidget; return tmpWidget;
} }
@ -219,28 +219,6 @@ ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D<float> pos)
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::Layer::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
}
// in every case, we propagate the flip-flop EVENT
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
if(NULL != m_subWidget[m_currentDrawId][iii]) {
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
}
}
}
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
@ -253,12 +231,11 @@ void ewol::Layer::OnObjectRemove(ewol::EObject * removeObject)
// First step call parrent : // First step call parrent :
ewol::Widget::OnObjectRemove(removeObject); ewol::Widget::OnObjectRemove(removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if(m_subWidget[m_currentCreateId][iii] == removeObject) { if(m_subWidget[iii] == removeObject) {
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
m_needFlipFlop = true;
} }
} }
} }

View File

@ -53,7 +53,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER]; etk::VectorType<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);
@ -71,12 +71,6 @@ namespace ewol {
* @return pointer on the widget found * @return pointer on the widget found
*/ */
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject

View File

@ -51,13 +51,11 @@ ewol::List::List(void)
ewol::List::~List(void) ewol::List::~List(void)
{ {
//clean all the object //clean all the object
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) { delete(m_listOObject[iii]);
delete(m_listOObject[jjj][iii]); m_listOObject[iii] = NULL;
m_listOObject[jjj][iii] = NULL;
}
m_listOObject[jjj].Clear();
} }
m_listOObject.Clear();
} }
@ -81,29 +79,28 @@ void ewol::List::AddOObject(ewol::OObject* newObject, int32_t pos)
EWOL_ERROR("Try to add an empty object in the Widget generic display system"); EWOL_ERROR("Try to add an empty object in the Widget generic display system");
return; return;
} }
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) { if (pos < 0 || pos >= m_listOObject.Size() ) {
m_listOObject[m_currentCreateId].PushBack(newObject); m_listOObject.PushBack(newObject);
} else { } else {
m_listOObject[m_currentCreateId].Insert(pos, newObject); m_listOObject.Insert(pos, newObject);
} }
m_needFlipFlop = true;
} }
void ewol::List::ClearOObjectList(void) void ewol::List::ClearOObjectList(void)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
delete(m_listOObject[m_currentCreateId][iii]); delete(m_listOObject[iii]);
m_listOObject[m_currentCreateId][iii] = NULL; m_listOObject[iii] = NULL;
} }
m_listOObject[m_currentCreateId].Clear(); m_listOObject.Clear();
} }
void ewol::List::OnDraw(DrawProperty& displayProp) void ewol::List::OnDraw(DrawProperty& displayProp)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
if (NULL != m_listOObject[m_currentDrawId][iii]) { if (NULL != m_listOObject[iii]) {
m_listOObject[m_currentDrawId][iii]->Draw(); m_listOObject[iii]->Draw();
} }
} }
WidgetScrooled::OnDraw(displayProp); WidgetScrooled::OnDraw(displayProp);
@ -195,7 +192,6 @@ void ewol::List::OnRegenerateDisplay(void)
// call the herited class... // call the herited class...
WidgetScrooled::OnRegenerateDisplay(); WidgetScrooled::OnRegenerateDisplay();
m_needFlipFlop = true;
} }
} }

View File

@ -48,7 +48,7 @@ namespace ewol {
void SetLabel(etk::UString newLabel); void SetLabel(etk::UString newLabel);
// Drawing capabilities .... // Drawing capabilities ....
private: private:
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);

View File

@ -44,9 +44,7 @@ ewol::PopUp::PopUp(void) :
m_colorBorder = etk::color::color_Black; m_colorBorder = etk::color::color_Black;
m_colorBorder.alpha = 0x7F; m_colorBorder.alpha = 0x7F;
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) { m_subWidget = 0;
m_subWidget[iii] = 0;
}
} }
ewol::PopUp::~PopUp(void) ewol::PopUp::~PopUp(void)
@ -62,14 +60,14 @@ bool ewol::PopUp::CalculateSize(float availlableX, float availlableY)
m_size.x = availlableX; m_size.x = availlableX;
m_size.y = availlableY; m_size.y = availlableY;
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
Vector2D<float> subWidgetSize; Vector2D<float> subWidgetSize;
Vector2D<float> subWidgetOrigin; Vector2D<float> subWidgetOrigin;
subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize(); subWidgetSize = m_subWidget->GetMinSize();
if (true == m_subWidget[m_currentCreateId]->CanExpentX()) { if (true == m_subWidget->CanExpentX()) {
subWidgetSize.x = m_size.x; subWidgetSize.x = m_size.x;
} }
if (true == m_subWidget[m_currentCreateId]->CanExpentY()) { if (true == m_subWidget->CanExpentY()) {
subWidgetSize.y = m_size.y; subWidgetSize.y = m_size.y;
} }
if (m_displayRatio>0.1 && m_displayRatio<=1) { if (m_displayRatio>0.1 && m_displayRatio<=1) {
@ -83,8 +81,8 @@ bool ewol::PopUp::CalculateSize(float availlableX, float availlableY)
subWidgetOrigin.x = (int32_t)(m_size.x - m_origin.x - subWidgetSize.x)/2 + m_origin.x; subWidgetOrigin.x = (int32_t)(m_size.x - m_origin.x - subWidgetSize.x)/2 + m_origin.x;
subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y; subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y;
m_subWidget[m_currentCreateId]->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y); m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y); m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
} }
MarkToReedraw(); MarkToReedraw();
return true; return true;
@ -98,9 +96,9 @@ bool ewol::PopUp::CalculateMinSize(void)
m_userExpendY=false; m_userExpendY=false;
m_minSize.x = 50.0; m_minSize.x = 50.0;
m_minSize.y = 50.0; m_minSize.y = 50.0;
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->CalculateMinSize(); m_subWidget->CalculateMinSize();
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget->GetMinSize();
m_minSize.x = tmpSize.x; m_minSize.x = tmpSize.x;
m_minSize.y = tmpSize.y; m_minSize.y = tmpSize.y;
} }
@ -132,29 +130,28 @@ void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget)
return; return;
} }
SubWidgetRemove(); SubWidgetRemove();
m_subWidget[m_currentCreateId] = newWidget; m_subWidget = newWidget;
m_needFlipFlop = true; //EWOL_DEBUG("SetSubWidget on Pop-Up : " << (int64_t)m_subWidget);
//EWOL_DEBUG("SetSubWidget on Pop-Up : " << (int64_t)m_subWidget[m_currentCreateId]);
MarkToReedraw(); MarkToReedraw();
} }
void ewol::PopUp::SubWidgetRemove(void) void ewol::PopUp::SubWidgetRemove(void)
{ {
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->MarkToRemove();; m_subWidget->MarkToRemove();;
m_subWidget[m_currentCreateId] = NULL; m_subWidget = NULL;
} }
m_needFlipFlop = true;
MarkToReedraw(); MarkToReedraw();
} }
void ewol::PopUp::OnDraw(DrawProperty& displayProp) void ewol::PopUp::OnDraw(DrawProperty& displayProp)
{ {
// draw upper classes // draw upper classes
ewol::Drawable::OnDraw(displayProp); ewol::Drawable::OnDraw(displayProp);
if (NULL != m_subWidget[m_currentDrawId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentDrawId]->GenDraw(displayProp); m_subWidget->GenDraw(displayProp);
} }
} }
@ -171,16 +168,16 @@ void ewol::PopUp::OnRegenerateDisplay(void)
BGOObjects->SetColor(m_colorEmptyArea); BGOObjects->SetColor(m_colorEmptyArea);
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
// set the area in white ... // set the area in white ...
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize(); Vector2D<float> tmpSize = m_subWidget->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
BGOObjects->SetColor(m_colorBorder); BGOObjects->SetColor(m_colorBorder);
BGOObjects->Rectangle(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP, tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP); BGOObjects->Rectangle(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP, tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP);
BGOObjects->SetColor(m_colorBackGroung); BGOObjects->SetColor(m_colorBackGroung);
BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y);
} }
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); m_subWidget->OnRegenerateDisplay();
} }
} }
@ -196,13 +193,13 @@ ewol::Widget * ewol::PopUp::GetWidgetAtPos(Vector2D<float> pos)
// calculate relative position // calculate relative position
Vector2D<float> relativePos = RelativePosition(pos); Vector2D<float> relativePos = RelativePosition(pos);
// for the element in the pop-up ... // for the element in the pop-up ...
if (NULL != m_subWidget[m_currentCreateId]) { if (NULL != m_subWidget) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize(); Vector2D<float> tmpSize = m_subWidget->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x) if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) ) && (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
{ {
return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos); return m_subWidget->GetWidgetAtPos(pos);
} else { } else {
//EWOL_INFO("Event ouside the Pop-up"); //EWOL_INFO("Event ouside the Pop-up");
} }
@ -219,27 +216,6 @@ void ewol::PopUp::SetDisplayRatio(float ratio)
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::PopUp::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
//EWOL_VERBOSE("Flip-Flop on Pop-Up : " << (int64_t)m_subWidget[m_currentCreateId] << " <-- " << (int64_t)m_subWidget[m_currentDrawId]);
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
}
// in every case, we propagate the flip-flop EVENT
if(NULL != m_subWidget[m_currentDrawId]) {
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
}
}
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
@ -251,10 +227,9 @@ void ewol::PopUp::OnObjectRemove(ewol::EObject * removeObject)
// First step call parrent : // First step call parrent :
ewol::Drawable::OnObjectRemove(removeObject); ewol::Drawable::OnObjectRemove(removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...
if(m_subWidget[m_currentCreateId] == removeObject) { if(m_subWidget == removeObject) {
EWOL_DEBUG("Remove pop-up sub Element ==> destroyed object"); EWOL_DEBUG("Remove pop-up sub Element ==> destroyed object");
m_subWidget[m_currentCreateId] = NULL; m_subWidget = NULL;
m_needFlipFlop = true;
} }
} }

View File

@ -55,7 +55,7 @@ namespace ewol {
color_ts m_colorBorder; color_ts m_colorBorder;
color_ts m_colorEmptyArea; color_ts m_colorEmptyArea;
ewol::Widget* m_subWidgetNext; ewol::Widget* m_subWidgetNext;
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; ewol::Widget* m_subWidget;
float m_displayRatio; float m_displayRatio;
public: public:
void SubWidgetSet(ewol::Widget* newWidget); void SubWidgetSet(ewol::Widget* newWidget);
@ -72,12 +72,6 @@ namespace ewol {
* @return pointer on the widget found * @return pointer on the widget found
*/ */
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject

View File

@ -63,20 +63,19 @@ void ewol::Scene::OnRegenerateDisplay(void)
{ {
if (true == NeedRedraw()) { if (true == NeedRedraw()) {
// clean elements // clean elements
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_sceneElement.animated.Size(); iii++) {
if (NULL != m_sceneElement.animated[m_currentCreateId][iii]) { if (NULL != m_sceneElement.animated[iii]) {
m_sceneElement.animated[m_currentCreateId][iii]->Clear(); m_sceneElement.animated[iii]->Clear();
} }
} }
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) { for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) { for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) {
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) { if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
// find an empty slot ... // find an empty slot ...
m_sceneElement.listAnimatedElements[jjj][iii]->Draw(m_currentCreateId); m_sceneElement.listAnimatedElements[jjj][iii]->Draw();
} }
} }
} }
m_needFlipFlop = true;
} }
} }
@ -90,9 +89,9 @@ void ewol::Scene::OnDraw(DrawProperty& displayProp)
{ {
//EWOL_ERROR(" On draw : " << m_currentDrawId); //EWOL_ERROR(" On draw : " << m_currentDrawId);
// draw elements // draw elements
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_sceneElement.animated.Size(); iii++) {
if (NULL != m_sceneElement.animated[m_currentDrawId][iii]) { if (NULL != m_sceneElement.animated[iii]) {
m_sceneElement.animated[m_currentDrawId][iii]->Draw(); m_sceneElement.animated[iii]->Draw();
} }
} }
} }

View File

@ -51,11 +51,11 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY)
float unexpendableSize=0.0; float unexpendableSize=0.0;
int32_t nbWidgetFixedSize=0; int32_t nbWidgetFixedSize=0;
int32_t nbWidgetNotFixedSize=0; int32_t nbWidgetNotFixedSize=0;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
unexpendableSize += tmpSize.x; unexpendableSize += tmpSize.x;
if (false == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { if (false == m_subWidget[iii]->CanExpentX()) {
nbWidgetFixedSize++; nbWidgetFixedSize++;
} else { } else {
nbWidgetNotFixedSize++; nbWidgetNotFixedSize++;
@ -73,18 +73,18 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY)
Vector2D<float> tmpOrigin; Vector2D<float> tmpOrigin;
tmpOrigin.x = m_origin.x; tmpOrigin.x = m_origin.x;
tmpOrigin.y = m_origin.y; tmpOrigin.y = m_origin.y;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
// Set the origin : // Set the origin :
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
m_subWidget[m_currentCreateId][iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y);
// Now Update his Size his size in X and the curent sizer size in Y: // Now Update his Size his size in X and the curent sizer size in Y:
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpentX()) {
m_subWidget[m_currentCreateId][iii]->CalculateSize(tmpSize.x+sizeToAddAtEveryOne, m_size.y); m_subWidget[iii]->CalculateSize(tmpSize.x+sizeToAddAtEveryOne, m_size.y);
tmpOrigin.x += tmpSize.x+sizeToAddAtEveryOne; tmpOrigin.x += tmpSize.x+sizeToAddAtEveryOne;
} else { } else {
m_subWidget[m_currentCreateId][iii]->CalculateSize(tmpSize.x, m_size.y); m_subWidget[iii]->CalculateSize(tmpSize.x, m_size.y);
tmpOrigin.x += tmpSize.x; tmpOrigin.x += tmpSize.x;
} }
} }
@ -101,16 +101,16 @@ bool ewol::SizerHori::CalculateMinSize(void)
m_userExpendY=false; m_userExpendY=false;
m_minSize.x = 0.0; m_minSize.x = 0.0;
m_minSize.y = 0.0; m_minSize.y = 0.0;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->CalculateMinSize(); m_subWidget[iii]->CalculateMinSize();
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpentX()) {
m_userExpendX = true; m_userExpendX = true;
} }
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpentY()) {
m_userExpendY = true; m_userExpendY = true;
} }
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
m_minSize.x += tmpSize.x; m_minSize.x += tmpSize.x;
if (tmpSize.y>m_minSize.y) { if (tmpSize.y>m_minSize.y) {
m_minSize.y = tmpSize.y; m_minSize.y = tmpSize.y;
@ -162,13 +162,13 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend)
void ewol::SizerHori::SubWidgetRemoveAll(void) void ewol::SizerHori::SubWidgetRemoveAll(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
} }
} }
m_subWidget[m_currentCreateId].Clear(); m_subWidget.Clear();
} }
@ -177,7 +177,7 @@ void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
m_subWidget[m_currentCreateId].PushBack(newWidget); m_subWidget.PushBack(newWidget);
} }
@ -186,13 +186,13 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
} }
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
return; return;
} }
} }
@ -203,10 +203,10 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
return; return;
} }
} }
@ -215,9 +215,9 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
void ewol::SizerHori::OnDraw(DrawProperty& displayProp) void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentDrawId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); m_subWidget[iii]->GenDraw(displayProp);
} }
} }
} }
@ -225,12 +225,11 @@ void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
void ewol::SizerHori::OnRegenerateDisplay(void) void ewol::SizerHori::OnRegenerateDisplay(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); m_subWidget[iii]->OnRegenerateDisplay();
} }
} }
NeedFlipFlop();
} }
@ -246,14 +245,14 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D<float> pos)
return NULL; return NULL;
} }
// for all element in the sizer ... // for all element in the sizer ...
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
{ {
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos); ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
if (NULL != tmpWidget) { if (NULL != tmpWidget) {
return tmpWidget; return tmpWidget;
} }
@ -268,29 +267,6 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D<float> pos)
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::SizerHori::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
}
// in every case, we propagate the flip-flop EVENT
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
if(NULL != m_subWidget[m_currentDrawId][iii]) {
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
}
}
}
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
@ -302,12 +278,11 @@ void ewol::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
// First step call parrent : // First step call parrent :
ewol::Widget::OnObjectRemove(removeObject); ewol::Widget::OnObjectRemove(removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if(m_subWidget[m_currentCreateId][iii] == removeObject) { if(m_subWidget[iii] == removeObject) {
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
m_needFlipFlop = true;
} }
} }
} }

View File

@ -54,7 +54,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER]; etk::VectorType<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);
@ -71,12 +71,6 @@ namespace ewol {
* @return pointer on the widget found * @return pointer on the widget found
*/ */
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject

View File

@ -52,11 +52,11 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY)
float unexpendableSize=0.0; float unexpendableSize=0.0;
int32_t nbWidgetFixedSize=0; int32_t nbWidgetFixedSize=0;
int32_t nbWidgetNotFixedSize=0; int32_t nbWidgetNotFixedSize=0;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
unexpendableSize += tmpSize.y; unexpendableSize += tmpSize.y;
if (false == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { if (false == m_subWidget[iii]->CanExpentY()) {
nbWidgetFixedSize++; nbWidgetFixedSize++;
} else { } else {
nbWidgetNotFixedSize++; nbWidgetNotFixedSize++;
@ -75,18 +75,18 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY)
Vector2D<float> tmpOrigin; Vector2D<float> tmpOrigin;
tmpOrigin.x = m_origin.x; tmpOrigin.x = m_origin.x;
tmpOrigin.y = m_origin.y; tmpOrigin.y = m_origin.y;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
// Set the origin : // Set the origin :
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
m_subWidget[m_currentCreateId][iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y);
// Now Update his Size his size in X and the curent sizer size in Y: // Now Update his Size his size in X and the curent sizer size in Y:
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpentY()) {
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, tmpSize.y+sizeToAddAtEveryOne); m_subWidget[iii]->CalculateSize(m_size.x, tmpSize.y+sizeToAddAtEveryOne);
tmpOrigin.y += tmpSize.y+sizeToAddAtEveryOne; tmpOrigin.y += tmpSize.y+sizeToAddAtEveryOne;
} else { } else {
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, tmpSize.y); m_subWidget[iii]->CalculateSize(m_size.x, tmpSize.y);
tmpOrigin.y += tmpSize.y; tmpOrigin.y += tmpSize.y;
} }
} }
@ -103,16 +103,16 @@ bool ewol::SizerVert::CalculateMinSize(void)
m_userExpendY=false; m_userExpendY=false;
m_minSize.x = 0.0; m_minSize.x = 0.0;
m_minSize.y = 0.0; m_minSize.y = 0.0;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->CalculateMinSize(); m_subWidget[iii]->CalculateMinSize();
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpentX()) {
m_userExpendX = true; m_userExpendX = true;
} }
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpentY()) {
m_userExpendY = true; m_userExpendY = true;
} }
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
//EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")");
m_minSize.y += tmpSize.y; m_minSize.y += tmpSize.y;
if (tmpSize.x>m_minSize.x) { if (tmpSize.x>m_minSize.x) {
@ -165,11 +165,11 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend)
void ewol::SizerVert::SubWidgetRemoveAll(void) void ewol::SizerVert::SubWidgetRemoveAll(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
} }
m_subWidget[m_currentCreateId].Clear(); m_subWidget.Clear();
} }
@ -178,7 +178,7 @@ void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
m_subWidget[m_currentCreateId].PushBack(newWidget); m_subWidget.PushBack(newWidget);
} }
@ -187,11 +187,11 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
return; return;
} }
} }
@ -202,10 +202,10 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
return; return;
} }
} }
@ -214,9 +214,9 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
void ewol::SizerVert::OnDraw(DrawProperty& displayProp) void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentDrawId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); m_subWidget[iii]->GenDraw(displayProp);
} }
} }
} }
@ -225,12 +225,11 @@ void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
void ewol::SizerVert::OnRegenerateDisplay(void) void ewol::SizerVert::OnRegenerateDisplay(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); m_subWidget[iii]->OnRegenerateDisplay();
} }
} }
NeedFlipFlop();
} }
@ -246,14 +245,14 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D<float> pos)
return NULL; return NULL;
} }
// for all element in the sizer ... // for all element in the sizer ...
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
{ {
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos); ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
if (NULL != tmpWidget) { if (NULL != tmpWidget) {
return tmpWidget; return tmpWidget;
} }
@ -268,29 +267,6 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D<float> pos)
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::SizerVert::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
}
// in every case, we propagate the flip-flop EVENT
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
if(NULL != m_subWidget[m_currentDrawId][iii]) {
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
}
}
}
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
@ -302,12 +278,11 @@ void ewol::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
// First step call parrent : // First step call parrent :
ewol::Widget::OnObjectRemove(removeObject); ewol::Widget::OnObjectRemove(removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if(m_subWidget[m_currentCreateId][iii] == removeObject) { if(m_subWidget[iii] == removeObject) {
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
m_needFlipFlop = true;
} }
} }
} }

View File

@ -53,7 +53,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER]; etk::VectorType<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);
@ -71,12 +71,6 @@ namespace ewol {
* @return pointer on the widget found * @return pointer on the widget found
*/ */
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject

View File

@ -57,25 +57,25 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY)
if (m_windowsDestination == m_windowsSources) { if (m_windowsDestination == m_windowsSources) {
int32_t iii = m_windowsDestination; int32_t iii = m_windowsDestination;
if (iii < m_subWidget[m_currentCreateId].Size()) { if (iii < m_subWidget.Size()) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y); m_subWidget[iii]->SetOrigin(m_origin.x, m_origin.y);
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
} }
} }
} else { } else {
int32_t iii = m_windowsSources; int32_t iii = m_windowsSources;
if (iii < m_subWidget[m_currentCreateId].Size()) { if (iii < m_subWidget.Size()) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y); m_subWidget[iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y);
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
} }
} }
iii = m_windowsDestination; iii = m_windowsDestination;
if (iii < m_subWidget[m_currentCreateId].Size()) { if (iii < m_subWidget.Size()) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.y); m_subWidget[iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.y);
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
} }
} }
} }
@ -91,16 +91,16 @@ bool ewol::WSlider::CalculateMinSize(void)
m_underExpend.y=false; m_underExpend.y=false;
m_minSize.x = 0.0; m_minSize.x = 0.0;
m_minSize.y = 0.0; m_minSize.y = 0.0;
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->CalculateMinSize(); m_subWidget[iii]->CalculateMinSize();
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpentX()) {
m_underExpend.x = true; m_underExpend.x = true;
} }
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpentY()) {
m_underExpend.y = true; m_underExpend.y = true;
} }
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
m_minSize.x = etk_max(tmpSize.x, m_minSize.x); m_minSize.x = etk_max(tmpSize.x, m_minSize.x);
m_minSize.y = etk_max(tmpSize.y, m_minSize.y); m_minSize.y = etk_max(tmpSize.y, m_minSize.y);
} }
@ -144,11 +144,11 @@ void ewol::WSlider::LockExpendContamination(bool lockExpend)
void ewol::WSlider::SubWidgetRemoveAll(void) void ewol::WSlider::SubWidgetRemoveAll(void)
{ {
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
} }
m_subWidget[m_currentCreateId].Clear(); m_subWidget.Clear();
} }
@ -157,7 +157,7 @@ void ewol::WSlider::SubWidgetAdd(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
m_subWidget[m_currentCreateId].PushBack(newWidget); m_subWidget.PushBack(newWidget);
MarkToReedraw(); MarkToReedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
} }
@ -168,11 +168,11 @@ void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->MarkToRemove(); m_subWidget[iii]->MarkToRemove();
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
MarkToReedraw(); MarkToReedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
return; return;
@ -185,10 +185,10 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
if (NULL == newWidget) { if (NULL == newWidget) {
return; return;
} }
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (newWidget == m_subWidget[m_currentCreateId][iii]) { if (newWidget == m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
MarkToReedraw(); MarkToReedraw();
return; return;
@ -198,7 +198,7 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
void ewol::WSlider::SubWidgetSelectSet(int32_t id) void ewol::WSlider::SubWidgetSelectSet(int32_t id)
{ {
if (id<0 || id > m_subWidget[m_currentCreateId].Size()) { if (id<0 || id > m_subWidget.Size()) {
EWOL_ERROR("Can not change to a widget not present"); EWOL_ERROR("Can not change to a widget not present");
} }
m_windowsDestination = id; m_windowsDestination = id;
@ -232,29 +232,29 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp)
if (m_windowsDestination == m_windowsSources) { if (m_windowsDestination == m_windowsSources) {
//EWOL_DEBUG("Draw : " << m_windowsDestination); //EWOL_DEBUG("Draw : " << m_windowsDestination);
int32_t iii = m_windowsDestination; int32_t iii = m_windowsDestination;
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) { if (iii<0 || iii > m_subWidget.Size()) {
return; return;
} }
if (NULL != m_subWidget[m_currentDrawId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); m_subWidget[iii]->GenDraw(displayProp);
} }
} else { } else {
//EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) ); //EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) );
// draw Sources : // draw Sources :
int32_t iii = m_windowsSources; int32_t iii = m_windowsSources;
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) { if (iii<0 || iii > m_subWidget.Size()) {
return; return;
} }
if (NULL != m_subWidget[m_currentDrawId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); m_subWidget[iii]->GenDraw(displayProp);
} }
// Draw Destination : // Draw Destination :
iii = m_windowsDestination; iii = m_windowsDestination;
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) { if (iii<0 || iii > m_subWidget.Size()) {
return; return;
} }
if (NULL != m_subWidget[m_currentDrawId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); m_subWidget[iii]->GenDraw(displayProp);
} }
} }
} }
@ -265,26 +265,26 @@ void ewol::WSlider::OnRegenerateDisplay(void)
{ {
if (m_windowsDestination == m_windowsSources) { if (m_windowsDestination == m_windowsSources) {
int32_t iii = m_windowsDestination; int32_t iii = m_windowsDestination;
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) { if (iii<0 || iii > m_subWidget.Size()) {
return; return;
} }
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); m_subWidget[iii]->OnRegenerateDisplay();
} }
} else { } else {
int32_t iii = m_windowsSources; int32_t iii = m_windowsSources;
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) { if (iii<0 || iii > m_subWidget.Size()) {
return; return;
} }
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); m_subWidget[iii]->OnRegenerateDisplay();
} }
iii = m_windowsDestination; iii = m_windowsDestination;
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) { if (iii<0 || iii > m_subWidget.Size()) {
return; return;
} }
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); m_subWidget[iii]->OnRegenerateDisplay();
} }
} }
} }
@ -299,19 +299,19 @@ void ewol::WSlider::OnRegenerateDisplay(void)
ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D<float> pos) ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D<float> pos)
{ {
// TODO : Review this ... // TODO : Review this ...
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].Size()) { if (m_windowsDestination<0 || m_windowsDestination > m_subWidget.Size()) {
// error ... // error ...
return NULL; return NULL;
} }
int32_t iii = m_windowsDestination; int32_t iii = m_windowsDestination;
if (NULL != m_subWidget[m_currentCreateId][iii]) { if (NULL != m_subWidget[iii]) {
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
{ {
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos); ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
if (NULL != tmpWidget) { if (NULL != tmpWidget) {
return tmpWidget; return tmpWidget;
} }
@ -322,30 +322,6 @@ ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D<float> pos)
} }
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
void ewol::WSlider::OnFlipFlopEvent(void)
{
bool needFlipFlop = m_needFlipFlop;
// call herited classes
ewol::Widget::OnFlipFlopEvent();
// internal saving
if (true == needFlipFlop) {
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
}
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentDrawId].Size()) {
// error ...
return;
}
if(NULL != m_subWidget[m_currentDrawId][m_windowsDestination]) {
m_subWidget[m_currentDrawId][m_windowsDestination]->OnFlipFlopEvent();
}
}
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
@ -357,12 +333,11 @@ void ewol::WSlider::OnObjectRemove(ewol::EObject * removeObject)
// First step call parrent : // First step call parrent :
ewol::Widget::OnObjectRemove(removeObject); ewol::Widget::OnObjectRemove(removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if(m_subWidget[m_currentCreateId][iii] == removeObject) { if(m_subWidget[iii] == removeObject) {
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget[m_currentCreateId].Erase(iii); m_subWidget.Erase(iii);
m_needFlipFlop = true;
} }
} }
} }

View File

@ -53,7 +53,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER]; etk::VectorType<ewol::Widget*> m_subWidget;
int32_t m_windowsSources; // widget source viewed int32_t m_windowsSources; // widget source viewed
int32_t m_windowsDestination; // widget destinated viewed int32_t m_windowsDestination; // widget destinated viewed
int32_t m_slidingProgress; // ratio progression of a sliding int32_t m_slidingProgress; // ratio progression of a sliding
@ -64,7 +64,7 @@ namespace ewol {
virtual void SubWidgetUnLink(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget);
void SubWidgetSelectSet(int32_t id); void SubWidgetSelectSet(int32_t id);
int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; }; int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; };
int32_t SubWidgetNumber(void) { return m_subWidget[m_currentCreateId].Size(); }; int32_t SubWidgetNumber(void) { return m_subWidget.Size(); };
protected: protected:
virtual void OnDraw(DrawProperty& displayProp); virtual void OnDraw(DrawProperty& displayProp);
public: public:
@ -77,12 +77,6 @@ namespace ewol {
* @return pointer on the widget found * @return pointer on the widget found
*/ */
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
/**
* @brief Event generated to inform a flip-flop has occured on the current widget
* @param ---
* @return ---
*/
virtual void OnFlipFlopEvent(void);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject

View File

@ -311,29 +311,28 @@ void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos)
EWOL_ERROR("Try to add an empty object in the Widget generic display system"); EWOL_ERROR("Try to add an empty object in the Widget generic display system");
return; return;
} }
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) { if (pos < 0 || pos >= m_listOObject.Size() ) {
m_listOObject[m_currentCreateId].PushBack(newObject); m_listOObject.PushBack(newObject);
} else { } else {
m_listOObject[m_currentCreateId].Insert(pos, newObject); m_listOObject.Insert(pos, newObject);
} }
m_needFlipFlop = true;
} }
void ewol::WidgetScrooled::ClearOObjectList(void) void ewol::WidgetScrooled::ClearOObjectList(void)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
delete(m_listOObject[m_currentCreateId][iii]); delete(m_listOObject[iii]);
m_listOObject[m_currentCreateId][iii] = NULL; m_listOObject[iii] = NULL;
} }
m_listOObject[m_currentCreateId].Clear(); m_listOObject.Clear();
} }
void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp) void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
if (NULL != m_listOObject[m_currentDrawId][iii]) { if (NULL != m_listOObject[iii]) {
m_listOObject[m_currentDrawId][iii]->Draw(); m_listOObject[iii]->Draw();
} }
} }
} }

View File

@ -47,7 +47,7 @@ namespace ewol {
class WidgetScrooled : public ewol::Widget class WidgetScrooled : public ewol::Widget
{ {
private: private:
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display...
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);
protected: protected:

View File

@ -220,23 +220,18 @@ void ewol::ColorChooser::OnObjectRemove(ewol::EObject * removeObject)
// second step find if in all the elements ... // second step find if in all the elements ...
if(removeObject == m_widgetRed) { if(removeObject == m_widgetRed) {
m_widgetRed = NULL; m_widgetRed = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetGreen) { if(removeObject == m_widgetGreen) {
m_widgetGreen = NULL; m_widgetGreen = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetBlue) { if(removeObject == m_widgetBlue) {
m_widgetBlue = NULL; m_widgetBlue = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetAlpha) { if(removeObject == m_widgetAlpha) {
m_widgetAlpha = NULL; m_widgetAlpha = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetColorBar) { if(removeObject == m_widgetColorBar) {
m_widgetColorBar = NULL; m_widgetColorBar = NULL;
m_needFlipFlop = true;
} }
} }

View File

@ -442,35 +442,27 @@ void ewol::FileChooser::OnObjectRemove(ewol::EObject * removeObject)
// second step find if in all the elements ... // second step find if in all the elements ...
if(removeObject == m_widgetTitle) { if(removeObject == m_widgetTitle) {
m_widgetTitle = NULL; m_widgetTitle = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetValidate) { if(removeObject == m_widgetValidate) {
m_widgetValidate = NULL; m_widgetValidate = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetCancel) { if(removeObject == m_widgetCancel) {
m_widgetCancel = NULL; m_widgetCancel = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetCurrentFolder) { if(removeObject == m_widgetCurrentFolder) {
m_widgetCurrentFolder = NULL; m_widgetCurrentFolder = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetCurrentFileName) { if(removeObject == m_widgetCurrentFileName) {
m_widgetCurrentFileName = NULL; m_widgetCurrentFileName = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetListFolder) { if(removeObject == m_widgetListFolder) {
m_widgetListFolder = NULL; m_widgetListFolder = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetListFile) { if(removeObject == m_widgetListFile) {
m_widgetListFile = NULL; m_widgetListFile = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetCheckBox) { if(removeObject == m_widgetCheckBox) {
m_widgetCheckBox = NULL; m_widgetCheckBox = NULL;
m_needFlipFlop = true;
} }
} }

View File

@ -165,7 +165,6 @@ ewol::Parameter::Parameter(void) :
} }
} }
MarkToReedraw(); MarkToReedraw();
//m_needFlipFlop = true;
} }
@ -227,19 +226,15 @@ void ewol::Parameter::OnObjectRemove(ewol::EObject * removeObject)
// second step find if in all the elements ... // second step find if in all the elements ...
if(removeObject == m_widgetTitle) { if(removeObject == m_widgetTitle) {
m_widgetTitle = NULL; m_widgetTitle = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_paramList) { if(removeObject == m_paramList) {
m_paramList = NULL; m_paramList = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_widgetCancel) { if(removeObject == m_widgetCancel) {
m_widgetCancel = NULL; m_widgetCancel = NULL;
m_needFlipFlop = true;
} }
if(removeObject == m_wSlider) { if(removeObject == m_wSlider) {
m_wSlider = NULL; m_wSlider = NULL;
m_needFlipFlop = true;
} }
} }

View File

@ -57,13 +57,11 @@ ewol::ParameterList::ParameterList(void)
ewol::ParameterList::~ParameterList(void) ewol::ParameterList::~ParameterList(void)
{ {
//clean all the object //clean all the object
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) { delete(m_listOObject[iii]);
delete(m_listOObject[jjj][iii]); m_listOObject[iii] = NULL;
m_listOObject[jjj][iii] = NULL;
}
m_listOObject[jjj].Clear();
} }
m_listOObject.Clear();
MenuClear(); MenuClear();
} }
@ -88,29 +86,28 @@ void ewol::ParameterList::AddOObject(ewol::OObject* newObject, int32_t pos)
EWOL_ERROR("Try to add an empty object in the Widget generic display system"); EWOL_ERROR("Try to add an empty object in the Widget generic display system");
return; return;
} }
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) { if (pos < 0 || pos >= m_listOObject.Size() ) {
m_listOObject[m_currentCreateId].PushBack(newObject); m_listOObject.PushBack(newObject);
} else { } else {
m_listOObject[m_currentCreateId].Insert(pos, newObject); m_listOObject.Insert(pos, newObject);
} }
m_needFlipFlop = true;
} }
void ewol::ParameterList::ClearOObjectList(void) void ewol::ParameterList::ClearOObjectList(void)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
delete(m_listOObject[m_currentCreateId][iii]); delete(m_listOObject[iii]);
m_listOObject[m_currentCreateId][iii] = NULL; m_listOObject[iii] = NULL;
} }
m_listOObject[m_currentCreateId].Clear(); m_listOObject.Clear();
} }
void ewol::ParameterList::OnDraw(DrawProperty& displayProp) void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
{ {
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) { for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
if (NULL != m_listOObject[m_currentDrawId][iii]) { if (NULL != m_listOObject[iii]) {
m_listOObject[m_currentDrawId][iii]->Draw(); m_listOObject[iii]->Draw();
} }
} }
WidgetScrooled::OnDraw(displayProp); WidgetScrooled::OnDraw(displayProp);
@ -201,7 +198,6 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
// call the herited class... // call the herited class...
WidgetScrooled::OnRegenerateDisplay(); WidgetScrooled::OnRegenerateDisplay();
m_needFlipFlop = true;
} }
} }

View File

@ -70,7 +70,7 @@ namespace ewol {
void SetLabel(etk::UString newLabel); void SetLabel(etk::UString newLabel);
// Drawing capabilities .... // Drawing capabilities ....
private: private:
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);