[DEV] correct the pop-up error size and parameter tool exit button

This commit is contained in:
Edouard DUPIN 2013-04-25 22:53:51 +02:00
parent a7d4bf13fa
commit 7afec192d1
11 changed files with 27 additions and 43 deletions

2
build

@ -1 +1 @@
Subproject commit d0356e2fd0ef6e8f34fd0ab673a016fc8b6b5b42
Subproject commit 810f699b6c58a82381b7291faba0db76048d83ff

View File

@ -10,6 +10,7 @@
#include <ewol/debug.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/FontFreeType.h>
#include <ewol/ewol.h>
// Specific for the resource :
@ -80,6 +81,7 @@ void ewol::resource::ReLoadResources(void)
}
}
}
ewol::RequestUpdateSize();
EWOL_INFO("------------- Resources -------------");
}

View File

@ -101,12 +101,7 @@ void widget::Container::CalculateMinMaxSize(void)
if (NULL!=m_subWidget) {
m_subWidget->CalculateMinMaxSize();
vec2 min = m_subWidget->GetCalculateMinSize();
if (m_minSize.x()<min.x()) {
m_minSize.setX(min.x());
}
if (m_minSize.y()<min.y()) {
m_minSize.setY(min.y());
}
m_minSize.setMax(min);
}
}

View File

@ -91,9 +91,9 @@ void widget::Gird::CalculateSize(const vec2& availlable)
EWOL_DEBUG(" [" << iii << "] set subwidget origin=" <<tmpOrigin << " size=" << ivec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow) );
// Set the origin :
m_subWidget[iii].widget->SetOrigin(tmpOrigin);
m_subWidget[iii].widget->SetOrigin(vec2ClipInt32(tmpOrigin));
// all time set oll the space .
m_subWidget[iii].widget->CalculateSize(vec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow));
m_subWidget[iii].widget->CalculateSize(vec2ClipInt32(vec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow)));
}
}
m_size += m_borderSize*2;

View File

@ -52,6 +52,7 @@ void widget::PopUp::CalculateSize(const vec2& availlable)
// set config to the Sub-widget
vec2 subWidgetOrigin = m_origin + (m_size-subWidgetSize)/2.0f;
subWidgetOrigin = vec2ClipInt32(subWidgetOrigin);
m_subWidget->SetOrigin(subWidgetOrigin);
m_subWidget->CalculateSize(subWidgetSize);
@ -59,27 +60,6 @@ void widget::PopUp::CalculateSize(const vec2& availlable)
MarkToRedraw();
}
void widget::PopUp::CalculateMinMaxSize(void)
{
// remove expand of sub widget ==> not needed ...
m_userExpand.setValue(false,false);
if (m_userMinSize.GetType() != ewol::Dimension::Pourcent) {
EWOL_ERROR(" ==> Please set pourcent size of the popo_up view");
m_minSize.setValue(50, 50);
} else {
m_minSize = m_userMinSize.GetPixel();
}
if (NULL != m_subWidget) {
m_subWidget->CalculateMinMaxSize();
vec2 tmpSize = m_subWidget->GetCalculateMinSize();
m_minSize.setMax(tmpSize);
}
EWOL_DEBUG("CalculateMinSize=" << m_minSize);
MarkToRedraw();
}
void widget::PopUp::OnDraw(ewol::DrawProperty& displayProp)
{
// draw upper classes

View File

@ -32,7 +32,7 @@ namespace widget {
public: // Derived function
virtual void OnRegenerateDisplay(void);
virtual void CalculateSize(const vec2& availlable);
virtual void CalculateMinMaxSize(void);
//virtual void CalculateMinMaxSize(void);
virtual const char * const GetObjectType(void) { return "ewol::PopUp"; };
virtual ewol::Widget* GetWidgetAtPos(const vec2& pos);
};

View File

@ -111,22 +111,22 @@ void widget::Sizer::CalculateSize(const vec2& availlable)
vec2 tmpSize = m_subWidget[iii]->GetCalculateMinSize();
// Set the origin :
//EWOL_DEBUG("[" << GetId() << "] Set ORIGIN : " << tmpOrigin);
m_subWidget[iii]->SetOrigin(tmpOrigin);
m_subWidget[iii]->SetOrigin(vec2ClipInt32(tmpOrigin));
// Now Update his Size his size in X and the curent sizer size in Y:
if (m_mode==widget::Sizer::modeVert) {
if (true == m_subWidget[iii]->CanExpand().y()) {
m_subWidget[iii]->CalculateSize(vec2(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne));
m_subWidget[iii]->CalculateSize(vec2ClipInt32(vec2(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne)));
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
} else {
m_subWidget[iii]->CalculateSize(vec2(m_size.x(), tmpSize.y()));
m_subWidget[iii]->CalculateSize(vec2ClipInt32(vec2(m_size.x(), tmpSize.y())));
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y());
}
} else {
if (true == m_subWidget[iii]->CanExpand().x()) {
m_subWidget[iii]->CalculateSize(vec2(tmpSize.x()+sizeToAddAtEveryOne, m_size.y()));
m_subWidget[iii]->CalculateSize(vec2ClipInt32(vec2(tmpSize.x()+sizeToAddAtEveryOne, m_size.y())));
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne);
} else {
m_subWidget[iii]->CalculateSize(vec2(tmpSize.x(), m_size.y()));
m_subWidget[iii]->CalculateSize(vec2ClipInt32(vec2(tmpSize.x(), m_size.y())));
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x());
}
}

View File

@ -119,6 +119,7 @@ widget::FileChooser::FileChooser(void)
EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else {
mySizerVert->LockExpand(bvec2(true,true));
mySizerVert->SetExpand(bvec2(true,true));
// set it in the pop-up-system :
SetSubWidget(mySizerVert);

View File

@ -12,6 +12,7 @@
#include <ewol/widget/Spacer.h>
#include <ewol/widget/Image.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/widget/Composer.h>
#include <etk/Vector.h>
@ -49,6 +50,7 @@ widget::Parameter::Parameter(void) :
} else {
EWOL_INFO("add widget");
mySizerVert->LockExpand(bvec2(true,true));
mySizerVert->SetExpand(bvec2(true,true));
// set it in the pop-up-system :
SetSubWidget(mySizerVert);
@ -66,17 +68,21 @@ widget::Parameter::Parameter(void) :
mySizerHori->SubWidgetAdd(mySpacer);
}
// TODO : set if back :
/*
m_widgetCancel = new widget::Button("Close");
m_widgetCancel = new widget::Button();
if (NULL == m_widgetCancel) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else {
m_widgetCancel->SetImage("icon/Remove.svg");
m_widgetCancel->SetSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <label>Close</label>\n"
" </sizer>\n"
"</composer\n"));
m_widgetCancel->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventParameterClose);
mySizerHori->SubWidgetAdd(m_widgetCancel);
}
*/
}
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);

View File

@ -51,7 +51,7 @@ widget::ParameterList::~ParameterList(void)
}
void widget::ParameterList::CalculateMinSize(void)
void widget::ParameterList::CalculateMinMaxSize(void)
{
/*int32_t fontId = GetDefaultFontId();
int32_t minWidth = ewol::GetWidth(fontId, m_label);

View File

@ -46,7 +46,7 @@ namespace widget {
virtual const char * const GetObjectType(void) { return "EwolParameterList"; };
virtual ~ParameterList(void);
// Derived function
virtual void CalculateMinSize(void);
virtual void CalculateMinMaxSize(void);
void SetLabel(etk::UString newLabel);
// Drawing capabilities ....
private: