[DEV] widget back to work on test woft ==> not ended (some mistake to correct)

This commit is contained in:
Edouard DUPIN 2013-04-10 21:05:45 +02:00
parent 36dbd60e19
commit 2d209cd37e
17 changed files with 162 additions and 163 deletions

View File

@ -40,9 +40,9 @@ void ewol::dimension::UnInit(void)
windowsSize.Set(vec2(9999999,88888), ewol::Dimension::Pixel); windowsSize.Set(vec2(9999999,88888), ewol::Dimension::Pixel);
} }
void ewol::dimension::SetPixelRatio(const vec2& ratio, ewol::Dimension::distance_te type) void ewol::dimension::SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te type)
{ {
ewol::Dimension conversion(ratio, type); ewol::Dimension conversion(_ratio, type);
ratio = conversion.GetMillimeter(); ratio = conversion.GetMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio); EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio);
@ -105,28 +105,28 @@ void ewol::Dimension::Set(const vec2& size, ewol::Dimension::distance_te type)
{ {
switch(type) { switch(type) {
case ewol::Dimension::Pourcent: case ewol::Dimension::Pourcent:
m_data = size*0.01f; m_data = vec2(size.x()*0.01f, size.y()*0.01f);
break; break;
case ewol::Dimension::Pixel: case ewol::Dimension::Pixel:
m_data = size; m_data = size;
break; break;
case ewol::Dimension::Meter: case ewol::Dimension::Meter:
m_data = (size*meterToMillimeter)*ratio; m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y());
break; break;
case ewol::Dimension::Centimeter: case ewol::Dimension::Centimeter:
m_data = (size*centimeterToMillimeter)*ratio; m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y());
break; break;
case ewol::Dimension::Millimeter: case ewol::Dimension::Millimeter:
m_data = size*ratio; m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y());
break; break;
case ewol::Dimension::Kilometer: case ewol::Dimension::Kilometer:
m_data = (size*kilometerToMillimeter)*ratio; m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y());
break; break;
case ewol::Dimension::Inch: case ewol::Dimension::Inch:
m_data = (size*inchToMillimeter)*ratio; m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y());
break; break;
case ewol::Dimension::foot: case ewol::Dimension::foot:
m_data = (size*footToMillimeter)*ratio; m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y());
break; break;
} }
m_type = type; m_type = type;
@ -134,16 +134,18 @@ void ewol::Dimension::Set(const vec2& size, ewol::Dimension::distance_te type)
vec2 ewol::Dimension::GetPixel(void) vec2 ewol::Dimension::GetPixel(void)
{ {
if (type!=ewol::Dimension::Pourcent) { if (m_type!=ewol::Dimension::Pourcent) {
return m_data; return m_data;
} }
return windowsSize*m_data; vec2 windDim = windowsSize.GetPixel();
return vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y());
} }
vec2 ewol::Dimension::GetPourcent(void) vec2 ewol::Dimension::GetPourcent(void)
{ {
if (type!=ewol::Dimension::Pourcent) { if (m_type!=ewol::Dimension::Pourcent) {
return m_data/windowsSize*100.0f; vec2 windDim = windowsSize.GetPixel();
return vec2(m_data.x()/windDim.x()*100.0f, m_data.y()/windDim.y()*100.0f);
} }
return m_data*100.0f; return m_data*100.0f;
} }

View File

@ -6,8 +6,8 @@
* @license BSD v3 (see license file) * @license BSD v3 (see license file)
*/ */
#ifndef __DIMENSION_H__ #ifndef __EWOL_DIMENSION_H__
#define __DIMENSION_H__ #define __EWOL_DIMENSION_H__
#include <etk/types.h> #include <etk/types.h>
#include <etk/UString.h> #include <etk/UString.h>

View File

@ -12,7 +12,7 @@
#include <etk/MessageFifo.h> #include <etk/MessageFifo.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/DisplayConv.h> #include <ewol/Dimension.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/config.h> #include <ewol/config.h>
@ -135,7 +135,7 @@ void ewolProcessEvents(void)
case THREAD_RESIZE: case THREAD_RESIZE:
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE"); //EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
windowsSize = data.dimention; windowsSize = data.dimention;
ewol::SetPixelWindowsSize(vec2(windowsSize.x(),windowsSize.y())); ewol::dimension::SetPixelWindowsSize(vec2(windowsSize.x(),windowsSize.y()));
eSystem::ForceRedrawAll(); eSystem::ForceRedrawAll();
break; break;
case THREAD_INPUT_MOTION: case THREAD_INPUT_MOTION:
@ -329,7 +329,7 @@ void eSystem::RequestUpdateSize(void)
void eSystem::Resize(int w, int h ) void eSystem::Resize(int w, int h )
{ {
// TODO : Better in the thread ... ==> but generate some init error ... // TODO : Better in the thread ... ==> but generate some init error ...
ewol::SetPixelWindowsSize(vec2(w,h)); ewol::dimension::SetPixelWindowsSize(vec2(w,h));
if (true == isGlobalSystemInit) { if (true == isGlobalSystemInit) {
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_RESIZE; data.TypeMessage = THREAD_RESIZE;

View File

@ -19,7 +19,7 @@
#include <ewol/renderer/ResourceManager.h> #include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/os/eSystem.h> #include <ewol/renderer/os/eSystem.h>
#include <ewol/DisplayConv.h> #include <ewol/Dimension.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -170,8 +170,9 @@ bool CreateX11Context(void)
} }
int Xscreen = DefaultScreen(m_display); int Xscreen = DefaultScreen(m_display);
// set the DPI for the current screen : // set the DPI for the current screen :
ewol::SetPixelPerMillimeter(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen), ewol::dimension::SetPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen),
(float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen))); (float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen)),
ewol::Dimension::Millimeter);
// get an appropriate visual // get an appropriate visual
m_visual = glXChooseVisual(m_display, Xscreen, attrListDbl); m_visual = glXChooseVisual(m_display, Xscreen, attrListDbl);
if (NULL == m_visual) { if (NULL == m_visual) {

View File

@ -43,7 +43,6 @@ namespace widget {
virtual void CalculateSize(const vec2& availlable); virtual void CalculateSize(const vec2& availlable);
virtual void CalculateMinSize(void); virtual void CalculateMinSize(void);
virtual void SetMinSize(const vec2& size); virtual void SetMinSize(const vec2& size);
virtual void SetExpand(const bvec2& newExpend);
virtual bvec2 CanExpand(void); virtual bvec2 CanExpand(void);
virtual const char * const GetObjectType(void) { return "EwolLayer"; }; virtual const char * const GetObjectType(void) { return "EwolLayer"; };
}; };

View File

@ -61,8 +61,8 @@ void widget::PopUp::CalculateSize(const vec2& availlable)
subWidgetOrigin.setValue((int32_t)(m_size.x() - m_origin.x() - subWidgetSize.x())/2 + m_origin.x(), subWidgetOrigin.setValue((int32_t)(m_size.x() - m_origin.x() - subWidgetSize.x())/2 + m_origin.x(),
(int32_t)(m_size.y() - m_origin.y() - subWidgetSize.y())/2 + m_origin.y()); (int32_t)(m_size.y() - m_origin.y() - subWidgetSize.y())/2 + m_origin.y());
m_subWidget->SetOrigin(subWidgetOrigin.x(), subWidgetOrigin.y()); m_subWidget->SetOrigin(subWidgetOrigin);
m_subWidget->CalculateSize(subWidgetSize.x(), subWidgetSize.y()); m_subWidget->CalculateSize(subWidgetSize);
} }
MarkToRedraw(); MarkToRedraw();
} }

View File

@ -86,14 +86,14 @@ void widget::Sizer::CalculateSize(const vec2& availlable)
vec2 tmpSize = m_subWidget[iii]->GetMinSize(); vec2 tmpSize = m_subWidget[iii]->GetMinSize();
if (m_mode==widget::Sizer::modeVert) { if (m_mode==widget::Sizer::modeVert) {
unexpendableSize += tmpSize.y(); unexpendableSize += tmpSize.y();
if (false == m_subWidget[iii]->CanExpentY()) { if (false == m_subWidget[iii]->CanExpand().y()) {
nbWidgetFixedSize++; nbWidgetFixedSize++;
} else { } else {
nbWidgetNotFixedSize++; nbWidgetNotFixedSize++;
} }
} else { } else {
unexpendableSize += tmpSize.x(); unexpendableSize += tmpSize.x();
if (false == m_subWidget[iii]->CanExpentX()) { if (false == m_subWidget[iii]->CanExpand().x()) {
nbWidgetFixedSize++; nbWidgetFixedSize++;
} else { } else {
nbWidgetNotFixedSize++; nbWidgetNotFixedSize++;
@ -120,22 +120,22 @@ void widget::Sizer::CalculateSize(const vec2& availlable)
vec2 tmpSize = m_subWidget[iii]->GetMinSize(); vec2 tmpSize = m_subWidget[iii]->GetMinSize();
// Set the origin : // Set the origin :
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
m_subWidget[iii]->SetOrigin(tmpOrigin.x(), tmpOrigin.y()); m_subWidget[iii]->SetOrigin(tmpOrigin);
// Now Update his Size his size in X and the curent sizer size in Y: // Now Update his Size his size in X and the curent sizer size in Y:
if (m_mode==widget::Sizer::modeVert) { if (m_mode==widget::Sizer::modeVert) {
if (true == m_subWidget[iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpand().y()) {
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne); m_subWidget[iii]->CalculateSize(vec2(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne));
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne); tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
} else { } else {
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y()); m_subWidget[iii]->CalculateSize(vec2(m_size.x(), tmpSize.y()));
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()); tmpOrigin.setY(tmpOrigin.y() + tmpSize.y());
} }
} else { } else {
if (true == m_subWidget[iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpand().x()) {
m_subWidget[iii]->CalculateSize(tmpSize.x()+sizeToAddAtEveryOne, m_size.y()); m_subWidget[iii]->CalculateSize(vec2(tmpSize.x()+sizeToAddAtEveryOne, m_size.y()));
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne); tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne);
} else { } else {
m_subWidget[iii]->CalculateSize(tmpSize.x(), m_size.y()); m_subWidget[iii]->CalculateSize(vec2(tmpSize.x(), m_size.y()));
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()); tmpOrigin.setX(tmpOrigin.x() + tmpSize.x());
} }
} }
@ -161,10 +161,10 @@ void widget::Sizer::CalculateMinSize(void)
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[iii]->CalculateMinSize(); m_subWidget[iii]->CalculateMinSize();
if (true == m_subWidget[iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpand().x()) {
m_userExpend.setX(true); m_userExpend.setX(true);
} }
if (true == m_subWidget[iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpand().y()) {
m_userExpend.setY(true); m_userExpend.setY(true);
} }
vec2 tmpSize = m_subWidget[iii]->GetMinSize(); vec2 tmpSize = m_subWidget[iii]->GetMinSize();
@ -190,17 +190,21 @@ void widget::Sizer::SetMinSize(const vec2& size)
EWOL_ERROR("[" << GetId() << "] Sizer can not have a user Minimum size (herited from under elements)"); EWOL_ERROR("[" << GetId() << "] Sizer can not have a user Minimum size (herited from under elements)");
} }
void widget::Sizer::SetExpand(const bvec2& newExpend) void widget::Sizer::SetExpand(const bvec2& newExpand)
{ {
EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings (herited from under elements)"); EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings (herited from under elements)");
} }
bvec2 widget::Sizer::CanExpentY(void) bvec2 widget::Sizer::CanExpand(void)
{ {
if (true == m_lockExpendContamination)) { bvec2 res = m_userExpend;
return bvec2(false,false); if (true == m_lockExpendContamination.x()) {
res.setX(false);
} }
return m_userExpend; if (true == m_lockExpendContamination.y()) {
res.setY(false);
}
return res;
} }
void widget::Sizer::LockExpendContamination(const bvec2& lockExpend) void widget::Sizer::LockExpendContamination(const bvec2& lockExpend)

View File

@ -104,7 +104,7 @@ namespace widget {
virtual void CalculateMinSize(void); virtual void CalculateMinSize(void);
virtual void SetMinSize(const vec2& size); virtual void SetMinSize(const vec2& size);
virtual void SetExpand(const bvec2& newExpend); virtual void SetExpand(const bvec2& newExpend);
virtual bvec2 CanExpent(void);; virtual bvec2 CanExpand(void);;
}; };
}; };

View File

@ -18,11 +18,11 @@
widget::WSlider::WSlider(void) widget::WSlider::WSlider(void)
{ {
// set contamination enable // set contamination enable
LockExpendContamination(); LockExpendContamination(bvec2(false,false));
m_windowsDestination = 0; m_windowsDestination = 0;
m_slidingProgress = 0; m_slidingProgress = 0;
m_windowsSources = 0; m_windowsSources = 0;
m_underExpend.setValue(false,false); m_underExpand.setValue(false,false);
} }
widget::WSlider::~WSlider(void) widget::WSlider::~WSlider(void)
@ -31,92 +31,86 @@ widget::WSlider::~WSlider(void)
} }
bool widget::WSlider::CalculateSize(float availlableX, float availlableY) void widget::WSlider::CalculateSize(const vec2& availlable)
{ {
//EWOL_DEBUG("Update Size"); //EWOL_DEBUG("Update Size");
m_size.setValue(availlableX, availlableY); m_size = availlable;
if (m_windowsDestination == m_windowsSources) { if (m_windowsDestination == m_windowsSources) {
int32_t iii = m_windowsDestination; int32_t iii = m_windowsDestination;
if (iii < m_subWidget.Size()) { if (iii < m_subWidget.Size()) {
if (NULL != m_subWidget[iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[iii]->SetOrigin(m_origin.x(), m_origin.y()); m_subWidget[iii]->SetOrigin(m_origin);
m_subWidget[iii]->CalculateSize(m_size.x(), m_size.y()); m_subWidget[iii]->CalculateSize(m_size);
} }
} }
} else { } else {
int32_t iii = m_windowsSources; int32_t iii = m_windowsSources;
if (iii < m_subWidget.Size()) { if (iii < m_subWidget.Size()) {
if (NULL != m_subWidget[iii]) { 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]->SetOrigin(vec2(m_origin.x() - (m_size.x()*(float)m_slidingProgress/1000.0), m_origin.y()));
m_subWidget[iii]->CalculateSize(m_size.x(), m_size.y()); m_subWidget[iii]->CalculateSize(m_size);
} }
} }
iii = m_windowsDestination; iii = m_windowsDestination;
if (iii < m_subWidget.Size()) { if (iii < m_subWidget.Size()) {
if (NULL != m_subWidget[iii]) { 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]->SetOrigin(vec2(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()); m_subWidget[iii]->CalculateSize(m_size);
} }
} }
} }
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::WSlider::CalculateMinSize(void) void widget::WSlider::CalculateMinSize(void)
{ {
EWOL_DEBUG("Calculate MinSize"); EWOL_DEBUG("Calculate MinSize");
m_underExpend.setValue(false,false); m_underExpand.setValue(false,false);
m_minSize.setValue(0,0); m_minSize.setValue(0,0);
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[iii]) { if (NULL != m_subWidget[iii]) {
m_subWidget[iii]->CalculateMinSize(); m_subWidget[iii]->CalculateMinSize();
if (true == m_subWidget[iii]->CanExpentX()) { if (true == m_subWidget[iii]->CanExpand().x()) {
m_underExpend.setX(true); m_underExpand.setX(true);
} }
if (true == m_subWidget[iii]->CanExpentY()) { if (true == m_subWidget[iii]->CanExpand().y()) {
m_underExpend.setY(true); m_underExpand.setY(true);
} }
vec2 tmpSize = m_subWidget[iii]->GetMinSize(); vec2 tmpSize = m_subWidget[iii]->GetMinSize();
m_minSize.setValue(etk_max(tmpSize.x(), m_minSize.x()), m_minSize.setValue(etk_max(tmpSize.x(), m_minSize.x()),
etk_max(tmpSize.y(), m_minSize.y())); etk_max(tmpSize.y(), m_minSize.y()));
} }
} }
return true;
} }
void widget::WSlider::SetMinSise(float x, float y) void widget::WSlider::SetMinSize(const vec2& size)
{ {
EWOL_ERROR("Layer can not have a user Minimum size (herited from under elements)"); EWOL_ERROR("Layer can not have a user Minimum size (herited from under elements)");
} }
bool widget::WSlider::CanExpentX(void) bvec2 widget::WSlider::CanExpand(void)
{ {
if (m_userExpend.x() == true) { bvec2 res = m_userExpend;
return true; if (true == m_underExpand.x()) {
res.setX(true);
} }
if (true == m_lockExpendContamination) { if (true == m_underExpand.y()) {
return false; res.setY(true);
} }
return m_underExpend.x(); if (true == m_lockExpendContamination.x()) {
res.setX(false);
}
if (true == m_lockExpendContamination.y()) {
res.setY(false);
}
return res;
} }
bool widget::WSlider::CanExpentY(void) void widget::WSlider::LockExpendContamination(const bvec2& lockExpand)
{ {
if (m_userExpend.y() == true) { m_lockExpendContamination = lockExpand;
return true;
}
if (true == m_lockExpendContamination) {
return false;
}
return m_underExpend.y();
}
void widget::WSlider::LockExpendContamination(bool lockExpend)
{
m_lockExpendContamination = lockExpend;
} }
//etk::Vector<ewol::Widget*> m_SubWidget; //etk::Vector<ewol::Widget*> m_SubWidget;
@ -197,7 +191,7 @@ void widget::WSlider::PeriodicCall(int64_t localTime)
m_slidingProgress += 30; m_slidingProgress += 30;
m_slidingProgress = etk_avg(0, m_slidingProgress, 1000); m_slidingProgress = etk_avg(0, m_slidingProgress, 1000);
} }
CalculateSize(m_size.x(), m_size.y()); CalculateSize(m_size);
MarkToRedraw(); MarkToRedraw();
} }

View File

@ -22,33 +22,28 @@ namespace widget {
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolWSlider"; }; virtual const char * const GetObjectType(void) { return "EwolWSlider"; };
private: private:
bvec2 m_underExpend; // expend of the uner elements ... bvec2 m_underExpand; // expend of the uner elements ...
public: public:
// Derived function // Derived function
virtual bool CalculateSize(float availlableX, float availlableY); virtual void CalculateSize(const vec2& availlable);
// Derived function virtual void CalculateMinSize(void);
virtual bool CalculateMinSize(void); virtual void SetMinSize(const vec2& size);
// Derived function virtual bvec2 CanExpand(void);
virtual void SetMinSise(float x=-1, float y=-1); void LockExpendContamination(const bvec2& lockExpend);
// Derived function
virtual bool CanExpentX(void);
// Derived function
virtual bool CanExpentY(void);
void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bvec2 m_lockExpendContamination;
etk::Vector<ewol::Widget*> m_subWidget; etk::Vector<ewol::Widget*> m_subWidget;
int32_t m_windowsSources; // widget source viewed int32_t m_windowsSources; // widget source viewed
int32_t m_windowsDestination; // widget destinated viewed int32_t m_windowsDestination; // widget destinated viewed
int32_t m_slidingProgress; // ratio progression of a sliding int32_t m_slidingProgress; // ratio progression of a sliding
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);
virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetRemove(ewol::Widget* newWidget);
virtual void SubWidgetUnLink(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget);
void SubWidgetSelectSet(int32_t id); void SubWidgetSelectSet(int32_t id);
int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; }; int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; };
int32_t SubWidgetNumber(void) { return m_subWidget.Size(); }; int32_t SubWidgetNumber(void) { return m_subWidget.Size(); };
protected: protected:
// Derived function // Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);

View File

@ -142,7 +142,7 @@ namespace ewol {
public: public:
/** /**
* @brief User set the maximum size he want to set the display * @brief User set the maximum size he want to set the display
* @param[in] size The new maximum size requested (vec2(-1,-1) to unset) * @param[in] size The new maximum size requested (vec2(0,0) to unset)
*/ */
virtual void SetMaxSize(vec2 size); virtual void SetMaxSize(vec2 size);
/** /**
@ -163,6 +163,11 @@ namespace ewol {
* @param[in] newExpend 2D boolean repensent the capacity to expend * @param[in] newExpend 2D boolean repensent the capacity to expend
*/ */
virtual void SetExpand(const bvec2& newExpend); virtual void SetExpand(const bvec2& newExpend);
/**
* @brief Get the expend capabilities (x&y) (set by the user)
* @return 2D boolean repensent the capacity to expend
*/
virtual bvec2 GetExpand(void) { return m_userExpend; };
/** /**
* @brief Get the expend capabilities (x&y) * @brief Get the expend capabilities (x&y)
* @return 2D boolean repensent the capacity to expend * @return 2D boolean repensent the capacity to expend
@ -176,6 +181,11 @@ namespace ewol {
* @param[in] newFill new x&y fill state * @param[in] newFill new x&y fill state
*/ */
virtual void SetFill(const bvec2& newFill); virtual void SetFill(const bvec2& newFill);
/**
* @brief Set the x&y filling capacity set by the user
* @return bvec2 repensent the capacity to x&y filling (set by the user)
*/
virtual const bvec2& GetFill(void) { return m_userFill; };
/** /**
* @brief Get the filling capabilities x&y * @brief Get the filling capabilities x&y
* @return bvec2 repensent the capacity to x&y filling * @return bvec2 repensent the capacity to x&y filling

View File

@ -44,11 +44,10 @@ widget::ColorChooser::ColorChooser(void) :
m_widgetBlue = NULL; m_widgetBlue = NULL;
m_widgetAlpha = NULL; m_widgetAlpha = NULL;
LockExpendContamination(true); LockExpendContamination(bvec2(true,true));
m_widgetColorBar = new widget::ColorBar(); m_widgetColorBar = new widget::ColorBar();
m_widgetColorBar->RegisterOnEvent(this, ewolEventColorBarChange, eventColorBarHasChange); m_widgetColorBar->RegisterOnEvent(this, ewolEventColorBarChange, eventColorBarHasChange);
m_widgetColorBar->SetFillY(true); m_widgetColorBar->SetFill(bvec2(true,true));
m_widgetColorBar->SetFillX(true);
/* /*
m_widgetColorBar->SetWidth(200); m_widgetColorBar->SetWidth(200);
m_widgetColorBar->SetHeigh(200); m_widgetColorBar->SetHeigh(200);
@ -60,8 +59,8 @@ widget::ColorChooser::ColorChooser(void) :
m_widgetRed = new widget::Slider(); m_widgetRed = new widget::Slider();
m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
m_widgetRed->SetExpendX(true); m_widgetRed->SetExpand(bvec2(true,false));
m_widgetRed->SetFillX(true); m_widgetRed->SetFill(bvec2(true,false));
m_widgetRed->SetMin(0); m_widgetRed->SetMin(0);
m_widgetRed->SetMax(255); m_widgetRed->SetMax(255);
sliderColor = 0xFF0000FF; sliderColor = 0xFF0000FF;
@ -69,8 +68,8 @@ widget::ColorChooser::ColorChooser(void) :
SubWidgetAdd(m_widgetRed); SubWidgetAdd(m_widgetRed);
m_widgetGreen = new widget::Slider(); m_widgetGreen = new widget::Slider();
m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
m_widgetGreen->SetExpendX(true); m_widgetGreen->SetExpand(bvec2(true,false));
m_widgetGreen->SetFillX(true); m_widgetGreen->SetFill(bvec2(true,false));
m_widgetGreen->SetMin(0); m_widgetGreen->SetMin(0);
sliderColor = 0x00FF00FF; sliderColor = 0x00FF00FF;
m_widgetGreen->SetColor(sliderColor); m_widgetGreen->SetColor(sliderColor);
@ -78,8 +77,8 @@ widget::ColorChooser::ColorChooser(void) :
SubWidgetAdd(m_widgetGreen); SubWidgetAdd(m_widgetGreen);
m_widgetBlue = new widget::Slider(); m_widgetBlue = new widget::Slider();
m_widgetBlue->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetBlue->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
m_widgetBlue->SetExpendX(true); m_widgetBlue->SetExpand(bvec2(true,false));
m_widgetBlue->SetFillX(true); m_widgetBlue->SetFill(bvec2(true,false));
m_widgetBlue->SetMin(0); m_widgetBlue->SetMin(0);
sliderColor = 0x0000FFFF; sliderColor = 0x0000FFFF;
m_widgetBlue->SetColor(sliderColor); m_widgetBlue->SetColor(sliderColor);
@ -87,8 +86,8 @@ widget::ColorChooser::ColorChooser(void) :
SubWidgetAdd(m_widgetBlue); SubWidgetAdd(m_widgetBlue);
m_widgetAlpha = new widget::Slider(); m_widgetAlpha = new widget::Slider();
m_widgetAlpha->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetAlpha->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
m_widgetAlpha->SetExpendX(true); m_widgetAlpha->SetExpand(bvec2(true,false));
m_widgetAlpha->SetFillX(true); m_widgetAlpha->SetFill(bvec2(true,false));
m_widgetAlpha->SetMin(0); m_widgetAlpha->SetMin(0);
m_widgetAlpha->SetMax(255); m_widgetAlpha->SetMax(255);
SubWidgetAdd(m_widgetAlpha); SubWidgetAdd(m_widgetAlpha);

View File

@ -30,19 +30,19 @@ namespace widget {
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "widget::ColorChooser"; }; virtual const char * const GetObjectType(void) { return "widget::ColorChooser"; };
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); virtual void OnReceiveMessage(ewol::EObject* CallerObject, const char * eventId, const etk::UString& data);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject* removeObject);
void SetColor(draw::Color newColor); void SetColor(draw::Color newColor);
draw::Color GetColor(void); draw::Color GetColor(void);
private:; private:;
widget::ColorBar* m_widgetColorBar; widget::ColorBar* m_widgetColorBar;
widget::Slider* m_widgetRed; widget::Slider* m_widgetRed;
widget::Slider* m_widgetGreen; widget::Slider* m_widgetGreen;
widget::Slider* m_widgetBlue; widget::Slider* m_widgetBlue;
widget::Slider* m_widgetAlpha; widget::Slider* m_widgetAlpha;
draw::Color m_currentColor; draw::Color m_currentColor;
}; };
}; };

View File

@ -81,7 +81,7 @@ widget::FileChooser::FileChooser(void)
if (NULL == mySizerVert) { if (NULL == mySizerVert) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
mySizerVert->LockExpendContamination(true); mySizerVert->LockExpendContamination(bvec2(true,true));
// set it in the pop-up-system : // set it in the pop-up-system :
SubWidgetSet(mySizerVert); SubWidgetSet(mySizerVert);
@ -102,7 +102,7 @@ widget::FileChooser::FileChooser(void)
if (NULL == mySpacer) { if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
mySpacer->SetExpendX(true); mySpacer->SetExpand(bvec2(true,false));
mySizerHori->SubWidgetAdd(mySpacer); mySizerHori->SubWidgetAdd(mySpacer);
} }
// TODO : set if back : // TODO : set if back :
@ -145,8 +145,8 @@ widget::FileChooser::FileChooser(void)
m_widgetListFolder->SetShowFiles(false); m_widgetListFolder->SetShowFiles(false);
m_widgetListFolder->SetShowHiddenFiles(false); m_widgetListFolder->SetShowHiddenFiles(false);
m_widgetListFolder->RegisterOnEvent(this, ewolEventFSFolderValidate, ewolEventFileChooserListFolder); m_widgetListFolder->RegisterOnEvent(this, ewolEventFSFolderValidate, ewolEventFileChooserListFolder);
m_widgetListFolder->SetExpendY(true); m_widgetListFolder->SetExpand(bvec2(false,true));
m_widgetListFolder->SetFillY(true); m_widgetListFolder->SetFill(bvec2(false,true));
mySizerHori->SubWidgetAdd(m_widgetListFolder); mySizerHori->SubWidgetAdd(m_widgetListFolder);
} }
mySpacer = new widget::Spacer(); mySpacer = new widget::Spacer();
@ -165,10 +165,8 @@ widget::FileChooser::FileChooser(void)
m_widgetListFile->SetShowHiddenFiles(false); m_widgetListFile->SetShowHiddenFiles(false);
m_widgetListFile->RegisterOnEvent(this, ewolEventFSFileSelect, ewolEventFileChooserListFile); m_widgetListFile->RegisterOnEvent(this, ewolEventFSFileSelect, ewolEventFileChooserListFile);
m_widgetListFile->RegisterOnEvent(this, ewolEventFSFileValidate, ewolEventFileChooserListFileValidate); m_widgetListFile->RegisterOnEvent(this, ewolEventFSFileValidate, ewolEventFileChooserListFileValidate);
m_widgetListFile->SetExpendX(true); m_widgetListFile->SetExpand(bvec2(true,true));
m_widgetListFile->SetFillX(true); m_widgetListFile->SetFill(bvec2(true,true));
m_widgetListFile->SetExpendY(true);
m_widgetListFile->SetFillY(true);
mySizerHori->SubWidgetAdd(m_widgetListFile); mySizerHori->SubWidgetAdd(m_widgetListFile);
} }
mySpacer = new widget::Spacer(); mySpacer = new widget::Spacer();
@ -188,7 +186,7 @@ widget::FileChooser::FileChooser(void)
if (NULL == myImage) { if (NULL == myImage) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
myImage->SetFillY(true); myImage->SetFill(bvec2(false,true));
mySizerHori->SubWidgetAdd(myImage); mySizerHori->SubWidgetAdd(myImage);
} }
m_widgetCurrentFileName = new widget::Entry(m_file); m_widgetCurrentFileName = new widget::Entry(m_file);
@ -197,8 +195,8 @@ widget::FileChooser::FileChooser(void)
} else { } else {
m_widgetCurrentFileName->RegisterOnEvent(this, ewolEventEntryModify, ewolEventFileChooserEntryFile); m_widgetCurrentFileName->RegisterOnEvent(this, ewolEventEntryModify, ewolEventFileChooserEntryFile);
m_widgetCurrentFileName->RegisterOnEvent(this, ewolEventEntryEnter, ewolEventFileChooserEntryFileEnter); m_widgetCurrentFileName->RegisterOnEvent(this, ewolEventEntryEnter, ewolEventFileChooserEntryFileEnter);
m_widgetCurrentFileName->SetExpendX(true); m_widgetCurrentFileName->SetExpand(bvec2(true,false));
m_widgetCurrentFileName->SetFillX(true); m_widgetCurrentFileName->SetFill(bvec2(true,false));
m_widgetCurrentFileName->SetWidth(200); m_widgetCurrentFileName->SetWidth(200);
mySizerHori->SubWidgetAdd(m_widgetCurrentFileName); mySizerHori->SubWidgetAdd(m_widgetCurrentFileName);
} }
@ -212,7 +210,7 @@ widget::FileChooser::FileChooser(void)
if (NULL == myImage) { if (NULL == myImage) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
myImage->SetFillY(true); myImage->SetFill(bvec2(false,true));
mySizerHori->SubWidgetAdd(myImage); mySizerHori->SubWidgetAdd(myImage);
} }
@ -222,8 +220,8 @@ widget::FileChooser::FileChooser(void)
} else { } else {
m_widgetCurrentFolder->RegisterOnEvent(this, ewolEventEntryModify, ewolEventFileChooserEntryFolder); m_widgetCurrentFolder->RegisterOnEvent(this, ewolEventEntryModify, ewolEventFileChooserEntryFolder);
m_widgetCurrentFolder->RegisterOnEvent(this, ewolEventEntryEnter, ewolEventFileChooserEntryFolderEnter); m_widgetCurrentFolder->RegisterOnEvent(this, ewolEventEntryEnter, ewolEventFileChooserEntryFolderEnter);
m_widgetCurrentFolder->SetExpendX(true); m_widgetCurrentFolder->SetExpand(bvec2(true,false));
m_widgetCurrentFolder->SetFillX(true); m_widgetCurrentFolder->SetFill(bvec2(true,false));
m_widgetCurrentFolder->SetWidth(200); m_widgetCurrentFolder->SetWidth(200);
mySizerHori->SubWidgetAdd(m_widgetCurrentFolder); mySizerHori->SubWidgetAdd(m_widgetCurrentFolder);
} }
@ -232,7 +230,7 @@ widget::FileChooser::FileChooser(void)
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
myImage->RegisterOnEvent(this, ewolEventImagePressed, ewolEventFileChooserHome); myImage->RegisterOnEvent(this, ewolEventImagePressed, ewolEventFileChooserHome);
myImage->SetFillY(true); myImage->SetFill(bvec2(false,true));
mySizerHori->SubWidgetAdd(myImage); mySizerHori->SubWidgetAdd(myImage);
} }
} }

View File

@ -48,7 +48,7 @@ widget::Parameter::Parameter(void) :
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
EWOL_INFO("add widget"); EWOL_INFO("add widget");
mySizerVert->LockExpendContamination(true); mySizerVert->LockExpendContamination(bvec2(true,true));
// set it in the pop-up-system : // set it in the pop-up-system :
SubWidgetSet(mySizerVert); SubWidgetSet(mySizerVert);
@ -62,7 +62,7 @@ widget::Parameter::Parameter(void) :
if (NULL == mySpacer) { if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
mySpacer->SetExpendX(true); mySpacer->SetExpand(bvec2(true,false));
mySizerHori->SubWidgetAdd(mySpacer); mySizerHori->SubWidgetAdd(mySpacer);
} }
@ -91,15 +91,15 @@ widget::Parameter::Parameter(void) :
} else { } else {
m_paramList->RegisterOnEvent(this, ewolEventParameterListSelect, l_eventMenuSelected); m_paramList->RegisterOnEvent(this, ewolEventParameterListSelect, l_eventMenuSelected);
m_paramList->SetFillY(true); m_paramList->SetFill(bvec2(false,true));
m_paramList->SetExpendY(true); m_paramList->SetExpand(bvec2(false,true));
mySizerHori->SubWidgetAdd(m_paramList); mySizerHori->SubWidgetAdd(m_paramList);
} }
mySpacer = new widget::Spacer(); mySpacer = new widget::Spacer();
if (NULL == mySpacer) { if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
mySpacer->SetExpendY(true); mySpacer->SetFill(bvec2(false,true));
mySpacer->SetSize(5); mySpacer->SetSize(5);
mySpacer->SetColor(0x000000BF); mySpacer->SetColor(0x000000BF);
mySizerHori->SubWidgetAdd(mySpacer); mySizerHori->SubWidgetAdd(mySpacer);
@ -115,7 +115,7 @@ widget::Parameter::Parameter(void) :
if (NULL == mySpacer) { if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
mySpacer->SetExpendX(true); mySpacer->SetExpand(bvec2(true,false));
mySpacer->SetSize(5); mySpacer->SetSize(5);
mySpacer->SetColor(0x000000BF); mySpacer->SetColor(0x000000BF);
mySizerVert2->SubWidgetAdd(mySpacer); mySizerVert2->SubWidgetAdd(mySpacer);
@ -125,8 +125,7 @@ widget::Parameter::Parameter(void) :
if (NULL == m_wSlider) { if (NULL == m_wSlider) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
m_wSlider->SetExpendX(true); m_wSlider->SetExpand(bvec2(true,true));
m_wSlider->SetExpendY(true);
mySizerVert2->SubWidgetAdd(m_wSlider); mySizerVert2->SubWidgetAdd(m_wSlider);
} }
} }
@ -136,7 +135,7 @@ widget::Parameter::Parameter(void) :
if (NULL == mySpacer) { if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
mySpacer->SetExpendX(true); mySpacer->SetExpand(bvec2(true,false));
mySpacer->SetSize(5); mySpacer->SetSize(5);
mySpacer->SetColor(0x000000BF); mySpacer->SetColor(0x000000BF);
mySizerVert->SubWidgetAdd(mySpacer); mySizerVert->SubWidgetAdd(mySpacer);
@ -146,7 +145,7 @@ widget::Parameter::Parameter(void) :
if (NULL == m_widgetTitle) { if (NULL == m_widgetTitle) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
m_widgetTitle->SetExpendX(true); m_widgetTitle->SetExpand(bvec2(true,false));
mySizerVert->SubWidgetAdd(m_widgetTitle); mySizerVert->SubWidgetAdd(m_widgetTitle);
} }
} }
@ -225,8 +224,7 @@ void widget::Parameter::MenuAdd(etk::UString label, etk::UString image, ewol::Wi
if (NULL == myLabel) { if (NULL == myLabel) {
EWOL_ERROR("Can not allocate widget ==> display might be in error"); EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else { } else {
myLabel->SetExpendY(true); myLabel->SetExpand(bvec2(true,true));
myLabel->SetExpendX(true);
m_wSlider->SubWidgetAdd(myLabel); m_wSlider->SubWidgetAdd(myLabel);
} }
} }

View File

@ -51,7 +51,7 @@ widget::ParameterList::~ParameterList(void)
} }
bool widget::ParameterList::CalculateMinSize(void) void widget::ParameterList::CalculateMinSize(void)
{ {
/*int32_t fontId = GetDefaultFontId(); /*int32_t fontId = GetDefaultFontId();
int32_t minWidth = ewol::GetWidth(fontId, m_label); int32_t minWidth = ewol::GetWidth(fontId, m_label);
@ -60,7 +60,6 @@ bool widget::ParameterList::CalculateMinSize(void)
m_minSize.y = 3+minHeight; m_minSize.y = 3+minHeight;
*/ */
m_minSize.setValue(150, 150); m_minSize.setValue(150, 150);
return true;
} }

View File

@ -38,7 +38,7 @@ namespace widget {
class ParameterList :public widget::WidgetScrooled class ParameterList :public widget::WidgetScrooled
{ {
private: private:
int32_t m_idSelected; int32_t m_idSelected;
etk::Vector<widget::elementPL *> m_list; etk::Vector<widget::elementPL *> m_list;
public: public:
ParameterList(void); ParameterList(void);
@ -46,26 +46,26 @@ namespace widget {
virtual const char * const GetObjectType(void) { return "EwolParameterList"; }; virtual const char * const GetObjectType(void) { return "EwolParameterList"; };
virtual ~ParameterList(void); virtual ~ParameterList(void);
// Derived function // Derived function
virtual bool CalculateMinSize(void); virtual void CalculateMinSize(void);
void SetLabel(etk::UString newLabel); void SetLabel(etk::UString newLabel);
// Drawing capabilities .... // Drawing capabilities ....
private: private:
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display... etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::Compositing* newObject, int32_t pos=-1); void AddOObject(ewol::Compositing* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);
protected: protected:
// Derived function // Derived function
void OnDraw(ewol::DrawProperty& displayProp); void OnDraw(ewol::DrawProperty& displayProp);
// list properties ... // list properties ...
private: private:
int32_t m_paddingSizeX; int32_t m_paddingSizeX;
int32_t m_paddingSizeY; int32_t m_paddingSizeY;
int32_t m_displayStartRaw; //!< Current starting diaplayed raw int32_t m_displayStartRaw; //!< Current starting diaplayed raw
int32_t m_displayCurrentNbLine; //!< Number of line in the display int32_t m_displayCurrentNbLine; //!< Number of line in the display
public: public:
// Derived function // Derived function
void OnRegenerateDisplay(void); void OnRegenerateDisplay(void);
// Derived function // Derived function
bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
protected: protected: