[DEV] color button and corection of the unsupressed widgets
This commit is contained in:
parent
426cbbfa78
commit
d61e67773c
@ -241,7 +241,7 @@ 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;
|
||||
}
|
||||
|
||||
void ewol::Drawing::UnLoadProgram(void)
|
||||
{
|
||||
if (NULL!=m_GLprogram) {
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
m_GLprogram = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::Drawing::LoadProgram(void)
|
||||
{
|
||||
// remove previous loading ... in case
|
||||
UnLoadProgram();
|
||||
// oad the new ...
|
||||
etk::UString tmpString("DATA:color3.prog");
|
||||
// get the shader resource :
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
|
@ -50,6 +50,10 @@ namespace ewol
|
||||
* @brief Load the openGL program and get all the ID needed
|
||||
*/
|
||||
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
|
||||
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
|
||||
|
@ -44,6 +44,11 @@ ewol::Shaper::Shaper(etk::UString shaperName) :
|
||||
}
|
||||
|
||||
ewol::Shaper::~Shaper(void)
|
||||
{
|
||||
UnLoadProgram();
|
||||
}
|
||||
|
||||
void ewol::Shaper::UnLoadProgram(void)
|
||||
{
|
||||
if (NULL != m_GLprogram) {
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
@ -73,33 +78,36 @@ void ewol::Shaper::LoadProgram(void)
|
||||
m_confImageFile = m_config->Request("image");
|
||||
}
|
||||
etk::UString basicShaderFile = m_config->GetString(m_confProgramFile);
|
||||
// Get the relative position of the current file ...
|
||||
etk::FSNode file(m_name);
|
||||
etk::UString tmpFilename = file.GetRelativeFolder() + basicShaderFile;
|
||||
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpFilename, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
// Widget property ==> for the Vertex shader
|
||||
m_GLPropertySize = m_GLprogram->GetUniform("EW_widgetProperty.size");
|
||||
m_GLPropertyOrigin = m_GLprogram->GetUniform("EW_widgetProperty.origin");
|
||||
m_GLPropertyInsidePos = m_GLprogram->GetUniform("EW_widgetProperty.insidePos");
|
||||
m_GLPropertyInsideSize = m_GLprogram->GetUniform("EW_widgetProperty.insideSize");
|
||||
// status property ==> for the fragment shader
|
||||
m_GLStateOld = m_GLprogram->GetUniform("EW_status.stateOld");
|
||||
m_GLStateNew = m_GLprogram->GetUniform("EW_status.stateNew");
|
||||
m_GLStateTransition = m_GLprogram->GetUniform("EW_status.transition");
|
||||
// for the texture ID :
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
|
||||
etk::UString basicImageFile = m_config->GetString(m_confImageFile);
|
||||
tmpFilename = file.GetRelativeFolder() + basicImageFile;
|
||||
etk::Vector2D<int32_t> size(64,64);
|
||||
if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) {
|
||||
// nothing else to do ...
|
||||
if (basicShaderFile!="") {
|
||||
// Get the relative position of the current file ...
|
||||
etk::FSNode file(m_name);
|
||||
etk::UString tmpFilename = file.GetRelativeFolder() + basicShaderFile;
|
||||
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpFilename, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
// Widget property ==> for the Vertex shader
|
||||
m_GLPropertySize = m_GLprogram->GetUniform("EW_widgetProperty.size");
|
||||
m_GLPropertyOrigin = m_GLprogram->GetUniform("EW_widgetProperty.origin");
|
||||
m_GLPropertyInsidePos = m_GLprogram->GetUniform("EW_widgetProperty.insidePos");
|
||||
m_GLPropertyInsideSize = m_GLprogram->GetUniform("EW_widgetProperty.insideSize");
|
||||
// status property ==> for the fragment shader
|
||||
m_GLStateOld = m_GLprogram->GetUniform("EW_status.stateOld");
|
||||
m_GLStateNew = m_GLprogram->GetUniform("EW_status.stateNew");
|
||||
m_GLStateTransition = m_GLprogram->GetUniform("EW_status.transition");
|
||||
// for the texture ID :
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
etk::UString basicImageFile = m_config->GetString(m_confImageFile);
|
||||
if (basicImageFile != "") {
|
||||
tmpFilename = file.GetRelativeFolder() + basicImageFile;
|
||||
etk::Vector2D<int32_t> size(64,64);
|
||||
if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) {
|
||||
// nothing else to do ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,8 +251,10 @@ void ewol::Shaper::SetInsidePos(etk::Vector2D<float> newInsidePos)
|
||||
etk::Vector2D<float> ewol::Shaper::GetPadding(void)
|
||||
{
|
||||
etk::Vector2D<float> padding;
|
||||
padding.x = m_config->GetFloat(m_confIdPaddingX);
|
||||
padding.y = m_config->GetFloat(m_confIdPaddingY);
|
||||
if (m_config!=NULL) {
|
||||
padding.x = m_config->GetFloat(m_confIdPaddingX);
|
||||
padding.y = m_config->GetFloat(m_confIdPaddingY);
|
||||
}
|
||||
return padding;
|
||||
}
|
||||
|
||||
@ -252,14 +262,8 @@ etk::Vector2D<float> ewol::Shaper::GetPadding(void)
|
||||
void ewol::Shaper::SetSource(etk::UString newFile)
|
||||
{
|
||||
Clear();
|
||||
if (NULL != m_GLprogram) {
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
m_GLprogram = NULL;
|
||||
}
|
||||
if (NULL != m_config) {
|
||||
ewol::resource::Release(m_config);
|
||||
m_config = NULL;
|
||||
}
|
||||
UnLoadProgram();
|
||||
m_name = newFile;
|
||||
LoadProgram();
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,10 @@ namespace ewol
|
||||
* @brief Load the openGL program and get all the ID needed
|
||||
*/
|
||||
void LoadProgram(void);
|
||||
/**
|
||||
* @brief Un-Load the openGL program and get all the ID needed
|
||||
*/
|
||||
void UnLoadProgram(void);
|
||||
public:
|
||||
/**
|
||||
* @brief generic constructor
|
||||
|
@ -36,6 +36,7 @@ void ewol::EObjectManager::UnInit(void)
|
||||
EWOL_INFO(" Remove missing user widget");
|
||||
while(0<m_eObjectList.Size()) {
|
||||
if (m_eObjectList[0]!=NULL) {
|
||||
EWOL_WARNING("Un-INIT : Remove EObject type=\"" << m_eObjectList[0]->GetObjectType() << "\"");
|
||||
delete(m_eObjectList[0]);
|
||||
m_eObjectList[0] = NULL;
|
||||
} else {
|
||||
@ -95,7 +96,7 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* object)
|
||||
// Remove Element
|
||||
m_eObjectList[iii] = NULL;
|
||||
m_eObjectList.Erase(iii);
|
||||
EWOL_DEBUG("Auto-Remove EObject : [" << object->GetId() << "]");
|
||||
EWOL_DEBUG("Auto-Remove EObject : [" << object->GetId() << "] type=\"" << object->GetObjectType() << "\"");
|
||||
informOneObjectIsRemoved(object);
|
||||
m_eObjectAutoRemoveList.PushBack(object);
|
||||
ewol::ForceRedrawAll();
|
||||
@ -110,6 +111,7 @@ void ewol::EObjectManager::RemoveAllAutoRemove(void)
|
||||
{
|
||||
while(0<m_eObjectAutoRemoveList.Size()) {
|
||||
if (m_eObjectAutoRemoveList[0]!=NULL) {
|
||||
EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->GetObjectType() << "\"");
|
||||
delete(m_eObjectAutoRemoveList[0]);
|
||||
m_eObjectAutoRemoveList[0] = NULL;
|
||||
} else {
|
||||
|
@ -122,8 +122,6 @@ namespace ewol
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
/*
|
||||
bool IsSetCapsLock(void)
|
||||
{
|
||||
return capLock;
|
||||
@ -158,8 +156,12 @@ namespace ewol
|
||||
{
|
||||
return verNum;
|
||||
}
|
||||
bool IsSetInsert(void)
|
||||
{
|
||||
return insert;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
SpecialKey& GetCurrentSpecialKeyStatus(void);
|
||||
};
|
||||
|
||||
|
@ -40,6 +40,7 @@ namespace ewol
|
||||
{
|
||||
private:
|
||||
etk::Vector<ewol::SimpleConfigElement*> m_list;
|
||||
etk::UString m_errorString;
|
||||
public:
|
||||
ConfigFile(etk::UString& filename);
|
||||
virtual ~ConfigFile(void);
|
||||
@ -48,9 +49,9 @@ namespace ewol
|
||||
|
||||
int32_t Request(etk::UString paramName);
|
||||
|
||||
int32_t GetInteger(int32_t id) { return m_list[id]->GetInteger(); };
|
||||
float GetFloat(int32_t id) { return m_list[id]->GetFloat(); };
|
||||
etk::UString& GetString(int32_t id) { return m_list[id]->GetString(); };
|
||||
int32_t GetInteger(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetInteger(); };
|
||||
float GetFloat(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetFloat(); };
|
||||
etk::UString& GetString(int32_t id) { if (id<0) { return m_errorString; } return m_list[id]->GetString(); };
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -29,8 +29,8 @@ extern const char * const ewolEventButtonValue = "ewol-button-value";
|
||||
#define STATUS_DOWN (3)
|
||||
|
||||
|
||||
widget::Button::Button(etk::UString newLabel) :
|
||||
m_shaper("THEME:GUI:widgetButton.conf"),
|
||||
widget::Button::Button(etk::UString newLabel, etk::UString shaperName) :
|
||||
m_shaper(shaperName),
|
||||
m_label(newLabel),
|
||||
m_toggleMode(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);
|
||||
MarkToRedraw();
|
||||
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);
|
||||
MarkToRedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
@ -220,9 +227,11 @@ void widget::Button::OnRegenerateDisplay(void)
|
||||
if( false==m_toggleMode
|
||||
|| false==m_value) {
|
||||
m_displayImage.SetPos(imagePos);
|
||||
m_displayImage.SetColor(m_imageColor);
|
||||
m_displayImage.Print(imageSize);
|
||||
} else {
|
||||
m_displayImageToggle.SetPos(imagePos);
|
||||
m_displayImageToggle.SetColor(m_imageColorToggle);
|
||||
m_displayImageToggle.Print(imageSize);
|
||||
}
|
||||
// update the text position ...
|
||||
|
@ -31,7 +31,9 @@ namespace widget {
|
||||
ewol::Shaper m_shaper; //!< Compositing theme.
|
||||
ewol::Text m_displayText; //!< compositing Text.
|
||||
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.
|
||||
draw::Color m_imageColorToggle; //!< Image color Toggle to display it.
|
||||
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).
|
||||
bool m_toggleMode; //!< The button is able to toggle.
|
||||
@ -47,11 +49,16 @@ namespace widget {
|
||||
* @brief Constructor
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
* @param[in] newLabel The string that might be displayed
|
||||
@ -75,13 +82,15 @@ namespace widget {
|
||||
/**
|
||||
* @brief Set an image to set at the button.
|
||||
* @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.
|
||||
* @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)
|
||||
* @note Work only in toggle mode
|
||||
|
@ -28,8 +28,8 @@ extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Cha
|
||||
#undef __class__
|
||||
#define __class__ "ButtonColor"
|
||||
|
||||
widget::ButtonColor::ButtonColor(draw::Color baseColor) :
|
||||
m_shaper("THEME:GUI:widgetButton.conf"),
|
||||
widget::ButtonColor::ButtonColor(draw::Color baseColor, etk::UString shaperName) :
|
||||
m_shaper(shaperName),
|
||||
m_textColorFg(baseColor),
|
||||
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)
|
||||
{
|
||||
|
@ -22,15 +22,6 @@ extern const char * const ewolEventButtonColorChange;
|
||||
namespace widget {
|
||||
class ButtonColor : public ewol::Widget
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Main constructor
|
||||
*/
|
||||
ButtonColor(draw::Color baseColor=draw::color::black);
|
||||
/**
|
||||
* @brief Main destructor
|
||||
*/
|
||||
virtual ~ButtonColor(void);
|
||||
private:
|
||||
ewol::Shaper m_shaper; //!< Compositing theme.
|
||||
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_selectableAreaSize; //!< Size of the event positions
|
||||
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
|
||||
* @return The current color
|
||||
@ -56,7 +62,7 @@ namespace widget {
|
||||
// Derived function
|
||||
virtual bool CalculateMinSize(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "EwolButtonColor"; };
|
||||
virtual const char * const GetObjectType(void) { return "widget::ButtonColor"; };
|
||||
// Derived function
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
// Derived function
|
||||
|
@ -31,7 +31,7 @@ namespace widget {
|
||||
etk::Vector2D<float> m_currentUserPos;
|
||||
public:
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "EwolColorBar"; };
|
||||
virtual const char * const GetObjectType(void) { return "widget::ColorBar"; };
|
||||
// Derived function
|
||||
virtual bool CalculateMinSize(void);
|
||||
// Derived function
|
||||
|
@ -16,17 +16,10 @@ widget::Drawable::Drawable(void)
|
||||
|
||||
widget::Drawable::~Drawable(void)
|
||||
{
|
||||
//clean all the object
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
m_listOObject[iii] = NULL;
|
||||
}
|
||||
m_listOObject.Clear();
|
||||
|
||||
ClearOObjectList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void widget::Drawable::AddOObject(ewol::Compositing* newObject, int32_t pos)
|
||||
{
|
||||
if (NULL == newObject) {
|
||||
|
@ -20,7 +20,7 @@ namespace widget {
|
||||
Drawable(void);
|
||||
virtual ~Drawable(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "EwolDrawable"; };
|
||||
virtual const char * const GetObjectType(void) { return "widget::Drawable"; };
|
||||
|
||||
private:
|
||||
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display...
|
||||
|
@ -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_parentId = parent;
|
||||
tmpObject->m_widgetPointer = NULL;
|
||||
tmpObject->m_label = label;
|
||||
tmpObject->m_label = etk::UString("<left>") + label + "</left>";
|
||||
tmpObject->m_image = image;
|
||||
tmpObject->m_generateEvent = generateEvent;
|
||||
tmpObject->m_message = message;
|
||||
|
@ -144,10 +144,11 @@ void widget::SizerHori::LockExpendContamination(bool lockExpend)
|
||||
|
||||
void widget::SizerHori::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
delete(m_subWidget[iii]);
|
||||
m_subWidget[iii] = NULL;
|
||||
// the size automaticly decrement with the auto call of the OnObjectRemove function
|
||||
while (m_subWidget.Size() > 0 ) {
|
||||
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();
|
||||
@ -250,7 +251,7 @@ void widget::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
|
||||
// second step find if in all the elements ...
|
||||
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");
|
||||
EWOL_VERBOSE("Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object");
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
}
|
||||
|
@ -19,42 +19,41 @@ namespace widget {
|
||||
public:
|
||||
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:
|
||||
bool m_lockExpendContamination;
|
||||
bool m_lockExpendContamination;
|
||||
etk::Vector<ewol::Widget*> m_subWidget;
|
||||
public:
|
||||
virtual void SubWidgetRemoveAll(void);
|
||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetRemoveAll(void);
|
||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||
protected:
|
||||
// Derived function
|
||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||
public:
|
||||
// Derived function
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
// Derived function
|
||||
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos);
|
||||
// Derived function
|
||||
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);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -148,9 +148,12 @@ void widget::SizerVert::LockExpendContamination(bool lockExpend)
|
||||
|
||||
void widget::SizerVert::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
delete(m_subWidget[iii]);
|
||||
m_subWidget[iii] = NULL;
|
||||
// the size automaticly decrement with the auto call of the OnObjectRemove function
|
||||
while (m_subWidget.Size() > 0 ) {
|
||||
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();
|
||||
}
|
||||
@ -251,7 +254,7 @@ void widget::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
|
||||
// second step find if in all the elements ...
|
||||
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");
|
||||
EWOL_VERBOSE("Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object");
|
||||
m_subWidget[iii] = NULL;
|
||||
m_subWidget.Erase(iii);
|
||||
}
|
||||
|
@ -19,23 +19,6 @@ namespace widget {
|
||||
public:
|
||||
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);
|
||||
private:
|
||||
bool m_lockExpendContamination;
|
||||
@ -55,6 +38,22 @@ namespace widget {
|
||||
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos);
|
||||
// Derived function
|
||||
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);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -44,25 +44,26 @@ void widget::Spacer::SetSize(float size)
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
|
||||
void widget::Spacer::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
m_draw.Draw();
|
||||
}
|
||||
|
||||
|
||||
#define BORDER_SIZE_TMP (4)
|
||||
void widget::Spacer::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (false == NeedRedraw()) {
|
||||
return;
|
||||
}
|
||||
// generate a white background and take gray on other surfaces
|
||||
ClearOObjectList();
|
||||
m_draw.Clear();
|
||||
|
||||
if (m_color.a == 0) {
|
||||
return;
|
||||
}
|
||||
ewol::Drawing * tmpDraw = new ewol::Drawing();
|
||||
if (NULL == tmpDraw) {
|
||||
return;
|
||||
}
|
||||
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) );
|
||||
m_draw.SetColor(m_color);
|
||||
m_draw.SetPos(etk::Vector3D<float>(0, 0, 0) );
|
||||
m_draw.RectangleWidth(etk::Vector3D<float>(m_size.x, m_size.y) );
|
||||
}
|
||||
|
||||
|
@ -12,27 +12,46 @@
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
|
||||
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:
|
||||
/**
|
||||
* @brief Main constructer
|
||||
*/
|
||||
Spacer(void);
|
||||
/**
|
||||
* @brief Main destructer
|
||||
*/
|
||||
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
|
||||
virtual const char * const GetObjectType(void) { return "EwolSpacer"; };
|
||||
// Derived function
|
||||
virtual bool CalculateMinSize(void);
|
||||
void SetSize(float size);
|
||||
virtual bool CalculateMinSize(void);
|
||||
// Derived function
|
||||
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos) { return NULL; };
|
||||
// Derived function
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); };
|
||||
private:
|
||||
float m_localSize;
|
||||
draw::Color m_color;
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
// Derived function
|
||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ namespace widget {
|
||||
ColorChooser(void);
|
||||
~ColorChooser(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "EwolColorChooser"; };
|
||||
virtual const char * const GetObjectType(void) { return "widget::ColorChooser"; };
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
// Derived function
|
||||
|
@ -39,7 +39,8 @@ static const char * l_basicLabel = "<center>Test software for EWOL</center>";
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
MainWindows::MainWindows(void) :
|
||||
m_idWidget(0)
|
||||
m_idWidget(0),
|
||||
m_subWidget(NULL)
|
||||
{
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
|
@ -41,7 +41,7 @@ static const char * l_eventChangeImageToggle = "event-change-image-toggle";
|
||||
|
||||
TestButton::TestButton(void)
|
||||
{
|
||||
APPL_DEBUG("CREATE "__class__" ... ");
|
||||
APPL_CRITICAL("Create "__class__" (start)");
|
||||
widget::SizerVert* mySizerVert2 = NULL;
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
@ -189,12 +189,13 @@ TestButton::TestButton(void)
|
||||
m_spacer[idSpacer]->SetColor(0x00FFFF80);
|
||||
SubWidgetAdd(m_spacer[idSpacer]);
|
||||
}
|
||||
APPL_CRITICAL("Create "__class__" (end)");
|
||||
}
|
||||
|
||||
|
||||
TestButton::~TestButton(void)
|
||||
{
|
||||
|
||||
APPL_CRITICAL("Remove "__class__" ...");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user