Remove the double buffering system ...
This commit is contained in:
parent
de3cff6ad5
commit
665a350fa1
@ -134,7 +134,7 @@ namespace ewol {
|
||||
* @param[in,out] listOfEffects Reference on the list where the display must be done for every effects
|
||||
* @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
|
||||
* @param[in] idOfElement Id of the element that has been removed
|
||||
|
@ -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;
|
||||
tmpSprite = &m_sceneElement.animated[currentCreateId];
|
||||
tmpSprite = &m_sceneElement.animated;
|
||||
if (NULL != m_luaState) {
|
||||
// call the Draw function
|
||||
lua_getglobal(m_luaState, "Draw");
|
||||
|
@ -46,7 +46,7 @@ namespace ewol {
|
||||
virtual void Init(void);
|
||||
virtual void UnInit(void);
|
||||
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 Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
|
||||
virtual void Message(etk::UString control, etk::UString message);
|
||||
|
@ -80,15 +80,13 @@ ewol::SceneElement::~SceneElement(void)
|
||||
}
|
||||
listAnimatedElements[iii].Clear();
|
||||
}
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
for (int32_t jjj=0; jjj<animated[iii].Size(); jjj++) {
|
||||
if (NULL != animated[iii][jjj]) {
|
||||
delete(animated[iii][jjj]);
|
||||
animated[iii][jjj] = NULL;
|
||||
for (int32_t jjj=0; jjj<animated.Size(); jjj++) {
|
||||
if (NULL != animated[jjj]) {
|
||||
delete(animated[jjj]);
|
||||
animated[jjj] = NULL;
|
||||
}
|
||||
}
|
||||
animated[iii].Clear();
|
||||
}
|
||||
animated.Clear();
|
||||
}
|
||||
|
||||
void ewol::SceneElement::RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString)
|
||||
@ -324,16 +322,15 @@ void ewol::SceneElement::SetEventExternJoystick(uint32_t id, int32_t joyId, floa
|
||||
*/
|
||||
int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
|
||||
{
|
||||
for (int32_t iii=0; iii<animated[0].Size(); iii++) {
|
||||
if (animated[0][iii] != NULL) {
|
||||
if (animated[0][iii]->HasName(fileName) == true) {
|
||||
for (int32_t iii=0; iii<animated.Size(); iii++) {
|
||||
if (animated[iii] != NULL) {
|
||||
if (animated[iii]->HasName(fileName) == true) {
|
||||
// count the number of element registered ...
|
||||
animated[0][iii]->IncreaseLoadedTime();
|
||||
animated[iii]->IncreaseLoadedTime();
|
||||
return iii;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
// we did not find the sprite ==> created it ...
|
||||
ewol::Sprite* tmpSprite = new ewol::Sprite(fileName, maxSize, maxSize);
|
||||
if (NULL == tmpSprite) {
|
||||
@ -341,9 +338,9 @@ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
|
||||
return -1;
|
||||
}
|
||||
// add it :
|
||||
animated[iii].PushBack(tmpSprite);
|
||||
}
|
||||
return animated[0].Size() -1;
|
||||
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)
|
||||
{
|
||||
if (spriteId >= 0 && spriteId < animated[0].Size()) {
|
||||
if (animated[0][spriteId] != NULL) {
|
||||
if (spriteId >= 0 && spriteId < animated.Size()) {
|
||||
if (animated[spriteId] != NULL) {
|
||||
// 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 ...
|
||||
// TODO : ==> for all double buffer ...
|
||||
for(int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
|
||||
}
|
||||
delete(animated[spriteId]);
|
||||
animated[spriteId] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace ewol {
|
||||
int32_t numberOfGroup; //!< curent scene number of group
|
||||
etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups
|
||||
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*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free
|
||||
etk::VectorType<listRegisteElement*> listCreatorElement; //!< list of all creatable elements
|
||||
|
@ -84,9 +84,6 @@ ewol::Widget::Widget(void)
|
||||
{
|
||||
m_limitMouseEvent = 3;
|
||||
m_needRegenerateDisplay = true;
|
||||
m_currentDrawId = 0;
|
||||
m_currentCreateId = 1;
|
||||
m_needFlipFlop = true;
|
||||
m_origin.x = 0.0;
|
||||
m_origin.y = 0.0;
|
||||
m_size.x = 10.0;
|
||||
@ -102,9 +99,7 @@ ewol::Widget::Widget(void)
|
||||
SetFillY();
|
||||
m_canFocus = false;
|
||||
m_hasFocus = false;
|
||||
for(int32_t iii=0 ; iii<NB_BOUBLE_BUFFER ; iii++) {
|
||||
m_hide[iii] = false;
|
||||
}
|
||||
m_hide = false;
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +110,7 @@ ewol::Widget::Widget(void)
|
||||
*/
|
||||
void ewol::Widget::Hide(void)
|
||||
{
|
||||
m_hide[m_currentCreateId] = true;
|
||||
m_hide = true;
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
}
|
||||
@ -128,7 +123,7 @@ void ewol::Widget::Hide(void)
|
||||
*/
|
||||
void ewol::Widget::Show(void)
|
||||
{
|
||||
m_hide[m_currentCreateId] = false;
|
||||
m_hide = false;
|
||||
MarkToReedraw();
|
||||
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
|
||||
* @param ---
|
||||
@ -255,7 +225,7 @@ void ewol::Widget::KeepFocus(void)
|
||||
*/
|
||||
void ewol::Widget::GenDraw(DrawProperty displayProp)
|
||||
{
|
||||
if (true==m_hide[m_currentDrawId]){
|
||||
if (true==m_hide){
|
||||
// widget is hidden ...
|
||||
return;
|
||||
}
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include <ewol/EObject.h>
|
||||
|
||||
#define NB_BOUBLE_BUFFER (1)
|
||||
|
||||
namespace ewol {
|
||||
class Widget;
|
||||
};
|
||||
@ -142,7 +140,7 @@ namespace ewol {
|
||||
// -- Widget Size:
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
private:
|
||||
bool m_hide[NB_BOUBLE_BUFFER]; //!< hide a widget on the display
|
||||
bool m_hide; //!< hide a widget on the display
|
||||
protected:
|
||||
// internal element calculated by the system
|
||||
Vector2D<float> m_origin; //!< internal ... I do not really known how i can use it ...
|
||||
@ -277,7 +275,7 @@ namespace ewol {
|
||||
* @param ---
|
||||
* @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...
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
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
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
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:
|
||||
/**
|
||||
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
|
||||
@ -478,10 +460,7 @@ namespace ewol {
|
||||
|
||||
}; // end of the class Widget declaration
|
||||
|
||||
extern const char * const TYPE_EOBJECT_WIDGET;
|
||||
|
||||
};// end of namespace
|
||||
|
||||
#define EWOL_CAST_WIDGET(curentPointer) EWOL_CAST(ewol::TYPE_EOBJECT_WIDGET,ewol::Widget,curentPointer)
|
||||
|
||||
#endif
|
||||
|
@ -47,27 +47,25 @@ extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKey
|
||||
ewol::Windows::Windows(void)
|
||||
{
|
||||
SetCanHaveFocus(true);
|
||||
for(int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_subWidget[iii] = NULL;
|
||||
}
|
||||
m_subWidget = NULL;
|
||||
SetDecorationDisable();
|
||||
//KeyboardShow(KEYBOARD_MODE_CODE);
|
||||
}
|
||||
|
||||
ewol::Windows::~Windows(void)
|
||||
{
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId]=NULL;
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->MarkToRemove();
|
||||
m_subWidget=NULL;
|
||||
}
|
||||
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||
m_popUpWidgetList[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_popUpWidgetList[m_currentCreateId][iii]=NULL;
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[iii]) {
|
||||
m_popUpWidgetList[iii]->MarkToRemove();
|
||||
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);
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->CalculateMinSize();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
// TODO : Check if min Size is possible ...
|
||||
// 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++) {
|
||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||
m_popUpWidgetList[m_currentCreateId][iii]->CalculateMinSize();
|
||||
m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[iii]) {
|
||||
m_popUpWidgetList[iii]->CalculateMinSize();
|
||||
m_popUpWidgetList[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -102,15 +100,15 @@ ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D<float> pos)
|
||||
// calculate relative position
|
||||
Vector2D<float> relativePos = RelativePosition(pos);
|
||||
// event go directly on the pop-up
|
||||
if (0 < m_popUpWidgetList[m_currentCreateId].Size()) {
|
||||
if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) {
|
||||
m_popUpWidgetList[m_currentCreateId].PopBack();
|
||||
if (0 < m_popUpWidgetList.Size()) {
|
||||
if (NULL == m_popUpWidgetList[m_popUpWidgetList.Size()-1]) {
|
||||
m_popUpWidgetList.PopBack();
|
||||
} 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
|
||||
} else if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos);
|
||||
} else if (NULL != m_subWidget) {
|
||||
return m_subWidget->GetWidgetAtPos(pos);
|
||||
}
|
||||
// otherwise the event go to this widget ...
|
||||
return this;
|
||||
@ -140,12 +138,12 @@ void ewol::Windows::SysDraw(void)
|
||||
|
||||
void ewol::Windows::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
}
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||
m_popUpWidgetList[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[iii]) {
|
||||
m_popUpWidgetList[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -160,14 +158,14 @@ void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
|
||||
|
||||
//EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId);
|
||||
// first display the windows on the display
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw(displayProp);
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->GenDraw(displayProp);
|
||||
//EWOL_DEBUG("Draw Windows");
|
||||
}
|
||||
// second display the pop-up
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
||||
m_popUpWidgetList[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[iii]) {
|
||||
m_popUpWidgetList[iii]->GenDraw(displayProp);
|
||||
//EWOL_DEBUG("Draw Pop-up");
|
||||
}
|
||||
}
|
||||
@ -177,54 +175,25 @@ void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
|
||||
|
||||
void ewol::Windows::SetSubWidget(ewol::Widget * widget)
|
||||
{
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
if (NULL != m_subWidget) {
|
||||
EWOL_INFO("Remove current main windows Widget...");
|
||||
m_subWidget[m_currentCreateId]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
m_subWidget->MarkToRemove();
|
||||
m_subWidget = NULL;
|
||||
}
|
||||
m_subWidget[m_currentCreateId] = widget;
|
||||
m_subWidget = widget;
|
||||
// Regenerate the size calculation :
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
||||
{
|
||||
m_popUpWidgetList[m_currentCreateId].PushBack(widget);
|
||||
m_popUpWidgetList.PushBack(widget);
|
||||
// Regenerate the size calculation :
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
m_needFlipFlop = true;
|
||||
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 ...
|
||||
* @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);
|
||||
// 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");
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
m_needFlipFlop = true;
|
||||
m_subWidget = NULL;
|
||||
}
|
||||
for(int32_t iii=m_popUpWidgetList[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_popUpWidgetList[m_currentCreateId][iii] == removeObject) {
|
||||
for(int32_t iii=m_popUpWidgetList.Size()-1; iii>=0; iii--) {
|
||||
if(m_popUpWidgetList[iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object");
|
||||
m_popUpWidgetList[m_currentCreateId][iii] = NULL;
|
||||
m_popUpWidgetList[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
m_popUpWidgetList[iii] = NULL;
|
||||
m_popUpWidgetList.Erase(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ namespace ewol {
|
||||
m_hasDecoration = true;
|
||||
}
|
||||
private:
|
||||
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
||||
etk::VectorType<ewol::Widget*> m_popUpWidgetList[NB_BOUBLE_BUFFER];
|
||||
ewol::Widget* m_subWidget;
|
||||
etk::VectorType<ewol::Widget*> m_popUpWidgetList;
|
||||
public:
|
||||
void SetSubWidget(ewol::Widget * widget);
|
||||
void PopUpWidgetPush(ewol::Widget * widget);
|
||||
@ -88,12 +88,6 @@ namespace ewol {
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
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 ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
|
@ -81,8 +81,6 @@ void EWOL_NativeRegenerateDisplay(void)
|
||||
gui_uniqueWindows->OnRegenerateDisplay();
|
||||
// Keep Inter-thread-lock-mutex
|
||||
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
|
||||
ewol::widgetManager::SetDoubleBufferNeedDraw();
|
||||
// Release Inter-thread-lock-mutex
|
||||
|
@ -55,12 +55,10 @@ ewol::ButtonImage::ButtonImage(etk::UString imageName, color_ts col)
|
||||
m_value = false;
|
||||
m_image = imageName;
|
||||
m_color = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_OOImage[iii] = NULL;
|
||||
m_OOImageBg1[iii] = NULL;
|
||||
m_OOImageBG2[iii] = NULL;
|
||||
m_resetNeeded[iii] = false;
|
||||
}
|
||||
m_OOImage = NULL;
|
||||
m_OOImageBg1 = NULL;
|
||||
m_OOImageBG2 = NULL;
|
||||
m_resetNeeded = false;
|
||||
m_toggleMode = false;
|
||||
}
|
||||
|
||||
@ -74,9 +72,7 @@ void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col)
|
||||
{
|
||||
m_image = imageName;
|
||||
m_color = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_resetNeeded[iii] = true;
|
||||
}
|
||||
m_resetNeeded = true;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
@ -84,9 +80,7 @@ void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col)
|
||||
{
|
||||
m_imageBg1 = imageName;
|
||||
m_colorBg1 = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_resetNeeded[iii] = true;
|
||||
}
|
||||
m_resetNeeded = true;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
@ -94,9 +88,7 @@ void ewol::ButtonImage::SetImageSelected(etk::UString imageName, color_ts col)
|
||||
{
|
||||
m_imageBg2 = imageName;
|
||||
m_colorBg2 = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_resetNeeded[iii] = true;
|
||||
}
|
||||
m_resetNeeded = true;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
@ -147,28 +139,28 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
|
||||
if (NULL == m_OOImageBG2[m_currentCreateId]) {
|
||||
if (NULL == m_OOImageBG2) {
|
||||
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 != "") {
|
||||
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 != "") {
|
||||
m_OOImage[m_currentCreateId] = new ewol::OObject2DTextured(m_image, tmpSizeX, tmpSizeY);
|
||||
m_OOImage = new ewol::OObject2DTextured(m_image, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
}
|
||||
if (false == m_toggleMode) {
|
||||
float tmpval = 0.0;
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Clear();
|
||||
if (NULL != m_OOImageBG2) {
|
||||
m_OOImageBG2->Clear();
|
||||
if( m_down == true
|
||||
|| m_over == true ) {
|
||||
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
m_OOImageBG2->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
tmpval = tmpSizeX * 0.2;
|
||||
tmpSizeX -= tmpval;
|
||||
@ -177,9 +169,9 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
|
||||
tmpSizeY -= tmpval;
|
||||
tmpOriginY += tmpval/2;
|
||||
}
|
||||
if (NULL != m_OOImageBg1[m_currentCreateId]) {
|
||||
m_OOImageBg1[m_currentCreateId]->Clear();
|
||||
m_OOImageBg1[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
if (NULL != m_OOImageBg1) {
|
||||
m_OOImageBg1->Clear();
|
||||
m_OOImageBg1->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpval = tmpSizeX * 0.2;
|
||||
tmpSizeX -= tmpval;
|
||||
tmpOriginX += tmpval/2;
|
||||
@ -187,28 +179,27 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
|
||||
tmpSizeY -= tmpval;
|
||||
tmpOriginY += tmpval/2;
|
||||
}
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Clear();
|
||||
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
if (NULL != m_OOImage) {
|
||||
m_OOImage->Clear();
|
||||
m_OOImage->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
} else {
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Clear();
|
||||
if (NULL != m_OOImage) {
|
||||
m_OOImage->Clear();
|
||||
}
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Clear();
|
||||
if (NULL != m_OOImageBG2) {
|
||||
m_OOImageBG2->Clear();
|
||||
}
|
||||
if(m_value == true) {
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_color);
|
||||
if (NULL != m_OOImage) {
|
||||
m_OOImage->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_color);
|
||||
}
|
||||
} else {
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_colorBg2);
|
||||
if (NULL != m_OOImageBG2) {
|
||||
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)
|
||||
{
|
||||
if (NULL != m_OOImageBG2[m_currentDrawId]) {
|
||||
m_OOImageBG2[m_currentDrawId]->Draw();
|
||||
if (NULL != m_OOImageBG2) {
|
||||
m_OOImageBG2->Draw();
|
||||
}
|
||||
if (NULL != m_OOImageBg1[m_currentDrawId]) {
|
||||
m_OOImageBg1[m_currentDrawId]->Draw();
|
||||
if (NULL != m_OOImageBg1) {
|
||||
m_OOImageBg1->Draw();
|
||||
}
|
||||
if (NULL != m_OOImage[m_currentDrawId]) {
|
||||
m_OOImage[m_currentDrawId]->Draw();
|
||||
if (NULL != m_OOImage) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,16 +53,16 @@ namespace ewol {
|
||||
bool GetToggleMode(void);
|
||||
private:
|
||||
etk::UString m_image;
|
||||
bool m_resetNeeded[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextured* m_OOImage[NB_BOUBLE_BUFFER];
|
||||
bool m_resetNeeded;
|
||||
ewol::OObject2DTextured* m_OOImage;
|
||||
color_ts m_color;
|
||||
|
||||
etk::UString m_imageBg1;
|
||||
ewol::OObject2DTextured* m_OOImageBg1[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextured* m_OOImageBg1;
|
||||
color_ts m_colorBg1;
|
||||
|
||||
etk::UString m_imageBg2;
|
||||
ewol::OObject2DTextured* m_OOImageBG2[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextured* m_OOImageBG2;
|
||||
color_ts m_colorBg2;
|
||||
|
||||
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 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);
|
||||
};
|
||||
|
||||
|
@ -63,14 +63,14 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY)
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> subWidgetSize;
|
||||
Vector2D<float> subWidgetOrigin;
|
||||
subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId]->CanExpentX()) {
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId]->CanExpentY()) {
|
||||
if (true == m_subWidget->CanExpentY()) {
|
||||
subWidgetSize.y = m_size.y;
|
||||
}
|
||||
int32_t minWidth = 100;
|
||||
@ -123,8 +123,8 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY)
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_subWidget[m_currentCreateId]->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
||||
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
@ -138,9 +138,9 @@ bool ewol::ContextMenu::CalculateMinSize(void)
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 50.0;
|
||||
m_minSize.y = 50.0;
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->CalculateMinSize();
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetMinSize();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
Vector2D<float> tmpSize = m_subWidget->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
}
|
||||
@ -170,15 +170,15 @@ void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget)
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
m_subWidget[m_currentCreateId] = newWidget;
|
||||
m_subWidget = newWidget;
|
||||
}
|
||||
|
||||
|
||||
void ewol::ContextMenu::SubWidgetRemove(void)
|
||||
{
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->MarkToRemove();
|
||||
m_subWidget = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ void ewol::ContextMenu::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
//EWOL_DEBUG("On Draw " << m_currentDrawId);
|
||||
ewol::Drawable::OnDraw(displayProp);
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw(displayProp);
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,9 +201,9 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
AddOObject(BGOObjects);
|
||||
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
|
||||
// display border ...
|
||||
BGOObjects->SetColor(m_colorBorder);
|
||||
@ -245,8 +245,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
|
||||
BGOObjects->SetColor(m_colorBackGroung);
|
||||
BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y);
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,13 +262,13 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D<float> pos)
|
||||
// calculate relative position
|
||||
Vector2D<float> relativePos = RelativePosition(pos);
|
||||
// Check for sub Element
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
|
||||
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
|
||||
{
|
||||
return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos);
|
||||
return m_subWidget->GetWidgetAtPos(pos);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
@ -312,24 +312,3 @@ void ewol::ContextMenu::SetPositionMark(markPosition_te position, Vector2D<float
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace ewol {
|
||||
Vector2D<float> m_arrowPos;
|
||||
float m_offset;
|
||||
markPosition_te m_arrawBorder;
|
||||
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
||||
ewol::Widget* m_subWidget;
|
||||
public:
|
||||
void SubWidgetSet(ewol::Widget* newWidget);
|
||||
void SubWidgetRemove(void);
|
||||
@ -90,12 +90,6 @@ namespace ewol {
|
||||
* @return false the event is not used
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -33,13 +33,12 @@ ewol::Drawable::Drawable(void)
|
||||
ewol::Drawable::~Drawable(void)
|
||||
{
|
||||
//clean all the object
|
||||
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
||||
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) {
|
||||
delete(m_listOObject[jjj][iii]);
|
||||
m_listOObject[jjj][iii] = NULL;
|
||||
}
|
||||
m_listOObject[jjj].Clear();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
||||
if (pos < 0 || pos >= m_listOObject.Size() ) {
|
||||
m_listOObject.PushBack(newObject);
|
||||
} else {
|
||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
||||
m_listOObject.Insert(pos, newObject);
|
||||
}
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::Drawable::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
||||
delete(m_listOObject[m_currentCreateId][iii]);
|
||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::Drawable::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
m_listOObject[iii]->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace ewol {
|
||||
virtual const char * const GetObjectType(void) { return "EwolDrawable"; };
|
||||
|
||||
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:
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
|
@ -48,10 +48,10 @@ bool ewol::Layer::CalculateSize(float availlableX, float availlableY)
|
||||
//EWOL_DEBUG("Update Size");
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
}
|
||||
}
|
||||
MarkToReedraw();
|
||||
@ -65,16 +65,16 @@ bool ewol::Layer::CalculateMinSize(void)
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_userExpendX = true;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
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.y = etk_max(tmpSize.y, m_minSize.y);
|
||||
}
|
||||
@ -122,11 +122,11 @@ void ewol::Layer::LockExpendContamination(bool lockExpend)
|
||||
|
||||
void ewol::Layer::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
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) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -159,10 +159,10 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -172,9 +172,9 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
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
|
||||
for (int32_t iii=m_subWidget[m_currentDrawId].Size()-1; iii>=0; iii--) {
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
for (int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,9 +183,9 @@ void ewol::Layer::OnDraw(DrawProperty& displayProp)
|
||||
|
||||
void ewol::Layer::OnRegenerateDisplay(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,14 +200,14 @@ void ewol::Layer::OnRegenerateDisplay(void)
|
||||
ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D<float> pos)
|
||||
{
|
||||
// for all element in the sizer ...
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos);
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != 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 ...
|
||||
@ -253,12 +231,11 @@ void ewol::Layer::OnObjectRemove(ewol::EObject * removeObject)
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace ewol {
|
||||
void LockExpendContamination(bool lockExpend=false);
|
||||
private:
|
||||
bool m_lockExpendContamination;
|
||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||
etk::VectorType<ewol::Widget*> m_subWidget;
|
||||
public:
|
||||
virtual void SubWidgetRemoveAll(void);
|
||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||
@ -71,12 +71,6 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
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 ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
|
@ -51,13 +51,11 @@ ewol::List::List(void)
|
||||
ewol::List::~List(void)
|
||||
{
|
||||
//clean all the object
|
||||
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
||||
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) {
|
||||
delete(m_listOObject[jjj][iii]);
|
||||
m_listOObject[jjj][iii] = NULL;
|
||||
}
|
||||
m_listOObject[jjj].Clear();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
||||
if (pos < 0 || pos >= m_listOObject.Size() ) {
|
||||
m_listOObject.PushBack(newObject);
|
||||
} else {
|
||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
||||
m_listOObject.Insert(pos, newObject);
|
||||
}
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::List::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
||||
delete(m_listOObject[m_currentCreateId][iii]);
|
||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::List::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
m_listOObject[iii]->Draw();
|
||||
}
|
||||
}
|
||||
WidgetScrooled::OnDraw(displayProp);
|
||||
@ -195,7 +192,6 @@ void ewol::List::OnRegenerateDisplay(void)
|
||||
|
||||
// call the herited class...
|
||||
WidgetScrooled::OnRegenerateDisplay();
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace ewol {
|
||||
void SetLabel(etk::UString newLabel);
|
||||
// Drawing capabilities ....
|
||||
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:
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
|
@ -44,9 +44,7 @@ ewol::PopUp::PopUp(void) :
|
||||
m_colorBorder = etk::color::color_Black;
|
||||
m_colorBorder.alpha = 0x7F;
|
||||
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_subWidget[iii] = 0;
|
||||
}
|
||||
m_subWidget = 0;
|
||||
}
|
||||
|
||||
ewol::PopUp::~PopUp(void)
|
||||
@ -62,14 +60,14 @@ bool ewol::PopUp::CalculateSize(float availlableX, float availlableY)
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> subWidgetSize;
|
||||
Vector2D<float> subWidgetOrigin;
|
||||
subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId]->CanExpentX()) {
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId]->CanExpentY()) {
|
||||
if (true == m_subWidget->CanExpentY()) {
|
||||
subWidgetSize.y = m_size.y;
|
||||
}
|
||||
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.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[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
@ -98,9 +96,9 @@ bool ewol::PopUp::CalculateMinSize(void)
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 50.0;
|
||||
m_minSize.y = 50.0;
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->CalculateMinSize();
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetMinSize();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
Vector2D<float> tmpSize = m_subWidget->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
}
|
||||
@ -132,29 +130,28 @@ void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget)
|
||||
return;
|
||||
}
|
||||
SubWidgetRemove();
|
||||
m_subWidget[m_currentCreateId] = newWidget;
|
||||
m_needFlipFlop = true;
|
||||
//EWOL_DEBUG("SetSubWidget on Pop-Up : " << (int64_t)m_subWidget[m_currentCreateId]);
|
||||
m_subWidget = newWidget;
|
||||
//EWOL_DEBUG("SetSubWidget on Pop-Up : " << (int64_t)m_subWidget);
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
|
||||
void ewol::PopUp::SubWidgetRemove(void)
|
||||
{
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->MarkToRemove();;
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->MarkToRemove();;
|
||||
m_subWidget = NULL;
|
||||
}
|
||||
m_needFlipFlop = true;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
|
||||
void ewol::PopUp::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
// draw upper classes
|
||||
ewol::Drawable::OnDraw(displayProp);
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw(displayProp);
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,16 +168,16 @@ void ewol::PopUp::OnRegenerateDisplay(void)
|
||||
BGOObjects->SetColor(m_colorEmptyArea);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
// set the area in white ...
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
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->SetColor(m_colorBackGroung);
|
||||
BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y);
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,13 +193,13 @@ ewol::Widget * ewol::PopUp::GetWidgetAtPos(Vector2D<float> pos)
|
||||
// calculate relative position
|
||||
Vector2D<float> relativePos = RelativePosition(pos);
|
||||
// for the element in the pop-up ...
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
|
||||
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
|
||||
{
|
||||
return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos);
|
||||
return m_subWidget->GetWidgetAtPos(pos);
|
||||
} else {
|
||||
//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 ...
|
||||
* @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 :
|
||||
ewol::Drawable::OnObjectRemove(removeObject);
|
||||
// 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");
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
m_needFlipFlop = true;
|
||||
m_subWidget = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace ewol {
|
||||
color_ts m_colorBorder;
|
||||
color_ts m_colorEmptyArea;
|
||||
ewol::Widget* m_subWidgetNext;
|
||||
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
||||
ewol::Widget* m_subWidget;
|
||||
float m_displayRatio;
|
||||
public:
|
||||
void SubWidgetSet(ewol::Widget* newWidget);
|
||||
@ -72,12 +72,6 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
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 ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
|
@ -63,20 +63,19 @@ void ewol::Scene::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
// clean elements
|
||||
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_sceneElement.animated[m_currentCreateId][iii]) {
|
||||
m_sceneElement.animated[m_currentCreateId][iii]->Clear();
|
||||
for (int32_t iii=0; iii<m_sceneElement.animated.Size(); iii++) {
|
||||
if (NULL != m_sceneElement.animated[iii]) {
|
||||
m_sceneElement.animated[iii]->Clear();
|
||||
}
|
||||
}
|
||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) {
|
||||
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
||||
// 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);
|
||||
// draw elements
|
||||
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_sceneElement.animated[m_currentDrawId][iii]) {
|
||||
m_sceneElement.animated[m_currentDrawId][iii]->Draw();
|
||||
for (int32_t iii=0; iii<m_sceneElement.animated.Size(); iii++) {
|
||||
if (NULL != m_sceneElement.animated[iii]) {
|
||||
m_sceneElement.animated[iii]->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY)
|
||||
float unexpendableSize=0.0;
|
||||
int32_t nbWidgetFixedSize=0;
|
||||
int32_t nbWidgetNotFixedSize=0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
unexpendableSize += tmpSize.x;
|
||||
if (false == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
if (false == m_subWidget[iii]->CanExpentX()) {
|
||||
nbWidgetFixedSize++;
|
||||
} else {
|
||||
nbWidgetNotFixedSize++;
|
||||
@ -73,18 +73,18 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY)
|
||||
Vector2D<float> tmpOrigin;
|
||||
tmpOrigin.x = m_origin.x;
|
||||
tmpOrigin.y = m_origin.y;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
// Set the origin :
|
||||
//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:
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(tmpSize.x+sizeToAddAtEveryOne, m_size.y);
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_subWidget[iii]->CalculateSize(tmpSize.x+sizeToAddAtEveryOne, m_size.y);
|
||||
tmpOrigin.x += tmpSize.x+sizeToAddAtEveryOne;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -101,16 +101,16 @@ bool ewol::SizerHori::CalculateMinSize(void)
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_userExpendX = true;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
m_userExpendY = true;
|
||||
}
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
m_minSize.x += tmpSize.x;
|
||||
if (tmpSize.y>m_minSize.y) {
|
||||
m_minSize.y = tmpSize.y;
|
||||
@ -162,13 +162,13 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend)
|
||||
|
||||
void ewol::SizerHori::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
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) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
m_subWidget[iii] = NULL;
|
||||
}
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_subWidget.Erase(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -203,10 +203,10 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -215,9 +215,9 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
|
||||
void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,12 +225,11 @@ void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
||||
|
||||
void ewol::SizerHori::OnRegenerateDisplay(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
NeedFlipFlop();
|
||||
}
|
||||
|
||||
|
||||
@ -246,14 +245,14 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D<float> pos)
|
||||
return NULL;
|
||||
}
|
||||
// for all element in the sizer ...
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos);
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != 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 ...
|
||||
* @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 :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace ewol {
|
||||
void LockExpendContamination(bool lockExpend=false);
|
||||
private:
|
||||
bool m_lockExpendContamination;
|
||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||
etk::VectorType<ewol::Widget*> m_subWidget;
|
||||
public:
|
||||
virtual void SubWidgetRemoveAll(void);
|
||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||
@ -71,12 +71,6 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
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 ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
|
@ -52,11 +52,11 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY)
|
||||
float unexpendableSize=0.0;
|
||||
int32_t nbWidgetFixedSize=0;
|
||||
int32_t nbWidgetNotFixedSize=0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
unexpendableSize += tmpSize.y;
|
||||
if (false == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
if (false == m_subWidget[iii]->CanExpentY()) {
|
||||
nbWidgetFixedSize++;
|
||||
} else {
|
||||
nbWidgetNotFixedSize++;
|
||||
@ -75,18 +75,18 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY)
|
||||
Vector2D<float> tmpOrigin;
|
||||
tmpOrigin.x = m_origin.x;
|
||||
tmpOrigin.y = m_origin.y;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
// Set the origin :
|
||||
//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:
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, tmpSize.y+sizeToAddAtEveryOne);
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, tmpSize.y+sizeToAddAtEveryOne);
|
||||
tmpOrigin.y += tmpSize.y+sizeToAddAtEveryOne;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -103,16 +103,16 @@ bool ewol::SizerVert::CalculateMinSize(void)
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_userExpendX = true;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
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 << ")");
|
||||
m_minSize.y += tmpSize.y;
|
||||
if (tmpSize.x>m_minSize.x) {
|
||||
@ -165,11 +165,11 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend)
|
||||
|
||||
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
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) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -202,10 +202,10 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -214,9 +214,9 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
|
||||
void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,12 +225,11 @@ void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
||||
|
||||
void ewol::SizerVert::OnRegenerateDisplay(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
NeedFlipFlop();
|
||||
}
|
||||
|
||||
|
||||
@ -246,14 +245,14 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D<float> pos)
|
||||
return NULL;
|
||||
}
|
||||
// for all element in the sizer ...
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos);
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != 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 ...
|
||||
* @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 :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace ewol {
|
||||
void LockExpendContamination(bool lockExpend=false);
|
||||
private:
|
||||
bool m_lockExpendContamination;
|
||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||
etk::VectorType<ewol::Widget*> m_subWidget;
|
||||
public:
|
||||
virtual void SubWidgetRemoveAll(void);
|
||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||
@ -71,12 +71,6 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
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 ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
|
@ -57,25 +57,25 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY)
|
||||
|
||||
if (m_windowsDestination == m_windowsSources) {
|
||||
int32_t iii = m_windowsDestination;
|
||||
if (iii < m_subWidget[m_currentCreateId].Size()) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||
if (iii < m_subWidget.Size()) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int32_t iii = m_windowsSources;
|
||||
if (iii < m_subWidget[m_currentCreateId].Size()) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][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);
|
||||
if (iii < m_subWidget.Size()) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
}
|
||||
}
|
||||
iii = m_windowsDestination;
|
||||
if (iii < m_subWidget[m_currentCreateId].Size()) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][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[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||
if (iii < m_subWidget.Size()) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.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_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_underExpend.x = true;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
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.y = etk_max(tmpSize.y, m_minSize.y);
|
||||
}
|
||||
@ -144,11 +144,11 @@ void ewol::WSlider::LockExpendContamination(bool lockExpend)
|
||||
|
||||
void ewol::WSlider::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
||||
m_subWidget.PushBack(newWidget);
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
}
|
||||
@ -168,11 +168,11 @@ void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii]->MarkToRemove();
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
return;
|
||||
@ -185,10 +185,10 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (newWidget == m_subWidget[iii]) {
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
ewol::RequestUpdateSize();
|
||||
MarkToReedraw();
|
||||
return;
|
||||
@ -198,7 +198,7 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
|
||||
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");
|
||||
}
|
||||
m_windowsDestination = id;
|
||||
@ -232,29 +232,29 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp)
|
||||
if (m_windowsDestination == m_windowsSources) {
|
||||
//EWOL_DEBUG("Draw : " << m_windowsDestination);
|
||||
int32_t iii = m_windowsDestination;
|
||||
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) {
|
||||
if (iii<0 || iii > m_subWidget.Size()) {
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->GenDraw(displayProp);
|
||||
}
|
||||
} else {
|
||||
//EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) );
|
||||
// draw Sources :
|
||||
int32_t iii = m_windowsSources;
|
||||
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) {
|
||||
if (iii<0 || iii > m_subWidget.Size()) {
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->GenDraw(displayProp);
|
||||
}
|
||||
// Draw Destination :
|
||||
iii = m_windowsDestination;
|
||||
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) {
|
||||
if (iii<0 || iii > m_subWidget.Size()) {
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,26 +265,26 @@ void ewol::WSlider::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (m_windowsDestination == m_windowsSources) {
|
||||
int32_t iii = m_windowsDestination;
|
||||
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) {
|
||||
if (iii<0 || iii > m_subWidget.Size()) {
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
} else {
|
||||
int32_t iii = m_windowsSources;
|
||||
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) {
|
||||
if (iii<0 || iii > m_subWidget.Size()) {
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
iii = m_windowsDestination;
|
||||
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) {
|
||||
if (iii<0 || iii > m_subWidget.Size()) {
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -299,19 +299,19 @@ void ewol::WSlider::OnRegenerateDisplay(void)
|
||||
ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D<float> pos)
|
||||
{
|
||||
// TODO : Review this ...
|
||||
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].Size()) {
|
||||
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget.Size()) {
|
||||
// error ...
|
||||
return NULL;
|
||||
}
|
||||
int32_t iii = m_windowsDestination;
|
||||
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
Vector2D<float> tmpSize = m_subWidget[iii]->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[m_currentCreateId][iii]->GetWidgetAtPos(pos);
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != 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 ...
|
||||
* @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 :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace ewol {
|
||||
void LockExpendContamination(bool lockExpend=false);
|
||||
private:
|
||||
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_windowsDestination; // widget destinated viewed
|
||||
int32_t m_slidingProgress; // ratio progression of a sliding
|
||||
@ -64,7 +64,7 @@ namespace ewol {
|
||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||
void SubWidgetSelectSet(int32_t id);
|
||||
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:
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
@ -77,12 +77,6 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
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 ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
|
@ -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");
|
||||
return;
|
||||
}
|
||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
||||
if (pos < 0 || pos >= m_listOObject.Size() ) {
|
||||
m_listOObject.PushBack(newObject);
|
||||
} else {
|
||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
||||
m_listOObject.Insert(pos, newObject);
|
||||
}
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::WidgetScrooled::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
||||
delete(m_listOObject[m_currentCreateId][iii]);
|
||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
m_listOObject[iii]->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace ewol {
|
||||
class WidgetScrooled : public ewol::Widget
|
||||
{
|
||||
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 ClearOObjectList(void);
|
||||
protected:
|
||||
|
@ -220,23 +220,18 @@ void ewol::ColorChooser::OnObjectRemove(ewol::EObject * removeObject)
|
||||
// second step find if in all the elements ...
|
||||
if(removeObject == m_widgetRed) {
|
||||
m_widgetRed = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetGreen) {
|
||||
m_widgetGreen = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetBlue) {
|
||||
m_widgetBlue = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetAlpha) {
|
||||
m_widgetAlpha = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetColorBar) {
|
||||
m_widgetColorBar = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,35 +442,27 @@ void ewol::FileChooser::OnObjectRemove(ewol::EObject * removeObject)
|
||||
// second step find if in all the elements ...
|
||||
if(removeObject == m_widgetTitle) {
|
||||
m_widgetTitle = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetValidate) {
|
||||
m_widgetValidate = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCancel) {
|
||||
m_widgetCancel = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCurrentFolder) {
|
||||
m_widgetCurrentFolder = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCurrentFileName) {
|
||||
m_widgetCurrentFileName = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetListFolder) {
|
||||
m_widgetListFolder = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetListFile) {
|
||||
m_widgetListFile = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCheckBox) {
|
||||
m_widgetCheckBox = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,6 @@ ewol::Parameter::Parameter(void) :
|
||||
}
|
||||
}
|
||||
MarkToReedraw();
|
||||
//m_needFlipFlop = true;
|
||||
|
||||
}
|
||||
|
||||
@ -227,19 +226,15 @@ void ewol::Parameter::OnObjectRemove(ewol::EObject * removeObject)
|
||||
// second step find if in all the elements ...
|
||||
if(removeObject == m_widgetTitle) {
|
||||
m_widgetTitle = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_paramList) {
|
||||
m_paramList = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCancel) {
|
||||
m_widgetCancel = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_wSlider) {
|
||||
m_wSlider = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,11 @@ ewol::ParameterList::ParameterList(void)
|
||||
ewol::ParameterList::~ParameterList(void)
|
||||
{
|
||||
//clean all the object
|
||||
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
||||
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) {
|
||||
delete(m_listOObject[jjj][iii]);
|
||||
m_listOObject[jjj][iii] = NULL;
|
||||
}
|
||||
m_listOObject[jjj].Clear();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
m_listOObject.Clear();
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
||||
if (pos < 0 || pos >= m_listOObject.Size() ) {
|
||||
m_listOObject.PushBack(newObject);
|
||||
} else {
|
||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
||||
m_listOObject.Insert(pos, newObject);
|
||||
}
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::ParameterList::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
||||
delete(m_listOObject[m_currentCreateId][iii]);
|
||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
m_listOObject[iii]->Draw();
|
||||
}
|
||||
}
|
||||
WidgetScrooled::OnDraw(displayProp);
|
||||
@ -201,7 +198,6 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
|
||||
|
||||
// call the herited class...
|
||||
WidgetScrooled::OnRegenerateDisplay();
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace ewol {
|
||||
void SetLabel(etk::UString newLabel);
|
||||
// Drawing capabilities ....
|
||||
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:
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user