[DEV] image rework base ok
This commit is contained in:
parent
b46542ca8d
commit
3e29816651
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 32da0ffb78f9ff9e3ede49c87a9fd5c19e23136b
|
Subproject commit dffd6233d37dd886f910ca95d9f176724b6fc4ff
|
2
external/parsersvg
vendored
2
external/parsersvg
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b8287243a8aef3ff97aa608b284e17c847481cd7
|
Subproject commit 928deb22eeec43ee683f331c33547845f6304d1f
|
@ -14,16 +14,16 @@ static vec2 ratio(9999999,888888);
|
|||||||
static vec2 invRatio(1,1);
|
static vec2 invRatio(1,1);
|
||||||
static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel);
|
static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel);
|
||||||
|
|
||||||
static const float inchToMillimeter = 1.0f/25.4f;
|
static const float inchToMillimeter = 25.4f;
|
||||||
static const float footToMillimeter = 1.0f/304.8f;
|
static const float footToMillimeter = 304.8f;
|
||||||
static const float meterToMillimeter = 1.0f/1000.0f;
|
static const float meterToMillimeter = 1000.0f;
|
||||||
static const float centimeterToMillimeter = 1.0f/10.0f;
|
static const float centimeterToMillimeter = 10.0f;
|
||||||
static const float kilometerToMillimeter = 1.0f/1000000.0f;
|
static const float kilometerToMillimeter = 1000000.0f;
|
||||||
static const float millimeterToInch = 25.4f;
|
static const float millimeterToInch = 1.0f/25.4f;
|
||||||
static const float millimeterToFoot = 304.8f;
|
static const float millimeterToFoot = 1.0f/304.8f;
|
||||||
static const float millimeterToMeter = 1000.0f;
|
static const float millimeterToMeter = 1.0f/1000.0f;
|
||||||
static const float millimeterToCentimeter = 10.0f;
|
static const float millimeterToCentimeter = 1.0f/10.0f;
|
||||||
static const float millimeterToKilometer = 1000000.0f;
|
static const float millimeterToKilometer = 1.0f/1000000.0f;
|
||||||
|
|
||||||
|
|
||||||
void ewol::dimension::Init(void)
|
void ewol::dimension::Init(void)
|
||||||
@ -146,16 +146,20 @@ vec2 ewol::Dimension::GetPixel(void) const
|
|||||||
{
|
{
|
||||||
if (m_type!=ewol::Dimension::Pourcent) {
|
if (m_type!=ewol::Dimension::Pourcent) {
|
||||||
return m_data;
|
return m_data;
|
||||||
|
} else {
|
||||||
|
vec2 windDim = windowsSize.GetPixel();
|
||||||
|
return vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y());
|
||||||
}
|
}
|
||||||
vec2 windDim = windowsSize.GetPixel();
|
|
||||||
return vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 ewol::Dimension::GetPourcent(void) const
|
vec2 ewol::Dimension::GetPourcent(void) const
|
||||||
{
|
{
|
||||||
if (m_type!=ewol::Dimension::Pourcent) {
|
if (m_type!=ewol::Dimension::Pourcent) {
|
||||||
vec2 windDim = windowsSize.GetPixel();
|
vec2 windDim = windowsSize.GetPixel();
|
||||||
return vec2(m_data.x()/windDim.x()*100.0f, m_data.y()/windDim.y()*100.0f);
|
//EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " ==> " << windDim << "px"); // ==> infinite loop ...
|
||||||
|
//printf(" windows dimention : %f,%f", windDim.x(),windDim.y());
|
||||||
|
//printf(" data : %f,%f", m_data.x(),m_data.y());
|
||||||
|
return vec2((m_data.x()/windDim.x())*100.0f, (m_data.y()/windDim.y())*100.0f);
|
||||||
}
|
}
|
||||||
return vec2(m_data.x()*100.0f, m_data.y()*100.0f);;
|
return vec2(m_data.x()*100.0f, m_data.y()*100.0f);;
|
||||||
}
|
}
|
||||||
@ -167,7 +171,7 @@ vec2 ewol::Dimension::GetMeter(void) const
|
|||||||
|
|
||||||
vec2 ewol::Dimension::GetCentimeter(void) const
|
vec2 ewol::Dimension::GetCentimeter(void) const
|
||||||
{
|
{
|
||||||
return ewol::Dimension::GetMillimeter()*millimeterToMeter;
|
return ewol::Dimension::GetMillimeter()*millimeterToCentimeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 ewol::Dimension::GetMillimeter(void) const
|
vec2 ewol::Dimension::GetMillimeter(void) const
|
||||||
@ -225,9 +229,46 @@ etk::UString ewol::Dimension::GetString(void)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Dimension::SetString(const etk::UString& value)
|
void ewol::Dimension::SetString(const etk::UString& value)
|
||||||
{
|
{
|
||||||
EWOL_TODO(" not done yet ...");
|
etk::UString value2 = value;
|
||||||
|
int32_t nbElementToRemove=0;
|
||||||
|
vec2 data;
|
||||||
|
distance_te type;
|
||||||
|
if (value.EndWith("%")==true) {
|
||||||
|
nbElementToRemove=1;
|
||||||
|
type = ewol::Dimension::Pourcent;
|
||||||
|
} else if (value.EndWith("px")==true) {
|
||||||
|
nbElementToRemove=2;
|
||||||
|
type = ewol::Dimension::Pixel;
|
||||||
|
} else if (value.EndWith("cm")==true) {
|
||||||
|
nbElementToRemove=2;
|
||||||
|
type = ewol::Dimension::Centimeter;
|
||||||
|
} else if (value.EndWith("mm")==true) {
|
||||||
|
nbElementToRemove=2;
|
||||||
|
type = ewol::Dimension::Millimeter;
|
||||||
|
} else if (value.EndWith("km")==true) {
|
||||||
|
nbElementToRemove=2;
|
||||||
|
type = ewol::Dimension::Kilometer;
|
||||||
|
} else if (value.EndWith("m")==true) {
|
||||||
|
nbElementToRemove=1;
|
||||||
|
type = ewol::Dimension::Meter;
|
||||||
|
} else if (value.EndWith("in")==true) {
|
||||||
|
nbElementToRemove=2;
|
||||||
|
type = ewol::Dimension::Inch;
|
||||||
|
} else if (value.EndWith("ft")==true) {
|
||||||
|
nbElementToRemove=2;
|
||||||
|
type = ewol::Dimension::foot;
|
||||||
|
} else {
|
||||||
|
EWOL_WARNING("you might st an unit at : \"" << value << "\"");
|
||||||
|
nbElementToRemove=0;
|
||||||
|
type = ewol::Dimension::Pixel;
|
||||||
|
}
|
||||||
|
value2.Remove(value2.Size()-nbElementToRemove, nbElementToRemove);
|
||||||
|
data=value2;
|
||||||
|
Set(data, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,3 +268,14 @@ bool ewol::Image::HasSources(void)
|
|||||||
return m_resource!=NULL;
|
return m_resource!=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec2 ewol::Image::GetRealSize(void)
|
||||||
|
{
|
||||||
|
if (NULL==m_resource) {
|
||||||
|
return vec2(0,0);
|
||||||
|
}
|
||||||
|
return m_resource->GetRealSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,26 +18,26 @@ namespace ewol
|
|||||||
class Image : public ewol::Compositing
|
class Image : public ewol::Compositing
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
vec3 m_position; //!< The current position to draw
|
vec3 m_position; //!< The current position to draw
|
||||||
vec3 m_clippingPosStart; //!< Clipping start position
|
vec3 m_clippingPosStart; //!< Clipping start position
|
||||||
vec3 m_clippingPosStop; //!< Clipping stop position
|
vec3 m_clippingPosStop; //!< Clipping stop position
|
||||||
bool m_clippingEnable; //!< true if the clipping must be activated
|
bool m_clippingEnable; //!< true if the clipping must be activated
|
||||||
private:
|
private:
|
||||||
draw::Color m_color; //!< The text foreground color
|
draw::Color m_color; //!< The text foreground color
|
||||||
vec3 m_axes; //!< Rotation axes (instant)
|
vec3 m_axes; //!< Rotation axes (instant)
|
||||||
float m_angle; //!< Angle to set at the axes
|
float m_angle; //!< Angle to set at the axes
|
||||||
private:
|
private:
|
||||||
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
|
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
|
||||||
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
|
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
|
||||||
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
|
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
|
||||||
int32_t m_GLColor; //!< openGL id on the element (color buffer)
|
int32_t m_GLColor; //!< openGL id on the element (color buffer)
|
||||||
int32_t m_GLtexture; //!< openGL id on the element (Texture position)
|
int32_t m_GLtexture; //!< openGL id on the element (Texture position)
|
||||||
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
|
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
|
||||||
private:
|
private:
|
||||||
ewol::TextureFile* m_resource; //!< texture resources
|
ewol::TextureFile* m_resource; //!< texture resources
|
||||||
etk::Vector<vec3 > m_coord; //!< internal coord of the object
|
etk::Vector<vec3 > m_coord; //!< internal coord of the object
|
||||||
etk::Vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
|
etk::Vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
|
||||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Load the openGL program and get all the ID needed
|
* @brief Load the openGL program and get all the ID needed
|
||||||
@ -72,11 +72,13 @@ namespace ewol
|
|||||||
* @param[in] pos Position of the text (in 3D)
|
* @param[in] pos Position of the text (in 3D)
|
||||||
*/
|
*/
|
||||||
void SetPos(const vec3& pos);
|
void SetPos(const vec3& pos);
|
||||||
|
inline void SetPos(const vec2& pos) { SetPos(vec3(pos.x(),pos.y(),0)); };
|
||||||
/**
|
/**
|
||||||
* @brief Set relative position for the next text writen
|
* @brief Set relative position for the next text writen
|
||||||
* @param[in] pos ofset apply of the text (in 3D)
|
* @param[in] pos ofset apply of the text (in 3D)
|
||||||
*/
|
*/
|
||||||
void SetRelPos(const vec3& pos);
|
void SetRelPos(const vec3& pos);
|
||||||
|
inline void SetRelPos(const vec2& pos) { SetRelPos(vec3(pos.x(),pos.y(),0)); };
|
||||||
/**
|
/**
|
||||||
* @brief Set the Color of the current foreground font
|
* @brief Set the Color of the current foreground font
|
||||||
* @param[in] color Color to set on foreground (for next print)
|
* @param[in] color Color to set on foreground (for next print)
|
||||||
@ -88,12 +90,14 @@ namespace ewol
|
|||||||
* @param[in] width Width size of the clipping
|
* @param[in] width Width size of the clipping
|
||||||
*/
|
*/
|
||||||
void SetClippingWidth(const vec3& pos, vec3 width);
|
void SetClippingWidth(const vec3& pos, vec3 width);
|
||||||
|
inline void SetClippingWidth(const vec2& pos, const vec2& width) { SetClippingWidth(vec3(pos.x(),pos.y(),0), vec3(width.x(),width.y(),0)); };
|
||||||
/**
|
/**
|
||||||
* @brief Request a clipping area for the text (next draw only)
|
* @brief Request a clipping area for the text (next draw only)
|
||||||
* @param[in] pos Start position of the clipping
|
* @param[in] pos Start position of the clipping
|
||||||
* @param[in] posEnd End position of the clipping
|
* @param[in] posEnd End position of the clipping
|
||||||
*/
|
*/
|
||||||
void SetClipping(const vec3& pos, vec3 posEnd);
|
void SetClipping(const vec3& pos, vec3 posEnd);
|
||||||
|
inline void SetClipping(const vec2& pos, const vec2& posEnd) { SetClipping(vec3(pos.x(),pos.y(),0), vec3(posEnd.x(),posEnd.y(),0)); };
|
||||||
/**
|
/**
|
||||||
* @brief Enable/Disable the clipping (without lose the current clipping position)
|
* @brief Enable/Disable the clipping (without lose the current clipping position)
|
||||||
* @brief newMode The new status of the clipping
|
* @brief newMode The new status of the clipping
|
||||||
@ -132,6 +136,11 @@ namespace ewol
|
|||||||
* @return the validity od the resources.
|
* @return the validity od the resources.
|
||||||
*/
|
*/
|
||||||
bool HasSources(void);
|
bool HasSources(void);
|
||||||
|
/**
|
||||||
|
* @brief Get the source image registered size in the file (<0 when multiple size image)
|
||||||
|
* @return tre image registered size
|
||||||
|
*/
|
||||||
|
vec2 GetRealSize(void);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -298,12 +298,17 @@ static int32_t nextP2(int32_t value)
|
|||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size)
|
bool ewol::resource::Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size)
|
||||||
{
|
{
|
||||||
ivec2 size2(nextP2(size.x()), nextP2(size.y()));
|
|
||||||
etk::UString TmpFilename = filename;
|
etk::UString TmpFilename = filename;
|
||||||
TmpFilename += ":";
|
if (false == filename.EndWith(".svg") ) {
|
||||||
TmpFilename += size2.x();
|
size = ivec2(-1,-1);
|
||||||
TmpFilename += "x";
|
}
|
||||||
TmpFilename += size2.y();
|
if (size.x()>0 && size.y()>0) {
|
||||||
|
ivec2 size2(nextP2(size.x()), nextP2(size.y()));
|
||||||
|
TmpFilename += ":";
|
||||||
|
TmpFilename += size2.x();
|
||||||
|
TmpFilename += "x";
|
||||||
|
TmpFilename += size2.y();
|
||||||
|
}
|
||||||
|
|
||||||
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" basic size=" << size);
|
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" basic size=" << size);
|
||||||
object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename));
|
object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename));
|
||||||
@ -312,7 +317,7 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::TextureFile*& obje
|
|||||||
}
|
}
|
||||||
EWOL_INFO(" ==> create new one...");
|
EWOL_INFO(" ==> create new one...");
|
||||||
// need to crate a new one ...
|
// need to crate a new one ...
|
||||||
object = new ewol::TextureFile(TmpFilename, filename, size2);
|
object = new ewol::TextureFile(TmpFilename, filename, size);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||||
return false;
|
return false;
|
||||||
|
@ -75,7 +75,7 @@ namespace ewol
|
|||||||
bool Keep(const etk::UString& filename, ewol::Program*& object);
|
bool Keep(const etk::UString& filename, ewol::Program*& object);
|
||||||
bool Keep(const etk::UString& filename, ewol::Shader*& object);
|
bool Keep(const etk::UString& filename, ewol::Shader*& object);
|
||||||
bool Keep(ewol::Texture*& object); // no name needed here ...
|
bool Keep(ewol::Texture*& object); // no name needed here ...
|
||||||
bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size);
|
bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size=ivec2(-1,-1));
|
||||||
bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object);
|
bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object);
|
||||||
bool Keep(const etk::UString& filename, ewol::MeshObj*& object);
|
bool Keep(const etk::UString& filename, ewol::MeshObj*& object);
|
||||||
bool Keep(const etk::UString& meshName, ewol::Mesh*& object);
|
bool Keep(const etk::UString& meshName, ewol::Mesh*& object);
|
||||||
|
@ -25,10 +25,6 @@ ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, i
|
|||||||
Texture(genName)
|
Texture(genName)
|
||||||
{
|
{
|
||||||
etk::UString tmpName = tmpfileName;
|
etk::UString tmpName = tmpfileName;
|
||||||
// get the upper paw2 ot the size requested...
|
|
||||||
if (size.x()>0 && size.y()>0) {
|
|
||||||
SetImageSize(size);
|
|
||||||
}
|
|
||||||
// load data
|
// load data
|
||||||
if (true == tmpName.EndWith(".bmp") ) {
|
if (true == tmpName.EndWith(".bmp") ) {
|
||||||
// generate the texture
|
// generate the texture
|
||||||
@ -40,8 +36,13 @@ ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, i
|
|||||||
if (false == m_element.IsLoadOk()) {
|
if (false == m_element.IsLoadOk()) {
|
||||||
EWOL_ERROR("Error To load SVG file " << tmpName );
|
EWOL_ERROR("Error To load SVG file " << tmpName );
|
||||||
} else {
|
} else {
|
||||||
// generate the texture
|
if (size.x()>0 && size.y()>0) {
|
||||||
m_element.GenerateAnImage(size, m_data);
|
// generate the texture
|
||||||
|
m_element.GenerateAnImage(size, m_data);
|
||||||
|
} else {
|
||||||
|
// generate the texture
|
||||||
|
m_element.GenerateAnImage(m_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (true == tmpName.EndWith(".png") ) {
|
} else if (true == tmpName.EndWith(".png") ) {
|
||||||
// generate the texture
|
// generate the texture
|
||||||
@ -51,6 +52,8 @@ ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, i
|
|||||||
} else {
|
} else {
|
||||||
EWOL_ERROR("Extention not managed " << tmpName << " Sopported extention : .bmp / .svg / .png");
|
EWOL_ERROR("Extention not managed " << tmpName << " Sopported extention : .bmp / .svg / .png");
|
||||||
}
|
}
|
||||||
|
ivec2 tmp = m_data.GetSize();
|
||||||
|
m_realImageSize = vec2(tmp.x(), tmp.y());
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +19,13 @@ namespace ewol
|
|||||||
{
|
{
|
||||||
class TextureFile : public ewol::Texture
|
class TextureFile : public ewol::Texture
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
vec2 m_realImageSize;
|
||||||
public:
|
public:
|
||||||
TextureFile(etk::UString genName, etk::UString fileName, ivec2 size);
|
TextureFile(etk::UString genName, etk::UString fileName, ivec2 size);
|
||||||
~TextureFile(void) { };
|
~TextureFile(void) { };
|
||||||
virtual const char* GetType(void) { return "ewol::TextureFile"; };
|
virtual const char* GetType(void) { return "ewol::TextureFile"; };
|
||||||
|
const vec2& GetRealSize(void) { return m_realImageSize; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
|
||||||
extern const char * const ewolEventImagePressed = "ewol-image-Pressed";
|
extern const char * const ewolEventImagePressed = "ewol-image-Pressed";
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Image"
|
#define __class__ "Image"
|
||||||
|
|
||||||
static ewol::Widget* Create(void)
|
static ewol::Widget* Create(void)
|
||||||
{
|
{
|
||||||
@ -34,9 +34,12 @@ void widget::Image::UnInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::Image::Image(const etk::UString& file, const ewol::Dimension& size, const ewol::Dimension& border)
|
widget::Image::Image(const etk::UString& file, const ewol::Dimension& border) :
|
||||||
|
m_imageSize(vec2(0,0)),
|
||||||
|
m_keepRatio(true)
|
||||||
{
|
{
|
||||||
Set(file, border, size);
|
AddEventId(ewolEventImagePressed);
|
||||||
|
Set(file, border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ void widget::Image::SetFile(const etk::UString& file)
|
|||||||
// Force redraw all :
|
// Force redraw all :
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
ewol::RequestUpdateSize();
|
||||||
m_compositing.SetSource(m_fileName, m_size);
|
m_compositing.SetSource(m_fileName, vec2(64,64));
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::SetBorder(const ewol::Dimension& border)
|
void widget::Image::SetBorder(const ewol::Dimension& border)
|
||||||
@ -56,30 +59,38 @@ void widget::Image::SetBorder(const ewol::Dimension& border)
|
|||||||
m_border = border;
|
m_border = border;
|
||||||
// Force redraw all :
|
// Force redraw all :
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
|
// TODO : Change the size with no size requested ...
|
||||||
ewol::RequestUpdateSize();
|
ewol::RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::SetSize(const ewol::Dimension& size)
|
void widget::Image::SetKeepRatio(bool keep)
|
||||||
{
|
{
|
||||||
// copy data :
|
if (m_keepRatio != keep) {
|
||||||
m_imageSize = size;
|
// copy data :
|
||||||
// Force redraw all :
|
m_keepRatio = keep;
|
||||||
MarkToRedraw();
|
// Force redraw all :
|
||||||
if (m_compositing.HasSources()) {
|
MarkToRedraw();
|
||||||
m_compositing.SetSource(m_fileName, m_size);
|
ewol::RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::Set(const etk::UString& file, const ewol::Dimension& size, const ewol::Dimension& border)
|
void widget::Image::SetImageSize(const ewol::Dimension& size)
|
||||||
|
{
|
||||||
|
m_imageSize = size;
|
||||||
|
MarkToRedraw();
|
||||||
|
ewol::RequestUpdateSize();
|
||||||
|
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
|
||||||
|
}
|
||||||
|
|
||||||
|
void widget::Image::Set(const etk::UString& file, const ewol::Dimension& border)
|
||||||
{
|
{
|
||||||
// copy data :
|
// copy data :
|
||||||
m_border = border;
|
m_border = border;
|
||||||
m_imageSize = size;
|
|
||||||
m_fileName = file;
|
m_fileName = file;
|
||||||
// Force redraw all :
|
// Force redraw all :
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
ewol::RequestUpdateSize();
|
||||||
m_compositing.SetSource(m_fileName, m_size);
|
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,19 +104,51 @@ void widget::Image::OnRegenerateDisplay(void)
|
|||||||
if (true == NeedRedraw()) {
|
if (true == NeedRedraw()) {
|
||||||
// remove data of the previous composition :
|
// remove data of the previous composition :
|
||||||
m_compositing.Clear();
|
m_compositing.Clear();
|
||||||
|
|
||||||
// calculate the new position and size :
|
// calculate the new position and size :
|
||||||
vec2 origin = m_origin + m_border.GetPixel();
|
vec2 imageBoder = m_border.GetPixel();
|
||||||
|
vec2 origin = imageBoder;
|
||||||
|
imageBoder *= 2.0f;
|
||||||
|
vec2 imageRealSize = m_minSize - imageBoder;
|
||||||
|
vec2 imageRealSizeMax = m_size - imageBoder;
|
||||||
|
|
||||||
|
vec2 tmpSize = m_compositing.GetRealSize();
|
||||||
|
if (m_userFill.x()) {
|
||||||
|
imageRealSize.setX(imageRealSizeMax.x());
|
||||||
|
} else {
|
||||||
|
origin.setX(origin.x() + (m_size.x()-m_minSize.x())*0.5f);
|
||||||
|
}
|
||||||
|
if (m_userFill.y()) {
|
||||||
|
imageRealSize.setY(imageRealSizeMax.y());
|
||||||
|
} else {
|
||||||
|
origin.setY(origin.y() + (m_size.y()-m_minSize.y())*0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
// set the somposition properties :
|
// set the somposition properties :
|
||||||
m_compositing.SetPos(vec3(origin.x(), origin.y(), 0) );
|
m_compositing.SetPos(origin);
|
||||||
m_compositing.Print(m_imageSize.GetPixel());
|
m_compositing.Print(imageRealSize);
|
||||||
EWOL_DEBUG("Paint Image at : " << origin << " size=" << m_imageSize.GetPixel() << " border=" << m_border.GetPixel());
|
EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize << " origin=" << origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::CalculateMinMaxSize(void)
|
void widget::Image::CalculateMinMaxSize(void)
|
||||||
{
|
{
|
||||||
m_minSize = m_border.GetPixel()*2+m_imageSize.GetPixel();
|
vec2 imageBoder = m_border.GetPixel()*2.0f;
|
||||||
m_maxSize = m_userMaxSize.GetPixel();
|
vec2 imageSize = m_imageSize.GetPixel();
|
||||||
|
if (imageSize!=vec2(0,0)) {
|
||||||
|
m_minSize = imageBoder+imageSize;
|
||||||
|
m_maxSize = m_minSize;
|
||||||
|
} else {
|
||||||
|
vec2 imageSizeReal = m_compositing.GetRealSize();
|
||||||
|
vec2 min1 = imageBoder+m_userMinSize.GetPixel();
|
||||||
|
m_minSize = imageBoder+imageSizeReal;
|
||||||
|
//EWOL_DEBUG(" set max : " << m_minSize << " " << min1);
|
||||||
|
m_minSize.setMax(min1);
|
||||||
|
//EWOL_DEBUG(" result : " << m_minSize);
|
||||||
|
m_maxSize = imageBoder+m_userMaxSize.GetPixel();
|
||||||
|
m_minSize.setMin(m_maxSize);
|
||||||
|
}
|
||||||
|
//EWOL_DEBUG("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image Size=" << imageSizeReal);
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,9 +172,35 @@ bool widget::Image::LoadXML(TiXmlNode* node)
|
|||||||
}
|
}
|
||||||
ewol::Widget::LoadXML(node);
|
ewol::Widget::LoadXML(node);
|
||||||
// get internal data :
|
// get internal data :
|
||||||
// TODO : Unparse data type XML ...
|
|
||||||
|
const char *tmpAttributeValue = node->ToElement()->Attribute("ratio");
|
||||||
|
if (NULL != tmpAttributeValue) {
|
||||||
|
if (strcmp(tmpAttributeValue,"true")==0) {
|
||||||
|
m_keepRatio = true;
|
||||||
|
} else if (strcmp(tmpAttributeValue,"1")==0) {
|
||||||
|
m_keepRatio = true;
|
||||||
|
} else {
|
||||||
|
m_keepRatio = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tmpAttributeValue = node->ToElement()->Attribute("size");
|
||||||
|
if (NULL != tmpAttributeValue) {
|
||||||
|
//EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue);
|
||||||
|
m_imageSize = tmpAttributeValue;
|
||||||
|
//EWOL_CRITICAL(" ==> " << m_imageSize);
|
||||||
|
}
|
||||||
|
tmpAttributeValue = node->ToElement()->Attribute("border");
|
||||||
|
if (NULL != tmpAttributeValue) {
|
||||||
|
m_border = tmpAttributeValue;
|
||||||
|
}
|
||||||
//EWOL_DEBUG("Load label:" << node->ToElement()->GetText());
|
//EWOL_DEBUG("Load label:" << node->ToElement()->GetText());
|
||||||
//SetLabel(node->ToElement()->GetText());
|
if (node->ToElement()->GetText() != NULL) {
|
||||||
|
SetFile(node->ToElement()->GetText());
|
||||||
|
} else {
|
||||||
|
tmpAttributeValue = node->ToElement()->Attribute("src");
|
||||||
|
if (NULL != tmpAttributeValue) {
|
||||||
|
SetFile(tmpAttributeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,58 +30,76 @@ namespace widget {
|
|||||||
*/
|
*/
|
||||||
static void UnInit(void);
|
static void UnInit(void);
|
||||||
protected:
|
protected:
|
||||||
ewol::Dimension m_border; //!< border to add at the image.
|
|
||||||
etk::UString m_fileName; //!< File name of the image.
|
|
||||||
ewol::Dimension m_imageSize; //!< requested image Size
|
|
||||||
ewol::Image m_compositing; //!< compositing element of the image.
|
ewol::Image m_compositing; //!< compositing element of the image.
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*/
|
*/
|
||||||
Image(const etk::UString& file="",
|
Image(const etk::UString& file="",
|
||||||
const ewol::Dimension& size=ewol::Dimension(vec2(10,10),ewol::Dimension::Centimeter),
|
const ewol::Dimension& border=ewol::Dimension(vec2(0,0),ewol::Dimension::Millimeter));
|
||||||
const ewol::Dimension& border=ewol::Dimension(vec2(2,2),ewol::Dimension::Millimeter));
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*/
|
*/
|
||||||
virtual ~Image(void) { };
|
virtual ~Image(void) { };
|
||||||
/**
|
|
||||||
* @brief Set the new filename
|
|
||||||
* @param[in] file Filaneme of the new image
|
|
||||||
*/
|
|
||||||
void SetFile(const etk::UString& file);
|
|
||||||
/**
|
|
||||||
* @brief Set tge Border size around the image
|
|
||||||
* @param[in] border New border size to set
|
|
||||||
*/
|
|
||||||
void SetBorder(const ewol::Dimension& border);
|
|
||||||
/**
|
|
||||||
* @brief Set the display size of the image (can be greater than the widget size (it will be clipped)
|
|
||||||
* @param[in] size new size of the display
|
|
||||||
*/
|
|
||||||
void SetSize(const ewol::Dimension& size);
|
|
||||||
/**
|
/**
|
||||||
* @brief Set All the configuration of the current image
|
* @brief Set All the configuration of the current image
|
||||||
* @param[in] file Filaneme of the new image
|
* @param[in] file Filaneme of the new image
|
||||||
* @param[in] border New border size to set
|
* @param[in] border New border size to set
|
||||||
* @param[in] size new size of the display
|
* @param[in] size new size of the display
|
||||||
*/
|
*/
|
||||||
void Set(const etk::UString& file, const ewol::Dimension& border, const ewol::Dimension& size);
|
void Set(const etk::UString& file, const ewol::Dimension& border);
|
||||||
|
protected:
|
||||||
|
etk::UString m_fileName; //!< File name of the image.
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set the new filename
|
||||||
|
* @param[in] file Filaneme of the new image
|
||||||
|
*/
|
||||||
|
void SetFile(const etk::UString& file);
|
||||||
/**
|
/**
|
||||||
* @brief Get the file displayed
|
* @brief Get the file displayed
|
||||||
* @return the filename of the image
|
* @return the filename of the image
|
||||||
*/
|
*/
|
||||||
const etk::UString& GetFile() { return m_fileName; };
|
const etk::UString& GetFile() { return m_fileName; };
|
||||||
|
protected:
|
||||||
|
ewol::Dimension m_border; //!< border to add at the image.
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set tge Border size around the image
|
||||||
|
* @param[in] border New border size to set
|
||||||
|
*/
|
||||||
|
void SetBorder(const ewol::Dimension& border);
|
||||||
/**
|
/**
|
||||||
* @brief Get the current border request at the image
|
* @brief Get the current border request at the image
|
||||||
* @return the border size
|
* @return the border size
|
||||||
*/
|
*/
|
||||||
const ewol::Dimension& GetBorder() { return m_border; };
|
const ewol::Dimension& GetBorder() { return m_border; };
|
||||||
|
protected:
|
||||||
|
ewol::Dimension m_imageSize; //!< border to add at the image.
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get the current Image display size
|
* @brief Set tge Border size around the image
|
||||||
* @return the size of the image
|
* @param[in] border New border size to set
|
||||||
|
*/
|
||||||
|
void SetImageSize(const ewol::Dimension& size);
|
||||||
|
/**
|
||||||
|
* @brief Get the current border request at the image
|
||||||
|
* @return the border size
|
||||||
*/
|
*/
|
||||||
const ewol::Dimension& GetImageSize() { return m_imageSize; };
|
const ewol::Dimension& GetImageSize() { return m_imageSize; };
|
||||||
|
protected:
|
||||||
|
bool m_keepRatio; //!< Keep the image ratio between width and hight
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set the current status of keeping ratio.
|
||||||
|
* @param[in] The new status of keeping the ratio of this image.
|
||||||
|
*/
|
||||||
|
void SetKeepRatio(bool keep);
|
||||||
|
/**
|
||||||
|
* @brief Get the current status of keeping ratio.
|
||||||
|
* @return The status of keeping the ratio of this image.
|
||||||
|
*/
|
||||||
|
bool GetKeepRatio(void) { return m_keepRatio; };
|
||||||
public:
|
public:
|
||||||
// Derived function
|
// Derived function
|
||||||
virtual const char * const GetObjectType(void) { return "Ewol::Image"; };
|
virtual const char * const GetObjectType(void) { return "Ewol::Image"; };
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include <ewol/widget/Menu.h>
|
#include <ewol/widget/Menu.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
#include <ewol/widget/ContextMenu.h>
|
#include <ewol/widget/ContextMenu.h>
|
||||||
|
#include <ewol/widget/Composer.h>
|
||||||
|
#include <ewol/widget/Label.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Menu"
|
#define __class__ "Menu"
|
||||||
@ -81,22 +83,30 @@ int32_t widget::Menu::Add(int32_t parent, etk::UString label, etk::UString image
|
|||||||
tmpObject->m_message = message;
|
tmpObject->m_message = message;
|
||||||
m_listElement.PushBack(tmpObject);
|
m_listElement.PushBack(tmpObject);
|
||||||
if (-1 == tmpObject->m_parentId) {
|
if (-1 == tmpObject->m_parentId) {
|
||||||
// TODO : When button are back ...
|
|
||||||
/*
|
|
||||||
widget::Button * myButton = NULL;
|
widget::Button * myButton = NULL;
|
||||||
myButton = new widget::Button(label);
|
myButton = new widget::Button();
|
||||||
if (NULL == myButton) {
|
if (NULL == myButton) {
|
||||||
EWOL_ERROR("Allocation button error");
|
EWOL_ERROR("Allocation button error");
|
||||||
return tmpObject->m_localId;
|
return tmpObject->m_localId;
|
||||||
}
|
}
|
||||||
// set the image if one is present ...
|
if (tmpObject->m_image.Size()!=0) {
|
||||||
myButton->SetImage(tmpObject->m_image);
|
myButton->SetSubWidget(
|
||||||
|
new widget::Composer(widget::Composer::String,
|
||||||
|
etk::UString("<composer>\n") +
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <image src=\"" + tmpObject->m_image + "\" size=\"8,8mm\"/>\n"
|
||||||
|
" <label>" + label + "</label>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
"</composer\n"));
|
||||||
|
} else {
|
||||||
|
myButton->SetSubWidget( new widget::Label(label) );
|
||||||
|
}
|
||||||
|
|
||||||
// add it in the widget list
|
// add it in the widget list
|
||||||
widget::Sizer::SubWidgetAdd(myButton);
|
widget::Sizer::SubWidgetAdd(myButton);
|
||||||
// keep the specific event ...
|
// keep the specific event ...
|
||||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
|
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
|
||||||
tmpObject->m_widgetPointer = myButton;
|
tmpObject->m_widgetPointer = myButton;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
return tmpObject->m_localId;
|
return tmpObject->m_localId;
|
||||||
}
|
}
|
||||||
@ -172,22 +182,30 @@ void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * e
|
|||||||
for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) {
|
for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) {
|
||||||
if (m_listElement[iii]!=NULL) {
|
if (m_listElement[iii]!=NULL) {
|
||||||
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
||||||
// TODO : When button are back ...
|
myButton = new widget::Button();
|
||||||
/*
|
|
||||||
myButton = new widget::Button(m_listElement[jjj]->m_label);
|
|
||||||
if (NULL == myButton) {
|
if (NULL == myButton) {
|
||||||
EWOL_ERROR("Allocation Error");
|
EWOL_ERROR("Allocation Error");
|
||||||
} else {
|
} else {
|
||||||
|
/*if (m_listElement[jjj]->m_image.Size()!=0) {
|
||||||
|
myButton->SetSubWidget(
|
||||||
|
new widget::Composer(widget::Composer::String,
|
||||||
|
etk::UString("<composer>\n") +
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <image src=\"" + m_listElement[jjj]->m_image + "\" size=\"8,8mm\"/>\n"
|
||||||
|
" <label exand=\"true,false\">" + m_listElement[jjj]->m_label + "</label>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
"</composer\n"));
|
||||||
|
} else */ {
|
||||||
|
myButton->SetSubWidget( new widget::Label(etk::UString("<left>") + m_listElement[jjj]->m_label + "</left>") );
|
||||||
|
}
|
||||||
// set the image if one is present ...
|
// set the image if one is present ...
|
||||||
myButton->SetImage(m_listElement[jjj]->m_image);
|
|
||||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
|
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
|
||||||
myButton->SetExpandX(true);
|
myButton->SetExpand(bvec2(true,false));
|
||||||
myButton->SetFillX(true);
|
myButton->SetFill(bvec2(true,false));
|
||||||
// add it in the widget list
|
// add it in the widget list
|
||||||
mySizer->SubWidgetAdd(myButton);
|
mySizer->SubWidgetAdd(myButton);
|
||||||
m_listElement[jjj]->m_widgetPointer = myButton;
|
m_listElement[jjj]->m_widgetPointer = myButton;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/widget/Image.h>
|
#include <ewol/widget/Image.h>
|
||||||
|
#include <ewol/widget/Composer.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
//#include <etk/Vector.h>
|
//#include <etk/Vector.h>
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
@ -77,6 +78,42 @@ widget::FileChooser::FileChooser(void)
|
|||||||
#endif
|
#endif
|
||||||
m_file = "";
|
m_file = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
SubWidgetSet(new widget::Composer(widget::Composer::String,
|
||||||
|
"<composer>\n"
|
||||||
|
" <sizer mode=\"vert\" lock=\"true\">\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <checkbox name=\"EWOL:file-shooser:show-hiden-file\"/>\n"
|
||||||
|
" <label>Show hiden files</label>\n"
|
||||||
|
" <spacer expand=\"true,false\"/>\n"
|
||||||
|
" <button name=\"EWOL:file-shooser:button-validate\">\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <image src=\"THEME:GUI:Load.svg\" fill=\"true\" size=\"70,70mm\"/>\n"
|
||||||
|
" <label>Validate</label>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
" </button>\n"
|
||||||
|
" <button name=\"EWOL:file-shooser:button-cancel\">\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <image src=\"THEME:GUI:Remove.svg\" fill=\"true\" size=\"70,70mm\"/>\n"
|
||||||
|
" <label>Cancel</label>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
" </button>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <spacer min-size=\"2,2mm\"/>\n"
|
||||||
|
" <ListFileSystem name=\"EWOL:file-shooser:list-folder\" min-size=\"20,0%\" expand=\"false,true\"/>\n"
|
||||||
|
" <spacer min-size=\"2,2mm\"/>\n"
|
||||||
|
" <ListFileSystem name=\"EWOL:file-shooser:list-files\" expand=\"true,true\"/>\n"
|
||||||
|
" <spacer min-size=\"2,2mm\"/>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" \n"
|
||||||
|
" </sizer>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
"</composer\n"));
|
||||||
|
*/
|
||||||
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
|
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
|
||||||
if (NULL == mySizerVert) {
|
if (NULL == mySizerVert) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
@ -105,25 +142,36 @@ widget::FileChooser::FileChooser(void)
|
|||||||
mySpacer->SetExpand(bvec2(true,false));
|
mySpacer->SetExpand(bvec2(true,false));
|
||||||
mySizerHori->SubWidgetAdd(mySpacer);
|
mySizerHori->SubWidgetAdd(mySpacer);
|
||||||
}
|
}
|
||||||
// TODO : set if back :
|
m_widgetValidate = new widget::Button();
|
||||||
/*
|
|
||||||
m_widgetValidate = new widget::Button("Validate");
|
|
||||||
if (NULL == m_widgetValidate) {
|
if (NULL == m_widgetValidate) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
m_widgetValidate->SetImage("THEME:GUI:Load.svg");
|
m_widgetValidate->SetSubWidget(
|
||||||
|
new widget::Composer(widget::Composer::String,
|
||||||
|
"<composer>\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <image src=\"THEME:GUI:Load.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
|
||||||
|
" <label>Validate</label>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
"</composer\n"));
|
||||||
m_widgetValidate->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserValidate);
|
m_widgetValidate->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserValidate);
|
||||||
mySizerHori->SubWidgetAdd(m_widgetValidate);
|
mySizerHori->SubWidgetAdd(m_widgetValidate);
|
||||||
}
|
}
|
||||||
m_widgetCancel = new widget::Button("Cancel");
|
m_widgetCancel = new widget::Button();
|
||||||
if (NULL == m_widgetCancel) {
|
if (NULL == m_widgetCancel) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
m_widgetCancel->SetImage("THEME:GUI:Remove.svg");
|
m_widgetCancel->SetSubWidget(
|
||||||
|
new widget::Composer(widget::Composer::String,
|
||||||
|
"<composer>\n"
|
||||||
|
" <sizer mode=\"hori\">\n"
|
||||||
|
" <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
|
||||||
|
" <label>Cancel</label>\n"
|
||||||
|
" </sizer>\n"
|
||||||
|
"</composer\n"));
|
||||||
m_widgetCancel->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserCancel);
|
m_widgetCancel->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserCancel);
|
||||||
mySizerHori->SubWidgetAdd(m_widgetCancel);
|
mySizerHori->SubWidgetAdd(m_widgetCancel);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
@ -186,7 +234,8 @@ widget::FileChooser::FileChooser(void)
|
|||||||
if (NULL == myImage) {
|
if (NULL == myImage) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myImage->SetFill(bvec2(false,true));
|
myImage->SetImageSize(ewol::Dimension(vec2(8,8),ewol::Dimension::Millimeter));
|
||||||
|
//myImage->SetExpand(bvec2(false,true));
|
||||||
mySizerHori->SubWidgetAdd(myImage);
|
mySizerHori->SubWidgetAdd(myImage);
|
||||||
}
|
}
|
||||||
m_widgetCurrentFileName = new widget::Entry(m_file);
|
m_widgetCurrentFileName = new widget::Entry(m_file);
|
||||||
@ -210,7 +259,8 @@ widget::FileChooser::FileChooser(void)
|
|||||||
if (NULL == myImage) {
|
if (NULL == myImage) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myImage->SetFill(bvec2(false,true));
|
myImage->SetImageSize(ewol::Dimension(vec2(8,8),ewol::Dimension::Millimeter));
|
||||||
|
//myImage->SetExpand(bvec2(false,true));
|
||||||
mySizerHori->SubWidgetAdd(myImage);
|
mySizerHori->SubWidgetAdd(myImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +279,9 @@ widget::FileChooser::FileChooser(void)
|
|||||||
if (NULL == myImage) {
|
if (NULL == myImage) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
|
myImage->SetImageSize(ewol::Dimension(vec2(8,8),ewol::Dimension::Millimeter));
|
||||||
myImage->RegisterOnEvent(this, ewolEventImagePressed, ewolEventFileChooserHome);
|
myImage->RegisterOnEvent(this, ewolEventImagePressed, ewolEventFileChooserHome);
|
||||||
myImage->SetFill(bvec2(false,true));
|
//myImage->SetExpand(bvec2(false,true));
|
||||||
mySizerHori->SubWidgetAdd(myImage);
|
mySizerHori->SubWidgetAdd(myImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@ ewol::Widget [OK]
|
|||||||
|== widget::Container [OK]
|
|== widget::Container [OK]
|
||||||
| .
|
| .
|
||||||
| /|\
|
| /|\
|
||||||
| |== widget::Button [OK]
|
|
||||||
| |
|
|
||||||
| \== widget::Composer [OK]
|
| \== widget::Composer [OK]
|
||||||
|
|
|
|
||||||
|== widget::ContainerN [OK]
|
|== widget::ContainerN [OK]
|
||||||
@ -24,11 +22,19 @@ ewol::Widget [OK]
|
|||||||
| |== widget::Layer [OK]
|
| |== widget::Layer [OK]
|
||||||
| |
|
| |
|
||||||
| \== widget::Sizer [OK]
|
| \== widget::Sizer [OK]
|
||||||
|
|
|
||||||
|
|== widget::Button [OK]
|
||||||
|
|
|
||||||
|
|== widget::Entry [TOEND]
|
||||||
|
|
|
||||||
|
|== widget::Label [OK]
|
||||||
|
|
|
||||||
|
|== widget::Image [TOEND]
|
||||||
|
|
|
||||||
|
|
||||||
ewol::EObject
|
ewol::EObject
|
||||||
ewol::Widget
|
ewol::Widget
|
||||||
## Windows :
|
## Windows :
|
||||||
widget::Windows main application windows
|
|
||||||
widget::PopUp Widget to display basic pop-up
|
widget::PopUp Widget to display basic pop-up
|
||||||
## Meta-widget :
|
## Meta-widget :
|
||||||
// (multiple and complex widget commonly used)
|
// (multiple and complex widget commonly used)
|
||||||
@ -37,9 +43,6 @@ ewol::EObject
|
|||||||
widget::ColorChooser Select a specific color
|
widget::ColorChooser Select a specific color
|
||||||
widget::Calendar [*TODO*] display the current calendar
|
widget::Calendar [*TODO*] display the current calendar
|
||||||
## Basics :
|
## Basics :
|
||||||
widget::Image
|
|
||||||
widget::Label
|
|
||||||
widget::Entry
|
|
||||||
widget::EntryNumericSpin [*TODO*]
|
widget::EntryNumericSpin [*TODO*]
|
||||||
widget::Checkbox
|
widget::Checkbox
|
||||||
widget::Joystick
|
widget::Joystick
|
||||||
@ -55,12 +58,9 @@ ewol::EObject
|
|||||||
widget::ButtonImage
|
widget::ButtonImage
|
||||||
widget::ButtonImageText
|
widget::ButtonImageText
|
||||||
## contener :
|
## contener :
|
||||||
widget::Sizer
|
|
||||||
widget::Gird
|
widget::Gird
|
||||||
widget::Layer
|
|
||||||
widget::WSlider
|
widget::WSlider
|
||||||
widget::FreePosition [*TODO*] set the widget at the desird position
|
widget::FreePosition [*TODO*] set the widget at the desird position
|
||||||
widget::WSlider
|
|
||||||
|
|
||||||
|
|
||||||
widget::ColorBar.cpp
|
widget::ColorBar.cpp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user