[DEV] start to reworks the widget class to simplify and normalize it (last rework)

This commit is contained in:
Edouard DUPIN 2013-04-09 21:17:47 +02:00
parent 56eafd762f
commit 100fbd43e2
48 changed files with 1066 additions and 619 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 64812713c7bfa87ab1f3368cf58cca7d6d996007 Subproject commit f9951e9f5566eca104348a1bbf84f5721f5ce63d

View File

@ -576,8 +576,8 @@ void eSystem::ForceRedrawAll(void)
{ {
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows(); ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
if (NULL != tmpWindows) { if (NULL != tmpWindows) {
ivec2 tmpSize = eSystem::GetSize(); ivec2 systemSize = eSystem::GetSize();
tmpWindows->CalculateSize(tmpSize.x(), tmpSize.y()); tmpWindows->CalculateSize(vec2(systemSize.x(), systemSize.y()));
} }
} }

View File

@ -29,6 +29,23 @@ extern const char * const ewolEventButtonValue = "ewol-button-value";
#define STATUS_DOWN (3) #define STATUS_DOWN (3)
static ewol::Widget* Create(void)
{
return new widget::Button();
}
void widget::Button::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Button::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Button::Button(const etk::UString& shaperName) : widget::Button::Button(const etk::UString& shaperName) :
m_shaper(shaperName), m_shaper(shaperName),
m_toggleMode(false), m_toggleMode(false),
@ -68,16 +85,9 @@ void widget::Button::SetShaperName(const etk::UString& shaperName)
m_shaper.SetSource(shaperName); m_shaper.SetSource(shaperName);
} }
void widget::Button::SetSubWidget(ewol::Widget* subWidget, bool forToggle) void widget::Button::SetSubWidget(ewol::Widget* subWidget)
{ {
if (subWidget==NULL) {
EWOL_WARNING("try to set an empty widget in the Button entity");
return;
}
int32_t idWidget=0; int32_t idWidget=0;
if (forToggle==true) {
idWidget = 1;
}
if (NULL!=m_subWidget[idWidget]) { if (NULL!=m_subWidget[idWidget]) {
delete(m_subWidget[idWidget]); delete(m_subWidget[idWidget]);
// the pointer might already set at NULL: // the pointer might already set at NULL:
@ -91,17 +101,36 @@ void widget::Button::SetSubWidget(ewol::Widget* subWidget, bool forToggle)
// element change ... We need to recalculate all the subElments : // element change ... We need to recalculate all the subElments :
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
} }
ewol::Widget* widget::Button::GetSubWidget(bool fromToggle)
void widget::Button::SetSubWidgetToggle(ewol::Widget* subWidget)
{ {
int32_t idWidget=0; int32_t idWidget=1;
if (fromToggle==true) { if (NULL!=m_subWidget[idWidget]) {
idWidget = 1; delete(m_subWidget[idWidget]);
// the pointer might already set at NULL:
if (NULL != m_subWidget[idWidget]) {
EWOL_ERROR("error while removing previous widget...");
m_subWidget[idWidget]=NULL;
}
} }
return m_subWidget[idWidget]; EWOL_DEBUG("Add button : " << idWidget << " element : " << (int64_t)subWidget);
m_subWidget[idWidget] = subWidget;
// element change ... We need to recalculate all the subElments :
ewol::RequestUpdateSize();
}
ewol::Widget* widget::Button::GetSubWidget(void)
{
return m_subWidget[0];
}
ewol::Widget* widget::Button::GetSubWidgetToggle(void)
{
return m_subWidget[1];
} }
bool widget::Button::CalculateSize(float availlableX, float availlableY) void widget::Button::CalculateSize(const vec2& availlable)
{ {
vec2 padding = m_shaper.GetPadding(); vec2 padding = m_shaper.GetPadding();
// set minimal size // set minimal size
@ -111,10 +140,10 @@ bool widget::Button::CalculateSize(float availlableX, float availlableY)
vec2 minimumSizeToggle(0,0); vec2 minimumSizeToggle(0,0);
// Checking the expend properties : // Checking the expend properties :
if (m_userExpend.x() == true) { if (m_userExpend.x() == true) {
m_size.setX(availlableX); m_size.setX(availlable.x());
} }
if (m_userExpend.y() == true) { if (m_userExpend.y() == true) {
m_size.setY(availlableY); m_size.setY(availlable.y());
} }
// Checkin the filling properties ==> for the subElements: // Checkin the filling properties ==> for the subElements:
vec2 subElementSize = m_minSize; vec2 subElementSize = m_minSize;
@ -127,22 +156,21 @@ bool widget::Button::CalculateSize(float availlableX, float availlableY)
vec2 origin = (m_size - subElementSize)/2.0f + padding; vec2 origin = (m_size - subElementSize)/2.0f + padding;
subElementSize -= padding*2.0f; subElementSize -= padding*2.0f;
if (NULL!=m_subWidget[0]) { if (NULL!=m_subWidget[0]) {
m_subWidget[0]->SetOrigin(m_origin.x()+origin.x(), m_origin.y()+origin.y()); m_subWidget[0]->SetOrigin(m_origin+origin);
m_subWidget[0]->CalculateSize(subElementSize.x(), subElementSize.y()); m_subWidget[0]->CalculateSize(subElementSize);
} }
if (NULL!=m_subWidget[1]) { if (NULL!=m_subWidget[1]) {
m_subWidget[1]->SetOrigin(m_origin.x()+origin.x(), m_origin.y()+origin.y()); m_subWidget[1]->SetOrigin(m_origin+origin);
m_subWidget[1]->CalculateSize(subElementSize.x(), subElementSize.y()); m_subWidget[1]->CalculateSize(subElementSize);
} }
//EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << ""); //EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << "");
m_selectableAreaSize = subElementSize + (padding*2.0f); m_selectableAreaSize = subElementSize + (padding*2.0f);
m_selectableAreaPos = origin-padding; m_selectableAreaPos = origin-padding;
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::Button::CalculateMinSize(void) void widget::Button::CalculateMinSize(void)
{ {
vec2 padding = m_shaper.GetPadding(); vec2 padding = m_shaper.GetPadding();
vec2 minimumSizeBase(0,0); vec2 minimumSizeBase(0,0);
@ -164,7 +192,6 @@ bool widget::Button::CalculateMinSize(void)
// verify the min max of the min size ... // verify the min max of the min size ...
CheckMinSize(); CheckMinSize();
MarkToRedraw(); MarkToRedraw();
return true;
} }
void widget::Button::OnDraw(ewol::DrawProperty& displayProp) void widget::Button::OnDraw(ewol::DrawProperty& displayProp)
@ -189,10 +216,10 @@ void widget::Button::OnRegenerateDisplay(void)
if (true == NeedRedraw()) { if (true == NeedRedraw()) {
vec2 padding = m_shaper.GetPadding(); vec2 padding = m_shaper.GetPadding();
m_shaper.Clear(); m_shaper.Clear();
m_shaper.SetOrigin(m_selectableAreaPos); m_shaper.SetOrigin(vec2ClipInt32(m_selectableAreaPos));
m_shaper.SetSize(m_selectableAreaSize); m_shaper.SetSize(vec2ClipInt32(m_selectableAreaSize));
m_shaper.SetInsidePos(m_selectableAreaPos+padding ); m_shaper.SetInsidePos(vec2ClipInt32(m_selectableAreaPos+padding));
m_shaper.SetInsideSize(m_selectableAreaSize-padding*2.0f); m_shaper.SetInsideSize(vec2ClipInt32(m_selectableAreaSize-padding*2.0f));
} }
if( false == m_toggleMode if( false == m_toggleMode
|| false == m_value) { || false == m_value) {
@ -227,6 +254,7 @@ void widget::Button::SetToggleMode(bool togg)
m_value = false; m_value = false;
// TODO : Change display and send event ... // TODO : Change display and send event ...
} }
CheckStatus();
MarkToRedraw(); MarkToRedraw();
} }
} }
@ -286,19 +314,7 @@ bool widget::Button::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput,
} }
if( m_mouseHover != previousHoverState if( m_mouseHover != previousHoverState
|| m_buttonPressed != previousPressed) { || m_buttonPressed != previousPressed) {
if (true==m_buttonPressed) { CheckStatus();
ChangeStatusIn(STATUS_PRESSED);
} else {
if (true==m_mouseHover) {
ChangeStatusIn(STATUS_HOVER);
} else {
if (true == m_value) {
ChangeStatusIn(STATUS_DOWN);
} else {
ChangeStatusIn(STATUS_UP);
}
}
}
} }
return m_mouseHover; return m_mouseHover;
} }
@ -314,7 +330,22 @@ bool widget::Button::OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t un
return false; return false;
} }
void widget::Button::CheckStatus(void)
{
if (true==m_buttonPressed) {
ChangeStatusIn(STATUS_PRESSED);
} else {
if (true==m_mouseHover) {
ChangeStatusIn(STATUS_HOVER);
} else {
if (true == m_value) {
ChangeStatusIn(STATUS_DOWN);
} else {
ChangeStatusIn(STATUS_UP);
}
}
}
}
void widget::Button::ChangeStatusIn(int32_t newStatusId) void widget::Button::ChangeStatusIn(int32_t newStatusId)
{ {

View File

@ -31,6 +31,9 @@ namespace widget {
*/ */
class Button : public ewol::Widget class Button : public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
private: private:
ewol::Shaper m_shaper; //!< Compositing theme. ewol::Shaper m_shaper; //!< Compositing theme.
ewol::Widget* m_subWidget[2]; //!< subwidget of the button ewol::Widget* m_subWidget[2]; //!< subwidget of the button
@ -58,15 +61,25 @@ namespace widget {
*/ */
void SetShaperName(const etk::UString& shaperName); void SetShaperName(const etk::UString& shaperName);
/** /**
* @brief Specify the current composition string * @brief Specify the current widget
* @param[in] newLabel The string that might be displayed * @param[in] subWidget Widget to add normal
*/ */
void SetSubWidget(ewol::Widget* subWidget, bool forToggle=false); void SetSubWidget(ewol::Widget* subWidget);
/**
* @brief Specify the current widget
* @param[in] subWidget Widget to add Toggle
*/
void SetSubWidgetToggle(ewol::Widget* subWidget);
/** /**
* @brief Get the current displayed composition * @brief Get the current displayed composition
* @return The displayed string. * @return The base widget
*/ */
ewol::Widget* GetSubWidget(bool fromToggle=false); ewol::Widget* GetSubWidget(void);
/**
* @brief Get the current displayed composition
* @return The toggle widget
*/
ewol::Widget* GetSubWidgetToggle(void);
/** /**
* @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
@ -90,11 +103,15 @@ namespace widget {
* @param[in] new state * @param[in] new state
*/ */
void ChangeStatusIn(int32_t newStatusId); void ChangeStatusIn(int32_t newStatusId);
/**
* @brief update the status with the internal satte of the button ...
*/
void CheckStatus(void);
public: public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "widget::Button"; }; virtual const char * const GetObjectType(void) { return "widget::Button"; };
virtual bool CalculateMinSize(void); virtual void CalculateMinSize(void);
virtual bool CalculateSize(float availlableX, float availlableY); virtual void CalculateSize(const vec2& availlable);
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);

View File

@ -28,6 +28,24 @@ extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Cha
#undef __class__ #undef __class__
#define __class__ "ButtonColor" #define __class__ "ButtonColor"
static ewol::Widget* Create(void)
{
return new widget::ButtonColor();
}
void widget::ButtonColor::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::ButtonColor::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::ButtonColor::ButtonColor(draw::Color baseColor, etk::UString shaperName) : widget::ButtonColor::ButtonColor(draw::Color baseColor, etk::UString shaperName) :
m_shaper(shaperName), m_shaper(shaperName),
m_textColorFg(baseColor), m_textColorFg(baseColor),
@ -53,7 +71,7 @@ void widget::ButtonColor::SetShaperName(etk::UString shaperName)
} }
bool widget::ButtonColor::CalculateMinSize(void) void widget::ButtonColor::CalculateMinSize(void)
{ {
vec2 padding = m_shaper.GetPadding(); vec2 padding = m_shaper.GetPadding();
etk::UString label = draw::GetString(m_textColorFg); etk::UString label = draw::GetString(m_textColorFg);
@ -61,7 +79,6 @@ bool widget::ButtonColor::CalculateMinSize(void)
m_minSize.setX(padding.x()*2 + minSize.x() + 7); m_minSize.setX(padding.x()*2 + minSize.x() + 7);
m_minSize.setY(padding.y()*2 + minSize.y() ); m_minSize.setY(padding.y()*2 + minSize.y() );
MarkToRedraw(); MarkToRedraw();
return true;
} }

View File

@ -22,16 +22,19 @@ extern const char * const ewolEventButtonColorChange;
namespace widget { namespace widget {
class ButtonColor : public ewol::Widget class ButtonColor : public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(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.
draw::Color m_textColorFg; //!< Current color. draw::Color m_textColorFg; //!< Current color.
widget::ContextMenu* m_widgetContextMenu; //!< Specific context menu. widget::ContextMenu* m_widgetContextMenu; //!< Specific context menu.
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed. bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area : // hover area :
vec2 m_selectableAreaPos; //!< Start position of the events vec2 m_selectableAreaPos; //!< Start position of the events
vec2 m_selectableAreaSize; //!< Size of the event positions vec2 m_selectableAreaSize; //!< Size of the event positions
public: public:
/** /**
* @brief Main constructor. * @brief Main constructor.
@ -60,16 +63,11 @@ namespace widget {
void SetValue(draw::Color color); void SetValue(draw::Color color);
public: public:
// Derived function // Derived function
virtual bool CalculateMinSize(void); virtual void CalculateMinSize(void);
// Derived function
virtual const char * const GetObjectType(void) { return "widget::ButtonColor"; }; virtual const char * const GetObjectType(void) { return "widget::ButtonColor"; };
// Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
// 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);
private: private:
/** /**

View File

@ -15,9 +15,25 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
#undef __class__ #undef __class__
#define __class__ "CheckBox" #define __class__ "CheckBox"
static ewol::Widget* Create(void)
{
return new widget::CheckBox();
}
void widget::CheckBox::Init(void) void widget::CheckBox::Init(void)
{ {
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::CheckBox::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::CheckBox::CheckBox(const etk::UString& newLabel)
{
m_label = newLabel;
AddEventId(ewolEventCheckBoxClicked); AddEventId(ewolEventCheckBoxClicked);
m_textColorFg = draw::color::black; m_textColorFg = draw::color::black;
m_textColorBg = draw::color::white; m_textColorBg = draw::color::white;
@ -26,18 +42,6 @@ void widget::CheckBox::Init(void)
SetMouseLimit(1); SetMouseLimit(1);
} }
widget::CheckBox::CheckBox(void)
{
m_label = "No Label";
Init();
}
widget::CheckBox::CheckBox(etk::UString newLabel)
{
m_label = newLabel;
Init();
}
widget::CheckBox::~CheckBox(void) widget::CheckBox::~CheckBox(void)
{ {
@ -45,14 +49,13 @@ widget::CheckBox::~CheckBox(void)
} }
bool widget::CheckBox::CalculateMinSize(void) void widget::CheckBox::CalculateMinSize(void)
{ {
vec3 minSize = m_oObjectText.CalculateSize(m_label); vec3 minSize = m_oObjectText.CalculateSize(m_label);
float boxSize = etk_max(20, minSize.y()) + 5; float boxSize = etk_max(20, minSize.y()) + 5;
m_minSize.setX(boxSize+minSize.x()); m_minSize.setX(boxSize+minSize.x());
m_minSize.setY(etk_max(boxSize, minSize.y())+3); m_minSize.setY(etk_max(boxSize, minSize.y())+3);
MarkToRedraw(); MarkToRedraw();
return true;
} }

View File

@ -21,32 +21,28 @@ namespace widget {
class CheckBox : public ewol::Widget class CheckBox : public ewol::Widget
{ {
public: public:
CheckBox(void); static void Init(void);
CheckBox(etk::UString newLabel); static void UnInit(void);
// Derived function public:
virtual const char * const GetObjectType(void) { return "EwolCheckBox"; }; CheckBox(const etk::UString& newLabel = "No Label");
void Init(void);
virtual ~CheckBox(void); virtual ~CheckBox(void);
// Derived function void SetLabel(etk::UString newLabel);
virtual bool CalculateMinSize(void); void SetValue(bool val);
void SetLabel(etk::UString newLabel); bool GetValue(void);
void SetValue(bool val);
bool GetValue(void);
private: private:
ewol::Text m_oObjectText; ewol::Text m_oObjectText;
ewol::Drawing m_oObjectDecoration; ewol::Drawing m_oObjectDecoration;
etk::UString m_label; etk::UString m_label;
bool m_value; bool m_value;
draw::Color m_textColorFg; //!< Text color draw::Color m_textColorFg; //!< Text color
draw::Color m_textColorBg; //!< Background color draw::Color m_textColorBg; //!< Background color
public: public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "Ewol::CheckBox"; };
virtual void CalculateMinSize(void);
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
// Derived function
virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData); virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData);
}; };

View File

@ -35,11 +35,10 @@ widget::ColorBar::~ColorBar(void)
} }
bool widget::ColorBar::CalculateMinSize(void) void widget::ColorBar::CalculateMinSize(void)
{ {
m_minSize.setValue(160, 80); m_minSize.setValue(160, 80);
MarkToRedraw(); MarkToRedraw();
return true;
} }
static draw::Color s_listColorWhite(0xFFFFFFFF); static draw::Color s_listColorWhite(0xFFFFFFFF);
static draw::Color s_listColorBlack(0x000000FF); static draw::Color s_listColorBlack(0x000000FF);

View File

@ -32,13 +32,9 @@ namespace widget {
public: public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "widget::ColorBar"; }; virtual const char * const GetObjectType(void) { return "widget::ColorBar"; };
// Derived function virtual void CalculateMinSize(void);
virtual bool CalculateMinSize(void);
// Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
}; };

View File

@ -8,25 +8,28 @@
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/widget/XmlComposer.h> #include <ewol/widget/Composer.h>
#include <etk/os/FSNode.h>
#include <ewol/widget/WidgetManager.h>
/* widget::Composer::Composer(void) :
ewol::Widget* m_widget; m_subWidget(NULL)
etk::UString composerString;
etk::Vector<ComposerWidgetListNamed> m_list;
*/
widget::XmlComposer::XmlComposer(const etk::UString& composerXmlString)
{ {
// TODO ... // nothing to do ...
} }
widget::XmlComposer::~XmlComposer(void) widget::Composer::~Composer(void)
{ {
if (NULL != m_widget) { Clean();
delete(m_widget); }
void widget::Composer::Clean(void)
{
if (NULL != m_subWidget) {
delete(m_subWidget);
// might have been destroy first here : // might have been destroy first here :
if (m_widget!=NULL) { if (m_subWidget!=NULL) {
EWOL_ERROR("Composer : An error Occured when removing main node"); EWOL_ERROR("Composer : An error Occured when removing main node");
} }
} }
@ -36,13 +39,99 @@ widget::XmlComposer::~XmlComposer(void)
} }
} }
ewol::Widget* widget::XmlComposer::GetMainWidget(void)
bool widget::Composer::LoadFromFile(const etk::UString& _fileName)
{ {
// nothing else to do ... // open the curent File
return m_widget; etk::FSNode fileName(_fileName);
if (false == fileName.Exist()) {
EWOL_ERROR("File Does not exist : " << fileName);
return false;
}
int32_t fileSize = fileName.FileSize();
if (0==fileSize) {
EWOL_ERROR("This file is empty : " << fileName);
return false;
}
if (false == fileName.FileOpenRead()) {
EWOL_ERROR("Can not open the file : " << fileName);
return false;
}
// allocate data
char * fileBuffer = new char[fileSize+5];
if (NULL == fileBuffer) {
EWOL_ERROR("Error Memory allocation size=" << fileSize);
return false;
}
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
// load data from the file :
fileName.FileRead(fileBuffer, 1, fileSize);
// close the file:
fileName.FileClose();
bool ret = CommonLoadXML((const char*)fileBuffer);
if (NULL != fileBuffer) {
delete[] fileBuffer;
}
return ret;
} }
ewol::Widget* widget::XmlComposer::GetWidgetNamed(const etk::UString& widgetName) bool widget::Composer::LoadFromString(const etk::UString& composerXmlString)
{
etk::Char tmpData = composerXmlString.c_str();
return CommonLoadXML(tmpData);
}
bool widget::Composer::CommonLoadXML(const char* data)
{
if (NULL==data) {
return false;
}
TiXmlDocument XmlDocument;
// load the XML from the memory
XmlDocument.Parse(data, 0, TIXML_ENCODING_UTF8);
TiXmlElement* root = XmlDocument.FirstChildElement("composer");
if (NULL == root ) {
EWOL_ERROR("(l ?) main node not find: \"composer\" ...");
return false;
}
// remove previous elements ...
Clean();
ewol::Widget::LoadXML(root);
for(TiXmlNode * pNode = root->FirstChild() ;
NULL != pNode ;
pNode = pNode->NextSibling() ) {
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
continue;
}
etk::UString widgetName = pNode->Value();
if (ewol::widgetManager::Exist(widgetName) == false) {
EWOL_ERROR("(l "<<pNode->Row()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
continue;
}
if (NULL != m_subWidget) {
EWOL_ERROR("(l "<<pNode->Row()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
continue;
}
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
if (tmpWidget == NULL) {
EWOL_ERROR ("(l "<<pNode->Row()<<") Can not create the widget : \"" << widgetName << "\"");
continue;
}
if (false == tmpWidget->LoadXML(pNode)) {
EWOL_ERROR ("(l "<<pNode->Row()<<") can not load widget properties : \"" << widgetName << "\"");
return false;
}
}
return true;
}
ewol::Widget* widget::Composer::GetWidgetNamed(const etk::UString& widgetName)
{ {
for (int32_t iii=0; iii<m_list.Size(); iii++) { for (int32_t iii=0; iii<m_list.Size(); iii++) {
if (m_list[iii].widgetName == widgetName) { if (m_list[iii].widgetName == widgetName) {
@ -52,11 +141,40 @@ ewol::Widget* widget::XmlComposer::GetWidgetNamed(const etk::UString& widgetName
return NULL; return NULL;
} }
virtual void widget::XmlComposer::OnObjectRemove(ewol::EObject* removeObject) void widget::Composer::OnObjectRemove(ewol::EObject* removeObject)
{ {
for (int32_t iii=0; iii<m_list.Size(); iii++) { for (int32_t iii=0; iii<m_list.Size(); iii++) {
if (m_list[iii].widgetName == widgetName) { if (m_list[iii].widget == removeObject) {
m_list.Erase(iii); m_list.Erase(iii);
} }
} }
if (m_subWidget==removeObject) {
m_subWidget=NULL;
}
}
void widget::Composer::OnDraw(ewol::DrawProperty& displayProp)
{
if (NULL!=m_subWidget) {
m_subWidget->GenDraw(displayProp);
}
}
void widget::Composer::CalculateSize(const vec2& availlable)
{
if (NULL!=m_subWidget) {
m_subWidget->CalculateSize(availlable);
// copy all sub parameters:
m_hide = m_subWidget->IsHide();
}
}
void widget::Composer::CalculateMinSize(void)
{
if (NULL!=m_subWidget) {
m_subWidget->CalculateMinSize();
// copy all sub parameters :
m_hide = m_subWidget->IsHide();
m_userFill = m_subWidget->CanFill();
}
} }

View File

@ -6,8 +6,8 @@
* @license BSD v3 (see license file) * @license BSD v3 (see license file)
*/ */
#ifndef __EWOL_XML_COMPOSER_H__ #ifndef __EWOL_WIDGET_COMPOSER_H__
#define __EWOL_XML_COMPOSER_H__ #define __EWOL_WIDGET_COMPOSER_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/debug.h> #include <ewol/debug.h>
@ -15,26 +15,54 @@
namespace widget namespace widget
{ {
class XmlComposer : public ewol::EObject /**
* @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
*/
class Composer : public ewol::Widget
{ {
private: private:
class ComposerWidgetListNamed { class ComposerWidgetListNamed {
public: public:
ewol::Widget* widget; ewol::Widget* widget;
etk::UString widgetName; etk::UString widgetName;
} };
ewol::Widget* m_widget; ewol::Widget* m_subWidget;
etk::UString composerString;
etk::Vector<ComposerWidgetListNamed> m_list; etk::Vector<ComposerWidgetListNamed> m_list;
public: public:
/** /**
* @brief Constructor * @brief Constructor
*/ */
XmlComposer(const etk::UString& composerXmlString); Composer(void);
/** /**
* @brief Destructor * @brief Destructor
*/ */
~XmlComposer(void); ~Composer(void);
/**
* @brief Remove all sub elements
*/
void Clean(void);
/**
* @brief Load a composition with a file
* @param[in] fileName Name of the file
* @return true ==> all done OK
* @return false ==> some error occured
*/
bool LoadFromFile(const etk::UString& fileName);
/**
* @brief Load a composition with a file
* @param[in] composerXmlString xml to parse directly
* @return true ==> all done OK
* @return false ==> some error occured
*/
bool LoadFromString(const etk::UString& composerXmlString);
private:
/**
* @brief Load a composition with a file.
* @param[in] data pointer on the file data.
* @return true ==> all done OK.
* @return false ==> some error occured.
*/
bool CommonLoadXML(const char* data);
public: public:
/** /**
* @brief Get the main node widget * @brief Get the main node widget
@ -48,9 +76,13 @@ namespace widget
*/ */
ewol::Widget* GetWidgetNamed(const etk::UString& widgetName); ewol::Widget* GetWidgetNamed(const etk::UString& widgetName);
public: protected: // Derived function
// herited function : virtual void OnDraw(ewol::DrawProperty& displayProp);
public:// Derived function
virtual void OnObjectRemove(ewol::EObject* removeObject); virtual void OnObjectRemove(ewol::EObject* removeObject);
virtual void CalculateSize(const vec2& availlable);
virtual void CalculateMinSize(void);
// TODO : Call all sub element getter an setter ==> this object might be transparent ...
}; };
}; };

View File

@ -37,20 +37,20 @@ widget::ContextMenu::~ContextMenu(void)
} }
bool widget::ContextMenu::CalculateSize(float availlableX, float availlableY) void widget::ContextMenu::CalculateSize(const vec2& availlable)
{ {
EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); //EWOL_DEBUG("CalculateSize=" << availlable);
// pop-up fill all the display : // pop-up fill all the display :
m_size.setValue(availlableX, availlableY); m_size = availlable;
if (NULL != m_subWidget) { if (NULL != m_subWidget) {
vec2 subWidgetSize; vec2 subWidgetSize;
vec2 subWidgetOrigin; vec2 subWidgetOrigin;
subWidgetSize = m_subWidget->GetMinSize(); subWidgetSize = m_subWidget->GetMinSize();
if (true == m_subWidget->CanExpentX()) { if (true == m_subWidget->CanExpand().x()) {
subWidgetSize.setX(m_size.x()); subWidgetSize.setX(m_size.x());
} }
if (true == m_subWidget->CanExpentY()) { if (true == m_subWidget->CanExpand().y()) {
subWidgetSize.setY(m_size.y()); subWidgetSize.setY(m_size.y());
} }
int32_t minWidth = 100; int32_t minWidth = 100;
@ -98,15 +98,14 @@ bool widget::ContextMenu::CalculateSize(float availlableX, float availlableY)
} }
break; break;
} }
m_subWidget->SetOrigin(subWidgetOrigin.x(), subWidgetOrigin.y()); m_subWidget->SetOrigin(subWidgetOrigin);
m_subWidget->CalculateSize(subWidgetSize.x(), subWidgetSize.y()); m_subWidget->CalculateSize(subWidgetSize);
} }
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::ContextMenu::CalculateMinSize(void) void widget::ContextMenu::CalculateMinSize(void)
{ {
EWOL_DEBUG("CalculateMinSize"); EWOL_DEBUG("CalculateMinSize");
m_userExpend.setValue(false,false); m_userExpend.setValue(false,false);
@ -117,24 +116,18 @@ bool widget::ContextMenu::CalculateMinSize(void)
} }
EWOL_DEBUG("CalculateMinSize=>>" << m_minSize); EWOL_DEBUG("CalculateMinSize=>>" << m_minSize);
MarkToRedraw(); MarkToRedraw();
return true;
} }
void widget::ContextMenu::SetMinSise(float x, float y) void widget::ContextMenu::SetMinSize(const vec2& size)
{ {
EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)"); EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)");
} }
void widget::ContextMenu::SetExpendX(bool newExpend) void widget::ContextMenu::SetExpand(const bvec2& newExpend)
{ {
EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)"); EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)");
} }
void widget::ContextMenu::SetExpendY(bool newExpend)
{
EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)");
}
void widget::ContextMenu::SubWidgetSet(ewol::Widget* newWidget) void widget::ContextMenu::SubWidgetSet(ewol::Widget* newWidget)
{ {

View File

@ -31,32 +31,29 @@ namespace widget {
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolContextMenu"; }; virtual const char * const GetObjectType(void) { return "EwolContextMenu"; };
public: public:
virtual bool CalculateSize(float availlableX, float availlableY); // this generate the current size ... virtual void CalculateSize(const vec2& availlable); // this generate the current size ...
virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer virtual void CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer
virtual void SetMinSise(float x=-1, float y=-1); virtual void SetMinSize(const vec2& size);
virtual void SetExpendX(bool newExpend=false); virtual void SetExpand(const bvec2& newExpend);
virtual void SetExpendY(bool newExpend=false);
private: private:
draw::Color m_colorBackGroung; draw::Color m_colorBackGroung;
draw::Color m_colorBorder; draw::Color m_colorBorder;
vec2 m_padding; vec2 m_padding;
vec2 m_arrowPos; vec2 m_arrowPos;
float m_offset; float m_offset;
markPosition_te m_arrawBorder; markPosition_te m_arrawBorder;
ewol::Widget* m_subWidget; ewol::Widget* m_subWidget;
public: public:
void SubWidgetSet(ewol::Widget* newWidget); void SubWidgetSet(ewol::Widget* newWidget);
void SubWidgetRemove(void); void SubWidgetRemove(void);
void SetPositionMark(markPosition_te position, vec2 arrowPos); void SetPositionMark(markPosition_te position, vec2 arrowPos);
protected: protected:
// Derived function // Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
public: public:
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function virtual ewol::Widget* GetWidgetAtPos(vec2 pos);
virtual ewol::Widget * GetWidgetAtPos(vec2 pos);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
}; };

View File

@ -31,6 +31,21 @@ const char * const ewolEventEntrySelect = "ewol-Entry-Select";
#define STATUS_HOVER (1) #define STATUS_HOVER (1)
#define STATUS_SELECTED (2) #define STATUS_SELECTED (2)
static ewol::Widget* Create(void)
{
return new widget::Entry();
}
void widget::Entry::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Entry::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Entry::Entry(etk::UString newData) : widget::Entry::Entry(etk::UString newData) :
m_shaper("THEME:GUI:widgetEntry.conf"), m_shaper("THEME:GUI:widgetEntry.conf"),
@ -66,7 +81,7 @@ widget::Entry::~Entry(void)
} }
bool widget::Entry::CalculateMinSize(void) void widget::Entry::CalculateMinSize(void)
{ {
vec2 padding = m_shaper.GetPadding(); vec2 padding = m_shaper.GetPadding();
@ -75,7 +90,6 @@ bool widget::Entry::CalculateMinSize(void)
minHeight + 2*padding.y()); minHeight + 2*padding.y());
UpdateTextPosition(); UpdateTextPosition();
MarkToRedraw(); MarkToRedraw();
return true;
} }

View File

@ -33,6 +33,9 @@ namespace widget {
*/ */
class Entry : public ewol::Widget class Entry : public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
private: private:
ewol::Shaper m_shaper; ewol::Shaper m_shaper;
ewol::Text m_oObjectText; //!< text display ewol::Text m_oObjectText; //!< text display
@ -54,29 +57,22 @@ namespace widget {
* @brief Destuctor * @brief Destuctor
*/ */
virtual ~Entry(void); virtual ~Entry(void);
// Derived function void SetValue(etk::UString newData);
virtual const char * const GetObjectType(void) { return "EwolEntry"; }; etk::UString GetValue(void);
// Derived function void SetWidth(int32_t width)
virtual bool CalculateMinSize(void);
void SetValue(etk::UString newData);
etk::UString GetValue(void);
void SetWidth(int32_t width)
{ {
m_userSize = width; m_userSize = width;
} }
public: public:
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
// Derived function
virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData); virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData);
// Derived function
virtual bool OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent); virtual bool OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent);
// 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
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID); virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual const char * const GetObjectType(void) { return "EwolEntry"; };
virtual void CalculateMinSize(void);
protected: protected:
// Derived function // Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);

View File

@ -15,11 +15,27 @@
#define __class__ "Gird" #define __class__ "Gird"
static ewol::Widget* Create(void)
{
return new widget::Gird();
}
void widget::Gird::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Gird::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Gird::Gird(int32_t colNumber) : widget::Gird::Gird(int32_t colNumber) :
m_tmpWidget(NULL),
m_sizeRow(0), m_sizeRow(0),
m_borderSize(0,0), m_tmpWidget(NULL),
m_gavityButtom(true) m_gavityButtom(true),
m_borderSize(0,0)
{ {
SetColNumber(colNumber); SetColNumber(colNumber);
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
@ -46,15 +62,11 @@ void widget::Gird::SetBorderSize(const ivec2& newBorderSize)
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
} }
bool widget::Gird::CalculateSize(float availlableX, float availlableY) void widget::Gird::CalculateSize(const vec2& availlable)
{ {
//EWOL_DEBUG("Update Size"); //EWOL_DEBUG("Update Size");
m_size.setValue(availlableX, availlableY); m_size = availlable;
m_size -= m_borderSize*2; m_size -= m_borderSize*2;
// calculate unExpendable Size :
float unexpendableSize=0.0;
int32_t nbWidgetFixedSize=0;
int32_t nbWidgetNotFixedSize=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].widget) { if (NULL != m_subWidget[iii].widget) {
@ -79,18 +91,17 @@ bool widget::Gird::CalculateSize(float availlableX, float availlableY)
EWOL_DEBUG(" [" << iii << "] set subwidget origin=" <<tmpOrigin << " size=" << ivec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow) ); EWOL_DEBUG(" [" << iii << "] set subwidget origin=" <<tmpOrigin << " size=" << ivec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow) );
// Set the origin : // Set the origin :
m_subWidget[iii].widget->SetOrigin(tmpOrigin.x(), tmpOrigin.y()); m_subWidget[iii].widget->SetOrigin(tmpOrigin);
// all time set oll the space . // all time set oll the space .
m_subWidget[iii].widget->CalculateSize(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow); m_subWidget[iii].widget->CalculateSize(vec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow));
} }
} }
m_size += m_borderSize*2; m_size += m_borderSize*2;
EWOL_DEBUG("Calculate size : " << m_size); EWOL_DEBUG("Calculate size : " << m_size);
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::Gird::CalculateMinSize(void) void widget::Gird::CalculateMinSize(void)
{ {
for (int32_t iii=0; iii<m_sizeCol.Size(); iii++ ){ for (int32_t iii=0; iii<m_sizeCol.Size(); iii++ ){
if (m_sizeCol[iii] <= 0) { if (m_sizeCol[iii] <= 0) {
@ -140,7 +151,6 @@ bool widget::Gird::CalculateMinSize(void)
EWOL_DEBUG("Calculate min size : " << m_minSize); EWOL_DEBUG("Calculate min size : " << m_minSize);
//EWOL_DEBUG("Vert Result : expend="<< m_userExpend << " minSize="<< m_minSize); //EWOL_DEBUG("Vert Result : expend="<< m_userExpend << " minSize="<< m_minSize);
return true;
} }
void widget::Gird::SetColNumber(int32_t colNumber) void widget::Gird::SetColNumber(int32_t colNumber)
@ -343,7 +353,6 @@ void widget::Gird::SubWidgetUnLink(int32_t colId, int32_t rowId)
EWOL_WARNING("[" << GetId() << "] try to Unlink widget with id < 0 col=" << colId << " row=" << rowId); EWOL_WARNING("[" << GetId() << "] try to Unlink widget with id < 0 col=" << colId << " row=" << rowId);
return; return;
} }
int32_t errorControl = m_subWidget.Size();
// try to find it ... // try to find it ...
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if( m_subWidget[iii].row == rowId if( m_subWidget[iii].row == rowId

View File

@ -17,6 +17,9 @@
namespace widget { namespace widget {
class Gird :public ewol::Widget class Gird :public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
private: private:
class GirdProperties { class GirdProperties {
public: public:
@ -136,8 +139,8 @@ namespace widget {
virtual ewol::Widget* GetWidgetAtPos(vec2 pos); virtual ewol::Widget* GetWidgetAtPos(vec2 pos);
virtual void OnObjectRemove(ewol::EObject* removeObject); virtual void OnObjectRemove(ewol::EObject* removeObject);
virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; }; virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; };
virtual bool CalculateSize(float availlableX, float availlableY); virtual void CalculateSize(const vec2& availlable);
virtual bool CalculateMinSize(void); virtual void CalculateMinSize(void);
}; };
}; };

View File

@ -17,9 +17,25 @@ extern const char * const ewolEventImagePressed = "ewol-image-Pressed";
#undef __class__ #undef __class__
#define __class__ "Image" #define __class__ "Image"
static ewol::Widget* Create(void)
{
return new widget::Image();
}
void widget::Image::Init(void) void widget::Image::Init(void)
{ {
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Image::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Image::Image(const etk::UString& dataFile, int32_t size)
{
m_imageSelected = dataFile;
AddEventId(ewolEventImagePressed); AddEventId(ewolEventImagePressed);
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
@ -33,13 +49,6 @@ void widget::Image::Init(void)
m_imageSize = 32; m_imageSize = 32;
// Limit event at 1: // Limit event at 1:
SetMouseLimit(1); SetMouseLimit(1);
}
widget::Image::Image(etk::UString dataFile, int32_t size)
{
m_imageSelected = dataFile;
Init();
if (size>0) { if (size>0) {
m_imageSize = size; m_imageSize = size;
} }
@ -57,12 +66,11 @@ void widget::Image::SetPadding(vec2 newPadding)
m_padding = newPadding; m_padding = newPadding;
} }
bool widget::Image::CalculateMinSize(void) void widget::Image::CalculateMinSize(void)
{ {
m_minSize.setValue(m_padding.x()*2 + m_imageSize, m_minSize.setValue(m_padding.x()*2 + m_imageSize,
m_padding.y()*2 + m_imageSize ); m_padding.y()*2 + m_imageSize );
MarkToRedraw(); MarkToRedraw();
return true;
} }

View File

@ -20,24 +20,23 @@ namespace widget {
class Image :public widget::Drawable class Image :public widget::Drawable
{ {
public: public:
Image(etk::UString dataFile, int32_t size=-1); // automatic considering in the appl Data older static void Init(void);
// Derived function static void UnInit(void);
virtual const char * const GetObjectType(void) { return "EwolImage"; }; public:
void Init(void); Image(const etk::UString& dataFile="", int32_t size=-1); // automatic considering in the appl Data older
virtual ~Image(void); virtual ~Image(void);
// Derived function void SetFile(etk::UString newFile);
virtual bool CalculateMinSize(void); void SetPadding(vec2 newPadding);
void SetFile(etk::UString newFile);
void SetPadding(vec2 newPadding);
private: private:
etk::UString m_imageSelected; etk::UString m_imageSelected;
vec2 m_padding; vec2 m_padding;
draw::Color m_textColorBg; //!< Background color draw::Color m_textColorBg; //!< Background color
int32_t m_imageSize; int32_t m_imageSize;
public: public:
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual const char * const GetObjectType(void) { return "Ewol::Image"; };
// Derived function virtual void CalculateMinSize(void);
virtual void OnRegenerateDisplay(void);
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
}; };
}; };

View File

@ -58,12 +58,11 @@ widget::Joystick::~Joystick(void)
} }
bool widget::Joystick::CalculateSize(float availlableX, float availlableY) void widget::Joystick::CalculateSize(const vec2& availlable)
{ {
float minimumSize = etk_min(availlableX, availlableY); float minimumSize = etk_min(availlable.x(), availlable.y());
m_size.setValue(minimumSize, minimumSize); m_size.setValue(minimumSize, minimumSize);
MarkToRedraw(); MarkToRedraw();
return true;
} }
void widget::Joystick::OnRegenerateDisplay(void) void widget::Joystick::OnRegenerateDisplay(void)

View File

@ -43,13 +43,11 @@ namespace widget {
Joystick(void); Joystick(void);
virtual ~Joystick(void); virtual ~Joystick(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "Ewol"; }; virtual const char * const GetObjectType(void) { return "Ewol::Joystick"; };
// Derived function virtual void CalculateSize(const vec2& availlable);
virtual bool CalculateSize(float availlableX, float availlableY);
// Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
void SetLockMode(bool lockWhenOut) { m_lock = lockWhenOut; }; void SetLockMode(bool lockWhenOut) { m_lock = lockWhenOut; };
void SetDisplayMode(joystickMode_te newMode) { m_displayMode = newMode; }; void SetDisplayMode(joystickMode_te newMode) { m_displayMode = newMode; };
/** /**

View File

@ -20,6 +20,21 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed";
#undef __class__ #undef __class__
#define __class__ "Label" #define __class__ "Label"
static ewol::Widget* Create(void)
{
return new widget::Label();
}
void widget::Label::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Label::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Label::Label(etk::UString newLabel) widget::Label::Label(etk::UString newLabel)
{ {
@ -33,7 +48,7 @@ widget::Label::~Label(void)
} }
bool widget::Label::CalculateMinSize(void) void widget::Label::CalculateMinSize(void)
{ {
if (m_userMaxSize.x() != -1) { if (m_userMaxSize.x() != -1) {
m_text.SetTextAlignement(0, m_userMaxSize.x()-4, ewol::Text::alignLeft); m_text.SetTextAlignement(0, m_userMaxSize.x()-4, ewol::Text::alignLeft);
@ -49,7 +64,6 @@ bool widget::Label::CalculateMinSize(void)
} else { } else {
m_minSize.setY(4 + minSize.y()); m_minSize.setY(4 + minSize.y());
} }
return true;
} }
@ -136,4 +150,14 @@ bool widget::Label::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput,
return false; return false;
} }
bool widget::Label::LoadXML(TiXmlNode* node)
{
if (NULL==node) {
return false;
}
ewol::Widget::LoadXML(node);
// get internal data :
// TODO : Unparse data type XML ...
SetLabel(node->ToElement()->GetText());
return true;
}

View File

@ -19,6 +19,9 @@ extern const char * const ewolEventLabelPressed;
namespace widget { namespace widget {
class Label : public ewol::Widget class Label : public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
private: private:
ewol::Text m_text; //!< Compositing text element. ewol::Text m_text; //!< Compositing text element.
etk::UString m_label; //!< decorated text to display. etk::UString m_label; //!< decorated text to display.
@ -42,16 +45,14 @@ namespace widget {
* @return The displayed decorated text. * @return The displayed decorated text.
*/ */
etk::UString GetLabel(void); etk::UString GetLabel(void);
public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "Ewol::Label"; }; virtual const char * const GetObjectType(void) { return "Ewol::Label"; };
// Derived function virtual void CalculateMinSize(void);
virtual bool CalculateMinSize(void);
// Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
virtual bool LoadXML(TiXmlNode* node);
}; };
}; };

View File

@ -13,6 +13,21 @@
#undef __class__ #undef __class__
#define __class__ "Layer" #define __class__ "Layer"
static ewol::Widget* Create(void)
{
return new widget::Layer();
}
void widget::Layer::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Layer::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Layer::Layer(void) widget::Layer::Layer(void)
{ {
@ -27,32 +42,31 @@ widget::Layer::~Layer(void)
} }
bool widget::Layer::CalculateSize(float availlableX, float availlableY) void widget::Layer::CalculateSize(const vec2& availlable)
{ {
//EWOL_DEBUG("Update Size"); //EWOL_DEBUG("Update Size");
m_size.setValue(availlableX, availlableY); m_size = availlable;
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]->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);
} }
} }
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::Layer::CalculateMinSize(void) void widget::Layer::CalculateMinSize(void)
{ {
m_userExpend.setValue(false, false); m_userExpend.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_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();
@ -60,38 +74,20 @@ bool widget::Layer::CalculateMinSize(void)
etk_max(tmpSize.y(), m_minSize.y()) ); etk_max(tmpSize.y(), m_minSize.y()) );
} }
} }
return true;
} }
void widget::Layer::SetMinSise(float x, float y) void widget::Layer::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)");
} }
void widget::Layer::SetExpendX(bool newExpend)
{
EWOL_ERROR("Layer can not have a user expend settings X (herited from under elements)");
}
bool widget::Layer::CanExpentX(void) bvec2 widget::Layer::CanExpand(void)
{ {
if (true == m_lockExpendContamination) { if (true == m_lockExpendContamination) {
return false; return bvec2(false,false);
} }
return m_userExpend.x(); return m_userExpend;
}
void widget::Layer::SetExpendY(bool newExpend)
{
EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)");
}
bool widget::Layer::CanExpentY(void)
{
if (true == m_lockExpendContamination) {
return false;
}
return m_userExpend.y();
} }
void widget::Layer::LockExpendContamination(bool lockExpend) void widget::Layer::LockExpendContamination(bool lockExpend)

View File

@ -16,20 +16,12 @@
namespace widget { namespace widget {
class Layer :public ewol::Widget class Layer :public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
public: public:
Layer(void); Layer(void);
virtual ~Layer(void); virtual ~Layer(void);
// Derived function
virtual const char * const GetObjectType(void) { return "EwolLayer"; };
public:
// Derived function
virtual bool CalculateSize(float availlableX, float availlableY);
virtual bool CalculateMinSize(void);
virtual void SetMinSise(float x=-1, float y=-1);
virtual void SetExpendX(bool newExpend=false);
virtual bool CanExpentX(void);
virtual void SetExpendY(bool newExpend=false);
virtual bool CanExpentY(void);
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
@ -46,10 +38,14 @@ namespace widget {
public: public:
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual ewol::Widget * GetWidgetAtPos(vec2 pos); virtual ewol::Widget * GetWidgetAtPos(vec2 pos);
// Derived function
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
virtual void CalculateSize(const vec2& availlable);
virtual void CalculateMinSize(void);
virtual void SetMinSize(const vec2& size);
virtual void SetExpand(const bvec2& newExpend);
virtual bvec2 CanExpand(void);
virtual const char * const GetObjectType(void) { return "EwolLayer"; };
}; };
}; };

View File

@ -43,7 +43,7 @@ widget::List::~List(void)
} }
bool widget::List::CalculateMinSize(void) void widget::List::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);
@ -52,7 +52,6 @@ bool widget::List::CalculateMinSize(void)
m_minSize.y = 3+minHeight; m_minSize.y = 3+minHeight;
*/ */
m_minSize.setValue(200, 150); m_minSize.setValue(200, 150);
return true;
} }

View File

@ -22,17 +22,17 @@ namespace widget {
List(void); List(void);
void Init(void); void Init(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolList"; }; virtual const char * const GetObjectType(void) { return "ewol::List"; };
virtual ~List(void); virtual ~List(void);
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...
etk::Vector<ivec2 > m_lineSize; etk::Vector<ivec2 > m_lineSize;
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
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
@ -44,7 +44,7 @@ namespace widget {
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
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function // Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
protected: protected:

View File

@ -164,7 +164,7 @@ void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * e
widget::Button * myButton = NULL; widget::Button * myButton = NULL;
mySizer = new widget::Sizer(widget::Sizer::modeVert); mySizer = new widget::Sizer(widget::Sizer::modeVert);
mySizer->LockExpendContamination(true); mySizer->LockExpendContamination(vec2(true,true));
// set it in the pop-up-system : // set it in the pop-up-system :
m_widgetContextMenu->SubWidgetSet(mySizer); m_widgetContextMenu->SubWidgetSet(mySizer);

View File

@ -37,22 +37,21 @@ namespace widget {
// Derived functionv // Derived functionv
virtual const char * const GetObjectType(void) { return "EwolMenu"; }; virtual const char * const GetObjectType(void) { return "EwolMenu"; };
private: private:
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);
private: private:
etk::Vector<widget::MenuElement*> m_listElement; etk::Vector<widget::MenuElement*> m_listElement;
int32_t m_staticId; // unique ID for every element of the menu ... int32_t m_staticId; // unique ID for every element of the menu ...
widget::ContextMenu* m_widgetContextMenu; widget::ContextMenu* m_widgetContextMenu;
public: public:
void Clear(void); void Clear(void);
int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = ""); int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
int32_t Add(int32_t parent, etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = ""); int32_t Add(int32_t parent, etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
void AddSpacer(void); void AddSpacer(void);
// 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
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
}; };

View File

@ -35,20 +35,20 @@ widget::PopUp::~PopUp(void)
} }
bool widget::PopUp::CalculateSize(float availlableX, float availlableY) void widget::PopUp::CalculateSize(const vec2& availlable)
{ {
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); //EWOL_DEBUG("CalculateSize=" << availlable);
// pop-up fill all the display : // pop-up fill all the display :
m_size.setValue(availlableX, availlableY); m_size = availlable;
if (NULL != m_subWidget) { if (NULL != m_subWidget) {
vec2 subWidgetSize; vec2 subWidgetSize;
vec2 subWidgetOrigin; vec2 subWidgetOrigin;
subWidgetSize = m_subWidget->GetMinSize(); subWidgetSize = m_subWidget->GetMinSize();
if (true == m_subWidget->CanExpentX()) { if (true == m_subWidget->CanExpand().x()) {
subWidgetSize.setX(m_size.x()); subWidgetSize.setX(m_size.x());
} }
if (true == m_subWidget->CanExpentY()) { if (true == m_subWidget->CanExpand().y()) {
subWidgetSize.setY(m_size.y()); subWidgetSize.setY(m_size.y());
} }
if (m_displayRatio>0.1 && m_displayRatio<=1) { if (m_displayRatio>0.1 && m_displayRatio<=1) {
@ -65,11 +65,10 @@ bool widget::PopUp::CalculateSize(float availlableX, float availlableY)
m_subWidget->CalculateSize(subWidgetSize.x(), subWidgetSize.y()); m_subWidget->CalculateSize(subWidgetSize.x(), subWidgetSize.y());
} }
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::PopUp::CalculateMinSize(void) void widget::PopUp::CalculateMinSize(void)
{ {
//EWOL_DEBUG("CalculateMinSize"); //EWOL_DEBUG("CalculateMinSize");
m_userExpend.setValue(false,false); m_userExpend.setValue(false,false);
@ -81,25 +80,18 @@ bool widget::PopUp::CalculateMinSize(void)
} }
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")"); //EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
MarkToRedraw(); MarkToRedraw();
return true;
} }
void widget::PopUp::SetMinSise(float x, float y) void widget::PopUp::SetMinSize(const vec2& size)
{ {
EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)"); EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)");
} }
void widget::PopUp::SetExpendX(bool newExpend) void widget::PopUp::SetExpand(const bvec2& newExpend)
{ {
EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)"); EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)");
} }
void widget::PopUp::SetExpendY(bool newExpend)
{
EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)");
}
void widget::PopUp::SubWidgetSet(ewol::Widget* newWidget) void widget::PopUp::SubWidgetSet(ewol::Widget* newWidget)
{ {
if (NULL == newWidget) { if (NULL == newWidget) {

View File

@ -25,16 +25,11 @@ namespace widget {
virtual const char * const GetObjectType(void) { return "EwolPopUp"; }; virtual const char * const GetObjectType(void) { return "EwolPopUp"; };
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 void SetExpand(const bvec2& newExpend);
virtual void SetMinSise(float x=-1, float y=-1); void SetDisplayRatio(float ratio);
// Derived function
virtual void SetExpendX(bool newExpend=false);
// Derived function
virtual void SetExpendY(bool newExpend=false);
void SetDisplayRatio(float ratio);
private: private:
draw::Color m_colorBackGroung; draw::Color m_colorBackGroung;
draw::Color m_colorBorder; draw::Color m_colorBorder;

View File

@ -12,7 +12,23 @@
#include <ewol/widget/WidgetManager.h> #include <ewol/widget/WidgetManager.h>
#undef __class__ #undef __class__
#define __class__ "Slider" #define __class__ "ProgressBar"
static ewol::Widget* Create(void)
{
return new widget::ProgressBar();
}
void widget::ProgressBar::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::ProgressBar::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
const int32_t dotRadius = 6; const int32_t dotRadius = 6;
@ -35,12 +51,11 @@ widget::ProgressBar::~ProgressBar(void)
} }
bool widget::ProgressBar::CalculateMinSize(void) void widget::ProgressBar::CalculateMinSize(void)
{ {
m_minSize.setValue( etk_max(m_userMinSize.x(), 40), m_minSize.setValue( etk_max(m_userMinSize.x(), 40),
etk_max(m_userMinSize.y(), dotRadius*2) ); etk_max(m_userMinSize.y(), dotRadius*2) );
MarkToRedraw(); MarkToRedraw();
return true;
} }

View File

@ -18,23 +18,26 @@
namespace widget { namespace widget {
class ProgressBar :public widget::Drawable class ProgressBar :public widget::Drawable
{ {
public:
static void Init(void);
static void UnInit(void);
public: public:
ProgressBar(void); ProgressBar(void);
virtual ~ProgressBar(void); virtual ~ProgressBar(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolProgressBar"; }; virtual const char * const GetObjectType(void) { return "EwolProgressBar"; };
virtual bool CalculateMinSize(void); virtual void CalculateMinSize(void);
void ValueSet(float val); void ValueSet(float val);
float ValueGet(void); float ValueGet(void);
void SetColor(draw::Color newColor) { m_textColorFg = newColor; }; void SetColor(draw::Color newColor) { m_textColorFg = newColor; };
private: private:
float m_value; //!< % used float m_value; //!< % used
draw::Color m_textColorFg; //!< forder bar color draw::Color m_textColorFg; //!< forder bar color
draw::Color m_textColorBgOn; //!< bar color enable draw::Color m_textColorBgOn; //!< bar color enable
draw::Color m_textColorBgOff; //!< bar color disable draw::Color m_textColorBgOff; //!< bar color disable
public: public:
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
}; };
}; };

View File

@ -14,6 +14,21 @@
#undef __class__ #undef __class__
#define __class__ "Sizer" #define __class__ "Sizer"
static ewol::Widget* Create(void)
{
return new widget::Sizer();
}
void widget::Sizer::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Sizer::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Sizer::Sizer(widget::Sizer::displayMode_te mode): widget::Sizer::Sizer(widget::Sizer::displayMode_te mode):
m_mode(mode), m_mode(mode),
@ -57,10 +72,10 @@ widget::Sizer::displayMode_te widget::Sizer::GetMode(void)
return m_mode; return m_mode;
} }
bool widget::Sizer::CalculateSize(float availlableX, float availlableY) void widget::Sizer::CalculateSize(const vec2& availlable)
{ {
//EWOL_DEBUG("Update Size"); //EWOL_DEBUG("Update Size");
m_size.setValue(availlableX, availlableY); m_size = availlable;
m_size -= m_borderSize*2; m_size -= m_borderSize*2;
// calculate unExpendable Size : // calculate unExpendable Size :
float unexpendableSize=0.0; float unexpendableSize=0.0;
@ -128,11 +143,10 @@ bool widget::Sizer::CalculateSize(float availlableX, float availlableY)
} }
m_size += m_borderSize*2; m_size += m_borderSize*2;
MarkToRedraw(); MarkToRedraw();
return true;
} }
bool widget::Sizer::CalculateMinSize(void) void widget::Sizer::CalculateMinSize(void)
{ {
//EWOL_DEBUG("Update minimum Size"); //EWOL_DEBUG("Update minimum Size");
m_userExpend.setValue(false, false); m_userExpend.setValue(false, false);
@ -169,52 +183,29 @@ bool widget::Sizer::CalculateMinSize(void)
} }
} }
} }
//EWOL_DEBUG("Vert Result : expend="<< m_userExpend << " minSize="<< m_minSize);
return true;
} }
void widget::Sizer::SetMinSize(float x, float y) 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::SetExpendX(bool newExpend) void widget::Sizer::SetExpand(const bvec2& newExpend)
{ {
EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings X (herited from under elements)"); EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings (herited from under elements)");
} }
bool widget::Sizer::CanExpentX(void) bvec2 widget::Sizer::CanExpentY(void)
{ {
if (true == m_lockExpendContamination.x()) { if (true == m_lockExpendContamination)) {
return false; return bvec2(false,false);
} }
return m_userExpend.x(); return m_userExpend;
} }
void widget::Sizer::SetExpendY(bool newExpend) void widget::Sizer::LockExpendContamination(const bvec2& lockExpend)
{ {
EWOL_ERROR("[" << GetId() << "] Sizer can not have a user expend settings Y (herited from under elements)"); m_lockExpendContamination = lockExpend;
}
bool widget::Sizer::CanExpentY(void)
{
if (true == m_lockExpendContamination.y()) {
return false;
}
return m_userExpend.y();
}
void widget::Sizer::LockExpendContamination(bool lockExpend)
{
m_lockExpendContamination.setValue(lockExpend,lockExpend);
}
void widget::Sizer::LockExpendContaminationVert(bool lockExpend)
{
m_lockExpendContamination.setY(lockExpend);
}
void widget::Sizer::LockExpendContaminationHori(bool lockExpend)
{
m_lockExpendContamination.setX(lockExpend);
} }
void widget::Sizer::SubWidgetRemoveAll(void) void widget::Sizer::SubWidgetRemoveAll(void)

View File

@ -16,6 +16,9 @@
namespace widget { namespace widget {
class Sizer :public ewol::Widget class Sizer :public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
public: public:
typedef enum { typedef enum {
modeVert, //!< Vertical mode modeVert, //!< Vertical mode
@ -51,17 +54,7 @@ namespace widget {
* @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget) * @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget)
* @param[in] lockExpend New expend state in vertical and horisantal * @param[in] lockExpend New expend state in vertical and horisantal
*/ */
void LockExpendContamination(bool lockExpend); void LockExpendContamination(const bvec2& lockExpend);
/**
* @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget)
* @param[in] lockExpend New expend state in vertical
*/
void LockExpendContaminationVert(bool lockExpend);
/**
* @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget)
* @param[in] lockExpend New expend state in horisantal
*/
void LockExpendContaminationHori(bool lockExpend);
public: public:
/** /**
* @brief Remove all sub element from the widget. * @brief Remove all sub element from the widget.
@ -107,13 +100,11 @@ namespace widget {
virtual ewol::Widget* GetWidgetAtPos(vec2 pos); virtual ewol::Widget* GetWidgetAtPos(vec2 pos);
virtual void OnObjectRemove(ewol::EObject* removeObject); virtual void OnObjectRemove(ewol::EObject* removeObject);
virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; }; virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; };
virtual bool CalculateSize(float availlableX, float availlableY); virtual void CalculateSize(const vec2& availlable);
virtual bool CalculateMinSize(void); virtual void CalculateMinSize(void);
virtual void SetMinSize(float x=-1, float y=-1); virtual void SetMinSize(const vec2& size);
virtual void SetExpendX(bool newExpend=false); virtual void SetExpand(const bvec2& newExpend);
virtual bool CanExpentX(void); virtual bvec2 CanExpent(void);;
virtual void SetExpendY(bool newExpend=false);
virtual bool CanExpentY(void);
}; };
}; };

View File

@ -19,6 +19,24 @@ extern const char * const ewolEventSliderChange = "ewol-event-slider-change";
#undef __class__ #undef __class__
#define __class__ "Slider" #define __class__ "Slider"
static ewol::Widget* Create(void)
{
return new widget::Slider();
}
void widget::Slider::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Slider::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
const int32_t dotRadius = 6; const int32_t dotRadius = 6;
widget::Slider::Slider(void) widget::Slider::Slider(void)
@ -44,12 +62,11 @@ widget::Slider::~Slider(void)
} }
bool widget::Slider::CalculateMinSize(void) void widget::Slider::CalculateMinSize(void)
{ {
m_minSize.setValue(etk_max(m_userMinSize.x(), 40), m_minSize.setValue(etk_max(m_userMinSize.x(), 40),
etk_max(m_userMinSize.y(), dotRadius*2) ); etk_max(m_userMinSize.y(), dotRadius*2) );
MarkToRedraw(); MarkToRedraw();
return true;
} }

View File

@ -19,18 +19,17 @@ extern const char * const ewolEventSliderChange;
namespace widget { namespace widget {
class Slider :public widget::Drawable class Slider :public widget::Drawable
{ {
public:
static void Init(void);
static void UnInit(void);
public: public:
Slider(void); Slider(void);
virtual ~Slider(void); virtual ~Slider(void);
// Derived function void SetValue(int32_t val);
virtual const char * const GetObjectType(void) { return "EwolSlider"; } ; int32_t GetValue(void);
// Derived function void SetMin(int32_t val);
virtual bool CalculateMinSize(void); void SetMax(int32_t val);
void SetValue(int32_t val); void SetColor(draw::Color newColor) { m_textColorFg = newColor; };
int32_t GetValue(void);
void SetMin(int32_t val);
void SetMax(int32_t val);
void SetColor(draw::Color newColor) { m_textColorFg = newColor; };
private: private:
int32_t m_value; int32_t m_value;
int32_t m_min; int32_t m_min;
@ -39,8 +38,9 @@ namespace widget {
draw::Color m_textColorBg; //!< Background color draw::Color m_textColorBg; //!< Background color
public: public:
// Derived function // Derived function
virtual void OnRegenerateDisplay(void); virtual const char * const GetObjectType(void) { return "Ewol::Slider"; } ;
// Derived function virtual void CalculateMinSize(void);
virtual void OnRegenerateDisplay(void);
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos); virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos);
}; };

View File

@ -15,6 +15,21 @@
#undef __class__ #undef __class__
#define __class__ "Spacer" #define __class__ "Spacer"
static ewol::Widget* Create(void)
{
return new widget::Spacer();
}
void widget::Spacer::Init(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
}
void widget::Spacer::UnInit(void)
{
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
}
widget::Spacer::Spacer(void) widget::Spacer::Spacer(void)
{ {
@ -30,10 +45,9 @@ widget::Spacer::~Spacer(void)
} }
bool widget::Spacer::CalculateMinSize(void) void widget::Spacer::CalculateMinSize(void)
{ {
m_minSize.setValue(m_localSize, m_localSize); m_minSize.setValue(m_localSize, m_localSize);
return true;
} }
@ -50,7 +64,7 @@ void widget::Spacer::OnDraw(ewol::DrawProperty& displayProp)
} }
#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()) {

View File

@ -18,10 +18,13 @@
namespace widget { namespace widget {
class Spacer :public ewol::Widget class Spacer :public ewol::Widget
{ {
public:
static void Init(void);
static void UnInit(void);
private: private:
ewol::Drawing m_draw; //!< Compositing drawing element ewol::Drawing m_draw; //!< Compositing drawing element
float m_localSize; //!< Local request size of the display float m_localSize; //!< Local request size of the display
draw::Color m_color; //!< Background color draw::Color m_color; //!< Background color
public: public:
/** /**
* @brief Main constructer * @brief Main constructer
@ -43,14 +46,10 @@ namespace widget {
void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); }; void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); };
public: public:
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolSpacer"; }; virtual const char * const GetObjectType(void) { return "Ewol::Spacer"; };
// Derived function virtual void CalculateMinSize(void);
virtual bool CalculateMinSize(void);
// Derived function
virtual ewol::Widget * GetWidgetAtPos(vec2 pos) { return NULL; }; virtual ewol::Widget * GetWidgetAtPos(vec2 pos) { return NULL; };
// Derived function
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
// Derived function
virtual void OnDraw(ewol::DrawProperty& displayProp); virtual void OnDraw(ewol::DrawProperty& displayProp);
}; };

View File

@ -20,15 +20,15 @@
#define __class__ "Widget" #define __class__ "Widget"
ewol::Widget::Widget(void) : ewol::Widget::Widget(void) :
m_hide(false),
m_zoom(1.0f),
m_origin(0,0),
m_size(10,10), m_size(10,10),
m_minSize(-1,-1), m_minSize(-1,-1),
m_zoom(1.0f),
m_origin(0,0),
m_userMinSize(-1,-1), m_userMinSize(-1,-1),
m_userMaxSize(-1,-1), m_userMaxSize(-1,-1),
m_userExpend(false,false), m_userExpend(false,false),
m_userFill(false,false), m_userFill(false,false),
m_hide(false),
m_hasFocus(false), m_hasFocus(false),
m_canFocus(false), m_canFocus(false),
m_limitMouseEvent(3), m_limitMouseEvent(3),
@ -66,11 +66,10 @@ void ewol::Widget::Show(void)
} }
bool ewol::Widget::CalculateSize(float availlableX, float availlableY) void ewol::Widget::CalculateSize(const vec2& availlable)
{ {
m_size.setValue(availlableX, availlableY); m_size = availlable;
MarkToRedraw(); MarkToRedraw();
return true;
} }
@ -206,9 +205,9 @@ float ewol::Widget::GetZoom(void)
return m_zoom; return m_zoom;
} }
void ewol::Widget::SetOrigin(float x, float y) void ewol::Widget::SetOrigin(const vec2& pos)
{ {
m_origin.setValue(x, y); m_origin = pos;
} }
vec2 ewol::Widget::GetOrigin(void) vec2 ewol::Widget::GetOrigin(void)
@ -221,16 +220,15 @@ vec2 ewol::Widget::RelativePosition(vec2 pos)
return pos - m_origin; return pos - m_origin;
} }
bool ewol::Widget::CalculateMinSize(void) void ewol::Widget::CalculateMinSize(void)
{ {
m_minSize = m_userMinSize; m_minSize = m_userMinSize;
MarkToRedraw(); MarkToRedraw();
return true;
} }
void ewol::Widget::SetMinSize(float x, float y) void ewol::Widget::SetMinSize(const vec2& size)
{ {
m_userMinSize.setValue(x, y); m_userMinSize = size;
} }
void ewol::Widget::CheckMinSize(void) void ewol::Widget::CheckMinSize(void)
@ -270,37 +268,17 @@ vec2 ewol::Widget::GetSize(void)
return vec2(0,0); return vec2(0,0);
} }
void ewol::Widget::SetExpendX(bool newExpend) void ewol::Widget::SetExpand(const bvec2& newExpend)
{ {
m_userExpend.setX(newExpend); if( m_userExpend.x() != newExpend.x()
ewol::RequestUpdateSize(); || m_userExpend.y() != newExpend.y()) {
MarkToRedraw(); m_userExpend = newExpend;
} ewol::RequestUpdateSize();
MarkToRedraw();
bool ewol::Widget::CanExpentX(void)
{
if (false==IsHide()) {
return m_userExpend.x();
} }
return false;
} }
void ewol::Widget::SetExpendY(bool newExpend) bvec2 ewol::Widget::CanExpand(void)
{
m_userExpend.setY(newExpend);
ewol::RequestUpdateSize();
MarkToRedraw();
}
bool ewol::Widget::CanExpentY(void)
{
if (false==IsHide()) {
return m_userExpend.y();
}
return false;
}
bvec2 ewol::Widget::CanExpent(void)
{ {
if (false==IsHide()) { if (false==IsHide()) {
return m_userExpend; return m_userExpend;
@ -309,27 +287,19 @@ bvec2 ewol::Widget::CanExpent(void)
} }
void ewol::Widget::SetFill(const bvec2& newFill)
void ewol::Widget::SetFillX(bool newFill)
{ {
m_userFill.setX(newFill); if( m_userFill.x() != newFill.x()
MarkToRedraw(); || m_userFill.y() != newFill.y()) {
m_userFill = newFill;
ewol::RequestUpdateSize();
MarkToRedraw();
}
} }
bool ewol::Widget::CanFillX(void) const bvec2& ewol::Widget::CanFill(void)
{ {
return m_userFill.x(); return m_userFill;
}
void ewol::Widget::SetFillY(bool newFill)
{
m_userFill.setY(newFill);
MarkToRedraw();
}
bool ewol::Widget::CanFillY(void)
{
return m_userFill.y();
} }
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
@ -514,3 +484,118 @@ ewol::cursorDisplay_te ewol::Widget::GetCursor(void)
{ {
return m_cursorDisplay; return m_cursorDisplay;
} }
bool ewol::Widget::LoadXML(TiXmlNode* node)
{
if (NULL==node) {
return false;
}
bool ret = true;
const char *tmpAttributeValue = node->ToElement()->Attribute("name");
if (NULL != tmpAttributeValue) {
m_widgetName = tmpAttributeValue;
}
tmpAttributeValue = node->ToElement()->Attribute("fill");
if (NULL != tmpAttributeValue) {
if (strcmp("false,false", tmpAttributeValue)==0) {
SetFill(bvec2(false,false));
} else if (strcmp("false,true", tmpAttributeValue)==0) {
SetFill(bvec2(false,true));
} else if (strcmp("true,false", tmpAttributeValue)==0) {
SetFill(bvec2(true,false));
} else if (strcmp("false", tmpAttributeValue)==0) {
SetFill(bvec2(false,false));
} else {
SetFill(bvec2(true,true));
}
}
tmpAttributeValue = node->ToElement()->Attribute("expand");
if (NULL != tmpAttributeValue) {
if (strcmp("false,false", tmpAttributeValue)==0) {
SetExpand(bvec2(false,false));
} else if (strcmp("false,true", tmpAttributeValue)==0) {
SetExpand(bvec2(false,true));
} else if (strcmp("true,false", tmpAttributeValue)==0) {
SetExpand(bvec2(true,false));
} else if (strcmp("false", tmpAttributeValue)==0) {
SetExpand(bvec2(false,false));
} else {
SetExpand(bvec2(true,true));
}
}
tmpAttributeValue = node->ToElement()->Attribute("hide");
if (NULL != tmpAttributeValue) {
if (strcmp("true", tmpAttributeValue)==0) {
Hide();
} else {
Show();
}
}
tmpAttributeValue = node->ToElement()->Attribute("focus");
if (NULL != tmpAttributeValue) {
if (strcmp("true", tmpAttributeValue)==0) {
KeepFocus();
}
}
tmpAttributeValue = node->ToElement()->Attribute("min-size");
if (NULL != tmpAttributeValue) {
float x,y;
if (2!=sscanf(tmpAttributeValue, "%f,%f", &x, &y)) {
SetMinSize(vec2(x,y));
} else {
EWOL_ERROR("(l "<<node->Row()<<") An error occured when parsing element min-size : " << tmpAttributeValue);
ret = false;
}
}
tmpAttributeValue = node->ToElement()->Attribute("max-size");
if (NULL != tmpAttributeValue) {
float x,y;
if (2!=sscanf(tmpAttributeValue, "%f,%f", &x, &y)) {
SetMaxSize(vec2(x,y));
} else {
EWOL_ERROR("(l "<<node->Row()<<") An error occured when parsing element max-size : " << tmpAttributeValue);
ret = false;
}
}
return ret;
}
bool ewol::Widget::StoreXML(TiXmlNode* node)
{
if (NULL==node) {
return false;
}
/*
TiXmlElement * element = new TiXmlElement(__class__);
if (NULL == element) {
EWOL_ERROR("TinyXML node allocation error");
return false;
}
node->LinkEndChild(element);
*/
if (m_widgetName.Size()!=0) {
node->ToElement()->SetAttribute("name", m_widgetName.c_str() );
}
if (m_userMinSize != vec2(-1,-1)) {
etk::UString tmpVal = etk::UString(m_userMinSize.x()) + "," + etk::UString(m_userMinSize.y());
node->ToElement()->SetAttribute("min-size", tmpVal.c_str() );
}
if (m_userMaxSize != vec2(-1,-1)) {
etk::UString tmpVal = etk::UString(m_userMaxSize.x()) + "," + etk::UString(m_userMaxSize.y());
node->ToElement()->SetAttribute("max-size", tmpVal.c_str() );
}
if (m_userExpend != bvec2(false,false)) {
etk::UString tmpVal = etk::UString(m_userExpend.x()) + "," + etk::UString(m_userExpend.y());
node->ToElement()->SetAttribute("expand", tmpVal.c_str() );
}
if (m_userFill != bvec2(false,false)) {
etk::UString tmpVal = etk::UString(m_userFill.x()) + "," + etk::UString(m_userFill.y());
node->ToElement()->SetAttribute("fill", tmpVal.c_str() );
}
if (IsHide() != false) {
node->ToElement()->SetAttribute("hide", "true" );
}
return true;
}

View File

@ -10,6 +10,7 @@
#define __EWOL_WIDGET_H__ #define __EWOL_WIDGET_H__
#include <ewol/eObject/EObject.h> #include <ewol/eObject/EObject.h>
#include <tinyXML/tinyxml.h>
namespace ewol { namespace ewol {
class Widget; class Widget;
@ -70,40 +71,10 @@ namespace ewol {
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Widget Size: // -- Widget Size:
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private:
bool m_hide; //!< hide a widget on the display
protected: protected:
// internal element calculated by the system vec2 m_size; //!< internal : current size of the widget
float m_zoom; //!< generic widget zoom vec2 m_minSize; //!< user define the minimum size of the widget
vec2 m_origin; //!< internal ... I do not really known how i can use it ...
vec2 m_size; //!< internal : current size of the widget
vec2 m_minSize; //!< user define the minimum size of the widget
// user configuaration
vec2 m_userMinSize; //!< user define the minimum size of the widget
vec2 m_userMaxSize; //!< user define the maximum size of the widget
public: public:
/**
* @brief Set the zoom property of the widget
* @param[in] newVal newZoom value
*/
void SetZoom(float newVal);
/**
* @brief Get the zoom property of the widget
* @return the current zoom value
*/
float GetZoom(void);
/**
* @brief Set origin at the widget (must be an parrent widget that set this parameter).
* This represent the absolute origin in the program windows
* @param[in] x Position ot hte horizantal origin
* @param[in] y Position ot hte vertical origin
*/
void SetOrigin(float x, float y);
/**
* @brief Get the origin (obsolute position in the windows)
* @return coordonate of the origin requested
*/
vec2 GetOrigin(void);
/** /**
* @brief Convert the absolute position in the local Position (Relative) * @brief Convert the absolute position in the local Position (Relative)
* @param[in] pos Absolute position that you request convertion * @param[in] pos Absolute position that you request convertion
@ -113,34 +84,62 @@ namespace ewol {
/** /**
* @brief Parrent set the possible diplay size of the current widget whith his own possibilities * @brief Parrent set the possible diplay size of the current widget whith his own possibilities
* By default this save the widget availlable size in the widget size * By default this save the widget availlable size in the widget size
* @param[in] availlableX Availlable horisantal pixel size * @param[in] availlable Availlable x&y pixel size
* @param[in] availlableY Availlable vertical pixel size
*/ */
// TODO : Remove bool ==> deprecated ... virtual void CalculateSize(const vec2& availlable);
// TODO : Rename in SetSize()
virtual bool CalculateSize(float availlableX, float availlableY);
//update the min Size ... and the expend parameters for the sizer
/** /**
* @brief Calculate the minimum size of the widget that is needed to display or the user requested) * @brief Calculate the minimum size of the widget that is needed to display or the user requested)
*/ */
// TODO : Remove bool ==> deprecated ... virtual void CalculateMinSize(void);
virtual bool CalculateMinSize(void); protected:
// internal element calculated by the system
float m_zoom; //!< generic widget zoom
public:
/**
* @brief Set the zoom property of the widget
* @param[in] newVal newZoom value
*/
virtual void SetZoom(float newVal);
/**
* @brief Get the zoom property of the widget
* @return the current zoom value
*/
virtual float GetZoom(void);
protected:
vec2 m_origin; //!< internal ... I do not really known how i can use it ...
public:
/**
* @brief Set origin at the widget (must be an parrent widget that set this parameter).
* This represent the absolute origin in the program windows
* @param[in] pos Position of the origin
*/
virtual void SetOrigin(const vec2& pos);
/**
* @brief Get the origin (obsolute position in the windows)
* @return coordonate of the origin requested
*/
virtual vec2 GetOrigin(void);
protected:
vec2 m_userMinSize; //!< user define the minimum size of the widget
public:
/** /**
* @brief User set the minimum size he want to set the display * @brief User set the minimum size he want to set the display
* @param[in] x Set minimum horizontal size (-1 : no requested) * @param[in] size Set minimum size (none : 0)
* @param[in] y Set minimum vertical size (-1 : no requested)
*/ */
virtual void SetMinSize(float x=-1, float y=-1); virtual void SetMinSize(const vec2& size);
/** /**
* @brief Get the current calculated min size * @brief Get the current calculated min size
* @return the size requested * @return the size requested
*/ */
vec2 GetMinSize(void); virtual vec2 GetMinSize(void);
/** /**
* @brief Check if the current min size is compatible wit hte user minimum size * @brief Check if the current min size is compatible wit hte user minimum size
* If it is not the user minimum size will overWrite the minimum size set. * If it is not the user minimum size will overWrite the minimum size set.
*/ */
void CheckMinSize(void); virtual void CheckMinSize(void);
protected:
vec2 m_userMaxSize; //!< user define the maximum size of the widget
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(-1,-1) to unset)
@ -150,114 +149,90 @@ namespace ewol {
* @brief Get the current maximum size * @brief Get the current maximum size
* @return the size requested * @return the size requested
*/ */
vec2 GetMaxSize(void); virtual vec2 GetMaxSize(void);
/** /**
* @brief Get the widget size * @brief Get the widget size
* @return Requested size * @return Requested size
*/ */
vec2 GetSize(void); virtual vec2 GetSize(void);
protected: protected:
bvec2 m_userExpend; bvec2 m_userExpend; // TODO : Rename expand ... :p
public: public:
/** /**
* @brief Set the horizontal expend capacity * @brief Set the expend capabilities (x&y)
* @param[in] newExpend new Expend state * @param[in] newExpend 2D boolean repensent the capacity to expend
*/ */
virtual void SetExpendX(bool newExpend=false); virtual void SetExpand(const bvec2& newExpend);
/**
* @brief Get the horizontal expend capabilities
* @return boolean repensent the capacity to expend
*/
virtual bool CanExpentX(void);
/**
* @brief Set the vertical expend capacity
* @param[in] newExpend new Expend state
*/
virtual void SetExpendY(bool newExpend=false);
/**
* @brief Get the vertical expend capabilities
* @return boolean repensent the capacity to expend
*/
virtual bool CanExpentY(void);
/** /**
* @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
*/ */
virtual bvec2 CanExpent(void); virtual bvec2 CanExpand(void);
protected: protected:
bvec2 m_userFill; bvec2 m_userFill;
public: public:
/** /**
* @brief Set the horizontal filling capacity * @brief Set the x&y filling capacity
* @param[in] newFill new fill state * @param[in] newFill new x&y fill state
*/ */
virtual void SetFillX(bool newFill=false); virtual void SetFill(const bvec2& newFill);
/** /**
* @brief Get the horizontal filling capabilities * @brief Get the filling capabilities x&y
* @return boolean repensent the capacity to horizontal filling * @return bvec2 repensent the capacity to x&y filling
*/ */
bool CanFillX(void); const bvec2& CanFill(void);
/** protected:
* @brief Set the vertical filling capacity bool m_hide; //!< hide a widget on the display
* @param[in] newFill new fill state public:
*/
virtual void SetFillY(bool newFill=false);
/**
* @brief Get the vertical filling capabilities
* @return boolean repensent the capacity to vertical filling
*/
bool CanFillY(void);
/** /**
* @brief Set the widget hidden * @brief Set the widget hidden
*/ */
void Hide(void); virtual void Hide(void);
/** /**
* @brief Set the widget visible * @brief Set the widget visible
*/ */
void Show(void); virtual void Show(void);
/** /**
* @brief Get the visibility of the widget * @brief Get the visibility of the widget
* @return true: if the widget is hiden, false: it is visible * @return true: if the widget is hiden, false: it is visible
*/ */
bool IsHide(void) { return m_hide; }; virtual bool IsHide(void) { return m_hide; };
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Focus Area // -- Focus Area
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private: private:
bool m_hasFocus; //!< set the focus on this widget bool m_hasFocus; //!< set the focus on this widget
bool m_canFocus; //!< the focus can be done on this widget bool m_canFocus; //!< the focus can be done on this widget
public: public:
/** /**
* @brief Get the focus state of the widget * @brief Get the focus state of the widget
* @return Focus state * @return Focus state
*/ */
bool GetFocus(void) { return m_hasFocus;}; virtual bool GetFocus(void) { return m_hasFocus;};
/** /**
* @brief Get the capability to have focus * @brief Get the capability to have focus
* @return State capability to have focus * @return State capability to have focus
*/ */
bool CanHaveFocus(void) { return m_canFocus;}; virtual bool CanHaveFocus(void) { return m_canFocus;};
/** /**
* @brief Set focus on this widget * @brief Set focus on this widget
* @return return true if the widget keep the focus * @return return true if the widget keep the focus
*/ */
bool SetFocus(void); virtual bool SetFocus(void);
/** /**
* @brief Remove the focus on this widget * @brief Remove the focus on this widget
* @return return true if the widget have release his focus (if he has it) * @return return true if the widget have release his focus (if he has it)
*/ */
bool RmFocus(void); virtual bool RmFocus(void);
/** /**
* @brief Set the capability to have the focus * @brief Set the capability to have the focus
* @param[in] canFocusState new focus capability * @param[in] canFocusState new focus capability
*/ */
void SetCanHaveFocus(bool canFocusState); virtual void SetCanHaveFocus(bool canFocusState);
/** /**
* @brief Keep the focus on this widget ==> this remove the previous focus on all other widget * @brief Keep the focus on this widget ==> this remove the previous focus on all other widget
*/ */
void KeepFocus(void); virtual void KeepFocus(void);
protected: protected:
/** /**
* @brief Event of the focus has been grep by the current widget * @brief Event of the focus has been grep by the current widget
@ -278,12 +253,12 @@ namespace ewol {
* @brief Get the number of mouse event supported * @brief Get the number of mouse event supported
* @return return the number of event that the mouse supported [0..3] * @return return the number of event that the mouse supported [0..3]
*/ */
int32_t GetMouseLimit(void) { return m_limitMouseEvent; }; virtual int32_t GetMouseLimit(void) { return m_limitMouseEvent; };
/** /**
* @brief Get the number of mouse event supported * @brief Get the number of mouse event supported
* @param[in] numberState The number of event that the mouse supported [0..3] * @param[in] numberState The number of event that the mouse supported [0..3]
*/ */
void SetMouseLimit(int32_t numberState) { m_limitMouseEvent = numberState; }; virtual void SetMouseLimit(int32_t numberState) { m_limitMouseEvent = numberState; };
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- keyboard event properties Area // -- keyboard event properties Area
@ -296,12 +271,12 @@ namespace ewol {
* @return true : the event can be repeated. * @return true : the event can be repeated.
* @return false : the event must not be repeated. * @return false : the event must not be repeated.
*/ */
bool GetKeyboardRepeate(void) { return m_allowRepeateKeyboardEvent; }; virtual bool GetKeyboardRepeate(void) { return m_allowRepeateKeyboardEvent; };
/** /**
* @brief Set the keyboard repeating event supporting. * @brief Set the keyboard repeating event supporting.
* @param[in] state The repeating status (true: enable, false disable). * @param[in] state The repeating status (true: enable, false disable).
*/ */
void SetKeyboardRepeate(bool state) { m_allowRepeateKeyboardEvent = state; }; virtual void SetKeyboardRepeate(bool state) { m_allowRepeateKeyboardEvent = state; };
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Periodic call Area // -- Periodic call Area
@ -311,7 +286,7 @@ namespace ewol {
* @brief Request that the current widegt have a periodic call * @brief Request that the current widegt have a periodic call
* @param statusToSet true if the periodic call is needed * @param statusToSet true if the periodic call is needed
*/ */
void PeriodicCallSet(bool statusToSet); virtual void PeriodicCallSet(bool statusToSet);
public: public:
/** /**
* @brief Periodic call of this widget * @brief Periodic call of this widget
@ -370,11 +345,11 @@ namespace ewol {
* @param[in] generateEventId Event generic of the element * @param[in] generateEventId Event generic of the element
* @param[in] data Associate data wit the event * @param[in] data Associate data wit the event
*/ */
void ShortCutAdd(const char * descriptiveString, const char * generateEventId, etk::UString data="", bool broadcast=false); virtual void ShortCutAdd(const char * descriptiveString, const char * generateEventId, etk::UString data="", bool broadcast=false);
/** /**
* @brief Remove all curent shortCut * @brief Remove all curent shortCut
*/ */
void ShortCutClean(void); virtual void ShortCutClean(void);
public: public:
/** /**
* @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref OnEventKb) * @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref OnEventKb)
@ -394,13 +369,13 @@ namespace ewol {
/** /**
* @brief The widget mark itself that it need to regenerate the nest time. * @brief The widget mark itself that it need to regenerate the nest time.
*/ */
void MarkToRedraw(void); virtual void MarkToRedraw(void);
/** /**
* @brief Get the need of the redrawing of the widget and reset it to false * @brief Get the need of the redrawing of the widget and reset it to false
* @return true if we need to redraw * @return true if we need to redraw
* @return false if we have no need to redraw * @return false if we have no need to redraw
*/ */
bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; }; virtual bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; };
public: public:
/** /**
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) * @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
@ -429,16 +404,16 @@ namespace ewol {
* @note : the generation of the offset is due to the fact the cursor position is forced at the center of the widget. * @note : the generation of the offset is due to the fact the cursor position is forced at the center of the widget.
* @note This done nothing in "Finger" or "Stylet" mode. * @note This done nothing in "Finger" or "Stylet" mode.
*/ */
void GrabCursor(void); virtual void GrabCursor(void);
/** /**
* @brief Un-Grab the cursor (default mode cursor offset) * @brief Un-Grab the cursor (default mode cursor offset)
*/ */
void UnGrabCursor(void); virtual void UnGrabCursor(void);
/** /**
* @brief Get the grabbing status of the cursor. * @brief Get the grabbing status of the cursor.
* @return true if the cursor is curently grabbed * @return true if the cursor is curently grabbed
*/ */
bool GetGrabStatus(void); virtual bool GetGrabStatus(void);
// DisplayCursorType // DisplayCursorType
private: private:
ewol::cursorDisplay_te m_cursorDisplay; ewol::cursorDisplay_te m_cursorDisplay;
@ -447,13 +422,29 @@ namespace ewol {
* @brief Set the cursor display type. * @brief Set the cursor display type.
* @param[in] newCursor selected new cursor. * @param[in] newCursor selected new cursor.
*/ */
void SetCursor(ewol::cursorDisplay_te newCursor); virtual void SetCursor(ewol::cursorDisplay_te newCursor);
/** /**
* @brief Get the currrent cursor. * @brief Get the currrent cursor.
* @return the type of the cursor. * @return the type of the cursor.
*/ */
ewol::cursorDisplay_te GetCursor(void); virtual ewol::cursorDisplay_te GetCursor(void);
private:
etk::UString m_widgetName;
public:
/**
* @brief Load properties with an XML node.
* @param[in] node Pointer on the tinyXML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool LoadXML(TiXmlNode* node);
/**
* @brief Store properties in this XML node.
* @param[in,out] node Pointer on the tinyXML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool StoreXML(TiXmlNode* node);
}; // end of the class Widget declaration }; // end of the class Widget declaration

View File

@ -10,7 +10,16 @@
#include <ewol/widget/Joystick.h> #include <ewol/widget/Joystick.h>
#include <ewol/widget/Button.h> #include <ewol/widget/Button.h>
#include <ewol/widget/ButtonColor.h> #include <ewol/widget/ButtonColor.h>
//#include <ewol/widget/Scene.h> #include <ewol/widget/Spacer.h>
#include <ewol/widget/Slider.h>
#include <ewol/widget/Sizer.h>
#include <ewol/widget/ProgressBar.h>
#include <ewol/widget/Layer.h>
#include <ewol/widget/Label.h>
#include <ewol/widget/Image.h>
#include <ewol/widget/Gird.h>
#include <ewol/widget/Entry.h>
#include <ewol/widget/CheckBox.h>
#include <etk/Vector.h> #include <etk/Vector.h>
#undef __class__ #undef __class__
@ -22,9 +31,21 @@ static bool IsInit = false;
static ewol::Widget * m_focusWidgetDefault = NULL; static ewol::Widget * m_focusWidgetDefault = NULL;
static ewol::Widget * m_focusWidgetCurrent = NULL; static ewol::Widget * m_focusWidgetCurrent = NULL;
static etk::Vector<ewol::Widget*> l_listOfPeriodicWidget; static etk::Vector<ewol::Widget*> l_listOfPeriodicWidget;
static bool l_havePeriodic = false; static bool l_havePeriodic = false;
static bool l_haveRedraw = true;
class dataStructCreator
{
public:
etk::UString name;
ewol::widgetManager::creator_tf pointer;
};
static etk::Vector<dataStructCreator> l_creatorList;
static bool l_haveRedraw = true;
void ewol::widgetManager::Init(void) void ewol::widgetManager::Init(void)
{ {
@ -32,10 +53,23 @@ void ewol::widgetManager::Init(void)
// prevent android error ==> can create memory leak but I prefer // prevent android error ==> can create memory leak but I prefer
m_focusWidgetDefault = NULL; m_focusWidgetDefault = NULL;
m_focusWidgetCurrent = NULL; m_focusWidgetCurrent = NULL;
l_creatorList.Clear();
l_listOfPeriodicWidget.Clear(); l_listOfPeriodicWidget.Clear();
l_havePeriodic = false; l_havePeriodic = false;
l_haveRedraw = true; l_haveRedraw = true;
//ewol::WIDGET_SceneInit(); //ewol::WIDGET_SceneInit();
widget::Button::Init();
widget::ButtonColor::Init();
widget::Spacer::Init();
widget::Slider::Init();
widget::Sizer::Init();
widget::ProgressBar::Init();
widget::Layer::Init();
widget::Label::Init();
widget::Image::Init();
widget::Gird::Init();
widget::Entry::Init();
widget::CheckBox::Init();
IsInit = true; IsInit = true;
} }
@ -46,9 +80,24 @@ void ewol::widgetManager::UnInit(void)
ewol::widgetManager::FocusSetDefault(NULL); ewol::widgetManager::FocusSetDefault(NULL);
ewol::widgetManager::FocusRelease(); ewol::widgetManager::FocusRelease();
widget::CheckBox::UnInit();
widget::Entry::UnInit();
widget::Gird::UnInit();
widget::Image::UnInit();
widget::Label::UnInit();
widget::Layer::UnInit();
widget::ProgressBar::UnInit();
widget::Sizer::UnInit();
widget::Slider::UnInit();
widget::Spacer::UnInit();
widget::ButtonColor::UnInit();
widget::Button::UnInit();
IsInit = false; IsInit = false;
l_listOfPeriodicWidget.Clear(); l_listOfPeriodicWidget.Clear();
l_creatorList.Clear();
} }
void ewol::widgetManager::Rm(ewol::Widget * newWidget) void ewol::widgetManager::Rm(ewol::Widget * newWidget)
@ -203,3 +252,64 @@ bool ewol::widgetManager::IsDrawingNeeded(void)
l_haveRedraw = false; l_haveRedraw = false;
return tmp; return tmp;
} }
// element that generate the list of elements
void ewol::widgetManager::AddWidgetCreator(const etk::UString& name, ewol::widgetManager::creator_tf pointer)
{
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
if (name == l_creatorList[iii].name) {
if (NULL==pointer) {
EWOL_INFO("Remove Creator of a specify widget : " << name);
} else {
EWOL_WARNING("Replace Creator of a specify widget : " << name);
l_creatorList[iii].pointer = pointer;
}
return;
}
}
if (NULL==pointer) {
return;
}
EWOL_INFO("Add Creator of a specify widget : " << name);
dataStructCreator tmpStruct;
tmpStruct.name = name;
tmpStruct.pointer = pointer;
l_creatorList.PushBack(tmpStruct);
}
ewol::Widget* ewol::widgetManager::Create(const etk::UString& name)
{
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
if (name == l_creatorList[iii].name) {
if (NULL != l_creatorList[iii].pointer) {
return (*l_creatorList[iii].pointer)();
}
}
}
EWOL_WARNING("try to create an UnExistant widget : " << name);
return NULL;
}
bool ewol::widgetManager::Exist(const etk::UString& name)
{
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
if (name == l_creatorList[iii].name) {
return true;
}
}
return false;
}
etk::UString ewol::widgetManager::List(void)
{
etk::UString tmpVal;
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
tmpVal += l_creatorList[iii].name;
tmpVal += ",";
}
return tmpVal;
}

View File

@ -13,27 +13,35 @@
#include <ewol/debug.h> #include <ewol/debug.h>
#include <etk/Vector.h> #include <etk/Vector.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <tinyXML/tinyxml.h>
namespace ewol { namespace ewol {
namespace widgetManager { namespace widgetManager {
void Init( void); void Init(void);
void UnInit(void); void UnInit(void);
// need to call when remove a widget to clear all dependency of the focus system // need to call when remove a widget to clear all dependency of the focus system
void Rm( ewol::Widget * newWidget); void Rm(ewol::Widget * newWidget);
void FocusKeep( ewol::Widget * newWidget); // set the focus at the specific widget void FocusKeep(ewol::Widget * newWidget); // set the focus at the specific widget
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
void FocusRelease( void); // Release focus from the current widget to the default void FocusRelease(void); // Release focus from the current widget to the default
ewol::Widget * FocusGet( void); ewol::Widget* FocusGet(void);
void FocusRemoveIfRemove(ewol::Widget * newWidget); void FocusRemoveIfRemove(ewol::Widget * newWidget);
void PeriodicCallAdd(ewol::Widget * pWidget); void PeriodicCallAdd(ewol::Widget * pWidget);
void PeriodicCallRm( ewol::Widget * pWidget); void PeriodicCallRm( ewol::Widget * pWidget);
void PeriodicCall(int64_t localTime); void PeriodicCall(int64_t localTime);
bool PeriodicCallHave(void); bool PeriodicCallHave(void);
void MarkDrawingIsNeeded(void); void MarkDrawingIsNeeded(void);
bool IsDrawingNeeded(void); bool IsDrawingNeeded(void);
typedef ewol::Widget* (*creator_tf)(void);
// element that generate the list of elements
void AddWidgetCreator(const etk::UString& name, creator_tf pointer);
ewol::Widget* Create(const etk::UString& name);
bool Exist(const etk::UString& name);
etk::UString List(void);
}; };
}; };

View File

@ -50,23 +50,22 @@ ewol::Windows::~Windows(void)
} }
bool ewol::Windows::CalculateSize(float availlableX, float availlableY) void ewol::Windows::CalculateSize(const vec2& availlable)
{ {
//EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId); //EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId);
m_size.setValue(availlableX, availlableY); m_size = availlable;
if (NULL != m_subWidget) { if (NULL != m_subWidget) {
m_subWidget->CalculateMinSize(); m_subWidget->CalculateMinSize();
// TODO : Check if min Size is possible ... // TODO : Check if min Size is possible ...
// TODO : Herited from MinSize .. and expand ??? // TODO : Herited from MinSize .. and expand ???
m_subWidget->CalculateSize(m_size.x(), m_size.y()); m_subWidget->CalculateSize(m_size);
} }
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) { for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[iii]) { if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[iii]->CalculateMinSize(); m_popUpWidgetList[iii]->CalculateMinSize();
m_popUpWidgetList[iii]->CalculateSize(m_size.x(), m_size.y()); m_popUpWidgetList[iii]->CalculateSize(m_size);
} }
} }
return true;
} }
@ -191,7 +190,7 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget)
} }
m_subWidget = widget; m_subWidget = widget;
// Regenerate the size calculation : // Regenerate the size calculation :
CalculateSize(m_size.x(), m_size.y()); CalculateSize(m_size);
} }
@ -199,7 +198,7 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
{ {
m_popUpWidgetList.PushBack(widget); m_popUpWidgetList.PushBack(widget);
// Regenerate the size calculation : // Regenerate the size calculation :
CalculateSize(m_size.x(), m_size.y()); CalculateSize(m_size);
// TODO : it is dansgerous to access directly to the system ... // TODO : it is dansgerous to access directly to the system ...
eSystem::ResetIOEvent(); eSystem::ResetIOEvent();
} }

View File

@ -21,7 +21,7 @@ namespace ewol {
Windows(void); Windows(void);
virtual ~Windows(void); virtual ~Windows(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolWindows"; }; virtual const char * const GetObjectType(void) { return "Ewol::Windows"; };
// internal event at ewol system : // internal event at ewol system :
public: public:
void SysDraw(void); void SysDraw(void);
@ -36,9 +36,9 @@ namespace ewol {
virtual void On(void) { }; virtual void On(void) { };
public: public:
// Derived function // Derived function
virtual bool CalculateSize(float availlableX, float availlableY); virtual void CalculateSize(const vec2& availlable);
// Derived function // Derived function
virtual ewol::Widget * GetWidgetAtPos(vec2 pos); virtual ewol::Widget * GetWidgetAtPos(vec2 pos);
private: private:
bool m_hasDecoration; bool m_hasDecoration;
public: public:
@ -52,8 +52,8 @@ namespace ewol {
m_hasDecoration = true; m_hasDecoration = true;
} }
private: private:
ewol::Widget* m_subWidget; ewol::Widget* m_subWidget;
etk::Vector<ewol::Widget*> m_popUpWidgetList; etk::Vector<ewol::Widget*> m_popUpWidgetList;
public: public:
void SetSubWidget(ewol::Widget * widget); void SetSubWidget(ewol::Widget * widget);
void PopUpWidgetPush(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget);

View File

@ -28,10 +28,8 @@ namespace widget {
FileChooser(void); FileChooser(void);
virtual ~FileChooser(void); virtual ~FileChooser(void);
// Derived function // Derived function
virtual const char * const GetObjectType(void) { return "EwolFileChooser"; }; virtual const char * const GetObjectType(void) { return "Ewol::FileChooser"; };
// 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
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
void SetTitle(etk::UString label); void SetTitle(etk::UString label);
void SetValidateLabel(etk::UString label); void SetValidateLabel(etk::UString label);

View File

@ -64,6 +64,7 @@ FILE_LIST+= ewol/widget/Widget.cpp \
ewol/widget/CheckBox.cpp \ ewol/widget/CheckBox.cpp \
ewol/widget/ColorBar.cpp \ ewol/widget/ColorBar.cpp \
ewol/widget/ContextMenu.cpp \ ewol/widget/ContextMenu.cpp \
ewol/widget/Composer.cpp \
ewol/widget/Drawable.cpp \ ewol/widget/Drawable.cpp \
ewol/widget/Entry.cpp \ ewol/widget/Entry.cpp \
ewol/widget/Joystick.cpp \ ewol/widget/Joystick.cpp \