[DEV] color button and corection of the unsupressed widgets

This commit is contained in:
Edouard DUPIN 2012-12-02 20:34:44 +01:00
parent 426cbbfa78
commit d61e67773c
24 changed files with 224 additions and 150 deletions

View File

@ -241,7 +241,7 @@ ewol::Drawing::Drawing(void) :
ewol::Drawing::~Drawing(void) ewol::Drawing::~Drawing(void)
{ {
ewol::resource::Release(m_GLprogram); UnLoadProgram();
} }
@ -286,8 +286,19 @@ void ewol::Drawing::ResetCount(void)
m_triElement = 0; m_triElement = 0;
} }
void ewol::Drawing::UnLoadProgram(void)
{
if (NULL!=m_GLprogram) {
ewol::resource::Release(m_GLprogram);
m_GLprogram = NULL;
}
}
void ewol::Drawing::LoadProgram(void) void ewol::Drawing::LoadProgram(void)
{ {
// remove previous loading ... in case
UnLoadProgram();
// oad the new ...
etk::UString tmpString("DATA:color3.prog"); etk::UString tmpString("DATA:color3.prog");
// get the shader resource : // get the shader resource :
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {

View File

@ -50,6 +50,10 @@ namespace ewol
* @brief Load the openGL program and get all the ID needed * @brief Load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void LoadProgram(void);
/**
* @brief Un-Load the openGL program and get all the ID needed
*/
void UnLoadProgram(void);
float m_thickness; //!< when drawing line and other things float m_thickness; //!< when drawing line and other things
int32_t m_triElement; //!< special counter of the single dot generated int32_t m_triElement; //!< special counter of the single dot generated
etk::Vector3D<float> m_triangle[3]; //!< Register every system with a combinaison of tiangle etk::Vector3D<float> m_triangle[3]; //!< Register every system with a combinaison of tiangle

View File

@ -44,6 +44,11 @@ ewol::Shaper::Shaper(etk::UString shaperName) :
} }
ewol::Shaper::~Shaper(void) ewol::Shaper::~Shaper(void)
{
UnLoadProgram();
}
void ewol::Shaper::UnLoadProgram(void)
{ {
if (NULL != m_GLprogram) { if (NULL != m_GLprogram) {
ewol::resource::Release(m_GLprogram); ewol::resource::Release(m_GLprogram);
@ -73,6 +78,7 @@ void ewol::Shaper::LoadProgram(void)
m_confImageFile = m_config->Request("image"); m_confImageFile = m_config->Request("image");
} }
etk::UString basicShaderFile = m_config->GetString(m_confProgramFile); etk::UString basicShaderFile = m_config->GetString(m_confProgramFile);
if (basicShaderFile!="") {
// Get the relative position of the current file ... // Get the relative position of the current file ...
etk::FSNode file(m_name); etk::FSNode file(m_name);
etk::UString tmpFilename = file.GetRelativeFolder() + basicShaderFile; etk::UString tmpFilename = file.GetRelativeFolder() + basicShaderFile;
@ -94,14 +100,16 @@ void ewol::Shaper::LoadProgram(void)
// for the texture ID : // for the texture ID :
m_GLtexID = m_GLprogram->GetUniform("EW_texID"); m_GLtexID = m_GLprogram->GetUniform("EW_texID");
} }
etk::UString basicImageFile = m_config->GetString(m_confImageFile); etk::UString basicImageFile = m_config->GetString(m_confImageFile);
if (basicImageFile != "") {
tmpFilename = file.GetRelativeFolder() + basicImageFile; tmpFilename = file.GetRelativeFolder() + basicImageFile;
etk::Vector2D<int32_t> size(64,64); etk::Vector2D<int32_t> size(64,64);
if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) { if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) {
// nothing else to do ... // nothing else to do ...
} }
} }
}
}
void ewol::Shaper::Draw(void) void ewol::Shaper::Draw(void)
@ -243,8 +251,10 @@ void ewol::Shaper::SetInsidePos(etk::Vector2D<float> newInsidePos)
etk::Vector2D<float> ewol::Shaper::GetPadding(void) etk::Vector2D<float> ewol::Shaper::GetPadding(void)
{ {
etk::Vector2D<float> padding; etk::Vector2D<float> padding;
if (m_config!=NULL) {
padding.x = m_config->GetFloat(m_confIdPaddingX); padding.x = m_config->GetFloat(m_confIdPaddingX);
padding.y = m_config->GetFloat(m_confIdPaddingY); padding.y = m_config->GetFloat(m_confIdPaddingY);
}
return padding; return padding;
} }
@ -252,14 +262,8 @@ etk::Vector2D<float> ewol::Shaper::GetPadding(void)
void ewol::Shaper::SetSource(etk::UString newFile) void ewol::Shaper::SetSource(etk::UString newFile)
{ {
Clear(); Clear();
if (NULL != m_GLprogram) { UnLoadProgram();
ewol::resource::Release(m_GLprogram); m_name = newFile;
m_GLprogram = NULL;
}
if (NULL != m_config) {
ewol::resource::Release(m_config);
m_config = NULL;
}
LoadProgram(); LoadProgram();
} }

View File

@ -61,6 +61,10 @@ namespace ewol
* @brief Load the openGL program and get all the ID needed * @brief Load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void LoadProgram(void);
/**
* @brief Un-Load the openGL program and get all the ID needed
*/
void UnLoadProgram(void);
public: public:
/** /**
* @brief generic constructor * @brief generic constructor

View File

@ -36,6 +36,7 @@ void ewol::EObjectManager::UnInit(void)
EWOL_INFO(" Remove missing user widget"); EWOL_INFO(" Remove missing user widget");
while(0<m_eObjectList.Size()) { while(0<m_eObjectList.Size()) {
if (m_eObjectList[0]!=NULL) { if (m_eObjectList[0]!=NULL) {
EWOL_WARNING("Un-INIT : Remove EObject type=\"" << m_eObjectList[0]->GetObjectType() << "\"");
delete(m_eObjectList[0]); delete(m_eObjectList[0]);
m_eObjectList[0] = NULL; m_eObjectList[0] = NULL;
} else { } else {
@ -95,7 +96,7 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* object)
// Remove Element // Remove Element
m_eObjectList[iii] = NULL; m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii); m_eObjectList.Erase(iii);
EWOL_DEBUG("Auto-Remove EObject : [" << object->GetId() << "]"); EWOL_DEBUG("Auto-Remove EObject : [" << object->GetId() << "] type=\"" << object->GetObjectType() << "\"");
informOneObjectIsRemoved(object); informOneObjectIsRemoved(object);
m_eObjectAutoRemoveList.PushBack(object); m_eObjectAutoRemoveList.PushBack(object);
ewol::ForceRedrawAll(); ewol::ForceRedrawAll();
@ -110,6 +111,7 @@ void ewol::EObjectManager::RemoveAllAutoRemove(void)
{ {
while(0<m_eObjectAutoRemoveList.Size()) { while(0<m_eObjectAutoRemoveList.Size()) {
if (m_eObjectAutoRemoveList[0]!=NULL) { if (m_eObjectAutoRemoveList[0]!=NULL) {
EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->GetObjectType() << "\"");
delete(m_eObjectAutoRemoveList[0]); delete(m_eObjectAutoRemoveList[0]);
m_eObjectAutoRemoveList[0] = NULL; m_eObjectAutoRemoveList[0] = NULL;
} else { } else {

View File

@ -122,8 +122,6 @@ namespace ewol
{ {
} }
};
/*
bool IsSetCapsLock(void) bool IsSetCapsLock(void)
{ {
return capLock; return capLock;
@ -158,8 +156,12 @@ namespace ewol
{ {
return verNum; return verNum;
} }
bool IsSetInsert(void)
{
return insert;
}
}; };
*/
SpecialKey& GetCurrentSpecialKeyStatus(void); SpecialKey& GetCurrentSpecialKeyStatus(void);
}; };

View File

@ -40,6 +40,7 @@ namespace ewol
{ {
private: private:
etk::Vector<ewol::SimpleConfigElement*> m_list; etk::Vector<ewol::SimpleConfigElement*> m_list;
etk::UString m_errorString;
public: public:
ConfigFile(etk::UString& filename); ConfigFile(etk::UString& filename);
virtual ~ConfigFile(void); virtual ~ConfigFile(void);
@ -48,9 +49,9 @@ namespace ewol
int32_t Request(etk::UString paramName); int32_t Request(etk::UString paramName);
int32_t GetInteger(int32_t id) { return m_list[id]->GetInteger(); }; int32_t GetInteger(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetInteger(); };
float GetFloat(int32_t id) { return m_list[id]->GetFloat(); }; float GetFloat(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetFloat(); };
etk::UString& GetString(int32_t id) { return m_list[id]->GetString(); }; etk::UString& GetString(int32_t id) { if (id<0) { return m_errorString; } return m_list[id]->GetString(); };
}; };
}; };

View File

@ -29,8 +29,8 @@ extern const char * const ewolEventButtonValue = "ewol-button-value";
#define STATUS_DOWN (3) #define STATUS_DOWN (3)
widget::Button::Button(etk::UString newLabel) : widget::Button::Button(etk::UString newLabel, etk::UString shaperName) :
m_shaper("THEME:GUI:widgetButton.conf"), m_shaper(shaperName),
m_label(newLabel), m_label(newLabel),
m_toggleMode(false), m_toggleMode(false),
m_value(false), m_value(false),
@ -58,15 +58,22 @@ widget::Button::~Button(void)
} }
void widget::Button::SetImage(etk::UString imageName) void widget::Button::SetShaperName(etk::UString shaperName)
{ {
m_shaper.SetSource(shaperName);
}
void widget::Button::SetImage(etk::UString imageName, draw::Color color)
{
m_imageColor = color;
m_displayImage.SetSource(imageName); m_displayImage.SetSource(imageName);
MarkToRedraw(); MarkToRedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
} }
void widget::Button::SetImageToggle(etk::UString imageName) void widget::Button::SetImageToggle(etk::UString imageName, draw::Color color)
{ {
m_imageColorToggle = color;
m_displayImageToggle.SetSource(imageName); m_displayImageToggle.SetSource(imageName);
MarkToRedraw(); MarkToRedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
@ -220,9 +227,11 @@ void widget::Button::OnRegenerateDisplay(void)
if( false==m_toggleMode if( false==m_toggleMode
|| false==m_value) { || false==m_value) {
m_displayImage.SetPos(imagePos); m_displayImage.SetPos(imagePos);
m_displayImage.SetColor(m_imageColor);
m_displayImage.Print(imageSize); m_displayImage.Print(imageSize);
} else { } else {
m_displayImageToggle.SetPos(imagePos); m_displayImageToggle.SetPos(imagePos);
m_displayImageToggle.SetColor(m_imageColorToggle);
m_displayImageToggle.Print(imageSize); m_displayImageToggle.Print(imageSize);
} }
// update the text position ... // update the text position ...

View File

@ -31,7 +31,9 @@ namespace widget {
ewol::Shaper m_shaper; //!< Compositing theme. ewol::Shaper m_shaper; //!< Compositing theme.
ewol::Text m_displayText; //!< compositing Text. ewol::Text m_displayText; //!< compositing Text.
ewol::Image m_displayImage; //!< Image to display in normal mode. ewol::Image m_displayImage; //!< Image to display in normal mode.
draw::Color m_imageColor; //!< Image color to display it.
ewol::Image m_displayImageToggle; //!< Image to display in toggle mode. ewol::Image m_displayImageToggle; //!< Image to display in toggle mode.
draw::Color m_imageColorToggle; //!< Image color Toggle to display it.
etk::UString m_label; //!< Labe to display in normal mode. etk::UString m_label; //!< Labe to display in normal mode.
etk::UString m_labelToggle; //!< Label to display when toggle mode is set ("" whenit is the same). etk::UString m_labelToggle; //!< Label to display when toggle mode is set ("" whenit is the same).
bool m_toggleMode; //!< The button is able to toggle. bool m_toggleMode; //!< The button is able to toggle.
@ -47,11 +49,16 @@ namespace widget {
* @brief Constructor * @brief Constructor
* @param[in] newLabel Button Label to display * @param[in] newLabel Button Label to display
*/ */
Button(etk::UString newLabel="No Label"); Button(etk::UString newLabel="No Label", etk::UString shaperName="THEME:GUI:widgetButton.conf");
/** /**
* @brief Destructor * @brief Destructor
*/ */
virtual ~Button(void); virtual ~Button(void);
/**
* @brief Set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] shaperName The new shaper filename
*/
void SetShaperName(etk::UString shaperName);
/** /**
* @brief Specify the current label of the Button * @brief Specify the current label of the Button
* @param[in] newLabel The string that might be displayed * @param[in] newLabel The string that might be displayed
@ -75,13 +82,15 @@ namespace widget {
/** /**
* @brief Set an image to set at the button. * @brief Set an image to set at the button.
* @param[in] imageName Filename of the image. * @param[in] imageName Filename of the image.
* @param[in] color The required color for the image.
*/ */
void SetImage(etk::UString imageName); void SetImage(etk::UString imageName, draw::Color color=draw::color::white);
/** /**
* @brief Set the image when button is pressed. * @brief Set the image when button is pressed.
* @param[in] imageName Filename of the image. * @param[in] imageName Filename of the image.
* @param[in] color The required color for the image.
*/ */
void SetImageToggle(etk::UString imageName); void SetImageToggle(etk::UString imageName, draw::Color color=draw::color::white);
/** /**
* @brief Set the currentValue of the Button (pressed or not) * @brief Set the currentValue of the Button (pressed or not)
* @note Work only in toggle mode * @note Work only in toggle mode

View File

@ -28,8 +28,8 @@ extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Cha
#undef __class__ #undef __class__
#define __class__ "ButtonColor" #define __class__ "ButtonColor"
widget::ButtonColor::ButtonColor(draw::Color baseColor) : widget::ButtonColor::ButtonColor(draw::Color baseColor, etk::UString shaperName) :
m_shaper("THEME:GUI:widgetButton.conf"), m_shaper(shaperName),
m_textColorFg(baseColor), m_textColorFg(baseColor),
m_widgetContextMenu(NULL) m_widgetContextMenu(NULL)
{ {
@ -47,6 +47,11 @@ widget::ButtonColor::~ButtonColor(void)
} }
void widget::ButtonColor::SetShaperName(etk::UString shaperName)
{
m_shaper.SetSource(shaperName);
}
bool widget::ButtonColor::CalculateMinSize(void) bool widget::ButtonColor::CalculateMinSize(void)
{ {

View File

@ -22,15 +22,6 @@ extern const char * const ewolEventButtonColorChange;
namespace widget { namespace widget {
class ButtonColor : public ewol::Widget class ButtonColor : public ewol::Widget
{ {
public:
/**
* @brief Main constructor
*/
ButtonColor(draw::Color baseColor=draw::color::black);
/**
* @brief Main destructor
*/
virtual ~ButtonColor(void);
private: private:
ewol::Shaper m_shaper; //!< Compositing theme. ewol::Shaper m_shaper; //!< Compositing theme.
ewol::Text m_text; //!< Compositing Test display. ewol::Text m_text; //!< Compositing Test display.
@ -42,6 +33,21 @@ namespace widget {
etk::Vector2D<float> m_selectableAreaPos; //!< Start position of the events etk::Vector2D<float> m_selectableAreaPos; //!< Start position of the events
etk::Vector2D<float> m_selectableAreaSize; //!< Size of the event positions etk::Vector2D<float> m_selectableAreaSize; //!< Size of the event positions
public: public:
/**
* @brief Main constructor.
* @param[in] baseColor basic displayed color.
* @param[in] shaperName The new shaper filename.
*/
ButtonColor(draw::Color baseColor=draw::color::black, etk::UString shaperName="THEME:GUI:widgetButton.conf");
/**
* @brief Main destructor.
*/
virtual ~ButtonColor(void);
/**
* @brief Set the shaper name (use the contructer one this permit to not noad unused shaper).
* @param[in] shaperName The new shaper filename.
*/
void SetShaperName(etk::UString shaperName);
/** /**
* @brief Get the current color of the color selection widget * @brief Get the current color of the color selection widget
* @return The current color * @return The current color
@ -56,7 +62,7 @@ namespace widget {
// Derived function // Derived function
virtual bool CalculateMinSize(void); virtual bool CalculateMinSize(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolButtonColor"; }; virtual const char * const GetObjectType(void) { return "widget::ButtonColor"; };
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function // Derived function

View File

@ -31,7 +31,7 @@ namespace widget {
etk::Vector2D<float> m_currentUserPos; etk::Vector2D<float> m_currentUserPos;
public: public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolColorBar"; }; virtual const char * const GetObjectType(void) { return "widget::ColorBar"; };
// Derived function // Derived function
virtual bool CalculateMinSize(void); virtual bool CalculateMinSize(void);
// Derived function // Derived function

View File

@ -16,15 +16,8 @@ widget::Drawable::Drawable(void)
widget::Drawable::~Drawable(void) widget::Drawable::~Drawable(void)
{ {
//clean all the object ClearOObjectList();
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
delete(m_listOObject[iii]);
m_listOObject[iii] = NULL;
} }
m_listOObject.Clear();
}
void widget::Drawable::AddOObject(ewol::Compositing* newObject, int32_t pos) void widget::Drawable::AddOObject(ewol::Compositing* newObject, int32_t pos)

View File

@ -20,7 +20,7 @@ namespace widget {
Drawable(void); Drawable(void);
virtual ~Drawable(void); virtual ~Drawable(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolDrawable"; }; virtual const char * const GetObjectType(void) { return "widget::Drawable"; };
private: private:
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display... etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display...

View File

@ -76,7 +76,7 @@ int32_t widget::Menu::Add(int32_t parent, etk::UString label, etk::UString image
tmpObject->m_localId = m_staticId++; tmpObject->m_localId = m_staticId++;
tmpObject->m_parentId = parent; tmpObject->m_parentId = parent;
tmpObject->m_widgetPointer = NULL; tmpObject->m_widgetPointer = NULL;
tmpObject->m_label = label; tmpObject->m_label = etk::UString("<left>") + label + "</left>";
tmpObject->m_image = image; tmpObject->m_image = image;
tmpObject->m_generateEvent = generateEvent; tmpObject->m_generateEvent = generateEvent;
tmpObject->m_message = message; tmpObject->m_message = message;

View File

@ -144,10 +144,11 @@ void widget::SizerHori::LockExpendContamination(bool lockExpend)
void widget::SizerHori::SubWidgetRemoveAll(void) void widget::SizerHori::SubWidgetRemoveAll(void)
{ {
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { // the size automaticly decrement with the auto call of the OnObjectRemove function
if (NULL != m_subWidget[iii]) { while (m_subWidget.Size() > 0 ) {
delete(m_subWidget[iii]); if (NULL != m_subWidget[0]) {
m_subWidget[iii] = NULL; delete(m_subWidget[0]);
// no remove, this element is removed with the function OnObjectRemove ==> it does not exist anymore ...
} }
} }
m_subWidget.Clear(); m_subWidget.Clear();
@ -250,7 +251,7 @@ void widget::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
// second step find if in all the elements ... // second step find if in all the elements ...
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) { for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if(m_subWidget[iii] == removeObject) { if(m_subWidget[iii] == removeObject) {
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); EWOL_VERBOSE("Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object");
m_subWidget[iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget.Erase(iii); m_subWidget.Erase(iii);
} }

View File

@ -19,23 +19,6 @@ namespace widget {
public: public:
SizerHori(void); SizerHori(void);
virtual ~SizerHori(void); virtual ~SizerHori(void);
// Derived function
virtual const char * const GetObjectType(void) { return "EwolSizerHori"; };
public:
// Derived function
virtual bool CalculateSize(float availlableX, float availlableY);
// Derived function
virtual bool CalculateMinSize(void);
// Derived function
virtual void SetMinSize(float x=-1, float y=-1);
// Derived function
virtual void SetExpendX(bool newExpend=false);
// Derived function
virtual bool CanExpentX(void);
// Derived function
virtual void SetExpendY(bool newExpend=false);
// Derived function
virtual bool CanExpentY(void);
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
@ -55,6 +38,22 @@ namespace widget {
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
// Derived function
virtual const char * const GetObjectType(void) { return "EwolSizerHori"; };
// Derived function
virtual bool CalculateSize(float availlableX, float availlableY);
// Derived function
virtual bool CalculateMinSize(void);
// Derived function
virtual void SetMinSize(float x=-1, float y=-1);
// Derived function
virtual void SetExpendX(bool newExpend=false);
// Derived function
virtual bool CanExpentX(void);
// Derived function
virtual void SetExpendY(bool newExpend=false);
// Derived function
virtual bool CanExpentY(void);
}; };
}; };

View File

@ -148,9 +148,12 @@ void widget::SizerVert::LockExpendContamination(bool lockExpend)
void widget::SizerVert::SubWidgetRemoveAll(void) void widget::SizerVert::SubWidgetRemoveAll(void)
{ {
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { // the size automaticly decrement with the auto call of the OnObjectRemove function
delete(m_subWidget[iii]); while (m_subWidget.Size() > 0 ) {
m_subWidget[iii] = NULL; if (NULL != m_subWidget[0]) {
delete(m_subWidget[0]);
// no remove, this element is removed with the function OnObjectRemove ==> it does not exist anymore ...
}
} }
m_subWidget.Clear(); m_subWidget.Clear();
} }
@ -251,7 +254,7 @@ void widget::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
// second step find if in all the elements ... // second step find if in all the elements ...
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) { for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
if(m_subWidget[iii] == removeObject) { if(m_subWidget[iii] == removeObject) {
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); EWOL_VERBOSE("Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object");
m_subWidget[iii] = NULL; m_subWidget[iii] = NULL;
m_subWidget.Erase(iii); m_subWidget.Erase(iii);
} }

View File

@ -19,23 +19,6 @@ namespace widget {
public: public:
SizerVert(void); SizerVert(void);
virtual ~SizerVert(void); virtual ~SizerVert(void);
// Derived function
virtual const char * const GetObjectType(void) { return "EwolSizerVert"; };
public:
// Derived function
virtual bool CalculateSize(float availlableX, float availlableY);
// Derived function
virtual bool CalculateMinSize(void);
// Derived function
virtual void SetMinSize(float x=-1, float y=-1);
// Derived function
virtual void SetExpendX(bool newExpend=false);
// Derived function
virtual bool CanExpentX(void);
// Derived function
virtual void SetExpendY(bool newExpend=false);
// Derived function
virtual bool CanExpentY(void);
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
@ -55,6 +38,22 @@ namespace widget {
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos); virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos);
// Derived function // Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
// Derived function
virtual const char * const GetObjectType(void) { return "EwolSizerVert"; };
// Derived function
virtual bool CalculateSize(float availlableX, float availlableY);
// Derived function
virtual bool CalculateMinSize(void);
// Derived function
virtual void SetMinSize(float x=-1, float y=-1);
// Derived function
virtual void SetExpendX(bool newExpend=false);
// Derived function
virtual bool CanExpentX(void);
// Derived function
virtual void SetExpendY(bool newExpend=false);
// Derived function
virtual bool CanExpentY(void);
}; };
}; };

View File

@ -44,25 +44,26 @@ void widget::Spacer::SetSize(float size)
MarkToRedraw(); MarkToRedraw();
} }
void widget::Spacer::OnDraw(ewol::DrawProperty& displayProp)
{
m_draw.Draw();
}
#define BORDER_SIZE_TMP (4) #define BORDER_SIZE_TMP (4)
void widget::Spacer::OnRegenerateDisplay(void) void widget::Spacer::OnRegenerateDisplay(void)
{ {
if (false == NeedRedraw()) { if (false == NeedRedraw()) {
return; return;
} }
// generate a white background and take gray on other surfaces m_draw.Clear();
ClearOObjectList();
if (m_color.a == 0) { if (m_color.a == 0) {
return; return;
} }
ewol::Drawing * tmpDraw = new ewol::Drawing(); m_draw.SetColor(m_color);
if (NULL == tmpDraw) { m_draw.SetPos(etk::Vector3D<float>(0, 0, 0) );
return; m_draw.RectangleWidth(etk::Vector3D<float>(m_size.x, m_size.y) );
}
AddOObject(tmpDraw);
tmpDraw->SetColor(m_color);
tmpDraw->SetPos(etk::Vector3D<float>(0, 0, 0) );
tmpDraw->RectangleWidth(etk::Vector3D<float>(m_size.x, m_size.y) );
} }

View File

@ -12,27 +12,46 @@
#include <etk/types.h> #include <etk/types.h>
#include <draw/Color.h> #include <draw/Color.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/widget/Drawable.h> #include <ewol/widget/Widget.h>
#include <ewol/compositing/Drawing.h>
namespace widget { namespace widget {
class Spacer :public widget::Drawable class Spacer :public ewol::Widget
{ {
private:
ewol::Drawing m_draw; //!< Compositing drawing element
float m_localSize; //!< Local request size of the display
draw::Color m_color; //!< Background color
public: public:
/**
* @brief Main constructer
*/
Spacer(void); Spacer(void);
/**
* @brief Main destructer
*/
virtual ~Spacer(void); virtual ~Spacer(void);
/**
* @brief Set the minimum size requested
* @param[in] size Requested size of the minimum display (in X and Y)
*/
void SetSize(float size);
/**
* @brief Spziby the background color (basicly transparent)
* @param[in] newColor the display background color
*/
void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); };
public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolSpacer"; }; virtual const char * const GetObjectType(void) { return "EwolSpacer"; };
// Derived function // Derived function
virtual bool CalculateMinSize(void); virtual bool CalculateMinSize(void);
void SetSize(float size);
// Derived function // Derived function
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos) { return NULL; }; virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos) { return NULL; };
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); }; // Derived function
private: virtual void OnDraw(ewol::DrawProperty& displayProp);
float m_localSize;
draw::Color m_color;
}; };
}; };

View File

@ -28,7 +28,7 @@ namespace widget {
ColorChooser(void); ColorChooser(void);
~ColorChooser(void); ~ColorChooser(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolColorChooser"; }; virtual const char * const GetObjectType(void) { return "widget::ColorChooser"; };
// Derived function // Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
// Derived function // Derived function

View File

@ -39,7 +39,8 @@ static const char * l_basicLabel = "<center>Test software for EWOL</center>";
#define __class__ "MainWindows" #define __class__ "MainWindows"
MainWindows::MainWindows(void) : MainWindows::MainWindows(void) :
m_idWidget(0) m_idWidget(0),
m_subWidget(NULL)
{ {
APPL_DEBUG("CREATE WINDOWS ... "); APPL_DEBUG("CREATE WINDOWS ... ");
widget::SizerHori* mySizerHori = NULL; widget::SizerHori* mySizerHori = NULL;

View File

@ -41,7 +41,7 @@ static const char * l_eventChangeImageToggle = "event-change-image-toggle";
TestButton::TestButton(void) TestButton::TestButton(void)
{ {
APPL_DEBUG("CREATE "__class__" ... "); APPL_CRITICAL("Create "__class__" (start)");
widget::SizerVert* mySizerVert2 = NULL; widget::SizerVert* mySizerVert2 = NULL;
widget::SizerHori* mySizerHori = NULL; widget::SizerHori* mySizerHori = NULL;
widget::Button* myButton = NULL; widget::Button* myButton = NULL;
@ -189,12 +189,13 @@ TestButton::TestButton(void)
m_spacer[idSpacer]->SetColor(0x00FFFF80); m_spacer[idSpacer]->SetColor(0x00FFFF80);
SubWidgetAdd(m_spacer[idSpacer]); SubWidgetAdd(m_spacer[idSpacer]);
} }
APPL_CRITICAL("Create "__class__" (end)");
} }
TestButton::~TestButton(void) TestButton::~TestButton(void)
{ {
APPL_CRITICAL("Remove "__class__" ...");
} }