First dusplay EOL element with basic form ...

This commit is contained in:
Edouard Dupin 2011-11-29 10:12:14 +01:00
parent 9458f41709
commit eddb65de56
19 changed files with 109 additions and 34 deletions

View File

@ -104,7 +104,7 @@ int main(int argc, char *argv[])
ewol::SetDefaultFont("freefont/FreeMono", 14); ewol::SetDefaultFont("freefont/FreeMono", 14);
ewol::theme::LoadDefault("dataTest/exemple.eol"); ewol::theme::LoadDefault("dataTest/exemple.eol");
//ewol::theme::LoadDefault("dataTest/exemple.eol"); //ewol::theme::LoadDefault("dataTest/exemple.eol");
exit(0); //exit(0);
Plop * myWindowsExample = new Plop(); Plop * myWindowsExample = new Plop();

View File

@ -22,6 +22,7 @@
******************************************************************************* *******************************************************************************
*/ */
#include <ewol/theme/Theme.h>
#include <ewol/theme/EolBase.h> #include <ewol/theme/EolBase.h>
#undef __class__ #undef __class__
@ -38,8 +39,9 @@ ewol::theme::EolBase::~EolBase(void)
} }
/*
void ewol::theme::EolBase::Parse(TiXmlNode * pNode) void ewol::theme::EolBase::Parse(TiXmlNode * pNode)
{ {
EWOL_INFO("Element Base .. Generic ... nothing to parse..." ); EWOL_INFO("Element Base .. Generic ... nothing to parse..." );
} }
*/

View File

@ -39,7 +39,8 @@ namespace ewol {
public: public:
EolBase(void); EolBase(void);
virtual ~EolBase(void); virtual ~EolBase(void);
virtual void Parse(TiXmlNode * pNode); virtual void Parse(TiXmlNode * pNode) = 0;
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) = 0;
}; };
}; };
}; };

View File

@ -22,6 +22,7 @@
******************************************************************************* *******************************************************************************
*/ */
#include <ewol/theme/Theme.h>
#include <ewol/theme/EolBaseLine.h> #include <ewol/theme/EolBaseLine.h>
#undef __class__ #undef __class__
@ -76,3 +77,25 @@ void ewol::theme::EolBaseLine::Parse(TiXmlNode * pNode)
} }
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"line\" : pos(" << m_posStart.x << "," << m_posStart.y << ") to pos(" << m_posStop.x << "," << m_posStop.y << ") thickness=" << m_thickness); EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"line\" : pos(" << m_posStart.x << "," << m_posStart.y << ") to pos(" << m_posStop.x << "," << m_posStop.y << ") thickness=" << m_thickness);
} }
void ewol::theme::EolBaseLine::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{
bool res = false;
color_ts selectedColor = {0.0, 0.0, 0.0, 1.0};
// try get color for current element
if (NULL != myElement) {
res = myElement->GetColor(m_color, selectedColor);
}
// try from theme if not existed
if( false == res
&& NULL != myTheme ) {
myElement->GetColor(m_color, selectedColor);
}
newObject.SetColor(selectedColor);
newObject.Line(posX + m_posStart.x*sizeX, posY + m_posStart.y*sizeY, posX + m_posStop.x*sizeX, posY + m_posStop.y*sizeY, m_thickness*(sizeX+sizeY)/2);
}

View File

@ -43,6 +43,7 @@ namespace ewol {
/> />
*/ */
virtual void Parse(TiXmlNode * pNode); virtual void Parse(TiXmlNode * pNode);
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
private: private:
etk::String m_color; etk::String m_color;
coord2D_ts m_posStart; coord2D_ts m_posStart;

View File

@ -22,6 +22,7 @@
******************************************************************************* *******************************************************************************
*/ */
#include <ewol/theme/Theme.h>
#include <ewol/theme/EolBaseRect.h> #include <ewol/theme/EolBaseRect.h>
#undef __class__ #undef __class__
@ -67,3 +68,23 @@ void ewol::theme::EolBaseRect::Parse(TiXmlNode * pNode)
m_color = pNode->ToElement()->Attribute("color"); m_color = pNode->ToElement()->Attribute("color");
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"rect\" : pos(" << m_position.x << "," << m_position.y << ") size(" << m_size.x << "," << m_size.y << ") colorName=\"" << m_color << "\""); EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"rect\" : pos(" << m_position.x << "," << m_position.y << ") size(" << m_size.x << "," << m_size.y << ") colorName=\"" << m_color << "\"");
} }
void ewol::theme::EolBaseRect::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{
bool res = false;
color_ts selectedColor = {0.0, 0.0, 0.0, 1.0};
// try get color for current element
if (NULL != myElement) {
res = myElement->GetColor(m_color, selectedColor);
}
// try from theme if not existed
if( false == res
&& NULL != myTheme ) {
myElement->GetColor(m_color, selectedColor);
}
newObject.SetColor(selectedColor);
newObject.Rectangle(posX + m_position.x*sizeX, posY + m_position.y*sizeY, m_size.x*sizeX, m_size.y*sizeY);
}

View File

@ -42,6 +42,7 @@ namespace ewol {
/> />
*/ */
virtual void Parse(TiXmlNode * pNode); virtual void Parse(TiXmlNode * pNode);
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
private: private:
etk::String m_color; etk::String m_color;
coord2D_ts m_position; coord2D_ts m_position;

View File

@ -88,7 +88,7 @@ void ewol::theme::EolColor::Parse(TiXmlNode * pNode)
} }
etk::String ewol::theme::EolColor::GetName(void) etk::String ewol::theme::EolColor::GetName(void) const
{ {
return m_name; return m_name;
} }
@ -100,13 +100,13 @@ void ewol::theme::EolColor::SetName(etk::String & newName)
} }
bool ewol::theme::EolColor::HasName(etk::String & newName) bool ewol::theme::EolColor::HasName(etk::String & newName) const
{ {
return m_name == newName; return m_name == newName;
} }
color_ts ewol::theme::EolColor::Get(void) color_ts ewol::theme::EolColor::Get(void) const
{ {
return m_color; return m_color;
} }

View File

@ -42,10 +42,10 @@ namespace ewol {
virtual ~EolColor(void); virtual ~EolColor(void);
void Parse(TiXmlNode * pNode); void Parse(TiXmlNode * pNode);
etk::String GetName(void); etk::String GetName(void) const;
void SetName(etk::String & newName); void SetName(etk::String & newName);
bool HasName(etk::String & newName); bool HasName(etk::String & newName) const;
color_ts Get(void); color_ts Get(void) const;
void Set(color_ts newColor); void Set(color_ts newColor);
void Set(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha = 1); void Set(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha = 1);
private: private:

View File

@ -218,7 +218,7 @@ void ewol::theme::EolElement::Parse(TiXmlNode * root)
bool ewol::theme::EolElement::GetColor(etk::String colorName, color_ts & selectedColor) bool ewol::theme::EolElement::GetColor(etk::String colorName, color_ts & selectedColor) const
{ {
for (int32_t iii=0; iii < m_listColor.Size(); iii++) { for (int32_t iii=0; iii < m_listColor.Size(); iii++) {
if(NULL!=m_listColor[iii]) { if(NULL!=m_listColor[iii]) {
@ -235,13 +235,13 @@ bool ewol::theme::EolElement::GetColor(etk::String colorName, color_ts & selecte
return false; return false;
} }
int32_t ewol::theme::EolElement::GetNbFrame(void) int32_t ewol::theme::EolElement::GetNbFrame(void) const
{ {
return m_listElement.Size(); return m_listElement.Size();
} }
int32_t ewol::theme::EolElement::GetFrameId(etk::String & frameName) int32_t ewol::theme::EolElement::GetFrameId(etk::String & frameName) const
{ {
for (int32_t iii=0; iii < m_listElement.Size(); iii++) { for (int32_t iii=0; iii < m_listElement.Size(); iii++) {
if(NULL!=m_listElement[iii]) { if(NULL!=m_listElement[iii]) {
@ -254,7 +254,7 @@ int32_t ewol::theme::EolElement::GetFrameId(etk::String & frameName)
} }
etk::String ewol::theme::EolElement::GetName(void) etk::String ewol::theme::EolElement::GetName(void) const
{ {
return m_name; return m_name;
} }
@ -266,13 +266,13 @@ void ewol::theme::EolElement::SetName(etk::String & newName)
} }
bool ewol::theme::EolElement::HasName(etk::String & newName) bool ewol::theme::EolElement::HasName(etk::String & newName) const
{ {
return m_name == newName; return m_name == newName;
} }
void ewol::theme::EolElement::Generate(const ewol::theme::Theme * myTheme, int32_t frameId, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) void ewol::theme::EolElement::Generate(const ewol::theme::Theme * myTheme, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{ {
if (0 > frameId || frameId > m_listElement.Size()) { if (0 > frameId || frameId > m_listElement.Size()) {
EWOL_ERROR("Did not find the frame id=" << frameId); EWOL_ERROR("Did not find the frame id=" << frameId);
@ -281,6 +281,7 @@ void ewol::theme::EolElement::Generate(const ewol::theme::Theme * myTheme, int32
if (NULL != m_listElement[frameId]) { if (NULL != m_listElement[frameId]) {
m_listElement[frameId]->Generate(myTheme, this, newObject, posX, posY, sizeX, sizeY); m_listElement[frameId]->Generate(myTheme, this, newObject, posX, posY, sizeX, sizeY);
} }
} }

View File

@ -42,16 +42,16 @@ namespace ewol {
EolElement(void); EolElement(void);
virtual ~EolElement(void); virtual ~EolElement(void);
void Parse(TiXmlNode * pNode); void Parse(TiXmlNode * pNode);
etk::String GetName(void); etk::String GetName(void) const;
void SetName(etk::String & newName); void SetName(etk::String & newName);
bool HasName(etk::String & newName); bool HasName(etk::String & newName) const;
void Generate(const ewol::theme::Theme * myTheme, int32_t frameId, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY); void Generate(const ewol::theme::Theme * myTheme, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
bool GenerateGroup(const ewol::theme::Theme * myTheme, etk::String groupName, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY); bool GenerateGroup(const ewol::theme::Theme * myTheme, etk::String groupName, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
bool GetColor(etk::String colorName, color_ts & selectedColor); bool GetColor(etk::String colorName, color_ts & selectedColor) const;
int32_t GetNbFrame(void); int32_t GetNbFrame(void) const;
int32_t GetFrameId(etk::String & frameName); int32_t GetFrameId(etk::String & frameName) const;
private: private:
void RemoveAll(void); void RemoveAll(void);
etk::String m_name; etk::String m_name;

View File

@ -116,9 +116,11 @@ bool ewol::theme::EolElementFrame::HasName(etk::String & newName)
} }
void ewol::theme::EolElementFrame::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) void ewol::theme::EolElementFrame::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{ {
for (int32_t iii=0; iii<m_description.Size(); iii++) {
m_description[iii]->Generate(myTheme, myElement, newObject, posX, posY, sizeX, sizeY);
}
} }

View File

@ -44,7 +44,7 @@ namespace ewol {
EolElementFrame(void); EolElementFrame(void);
virtual ~EolElementFrame(void); virtual ~EolElementFrame(void);
void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY); void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
void Parse(TiXmlNode * pNode); void Parse(TiXmlNode * pNode);
etk::String GetName(void); etk::String GetName(void);

View File

@ -184,7 +184,7 @@ bool ewol::theme::Theme::GetColor(etk::String colorName, color_ts & selectedColo
return false; return false;
} }
void ewol::theme::Theme::Generate(int32_t id, int32_t frameId, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) void ewol::theme::Theme::Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{ {
if (0 > id || id > m_listElement.Size()) { if (0 > id || id > m_listElement.Size()) {
return; return;
@ -194,7 +194,7 @@ void ewol::theme::Theme::Generate(int32_t id, int32_t frameId, ewol::OObject2DTe
} }
} }
bool ewol::theme::Theme::GenerateGroup(etk::String groupName, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) bool ewol::theme::Theme::GenerateGroup(etk::String groupName, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{ {
if (groupName == "") { if (groupName == "") {
EWOL_ERROR("Did not find the group name=" << groupName); EWOL_ERROR("Did not find the group name=" << groupName);

View File

@ -50,8 +50,8 @@ namespace ewol {
Theme(void); Theme(void);
virtual ~Theme(void); virtual ~Theme(void);
void Load(etk::File & newFile, bool defaultTheme=false); void Load(etk::File & newFile, bool defaultTheme=false);
void Generate(int32_t id, int32_t frameId, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY); void Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
bool GenerateGroup(etk::String groupName, ewol::OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY); bool GenerateGroup(etk::String groupName, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
bool GetColor(etk::String colorName, color_ts & selectedColor); bool GetColor(etk::String colorName, color_ts & selectedColor);
int32_t GetNbFrame(int32_t id); int32_t GetNbFrame(int32_t id);
int32_t GetFrameId(int32_t id, etk::String & frameName); int32_t GetFrameId(int32_t id, etk::String & frameName);

View File

@ -65,7 +65,7 @@ int32_t ewol::theme::GetObjectId(etk::String name)
// ???? GetObjectType(int32_t id); // ???? GetObjectType(int32_t id);
void ewol::theme::Generate(int32_t id, int32_t frameId, OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) void ewol::theme::Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
{ {
if (id<0) { if (id<0) {
return; return;

View File

@ -40,7 +40,7 @@ namespace ewol {
void Load(etk::File filename); // add a user theme at the list ==> this remove previous declaration by the user... void Load(etk::File filename); // add a user theme at the list ==> this remove previous declaration by the user...
int32_t GetObjectId(etk::String name); int32_t GetObjectId(etk::String name);
// ???? GetObjectType(int32_t id); // ???? GetObjectType(int32_t id);
void Generate(int32_t id, int32_t frameId, OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY); void Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
int32_t GetNbFrame(int32_t id); int32_t GetNbFrame(int32_t id);
int32_t GetFrameId(int32_t id, etk::String & frameName); int32_t GetFrameId(int32_t id, etk::String & frameName);

View File

@ -25,6 +25,7 @@
#include <ewol/widget/Test.h> #include <ewol/widget/Test.h>
#include <ewol/OObject.h> #include <ewol/OObject.h>
#include <ewol/themeManager.h>
@ -57,7 +58,9 @@ void ewol::Test::OnRegenerateDisplay(void)
{ {
// clean the object list ... // clean the object list ...
ClearOObjectList(); ClearOObjectList();
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored; ewol::OObject2DColored * tmpOObjects = NULL;
tmpOObjects = new ewol::OObject2DColored;
tmpOObjects->SetColor(1.0, 0.0, 0.0, 1.0); tmpOObjects->SetColor(1.0, 0.0, 0.0, 1.0);
tmpOObjects->Rectangle( 0, 0, m_size.x, m_size.y); tmpOObjects->Rectangle( 0, 0, m_size.x, m_size.y);
@ -134,6 +137,15 @@ void ewol::Test::OnRegenerateDisplay(void)
AddOObject(tmpOObjects, "BouttonDecoration"); AddOObject(tmpOObjects, "BouttonDecoration");
tmpOObjects = new ewol::OObject2DColored;
ewol::theme::Generate(0, 0, *tmpOObjects, 50, 50, m_size.x*0.75, m_size.y*0.75);
AddOObject(tmpOObjects, "themeObject");
// Regenerate the event Area: // Regenerate the event Area:
EventAreaRemoveAll(); EventAreaRemoveAll();
coord origin; coord origin;

View File

@ -5,6 +5,7 @@
<color name="MEGAMERDIQUE"/> <color name="MEGAMERDIQUE"/>
<color name="GenBG" val="#FF0000"/> <color name="GenBG" val="#FF0000"/>
<color name="GenFG" val="#FF000055"/> <color name="GenFG" val="#FF000055"/>
<color name="TestPlop" val="#0000FF55"/>
<color name="GenBorder" val="1.0;0.000512;1.0;0.755562535"/> <color name="GenBorder" val="1.0;0.000512;1.0;0.755562535"/>
<color name="GenBorder" val="5.0;0.000512;1.0"/> <color name="GenBorder" val="5.0;0.000512;1.0"/>
@ -36,7 +37,8 @@
- R.R;G.G;B.B;A.A ==> in double 0<=x<=1 - R.R;G.G;B.B;A.A ==> in double 0<=x<=1
- &NameColor ==> search internal color of the element and after global color ... - &NameColor ==> search internal color of the element and after global color ...
--> -->
<color name="Background" val="#151515"/> <color name="Background" val="#EEEEEEFF"/>
<color name="Red" val="#FF0000FF"/>
<color name="Border" val="0.0;0.000512;1.0;0.755562535"/> <color name="Border" val="0.0;0.000512;1.0;0.755562535"/>
<!--...--> <!--...-->
@ -56,10 +58,19 @@
<!--...--> <!--...-->
<frame id="0" name="basic"> <frame id="0" name="basic">
<rect color="..." <rect color="Background"
position="0.0;0.0"
size="1.0;1.0"
/>
<rect color="Red"
position="0.53;0.56" position="0.53;0.56"
size="0.22;0.11" size="0.22;0.11"
/> />
<line color="TestPlop"
positionStart="0.53;0.56"
positionStop="0.22;0.11"
thickness="0.01"
/>
</frame> </frame>
<frame id="0" name="hover"> <frame id="0" name="hover">
<rect color="..." <rect color="..."