[DEV] change namespacing to clarify the API ==> (not work)
This commit is contained in:
parent
5c295fcca9
commit
dad1b90812
2
build
2
build
@ -1 +1 @@
|
|||||||
Subproject commit b02c8b5221d94dd8446319ea224ff25f801a2924
|
Subproject commit 5ea83bfddea9a0c93f65170b73d3be07f8a100e0
|
@ -10,9 +10,9 @@
|
|||||||
#include <ewol/compositing/Area.h>
|
#include <ewol/compositing/Area.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Area"
|
#define __class__ "ewol::compositing::Area"
|
||||||
|
|
||||||
ewol::Area::Area(const ivec2& _size) :
|
ewol::compositing::Area::Area(const ivec2& _size) :
|
||||||
m_position(0.0, 0.0, 0.0),
|
m_position(0.0, 0.0, 0.0),
|
||||||
m_color(etk::color::white),
|
m_color(etk::color::white),
|
||||||
m_GLprogram(NULL),
|
m_GLprogram(NULL),
|
||||||
@ -28,12 +28,12 @@ ewol::Area::Area(const ivec2& _size) :
|
|||||||
loadProgram();
|
loadProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Area::~Area(void) {
|
ewol::compositing::Area::~Area(void) {
|
||||||
ewol::Texture::release(m_resource);
|
ewol::Texture::release(m_resource);
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::Program::release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Area::loadProgram(void) {
|
void ewol::compositing::Area::loadProgram(void) {
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
|
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
|
||||||
@ -46,7 +46,7 @@ void ewol::Area::loadProgram(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Area::draw(bool _disableDepthTest) {
|
void ewol::compositing::Area::draw(bool _disableDepthTest) {
|
||||||
if (m_coord.size() <= 0) {
|
if (m_coord.size() <= 0) {
|
||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
return;
|
return;
|
||||||
@ -76,7 +76,7 @@ void ewol::Area::draw(bool _disableDepthTest) {
|
|||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Area::clear(void) {
|
void ewol::compositing::Area::clear(void) {
|
||||||
// call upper class
|
// call upper class
|
||||||
ewol::Compositing::clear();
|
ewol::Compositing::clear();
|
||||||
// reset Buffer :
|
// reset Buffer :
|
||||||
@ -87,7 +87,7 @@ void ewol::Area::clear(void) {
|
|||||||
m_position = vec3(0.0, 0.0, 0.0);
|
m_position = vec3(0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Area::print(const ivec2& _size) {
|
void ewol::compositing::Area::print(const ivec2& _size) {
|
||||||
vec3 point(0,0,0);
|
vec3 point(0,0,0);
|
||||||
vec2 tex(0,1);
|
vec2 tex(0,1);
|
||||||
point.setX(m_position.x());
|
point.setX(m_position.x());
|
||||||
|
@ -10,13 +10,12 @@
|
|||||||
#define __EWOL_COMPOSITING_AREA_H__
|
#define __EWOL_COMPOSITING_AREA_H__
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compose.h>
|
||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
namespace ewol
|
namespace ewol {
|
||||||
{
|
namespace compositing {
|
||||||
class Area : public ewol::Compositing
|
class Area : public ewol::compositing::Compose {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
vec3 m_position; //!< The current position to draw
|
vec3 m_position; //!< The current position to draw
|
||||||
etk::Color<> m_color; //!< The text foreground color
|
etk::Color<> m_color; //!< The text foreground color
|
||||||
@ -60,28 +59,42 @@ namespace ewol
|
|||||||
* @brief get the current display position (sometime needed in the gui control)
|
* @brief get the current display position (sometime needed in the gui control)
|
||||||
* @return the current position.
|
* @return the current position.
|
||||||
*/
|
*/
|
||||||
const vec3& getPos(void) { return m_position; };
|
const vec3& getPos(void) {
|
||||||
|
return m_position;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief set position for the next text writen
|
* @brief set position for the next text writen
|
||||||
* @param[in] _pos Position of the text (in 3D)
|
* @param[in] _pos Position of the text (in 3D)
|
||||||
*/
|
*/
|
||||||
void setPos(const vec3& _pos) { m_position = _pos; };
|
void setPos(const vec3& _pos) {
|
||||||
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
|
m_position = _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) { m_position += _pos; };
|
void setRelPos(const vec3& _pos) {
|
||||||
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
|
m_position += _pos;
|
||||||
|
};
|
||||||
|
inline void setRelPos(const vec2& _pos) {
|
||||||
|
setRelPos(vec3(_pos.x(),_pos.y(),0));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief add a compleate of the image to display with the requested size
|
* @brief add a compleate of the image to display with the requested size
|
||||||
* @param[in] _size size of the output image
|
* @param[in] _size size of the output image
|
||||||
*/
|
*/
|
||||||
void print(const ivec2& _size);
|
void print(const ivec2& _size);
|
||||||
|
|
||||||
egami::Image& get(void) { return m_resource->get(); };
|
egami::Image& get(void) {
|
||||||
void flush(void) { m_resource->flush(); };
|
return m_resource->get();
|
||||||
|
};
|
||||||
|
void flush(void) {
|
||||||
|
m_resource->flush();
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,41 +13,41 @@
|
|||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compositing.h>
|
||||||
|
|
||||||
|
|
||||||
ewol::Compositing::Compositing(void) {
|
ewol::compositing::Compose::Compose(void) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Compositing::~Compositing(void) {
|
ewol::compositing::Compose::~Compose(void) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Compositing::resetMatrix(void) {
|
void ewol::compositing::Compose::resetMatrix(void) {
|
||||||
m_matrixApply.identity();
|
m_matrixApply.identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Compositing::translate(const vec3& _vect) {
|
void ewol::compositing::Compose::translate(const vec3& _vect) {
|
||||||
m_matrixApply *= etk::matTranslate(_vect);
|
m_matrixApply *= etk::matTranslate(_vect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Compositing::rotate(const vec3& _vect, float _angle) {
|
void ewol::compositing::Compose::rotate(const vec3& _vect, float _angle) {
|
||||||
m_matrixApply *= etk::matRotate(_vect, _angle);
|
m_matrixApply *= etk::matRotate(_vect, _angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Compositing::scale(const vec3& _vect) {
|
void ewol::compositing::Compose::scale(const vec3& _vect) {
|
||||||
m_matrixApply *= etk::matScale(_vect);
|
m_matrixApply *= etk::matScale(_vect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Compositing::clear(void) {
|
void ewol::compositing::Compose::clear(void) {
|
||||||
m_matrixApply.identity();
|
m_matrixApply.identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Compositing::setMatrix(const mat4& _mat) {
|
void ewol::compositing::Compose::setMatrix(const mat4& _mat) {
|
||||||
m_matrixApply = _mat;
|
m_matrixApply = _mat;
|
||||||
}
|
}
|
66
sources/ewol/compositing/Compose.h
Normal file
66
sources/ewol/compositing/Compose.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_COMPOSITING_COMPOSE_H__
|
||||||
|
#define __EWOL_COMPOSITING_COMPOSE_H__
|
||||||
|
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <etk/UString.h>
|
||||||
|
#include <etk/math/Matrix4.h>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace compositing {
|
||||||
|
class Compose {
|
||||||
|
protected:
|
||||||
|
mat4 m_matrixApply;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief generic constructor
|
||||||
|
*/
|
||||||
|
Compose(void);
|
||||||
|
/**
|
||||||
|
* @brief Generic destructor
|
||||||
|
*/
|
||||||
|
virtual ~Compose(void);
|
||||||
|
/**
|
||||||
|
* @brief Virtal pure function that request the draw of all openGl elements
|
||||||
|
*/
|
||||||
|
virtual void draw(bool _disableDepthTest=true)=0;
|
||||||
|
/**
|
||||||
|
* @brief clear alll tre registered element in the current element
|
||||||
|
*/
|
||||||
|
virtual void clear(void);
|
||||||
|
/**
|
||||||
|
* @brief reset to the eye matrix the openGL mouving system
|
||||||
|
*/
|
||||||
|
virtual void resetMatrix(void);
|
||||||
|
/**
|
||||||
|
* @brief translate the current display of this element
|
||||||
|
* @param[in] _vect The translation vector to apply at the transformation matrix
|
||||||
|
*/
|
||||||
|
virtual void translate(const vec3& _vect);
|
||||||
|
/**
|
||||||
|
* @brief rotate the curent display of this element
|
||||||
|
* @param[in] _vect The rotation vector to apply at the transformation matrix
|
||||||
|
*/
|
||||||
|
virtual void rotate(const vec3& _vect, float _angle);
|
||||||
|
/**
|
||||||
|
* @brief scale the current diaplsy of this element
|
||||||
|
* @param[in] _vect The scaling vector to apply at the transformation matrix
|
||||||
|
*/
|
||||||
|
virtual void scale(const vec3& _vect);
|
||||||
|
/**
|
||||||
|
* @brief set the transformation matrix
|
||||||
|
* @param[in] _mat The new matrix.
|
||||||
|
*/
|
||||||
|
virtual void setMatrix(const mat4& _mat);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,66 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __EWOL_COMPOSITING_H__
|
|
||||||
#define __EWOL_COMPOSITING_H__
|
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <etk/math/Matrix4.h>
|
|
||||||
|
|
||||||
namespace ewol
|
|
||||||
{
|
|
||||||
class Compositing
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
mat4 m_matrixApply;
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief generic constructor
|
|
||||||
*/
|
|
||||||
Compositing(void);
|
|
||||||
/**
|
|
||||||
* @brief Generic destructor
|
|
||||||
*/
|
|
||||||
virtual ~Compositing(void);
|
|
||||||
/**
|
|
||||||
* @brief Virtal pure function that request the draw of all openGl elements
|
|
||||||
*/
|
|
||||||
virtual void draw(bool _disableDepthTest=true)=0;
|
|
||||||
/**
|
|
||||||
* @brief clear alll tre registered element in the current element
|
|
||||||
*/
|
|
||||||
virtual void clear(void);
|
|
||||||
/**
|
|
||||||
* @brief reset to the eye matrix the openGL mouving system
|
|
||||||
*/
|
|
||||||
virtual void resetMatrix(void);
|
|
||||||
/**
|
|
||||||
* @brief translate the current display of this element
|
|
||||||
* @param[in] _vect The translation vector to apply at the transformation matrix
|
|
||||||
*/
|
|
||||||
virtual void translate(const vec3& _vect);
|
|
||||||
/**
|
|
||||||
* @brief rotate the curent display of this element
|
|
||||||
* @param[in] _vect The rotation vector to apply at the transformation matrix
|
|
||||||
*/
|
|
||||||
virtual void rotate(const vec3& _vect, float _angle);
|
|
||||||
/**
|
|
||||||
* @brief scale the current diaplsy of this element
|
|
||||||
* @param[in] _vect The scaling vector to apply at the transformation matrix
|
|
||||||
*/
|
|
||||||
virtual void scale(const vec3& _vect);
|
|
||||||
/**
|
|
||||||
* @brief set the transformation matrix
|
|
||||||
* @param[in] _mat The new matrix.
|
|
||||||
*/
|
|
||||||
virtual void setMatrix(const mat4& _mat);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -217,7 +217,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ewol::Drawing::Drawing(void) :
|
ewol::compositing::Drawing::Drawing(void) :
|
||||||
m_position(0.0, 0.0, 0.0),
|
m_position(0.0, 0.0, 0.0),
|
||||||
m_clippingPosStart(0.0, 0.0, 0.0),
|
m_clippingPosStart(0.0, 0.0, 0.0),
|
||||||
m_clippingPosStop(0.0, 0.0, 0.0),
|
m_clippingPosStop(0.0, 0.0, 0.0),
|
||||||
@ -237,11 +237,11 @@ ewol::Drawing::Drawing(void) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Drawing::~Drawing(void) {
|
ewol::compositing::Drawing::~Drawing(void) {
|
||||||
unLoadProgram();
|
unLoadProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::generateTriangle(void) {
|
void ewol::compositing::Drawing::generateTriangle(void) {
|
||||||
m_triElement = 0;
|
m_triElement = 0;
|
||||||
|
|
||||||
m_coord.push_back(m_triangle[0]);
|
m_coord.push_back(m_triangle[0]);
|
||||||
@ -252,7 +252,7 @@ void ewol::Drawing::generateTriangle(void) {
|
|||||||
m_coordColor.push_back(m_tricolor[2]);
|
m_coordColor.push_back(m_tricolor[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::internalSetColor(const etk::Color<>& _color) {
|
void ewol::compositing::Drawing::internalSetColor(const etk::Color<>& _color) {
|
||||||
if (m_triElement < 1) {
|
if (m_triElement < 1) {
|
||||||
m_tricolor[0] = _color;
|
m_tricolor[0] = _color;
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ void ewol::Drawing::internalSetColor(const etk::Color<>& _color) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::setPoint(const vec3& _point) {
|
void ewol::compositing::Drawing::setPoint(const vec3& _point) {
|
||||||
m_triangle[m_triElement] = _point;
|
m_triangle[m_triElement] = _point;
|
||||||
m_triElement++;
|
m_triElement++;
|
||||||
if (m_triElement >= 3) {
|
if (m_triElement >= 3) {
|
||||||
@ -272,15 +272,15 @@ void ewol::Drawing::setPoint(const vec3& _point) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::resetCount(void) {
|
void ewol::compositing::Drawing::resetCount(void) {
|
||||||
m_triElement = 0;
|
m_triElement = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::unLoadProgram(void) {
|
void ewol::compositing::Drawing::unLoadProgram(void) {
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::Program::release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::loadProgram(void) {
|
void ewol::compositing::Drawing::loadProgram(void) {
|
||||||
// remove previous loading ... in case
|
// remove previous loading ... in case
|
||||||
unLoadProgram();
|
unLoadProgram();
|
||||||
// oad the new ...
|
// oad the new ...
|
||||||
@ -293,7 +293,7 @@ void ewol::Drawing::loadProgram(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::draw(bool _disableDepthTest) {
|
void ewol::compositing::Drawing::draw(bool _disableDepthTest) {
|
||||||
if (m_coord.size() <= 0) {
|
if (m_coord.size() <= 0) {
|
||||||
// TODO : a remÚtre ...
|
// TODO : a remÚtre ...
|
||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
@ -316,7 +316,7 @@ void ewol::Drawing::draw(bool _disableDepthTest) {
|
|||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::clear(void) {
|
void ewol::compositing::Drawing::clear(void) {
|
||||||
// call upper class
|
// call upper class
|
||||||
ewol::Compositing::clear();
|
ewol::Compositing::clear();
|
||||||
// reset Buffer :
|
// reset Buffer :
|
||||||
@ -338,7 +338,7 @@ void ewol::Drawing::clear(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::setClipping(const vec3& _pos, const vec3& _posEnd) {
|
void ewol::compositing::Drawing::setClipping(const vec3& _pos, const vec3& _posEnd) {
|
||||||
// note the internal system all time request to have a bounding all time in the same order
|
// note the internal system all time request to have a bounding all time in the same order
|
||||||
if (_pos.x() <= _posEnd.x()) {
|
if (_pos.x() <= _posEnd.x()) {
|
||||||
m_clippingPosStart.setX(_pos.x());
|
m_clippingPosStart.setX(_pos.x());
|
||||||
@ -364,7 +364,7 @@ void ewol::Drawing::setClipping(const vec3& _pos, const vec3& _posEnd) {
|
|||||||
m_clippingEnable = true;
|
m_clippingEnable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::setThickness(float _thickness) {
|
void ewol::compositing::Drawing::setThickness(float _thickness) {
|
||||||
m_thickness = _thickness;
|
m_thickness = _thickness;
|
||||||
// thickness must be positive
|
// thickness must be positive
|
||||||
if (m_thickness < 0) {
|
if (m_thickness < 0) {
|
||||||
@ -372,12 +372,12 @@ void ewol::Drawing::setThickness(float _thickness) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::addVertex(void) {
|
void ewol::compositing::Drawing::addVertex(void) {
|
||||||
internalSetColor(m_color);
|
internalSetColor(m_color);
|
||||||
setPoint(m_position);
|
setPoint(m_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::lineTo(const vec3& _dest) {
|
void ewol::compositing::Drawing::lineTo(const vec3& _dest) {
|
||||||
resetCount();
|
resetCount();
|
||||||
internalSetColor(m_color);
|
internalSetColor(m_color);
|
||||||
EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest);
|
EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest);
|
||||||
@ -411,7 +411,7 @@ void ewol::Drawing::lineTo(const vec3& _dest) {
|
|||||||
m_position = _dest;
|
m_position = _dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::rectangle(const vec3& _dest) {
|
void ewol::compositing::Drawing::rectangle(const vec3& _dest) {
|
||||||
resetCount();
|
resetCount();
|
||||||
internalSetColor(m_color);
|
internalSetColor(m_color);
|
||||||
/* Bitmap position
|
/* Bitmap position
|
||||||
@ -464,11 +464,11 @@ void ewol::Drawing::rectangle(const vec3& _dest) {
|
|||||||
setPoint(vec3(dxA, dyD, 0) );
|
setPoint(vec3(dxA, dyD, 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::cube(const vec3& _dest) {
|
void ewol::compositing::Drawing::cube(const vec3& _dest) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawing::circle(float _radius, float _angleStart, float _angleStop) {
|
void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float _angleStop) {
|
||||||
resetCount();
|
resetCount();
|
||||||
|
|
||||||
if (_radius<0) {
|
if (_radius<0) {
|
||||||
|
@ -12,12 +12,13 @@
|
|||||||
#include <etk/Color.h>
|
#include <etk/Color.h>
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compose.h>
|
||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Drawing : public ewol::Compositing {
|
namespace compositing {
|
||||||
|
class Drawing : public ewol::compositing::Compose {
|
||||||
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
|
||||||
@ -89,48 +90,70 @@ namespace ewol {
|
|||||||
* @brief get the current display position (sometime needed in the gui control)
|
* @brief get the current display position (sometime needed in the gui control)
|
||||||
* @return the current position.
|
* @return the current position.
|
||||||
*/
|
*/
|
||||||
const vec3& getPos(void) { return m_position; };
|
const vec3& getPos(void) {
|
||||||
|
return m_position;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief set position for the next text writen
|
* @brief set position for the next text writen
|
||||||
* @param[in] _pos Position of the text (in 3D)
|
* @param[in] _pos Position of the text (in 3D)
|
||||||
*/
|
*/
|
||||||
void setPos(const vec3& _pos) { m_position = _pos; };
|
void setPos(const vec3& _pos) {
|
||||||
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(), _pos.y(), 0)); };
|
m_position = _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) { m_position += _pos; };
|
void setRelPos(const vec3& _pos) {
|
||||||
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(), _pos.y(), 0)); };
|
m_position += _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)
|
||||||
*/
|
*/
|
||||||
void setColor(const etk::Color<>& _color) { m_color = _color; };
|
void setColor(const etk::Color<>& _color) {
|
||||||
|
m_color = _color;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief set the background color of the font (for selected Text (not the global BG))
|
* @brief set the background color of the font (for selected Text (not the global BG))
|
||||||
* @param[in] _color Color to set on background (for next print)
|
* @param[in] _color Color to set on background (for next print)
|
||||||
*/
|
*/
|
||||||
void setColorBg(const etk::Color<>& _color) { m_colorBg = _color; };
|
void setColorBg(const etk::Color<>& _color) {
|
||||||
|
m_colorBg = _color;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @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] _width Width size of the clipping
|
* @param[in] _width Width size of the clipping
|
||||||
*/
|
*/
|
||||||
void setClippingWidth(const vec3& _pos, const vec3& _width) { setClipping(_pos, _pos+_width); };
|
void setClippingWidth(const vec3& _pos, const vec3& _width) {
|
||||||
inline void setClippingWidth(const vec2& _pos, const vec2& _width) { setClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2)); };
|
setClipping(_pos, _pos+_width);
|
||||||
|
};
|
||||||
|
inline void setClippingWidth(const vec2& _pos, const vec2& _width) {
|
||||||
|
setClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @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, const vec3& _posEnd);
|
void setClipping(const vec3& _pos, const vec3& _posEnd);
|
||||||
inline void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1)); };
|
inline void setClipping(const vec2& _pos, const vec2& _posEnd) {
|
||||||
|
setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
void setClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
|
void setClippingMode(bool _newMode) {
|
||||||
|
m_clippingEnable = _newMode;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Specify the line thickness for the next elements
|
* @brief Specify the line thickness for the next elements
|
||||||
* @param[in] _thickness The thickness disired for the next print
|
* @param[in] _thickness The thickness disired for the next print
|
||||||
@ -145,25 +168,37 @@ namespace ewol {
|
|||||||
* @param[in] _dest Position of the end of the line.
|
* @param[in] _dest Position of the end of the line.
|
||||||
*/
|
*/
|
||||||
void lineTo(const vec3& _dest);
|
void lineTo(const vec3& _dest);
|
||||||
inline void lineTo(const vec2& _dest) { lineTo(vec3(_dest.x(), _dest.y(), 0)); };
|
inline void lineTo(const vec2& _dest) {
|
||||||
|
lineTo(vec3(_dest.x(), _dest.y(), 0));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Relative drawing a line (spacial vector)
|
* @brief Relative drawing a line (spacial vector)
|
||||||
* @param[in] _vect Vector of the curent line.
|
* @param[in] _vect Vector of the curent line.
|
||||||
*/
|
*/
|
||||||
void lineRel(const vec3& _vect) { lineTo(m_position+_vect); };
|
void lineRel(const vec3& _vect) {
|
||||||
inline void lineRel(const vec2& _vect) { lineRel(vec3(_vect.x(), _vect.y(), 0)); };
|
lineTo(m_position+_vect);
|
||||||
|
};
|
||||||
|
inline void lineRel(const vec2& _vect) {
|
||||||
|
lineRel(vec3(_vect.x(), _vect.y(), 0));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief draw a 2D rectangle to the position requested.
|
* @brief draw a 2D rectangle to the position requested.
|
||||||
* @param[in] _dest Position the the end of the rectangle
|
* @param[in] _dest Position the the end of the rectangle
|
||||||
*/
|
*/
|
||||||
void rectangle(const vec3& _dest);
|
void rectangle(const vec3& _dest);
|
||||||
inline void rectangle(const vec2& _dest) { rectangle(vec3(_dest.x(), _dest.y(), 0)); };
|
inline void rectangle(const vec2& _dest) {
|
||||||
|
rectangle(vec3(_dest.x(), _dest.y(), 0));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief draw a 2D rectangle to the requested size.
|
* @brief draw a 2D rectangle to the requested size.
|
||||||
* @param[in] _size size of the rectangle
|
* @param[in] _size size of the rectangle
|
||||||
*/
|
*/
|
||||||
void rectangleWidth(const vec3& _size) { rectangle(m_position+_size); };
|
void rectangleWidth(const vec3& _size) {
|
||||||
inline void rectangleWidth(const vec2& _size) { rectangleWidth(vec3(_size.x(), _size.y(), 0)); };
|
rectangle(m_position+_size);
|
||||||
|
};
|
||||||
|
inline void rectangleWidth(const vec2& _size) {
|
||||||
|
rectangleWidth(vec3(_size.x(), _size.y(), 0));
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief draw a 3D rectangle to the position requested.
|
* @brief draw a 3D rectangle to the position requested.
|
||||||
* @param[in] _dest Position the the end of the rectangle
|
* @param[in] _dest Position the the end of the rectangle
|
||||||
@ -177,6 +212,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
void circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
|
void circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
#include <ewol/compositing/Image.h>
|
#include <ewol/compositing/Image.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Image"
|
#define __class__ "ewol::compositing::Image"
|
||||||
|
|
||||||
ewol::Image::Image(const std::string& _imageName) :
|
ewol::compositing::Image::Image(const std::string& _imageName) :
|
||||||
m_position(0.0, 0.0, 0.0),
|
m_position(0.0, 0.0, 0.0),
|
||||||
m_clippingPosStart(0.0, 0.0, 0.0),
|
m_clippingPosStart(0.0, 0.0, 0.0),
|
||||||
m_clippingPosStop(0.0, 0.0, 0.0),
|
m_clippingPosStop(0.0, 0.0, 0.0),
|
||||||
@ -30,12 +30,12 @@ ewol::Image::Image(const std::string& _imageName) :
|
|||||||
loadProgram();
|
loadProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Image::~Image(void) {
|
ewol::compositing::Image::~Image(void) {
|
||||||
ewol::TextureFile::release(m_resource);
|
ewol::TextureFile::release(m_resource);
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::Program::release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::loadProgram(void) {
|
void ewol::compositing::Image::loadProgram(void) {
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
|
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
|
||||||
@ -48,7 +48,7 @@ void ewol::Image::loadProgram(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::draw(bool _disableDepthTest) {
|
void ewol::compositing::Image::draw(bool _disableDepthTest) {
|
||||||
if (m_coord.size() <= 0) {
|
if (m_coord.size() <= 0) {
|
||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
return;
|
return;
|
||||||
@ -83,9 +83,9 @@ void ewol::Image::draw(bool _disableDepthTest) {
|
|||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::clear(void) {
|
void ewol::compositing::Image::clear(void) {
|
||||||
// call upper class
|
// call upper class
|
||||||
ewol::Compositing::clear();
|
ewol::compositing::Compose::clear();
|
||||||
// reset Buffer :
|
// reset Buffer :
|
||||||
m_coord.clear();
|
m_coord.clear();
|
||||||
m_coordTex.clear();
|
m_coordTex.clear();
|
||||||
@ -99,7 +99,7 @@ void ewol::Image::clear(void) {
|
|||||||
m_angle = 0.0;
|
m_angle = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::setClipping(const vec3& _pos, vec3 _posEnd) {
|
void ewol::compositing::Image::setClipping(const vec3& _pos, vec3 _posEnd) {
|
||||||
// note the internal system all time request to have a bounding all time in the same order
|
// note the internal system all time request to have a bounding all time in the same order
|
||||||
if (_pos.x() <= _posEnd.x()) {
|
if (_pos.x() <= _posEnd.x()) {
|
||||||
m_clippingPosStart.setX(_pos.x());
|
m_clippingPosStart.setX(_pos.x());
|
||||||
@ -125,15 +125,15 @@ void ewol::Image::setClipping(const vec3& _pos, vec3 _posEnd) {
|
|||||||
m_clippingEnable = true;
|
m_clippingEnable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::setAngle(float _angle) {
|
void ewol::compositing::Image::setAngle(float _angle) {
|
||||||
m_angle = _angle;
|
m_angle = _angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::print(const vec2& _size) {
|
void ewol::compositing::Image::print(const vec2& _size) {
|
||||||
printPart(_size, vec2(0,0), vec2(1,1));
|
printPart(_size, vec2(0,0), vec2(1,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::printPart(const vec2& _size,
|
void ewol::compositing::Image::printPart(const vec2& _size,
|
||||||
const vec2& _sourcePosStart,
|
const vec2& _sourcePosStart,
|
||||||
const vec2& _sourcePosStop) {
|
const vec2& _sourcePosStop) {
|
||||||
if (m_angle == 0.0f) {
|
if (m_angle == 0.0f) {
|
||||||
@ -226,7 +226,7 @@ void ewol::Image::printPart(const vec2& _size,
|
|||||||
m_coordColor.push_back(m_color);
|
m_coordColor.push_back(m_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::setSource(const std::string& _newFile, const vec2& _size) {
|
void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2& _size) {
|
||||||
clear();
|
clear();
|
||||||
// remove old one
|
// remove old one
|
||||||
ewol::TextureFile::release(m_resource);
|
ewol::TextureFile::release(m_resource);
|
||||||
@ -241,12 +241,12 @@ void ewol::Image::setSource(const std::string& _newFile, const vec2& _size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Image::hasSources(void) {
|
bool ewol::compositing::Image::hasSources(void) {
|
||||||
return m_resource!=NULL;
|
return m_resource!=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vec2 ewol::Image::getRealSize(void) {
|
vec2 ewol::compositing::Image::getRealSize(void) {
|
||||||
if (NULL == m_resource) {
|
if (NULL == m_resource) {
|
||||||
return vec2(0,0);
|
return vec2(0,0);
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
#define __EWOL_COMPOSITING_IMAGE_H__
|
#define __EWOL_COMPOSITING_IMAGE_H__
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compose.h>
|
||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Image : public ewol::Compositing {
|
namespace compositing {
|
||||||
|
class Image : public ewol::compositing::Compose {
|
||||||
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
|
||||||
@ -64,43 +65,63 @@ namespace ewol {
|
|||||||
* @brief get the current display position (sometime needed in the gui control)
|
* @brief get the current display position (sometime needed in the gui control)
|
||||||
* @return the current position.
|
* @return the current position.
|
||||||
*/
|
*/
|
||||||
const vec3& getPos(void) { return m_position; };
|
const vec3& getPos(void) {
|
||||||
|
return m_position;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief set position for the next text writen
|
* @brief set position for the next text writen
|
||||||
* @param[in] _pos Position of the text (in 3D)
|
* @param[in] _pos Position of the text (in 3D)
|
||||||
*/
|
*/
|
||||||
void setPos(const vec3& _pos) { m_position = _pos; };
|
void setPos(const vec3& _pos) {
|
||||||
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
|
m_position = _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) { m_position += _pos; };
|
void setRelPos(const vec3& _pos) {
|
||||||
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
|
m_position += _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)
|
||||||
*/
|
*/
|
||||||
void setColor(const etk::Color<>& _color) { m_color = _color; };
|
void setColor(const etk::Color<>& _color) {
|
||||||
|
m_color = _color;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @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] _width Width size of the clipping
|
* @param[in] _width Width size of the clipping
|
||||||
*/
|
*/
|
||||||
void setClippingWidth(const vec3& _pos, vec3 _width) { setClipping(_pos, _pos+_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)); };
|
setClipping(_pos, _pos+_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)); };
|
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
|
||||||
*/
|
*/
|
||||||
void setClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
|
void setClippingMode(bool _newMode) {
|
||||||
|
m_clippingEnable = _newMode;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief set a unique rotation of this element (not set in the rotate Generic system)
|
* @brief set a unique rotation of this element (not set in the rotate Generic system)
|
||||||
* @param[in] _angle Angle to set in radiant.
|
* @param[in] _angle Angle to set in radiant.
|
||||||
@ -110,7 +131,9 @@ namespace ewol {
|
|||||||
* @brief add a compleate of the image to display with the requested size
|
* @brief add a compleate of the image to display with the requested size
|
||||||
* @param[in] _size size of the output image
|
* @param[in] _size size of the output image
|
||||||
*/
|
*/
|
||||||
void print(const ivec2& _size) { print(vec2(_size.x(),_size.y())); };
|
void print(const ivec2& _size) {
|
||||||
|
print(vec2(_size.x(),_size.y()));
|
||||||
|
};
|
||||||
void print(const vec2& _size);
|
void print(const vec2& _size);
|
||||||
/**
|
/**
|
||||||
* @brief add a part of the image to display with the requested size
|
* @brief add a part of the image to display with the requested size
|
||||||
@ -126,7 +149,9 @@ namespace ewol {
|
|||||||
* @param[in] _newFile New file of the Image
|
* @param[in] _newFile New file of the Image
|
||||||
* @param[in] _size for the image when Verctorial image loading is requested
|
* @param[in] _size for the image when Verctorial image loading is requested
|
||||||
*/
|
*/
|
||||||
void setSource(const std::string& _newFile, int32_t _size=32) { setSource(_newFile, vec2(_size,_size)); };
|
void setSource(const std::string& _newFile, int32_t _size=32) {
|
||||||
|
setSource(_newFile, vec2(_size,_size));
|
||||||
|
};
|
||||||
void setSource(const std::string& _newFile, const vec2& _size);
|
void setSource(const std::string& _newFile, const vec2& _size);
|
||||||
/**
|
/**
|
||||||
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
||||||
@ -139,6 +164,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
vec2 getRealSize(void);
|
vec2 getRealSize(void);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Shaper"
|
#define __class__ "ewol::compositing::Shaper"
|
||||||
|
|
||||||
ewol::Shaper::Shaper(const std::string& _shaperName) :
|
ewol::compositing::Shaper::Shaper(const std::string& _shaperName) :
|
||||||
m_name(_shaperName),
|
m_name(_shaperName),
|
||||||
m_config(NULL),
|
m_config(NULL),
|
||||||
m_confIdPaddingX(-1),
|
m_confIdPaddingX(-1),
|
||||||
@ -42,17 +42,17 @@ ewol::Shaper::Shaper(const std::string& _shaperName) :
|
|||||||
updateVertex();
|
updateVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Shaper::~Shaper(void) {
|
ewol::compositing::Shaper::~Shaper(void) {
|
||||||
unLoadProgram();
|
unLoadProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::unLoadProgram(void) {
|
void ewol::compositing::Shaper::unLoadProgram(void) {
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::Program::release(m_GLprogram);
|
||||||
ewol::TextureFile::release(m_resourceTexture);
|
ewol::TextureFile::release(m_resourceTexture);
|
||||||
ewol::ConfigFile::release(m_config);
|
ewol::ConfigFile::release(m_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::loadProgram(void) {
|
void ewol::compositing::Shaper::loadProgram(void) {
|
||||||
if (m_name == "") {
|
if (m_name == "") {
|
||||||
EWOL_DEBUG("no Shaper set for loading resources ...");
|
EWOL_DEBUG("no Shaper set for loading resources ...");
|
||||||
return;
|
return;
|
||||||
@ -98,7 +98,7 @@ void ewol::Shaper::loadProgram(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::draw(bool _disableDepthTest) {
|
void ewol::compositing::Shaper::draw(bool _disableDepthTest) {
|
||||||
if (m_config == NULL) {
|
if (m_config == NULL) {
|
||||||
// this is a normale case ... the user can choice to have no config basic file ...
|
// this is a normale case ... the user can choice to have no config basic file ...
|
||||||
return;
|
return;
|
||||||
@ -132,11 +132,11 @@ void ewol::Shaper::draw(bool _disableDepthTest) {
|
|||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::clear(void) {
|
void ewol::compositing::Shaper::clear(void) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Shaper::changeStatusIn(int32_t _newStatusId) {
|
bool ewol::compositing::Shaper::changeStatusIn(int32_t _newStatusId) {
|
||||||
if (_newStatusId != m_stateNew) {
|
if (_newStatusId != m_stateNew) {
|
||||||
m_nextStatusRequested = _newStatusId;
|
m_nextStatusRequested = _newStatusId;
|
||||||
return true;
|
return true;
|
||||||
@ -148,7 +148,7 @@ bool ewol::Shaper::changeStatusIn(int32_t _newStatusId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Shaper::periodicCall(const ewol::EventTime& _event) {
|
bool ewol::compositing::Shaper::periodicCall(const ewol::EventTime& _event) {
|
||||||
//EWOL_DEBUG("call=" << _event);
|
//EWOL_DEBUG("call=" << _event);
|
||||||
// start :
|
// start :
|
||||||
if (m_stateTransition >= 1.0) {
|
if (m_stateTransition >= 1.0) {
|
||||||
@ -186,7 +186,7 @@ bool ewol::Shaper::periodicCall(const ewol::EventTime& _event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::updateVertex(void) {
|
void ewol::compositing::Shaper::updateVertex(void) {
|
||||||
// set coord == > must be a static VBO ...
|
// set coord == > must be a static VBO ...
|
||||||
m_coord[0].setValue( m_propertyOrigin.x(),
|
m_coord[0].setValue( m_propertyOrigin.x(),
|
||||||
m_propertyOrigin.y()+m_propertySize.y());
|
m_propertyOrigin.y()+m_propertySize.y());
|
||||||
@ -203,29 +203,29 @@ void ewol::Shaper::updateVertex(void) {
|
|||||||
m_propertyOrigin.y()+m_propertySize.y());
|
m_propertyOrigin.y()+m_propertySize.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::setOrigin(const vec2& _newOri) {
|
void ewol::compositing::Shaper::setOrigin(const vec2& _newOri) {
|
||||||
if (m_propertyOrigin != _newOri) {
|
if (m_propertyOrigin != _newOri) {
|
||||||
m_propertyOrigin = _newOri;
|
m_propertyOrigin = _newOri;
|
||||||
updateVertex();
|
updateVertex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::setSize(const vec2& _newSize) {
|
void ewol::compositing::Shaper::setSize(const vec2& _newSize) {
|
||||||
if (m_propertySize != _newSize) {
|
if (m_propertySize != _newSize) {
|
||||||
m_propertySize = _newSize;
|
m_propertySize = _newSize;
|
||||||
updateVertex();
|
updateVertex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::setInsideSize(const vec2& _newInsideSize) {
|
void ewol::compositing::Shaper::setInsideSize(const vec2& _newInsideSize) {
|
||||||
m_propertyInsideSize = _newInsideSize;
|
m_propertyInsideSize = _newInsideSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::setInsidePos(const vec2& _newInsidePos) {
|
void ewol::compositing::Shaper::setInsidePos(const vec2& _newInsidePos) {
|
||||||
m_propertyInsidePosition = _newInsidePos;
|
m_propertyInsidePosition = _newInsidePos;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 ewol::Shaper::getPadding(void) {
|
vec2 ewol::compositing::Shaper::getPadding(void) {
|
||||||
vec2 padding(0,0);
|
vec2 padding(0,0);
|
||||||
if (m_config!=NULL) {
|
if (m_config!=NULL) {
|
||||||
padding.setValue(m_config->getFloat(m_confIdPaddingX),
|
padding.setValue(m_config->getFloat(m_confIdPaddingX),
|
||||||
@ -234,14 +234,14 @@ vec2 ewol::Shaper::getPadding(void) {
|
|||||||
return padding;
|
return padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shaper::setSource(const std::string& _newFile) {
|
void ewol::compositing::Shaper::setSource(const std::string& _newFile) {
|
||||||
clear();
|
clear();
|
||||||
unLoadProgram();
|
unLoadProgram();
|
||||||
m_name = _newFile;
|
m_name = _newFile;
|
||||||
loadProgram();
|
loadProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Shaper::hasSources(void) {
|
bool ewol::compositing::Shaper::hasSources(void) {
|
||||||
return m_GLprogram!=NULL;
|
return m_GLprogram!=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,17 +10,18 @@
|
|||||||
#define __EWOL_COMPOSITING_SHAPER_H__
|
#define __EWOL_COMPOSITING_SHAPER_H__
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compose.h>
|
||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
#include <ewol/renderer/EventTime.h>
|
#include <ewol/renderer/EventTime.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace compositing {
|
||||||
/**
|
/**
|
||||||
* @brief the Shaper system is a basic theme configuration for every widget, it corespond at a background display described by a pool of files
|
* @brief the Shaper system is a basic theme configuration for every widget, it corespond at a background display described by a pool of files
|
||||||
*/
|
*/
|
||||||
// TODO : load image
|
// TODO : load image
|
||||||
// TODO : Abstaraction between states (call by name and the system greate IDs
|
// TODO : Abstaraction between states (call by name and the system greate IDs
|
||||||
class Shaper : public ewol::Compositing {
|
class Shaper : public ewol::compositing::Compose {
|
||||||
private:
|
private:
|
||||||
std::string m_name; //!< Name of the configuration of the shaper.
|
std::string m_name; //!< Name of the configuration of the shaper.
|
||||||
// External theme config:
|
// External theme config:
|
||||||
@ -93,17 +94,23 @@ namespace ewol {
|
|||||||
* @brief get the current displayed status of the shaper
|
* @brief get the current displayed status of the shaper
|
||||||
* @return The Status Id
|
* @return The Status Id
|
||||||
*/
|
*/
|
||||||
int32_t getCurrentDisplayedStatus(void) { return m_stateNew; };
|
int32_t getCurrentDisplayedStatus(void) {
|
||||||
|
return m_stateNew;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief get the next displayed status of the shaper
|
* @brief get the next displayed status of the shaper
|
||||||
* @return The next status Id (-1 if no status in next)
|
* @return The next status Id (-1 if no status in next)
|
||||||
*/
|
*/
|
||||||
int32_t getNextDisplayedStatus(void) { return m_nextStatusRequested; };
|
int32_t getNextDisplayedStatus(void) {
|
||||||
|
return m_nextStatusRequested;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief get the current trasion status
|
* @brief get the current trasion status
|
||||||
* @return value of the transition status (0.0f when no activity)
|
* @return value of the transition status (0.0f when no activity)
|
||||||
*/
|
*/
|
||||||
float getTransitionStatus(void) { return m_stateTransition; };
|
float getTransitionStatus(void) {
|
||||||
|
return m_stateTransition;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Same as the widfget periodic call (this is for change display)
|
* @brief Same as the widfget periodic call (this is for change display)
|
||||||
* @param[in] _event The current time of the call.
|
* @param[in] _event The current time of the call.
|
||||||
@ -145,7 +152,9 @@ namespace ewol {
|
|||||||
* @brief get the shaper file Source
|
* @brief get the shaper file Source
|
||||||
* @return the shapper file name
|
* @return the shapper file name
|
||||||
*/
|
*/
|
||||||
const std::string& getSource(void) const { return m_name; };
|
const std::string& getSource(void) const {
|
||||||
|
return m_name;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
||||||
* @return the validity od the resources.
|
* @return the validity od the resources.
|
||||||
@ -157,6 +166,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
void updateVertex(void);
|
void updateVertex(void);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
#include <ewol/compositing/Sprite.h>
|
#include <ewol/compositing/Sprite.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Sprite"
|
#define __class__ "ewol::compositing::Sprite"
|
||||||
|
|
||||||
ewol::Sprite::Sprite(const std::string& _imageName, const ivec2& _nbSprite) :
|
ewol::compositing::Sprite::Sprite(const std::string& _imageName, const ivec2& _nbSprite) :
|
||||||
ewol::Image(_imageName),
|
ewol::Image(_imageName),
|
||||||
m_nbSprite(_nbSprite),
|
m_nbSprite(_nbSprite),
|
||||||
m_unitarySpriteSize(0,0) {
|
m_unitarySpriteSize(0,0) {
|
||||||
@ -26,7 +26,7 @@ ewol::Sprite::Sprite(const std::string& _imageName, const ivec2& _nbSprite) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Sprite::printSprite(const ivec2& _spriteID, const vec3& _size) {
|
void ewol::compositing::Sprite::printSprite(const ivec2& _spriteID, const vec3& _size) {
|
||||||
if( _spriteID.x()<0
|
if( _spriteID.x()<0
|
||||||
|| _spriteID.y()<0
|
|| _spriteID.y()<0
|
||||||
|| _spriteID.x() >= m_nbSprite.x()
|
|| _spriteID.x() >= m_nbSprite.x()
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Sprite : public ewol::Image {
|
namespace compositing {
|
||||||
|
class Sprite : public ewol::compositing::Compose {
|
||||||
protected:
|
protected:
|
||||||
ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal
|
ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal
|
||||||
vec2 m_unitarySpriteSize; //!< size of a unique sprite
|
vec2 m_unitarySpriteSize; //!< size of a unique sprite
|
||||||
@ -24,6 +25,7 @@ namespace ewol {
|
|||||||
void printSprite(const ivec2& _spriteID, const vec2& _size) { printSprite(_spriteID, vec3(_size.x(), _size.y(),0)); };
|
void printSprite(const ivec2& _spriteID, const vec2& _size) { printSprite(_spriteID, vec3(_size.x(), _size.y(),0)); };
|
||||||
void printSprite(const ivec2& _spriteID, const vec3& _size);
|
void printSprite(const ivec2& _spriteID, const vec3& _size);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Text"
|
#define __class__ "ewol::compositing::Text"
|
||||||
|
|
||||||
|
|
||||||
ewol::Text::Text(const std::string& _fontName, int32_t _fontSize) :
|
ewol::compositing::Text::Text(const std::string& _fontName, int32_t _fontSize) :
|
||||||
m_position(0.0, 0.0, 0.0),
|
m_position(0.0, 0.0, 0.0),
|
||||||
m_clippingPosStart(0.0, 0.0, 0.0),
|
m_clippingPosStart(0.0, 0.0, 0.0),
|
||||||
m_clippingPosStop(0.0, 0.0, 0.0),
|
m_clippingPosStop(0.0, 0.0, 0.0),
|
||||||
@ -45,12 +45,12 @@ ewol::Text::Text(const std::string& _fontName, int32_t _fontSize) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Text::~Text(void) {
|
ewol::compositing::Text::~Text(void) {
|
||||||
ewol::TexturedFont::release(m_font);
|
ewol::TexturedFont::release(m_font);
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::Program::release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::loadProgram(void) {
|
void ewol::compositing::Text::loadProgram(void) {
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
m_GLprogram = ewol::Program::keep("DATA:text.prog");
|
m_GLprogram = ewol::Program::keep("DATA:text.prog");
|
||||||
@ -63,7 +63,7 @@ void ewol::Text::loadProgram(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::draw(const mat4& _transformationMatrix, bool _enableDepthTest) {
|
void ewol::compositing::Text::draw(const mat4& _transformationMatrix, bool _enableDepthTest) {
|
||||||
|
|
||||||
// draw BG in any case:
|
// draw BG in any case:
|
||||||
m_vectorialDraw.draw();
|
m_vectorialDraw.draw();
|
||||||
@ -107,7 +107,7 @@ void ewol::Text::draw(const mat4& _transformationMatrix, bool _enableDepthTest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Text::draw(bool _disableDepthTest) {
|
void ewol::compositing::Text::draw(bool _disableDepthTest) {
|
||||||
// draw BG in any case:
|
// draw BG in any case:
|
||||||
m_vectorialDraw.draw();
|
m_vectorialDraw.draw();
|
||||||
|
|
||||||
@ -141,22 +141,22 @@ void ewol::Text::draw(bool _disableDepthTest) {
|
|||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::translate(const vec3& _vect) {
|
void ewol::compositing::Text::translate(const vec3& _vect) {
|
||||||
ewol::Compositing::translate(_vect);
|
ewol::Compositing::translate(_vect);
|
||||||
m_vectorialDraw.translate(_vect);
|
m_vectorialDraw.translate(_vect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::rotate(const vec3& _vect, float _angle) {
|
void ewol::compositing::Text::rotate(const vec3& _vect, float _angle) {
|
||||||
ewol::Compositing::rotate(_vect, _angle);
|
ewol::Compositing::rotate(_vect, _angle);
|
||||||
m_vectorialDraw.rotate(_vect, _angle);
|
m_vectorialDraw.rotate(_vect, _angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::scale(const vec3& _vect) {
|
void ewol::compositing::Text::scale(const vec3& _vect) {
|
||||||
ewol::Compositing::scale(_vect);
|
ewol::Compositing::scale(_vect);
|
||||||
m_vectorialDraw.scale(_vect);
|
m_vectorialDraw.scale(_vect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::clear(void) {
|
void ewol::compositing::Text::clear(void) {
|
||||||
// call upper class
|
// call upper class
|
||||||
ewol::Compositing::clear();
|
ewol::Compositing::clear();
|
||||||
// remove sub draw system
|
// remove sub draw system
|
||||||
@ -169,7 +169,7 @@ void ewol::Text::clear(void) {
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::reset(void) {
|
void ewol::compositing::Text::reset(void) {
|
||||||
m_position = vec3(0,0,0);
|
m_position = vec3(0,0,0);
|
||||||
m_clippingPosStart = vec3(0,0,0);
|
m_clippingPosStart = vec3(0,0,0);
|
||||||
m_clippingPosStop = vec3(0,0,0);
|
m_clippingPosStop = vec3(0,0,0);
|
||||||
@ -192,7 +192,7 @@ void ewol::Text::reset(void) {
|
|||||||
m_nbCharDisplayed = 0;
|
m_nbCharDisplayed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setPos(const vec3& _pos) {
|
void ewol::compositing::Text::setPos(const vec3& _pos) {
|
||||||
// check min max for display area
|
// check min max for display area
|
||||||
if (m_nbCharDisplayed != 0) {
|
if (m_nbCharDisplayed != 0) {
|
||||||
EWOL_VERBOSE("update size 1 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
EWOL_VERBOSE("update size 1 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||||
@ -222,18 +222,18 @@ void ewol::Text::setPos(const vec3& _pos) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setRelPos(const vec3& _pos) {
|
void ewol::compositing::Text::setRelPos(const vec3& _pos) {
|
||||||
m_position += _pos;
|
m_position += _pos;
|
||||||
m_previousCharcode = 0;
|
m_previousCharcode = 0;
|
||||||
m_vectorialDraw.setPos(m_position);
|
m_vectorialDraw.setPos(m_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setColorBg(const etk::Color<>& _color) {
|
void ewol::compositing::Text::setColorBg(const etk::Color<>& _color) {
|
||||||
m_colorBg = _color;
|
m_colorBg = _color;
|
||||||
m_vectorialDraw.setColor(_color);
|
m_vectorialDraw.setColor(_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setClipping(const vec3& _pos, const vec3& _posEnd) {
|
void ewol::compositing::Text::setClipping(const vec3& _pos, const vec3& _posEnd) {
|
||||||
// note the internal system all time request to have a bounding all time in the same order
|
// note the internal system all time request to have a bounding all time in the same order
|
||||||
if (_pos.x() <= _posEnd.x()) {
|
if (_pos.x() <= _posEnd.x()) {
|
||||||
m_clippingPosStart.setX(_pos.x());
|
m_clippingPosStart.setX(_pos.x());
|
||||||
@ -260,12 +260,12 @@ void ewol::Text::setClipping(const vec3& _pos, const vec3& _posEnd) {
|
|||||||
//m_vectorialDraw.setClipping(m_clippingPosStart, m_clippingPosStop);
|
//m_vectorialDraw.setClipping(m_clippingPosStart, m_clippingPosStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setClippingMode(bool _newMode) {
|
void ewol::compositing::Text::setClippingMode(bool _newMode) {
|
||||||
m_clippingEnable = _newMode;
|
m_clippingEnable = _newMode;
|
||||||
//m_vectorialDraw.setClippingMode(m_clippingEnable);
|
//m_vectorialDraw.setClippingMode(m_clippingEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setFontSize(int32_t _fontSize) {
|
void ewol::compositing::Text::setFontSize(int32_t _fontSize) {
|
||||||
// get old size
|
// get old size
|
||||||
std::string fontName = "";
|
std::string fontName = "";
|
||||||
if (m_font != NULL) {
|
if (m_font != NULL) {
|
||||||
@ -277,7 +277,7 @@ void ewol::Text::setFontSize(int32_t _fontSize) {
|
|||||||
setFont(fontName, _fontSize);
|
setFont(fontName, _fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setFontName(const std::string& _fontName) {
|
void ewol::compositing::Text::setFontName(const std::string& _fontName) {
|
||||||
// get old size
|
// get old size
|
||||||
int32_t fontSize = -1;
|
int32_t fontSize = -1;
|
||||||
if (m_font != NULL) {
|
if (m_font != NULL) {
|
||||||
@ -286,7 +286,7 @@ void ewol::Text::setFontName(const std::string& _fontName) {
|
|||||||
setFont(_fontName, fontSize);
|
setFont(_fontName, fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setFont(std::string _fontName, int32_t _fontSize) {
|
void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize) {
|
||||||
clear();
|
clear();
|
||||||
// remove old one
|
// remove old one
|
||||||
ewol::TexturedFont * previousFont = m_font;
|
ewol::TexturedFont * previousFont = m_font;
|
||||||
@ -309,7 +309,7 @@ void ewol::Text::setFont(std::string _fontName, int32_t _fontSize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setFontMode(enum ewol::font::mode _mode) {
|
void ewol::compositing::Text::setFontMode(enum ewol::font::mode _mode) {
|
||||||
if (m_font != NULL) {
|
if (m_font != NULL) {
|
||||||
m_mode = m_font->getWrappingMode(_mode);
|
m_mode = m_font->getWrappingMode(_mode);
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ enum ewol::font::mode ewol::Text::getFontMode(void) {
|
|||||||
return m_mode;
|
return m_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setFontBold(bool _status) {
|
void ewol::compositing::Text::setFontBold(bool _status) {
|
||||||
if (_status == true) {
|
if (_status == true) {
|
||||||
// enable
|
// enable
|
||||||
if (m_mode == ewol::font::Regular) {
|
if (m_mode == ewol::font::Regular) {
|
||||||
@ -337,7 +337,7 @@ void ewol::Text::setFontBold(bool _status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setFontItalic(bool _status) {
|
void ewol::compositing::Text::setFontItalic(bool _status) {
|
||||||
if (_status == true) {
|
if (_status == true) {
|
||||||
// enable
|
// enable
|
||||||
if (m_mode == ewol::font::Regular) {
|
if (m_mode == ewol::font::Regular) {
|
||||||
@ -355,27 +355,27 @@ void ewol::Text::setFontItalic(bool _status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setKerningMode(bool _newMode) {
|
void ewol::compositing::Text::setKerningMode(bool _newMode) {
|
||||||
m_kerning = _newMode;
|
m_kerning = _newMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setDistanceFieldMode(bool _newMode) {
|
void ewol::compositing::Text::setDistanceFieldMode(bool _newMode) {
|
||||||
m_distanceField = _newMode;
|
m_distanceField = _newMode;
|
||||||
EWOL_TODO("The Distance field mode is not availlable for now ...");
|
EWOL_TODO("The Distance field mode is not availlable for now ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::print(const std::u32string& _text) {
|
void ewol::compositing::Text::print(const std::u32string& _text) {
|
||||||
std::vector<TextDecoration> decorationEmpty;
|
std::vector<TextDecoration> decorationEmpty;
|
||||||
print(_text, decorationEmpty);
|
print(_text, decorationEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::print(const std::string& _text) {
|
void ewol::compositing::Text::print(const std::string& _text) {
|
||||||
std::vector<TextDecoration> decorationEmpty;
|
std::vector<TextDecoration> decorationEmpty;
|
||||||
print(_text, decorationEmpty);
|
print(_text, decorationEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Text::parseHtmlNode(exml::Element* _element) {
|
void ewol::compositing::Text::parseHtmlNode(exml::Element* _element) {
|
||||||
// get the static real pointer
|
// get the static real pointer
|
||||||
if (_element == NULL) {
|
if (_element == NULL) {
|
||||||
EWOL_ERROR( "Error Input node does not existed ...");
|
EWOL_ERROR( "Error Input node does not existed ...");
|
||||||
@ -470,7 +470,7 @@ void ewol::Text::parseHtmlNode(exml::Element* _element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::printDecorated(const std::string& _text) {
|
void ewol::compositing::Text::printDecorated(const std::string& _text) {
|
||||||
std::string tmpData("<html>\n<body>\n");
|
std::string tmpData("<html>\n<body>\n");
|
||||||
tmpData+=_text;
|
tmpData+=_text;
|
||||||
tmpData+="\n</body>\n</html>\n";
|
tmpData+="\n</body>\n</html>\n";
|
||||||
@ -478,7 +478,7 @@ void ewol::Text::printDecorated(const std::string& _text) {
|
|||||||
printHTML(tmpData);
|
printHTML(tmpData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::printHTML(const std::string& _text) {
|
void ewol::compositing::Text::printHTML(const std::string& _text) {
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
|
|
||||||
// reset parameter :
|
// reset parameter :
|
||||||
@ -506,7 +506,7 @@ void ewol::Text::printHTML(const std::string& _text) {
|
|||||||
htmlFlush();
|
htmlFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::print(const std::string& _text, const std::vector<TextDecoration>& _decoration) {
|
void ewol::compositing::Text::print(const std::string& _text, const std::vector<TextDecoration>& _decoration) {
|
||||||
if (m_font == NULL) {
|
if (m_font == NULL) {
|
||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return;
|
return;
|
||||||
@ -695,7 +695,7 @@ void ewol::Text::print(const std::string& _text, const std::vector<TextDecoratio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::print(const std::u32string& _text, const std::vector<TextDecoration>& _decoration) {
|
void ewol::compositing::Text::print(const std::u32string& _text, const std::vector<TextDecoration>& _decoration) {
|
||||||
if (m_font == NULL) {
|
if (m_font == NULL) {
|
||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return;
|
return;
|
||||||
@ -885,7 +885,7 @@ void ewol::Text::print(const std::u32string& _text, const std::vector<TextDecora
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Text::print(const char32_t& _charcode) {
|
void ewol::compositing::Text::print(const char32_t& _charcode) {
|
||||||
if (NULL == m_font) {
|
if (NULL == m_font) {
|
||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return;
|
return;
|
||||||
@ -1056,12 +1056,12 @@ void ewol::Text::print(const char32_t& _charcode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::forceLineReturn(void) {
|
void ewol::compositing::Text::forceLineReturn(void) {
|
||||||
// reset position :
|
// reset position :
|
||||||
setPos(vec3(m_startTextpos, m_position.y() - m_font->getHeight(m_mode), 0) );
|
setPos(vec3(m_startTextpos, m_position.y() - m_font->getHeight(m_mode), 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::Text::aligneMode _alignement) {
|
void ewol::compositing::Text::setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::Text::aligneMode _alignement) {
|
||||||
m_startTextpos = _startTextpos;
|
m_startTextpos = _startTextpos;
|
||||||
m_stopTextPos = _stopTextPos+1;
|
m_stopTextPos = _stopTextPos+1;
|
||||||
m_alignement = _alignement;
|
m_alignement = _alignement;
|
||||||
@ -1070,15 +1070,15 @@ void ewol::Text::setTextAlignement(float _startTextpos, float _stopTextPos, enum
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ewol::Text::aligneMode ewol::Text::getAlignement(void) {
|
enum ewol::compositing::Text::aligneMode ewol::compositing::Text::getAlignement(void) {
|
||||||
return m_alignement;
|
return m_alignement;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::disableAlignement(void) {
|
void ewol::compositing::Text::disableAlignement(void) {
|
||||||
m_alignement = ewol::Text::alignDisable;
|
m_alignement = ewol::Text::alignDisable;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 ewol::Text::calculateSizeHTML(const std::string& _text) {
|
vec3 ewol::compositing::Text::calculateSizeHTML(const std::string& _text) {
|
||||||
// remove intermediate result
|
// remove intermediate result
|
||||||
reset();
|
reset();
|
||||||
//EWOL_DEBUG(" 0 size for=\n" << text);
|
//EWOL_DEBUG(" 0 size for=\n" << text);
|
||||||
@ -1109,7 +1109,7 @@ vec3 ewol::Text::calculateSizeHTML(const std::string& _text) {
|
|||||||
m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
|
m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 ewol::Text::calculateSizeDecorated(const std::string& _text) {
|
vec3 ewol::compositing::Text::calculateSizeDecorated(const std::string& _text) {
|
||||||
if (_text.size() == 0) {
|
if (_text.size() == 0) {
|
||||||
return vec3(0,0,0);
|
return vec3(0,0,0);
|
||||||
}
|
}
|
||||||
@ -1120,7 +1120,7 @@ vec3 ewol::Text::calculateSizeDecorated(const std::string& _text) {
|
|||||||
return tmpVal;
|
return tmpVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 ewol::Text::calculateSize(const std::string& _text) {
|
vec3 ewol::compositing::Text::calculateSize(const std::string& _text) {
|
||||||
if (m_font == NULL) {
|
if (m_font == NULL) {
|
||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return vec3(0,0,0);
|
return vec3(0,0,0);
|
||||||
@ -1136,7 +1136,7 @@ vec3 ewol::Text::calculateSize(const std::string& _text) {
|
|||||||
return outputSize;
|
return outputSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 ewol::Text::calculateSize(const char32_t& _charcode) {
|
vec3 ewol::compositing::Text::calculateSize(const char32_t& _charcode) {
|
||||||
if (m_font == NULL) {
|
if (m_font == NULL) {
|
||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return vec3(0,0,0);
|
return vec3(0,0,0);
|
||||||
@ -1159,8 +1159,7 @@ vec3 ewol::Text::calculateSize(const char32_t& _charcode) {
|
|||||||
return outputSize;
|
return outputSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::compositing::Text::printCursor(bool _isInsertMode, float _cursorSize) {
|
||||||
void ewol::Text::printCursor(bool _isInsertMode, float _cursorSize) {
|
|
||||||
int32_t fontHeigh = m_font->getHeight(m_mode);
|
int32_t fontHeigh = m_font->getHeight(m_mode);
|
||||||
if (true == _isInsertMode) {
|
if (true == _isInsertMode) {
|
||||||
m_vectorialDraw.rectangleWidth(vec3(_cursorSize, fontHeigh, 0) );
|
m_vectorialDraw.rectangleWidth(vec3(_cursorSize, fontHeigh, 0) );
|
||||||
@ -1171,8 +1170,7 @@ void ewol::Text::printCursor(bool _isInsertMode, float _cursorSize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ewol::compositing::Text::extrapolateLastId(const std::string& _text,
|
||||||
bool ewol::Text::extrapolateLastId(const std::string& _text,
|
|
||||||
const int32_t _start,
|
const int32_t _start,
|
||||||
int32_t& _stop,
|
int32_t& _stop,
|
||||||
int32_t& _space,
|
int32_t& _space,
|
||||||
@ -1235,7 +1233,7 @@ bool ewol::Text::extrapolateLastId(const std::string& _text,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Text::extrapolateLastId(const std::u32string& _text,
|
bool ewol::compositing::Text::extrapolateLastId(const std::u32string& _text,
|
||||||
const int32_t _start,
|
const int32_t _start,
|
||||||
int32_t& _stop,
|
int32_t& _stop,
|
||||||
int32_t& _space,
|
int32_t& _space,
|
||||||
@ -1298,7 +1296,7 @@ bool ewol::Text::extrapolateLastId(const std::u32string& _text,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::htmlAddData(const std::string& _data) {
|
void ewol::compositing::Text::htmlAddData(const std::string& _data) {
|
||||||
if( m_htmlCurrrentLine.size()>0
|
if( m_htmlCurrrentLine.size()>0
|
||||||
&& m_htmlCurrrentLine[m_htmlCurrrentLine.size()-1] != ' ') {
|
&& m_htmlCurrrentLine[m_htmlCurrrentLine.size()-1] != ' ') {
|
||||||
m_htmlCurrrentLine+=" ";
|
m_htmlCurrrentLine+=" ";
|
||||||
@ -1315,7 +1313,7 @@ void ewol::Text::htmlAddData(const std::string& _data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::htmlFlush(void) {
|
void ewol::compositing::Text::htmlFlush(void) {
|
||||||
if (m_htmlCurrrentLine.size()>0) {
|
if (m_htmlCurrrentLine.size()>0) {
|
||||||
print(m_htmlCurrrentLine, m_htmlDecoration);
|
print(m_htmlCurrrentLine, m_htmlDecoration);
|
||||||
}
|
}
|
||||||
@ -1323,25 +1321,25 @@ void ewol::Text::htmlFlush(void) {
|
|||||||
m_htmlDecoration.clear();
|
m_htmlDecoration.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::disableCursor(void) {
|
void ewol::compositing::Text::disableCursor(void) {
|
||||||
m_selectionStartPos = -100;
|
m_selectionStartPos = -100;
|
||||||
m_cursorPos = -100;
|
m_cursorPos = -100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setCursorPos(int32_t _cursorPos) {
|
void ewol::compositing::Text::setCursorPos(int32_t _cursorPos) {
|
||||||
m_selectionStartPos = _cursorPos;
|
m_selectionStartPos = _cursorPos;
|
||||||
m_cursorPos = _cursorPos;
|
m_cursorPos = _cursorPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos) {
|
void ewol::compositing::Text::setCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos) {
|
||||||
m_selectionStartPos = _selectionStartPos;
|
m_selectionStartPos = _selectionStartPos;
|
||||||
m_cursorPos = _cursorPos;
|
m_cursorPos = _cursorPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setSelectionColor(const etk::Color<>& _color) {
|
void ewol::compositing::Text::setSelectionColor(const etk::Color<>& _color) {
|
||||||
m_colorSelection = _color;
|
m_colorSelection = _color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::setCursorColor(const etk::Color<>& _color) {
|
void ewol::compositing::Text::setCursorColor(const etk::Color<>& _color) {
|
||||||
m_colorCursor = _color;
|
m_colorCursor = _color;
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,14 @@
|
|||||||
#include <etk/Color.h>
|
#include <etk/Color.h>
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compose.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
#include <exml/exml.h>
|
#include <exml/exml.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace compositing {
|
||||||
/**
|
/**
|
||||||
* @brief This class represent the specific display for every char in the string ...
|
* @brief This class represent the specific display for every char in the string ...
|
||||||
*/
|
*/
|
||||||
@ -31,11 +32,10 @@ namespace ewol {
|
|||||||
m_colorBg = etk::color::blue;
|
m_colorBg = etk::color::blue;
|
||||||
m_colorBg = etk::color::green;
|
m_colorBg = etk::color::green;
|
||||||
m_mode = ewol::font::Regular;
|
m_mode = ewol::font::Regular;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Text : public ewol::Compositing {
|
class Text : public ewol::compositing::Compose {
|
||||||
public:
|
public:
|
||||||
enum aligneMode {
|
enum aligneMode {
|
||||||
alignDisable,
|
alignDisable,
|
||||||
@ -105,12 +105,9 @@ namespace ewol {
|
|||||||
* @brief generic destructor
|
* @brief generic destructor
|
||||||
*/
|
*/
|
||||||
~Text(void);
|
~Text(void);
|
||||||
public:
|
public: // Derived function
|
||||||
// Derived function
|
|
||||||
virtual void translate(const vec3& _vect);
|
virtual void translate(const vec3& _vect);
|
||||||
// Derived function
|
|
||||||
virtual void rotate(const vec3& _vect, float _angle);
|
virtual void rotate(const vec3& _vect, float _angle);
|
||||||
// Derived function
|
|
||||||
virtual void scale(const vec3& _vect);
|
virtual void scale(const vec3& _vect);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -422,6 +419,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
void setCursorColor(const etk::Color<>& _color);
|
void setCursorColor(const etk::Color<>& _color);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,6 +67,60 @@ void ewol::eContext::unLockContext(void) {
|
|||||||
mutexInterface().unLock();
|
mutexInterface().unLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
class eSystemMessage {
|
||||||
|
public:
|
||||||
|
enum theadMessage {
|
||||||
|
msgNone,
|
||||||
|
msgInit,
|
||||||
|
msgRecalculateSize,
|
||||||
|
msgResize,
|
||||||
|
msgHide,
|
||||||
|
msgShow,
|
||||||
|
|
||||||
|
msgInputMotion,
|
||||||
|
msgInputState,
|
||||||
|
|
||||||
|
msgKeyboardKey,
|
||||||
|
msgKeyboardMove,
|
||||||
|
|
||||||
|
msgClipboardArrive
|
||||||
|
};
|
||||||
|
public :
|
||||||
|
// specify the message type
|
||||||
|
enum theadMessage TypeMessage;
|
||||||
|
// can not set a union ...
|
||||||
|
enum ewol::clipBoard::clipboardListe clipboardID;
|
||||||
|
// InputId
|
||||||
|
enum ewol::keyEvent::type inputType;
|
||||||
|
int32_t inputId;
|
||||||
|
// generic dimentions
|
||||||
|
vec2 dimention;
|
||||||
|
// keyboard events :
|
||||||
|
bool repeateKey; //!< special flag for the repeating key on the PC interface
|
||||||
|
bool stateIsDown;
|
||||||
|
char32_t keyboardChar;
|
||||||
|
enum ewol::keyEvent::keyboard keyboardMove;
|
||||||
|
ewol::SpecialKey keyboardSpecial;
|
||||||
|
|
||||||
|
eSystemMessage(void) :
|
||||||
|
TypeMessage(msgNone),
|
||||||
|
clipboardID(ewol::clipBoard::clipboardStd),
|
||||||
|
inputType(ewol::keyEvent::typeUnknow),
|
||||||
|
inputId(-1),
|
||||||
|
dimention(0,0),
|
||||||
|
repeateKey(false),
|
||||||
|
stateIsDown(false),
|
||||||
|
keyboardChar(0),
|
||||||
|
keyboardMove(ewol::keyEvent::keyboardUnknow)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void ewol::eContext::inputEventTransfertWidget(ewol::Widget* _source,
|
void ewol::eContext::inputEventTransfertWidget(ewol::Widget* _source,
|
||||||
ewol::Widget* _destination) {
|
ewol::Widget* _destination) {
|
||||||
m_input.transfertEvent(_source, _destination);
|
m_input.transfertEvent(_source, _destination);
|
||||||
@ -84,71 +138,76 @@ void ewol::eContext::inputEventUnGrabPointer(void) {
|
|||||||
void ewol::eContext::processEvents(void) {
|
void ewol::eContext::processEvents(void) {
|
||||||
int32_t nbEvent = 0;
|
int32_t nbEvent = 0;
|
||||||
//EWOL_DEBUG(" ******** Event");
|
//EWOL_DEBUG(" ******** Event");
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage* data = NULL;
|
||||||
while (m_msgSystem.count()>0) {
|
while (m_msgSystem.count()>0) {
|
||||||
nbEvent++;
|
nbEvent++;
|
||||||
|
if (data != NULL) {
|
||||||
|
delete(data);
|
||||||
|
data = NULL;
|
||||||
|
}
|
||||||
m_msgSystem.wait(data);
|
m_msgSystem.wait(data);
|
||||||
//EWOL_DEBUG("EVENT");
|
//EWOL_DEBUG("EVENT");
|
||||||
switch (data.TypeMessage) {
|
switch (data->TypeMessage) {
|
||||||
case eSystemMessage::msgInit:
|
case eSystemMessage::msgInit:
|
||||||
// this is due to the openGL context
|
// this is due to the openGL context
|
||||||
/*bool returnVal = */APP_Init(*this);
|
/*bool returnVal = */
|
||||||
|
APP_Init(*this);
|
||||||
break;
|
break;
|
||||||
case eSystemMessage::msgRecalculateSize:
|
case eSystemMessage::msgRecalculateSize:
|
||||||
forceRedrawAll();
|
forceRedrawAll();
|
||||||
break;
|
break;
|
||||||
case eSystemMessage::msgResize:
|
case eSystemMessage::msgResize:
|
||||||
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||||
m_windowsSize = data.dimention;
|
m_windowsSize = data->dimention;
|
||||||
ewol::dimension::setPixelWindowsSize(m_windowsSize);
|
ewol::dimension::setPixelWindowsSize(m_windowsSize);
|
||||||
forceRedrawAll();
|
forceRedrawAll();
|
||||||
break;
|
break;
|
||||||
case eSystemMessage::msgInputMotion:
|
case eSystemMessage::msgInputMotion:
|
||||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
||||||
m_input.motion(data.inputType, data.inputId, data.dimention);
|
m_input.motion(data->inputType, data->inputId, data->dimention);
|
||||||
break;
|
break;
|
||||||
case eSystemMessage::msgInputState:
|
case eSystemMessage::msgInputState:
|
||||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
|
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
|
||||||
m_input.state(data.inputType, data.inputId, data.stateIsDown, data.dimention);
|
m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention);
|
||||||
break;
|
break;
|
||||||
case eSystemMessage::msgKeyboardKey:
|
case eSystemMessage::msgKeyboardKey:
|
||||||
case eSystemMessage::msgKeyboardMove:
|
case eSystemMessage::msgKeyboardMove:
|
||||||
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
||||||
if (NULL != m_windowsCurrent) {
|
if (NULL != m_windowsCurrent) {
|
||||||
if (false == m_windowsCurrent->onEventShortCut(data.keyboardSpecial,
|
if (false == m_windowsCurrent->onEventShortCut(data->keyboardSpecial,
|
||||||
data.keyboardChar,
|
data->keyboardChar,
|
||||||
data.keyboardMove,
|
data->keyboardMove,
|
||||||
data.stateIsDown) ) {
|
data->stateIsDown) ) {
|
||||||
// get the current focused Widget :
|
// get the current focused Widget :
|
||||||
ewol::Widget * tmpWidget = m_widgetManager.focusGet();
|
ewol::Widget * tmpWidget = m_widgetManager.focusGet();
|
||||||
if (NULL != tmpWidget) {
|
if (NULL != tmpWidget) {
|
||||||
// check if the widget allow repeating key events.
|
// check if the widget allow repeating key events.
|
||||||
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data.stateIsDown);
|
//EWOL_DEBUG("repeating test :" << data->repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data->stateIsDown);
|
||||||
if( false == data.repeateKey
|
if( false == data->repeateKey
|
||||||
|| ( true == data.repeateKey
|
|| ( true == data->repeateKey
|
||||||
&& true == tmpWidget->getKeyboardRepeate()) ) {
|
&& true == tmpWidget->getKeyboardRepeate()) ) {
|
||||||
// check Widget shortcut
|
// check Widget shortcut
|
||||||
if (false == tmpWidget->onEventShortCut(data.keyboardSpecial,
|
if (false == tmpWidget->onEventShortCut(data->keyboardSpecial,
|
||||||
data.keyboardChar,
|
data->keyboardChar,
|
||||||
data.keyboardMove,
|
data->keyboardMove,
|
||||||
data.stateIsDown) ) {
|
data->stateIsDown) ) {
|
||||||
// generate the direct event ...
|
// generate the direct event ...
|
||||||
if (data.TypeMessage == eSystemMessage::msgKeyboardKey) {
|
if (data->TypeMessage == eSystemMessage::msgKeyboardKey) {
|
||||||
ewol::EventEntrySystem tmpEntryEvent(ewol::keyEvent::keyboardChar,
|
ewol::EventEntrySystem tmpEntryEvent(ewol::keyEvent::keyboardChar,
|
||||||
ewol::keyEvent::statusUp,
|
ewol::keyEvent::statusUp,
|
||||||
data.keyboardSpecial,
|
data->keyboardSpecial,
|
||||||
data.keyboardChar);
|
data->keyboardChar);
|
||||||
if(true == data.stateIsDown) {
|
if(true == data->stateIsDown) {
|
||||||
tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
|
tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
|
||||||
}
|
}
|
||||||
tmpWidget->systemEventEntry(tmpEntryEvent);
|
tmpWidget->systemEventEntry(tmpEntryEvent);
|
||||||
} else { // THREAD_KEYBORAD_MOVE
|
} else { // THREAD_KEYBORAD_MOVE
|
||||||
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown);
|
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data->keyboardMove << " " << data->stateIsDown);
|
||||||
ewol::EventEntrySystem tmpEntryEvent(data.keyboardMove,
|
ewol::EventEntrySystem tmpEntryEvent(data->keyboardMove,
|
||||||
ewol::keyEvent::statusUp,
|
ewol::keyEvent::statusUp,
|
||||||
data.keyboardSpecial,
|
data->keyboardSpecial,
|
||||||
0);
|
0);
|
||||||
if(true == data.stateIsDown) {
|
if(true == data->stateIsDown) {
|
||||||
tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
|
tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
|
||||||
}
|
}
|
||||||
tmpWidget->systemEventEntry(tmpEntryEvent);
|
tmpWidget->systemEventEntry(tmpEntryEvent);
|
||||||
@ -165,7 +224,7 @@ void ewol::eContext::processEvents(void) {
|
|||||||
{
|
{
|
||||||
ewol::Widget * tmpWidget = m_widgetManager.focusGet();
|
ewol::Widget * tmpWidget = m_widgetManager.focusGet();
|
||||||
if (tmpWidget != NULL) {
|
if (tmpWidget != NULL) {
|
||||||
tmpWidget->onEventClipboard(data.clipboardID);
|
tmpWidget->onEventClipboard(data->clipboardID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -262,10 +321,14 @@ ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
|
|||||||
etk::initDefaultFolder("ewolApplNoName");
|
etk::initDefaultFolder("ewolApplNoName");
|
||||||
// request the init of the application in the main context of openGL ...
|
// request the init of the application in the main context of openGL ...
|
||||||
{
|
{
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgInit;
|
if (data == NULL) {
|
||||||
|
EWOL_ERROR("allocationerror of message");
|
||||||
|
} else {
|
||||||
|
data->TypeMessage = eSystemMessage::msgInit;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// force a recalculation
|
// force a recalculation
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
#if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__)
|
#if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__)
|
||||||
@ -282,6 +345,7 @@ ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
|
|||||||
|
|
||||||
ewol::eContext::~eContext(void) {
|
ewol::eContext::~eContext(void) {
|
||||||
EWOL_INFO(" == > Ewol system Un-Init (BEGIN)");
|
EWOL_INFO(" == > Ewol system Un-Init (BEGIN)");
|
||||||
|
// TODO : Clean the message list ...
|
||||||
// set the curent interface :
|
// set the curent interface :
|
||||||
lockContext();
|
lockContext();
|
||||||
// call application to uninit
|
// call application to uninit
|
||||||
@ -301,64 +365,88 @@ ewol::eContext::~eContext(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::requestUpdateSize(void) {
|
void ewol::eContext::requestUpdateSize(void) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgRecalculateSize;
|
if (data == NULL) {
|
||||||
|
EWOL_ERROR("allocationerror of message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgRecalculateSize;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_Resize(const vec2& _size) {
|
void ewol::eContext::OS_Resize(const vec2& _size) {
|
||||||
// TODO : Better in the thread ... == > but generate some init error ...
|
// TODO : Better in the thread ... == > but generate some init error ...
|
||||||
ewol::dimension::setPixelWindowsSize(_size);
|
ewol::dimension::setPixelWindowsSize(_size);
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgResize;
|
if (data == NULL) {
|
||||||
data.dimention = _size;
|
EWOL_ERROR("allocationerror of message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgResize;
|
||||||
|
data->dimention = _size;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
void ewol::eContext::OS_Move(const vec2& _pos) {
|
void ewol::eContext::OS_Move(const vec2& _pos) {
|
||||||
/*
|
/*
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgResize;
|
data->TypeMessage = eSystemMessage::msgResize;
|
||||||
data.resize.w = w;
|
data->resize.w = w;
|
||||||
data.resize.h = h;
|
data->resize.h = h;
|
||||||
m_msgSystem.Post(data);
|
m_msgSystem.Post(data);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_SetInputMotion(int _pointerID, const vec2& _pos ) {
|
void ewol::eContext::OS_SetInputMotion(int _pointerID, const vec2& _pos ) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgInputMotion;
|
if (data == NULL) {
|
||||||
data.inputType = ewol::keyEvent::typeFinger;
|
EWOL_ERROR("allocationerror of message");
|
||||||
data.inputId = _pointerID;
|
return;
|
||||||
data.dimention = _pos;
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgInputMotion;
|
||||||
|
data->inputType = ewol::keyEvent::typeFinger;
|
||||||
|
data->inputId = _pointerID;
|
||||||
|
data->dimention = _pos;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos ) {
|
void ewol::eContext::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos ) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgInputState;
|
if (data == NULL) {
|
||||||
data.inputType = ewol::keyEvent::typeFinger;
|
EWOL_ERROR("allocationerror of message");
|
||||||
data.inputId = _pointerID;
|
return;
|
||||||
data.stateIsDown = _isDown;
|
}
|
||||||
data.dimention = _pos;
|
data->TypeMessage = eSystemMessage::msgInputState;
|
||||||
|
data->inputType = ewol::keyEvent::typeFinger;
|
||||||
|
data->inputId = _pointerID;
|
||||||
|
data->stateIsDown = _isDown;
|
||||||
|
data->dimention = _pos;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) {
|
void ewol::eContext::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgInputMotion;
|
if (data == NULL) {
|
||||||
data.inputType = ewol::keyEvent::typeMouse;
|
EWOL_ERROR("allocationerror of message");
|
||||||
data.inputId = _pointerID;
|
return;
|
||||||
data.dimention = _pos;
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgInputMotion;
|
||||||
|
data->inputType = ewol::keyEvent::typeMouse;
|
||||||
|
data->inputId = _pointerID;
|
||||||
|
data->dimention = _pos;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos ) {
|
void ewol::eContext::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos ) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgInputState;
|
if (data == NULL) {
|
||||||
data.inputType = ewol::keyEvent::typeMouse;
|
EWOL_ERROR("allocationerror of message");
|
||||||
data.inputId = _pointerID;
|
return;
|
||||||
data.stateIsDown = _isDown;
|
}
|
||||||
data.dimention = _pos;
|
data->TypeMessage = eSystemMessage::msgInputState;
|
||||||
|
data->inputType = ewol::keyEvent::typeMouse;
|
||||||
|
data->inputId = _pointerID;
|
||||||
|
data->stateIsDown = _isDown;
|
||||||
|
data->dimention = _pos;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,12 +454,16 @@ void ewol::eContext::OS_SetKeyboard(ewol::SpecialKey& _special,
|
|||||||
char32_t _myChar,
|
char32_t _myChar,
|
||||||
bool _isDown,
|
bool _isDown,
|
||||||
bool _isARepeateKey) {
|
bool _isARepeateKey) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgKeyboardKey;
|
if (data == NULL) {
|
||||||
data.stateIsDown = _isDown;
|
EWOL_ERROR("allocationerror of message");
|
||||||
data.keyboardChar = _myChar;
|
return;
|
||||||
data.keyboardSpecial = _special;
|
}
|
||||||
data.repeateKey = _isARepeateKey;
|
data->TypeMessage = eSystemMessage::msgKeyboardKey;
|
||||||
|
data->stateIsDown = _isDown;
|
||||||
|
data->keyboardChar = _myChar;
|
||||||
|
data->keyboardSpecial = _special;
|
||||||
|
data->repeateKey = _isARepeateKey;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,32 +471,48 @@ void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special,
|
|||||||
enum ewol::keyEvent::keyboard _move,
|
enum ewol::keyEvent::keyboard _move,
|
||||||
bool _isDown,
|
bool _isDown,
|
||||||
bool _isARepeateKey) {
|
bool _isARepeateKey) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgKeyboardMove;
|
if (data == NULL) {
|
||||||
data.stateIsDown = _isDown;
|
EWOL_ERROR("allocationerror of message");
|
||||||
data.keyboardMove = _move;
|
return;
|
||||||
data.keyboardSpecial = _special;
|
}
|
||||||
data.repeateKey = _isARepeateKey;
|
data->TypeMessage = eSystemMessage::msgKeyboardMove;
|
||||||
|
data->stateIsDown = _isDown;
|
||||||
|
data->keyboardMove = _move;
|
||||||
|
data->keyboardSpecial = _special;
|
||||||
|
data->repeateKey = _isARepeateKey;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_Hide(void) {
|
void ewol::eContext::OS_Hide(void) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgHide;
|
if (data == NULL) {
|
||||||
|
EWOL_ERROR("allocationerror of message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgHide;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eContext::OS_Show(void) {
|
void ewol::eContext::OS_Show(void) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgShow;
|
if (data == NULL) {
|
||||||
|
EWOL_ERROR("allocationerror of message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgShow;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::eContext::OS_ClipBoardArrive(enum ewol::clipBoard::clipboardListe _clipboardID) {
|
void ewol::eContext::OS_ClipBoardArrive(enum ewol::clipBoard::clipboardListe _clipboardID) {
|
||||||
eSystemMessage data;
|
ewol::eSystemMessage *data = new ewol::eSystemMessage();
|
||||||
data.TypeMessage = eSystemMessage::msgClipboardArrive;
|
if (data == NULL) {
|
||||||
data.clipboardID = _clipboardID;
|
EWOL_ERROR("allocationerror of message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data->TypeMessage = eSystemMessage::msgClipboardArrive;
|
||||||
|
data->clipboardID = _clipboardID;
|
||||||
m_msgSystem.post(data);
|
m_msgSystem.post(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,58 +23,8 @@
|
|||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
#include <ewol/commandLine.h>
|
#include <ewol/commandLine.h>
|
||||||
|
|
||||||
// TODO : Remove this from here ...
|
|
||||||
class eSystemMessage {
|
|
||||||
public:
|
|
||||||
enum theadMessage {
|
|
||||||
msgNone,
|
|
||||||
msgInit,
|
|
||||||
msgRecalculateSize,
|
|
||||||
msgResize,
|
|
||||||
msgHide,
|
|
||||||
msgShow,
|
|
||||||
|
|
||||||
msgInputMotion,
|
|
||||||
msgInputState,
|
|
||||||
|
|
||||||
msgKeyboardKey,
|
|
||||||
msgKeyboardMove,
|
|
||||||
|
|
||||||
msgClipboardArrive
|
|
||||||
};
|
|
||||||
public :
|
|
||||||
// specify the message type
|
|
||||||
enum theadMessage TypeMessage;
|
|
||||||
// can not set a union ...
|
|
||||||
enum ewol::clipBoard::clipboardListe clipboardID;
|
|
||||||
// InputId
|
|
||||||
enum ewol::keyEvent::type inputType;
|
|
||||||
int32_t inputId;
|
|
||||||
// generic dimentions
|
|
||||||
vec2 dimention;
|
|
||||||
// keyboard events :
|
|
||||||
bool repeateKey; //!< special flag for the repeating key on the PC interface
|
|
||||||
bool stateIsDown;
|
|
||||||
char32_t keyboardChar;
|
|
||||||
enum ewol::keyEvent::keyboard keyboardMove;
|
|
||||||
ewol::SpecialKey keyboardSpecial;
|
|
||||||
|
|
||||||
eSystemMessage(void) :
|
|
||||||
TypeMessage(msgNone),
|
|
||||||
clipboardID(ewol::clipBoard::clipboardStd),
|
|
||||||
inputType(ewol::keyEvent::typeUnknow),
|
|
||||||
inputId(-1),
|
|
||||||
dimention(0,0),
|
|
||||||
repeateKey(false),
|
|
||||||
stateIsDown(false),
|
|
||||||
keyboardChar(0),
|
|
||||||
keyboardMove(ewol::keyEvent::keyboardUnknow)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
class eSystemMessage;
|
||||||
enum orientation{
|
enum orientation{
|
||||||
screenAuto = 0,
|
screenAuto = 0,
|
||||||
screenLandscape,
|
screenLandscape,
|
||||||
@ -129,7 +79,7 @@ namespace ewol {
|
|||||||
private:
|
private:
|
||||||
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
||||||
ewol::eInput m_input;
|
ewol::eInput m_input;
|
||||||
etk::MessageFifo<eSystemMessage> m_msgSystem;
|
etk::MessageFifo<ewol::eSystemMessage*> m_msgSystem;
|
||||||
bool m_displayFps;
|
bool m_displayFps;
|
||||||
ewol::Fps m_FpsSystemEvent;
|
ewol::Fps m_FpsSystemEvent;
|
||||||
ewol::Fps m_FpsSystemContext;
|
ewol::Fps m_FpsSystemContext;
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Colored3DObject"
|
#define __class__ "resource::Colored3DObject"
|
||||||
|
|
||||||
|
|
||||||
ewol::Colored3DObject::Colored3DObject(void) :
|
ewol::resource::Colored3DObject::Colored3DObject(void) :
|
||||||
m_GLprogram(NULL) {
|
m_GLprogram(NULL) {
|
||||||
addObjectType("ewol::Colored3DObject");
|
addObjectType("ewol::Colored3DObject");
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
@ -27,13 +27,13 @@ ewol::Colored3DObject::Colored3DObject(void) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Colored3DObject::~Colored3DObject(void) {
|
ewol::resource::Colored3DObject::~Colored3DObject(void) {
|
||||||
// remove dynamics dependencies :
|
// remove dynamics dependencies :
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::Program::release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Colored3DObject::draw(std::vector<vec3>& _vertices,
|
void ewol::resource::Colored3DObject::draw(std::vector<vec3>& _vertices,
|
||||||
const etk::Color<float>& _color,
|
const etk::Color<float>& _color,
|
||||||
bool _updateDepthBuffer,
|
bool _updateDepthBuffer,
|
||||||
bool _depthtest) {
|
bool _depthtest) {
|
||||||
@ -75,7 +75,7 @@ void ewol::Colored3DObject::draw(std::vector<vec3>& _vertices,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Colored3DObject::draw(std::vector<vec3>& _vertices,
|
void ewol::resource::Colored3DObject::draw(std::vector<vec3>& _vertices,
|
||||||
const etk::Color<float>& _color,
|
const etk::Color<float>& _color,
|
||||||
mat4& _transformationMatrix,
|
mat4& _transformationMatrix,
|
||||||
bool _updateDepthBuffer,
|
bool _updateDepthBuffer,
|
||||||
@ -115,7 +115,7 @@ void ewol::Colored3DObject::draw(std::vector<vec3>& _vertices,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Colored3DObject::drawLine(std::vector<vec3>& _vertices,
|
void ewol::resource::Colored3DObject::drawLine(std::vector<vec3>& _vertices,
|
||||||
const etk::Color<float>& _color,
|
const etk::Color<float>& _color,
|
||||||
mat4& _transformationMatrix,
|
mat4& _transformationMatrix,
|
||||||
bool _updateDepthBuffer,
|
bool _updateDepthBuffer,
|
||||||
@ -155,10 +155,10 @@ void ewol::Colored3DObject::drawLine(std::vector<vec3>& _vertices,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Colored3DObject* ewol::Colored3DObject::keep(void) {
|
ewol::resource::Colored3DObject* ewol::Colored3DObject::keep(void) {
|
||||||
EWOL_VERBOSE("KEEP : direct Colored3DObject");
|
EWOL_VERBOSE("KEEP : direct Colored3DObject");
|
||||||
// need to crate a new one ...
|
// need to crate a new one ...
|
||||||
ewol::Colored3DObject* object = new ewol::Colored3DObject();
|
ewol::resource::Colored3DObject* object = new ewol::resource::Colored3DObject();
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
|
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -167,11 +167,11 @@ ewol::Colored3DObject* ewol::Colored3DObject::keep(void) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Colored3DObject::release(ewol::Colored3DObject*& _object) {
|
void ewol::resource::Colored3DObject::release(ewol::resource::Colored3DObject*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/resources/Program.h>
|
#include <ewol/resources/Program.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Colored3DObject : public ewol::Resource {
|
namespace resource {
|
||||||
|
class Colored3DObject : public ewol::resource::Resource {
|
||||||
protected:
|
protected:
|
||||||
ewol::Program* m_GLprogram;
|
ewol::Program* m_GLprogram;
|
||||||
int32_t m_GLPosition;
|
int32_t m_GLPosition;
|
||||||
@ -54,6 +55,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::Colored3DObject*& _object);
|
static void release(ewol::Colored3DObject*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ConfigFile"
|
#define __class__ "resource::ConfigFile"
|
||||||
|
|
||||||
|
|
||||||
void ewol::SimpleConfigElement::parse(const std::string& _value) {
|
void ewol::resource::SimpleConfigElement::parse(const std::string& _value) {
|
||||||
m_value = _value;
|
m_value = _value;
|
||||||
#ifdef __EXCEPTIONS
|
#ifdef __EXCEPTIONS
|
||||||
try {
|
try {
|
||||||
@ -36,15 +36,15 @@ void ewol::SimpleConfigElement::parse(const std::string& _value) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::ConfigFile::ConfigFile(const std::string& _filename) :
|
ewol::resource::ConfigFile::ConfigFile(const std::string& _filename) :
|
||||||
ewol::Resource(_filename) {
|
ewol::resource::Resource(_filename) {
|
||||||
addObjectType("ewol::ConfigFile");
|
addObjectType("ewol::ConfigFile");
|
||||||
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
|
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::ConfigFile::~ConfigFile(void) {
|
ewol::resource::ConfigFile::~ConfigFile(void) {
|
||||||
// remove all element
|
// remove all element
|
||||||
for (size_t iii=0; iii<m_list.size(); iii++){
|
for (size_t iii=0; iii<m_list.size(); iii++){
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
@ -55,7 +55,7 @@ ewol::ConfigFile::~ConfigFile(void) {
|
|||||||
m_list.clear();
|
m_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ConfigFile::reload(void) {
|
void ewol::resource::ConfigFile::reload(void) {
|
||||||
// reset all parameters
|
// reset all parameters
|
||||||
for (size_t iii=0; iii<m_list.size(); iii++){
|
for (size_t iii=0; iii<m_list.size(); iii++){
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
@ -138,7 +138,7 @@ void ewol::ConfigFile::reload(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::ConfigFile::request(const std::string& _paramName) {
|
int32_t ewol::resource::ConfigFile::request(const std::string& _paramName) {
|
||||||
// check if the parameters existed :
|
// check if the parameters existed :
|
||||||
for (size_t iii=0; iii<m_list.size(); iii++){
|
for (size_t iii=0; iii<m_list.size(); iii++){
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
@ -147,7 +147,7 @@ int32_t ewol::ConfigFile::request(const std::string& _paramName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ewol::SimpleConfigElement* tmpElement = new ewol::SimpleConfigElement(_paramName);
|
ewol::resource::SimpleConfigElement* tmpElement = new ewol::resource::SimpleConfigElement(_paramName);
|
||||||
if (NULL == tmpElement) {
|
if (NULL == tmpElement) {
|
||||||
EWOL_DEBUG("error while allocation");
|
EWOL_DEBUG("error while allocation");
|
||||||
} else {
|
} else {
|
||||||
@ -157,14 +157,14 @@ int32_t ewol::ConfigFile::request(const std::string& _paramName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::ConfigFile* ewol::ConfigFile::keep(const std::string& _filename) {
|
ewol::resource::ConfigFile* ewol::resource::ConfigFile::keep(const std::string& _filename) {
|
||||||
EWOL_INFO("KEEP : SimpleConfig : file : \"" << _filename << "\"");
|
EWOL_INFO("KEEP : SimpleConfig : file : \"" << _filename << "\"");
|
||||||
ewol::ConfigFile* object = static_cast<ewol::ConfigFile*>(getManager().localKeep(_filename));
|
ewol::resource::ConfigFile* object = static_cast<ewol::resource::ConfigFile*>(getManager().localKeep(_filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
// this element create a new one every time ....
|
// this element create a new one every time ....
|
||||||
object = new ewol::ConfigFile(_filename);
|
object = new ewol::resource::ConfigFile(_filename);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
|
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -173,11 +173,11 @@ ewol::ConfigFile* ewol::ConfigFile::keep(const std::string& _filename) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ConfigFile::release(ewol::ConfigFile*& _object) {
|
void ewol::resource::ConfigFile::release(ewol::resource::ConfigFile*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <ewol/resources/Resource.h>
|
#include <ewol/resources/Resource.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
class SimpleConfigElement {
|
class SimpleConfigElement {
|
||||||
public:
|
public:
|
||||||
std::string m_paramName;
|
std::string m_paramName;
|
||||||
@ -34,7 +35,7 @@ namespace ewol {
|
|||||||
std::string& getString(void) { return m_value; };
|
std::string& getString(void) { return m_value; };
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigFile : public ewol::Resource {
|
class ConfigFile : public ewol::resource::Resource {
|
||||||
private:
|
private:
|
||||||
std::vector<ewol::SimpleConfigElement*> m_list;
|
std::vector<ewol::SimpleConfigElement*> m_list;
|
||||||
std::string m_errorString;
|
std::string m_errorString;
|
||||||
@ -79,6 +80,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::ConfigFile*& _object);
|
static void release(ewol::ConfigFile*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "FontFreeType"
|
#define __class__ "resource::FontFreeType"
|
||||||
|
|
||||||
// free Font hnadle of librairies ... entry for acces ...
|
// free Font hnadle of librairies ... entry for acces ...
|
||||||
static int32_t l_countLoaded=0;
|
static int32_t l_countLoaded=0;
|
||||||
static FT_Library library;
|
static FT_Library library;
|
||||||
|
|
||||||
void ewol::freeTypeInit(void) {
|
void ewol::resource::freeTypeInit(void) {
|
||||||
EWOL_DEBUG(" == > init Font-Manager");
|
EWOL_DEBUG(" == > init Font-Manager");
|
||||||
l_countLoaded++;
|
l_countLoaded++;
|
||||||
if (l_countLoaded>1) {
|
if (l_countLoaded>1) {
|
||||||
@ -38,7 +38,7 @@ void ewol::freeTypeInit(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::freeTypeUnInit(void) {
|
void ewol::resource::freeTypeUnInit(void) {
|
||||||
EWOL_DEBUG(" == > Un-Init Font-Manager");
|
EWOL_DEBUG(" == > Un-Init Font-Manager");
|
||||||
l_countLoaded--;
|
l_countLoaded--;
|
||||||
if (l_countLoaded>0) {
|
if (l_countLoaded>0) {
|
||||||
@ -52,7 +52,7 @@ void ewol::freeTypeUnInit(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::FontFreeType::FontFreeType(const std::string& _fontName) :
|
ewol::resource::FontFreeType::FontFreeType(const std::string& _fontName) :
|
||||||
FontBase(_fontName) {
|
FontBase(_fontName) {
|
||||||
addObjectType("ewol::FontFreeType");
|
addObjectType("ewol::FontFreeType");
|
||||||
m_init = false;
|
m_init = false;
|
||||||
@ -97,7 +97,7 @@ ewol::FontFreeType::FontFreeType(const std::string& _fontName) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::FontFreeType::~FontFreeType(void) {
|
ewol::resource::FontFreeType::~FontFreeType(void) {
|
||||||
// clean the tmp memory
|
// clean the tmp memory
|
||||||
if (NULL != m_FileBuffer) {
|
if (NULL != m_FileBuffer) {
|
||||||
delete[] m_FileBuffer;
|
delete[] m_FileBuffer;
|
||||||
@ -107,7 +107,7 @@ ewol::FontFreeType::~FontFreeType(void) {
|
|||||||
FT_Done_Face( m_fftFace );
|
FT_Done_Face( m_fftFace );
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 ewol::FontFreeType::getSize(int32_t _fontSize, const std::string& _unicodeString) {
|
vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const std::string& _unicodeString) {
|
||||||
if(false == m_init) {
|
if(false == m_init) {
|
||||||
return vec2(0,0);
|
return vec2(0,0);
|
||||||
}
|
}
|
||||||
@ -116,11 +116,11 @@ vec2 ewol::FontFreeType::getSize(int32_t _fontSize, const std::string& _unicodeS
|
|||||||
return outputSize;
|
return outputSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::FontFreeType::getHeight(int32_t _fontSize) {
|
int32_t ewol::resource::FontFreeType::getHeight(int32_t _fontSize) {
|
||||||
return _fontSize*1.43f; // this is a really "magic" number ...
|
return _fontSize*1.43f; // this is a really "magic" number ...
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) {
|
bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) {
|
||||||
if(false == m_init) {
|
if(false == m_init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -160,10 +160,10 @@ bool ewol::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
||||||
int32_t _fontSize,
|
int32_t _fontSize,
|
||||||
ivec2 _glyphPosition,
|
ivec2 _glyphPosition,
|
||||||
ewol::GlyphProperty& _property,
|
ewol::resource::GlyphProperty& _property,
|
||||||
int8_t _posInImage) {
|
int8_t _posInImage) {
|
||||||
if(false == m_init) {
|
if(false == m_init) {
|
||||||
return false;
|
return false;
|
||||||
@ -200,8 +200,7 @@ bool ewol::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
|||||||
tlpppp = _imageOut.get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
|
tlpppp = _imageOut.get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
|
||||||
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
|
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
|
||||||
// set only alpha :
|
// set only alpha :
|
||||||
switch(_posInImage)
|
switch(_posInImage) {
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
tlpppp.setA(valueColor);
|
tlpppp.setA(valueColor);
|
||||||
@ -224,7 +223,7 @@ bool ewol::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::FontFreeType::generateKerning(int32_t fontSize, std::vector<ewol::GlyphProperty>& listGlyph) {
|
void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, std::vector<ewol::GlyphProperty>& listGlyph) {
|
||||||
if(false == m_init) {
|
if(false == m_init) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -257,7 +256,7 @@ void ewol::FontFreeType::generateKerning(int32_t fontSize, std::vector<ewol::Gly
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::FontFreeType::display(void) {
|
void ewol::resource::FontFreeType::display(void) {
|
||||||
if(false == m_init) {
|
if(false == m_init) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -343,14 +342,14 @@ void ewol::FontFreeType::display(void) {
|
|||||||
//EWOL_INFO(" Current size = " << (int)m_fftFace->size);
|
//EWOL_INFO(" Current size = " << (int)m_fftFace->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::FontBase* ewol::FontFreeType::keep(const std::string& _filename) {
|
ewol::resource::FontBase* ewol::resource::FontFreeType::keep(const std::string& _filename) {
|
||||||
EWOL_VERBOSE("KEEP : Font : file : \"" << _filename << "\"");
|
EWOL_VERBOSE("KEEP : Font : file : \"" << _filename << "\"");
|
||||||
ewol::FontBase* object = static_cast<ewol::FontBase*>(getManager().localKeep(_filename));
|
ewol::resource::FontBase* object = static_cast<ewol::resource::FontBase*>(getManager().localKeep(_filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
// need to crate a new one ...
|
// need to crate a new one ...
|
||||||
object = new ewol::FontFreeType(_filename);
|
object = new ewol::resource::FontFreeType(_filename);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -359,11 +358,11 @@ ewol::FontBase* ewol::FontFreeType::keep(const std::string& _filename) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::FontFreeType::release(ewol::FontBase*& _object) {
|
void ewol::resource::FontFreeType::release(ewol::resource::FontBase*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,9 @@ extern "C" {
|
|||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
|
// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
|
||||||
class FontFreeType : public ewol::FontBase {
|
class FontFreeType : public ewol::resource::FontBase {
|
||||||
private:
|
private:
|
||||||
FT_Byte* m_FileBuffer;
|
FT_Byte* m_FileBuffer;
|
||||||
int32_t m_FileSize;
|
int32_t m_FileSize;
|
||||||
@ -61,6 +62,7 @@ namespace ewol {
|
|||||||
};
|
};
|
||||||
void freeTypeInit(void);
|
void freeTypeInit(void);
|
||||||
void freeTypeUnInit(void);
|
void freeTypeUnInit(void);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,16 +15,16 @@
|
|||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TextureFile"
|
#define __class__ "resource::TextureFile"
|
||||||
|
|
||||||
ewol::TextureFile::TextureFile(const std::string& _genName) :
|
ewol::resource::TextureFile::TextureFile(const std::string& _genName) :
|
||||||
Texture(_genName) {
|
Texture(_genName) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::TextureFile::TextureFile(std::string _genName, const std::string& _tmpfileName, const ivec2& _size) :
|
ewol::resource::TextureFile::TextureFile(std::string _genName, const std::string& _tmpfileName, const ivec2& _size) :
|
||||||
Texture(_genName) {
|
ewol::resource::Texture(_genName) {
|
||||||
addObjectType("ewol::TextureFile");
|
addObjectType("ewol::TextureFile");
|
||||||
if (false == egami::load(m_data, _tmpfileName, _size)) {
|
if (false == egami::load(m_data, _tmpfileName, _size)) {
|
||||||
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
|
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
|
||||||
@ -56,10 +56,10 @@ static int32_t nextP2(int32_t _value) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::TextureFile* ewol::TextureFile::keep(const std::string& _filename, ivec2 _size) {
|
ewol::resource::TextureFile* ewol::resource::TextureFile::keep(const std::string& _filename, ivec2 _size) {
|
||||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size);
|
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size);
|
||||||
if (_filename == "") {
|
if (_filename == "") {
|
||||||
ewol::TextureFile* object = new ewol::TextureFile("");
|
ewol::resource::TextureFile* object = new ewol::resource::TextureFile("");
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -95,13 +95,13 @@ ewol::TextureFile* ewol::TextureFile::keep(const std::string& _filename, ivec2 _
|
|||||||
}
|
}
|
||||||
|
|
||||||
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);
|
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);
|
||||||
ewol::TextureFile* object = static_cast<ewol::TextureFile*>(getManager().localKeep(TmpFilename));
|
ewol::resource::TextureFile* object = static_cast<ewol::resource::TextureFile*>(getManager().localKeep(TmpFilename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
EWOL_INFO("CREATE: TextureFile: '" << TmpFilename << "' size=" << _size);
|
EWOL_INFO("CREATE: TextureFile: '" << TmpFilename << "' size=" << _size);
|
||||||
// need to crate a new one ...
|
// need to crate a new one ...
|
||||||
object = new ewol::TextureFile(TmpFilename, _filename, _size);
|
object = new ewol::resource::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 NULL;
|
return NULL;
|
||||||
@ -111,11 +111,11 @@ ewol::TextureFile* ewol::TextureFile::keep(const std::string& _filename, ivec2 _
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::TextureFile::release(ewol::TextureFile*& _object) {
|
void ewol::resource::TextureFile::release(ewol::resource::TextureFile*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/resources/Resource.h>
|
#include <ewol/resources/Resource.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class TextureFile : public ewol::Texture {
|
namespace resource {
|
||||||
|
class TextureFile : public ewol::resource::Texture {
|
||||||
private:
|
private:
|
||||||
vec2 m_realImageSize;
|
vec2 m_realImageSize;
|
||||||
private:
|
private:
|
||||||
@ -41,6 +42,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::TextureFile*& _object);
|
static void release(ewol::TextureFile*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::ResourceManager::ResourceManager(void) :
|
ewol::resource::Manager::Manager(void) :
|
||||||
m_contextHasBeenRemoved(true) {
|
m_contextHasBeenRemoved(true) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::ResourceManager::~ResourceManager(void) {
|
ewol::resource::Manager::~Manager(void) {
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
if (m_resourceListToUpdate.size()!=0) {
|
if (m_resourceListToUpdate.size()!=0) {
|
||||||
EWOL_ERROR("Must not have anymore resources to update !!!");
|
EWOL_ERROR("Must not have anymore resources to update !!!");
|
||||||
@ -36,7 +36,7 @@ ewol::ResourceManager::~ResourceManager(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ResourceManager::unInit(void) {
|
void ewol::resource::Manager::unInit(void) {
|
||||||
display();
|
display();
|
||||||
m_resourceListToUpdate.clear();
|
m_resourceListToUpdate.clear();
|
||||||
// remove all resources ...
|
// remove all resources ...
|
||||||
@ -52,7 +52,7 @@ void ewol::ResourceManager::unInit(void) {
|
|||||||
m_resourceList.clear();
|
m_resourceList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ResourceManager::display(void) {
|
void ewol::resource::Manager::display(void) {
|
||||||
EWOL_INFO("Resources loaded : ");
|
EWOL_INFO("Resources loaded : ");
|
||||||
// remove all resources ...
|
// remove all resources ...
|
||||||
for (int64_t iii=m_resourceList.size()-1; iii >= 0; iii--) {
|
for (int64_t iii=m_resourceList.size()-1; iii >= 0; iii--) {
|
||||||
@ -66,7 +66,7 @@ void ewol::ResourceManager::display(void) {
|
|||||||
EWOL_INFO("Resources ---");
|
EWOL_INFO("Resources ---");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ResourceManager::reLoadResources(void) {
|
void ewol::resource::Manager::reLoadResources(void) {
|
||||||
EWOL_INFO("------------- Resources re-loaded -------------");
|
EWOL_INFO("------------- Resources re-loaded -------------");
|
||||||
// remove all resources ...
|
// remove all resources ...
|
||||||
if (m_resourceList.size() != 0) {
|
if (m_resourceList.size() != 0) {
|
||||||
@ -87,7 +87,7 @@ void ewol::ResourceManager::reLoadResources(void) {
|
|||||||
EWOL_INFO("------------- Resources -------------");
|
EWOL_INFO("------------- Resources -------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ResourceManager::update(ewol::Resource* _object) {
|
void ewol::resource::Manager::update(ewol::resource::Resource* _object) {
|
||||||
// chek if not added before
|
// chek if not added before
|
||||||
for (size_t iii=0; iii<m_resourceListToUpdate.size(); iii++) {
|
for (size_t iii=0; iii<m_resourceListToUpdate.size(); iii++) {
|
||||||
if (m_resourceListToUpdate[iii] != NULL) {
|
if (m_resourceListToUpdate[iii] != NULL) {
|
||||||
@ -102,7 +102,7 @@ void ewol::ResourceManager::update(ewol::Resource* _object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Specific to load or update the data in the openGl context == > system use only
|
// Specific to load or update the data in the openGl context == > system use only
|
||||||
void ewol::ResourceManager::updateContext(void) {
|
void ewol::resource::Manager::updateContext(void) {
|
||||||
if (true == m_contextHasBeenRemoved) {
|
if (true == m_contextHasBeenRemoved) {
|
||||||
// need to update all ...
|
// need to update all ...
|
||||||
m_contextHasBeenRemoved = false;
|
m_contextHasBeenRemoved = false;
|
||||||
@ -138,7 +138,7 @@ void ewol::ResourceManager::updateContext(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// in this case, it is really too late ...
|
// in this case, it is really too late ...
|
||||||
void ewol::ResourceManager::contextHasBeenDestroyed(void) {
|
void ewol::resource::Manager::contextHasBeenDestroyed(void) {
|
||||||
for (size_t iii=0; iii<m_resourceList.size(); iii++) {
|
for (size_t iii=0; iii<m_resourceList.size(); iii++) {
|
||||||
if (m_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
m_resourceList[iii]->removeContextToLate();
|
m_resourceList[iii]->removeContextToLate();
|
||||||
@ -149,7 +149,7 @@ void ewol::ResourceManager::contextHasBeenDestroyed(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// internal generic keeper ...
|
// internal generic keeper ...
|
||||||
ewol::Resource* ewol::ResourceManager::localKeep(const std::string& _filename) {
|
ewol::resource::Resource* ewol::resource::Manager::localKeep(const std::string& _filename) {
|
||||||
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << _filename << "\"");
|
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << _filename << "\"");
|
||||||
for (size_t iii=0; iii<m_resourceList.size(); iii++) {
|
for (size_t iii=0; iii<m_resourceList.size(); iii++) {
|
||||||
if (m_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
@ -164,7 +164,7 @@ ewol::Resource* ewol::ResourceManager::localKeep(const std::string& _filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// internal generic keeper ...
|
// internal generic keeper ...
|
||||||
void ewol::ResourceManager::localAdd(ewol::Resource* _object) {
|
void ewol::resource::Manager::localAdd(ewol::resource::Resource* _object) {
|
||||||
//Add ... find empty slot
|
//Add ... find empty slot
|
||||||
for (size_t iii=0; iii<m_resourceList.size(); iii++) {
|
for (size_t iii=0; iii<m_resourceList.size(); iii++) {
|
||||||
if (m_resourceList[iii] == NULL) {
|
if (m_resourceList[iii] == NULL) {
|
||||||
@ -176,7 +176,7 @@ void ewol::ResourceManager::localAdd(ewol::Resource* _object) {
|
|||||||
m_resourceList.push_back(_object);
|
m_resourceList.push_back(_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::ResourceManager::release(ewol::Resource*& _object) {
|
bool ewol::resource::Manager::release(ewol::resource::Resource*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
EWOL_ERROR("Try to remove a resource that have null pointer ...");
|
EWOL_ERROR("Try to remove a resource that have null pointer ...");
|
||||||
return false;
|
return false;
|
85
sources/ewol/resources/Manager.h
Normal file
85
sources/ewol/resources/Manager.h
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RESOURCES_MANAGER_H__
|
||||||
|
#define __RESOURCES_MANAGER_H__
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/resources/Resource.h>
|
||||||
|
#include <ewol/resources/Shader.h>
|
||||||
|
#include <ewol/resources/Program.h>
|
||||||
|
#include <ewol/resources/VirtualBufferObject.h>
|
||||||
|
#include <ewol/resources/ConfigFile.h>
|
||||||
|
#include <ewol/resources/TexturedFont.h>
|
||||||
|
#include <ewol/resources/Texture.h>
|
||||||
|
#include <ewol/resources/Image.h>
|
||||||
|
#include <ewol/resources/Mesh.h>
|
||||||
|
#include <ewol/resources/Colored3DObject.h>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
|
class Manager {
|
||||||
|
private:
|
||||||
|
std::vector<ewol::Resource*> m_resourceList;
|
||||||
|
std::vector<ewol::Resource*> m_resourceListToUpdate;
|
||||||
|
bool m_contextHasBeenRemoved;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief initialize the internal variable
|
||||||
|
*/
|
||||||
|
Manager(void);
|
||||||
|
/**
|
||||||
|
* @brief Uninitiamize the resource manager, free all resources previously requested
|
||||||
|
* @note when not free == > generate warning, because the segfault can appear after...
|
||||||
|
*/
|
||||||
|
~Manager(void);
|
||||||
|
/**
|
||||||
|
* @brief remove all resources (un-init) out of the destructor (due to the system implementation)
|
||||||
|
*/
|
||||||
|
void unInit(void);
|
||||||
|
/**
|
||||||
|
* @brief display in the log all the resources loaded ...
|
||||||
|
*/
|
||||||
|
void display(void);
|
||||||
|
/**
|
||||||
|
* @brief Reload all resources from files, and send there in openGL card if needed.
|
||||||
|
* @note If file is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
|
||||||
|
*/
|
||||||
|
void reLoadResources(void);
|
||||||
|
/**
|
||||||
|
* @brief Call by the system to send all the needed data on the graphic card chen they change ...
|
||||||
|
* @param[in] _object The resources that might be updated
|
||||||
|
*/
|
||||||
|
void update(ewol::Resource* _object);
|
||||||
|
/**
|
||||||
|
* @brief Call by the system chen the openGL Context has been unexpectially removed == > This reload all the texture, VBO and other ....
|
||||||
|
*/
|
||||||
|
void updateContext(void);
|
||||||
|
/**
|
||||||
|
* @brief This is to inform the resources manager that we have no more openGl context ...
|
||||||
|
*/
|
||||||
|
void contextHasBeenDestroyed(void);
|
||||||
|
public:
|
||||||
|
// internal API to extent eResources in extern Soft
|
||||||
|
ewol::Resource* localKeep(const std::string& _filename);
|
||||||
|
void localAdd(ewol::Resource* _object);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief release a resources and free it if the Last release is call.
|
||||||
|
* @param[in,out] _object element to realease == > is return at NULL value.
|
||||||
|
* @return true, if element is removed, and false for just decreasing counter
|
||||||
|
*/
|
||||||
|
bool release(ewol::Resource*& _object);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -12,10 +12,10 @@
|
|||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Mesh"
|
#define __class__ "resource::Mesh"
|
||||||
|
|
||||||
ewol::Mesh::Mesh(const std::string& _fileName, const std::string& _shaderName) :
|
ewol::resource::Mesh::Mesh(const std::string& _fileName, const std::string& _shaderName) :
|
||||||
ewol::Resource(_fileName),
|
ewol::resource::Resource(_fileName),
|
||||||
m_normalMode(normalModeNone),
|
m_normalMode(normalModeNone),
|
||||||
m_checkNormal(false),
|
m_checkNormal(false),
|
||||||
m_pointerShape(NULL),
|
m_pointerShape(NULL),
|
||||||
@ -65,10 +65,10 @@ ewol::Mesh::Mesh(const std::string& _fileName, const std::string& _shaderName) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Mesh::~Mesh(void) {
|
ewol::resource::Mesh::~Mesh(void) {
|
||||||
// remove dynamics dependencies :
|
// remove dynamics dependencies :
|
||||||
ewol::Program::release(m_GLprogram);
|
ewol::resource::Program::release(m_GLprogram);
|
||||||
ewol::VirtualBufferObject::release(m_verticesVBO);
|
ewol::resource::VirtualBufferObject::release(m_verticesVBO);
|
||||||
if (m_functionFreeShape!=NULL) {
|
if (m_functionFreeShape!=NULL) {
|
||||||
m_functionFreeShape(m_pointerShape);
|
m_functionFreeShape(m_pointerShape);
|
||||||
m_pointerShape = NULL;
|
m_pointerShape = NULL;
|
||||||
@ -77,7 +77,7 @@ ewol::Mesh::~Mesh(void) {
|
|||||||
|
|
||||||
//#define DISPLAY_NB_VERTEX_DISPLAYED
|
//#define DISPLAY_NB_VERTEX_DISPLAYED
|
||||||
|
|
||||||
void ewol::Mesh::draw(mat4& _positionMatrix,
|
void ewol::resource::Mesh::draw(mat4& _positionMatrix,
|
||||||
bool _enableDepthTest,
|
bool _enableDepthTest,
|
||||||
bool _enableDepthUpdate) {
|
bool _enableDepthUpdate) {
|
||||||
if (m_GLprogram == NULL) {
|
if (m_GLprogram == NULL) {
|
||||||
@ -178,7 +178,7 @@ void ewol::Mesh::draw(mat4& _positionMatrix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// normal calculation of the normal face is really easy :
|
// normal calculation of the normal face is really easy :
|
||||||
void ewol::Mesh::calculateNormaleFace(void) {
|
void ewol::resource::Mesh::calculateNormaleFace(void) {
|
||||||
m_listFacesNormal.clear();
|
m_listFacesNormal.clear();
|
||||||
if (m_normalMode != ewol::Mesh::normalModeFace) {
|
if (m_normalMode != ewol::Mesh::normalModeFace) {
|
||||||
std::vector<Face>& tmpFaceList = m_listFaces.getValue(0).m_faces;
|
std::vector<Face>& tmpFaceList = m_listFaces.getValue(0).m_faces;
|
||||||
@ -192,7 +192,7 @@ void ewol::Mesh::calculateNormaleFace(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Mesh::calculateNormaleEdge(void) {
|
void ewol::resource::Mesh::calculateNormaleEdge(void) {
|
||||||
m_listVertexNormal.clear();
|
m_listVertexNormal.clear();
|
||||||
if (m_normalMode != ewol::Mesh::normalModeVertex) {
|
if (m_normalMode != ewol::Mesh::normalModeVertex) {
|
||||||
for(size_t iii=0 ; iii<m_listVertex.size() ; iii++) {
|
for(size_t iii=0 ; iii<m_listVertex.size() ; iii++) {
|
||||||
@ -221,7 +221,7 @@ void ewol::Mesh::calculateNormaleEdge(void) {
|
|||||||
//#define PRINT_HALF (1)
|
//#define PRINT_HALF (1)
|
||||||
//#define TRY_MINIMAL_VBO
|
//#define TRY_MINIMAL_VBO
|
||||||
|
|
||||||
void ewol::Mesh::generateVBO(void) {
|
void ewol::resource::Mesh::generateVBO(void) {
|
||||||
// calculate the normal of all faces if needed
|
// calculate the normal of all faces if needed
|
||||||
if (m_normalMode == ewol::Mesh::normalModeNone) {
|
if (m_normalMode == ewol::Mesh::normalModeNone) {
|
||||||
// when no normal detected == > auto generate Face normal ....
|
// when no normal detected == > auto generate Face normal ....
|
||||||
@ -284,7 +284,7 @@ void ewol::Mesh::generateVBO(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Mesh::createViewBox(const std::string& _materialName,float _size) {
|
void ewol::resource::Mesh::createViewBox(const std::string& _materialName,float _size) {
|
||||||
m_normalMode = ewol::Mesh::normalModeNone;
|
m_normalMode = ewol::Mesh::normalModeNone;
|
||||||
// This is the direct generation basis on the .obj system
|
// This is the direct generation basis on the .obj system
|
||||||
/*
|
/*
|
||||||
@ -377,7 +377,7 @@ void ewol::Mesh::createViewBox(const std::string& _materialName,float _size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Mesh::loadOBJ(const std::string& _fileName) {
|
bool ewol::resource::Mesh::loadOBJ(const std::string& _fileName) {
|
||||||
m_normalMode = ewol::Mesh::normalModeNone;
|
m_normalMode = ewol::Mesh::normalModeNone;
|
||||||
#if 0
|
#if 0
|
||||||
etk::FSNode fileName(_fileName);
|
etk::FSNode fileName(_fileName);
|
||||||
@ -626,7 +626,7 @@ enum emfModuleMode {
|
|||||||
EMFModuleMaterial_END,
|
EMFModuleMaterial_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ewol::Mesh::loadEMF(const std::string& _fileName) {
|
bool ewol::resource::Mesh::loadEMF(const std::string& _fileName) {
|
||||||
m_checkNormal = true;
|
m_checkNormal = true;
|
||||||
m_normalMode = ewol::Mesh::normalModeNone;
|
m_normalMode = ewol::Mesh::normalModeNone;
|
||||||
etk::FSNode fileName(_fileName);
|
etk::FSNode fileName(_fileName);
|
||||||
@ -992,7 +992,7 @@ bool ewol::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Mesh::addMaterial(const std::string& _name, ewol::Material* _data) {
|
void ewol::resource::Mesh::addMaterial(const std::string& _name, ewol::Material* _data) {
|
||||||
if (NULL == _data) {
|
if (NULL == _data) {
|
||||||
EWOL_ERROR(" can not add material with null pointer");
|
EWOL_ERROR(" can not add material with null pointer");
|
||||||
return;
|
return;
|
||||||
@ -1005,7 +1005,7 @@ void ewol::Mesh::addMaterial(const std::string& _name, ewol::Material* _data) {
|
|||||||
m_materials.add(_name, _data);
|
m_materials.add(_name, _data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Mesh::setShape(void* _shape) {
|
void ewol::resource::Mesh::setShape(void* _shape) {
|
||||||
if (m_functionFreeShape!=NULL) {
|
if (m_functionFreeShape!=NULL) {
|
||||||
m_functionFreeShape(m_pointerShape);
|
m_functionFreeShape(m_pointerShape);
|
||||||
m_pointerShape = NULL;
|
m_pointerShape = NULL;
|
||||||
@ -1013,13 +1013,13 @@ void ewol::Mesh::setShape(void* _shape) {
|
|||||||
m_pointerShape=_shape;
|
m_pointerShape=_shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Mesh* ewol::Mesh::keep(const std::string& _meshName) {
|
ewol::resource::Mesh* ewol::resource::Mesh::keep(const std::string& _meshName) {
|
||||||
ewol::Mesh* object = static_cast<ewol::Mesh*>(getManager().localKeep(_meshName));
|
ewol::resource::Mesh* object = static_cast<ewol::resource::Mesh*>(getManager().localKeep(_meshName));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("CREATE: Mesh: '" << _meshName << "'");
|
EWOL_DEBUG("CREATE: Mesh: '" << _meshName << "'");
|
||||||
object = new ewol::Mesh(_meshName);
|
object = new ewol::resource::Mesh(_meshName);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
|
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1028,11 +1028,11 @@ ewol::Mesh* ewol::Mesh::keep(const std::string& _meshName) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Mesh::release(ewol::Mesh*& _object) {
|
void ewol::resource::Mesh::release(ewol::Mesh*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define MESH_VBO_COLOR (4)
|
#define MESH_VBO_COLOR (4)
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
class Face {
|
class Face {
|
||||||
public:
|
public:
|
||||||
int32_t m_vertex[3];
|
int32_t m_vertex[3];
|
||||||
@ -70,7 +71,7 @@ namespace ewol {
|
|||||||
std::vector<Face> m_faces;
|
std::vector<Face> m_faces;
|
||||||
std::vector<uint32_t> m_index;
|
std::vector<uint32_t> m_index;
|
||||||
};
|
};
|
||||||
class Mesh : public ewol::Resource {
|
class Mesh : public ewol::resource::Resource {
|
||||||
public:
|
public:
|
||||||
enum normalMode {
|
enum normalMode {
|
||||||
normalModeNone,
|
normalModeNone,
|
||||||
@ -161,6 +162,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::Mesh*& _object);
|
static void release(ewol::Mesh*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
#define LOCAL_DEBUG EWOL_DEBUG
|
#define LOCAL_DEBUG EWOL_DEBUG
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Program"
|
#define __class__ "resource::Program"
|
||||||
|
|
||||||
ewol::Program::Program(const std::string& _filename) :
|
ewol::resource::resource::Program::Program(const std::string& _filename) :
|
||||||
ewol::Resource(_filename),
|
ewol::resource::Resource(_filename),
|
||||||
m_exist(false),
|
m_exist(false),
|
||||||
m_program(0),
|
m_program(0),
|
||||||
m_hasTexture(false),
|
m_hasTexture(false),
|
||||||
@ -95,7 +95,7 @@ ewol::Program::Program(const std::string& _filename) :
|
|||||||
updateContext();
|
updateContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Program::~Program(void) {
|
ewol::resource::Program::~Program(void) {
|
||||||
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
|
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
|
||||||
ewol::Shader::release(m_shaderList[iii]);
|
ewol::Shader::release(m_shaderList[iii]);
|
||||||
m_shaderList[iii] = 0;
|
m_shaderList[iii] = 0;
|
||||||
@ -116,7 +116,7 @@ static void checkGlError(const char* _op, int32_t _localLine) {
|
|||||||
#define LOG_OGL_INTERNAL_BUFFER_LEN (8192)
|
#define LOG_OGL_INTERNAL_BUFFER_LEN (8192)
|
||||||
static char l_bufferDisplayError[LOG_OGL_INTERNAL_BUFFER_LEN] = "";
|
static char l_bufferDisplayError[LOG_OGL_INTERNAL_BUFFER_LEN] = "";
|
||||||
|
|
||||||
int32_t ewol::Program::getAttribute(std::string _elementName) {
|
int32_t ewol::resource::Program::getAttribute(std::string _elementName) {
|
||||||
// check if it exist previously :
|
// check if it exist previously :
|
||||||
for(size_t iii=0; iii<m_elementList.size(); iii++) {
|
for(size_t iii=0; iii<m_elementList.size(); iii++) {
|
||||||
if (m_elementList[iii].m_name == _elementName) {
|
if (m_elementList[iii].m_name == _elementName) {
|
||||||
@ -137,7 +137,7 @@ int32_t ewol::Program::getAttribute(std::string _elementName) {
|
|||||||
return m_elementList.size()-1;
|
return m_elementList.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::Program::getUniform(std::string _elementName) {
|
int32_t ewol::resource::Program::getUniform(std::string _elementName) {
|
||||||
// check if it exist previously :
|
// check if it exist previously :
|
||||||
for(size_t iii=0; iii<m_elementList.size(); iii++) {
|
for(size_t iii=0; iii<m_elementList.size(); iii++) {
|
||||||
if (m_elementList[iii].m_name == _elementName) {
|
if (m_elementList[iii].m_name == _elementName) {
|
||||||
@ -158,7 +158,7 @@ int32_t ewol::Program::getUniform(std::string _elementName) {
|
|||||||
return m_elementList.size()-1;
|
return m_elementList.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Program::updateContext(void) {
|
void ewol::resource::Program::updateContext(void) {
|
||||||
if (true == m_exist) {
|
if (true == m_exist) {
|
||||||
// Do nothing == > too dangerous ...
|
// Do nothing == > too dangerous ...
|
||||||
} else {
|
} else {
|
||||||
@ -246,7 +246,7 @@ void ewol::Program::updateContext(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Program::removeContext(void) {
|
void ewol::resource::Program::removeContext(void) {
|
||||||
if (true == m_exist) {
|
if (true == m_exist) {
|
||||||
glDeleteProgram(m_program);
|
glDeleteProgram(m_program);
|
||||||
m_program = 0;
|
m_program = 0;
|
||||||
@ -257,12 +257,12 @@ void ewol::Program::removeContext(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Program::removeContextToLate(void) {
|
void ewol::resource::Program::removeContextToLate(void) {
|
||||||
m_exist = false;
|
m_exist = false;
|
||||||
m_program = 0;
|
m_program = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Program::reload(void) {
|
void ewol::resource::Program::reload(void) {
|
||||||
/* TODO : ...
|
/* TODO : ...
|
||||||
etk::file file(m_name, etk::FILE_TYPE_DATA);
|
etk::file file(m_name, etk::FILE_TYPE_DATA);
|
||||||
if (false == file.Exist()) {
|
if (false == file.Exist()) {
|
||||||
@ -303,7 +303,7 @@ void ewol::Program::reload(void) {
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ewol::Program::sendAttribute(int32_t _idElem,
|
void ewol::resource::Program::sendAttribute(int32_t _idElem,
|
||||||
int32_t _nbElement,
|
int32_t _nbElement,
|
||||||
void* _pointer,
|
void* _pointer,
|
||||||
int32_t _jumpBetweenSample) {
|
int32_t _jumpBetweenSample) {
|
||||||
@ -328,9 +328,9 @@ void ewol::Program::sendAttribute(int32_t _idElem,
|
|||||||
//checkGlError("glEnableVertexAttribArray", __LINE__);
|
//checkGlError("glEnableVertexAttribArray", __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Program::sendAttributePointer(int32_t _idElem,
|
void ewol::resource::Program::sendAttributePointer(int32_t _idElem,
|
||||||
int32_t _nbElement,
|
int32_t _nbElement,
|
||||||
ewol::VirtualBufferObject* _vbo,
|
ewol::resource::VirtualBufferObject* _vbo,
|
||||||
int32_t _index,
|
int32_t _index,
|
||||||
int32_t _jumpBetweenSample,
|
int32_t _jumpBetweenSample,
|
||||||
int32_t _offset) {
|
int32_t _offset) {
|
||||||
@ -358,7 +358,7 @@ void ewol::Program::sendAttributePointer(int32_t _idElem,
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ewol::Program::uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _matrix, bool _transpose) {
|
void ewol::resource::Program::uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _matrix, bool _transpose) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ void ewol::Program::uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ewol::Program::uniform1f(int32_t _idElem, float _value1) {
|
void ewol::resource::Program::uniform1f(int32_t _idElem, float _value1) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -393,7 +393,7 @@ void ewol::Program::uniform1f(int32_t _idElem, float _value1) {
|
|||||||
glUniform1f(m_elementList[_idElem].m_elementId, _value1);
|
glUniform1f(m_elementList[_idElem].m_elementId, _value1);
|
||||||
//checkGlError("glUniform1f", __LINE__);
|
//checkGlError("glUniform1f", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform2f(int32_t _idElem, float _value1, float _value2) {
|
void ewol::resource::Program::uniform2f(int32_t _idElem, float _value1, float _value2) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ void ewol::Program::uniform2f(int32_t _idElem, float _value1, float _value2) {
|
|||||||
glUniform2f(m_elementList[_idElem].m_elementId, _value1, _value2);
|
glUniform2f(m_elementList[_idElem].m_elementId, _value1, _value2);
|
||||||
//checkGlError("glUniform2f", __LINE__);
|
//checkGlError("glUniform2f", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform3f(int32_t _idElem, float _value1, float _value2, float _value3) {
|
void ewol::resource::Program::uniform3f(int32_t _idElem, float _value1, float _value2, float _value3) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ void ewol::Program::uniform3f(int32_t _idElem, float _value1, float _value2, flo
|
|||||||
glUniform3f(m_elementList[_idElem].m_elementId, _value1, _value2, _value3);
|
glUniform3f(m_elementList[_idElem].m_elementId, _value1, _value2, _value3);
|
||||||
//checkGlError("glUniform3f", __LINE__);
|
//checkGlError("glUniform3f", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform4f(int32_t _idElem, float _value1, float _value2, float _value3, float _value4) {
|
void ewol::resource::Program::uniform4f(int32_t _idElem, float _value1, float _value2, float _value3, float _value4) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -438,7 +438,7 @@ void ewol::Program::uniform4f(int32_t _idElem, float _value1, float _value2, flo
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ewol::Program::uniform1i(int32_t _idElem, int32_t _value1) {
|
void ewol::resource::Program::uniform1i(int32_t _idElem, int32_t _value1) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -452,7 +452,7 @@ void ewol::Program::uniform1i(int32_t _idElem, int32_t _value1) {
|
|||||||
glUniform1i(m_elementList[_idElem].m_elementId, _value1);
|
glUniform1i(m_elementList[_idElem].m_elementId, _value1);
|
||||||
//checkGlError("glUniform1i", __LINE__);
|
//checkGlError("glUniform1i", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_t _value2) {
|
void ewol::resource::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_t _value2) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ void ewol::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_t _value2)
|
|||||||
glUniform2i(m_elementList[_idElem].m_elementId, _value1, _value2);
|
glUniform2i(m_elementList[_idElem].m_elementId, _value1, _value2);
|
||||||
//checkGlError("glUniform2i", __LINE__);
|
//checkGlError("glUniform2i", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3) {
|
void ewol::resource::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ void ewol::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_t _value2,
|
|||||||
glUniform3i(m_elementList[_idElem].m_elementId, _value1, _value2, _value3);
|
glUniform3i(m_elementList[_idElem].m_elementId, _value1, _value2, _value3);
|
||||||
//checkGlError("glUniform3i", __LINE__);
|
//checkGlError("glUniform3i", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3, int32_t _value4) {
|
void ewol::resource::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3, int32_t _value4) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -498,7 +498,7 @@ void ewol::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_t _value2,
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ewol::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
void ewol::resource::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ void ewol::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, const float
|
|||||||
glUniform1fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
glUniform1fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
||||||
//checkGlError("glUniform1fv", __LINE__);
|
//checkGlError("glUniform1fv", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
void ewol::resource::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -542,7 +542,7 @@ void ewol::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, const float
|
|||||||
glUniform2fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
glUniform2fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
||||||
//checkGlError("glUniform2fv", __LINE__);
|
//checkGlError("glUniform2fv", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
void ewol::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ void ewol::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, const float
|
|||||||
glUniform3fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
glUniform3fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
||||||
//checkGlError("glUniform3fv", __LINE__);
|
//checkGlError("glUniform3fv", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
void ewol::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, const float *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -589,7 +589,7 @@ void ewol::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, const float
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ewol::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
void ewol::resource::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ void ewol::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, const int32_
|
|||||||
glUniform1iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
glUniform1iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
||||||
//checkGlError("glUniform1iv", __LINE__);
|
//checkGlError("glUniform1iv", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
void ewol::resource::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -633,7 +633,7 @@ void ewol::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, const int32_
|
|||||||
glUniform2iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
glUniform2iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
||||||
//checkGlError("glUniform2iv", __LINE__);
|
//checkGlError("glUniform2iv", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
void ewol::resource::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -655,7 +655,7 @@ void ewol::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, const int32_
|
|||||||
glUniform3iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
glUniform3iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
|
||||||
//checkGlError("glUniform3iv", __LINE__);
|
//checkGlError("glUniform3iv", __LINE__);
|
||||||
}
|
}
|
||||||
void ewol::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
void ewol::resource::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -686,7 +686,7 @@ void ewol::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, const int32_
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void ewol::Program::use(void) {
|
void ewol::resource::Program::use(void) {
|
||||||
#ifdef PROGRAM_DISPLAY_SPEED
|
#ifdef PROGRAM_DISPLAY_SPEED
|
||||||
g_startTime = ewol::getTime();
|
g_startTime = ewol::getTime();
|
||||||
#endif
|
#endif
|
||||||
@ -696,7 +696,7 @@ void ewol::Program::use(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Program::setTexture0(int32_t _idElem, GLint _textureOpenGlID) {
|
void ewol::resource::Program::setTexture0(int32_t _idElem, GLint _textureOpenGlID) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -721,7 +721,7 @@ void ewol::Program::setTexture0(int32_t _idElem, GLint _textureOpenGlID) {
|
|||||||
m_hasTexture = true;
|
m_hasTexture = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Program::setTexture1(int32_t _idElem, GLint _textureOpenGlID) {
|
void ewol::resource::Program::setTexture1(int32_t _idElem, GLint _textureOpenGlID) {
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -747,7 +747,7 @@ void ewol::Program::setTexture1(int32_t _idElem, GLint _textureOpenGlID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Program::unUse(void) {
|
void ewol::resource::Program::unUse(void) {
|
||||||
//EWOL_WARNING("Will use program : " << m_program);
|
//EWOL_WARNING("Will use program : " << m_program);
|
||||||
if (0 == m_program) {
|
if (0 == m_program) {
|
||||||
return;
|
return;
|
||||||
@ -774,9 +774,9 @@ void ewol::Program::unUse(void) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::Program* ewol::Program::keep(const std::string& _filename) {
|
ewol::resource::Program* ewol::resource::Program::keep(const std::string& _filename) {
|
||||||
EWOL_VERBOSE("KEEP : Program : file : \"" << _filename << "\"");
|
EWOL_VERBOSE("KEEP : Program : file : \"" << _filename << "\"");
|
||||||
ewol::Program* object = static_cast<ewol::Program*>(getManager().localKeep(_filename));
|
ewol::resource::Program* object = static_cast<ewol::resource::Program*>(getManager().localKeep(_filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -791,11 +791,11 @@ ewol::Program* ewol::Program::keep(const std::string& _filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Program::release(ewol::Program*& _object) {
|
void ewol::resource::Program::release(ewol::resource::Program*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
@ -18,6 +18,7 @@
|
|||||||
#include <ewol/resources/VirtualBufferObject.h>
|
#include <ewol/resources/VirtualBufferObject.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
/**
|
/**
|
||||||
* @brief In a openGL program we need some data to communicate with them, we register all the name requested by the user in this structure:
|
* @brief In a openGL program we need some data to communicate with them, we register all the name requested by the user in this structure:
|
||||||
* @note Register all requested element permit to abstract the fact that some element does not exist and remove control of existance from upper code.
|
* @note Register all requested element permit to abstract the fact that some element does not exist and remove control of existance from upper code.
|
||||||
@ -43,7 +44,7 @@ namespace ewol {
|
|||||||
* filename4.frag
|
* filename4.frag
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
class Program : public ewol::Resource {
|
class Program : public ewol::resource::Resource {
|
||||||
private :
|
private :
|
||||||
bool m_exist; //!< the file existed
|
bool m_exist; //!< the file existed
|
||||||
GLuint m_program; //!< openGL id of the current program
|
GLuint m_program; //!< openGL id of the current program
|
||||||
@ -279,6 +280,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::Program*& _object);
|
static void release(ewol::Program*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,22 +15,22 @@
|
|||||||
#include <ewol/renderer/eContext.h>
|
#include <ewol/renderer/eContext.h>
|
||||||
|
|
||||||
|
|
||||||
void ewol::Resource::updateContext(void) {
|
void ewol::resource::Resource::updateContext(void) {
|
||||||
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Resource::removeContext(void) {
|
void ewol::resource::Resource::removeContext(void) {
|
||||||
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Resource::removeContextToLate(void) {
|
void ewol::resource::Resource::removeContextToLate(void) {
|
||||||
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Resource::reload(void) {
|
void ewol::resource::Resource::reload(void) {
|
||||||
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::ResourceManager& ewol::Resource::getManager(void) {
|
ewol::resource::Manager& ewol::resource::Resource::getManager(void) {
|
||||||
return ewol::getContext().getResourcesManager();
|
return ewol::getContext().getResourcesManager();
|
||||||
}
|
}
|
@ -18,7 +18,8 @@
|
|||||||
#define MAX_RESOURCE_LEVEL (5)
|
#define MAX_RESOURCE_LEVEL (5)
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class ResourceManager;
|
namespace resource {
|
||||||
|
class Manager;
|
||||||
// class resources is pure virtual
|
// class resources is pure virtual
|
||||||
class Resource : public ewol::EObject {
|
class Resource : public ewol::EObject {
|
||||||
public:
|
public:
|
||||||
@ -61,7 +62,8 @@ namespace ewol {
|
|||||||
virtual void removeContext(void);
|
virtual void removeContext(void);
|
||||||
virtual void removeContextToLate(void);
|
virtual void removeContextToLate(void);
|
||||||
virtual void reload(void);
|
virtual void reload(void);
|
||||||
static ewol::ResourceManager& getManager(void);
|
static ewol::resource::Manager& getManager(void);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __RESOURCES_MANAGER_H__
|
|
||||||
#define __RESOURCES_MANAGER_H__
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
#include <ewol/resources/Resource.h>
|
|
||||||
#include <ewol/resources/Shader.h>
|
|
||||||
#include <ewol/resources/Program.h>
|
|
||||||
#include <ewol/resources/VirtualBufferObject.h>
|
|
||||||
#include <ewol/resources/ConfigFile.h>
|
|
||||||
#include <ewol/resources/TexturedFont.h>
|
|
||||||
#include <ewol/resources/Texture.h>
|
|
||||||
#include <ewol/resources/Image.h>
|
|
||||||
#include <ewol/resources/Mesh.h>
|
|
||||||
#include <ewol/resources/Colored3DObject.h>
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
class ResourceManager {
|
|
||||||
private:
|
|
||||||
std::vector<ewol::Resource*> m_resourceList;
|
|
||||||
std::vector<ewol::Resource*> m_resourceListToUpdate;
|
|
||||||
bool m_contextHasBeenRemoved;
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief initialize the internal variable
|
|
||||||
*/
|
|
||||||
ResourceManager(void);
|
|
||||||
/**
|
|
||||||
* @brief Uninitiamize the resource manager, free all resources previously requested
|
|
||||||
* @note when not free == > generate warning, because the segfault can appear after...
|
|
||||||
*/
|
|
||||||
~ResourceManager(void);
|
|
||||||
/**
|
|
||||||
* @brief remove all resources (un-init) out of the destructor (due to the system implementation)
|
|
||||||
*/
|
|
||||||
void unInit(void);
|
|
||||||
/**
|
|
||||||
* @brief display in the log all the resources loaded ...
|
|
||||||
*/
|
|
||||||
void display(void);
|
|
||||||
/**
|
|
||||||
* @brief Reload all resources from files, and send there in openGL card if needed.
|
|
||||||
* @note If file is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
|
|
||||||
*/
|
|
||||||
void reLoadResources(void);
|
|
||||||
/**
|
|
||||||
* @brief Call by the system to send all the needed data on the graphic card chen they change ...
|
|
||||||
* @param[in] _object The resources that might be updated
|
|
||||||
*/
|
|
||||||
void update(ewol::Resource* _object);
|
|
||||||
/**
|
|
||||||
* @brief Call by the system chen the openGL Context has been unexpectially removed == > This reload all the texture, VBO and other ....
|
|
||||||
*/
|
|
||||||
void updateContext(void);
|
|
||||||
/**
|
|
||||||
* @brief This is to inform the resources manager that we have no more openGl context ...
|
|
||||||
*/
|
|
||||||
void contextHasBeenDestroyed(void);
|
|
||||||
public:
|
|
||||||
// internal API to extent eResources in extern Soft
|
|
||||||
ewol::Resource* localKeep(const std::string& _filename);
|
|
||||||
void localAdd(ewol::Resource* _object);
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief release a resources and free it if the Last release is call.
|
|
||||||
* @param[in,out] _object element to realease == > is return at NULL value.
|
|
||||||
* @return true, if element is removed, and false for just decreasing counter
|
|
||||||
*/
|
|
||||||
bool release(ewol::Resource*& _object);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -13,10 +13,10 @@
|
|||||||
#include <ewol/resources/ResourceManager.h>
|
#include <ewol/resources/ResourceManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Shader"
|
#define __class__ "resource::Shader"
|
||||||
|
|
||||||
ewol::Shader::Shader(const std::string& _filename) :
|
ewol::resource::Shader::Shader(const std::string& _filename) :
|
||||||
ewol::Resource(_filename),
|
ewol::resource::Resource(_filename),
|
||||||
m_exist(false),
|
m_exist(false),
|
||||||
m_fileData(NULL),
|
m_fileData(NULL),
|
||||||
m_shader(0),
|
m_shader(0),
|
||||||
@ -37,7 +37,7 @@ ewol::Shader::Shader(const std::string& _filename) :
|
|||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Shader::~Shader(void) {
|
ewol::resource::Shader::~Shader(void) {
|
||||||
if (NULL != m_fileData) {
|
if (NULL != m_fileData) {
|
||||||
delete [] m_fileData;
|
delete [] m_fileData;
|
||||||
m_fileData = NULL;
|
m_fileData = NULL;
|
||||||
@ -57,7 +57,7 @@ static void checkGlError(const char* _op) {
|
|||||||
#define LOG_OGL_INTERNAL_BUFFER_LEN (8192)
|
#define LOG_OGL_INTERNAL_BUFFER_LEN (8192)
|
||||||
static char l_bufferDisplayError[LOG_OGL_INTERNAL_BUFFER_LEN] = "";
|
static char l_bufferDisplayError[LOG_OGL_INTERNAL_BUFFER_LEN] = "";
|
||||||
|
|
||||||
void ewol::Shader::updateContext(void) {
|
void ewol::resource::Shader::updateContext(void) {
|
||||||
if (true == m_exist) {
|
if (true == m_exist) {
|
||||||
// Do nothing == > too dangerous ...
|
// Do nothing == > too dangerous ...
|
||||||
} else {
|
} else {
|
||||||
@ -98,7 +98,7 @@ void ewol::Shader::updateContext(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shader::removeContext(void) {
|
void ewol::resource::Shader::removeContext(void) {
|
||||||
if (true == m_exist) {
|
if (true == m_exist) {
|
||||||
glDeleteShader(m_shader);
|
glDeleteShader(m_shader);
|
||||||
m_exist = false;
|
m_exist = false;
|
||||||
@ -106,12 +106,12 @@ void ewol::Shader::removeContext(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shader::removeContextToLate(void) {
|
void ewol::resource::Shader::removeContextToLate(void) {
|
||||||
m_exist = false;
|
m_exist = false;
|
||||||
m_shader = 0;
|
m_shader = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shader::reload(void) {
|
void ewol::resource::Shader::reload(void) {
|
||||||
etk::FSNode file(m_name);
|
etk::FSNode file(m_name);
|
||||||
if (false == file.exist()) {
|
if (false == file.exist()) {
|
||||||
EWOL_ERROR("File does not Exist : \"" << file << "\"");
|
EWOL_ERROR("File does not Exist : \"" << file << "\"");
|
||||||
@ -149,14 +149,14 @@ void ewol::Shader::reload(void) {
|
|||||||
updateContext();
|
updateContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Shader* ewol::Shader::keep(const std::string& _filename) {
|
ewol::resource::Shader* ewol::resource::Shader::keep(const std::string& _filename) {
|
||||||
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << _filename << "\"");
|
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << _filename << "\"");
|
||||||
ewol::Shader* object = static_cast<ewol::Shader*>(getManager().localKeep(_filename));
|
ewol::resource::Shader* object = static_cast<ewol::resource::Shader*>(getManager().localKeep(_filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
// need to crate a new one ...
|
// need to crate a new one ...
|
||||||
object = new ewol::Shader(_filename);
|
object = new ewol::resource::Shader(_filename);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -165,11 +165,11 @@ ewol::Shader* ewol::Shader::keep(const std::string& _filename) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Shader::release(ewol::Shader*& _object) {
|
void ewol::resource::Shader::release(ewol::resource::Shader*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,11 @@
|
|||||||
#include <ewol/resources/Resource.h>
|
#include <ewol/resources/Resource.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
/**
|
/**
|
||||||
* @brief Shader is a specific resources for opengl, used only in @ref Program. This are components of the renderer pipe-line
|
* @brief Shader is a specific resources for opengl, used only in @ref Program. This are components of the renderer pipe-line
|
||||||
*/
|
*/
|
||||||
class Shader : public ewol::Resource {
|
class Shader : public ewol::resource::Resource {
|
||||||
private :
|
private :
|
||||||
bool m_exist; //!< The shader file existed and has been loaded
|
bool m_exist; //!< The shader file existed and has been loaded
|
||||||
char* m_fileData; //!< A copy of the data loaded from the file (usefull only when opengl context is removed)
|
char* m_fileData; //!< A copy of the data loaded from the file (usefull only when opengl context is removed)
|
||||||
@ -81,6 +82,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::Shader*& _object);
|
static void release(ewol::Shader*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <ewol/renderer/eContext.h>
|
#include <ewol/renderer/eContext.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Texture"
|
#define __class__ "resource::Texture"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the next power 2 if the input
|
* @brief get the next power 2 if the input
|
||||||
@ -34,26 +34,26 @@ static int32_t nextP2(int32_t _value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Texture::Texture(const std::string& _filename) :
|
ewol::resource::Texture::Texture(const std::string& _filename) :
|
||||||
ewol::Resource(_filename) {
|
ewol::resource::Resource(_filename) {
|
||||||
addObjectType("ewol::Texture");
|
addObjectType("ewol::Texture");
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
m_texId = 0;
|
m_texId = 0;
|
||||||
m_endPointSize.setValue(1.0,1.0);
|
m_endPointSize.setValue(1.0,1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Texture::Texture(void) {
|
ewol::resource::Texture::Texture(void) {
|
||||||
addObjectType("ewol::Texture");
|
addObjectType("ewol::Texture");
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
m_texId = 0;
|
m_texId = 0;
|
||||||
m_endPointSize.setValue(1.0,1.0);
|
m_endPointSize.setValue(1.0,1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Texture::~Texture(void) {
|
ewol::resource::Texture::~Texture(void) {
|
||||||
removeContext();
|
removeContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Texture::updateContext(void) {
|
void ewol::resource::Texture::updateContext(void) {
|
||||||
if (false == m_loaded) {
|
if (false == m_loaded) {
|
||||||
// Request a new texture at openGl :
|
// Request a new texture at openGl :
|
||||||
glGenTextures(1, &m_texId);
|
glGenTextures(1, &m_texId);
|
||||||
@ -84,7 +84,7 @@ void ewol::Texture::updateContext(void) {
|
|||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Texture::removeContext(void) {
|
void ewol::resource::Texture::removeContext(void) {
|
||||||
if (true == m_loaded) {
|
if (true == m_loaded) {
|
||||||
// Request remove texture ...
|
// Request remove texture ...
|
||||||
EWOL_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
|
EWOL_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
|
||||||
@ -93,24 +93,24 @@ void ewol::Texture::removeContext(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Texture::removeContextToLate(void) {
|
void ewol::resource::Texture::removeContextToLate(void) {
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
m_texId=0;
|
m_texId=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Texture::flush(void) {
|
void ewol::resource::Texture::flush(void) {
|
||||||
// request to the manager to be call at the next update ...
|
// request to the manager to be call at the next update ...
|
||||||
getManager().update(this);
|
getManager().update(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Texture::setImageSize(ivec2 _newSize) {
|
void ewol::resource::Texture::setImageSize(ivec2 _newSize) {
|
||||||
_newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) );
|
_newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) );
|
||||||
m_data.resize(_newSize);
|
m_data.resize(_newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Texture* ewol::Texture::keep(void) {
|
ewol::resource::Texture* ewol::resource::Texture::keep(void) {
|
||||||
// this element create a new one every time ....
|
// this element create a new one every time ....
|
||||||
ewol::Texture* object = new ewol::Texture();
|
ewol::resource::Texture* object = new ewol::resource::Texture();
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -119,11 +119,11 @@ ewol::Texture* ewol::Texture::keep(void) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Texture::release(ewol::Texture*& _object) {
|
void ewol::resource::Texture::release(ewol::resource::Texture*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/resources/Resource.h>
|
#include <ewol/resources/Resource.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Texture : public ewol::Resource {
|
namespace resource {
|
||||||
|
class Texture : public ewol::resource::Resource {
|
||||||
protected:
|
protected:
|
||||||
// openGl Context propoerties :
|
// openGl Context propoerties :
|
||||||
egami::Image m_data;
|
egami::Image m_data;
|
||||||
@ -61,7 +62,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::Texture*& _object);
|
static void release(ewol::Texture*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,10 +40,10 @@ etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::font::mode _obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TexturedFont"
|
#define __class__ "resource::TexturedFont"
|
||||||
|
|
||||||
ewol::TexturedFont::TexturedFont(const std::string& _fontName) :
|
ewol::resource::TexturedFont::TexturedFont(const std::string& _fontName) :
|
||||||
ewol::Texture(_fontName) {
|
ewol::resource::Texture(_fontName) {
|
||||||
addObjectType("ewol::TexturedFont");
|
addObjectType("ewol::TexturedFont");
|
||||||
m_font[0] = NULL;
|
m_font[0] = NULL;
|
||||||
m_font[1] = NULL;
|
m_font[1] = NULL;
|
||||||
@ -217,13 +217,13 @@ ewol::TexturedFont::TexturedFont(const std::string& _fontName) :
|
|||||||
EWOL_DEBUG(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic));
|
EWOL_DEBUG(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic));
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::TexturedFont::~TexturedFont(void) {
|
ewol::resource::TexturedFont::~TexturedFont(void) {
|
||||||
for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) {
|
for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) {
|
||||||
ewol::FontFreeType::release(m_font[iiiFontId]);
|
ewol::FontFreeType::release(m_font[iiiFontId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::TexturedFont::addGlyph(const char32_t& _val) {
|
bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
|
||||||
bool hasChange = false;
|
bool hasChange = false;
|
||||||
// for each font :
|
// for each font :
|
||||||
for (int32_t iii=0; iii<4 ; iii++) {
|
for (int32_t iii=0; iii<4 ; iii++) {
|
||||||
@ -291,7 +291,7 @@ bool ewol::TexturedFont::addGlyph(const char32_t& _val) {
|
|||||||
return hasChange;
|
return hasChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::TexturedFont::getIndex(char32_t _charcode, const enum ewol::font::mode _displayMode) {
|
int32_t ewol::resource::TexturedFont::getIndex(char32_t _charcode, const enum ewol::font::mode _displayMode) {
|
||||||
if (_charcode < 0x20) {
|
if (_charcode < 0x20) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (_charcode < 0x80) {
|
} else if (_charcode < 0x80) {
|
||||||
@ -317,7 +317,7 @@ int32_t ewol::TexturedFont::getIndex(char32_t _charcode, const enum ewol::font::
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::GlyphProperty* ewol::TexturedFont::getGlyphPointer(const char32_t& _charcode, const enum ewol::font::mode _displayMode) {
|
ewol::resource::GlyphProperty* ewol::resource::TexturedFont::getGlyphPointer(const char32_t& _charcode, const enum ewol::font::mode _displayMode) {
|
||||||
//EWOL_DEBUG("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]);
|
//EWOL_DEBUG("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]);
|
||||||
int32_t index = getIndex(_charcode, _displayMode);
|
int32_t index = getIndex(_charcode, _displayMode);
|
||||||
if( index < 0
|
if( index < 0
|
||||||
@ -336,15 +336,15 @@ ewol::GlyphProperty* ewol::TexturedFont::getGlyphPointer(const char32_t& _charco
|
|||||||
return &((m_listElement[_displayMode])[index]);
|
return &((m_listElement[_displayMode])[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::TexturedFont* ewol::TexturedFont::keep(const std::string& _filename) {
|
ewol::resource::TexturedFont* ewol::resource::TexturedFont::keep(const std::string& _filename) {
|
||||||
EWOL_VERBOSE("KEEP : TexturedFont : file : '" << _filename << "'");
|
EWOL_VERBOSE("KEEP : TexturedFont : file : '" << _filename << "'");
|
||||||
ewol::TexturedFont* object = static_cast<ewol::TexturedFont*>(getManager().localKeep(_filename));
|
ewol::resource::TexturedFont* object = static_cast<ewol::resource::TexturedFont*>(getManager().localKeep(_filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
// need to crate a new one ...
|
// need to crate a new one ...
|
||||||
EWOL_DEBUG("CREATE: TexturedFont : file : '" << _filename << "'");
|
EWOL_DEBUG("CREATE: TexturedFont : file : '" << _filename << "'");
|
||||||
object = new ewol::TexturedFont(_filename);
|
object = new ewol::resource::TexturedFont(_filename);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -353,13 +353,13 @@ ewol::TexturedFont* ewol::TexturedFont::keep(const std::string& _filename) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::TexturedFont::release(ewol::TexturedFont*& _object) {
|
void ewol::resource::TexturedFont::release(ewol::resource::TexturedFont*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string name = _object->getName();
|
std::string name = _object->getName();
|
||||||
int32_t count = _object->getCounter() - 1;
|
int32_t count = _object->getCounter() - 1;
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
if (getManager().release(object2) == true) {
|
if (getManager().release(object2) == true) {
|
||||||
EWOL_DEBUG("REMOVE: TexturedFont : file : '" << name << "' count=" << count);
|
EWOL_DEBUG("REMOVE: TexturedFont : file : '" << name << "' count=" << count);
|
||||||
//etk::displayBacktrace(false);
|
//etk::displayBacktrace(false);
|
||||||
|
@ -24,7 +24,8 @@ namespace ewol {
|
|||||||
};
|
};
|
||||||
etk::CCout& operator <<(etk::CCout& _os, enum ewol::font::mode _obj);
|
etk::CCout& operator <<(etk::CCout& _os, enum ewol::font::mode _obj);
|
||||||
|
|
||||||
class TexturedFont : public ewol::Texture {
|
namespace resource {
|
||||||
|
class TexturedFont : public ewol::resource::Texture {
|
||||||
private:
|
private:
|
||||||
std::string m_fileName[4];
|
std::string m_fileName[4];
|
||||||
int32_t m_size;
|
int32_t m_size;
|
||||||
@ -106,8 +107,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
bool addGlyph(const char32_t& _val);
|
bool addGlyph(const char32_t& _val);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
#include <ewol/renderer/eContext.h>
|
#include <ewol/renderer/eContext.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "VirtualBufferObject"
|
#define __class__ "resource::VirtualBufferObject"
|
||||||
|
|
||||||
ewol::VirtualBufferObject::VirtualBufferObject(int32_t _number) :
|
ewol::resource::VirtualBufferObject::VirtualBufferObject(int32_t _number) :
|
||||||
m_exist(false) {
|
m_exist(false) {
|
||||||
addObjectType("ewol::VirtualBufferObject");
|
addObjectType("ewol::VirtualBufferObject");
|
||||||
m_nbVBO = etk_avg(1, _number, NB_VBO_MAX);
|
m_nbVBO = etk_avg(1, _number, NB_VBO_MAX);
|
||||||
@ -27,15 +27,15 @@ ewol::VirtualBufferObject::VirtualBufferObject(int32_t _number) :
|
|||||||
EWOL_DEBUG("OGL : load VBO count=\"" << _number << "\"");
|
EWOL_DEBUG("OGL : load VBO count=\"" << _number << "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::VirtualBufferObject::~VirtualBufferObject(void) {
|
ewol::resource::VirtualBufferObject::~VirtualBufferObject(void) {
|
||||||
removeContext();
|
removeContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::retreiveData(void) {
|
void ewol::resource::VirtualBufferObject::retreiveData(void) {
|
||||||
EWOL_ERROR("TODO ... ");
|
EWOL_ERROR("TODO ... ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::updateContext(void) {
|
void ewol::resource::VirtualBufferObject::updateContext(void) {
|
||||||
if (false == m_exist) {
|
if (false == m_exist) {
|
||||||
// Allocate and assign a Vertex Array Object to our handle
|
// Allocate and assign a Vertex Array Object to our handle
|
||||||
glGenBuffers(m_nbVBO, m_vbo);
|
glGenBuffers(m_nbVBO, m_vbo);
|
||||||
@ -55,7 +55,7 @@ void ewol::VirtualBufferObject::updateContext(void) {
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::removeContext(void) {
|
void ewol::resource::VirtualBufferObject::removeContext(void) {
|
||||||
if (true == m_exist) {
|
if (true == m_exist) {
|
||||||
EWOL_INFO("VBO: remove [" << getId() << "] OGl_Id=" << m_vbo[0]
|
EWOL_INFO("VBO: remove [" << getId() << "] OGl_Id=" << m_vbo[0]
|
||||||
<< "/" << m_vbo[1]
|
<< "/" << m_vbo[1]
|
||||||
@ -69,31 +69,31 @@ void ewol::VirtualBufferObject::removeContext(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::removeContextToLate(void) {
|
void ewol::resource::VirtualBufferObject::removeContextToLate(void) {
|
||||||
m_exist = false;
|
m_exist = false;
|
||||||
for (size_t iii=0; iii<NB_VBO_MAX; iii++) {
|
for (size_t iii=0; iii<NB_VBO_MAX; iii++) {
|
||||||
m_vbo[iii] = 0;
|
m_vbo[iii] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::reload(void) {
|
void ewol::resource::VirtualBufferObject::reload(void) {
|
||||||
removeContext();
|
removeContext();
|
||||||
updateContext();
|
updateContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::flush(void) {
|
void ewol::resource::VirtualBufferObject::flush(void) {
|
||||||
// request to the manager to be call at the next update ...
|
// request to the manager to be call at the next update ...
|
||||||
ewol::getContext().getResourcesManager().update(this);
|
ewol::getContext().getResourcesManager().update(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec3& _data) {
|
void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec3& _data) {
|
||||||
m_vboUsed[_id] = true;
|
m_vboUsed[_id] = true;
|
||||||
m_buffer[_id].push_back(_data.x());
|
m_buffer[_id].push_back(_data.x());
|
||||||
m_buffer[_id].push_back(_data.y());
|
m_buffer[_id].push_back(_data.y());
|
||||||
m_buffer[_id].push_back(_data.z());
|
m_buffer[_id].push_back(_data.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 ewol::VirtualBufferObject::getOnBufferVec3(int32_t _id, int32_t _elementID) {
|
vec3 ewol::resource::VirtualBufferObject::getOnBufferVec3(int32_t _id, int32_t _elementID) {
|
||||||
if ((size_t)_elementID*3 > m_buffer[_id].size()) {
|
if ((size_t)_elementID*3 > m_buffer[_id].size()) {
|
||||||
return vec3(0,0,0);
|
return vec3(0,0,0);
|
||||||
}
|
}
|
||||||
@ -102,17 +102,17 @@ vec3 ewol::VirtualBufferObject::getOnBufferVec3(int32_t _id, int32_t _elementID)
|
|||||||
m_buffer[_id][3*_elementID+2]);
|
m_buffer[_id][3*_elementID+2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::VirtualBufferObject::sizeOnBufferVec3(int32_t _id) {
|
int32_t ewol::resource::VirtualBufferObject::sizeOnBufferVec3(int32_t _id) {
|
||||||
return m_buffer[_id].size()/3;
|
return m_buffer[_id].size()/3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec2& _data) {
|
void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec2& _data) {
|
||||||
m_vboUsed[_id] = true;
|
m_vboUsed[_id] = true;
|
||||||
m_buffer[_id].push_back(_data.x());
|
m_buffer[_id].push_back(_data.x());
|
||||||
m_buffer[_id].push_back(_data.y());
|
m_buffer[_id].push_back(_data.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 ewol::VirtualBufferObject::getOnBufferVec2(int32_t _id, int32_t _elementID) {
|
vec2 ewol::resource::VirtualBufferObject::getOnBufferVec2(int32_t _id, int32_t _elementID) {
|
||||||
if ((size_t)_elementID*2 > m_buffer[_id].size()) {
|
if ((size_t)_elementID*2 > m_buffer[_id].size()) {
|
||||||
return vec2(0,0);
|
return vec2(0,0);
|
||||||
}
|
}
|
||||||
@ -120,13 +120,13 @@ vec2 ewol::VirtualBufferObject::getOnBufferVec2(int32_t _id, int32_t _elementID)
|
|||||||
m_buffer[_id][2*_elementID+1]);
|
m_buffer[_id][2*_elementID+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::VirtualBufferObject::sizeOnBufferVec2(int32_t _id) {
|
int32_t ewol::resource::VirtualBufferObject::sizeOnBufferVec2(int32_t _id) {
|
||||||
return m_buffer[_id].size()/2;
|
return m_buffer[_id].size()/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::VirtualBufferObject* ewol::VirtualBufferObject::keep(int32_t _number) {
|
ewol::resource::VirtualBufferObject* ewol::resource::VirtualBufferObject::keep(int32_t _number) {
|
||||||
// this element create a new one every time ....
|
// this element create a new one every time ....
|
||||||
ewol::VirtualBufferObject* object = new ewol::VirtualBufferObject(_number);
|
ewol::resource::VirtualBufferObject* object = new ewol::resource::VirtualBufferObject(_number);
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("allocation error of a resource : ??VBO??");
|
EWOL_ERROR("allocation error of a resource : ??VBO??");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -135,11 +135,11 @@ ewol::VirtualBufferObject* ewol::VirtualBufferObject::keep(int32_t _number) {
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::VirtualBufferObject::release(ewol::VirtualBufferObject*& _object) {
|
void ewol::resource::VirtualBufferObject::release(ewol::resource::VirtualBufferObject*& _object) {
|
||||||
if (NULL == _object) {
|
if (NULL == _object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
ewol::resource::Resource* object2 = static_cast<ewol::resource::Resource*>(_object);
|
||||||
getManager().release(object2);
|
getManager().release(object2);
|
||||||
_object = NULL;
|
_object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
#define NB_VBO_MAX (20)
|
#define NB_VBO_MAX (20)
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
/**
|
/**
|
||||||
* @brief VirtualBufferObject is a specific resources for opengl, this load the data directly in the graphic card ad keep these inside
|
* @brief VirtualBufferObject is a specific resources for opengl, this load the data directly in the graphic card ad keep these inside
|
||||||
*/
|
*/
|
||||||
class VirtualBufferObject : public ewol::Resource {
|
class VirtualBufferObject : public ewol::resource::Resource {
|
||||||
private :
|
private :
|
||||||
size_t m_nbVBO;
|
size_t m_nbVBO;
|
||||||
bool m_exist; //!< This data is availlable in the Graphic card
|
bool m_exist; //!< This data is availlable in the Graphic card
|
||||||
@ -110,6 +111,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
static void release(ewol::VirtualBufferObject*& _object);
|
static void release(ewol::VirtualBufferObject*& _object);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class FontBase : public ewol::Resource {
|
namespace resource {
|
||||||
|
class FontBase : public ewol::resource::Resource {
|
||||||
public:
|
public:
|
||||||
FontBase(const std::string& _fontName) : ewol::Resource(_fontName) {};
|
FontBase(const std::string& _fontName) : ewol::Resource(_fontName) {};
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ namespace ewol {
|
|||||||
|
|
||||||
virtual void display(void) {};
|
virtual void display(void) {};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
/*
|
/*
|
||||||
| | | |
|
| | | |
|
||||||
| | | |
|
| | | |
|
||||||
@ -100,6 +101,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
void setNotExist(void) { m_exist = false; };
|
void setNotExist(void) { m_exist = false; };
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define __EWOL_FONT_KERNING_H__
|
#define __EWOL_FONT_KERNING_H__
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
namespace resource {
|
||||||
/**
|
/**
|
||||||
* @brief Kerning properties of one specific Glyph with an other
|
* @brief Kerning properties of one specific Glyph with an other
|
||||||
* @note The "Kerning" is the methode to provide a better display for some string like
|
* @note The "Kerning" is the methode to provide a better display for some string like
|
||||||
@ -64,6 +65,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
~Kerning(void) { };
|
~Kerning(void) { };
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,17 +14,17 @@
|
|||||||
#define __class__ "Button"
|
#define __class__ "Button"
|
||||||
|
|
||||||
|
|
||||||
const char* const widget::Button::eventPressed = "pressed";
|
const char* const ewol::widget::Button::eventPressed = "pressed";
|
||||||
const char* const widget::Button::eventDown = "down";
|
const char* const ewol::widget::Button::eventDown = "down";
|
||||||
const char* const widget::Button::eventUp = "up";
|
const char* const ewol::widget::Button::eventUp = "up";
|
||||||
const char* const widget::Button::eventEnter = "enter";
|
const char* const ewol::widget::Button::eventEnter = "enter";
|
||||||
const char* const widget::Button::eventLeave = "leave";
|
const char* const ewol::widget::Button::eventLeave = "leave";
|
||||||
const char* const widget::Button::eventValue = "value";
|
const char* const ewol::widget::Button::eventValue = "value";
|
||||||
|
|
||||||
const char* const widget::Button::configToggle = "toggle";
|
const char* const ewol::widget::Button::configToggle = "toggle";
|
||||||
const char* const widget::Button::configLock = "lock";
|
const char* const ewol::widget::Button::configLock = "lock";
|
||||||
const char* const widget::Button::configValue = "value";
|
const char* const ewol::widget::Button::configValue = "value";
|
||||||
const char* const widget::Button::configShaper = "shaper";
|
const char* const ewol::widget::Button::configShaper = "shaper";
|
||||||
|
|
||||||
|
|
||||||
// DEFINE for the shader display system :
|
// DEFINE for the shader display system :
|
||||||
@ -35,23 +35,23 @@ const char* const widget::Button::configShaper = "shaper";
|
|||||||
|
|
||||||
|
|
||||||
static ewol::Widget* Create(void) {
|
static ewol::Widget* Create(void) {
|
||||||
return new widget::Button();
|
return new ewol::widget::Button();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Button::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&Create);
|
_widgetManager.addWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Button::Button(const std::string& _shaperName) :
|
ewol::widget::Button::Button(const std::string& _shaperName) :
|
||||||
m_shaper(_shaperName),
|
m_shaper(_shaperName),
|
||||||
m_value(false),
|
m_value(false),
|
||||||
m_lock(widget::Button::lockNone),
|
m_lock(ewol::widget::Button::lockNone),
|
||||||
m_toggleMode(false),
|
m_toggleMode(false),
|
||||||
m_mouseHover(false),
|
m_mouseHover(false),
|
||||||
m_buttonPressed(false),
|
m_buttonPressed(false),
|
||||||
m_selectableAreaPos(0,0),
|
m_selectableAreaPos(0,0),
|
||||||
m_selectableAreaSize(0,0) {
|
m_selectableAreaSize(0,0) {
|
||||||
addObjectType("widget::Button");
|
addObjectType("ewol::widget::Button");
|
||||||
// by default set no widget :
|
// by default set no widget :
|
||||||
m_subWidget[0] = NULL;
|
m_subWidget[0] = NULL;
|
||||||
m_subWidget[1] = NULL;
|
m_subWidget[1] = NULL;
|
||||||
@ -77,17 +77,17 @@ widget::Button::Button(const std::string& _shaperName) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::Button::~Button(void) {
|
ewol::widget::Button::~Button(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Button::setShaperName(const std::string& _shaperName) {
|
void ewol::widget::Button::setShaperName(const std::string& _shaperName) {
|
||||||
m_shaper.setSource(_shaperName);
|
m_shaper.setSource(_shaperName);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::setSubWidget(ewol::Widget* _subWidget) {
|
void ewol::widget::Button::setSubWidget(ewol::Widget* _subWidget) {
|
||||||
int32_t idWidget=0;
|
int32_t idWidget=0;
|
||||||
if (NULL!=m_subWidget[idWidget]) {
|
if (NULL!=m_subWidget[idWidget]) {
|
||||||
m_subWidget[idWidget]->removeObject();
|
m_subWidget[idWidget]->removeObject();
|
||||||
@ -100,7 +100,7 @@ void widget::Button::setSubWidget(ewol::Widget* _subWidget) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::setSubWidgetToggle(ewol::Widget* _subWidget) {
|
void ewol::widget::Button::setSubWidgetToggle(ewol::Widget* _subWidget) {
|
||||||
int32_t idWidget=1;
|
int32_t idWidget=1;
|
||||||
if (NULL!=m_subWidget[idWidget]) {
|
if (NULL!=m_subWidget[idWidget]) {
|
||||||
m_subWidget[idWidget]->removeObject();
|
m_subWidget[idWidget]->removeObject();
|
||||||
@ -112,7 +112,7 @@ void widget::Button::setSubWidgetToggle(ewol::Widget* _subWidget) {
|
|||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::calculateSize(const vec2& _availlable) {
|
void ewol::widget::Button::calculateSize(const vec2& _availlable) {
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
// set minimal size
|
// set minimal size
|
||||||
m_size = m_minSize;
|
m_size = m_minSize;
|
||||||
@ -158,7 +158,7 @@ void widget::Button::calculateSize(const vec2& _availlable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Button::calculateMinMaxSize(void) {
|
void ewol::widget::Button::calculateMinMaxSize(void) {
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
vec2 minimumSizeBase(0,0);
|
vec2 minimumSizeBase(0,0);
|
||||||
vec2 minimumSizeToggle(0,0);
|
vec2 minimumSizeToggle(0,0);
|
||||||
@ -182,7 +182,7 @@ void widget::Button::calculateMinMaxSize(void) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::Button::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
if (true == m_hide){
|
if (true == m_hide){
|
||||||
// widget is hidden ...
|
// widget is hidden ...
|
||||||
return;
|
return;
|
||||||
@ -201,12 +201,12 @@ void widget::Button::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void widget::Button::onDraw(void) {
|
void ewol::widget::Button::onDraw(void) {
|
||||||
// draw the shaaper (if needed indeed)
|
// draw the shaaper (if needed indeed)
|
||||||
m_shaper.draw();
|
m_shaper.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::onRegenerateDisplay(void) {
|
void ewol::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();
|
||||||
@ -228,10 +228,10 @@ void widget::Button::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::setLock(enum buttonLock _lock) {
|
void ewol::widget::Button::setLock(enum buttonLock _lock) {
|
||||||
if (m_lock != _lock) {
|
if (m_lock != _lock) {
|
||||||
m_lock = _lock;
|
m_lock = _lock;
|
||||||
if(widget::Button::lockAccess == _lock) {
|
if(ewol::widget::Button::lockAccess == _lock) {
|
||||||
m_buttonPressed = false;
|
m_buttonPressed = false;
|
||||||
m_mouseHover = false;
|
m_mouseHover = false;
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ void widget::Button::setLock(enum buttonLock _lock) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::setValue(bool _val) {
|
void ewol::widget::Button::setValue(bool _val) {
|
||||||
if (m_value != _val) {
|
if (m_value != _val) {
|
||||||
m_value = _val;
|
m_value = _val;
|
||||||
CheckStatus();
|
CheckStatus();
|
||||||
@ -248,7 +248,7 @@ void widget::Button::setValue(bool _val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::setToggleMode(bool _togg) {
|
void ewol::widget::Button::setToggleMode(bool _togg) {
|
||||||
if (m_toggleMode != _togg) {
|
if (m_toggleMode != _togg) {
|
||||||
m_toggleMode = _togg;
|
m_toggleMode = _togg;
|
||||||
if (m_value == true) {
|
if (m_value == true) {
|
||||||
@ -260,9 +260,9 @@ void widget::Button::setToggleMode(bool _togg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Button::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Button::onEventInput(const ewol::EventInput& _event) {
|
||||||
// disable event in the lock access mode :
|
// disable event in the lock access mode :
|
||||||
if(widget::Button::lockAccess == m_lock) {
|
if(ewol::widget::Button::lockAccess == m_lock) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool previousHoverState = m_mouseHover;
|
bool previousHoverState = m_mouseHover;
|
||||||
@ -301,9 +301,9 @@ bool widget::Button::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
if(ewol::keyEvent::statusSingle == _event.getStatus()) {
|
if(ewol::keyEvent::statusSingle == _event.getStatus()) {
|
||||||
if( ( m_value == true
|
if( ( m_value == true
|
||||||
&& widget::Button::lockWhenPressed == m_lock)
|
&& ewol::widget::Button::lockWhenPressed == m_lock)
|
||||||
|| ( m_value == false
|
|| ( m_value == false
|
||||||
&& widget::Button::lockWhenReleased == m_lock) ) {
|
&& ewol::widget::Button::lockWhenReleased == m_lock) ) {
|
||||||
// nothing to do : Lock mode ...
|
// nothing to do : Lock mode ...
|
||||||
// user might set himself the new correct value with @ref setValue(xxx)
|
// user might set himself the new correct value with @ref setValue(xxx)
|
||||||
} else {
|
} else {
|
||||||
@ -316,7 +316,7 @@ bool widget::Button::onEventInput(const ewol::EventInput& _event) {
|
|||||||
if( false == m_toggleMode
|
if( false == m_toggleMode
|
||||||
&& true == m_value) {
|
&& true == m_value) {
|
||||||
m_value = false;
|
m_value = false;
|
||||||
//EWOL_DEBUG("Generate event : " << widget::Button::eventValue << " val=" << m_value);
|
//EWOL_DEBUG("Generate event : " << ewol::widget::Button::eventValue << " val=" << m_value);
|
||||||
generateEventId(eventValue, std::to_string(m_value));
|
generateEventId(eventValue, std::to_string(m_value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ bool widget::Button::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::Button::onEventEntry(const ewol::EventEntry& _event) {
|
bool ewol::widget::Button::onEventEntry(const ewol::EventEntry& _event) {
|
||||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||||
if( _event.getType() == ewol::keyEvent::keyboardChar
|
if( _event.getType() == ewol::keyEvent::keyboardChar
|
||||||
&& _event.getStatus() == ewol::keyEvent::statusDown
|
&& _event.getStatus() == ewol::keyEvent::statusDown
|
||||||
@ -343,7 +343,7 @@ bool widget::Button::onEventEntry(const ewol::EventEntry& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::CheckStatus(void) {
|
void ewol::widget::Button::CheckStatus(void) {
|
||||||
if (true == m_buttonPressed) {
|
if (true == m_buttonPressed) {
|
||||||
changeStatusIn(STATUS_PRESSED);
|
changeStatusIn(STATUS_PRESSED);
|
||||||
} else {
|
} else {
|
||||||
@ -359,7 +359,7 @@ void widget::Button::CheckStatus(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::changeStatusIn(int32_t _newStatusId) {
|
void ewol::widget::Button::changeStatusIn(int32_t _newStatusId) {
|
||||||
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
||||||
periodicCallEnable();
|
periodicCallEnable();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -367,7 +367,7 @@ void widget::Button::changeStatusIn(int32_t _newStatusId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Button::periodicCall(const ewol::EventTime& _event) {
|
void ewol::widget::Button::periodicCall(const ewol::EventTime& _event) {
|
||||||
if (false == m_shaper.periodicCall(_event) ) {
|
if (false == m_shaper.periodicCall(_event) ) {
|
||||||
periodicCallDisable();
|
periodicCallDisable();
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ void widget::Button::periodicCall(const ewol::EventTime& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Widget* widget::Button::getWidgetNamed(const std::string& _widgetName) {
|
ewol::Widget* ewol::widget::Button::getWidgetNamed(const std::string& _widgetName) {
|
||||||
ewol::Widget* tmpUpperWidget = ewol::Widget::getWidgetNamed(_widgetName);
|
ewol::Widget* tmpUpperWidget = ewol::Widget::getWidgetNamed(_widgetName);
|
||||||
if (NULL!=tmpUpperWidget) {
|
if (NULL!=tmpUpperWidget) {
|
||||||
return tmpUpperWidget;
|
return tmpUpperWidget;
|
||||||
@ -396,7 +396,7 @@ ewol::Widget* widget::Button::getWidgetNamed(const std::string& _widgetName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::Button::loadXML(exml::Element* _element) {
|
bool ewol::widget::Button::loadXML(exml::Element* _element) {
|
||||||
if (NULL == _element) {
|
if (NULL == _element) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ bool widget::Button::loadXML(exml::Element* _element) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Button::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::Button::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == ewol::Widget::onSetConfig(_conf)) {
|
if (true == ewol::Widget::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ bool widget::Button::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Button::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::Button::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
* @brief a composed button is a button with an inside composed with the specify XML element == > this permit to generate standard element simple
|
* @brief a composed button is a button with an inside composed with the specify XML element == > this permit to generate standard element simple
|
||||||
|
@ -31,18 +31,18 @@ extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Cha
|
|||||||
|
|
||||||
|
|
||||||
static ewol::Widget* Create(void) {
|
static ewol::Widget* Create(void) {
|
||||||
return new widget::ButtonColor();
|
return new ewol::widget::ButtonColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ButtonColor::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::ButtonColor::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&Create);
|
_widgetManager.addWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::ButtonColor::ButtonColor(etk::Color<> _baseColor, std::string _shaperName) :
|
ewol::widget::ButtonColor::ButtonColor(etk::Color<> _baseColor, std::string _shaperName) :
|
||||||
m_shaper(_shaperName),
|
m_shaper(_shaperName),
|
||||||
m_textColorFg(_baseColor),
|
m_textColorFg(_baseColor),
|
||||||
m_widgetContextMenu(NULL) {
|
m_widgetContextMenu(NULL) {
|
||||||
addObjectType("widget::ButtonColor");
|
addObjectType("ewol::widget::ButtonColor");
|
||||||
addEventId(ewolEventButtonColorChange);
|
addEventId(ewolEventButtonColorChange);
|
||||||
changeStatusIn(STATUS_UP);
|
changeStatusIn(STATUS_UP);
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
@ -51,17 +51,17 @@ widget::ButtonColor::ButtonColor(etk::Color<> _baseColor, std::string _shaperNam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::ButtonColor::~ButtonColor(void) {
|
ewol::widget::ButtonColor::~ButtonColor(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::setShaperName(std::string _shaperName) {
|
void ewol::widget::ButtonColor::setShaperName(std::string _shaperName) {
|
||||||
m_shaper.setSource(_shaperName);
|
m_shaper.setSource(_shaperName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::calculateMinMaxSize(void) {
|
void ewol::widget::ButtonColor::calculateMinMaxSize(void) {
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
std::string label = m_textColorFg.getString();
|
std::string label = m_textColorFg.getString();
|
||||||
vec3 minSize = m_text.calculateSize(label);
|
vec3 minSize = m_text.calculateSize(label);
|
||||||
@ -72,13 +72,13 @@ void widget::ButtonColor::calculateMinMaxSize(void) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::onDraw(void) {
|
void ewol::widget::ButtonColor::onDraw(void) {
|
||||||
m_shaper.draw();
|
m_shaper.draw();
|
||||||
m_text.draw();
|
m_text.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::onRegenerateDisplay(void) {
|
void ewol::widget::ButtonColor::onRegenerateDisplay(void) {
|
||||||
if (needRedraw() == false) {
|
if (needRedraw() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ void widget::ButtonColor::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::ButtonColor::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::ButtonColor::onEventInput(const ewol::EventInput& _event) {
|
||||||
bool previousHoverState = m_mouseHover;
|
bool previousHoverState = m_mouseHover;
|
||||||
if(ewol::keyEvent::statusLeave == _event.getStatus()) {
|
if(ewol::keyEvent::statusLeave == _event.getStatus()) {
|
||||||
m_mouseHover = false;
|
m_mouseHover = false;
|
||||||
@ -219,17 +219,17 @@ bool widget::ButtonColor::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::setValue(etk::Color<> _color) {
|
void ewol::widget::ButtonColor::setValue(etk::Color<> _color) {
|
||||||
m_textColorFg = _color;
|
m_textColorFg = _color;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Color<> widget::ButtonColor::getValue(void) {
|
etk::Color<> ewol::widget::ButtonColor::getValue(void) {
|
||||||
return m_textColorFg;
|
return m_textColorFg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::onReceiveMessage(const ewol::EMessage& _msg) {
|
void ewol::widget::ButtonColor::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||||
EWOL_INFO("Receive MSG : " << _msg.getData());
|
EWOL_INFO("Receive MSG : " << _msg.getData());
|
||||||
if (_msg.getMessage() == ewolEventColorChooserChange) {
|
if (_msg.getMessage() == ewolEventColorChooserChange) {
|
||||||
m_textColorFg = _msg.getData();
|
m_textColorFg = _msg.getData();
|
||||||
@ -239,7 +239,7 @@ void widget::ButtonColor::onReceiveMessage(const ewol::EMessage& _msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::changeStatusIn(int32_t _newStatusId) {
|
void ewol::widget::ButtonColor::changeStatusIn(int32_t _newStatusId) {
|
||||||
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
||||||
periodicCallEnable();
|
periodicCallEnable();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -248,7 +248,7 @@ void widget::ButtonColor::changeStatusIn(int32_t _newStatusId) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void widget::ButtonColor::periodicCall(const ewol::EventTime& _event) {
|
void ewol::widget::ButtonColor::periodicCall(const ewol::EventTime& _event) {
|
||||||
if (false == m_shaper.periodicCall(_event) ) {
|
if (false == m_shaper.periodicCall(_event) ) {
|
||||||
periodicCallDisable();
|
periodicCallDisable();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
|
|
||||||
extern const char * const ewolEventButtonColorChange;
|
extern const char * const ewolEventButtonColorChange;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -79,6 +80,7 @@ namespace widget {
|
|||||||
// Derived function
|
// Derived function
|
||||||
virtual void periodicCall(const ewol::EventTime& _event);
|
virtual void periodicCall(const ewol::EventTime& _event);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,15 +16,15 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
|
|||||||
#define __class__ "CheckBox"
|
#define __class__ "CheckBox"
|
||||||
|
|
||||||
static ewol::Widget* Create(void) {
|
static ewol::Widget* Create(void) {
|
||||||
return new widget::CheckBox();
|
return new ewol::widget::CheckBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::CheckBox::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::CheckBox::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&Create);
|
_widgetManager.addWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::CheckBox::CheckBox(const std::string& _newLabel) {
|
ewol::widget::CheckBox::CheckBox(const std::string& _newLabel) {
|
||||||
addObjectType("widget::CheckBox");
|
addObjectType("ewol::widget::CheckBox");
|
||||||
m_label = _newLabel;
|
m_label = _newLabel;
|
||||||
addEventId(ewolEventCheckBoxClicked);
|
addEventId(ewolEventCheckBoxClicked);
|
||||||
m_textColorFg = etk::color::black;
|
m_textColorFg = etk::color::black;
|
||||||
@ -35,12 +35,12 @@ widget::CheckBox::CheckBox(const std::string& _newLabel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::CheckBox::~CheckBox(void) {
|
ewol::widget::CheckBox::~CheckBox(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::CheckBox::calculateMinMaxSize(void) {
|
void ewol::widget::CheckBox::calculateMinMaxSize(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());
|
||||||
@ -49,12 +49,12 @@ void widget::CheckBox::calculateMinMaxSize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::CheckBox::setLabel(std::string _newLabel) {
|
void ewol::widget::CheckBox::setLabel(std::string _newLabel) {
|
||||||
m_label = _newLabel;
|
m_label = _newLabel;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::CheckBox::setValue(bool _val) {
|
void ewol::widget::CheckBox::setValue(bool _val) {
|
||||||
if (m_value == _val) {
|
if (m_value == _val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,16 +62,16 @@ void widget::CheckBox::setValue(bool _val) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::CheckBox::getValue(void) {
|
bool ewol::widget::CheckBox::getValue(void) {
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::CheckBox::onDraw(void) {
|
void ewol::widget::CheckBox::onDraw(void) {
|
||||||
m_oObjectDecoration.draw();
|
m_oObjectDecoration.draw();
|
||||||
m_oObjectText.draw();
|
m_oObjectText.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::CheckBox::onRegenerateDisplay(void) {
|
void ewol::widget::CheckBox::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
m_oObjectDecoration.clear();
|
m_oObjectDecoration.clear();
|
||||||
m_oObjectText.clear();
|
m_oObjectText.clear();
|
||||||
@ -99,7 +99,7 @@ void widget::CheckBox::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::CheckBox::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::CheckBox::onEventInput(const ewol::EventInput& _event) {
|
||||||
//EWOL_DEBUG("Event on checkbox ...");
|
//EWOL_DEBUG("Event on checkbox ...");
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
|
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
|
||||||
@ -118,7 +118,7 @@ bool widget::CheckBox::onEventInput(const ewol::EventInput& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::CheckBox::onEventEntry(const ewol::EventEntry& _event) {
|
bool ewol::widget::CheckBox::onEventEntry(const ewol::EventEntry& _event) {
|
||||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||||
if( _event.getType() == ewol::keyEvent::keyboardChar
|
if( _event.getType() == ewol::keyEvent::keyboardChar
|
||||||
&& _event.getStatus() == ewol::keyEvent::statusDown
|
&& _event.getStatus() == ewol::keyEvent::statusDown
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
extern const char* const ewolEventCheckBoxClicked;
|
extern const char* const ewolEventCheckBoxClicked;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -46,7 +47,7 @@ namespace widget {
|
|||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
virtual bool onEventEntry(const ewol::EventEntry& _event);
|
virtual bool onEventEntry(const ewol::EventEntry& _event);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,8 +20,8 @@ extern const char * const ewolEventColorBarChange = "ewol-color-bar-change";
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ColorBar"
|
#define __class__ "ColorBar"
|
||||||
|
|
||||||
widget::ColorBar::ColorBar(void) {
|
ewol::widget::ColorBar::ColorBar(void) {
|
||||||
addObjectType("widget::ColorBar");
|
addObjectType("ewol::widget::ColorBar");
|
||||||
addEventId(ewolEventColorBarChange);
|
addEventId(ewolEventColorBarChange);
|
||||||
m_currentUserPos.setValue(0,0);
|
m_currentUserPos.setValue(0,0);
|
||||||
m_currentColor = etk::color::black;
|
m_currentColor = etk::color::black;
|
||||||
@ -29,12 +29,12 @@ widget::ColorBar::ColorBar(void) {
|
|||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::ColorBar::~ColorBar(void) {
|
ewol::widget::ColorBar::~ColorBar(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ColorBar::calculateMinMaxSize(void) {
|
void ewol::widget::ColorBar::calculateMinMaxSize(void) {
|
||||||
m_minSize.setValue(160, 80);
|
m_minSize.setValue(160, 80);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
@ -52,22 +52,22 @@ static etk::Color<> s_listColor[NB_BAND_COLOR+1] = {
|
|||||||
0xFF0000FF
|
0xFF0000FF
|
||||||
};
|
};
|
||||||
|
|
||||||
etk::Color<> widget::ColorBar::getCurrentColor(void) {
|
etk::Color<> ewol::widget::ColorBar::getCurrentColor(void) {
|
||||||
return m_currentColor;
|
return m_currentColor;
|
||||||
}
|
}
|
||||||
void widget::ColorBar::setCurrentColor(etk::Color<> newOne) {
|
void ewol::widget::ColorBar::setCurrentColor(etk::Color<> newOne) {
|
||||||
m_currentColor = newOne;
|
m_currentColor = newOne;
|
||||||
m_currentColor.setA(0xFF);
|
m_currentColor.setA(0xFF);
|
||||||
// estimate the cursor position :
|
// estimate the cursor position :
|
||||||
// TODO : Later when really needed ...
|
// TODO : Later when really needed ...
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ColorBar::onDraw(void) {
|
void ewol::widget::ColorBar::onDraw(void) {
|
||||||
m_draw.draw();
|
m_draw.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ColorBar::onRegenerateDisplay(void) {
|
void ewol::widget::ColorBar::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
m_draw.clear();
|
m_draw.clear();
|
||||||
@ -165,7 +165,7 @@ void widget::ColorBar::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::ColorBar::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::ColorBar::onEventInput(const ewol::EventInput& _event) {
|
||||||
vec2 relativePos = relativePosition(_event.getPos());
|
vec2 relativePos = relativePosition(_event.getPos());
|
||||||
//EWOL_DEBUG("Event on BT ...");
|
//EWOL_DEBUG("Event on BT ...");
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
extern const char * const ewolEventColorBarChange;
|
extern const char * const ewolEventColorBarChange;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -38,7 +39,7 @@ namespace widget {
|
|||||||
virtual void onRegenerateDisplay(void);
|
virtual void onRegenerateDisplay(void);
|
||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,32 +13,32 @@
|
|||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "widget::Composer"
|
#define __class__ "ewol::widget::Composer"
|
||||||
|
|
||||||
widget::Composer::Composer(void) {
|
ewol::widget::Composer::Composer(void) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Composer::Composer(enum composerMode _mode, const std::string& _fileName) {
|
ewol::widget::Composer::Composer(enum composerMode _mode, const std::string& _fileName) {
|
||||||
addObjectType("widget::Composer");
|
addObjectType("ewol::widget::Composer");
|
||||||
switch(_mode) {
|
switch(_mode) {
|
||||||
case widget::Composer::None:
|
case ewol::widget::Composer::None:
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
break;
|
break;
|
||||||
case widget::Composer::String:
|
case ewol::widget::Composer::String:
|
||||||
loadFromString(_fileName);
|
loadFromString(_fileName);
|
||||||
break;
|
break;
|
||||||
case widget::Composer::file:
|
case ewol::widget::Composer::file:
|
||||||
loadFromFile(_fileName);
|
loadFromFile(_fileName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Composer::~Composer(void) {
|
ewol::widget::Composer::~Composer(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Composer::loadFromFile(const std::string& _fileName) {
|
bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) {
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
if (doc.load(_fileName) == false) {
|
if (doc.load(_fileName) == false) {
|
||||||
EWOL_ERROR(" can not load file XML : " << _fileName);
|
EWOL_ERROR(" can not load file XML : " << _fileName);
|
||||||
@ -63,7 +63,7 @@ bool widget::Composer::loadFromFile(const std::string& _fileName) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Composer::loadFromString(const std::string& _composerXmlString) {
|
bool ewol::widget::Composer::loadFromString(const std::string& _composerXmlString) {
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
if (doc.parse(_composerXmlString) == false) {
|
if (doc.parse(_composerXmlString) == false) {
|
||||||
EWOL_ERROR(" can not load file XML string...");
|
EWOL_ERROR(" can not load file XML string...");
|
||||||
@ -89,14 +89,14 @@ bool widget::Composer::loadFromString(const std::string& _composerXmlString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Composer::registerOnEventNameWidget(const std::string& _subWidgetName,
|
void ewol::widget::Composer::registerOnEventNameWidget(const std::string& _subWidgetName,
|
||||||
const char * _eventId,
|
const char * _eventId,
|
||||||
const char * _eventIdgenerated,
|
const char * _eventIdgenerated,
|
||||||
const std::string& _overloadData) {
|
const std::string& _overloadData) {
|
||||||
registerOnEventNameWidget(this, _subWidgetName, _eventId, _eventIdgenerated, _overloadData);
|
registerOnEventNameWidget(this, _subWidgetName, _eventId, _eventIdgenerated, _overloadData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Composer::registerOnEventNameWidget(ewol::EObject * _destinationObject,
|
void ewol::widget::Composer::registerOnEventNameWidget(ewol::EObject * _destinationObject,
|
||||||
const std::string& _subWidgetName,
|
const std::string& _subWidgetName,
|
||||||
const char * _eventId,
|
const char * _eventId,
|
||||||
const char * _eventIdgenerated,
|
const char * _eventIdgenerated,
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Container.h>
|
#include <ewol/widget/Container.h>
|
||||||
|
|
||||||
namespace widget
|
namespace ewol {
|
||||||
{
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
* @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
|
* @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
|
||||||
@ -82,6 +82,7 @@ namespace widget
|
|||||||
const char * _eventIdgenerated = NULL,
|
const char * _eventIdgenerated = NULL,
|
||||||
const std::string& _overloadData="");
|
const std::string& _overloadData="");
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,21 +16,21 @@
|
|||||||
#define __class__ "Container"
|
#define __class__ "Container"
|
||||||
|
|
||||||
|
|
||||||
widget::Container::Container(ewol::Widget* _subElement) :
|
ewol::widget::Container::Container(ewol::Widget* _subElement) :
|
||||||
m_subWidget(_subElement) {
|
m_subWidget(_subElement) {
|
||||||
addObjectType("widget::Container");
|
addObjectType("ewol::widget::Container");
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Container::~Container(void) {
|
ewol::widget::Container::~Container(void) {
|
||||||
subWidgetRemove();
|
subWidgetRemove();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::Container::getSubWidget(void) {
|
ewol::Widget* ewol::widget::Container::getSubWidget(void) {
|
||||||
return m_subWidget;
|
return m_subWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::setSubWidget(ewol::Widget* _newWidget) {
|
void ewol::widget::Container::setSubWidget(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ void widget::Container::setSubWidget(ewol::Widget* _newWidget) {
|
|||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::subWidgetRemove(void) {
|
void ewol::widget::Container::subWidgetRemove(void) {
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->removeUpperWidget();
|
m_subWidget->removeUpperWidget();
|
||||||
delete(m_subWidget);
|
delete(m_subWidget);
|
||||||
@ -56,7 +56,7 @@ void widget::Container::subWidgetRemove(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::subWidgetRemoveDelayed(void) {
|
void ewol::widget::Container::subWidgetRemoveDelayed(void) {
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->removeUpperWidget();
|
m_subWidget->removeUpperWidget();
|
||||||
m_subWidget->removeObject();
|
m_subWidget->removeObject();
|
||||||
@ -66,7 +66,7 @@ void widget::Container::subWidgetRemoveDelayed(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::Container::getWidgetNamed(const std::string& _widgetName) {
|
ewol::Widget* ewol::widget::Container::getWidgetNamed(const std::string& _widgetName) {
|
||||||
ewol::Widget* tmpUpperWidget = ewol::Widget::getWidgetNamed(_widgetName);
|
ewol::Widget* tmpUpperWidget = ewol::Widget::getWidgetNamed(_widgetName);
|
||||||
if (NULL!=tmpUpperWidget) {
|
if (NULL!=tmpUpperWidget) {
|
||||||
return tmpUpperWidget;
|
return tmpUpperWidget;
|
||||||
@ -77,7 +77,7 @@ ewol::Widget* widget::Container::getWidgetNamed(const std::string& _widgetName)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::onObjectRemove(ewol::EObject* _removeObject) {
|
void ewol::widget::Container::onObjectRemove(ewol::EObject* _removeObject) {
|
||||||
if (m_subWidget == _removeObject) {
|
if (m_subWidget == _removeObject) {
|
||||||
m_subWidget=NULL;
|
m_subWidget=NULL;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -85,7 +85,7 @@ void widget::Container::onObjectRemove(ewol::EObject* _removeObject) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::Container::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
if (true == m_hide){
|
if (true == m_hide){
|
||||||
// widget is hidden ...
|
// widget is hidden ...
|
||||||
return;
|
return;
|
||||||
@ -98,7 +98,7 @@ void widget::Container::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::calculateSize(const vec2& _availlable) {
|
void ewol::widget::Container::calculateSize(const vec2& _availlable) {
|
||||||
if (NULL!=m_subWidget) {
|
if (NULL!=m_subWidget) {
|
||||||
vec2 origin = m_origin+m_offset;
|
vec2 origin = m_origin+m_offset;
|
||||||
vec2 minSize = m_subWidget->getCalculateMinSize();
|
vec2 minSize = m_subWidget->getCalculateMinSize();
|
||||||
@ -125,7 +125,7 @@ void widget::Container::calculateSize(const vec2& _availlable) {
|
|||||||
ewol::Widget::calculateSize(_availlable);
|
ewol::Widget::calculateSize(_availlable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::calculateMinMaxSize(void) {
|
void ewol::widget::Container::calculateMinMaxSize(void) {
|
||||||
// call main class
|
// call main class
|
||||||
ewol::Widget::calculateMinMaxSize();
|
ewol::Widget::calculateMinMaxSize();
|
||||||
// call sub classes
|
// call sub classes
|
||||||
@ -137,13 +137,13 @@ void widget::Container::calculateMinMaxSize(void) {
|
|||||||
//EWOL_ERROR("[" << getId() << "] Result min size : " << m_minSize);
|
//EWOL_ERROR("[" << getId() << "] Result min size : " << m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::onRegenerateDisplay(void) {
|
void ewol::widget::Container::onRegenerateDisplay(void) {
|
||||||
if (NULL!=m_subWidget) {
|
if (NULL!=m_subWidget) {
|
||||||
m_subWidget->onRegenerateDisplay();
|
m_subWidget->onRegenerateDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::Container::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::Container::getWidgetAtPos(const vec2& _pos) {
|
||||||
if (false == isHide()) {
|
if (false == isHide()) {
|
||||||
if (NULL!=m_subWidget) {
|
if (NULL!=m_subWidget) {
|
||||||
return m_subWidget->getWidgetAtPos(_pos);
|
return m_subWidget->getWidgetAtPos(_pos);
|
||||||
@ -153,7 +153,7 @@ ewol::Widget* widget::Container::getWidgetAtPos(const vec2& _pos) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool widget::Container::loadXML(exml::Element* _node) {
|
bool ewol::widget::Container::loadXML(exml::Element* _node) {
|
||||||
if (NULL == _node) {
|
if (NULL == _node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ bool widget::Container::loadXML(exml::Element* _node) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Container::setOffset(const vec2& _newVal) {
|
void ewol::widget::Container::setOffset(const vec2& _newVal) {
|
||||||
if (m_offset != _newVal) {
|
if (m_offset != _newVal) {
|
||||||
ewol::Widget::setOffset(_newVal);
|
ewol::Widget::setOffset(_newVal);
|
||||||
// recalculate the new sise and position of sub widget ...
|
// recalculate the new sise and position of sub widget ...
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
* @brief the Cotainer widget is a widget that have an only one subWidget
|
* @brief the Cotainer widget is a widget that have an only one subWidget
|
||||||
@ -61,6 +62,7 @@ namespace widget {
|
|||||||
virtual bool loadXML(exml::Element* _node);
|
virtual bool loadXML(exml::Element* _node);
|
||||||
virtual void setOffset(const vec2& _newVal);
|
virtual void setOffset(const vec2& _newVal);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,19 +15,19 @@
|
|||||||
#define __class__ "ContainerN"
|
#define __class__ "ContainerN"
|
||||||
|
|
||||||
|
|
||||||
widget::ContainerN::ContainerN(void) :
|
ewol::widget::ContainerN::ContainerN(void) :
|
||||||
m_lockExpand(false,false),
|
m_lockExpand(false,false),
|
||||||
m_subExpend(false,false) {
|
m_subExpend(false,false) {
|
||||||
addObjectType("widget::ContainerN");
|
addObjectType("ewol::widget::ContainerN");
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::ContainerN::~ContainerN(void) {
|
ewol::widget::ContainerN::~ContainerN(void) {
|
||||||
subWidgetRemoveAll();
|
subWidgetRemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bvec2 widget::ContainerN::canExpand(void) {
|
bvec2 ewol::widget::ContainerN::canExpand(void) {
|
||||||
bvec2 res = m_userExpand;
|
bvec2 res = m_userExpand;
|
||||||
if (false == m_lockExpand.x()) {
|
if (false == m_lockExpand.x()) {
|
||||||
if (true == m_subExpend.x()) {
|
if (true == m_subExpend.x()) {
|
||||||
@ -43,7 +43,7 @@ bvec2 widget::ContainerN::canExpand(void) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::lockExpand(const bvec2& _lockExpand) {
|
void ewol::widget::ContainerN::lockExpand(const bvec2& _lockExpand) {
|
||||||
if (_lockExpand != m_lockExpand) {
|
if (_lockExpand != m_lockExpand) {
|
||||||
m_lockExpand = _lockExpand;
|
m_lockExpand = _lockExpand;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -52,7 +52,7 @@ void widget::ContainerN::lockExpand(const bvec2& _lockExpand) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t widget::ContainerN::subWidgetAdd(ewol::Widget* _newWidget) {
|
int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... ");
|
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... ");
|
||||||
return -1;
|
return -1;
|
||||||
@ -67,7 +67,7 @@ int32_t widget::ContainerN::subWidgetAdd(ewol::Widget* _newWidget) {
|
|||||||
return _newWidget->getId();
|
return _newWidget->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::ContainerN::subWidgetAddStart(ewol::Widget* _newWidget) {
|
int32_t ewol::widget::ContainerN::subWidgetAddStart(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... ");
|
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... ");
|
||||||
return -1;
|
return -1;
|
||||||
@ -81,7 +81,7 @@ int32_t widget::ContainerN::subWidgetAddStart(ewol::Widget* _newWidget) {
|
|||||||
return _newWidget->getId();
|
return _newWidget->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::subWidgetRemove(ewol::Widget* _newWidget) {
|
void ewol::widget::ContainerN::subWidgetRemove(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ void widget::ContainerN::subWidgetRemove(ewol::Widget* _newWidget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::subWidgetUnLink(ewol::Widget* _newWidget) {
|
void ewol::widget::ContainerN::subWidgetUnLink(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ void widget::ContainerN::subWidgetUnLink(ewol::Widget* _newWidget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::subWidgetRemoveAll(void) {
|
void ewol::widget::ContainerN::subWidgetRemoveAll(void) {
|
||||||
size_t errorControl = m_subWidget.size();
|
size_t errorControl = m_subWidget.size();
|
||||||
// the size automaticly decrement with the auto call of the onObjectRemove function
|
// the size automaticly decrement with the auto call of the onObjectRemove function
|
||||||
while (m_subWidget.size() > 0 ) {
|
while (m_subWidget.size() > 0 ) {
|
||||||
@ -140,7 +140,7 @@ void widget::ContainerN::subWidgetRemoveAll(void) {
|
|||||||
m_subWidget.clear();
|
m_subWidget.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::subWidgetRemoveAllDelayed(void) {
|
void ewol::widget::ContainerN::subWidgetRemoveAllDelayed(void) {
|
||||||
// the size automaticly decrement with the auto call of the onObjectRemove function
|
// the size automaticly decrement with the auto call of the onObjectRemove function
|
||||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
@ -154,7 +154,7 @@ void widget::ContainerN::subWidgetRemoveAllDelayed(void) {
|
|||||||
m_subWidget.clear();
|
m_subWidget.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::ContainerN::getWidgetNamed(const std::string& _widgetName) {
|
ewol::Widget* ewol::widget::ContainerN::getWidgetNamed(const std::string& _widgetName) {
|
||||||
ewol::Widget* tmpUpperWidget = ewol::Widget::getWidgetNamed(_widgetName);
|
ewol::Widget* tmpUpperWidget = ewol::Widget::getWidgetNamed(_widgetName);
|
||||||
if (NULL!=tmpUpperWidget) {
|
if (NULL!=tmpUpperWidget) {
|
||||||
return tmpUpperWidget;
|
return tmpUpperWidget;
|
||||||
@ -170,7 +170,7 @@ ewol::Widget* widget::ContainerN::getWidgetNamed(const std::string& _widgetName)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::onObjectRemove(ewol::EObject* _removeObject) {
|
void ewol::widget::ContainerN::onObjectRemove(ewol::EObject* _removeObject) {
|
||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::onObjectRemove(_removeObject);
|
ewol::Widget::onObjectRemove(_removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
@ -183,7 +183,7 @@ void widget::ContainerN::onObjectRemove(ewol::EObject* _removeObject) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
if (true == m_hide){
|
if (true == m_hide){
|
||||||
// widget is hidden ...
|
// widget is hidden ...
|
||||||
return;
|
return;
|
||||||
@ -200,7 +200,7 @@ void widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::calculateSize(const vec2& _availlable) {
|
void ewol::widget::ContainerN::calculateSize(const vec2& _availlable) {
|
||||||
m_size = _availlable;
|
m_size = _availlable;
|
||||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
@ -211,7 +211,7 @@ void widget::ContainerN::calculateSize(const vec2& _availlable) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::calculateMinMaxSize(void) {
|
void ewol::widget::ContainerN::calculateMinMaxSize(void) {
|
||||||
m_subExpend.setValue(false, false);
|
m_subExpend.setValue(false, false);
|
||||||
m_minSize.setValue(0,0);
|
m_minSize.setValue(0,0);
|
||||||
m_maxSize.setValue(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE);
|
m_maxSize.setValue(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE);
|
||||||
@ -234,7 +234,7 @@ void widget::ContainerN::calculateMinMaxSize(void) {
|
|||||||
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContainerN::onRegenerateDisplay(void) {
|
void ewol::widget::ContainerN::onRegenerateDisplay(void) {
|
||||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
m_subWidget[iii]->onRegenerateDisplay();
|
m_subWidget[iii]->onRegenerateDisplay();
|
||||||
@ -242,7 +242,7 @@ void widget::ContainerN::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::ContainerN::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::ContainerN::getWidgetAtPos(const vec2& _pos) {
|
||||||
if (true == isHide()) {
|
if (true == isHide()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ ewol::Widget* widget::ContainerN::getWidgetAtPos(const vec2& _pos) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool widget::ContainerN::loadXML(exml::Element* _node) {
|
bool ewol::widget::ContainerN::loadXML(exml::Element* _node) {
|
||||||
if (NULL == _node) {
|
if (NULL == _node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ bool widget::ContainerN::loadXML(exml::Element* _node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ContainerN::setOffset(const vec2& _newVal) {
|
void ewol::widget::ContainerN::setOffset(const vec2& _newVal) {
|
||||||
if (m_offset != _newVal) {
|
if (m_offset != _newVal) {
|
||||||
ewol::Widget::setOffset(_newVal);
|
ewol::Widget::setOffset(_newVal);
|
||||||
// recalculate the new sise and position of sub widget ...
|
// recalculate the new sise and position of sub widget ...
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
* @brief the Cotainer widget is a widget that have an only one subWidget
|
* @brief the Cotainer widget is a widget that have an only one subWidget
|
||||||
@ -92,6 +93,7 @@ namespace widget {
|
|||||||
virtual bool loadXML(exml::Element* _node);
|
virtual bool loadXML(exml::Element* _node);
|
||||||
virtual void setOffset(const vec2& _newVal);
|
virtual void setOffset(const vec2& _newVal);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,23 +16,23 @@
|
|||||||
#define __class__ "ContextMenu"
|
#define __class__ "ContextMenu"
|
||||||
|
|
||||||
|
|
||||||
const char* const widget::ContextMenu::configArrowPosition = "arrow-position";
|
const char* const ewol::widget::ContextMenu::configArrowPosition = "arrow-position";
|
||||||
const char* const widget::ContextMenu::configArrowMode = "arrow-mode";
|
const char* const ewol::widget::ContextMenu::configArrowMode = "arrow-mode";
|
||||||
const char* const widget::ContextMenu::configShaper = "shaper";
|
const char* const ewol::widget::ContextMenu::configShaper = "shaper";
|
||||||
|
|
||||||
static ewol::Widget* Create(void) {
|
static ewol::Widget* Create(void) {
|
||||||
return new widget::ContextMenu();
|
return new ewol::widget::ContextMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContextMenu::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::ContextMenu::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&Create);
|
_widgetManager.addWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
widget::ContextMenu::ContextMenu(const std::string& _shaperName) :
|
ewol::widget::ContextMenu::ContextMenu(const std::string& _shaperName) :
|
||||||
m_shaper(_shaperName) {
|
m_shaper(_shaperName) {
|
||||||
addObjectType("widget::ContextMenu");
|
addObjectType("ewol::widget::ContextMenu");
|
||||||
// add basic configurations :
|
// add basic configurations :
|
||||||
registerConfig(configArrowPosition, "vec2", NULL, "position of the arrow");
|
registerConfig(configArrowPosition, "vec2", NULL, "position of the arrow");
|
||||||
registerConfig(configArrowMode, "list", "none;left;buttom;right;top", "Position of the arrow in the pop-up");
|
registerConfig(configArrowMode, "list", "none;left;buttom;right;top", "Position of the arrow in the pop-up");
|
||||||
@ -52,17 +52,17 @@ widget::ContextMenu::ContextMenu(const std::string& _shaperName) :
|
|||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::ContextMenu::~ContextMenu(void) {
|
ewol::widget::ContextMenu::~ContextMenu(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContextMenu::setShaperName(const std::string& _shaperName) {
|
void ewol::widget::ContextMenu::setShaperName(const std::string& _shaperName) {
|
||||||
m_shaper.setSource(_shaperName);
|
m_shaper.setSource(_shaperName);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ContextMenu::calculateSize(const vec2& _availlable) {
|
void ewol::widget::ContextMenu::calculateSize(const vec2& _availlable) {
|
||||||
//EWOL_DEBUG("CalculateSize=" << availlable);
|
//EWOL_DEBUG("CalculateSize=" << availlable);
|
||||||
// pop-up fill all the display :
|
// pop-up fill all the display :
|
||||||
m_size = _availlable;
|
m_size = _availlable;
|
||||||
@ -130,7 +130,7 @@ void widget::ContextMenu::calculateSize(const vec2& _availlable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ContextMenu::calculateMinMaxSize(void) {
|
void ewol::widget::ContextMenu::calculateMinMaxSize(void) {
|
||||||
// call main class to calculate the min size...
|
// call main class to calculate the min size...
|
||||||
widget::Container::calculateMinMaxSize();
|
widget::Container::calculateMinMaxSize();
|
||||||
// add padding of the display
|
// add padding of the display
|
||||||
@ -140,13 +140,13 @@ void widget::ContextMenu::calculateMinMaxSize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ContextMenu::onDraw(void) {
|
void ewol::widget::ContextMenu::onDraw(void) {
|
||||||
m_compositing.draw();
|
m_compositing.draw();
|
||||||
m_shaper.draw();
|
m_shaper.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ContextMenu::onRegenerateDisplay(void) {
|
void ewol::widget::ContextMenu::onRegenerateDisplay(void) {
|
||||||
// call upper class :
|
// call upper class :
|
||||||
widget::Container::onRegenerateDisplay();
|
widget::Container::onRegenerateDisplay();
|
||||||
if (needRedraw() == false) {
|
if (needRedraw() == false) {
|
||||||
@ -214,7 +214,7 @@ void widget::ContextMenu::onRegenerateDisplay(void) {
|
|||||||
m_shaper.setInsideSize(vec2ClipInt32(shaperSize-padding*2.0f));
|
m_shaper.setInsideSize(vec2ClipInt32(shaperSize-padding*2.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::ContextMenu::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::ContextMenu::onEventInput(const ewol::EventInput& _event) {
|
||||||
if (_event.getId() > 0) {
|
if (_event.getId() > 0) {
|
||||||
if (NULL != widget::Container::getWidgetAtPos(_event.getPos())) {
|
if (NULL != widget::Container::getWidgetAtPos(_event.getPos())) {
|
||||||
return false;
|
return false;
|
||||||
@ -234,14 +234,14 @@ bool widget::ContextMenu::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ContextMenu::setPositionMark(enum markPosition _position, vec2 _arrowPos) {
|
void ewol::widget::ContextMenu::setPositionMark(enum markPosition _position, vec2 _arrowPos) {
|
||||||
EWOL_DEBUG("set context menu at the position : " << _arrowPos);
|
EWOL_DEBUG("set context menu at the position : " << _arrowPos);
|
||||||
m_arrawBorder = _position;
|
m_arrawBorder = _position;
|
||||||
m_arrowPos = _arrowPos;
|
m_arrowPos = _arrowPos;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
|
||||||
ewol::Widget* val = widget::Container::getWidgetAtPos(_pos);
|
ewol::Widget* val = widget::Container::getWidgetAtPos(_pos);
|
||||||
if (NULL != val) {
|
if (NULL != val) {
|
||||||
return val;
|
return val;
|
||||||
@ -250,7 +250,7 @@ ewol::Widget* widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::ContextMenu::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::ContextMenu::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == widget::Container::onSetConfig(_conf)) {
|
if (true == widget::Container::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ bool widget::ContextMenu::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::ContextMenu::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::ContextMenu::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == widget::Container::onGetConfig(_config, _result)) {
|
if (true == widget::Container::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
class ContextMenu : public widget::Container {
|
class ContextMenu : public ewol::widget::Container {
|
||||||
public:
|
public:
|
||||||
enum markPosition {
|
enum markPosition {
|
||||||
markTop,
|
markTop,
|
||||||
@ -70,6 +71,7 @@ namespace widget {
|
|||||||
virtual void calculateMinMaxSize(void);
|
virtual void calculateMinMaxSize(void);
|
||||||
virtual ewol::Widget* getWidgetAtPos(const vec2& pos);
|
virtual ewol::Widget* getWidgetAtPos(const vec2& pos);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,24 +29,24 @@ const char * const ewolEventEntrySelect = "ewol-widget-entry-event-internal-sele
|
|||||||
#define STATUS_SELECTED (2)
|
#define STATUS_SELECTED (2)
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Entry();
|
return new ewol::widget::Entry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Entry::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const widget::Entry::eventClick = "click";
|
const char * const ewol::widget::Entry::eventClick = "click";
|
||||||
const char * const widget::Entry::eventEnter = "enter";
|
const char * const ewol::widget::Entry::eventEnter = "enter";
|
||||||
const char * const widget::Entry::eventModify = "modify";
|
const char * const ewol::widget::Entry::eventModify = "modify";
|
||||||
|
|
||||||
const char* const widget::Entry::configMaxChar = "max";
|
const char* const ewol::widget::Entry::configMaxChar = "max";
|
||||||
const char* const widget::Entry::configRegExp = "regExp";
|
const char* const ewol::widget::Entry::configRegExp = "regExp";
|
||||||
const char* const widget::Entry::configColorFg = "color";
|
const char* const ewol::widget::Entry::configColorFg = "color";
|
||||||
const char* const widget::Entry::configColorBg = "background";
|
const char* const ewol::widget::Entry::configColorBg = "background";
|
||||||
const char* const widget::Entry::configEmptyMessage = "emptytext";
|
const char* const ewol::widget::Entry::configEmptyMessage = "emptytext";
|
||||||
|
|
||||||
widget::Entry::Entry(std::string _newData) :
|
ewol::widget::Entry::Entry(std::string _newData) :
|
||||||
m_shaper("THEME:GUI:widgetEntry.conf"),
|
m_shaper("THEME:GUI:widgetEntry.conf"),
|
||||||
m_data(""),
|
m_data(""),
|
||||||
m_maxCharacter(0x7FFFFFFF),
|
m_maxCharacter(0x7FFFFFFF),
|
||||||
@ -59,7 +59,7 @@ widget::Entry::Entry(std::string _newData) :
|
|||||||
m_textColorFg(etk::color::black),
|
m_textColorFg(etk::color::black),
|
||||||
m_textColorBg(etk::color::white),
|
m_textColorBg(etk::color::white),
|
||||||
m_textWhenNothing("") {
|
m_textWhenNothing("") {
|
||||||
addObjectType("widget::Entry");
|
addObjectType("ewol::widget::Entry");
|
||||||
m_textColorBg.setA(0xAF);
|
m_textColorBg.setA(0xAF);
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
addEventId(eventClick);
|
addEventId(eventClick);
|
||||||
@ -83,12 +83,12 @@ widget::Entry::Entry(std::string _newData) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::Entry::~Entry(void) {
|
ewol::widget::Entry::~Entry(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::setMaxChar(int32_t _nbMax) {
|
void ewol::widget::Entry::setMaxChar(int32_t _nbMax) {
|
||||||
if (_nbMax <= 0) {
|
if (_nbMax <= 0) {
|
||||||
m_maxCharacter = 0x7FFFFFFF;
|
m_maxCharacter = 0x7FFFFFFF;
|
||||||
} else {
|
} else {
|
||||||
@ -97,7 +97,7 @@ void widget::Entry::setMaxChar(int32_t _nbMax) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::calculateMinMaxSize(void) {
|
void ewol::widget::Entry::calculateMinMaxSize(void) {
|
||||||
// call main class
|
// call main class
|
||||||
ewol::Widget::calculateMinMaxSize();
|
ewol::Widget::calculateMinMaxSize();
|
||||||
// get generic padding
|
// get generic padding
|
||||||
@ -112,7 +112,7 @@ void widget::Entry::calculateMinMaxSize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::setValue(const std::string& _newData) {
|
void ewol::widget::Entry::setValue(const std::string& _newData) {
|
||||||
std::string newData = _newData;
|
std::string newData = _newData;
|
||||||
if ((int64_t)newData.size() > m_maxCharacter) {
|
if ((int64_t)newData.size() > m_maxCharacter) {
|
||||||
newData = std::string(_newData, 0, m_maxCharacter);
|
newData = std::string(_newData, 0, m_maxCharacter);
|
||||||
@ -129,13 +129,13 @@ void widget::Entry::setValue(const std::string& _newData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::onDraw(void) {
|
void ewol::widget::Entry::onDraw(void) {
|
||||||
m_shaper.draw();
|
m_shaper.draw();
|
||||||
m_oObjectText.draw();
|
m_oObjectText.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::onRegenerateDisplay(void) {
|
void ewol::widget::Entry::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
m_shaper.clear();
|
m_shaper.clear();
|
||||||
m_oObjectText.clear();
|
m_oObjectText.clear();
|
||||||
@ -186,7 +186,7 @@ void widget::Entry::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection) {
|
void ewol::widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection) {
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
|
|
||||||
vec2 relPos = relativePosition(_pos);
|
vec2 relPos = relativePosition(_pos);
|
||||||
@ -223,7 +223,7 @@ void widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::removeSelected(void) {
|
void ewol::widget::Entry::removeSelected(void) {
|
||||||
if (m_displayCursorPosSelection == m_displayCursorPos) {
|
if (m_displayCursorPosSelection == m_displayCursorPos) {
|
||||||
// nothing to cut ...
|
// nothing to cut ...
|
||||||
return;
|
return;
|
||||||
@ -242,7 +242,7 @@ void widget::Entry::removeSelected(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::copySelectionToClipBoard(enum ewol::clipBoard::clipboardListe _clipboardID) {
|
void ewol::widget::Entry::copySelectionToClipBoard(enum ewol::clipBoard::clipboardListe _clipboardID) {
|
||||||
if (m_displayCursorPosSelection == m_displayCursorPos) {
|
if (m_displayCursorPosSelection == m_displayCursorPos) {
|
||||||
// nothing to cut ...
|
// nothing to cut ...
|
||||||
return;
|
return;
|
||||||
@ -259,7 +259,7 @@ void widget::Entry::copySelectionToClipBoard(enum ewol::clipBoard::clipboardList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::Entry::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Entry::onEventInput(const ewol::EventInput& _event) {
|
||||||
//EWOL_DEBUG("Event on Entry ... type=" << (int32_t)type << " id=" << IdInput);
|
//EWOL_DEBUG("Event on Entry ... type=" << (int32_t)type << " id=" << IdInput);
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
|
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
|
||||||
@ -352,7 +352,7 @@ bool widget::Entry::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::Entry::onEventEntry(const ewol::EventEntry& _event) {
|
bool ewol::widget::Entry::onEventEntry(const ewol::EventEntry& _event) {
|
||||||
if (_event.getType() == ewol::keyEvent::keyboardChar) {
|
if (_event.getType() == ewol::keyEvent::keyboardChar) {
|
||||||
if(_event.getStatus() == ewol::keyEvent::statusDown) {
|
if(_event.getStatus() == ewol::keyEvent::statusDown) {
|
||||||
//EWOL_DEBUG("Entry input data ... : \"" << unicodeData << "\" " );
|
//EWOL_DEBUG("Entry input data ... : \"" << unicodeData << "\" " );
|
||||||
@ -424,7 +424,7 @@ bool widget::Entry::onEventEntry(const ewol::EventEntry& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::setInternalValue(const std::string& _newData) {
|
void ewol::widget::Entry::setInternalValue(const std::string& _newData) {
|
||||||
std::string previous = m_data;
|
std::string previous = m_data;
|
||||||
// check the RegExp :
|
// check the RegExp :
|
||||||
if (_newData.size()>0) {
|
if (_newData.size()>0) {
|
||||||
@ -442,7 +442,7 @@ void widget::Entry::setInternalValue(const std::string& _newData) {
|
|||||||
m_data = _newData;
|
m_data = _newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::onEventClipboard(enum ewol::clipBoard::clipboardListe _clipboardID) {
|
void ewol::widget::Entry::onEventClipboard(enum ewol::clipBoard::clipboardListe _clipboardID) {
|
||||||
// remove curent selected data ...
|
// remove curent selected data ...
|
||||||
removeSelected();
|
removeSelected();
|
||||||
// get current selection / Copy :
|
// get current selection / Copy :
|
||||||
@ -466,7 +466,7 @@ void widget::Entry::onEventClipboard(enum ewol::clipBoard::clipboardListe _clipb
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Entry::onReceiveMessage(const ewol::EMessage& _msg) {
|
void ewol::widget::Entry::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||||
ewol::Widget::onReceiveMessage(_msg);
|
ewol::Widget::onReceiveMessage(_msg);
|
||||||
if(_msg.getMessage() == ewolEventEntryClean) {
|
if(_msg.getMessage() == ewolEventEntryClean) {
|
||||||
m_data = "";
|
m_data = "";
|
||||||
@ -493,11 +493,11 @@ void widget::Entry::onReceiveMessage(const ewol::EMessage& _msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::markToUpdateTextPosition(void) {
|
void ewol::widget::Entry::markToUpdateTextPosition(void) {
|
||||||
m_needUpdateTextPos=true;
|
m_needUpdateTextPos=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::updateTextPosition(void) {
|
void ewol::widget::Entry::updateTextPosition(void) {
|
||||||
if (false == m_needUpdateTextPos) {
|
if (false == m_needUpdateTextPos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -532,35 +532,35 @@ void widget::Entry::updateTextPosition(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::onGetFocus(void) {
|
void ewol::widget::Entry::onGetFocus(void) {
|
||||||
m_displayCursor = true;
|
m_displayCursor = true;
|
||||||
changeStatusIn(STATUS_SELECTED);
|
changeStatusIn(STATUS_SELECTED);
|
||||||
showKeyboard();
|
showKeyboard();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::onLostFocus(void) {
|
void ewol::widget::Entry::onLostFocus(void) {
|
||||||
m_displayCursor = false;
|
m_displayCursor = false;
|
||||||
changeStatusIn(STATUS_NORMAL);
|
changeStatusIn(STATUS_NORMAL);
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::changeStatusIn(int32_t _newStatusId) {
|
void ewol::widget::Entry::changeStatusIn(int32_t _newStatusId) {
|
||||||
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
if (true == m_shaper.changeStatusIn(_newStatusId) ) {
|
||||||
periodicCallEnable();
|
periodicCallEnable();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::periodicCall(const ewol::EventTime& _event) {
|
void ewol::widget::Entry::periodicCall(const ewol::EventTime& _event) {
|
||||||
if (false == m_shaper.periodicCall(_event) ) {
|
if (false == m_shaper.periodicCall(_event) ) {
|
||||||
periodicCallDisable();
|
periodicCallDisable();
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::setRegExp(const std::string& _expression) {
|
void ewol::widget::Entry::setRegExp(const std::string& _expression) {
|
||||||
std::string previousRegExp = m_regExp.getRegExp();
|
std::string previousRegExp = m_regExp.getRegExp();
|
||||||
EWOL_DEBUG("change input regExp \"" << previousRegExp << "\" == > \"" << _expression << "\"");
|
EWOL_DEBUG("change input regExp \"" << previousRegExp << "\" == > \"" << _expression << "\"");
|
||||||
m_regExp.setRegExp(_expression);
|
m_regExp.setRegExp(_expression);
|
||||||
@ -570,22 +570,22 @@ void widget::Entry::setRegExp(const std::string& _expression) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::setColorText(const etk::Color<>& _color) {
|
void ewol::widget::Entry::setColorText(const etk::Color<>& _color) {
|
||||||
m_textColorFg = _color;
|
m_textColorFg = _color;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::setColorTextSelected(const etk::Color<>& _color) {
|
void ewol::widget::Entry::setColorTextSelected(const etk::Color<>& _color) {
|
||||||
m_textColorBg = _color;
|
m_textColorBg = _color;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::setEmptyText(const std::string& _text) {
|
void ewol::widget::Entry::setEmptyText(const std::string& _text) {
|
||||||
m_textWhenNothing = _text;
|
m_textWhenNothing = _text;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Entry::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::Entry::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == ewol::Widget::onSetConfig(_conf)) {
|
if (true == ewol::Widget::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -612,7 +612,7 @@ bool widget::Entry::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Entry::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::Entry::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#include <etk/Color.h>
|
#include <etk/Color.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
* @brief Entry box display :
|
* @brief Entry box display :
|
||||||
@ -208,7 +209,7 @@ namespace widget {
|
|||||||
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
||||||
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,30 +16,30 @@
|
|||||||
|
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Gird();
|
return new ewol::widget::Gird();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Gird::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::Gird::Gird(int32_t _colNumber) :
|
ewol::widget::Gird::Gird(int32_t _colNumber) :
|
||||||
m_sizeRow(0),
|
m_sizeRow(0),
|
||||||
m_tmpWidget(NULL),
|
m_tmpWidget(NULL),
|
||||||
m_gavityButtom(true),
|
m_gavityButtom(true),
|
||||||
m_borderSize(0,0) {
|
m_borderSize(0,0) {
|
||||||
addObjectType("widget::Gird");
|
addObjectType("ewol::widget::Gird");
|
||||||
setColNumber(_colNumber);
|
setColNumber(_colNumber);
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Gird::~Gird(void) {
|
ewol::widget::Gird::~Gird(void) {
|
||||||
EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} Gird : destroy");
|
EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} Gird : destroy");
|
||||||
subWidgetRemoveAll();
|
subWidgetRemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
|
void ewol::widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
|
||||||
m_borderSize = _newBorderSize;
|
m_borderSize = _newBorderSize;
|
||||||
if (m_borderSize.x() < 0) {
|
if (m_borderSize.x() < 0) {
|
||||||
EWOL_ERROR("Try to set a border size <0 on x : " << m_borderSize.x() << " == > restore to 0");
|
EWOL_ERROR("Try to set a border size <0 on x : " << m_borderSize.x() << " == > restore to 0");
|
||||||
@ -53,7 +53,7 @@ void widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
|
|||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::calculateSize(const vec2& _availlable) {
|
void ewol::widget::Gird::calculateSize(const vec2& _availlable) {
|
||||||
//EWOL_DEBUG("Update size");
|
//EWOL_DEBUG("Update size");
|
||||||
m_size = _availlable;
|
m_size = _availlable;
|
||||||
m_size -= m_borderSize*2;
|
m_size -= m_borderSize*2;
|
||||||
@ -91,7 +91,7 @@ void widget::Gird::calculateSize(const vec2& _availlable) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::calculateMinMaxSize(void) {
|
void ewol::widget::Gird::calculateMinMaxSize(void) {
|
||||||
for (size_t iii=0; iii<m_sizeCol.size(); iii++ ){
|
for (size_t iii=0; iii<m_sizeCol.size(); iii++ ){
|
||||||
if (m_sizeCol[iii] <= 0) {
|
if (m_sizeCol[iii] <= 0) {
|
||||||
m_sizeCol[iii] = 0;
|
m_sizeCol[iii] = 0;
|
||||||
@ -137,7 +137,7 @@ void widget::Gird::calculateMinMaxSize(void) {
|
|||||||
//EWOL_DEBUG("Vert Result : expand="<< m_userExpand << " minSize="<< m_minSize);
|
//EWOL_DEBUG("Vert Result : expand="<< m_userExpand << " minSize="<< m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::setColNumber(int32_t _colNumber) {
|
void ewol::widget::Gird::setColNumber(int32_t _colNumber) {
|
||||||
if ((int64_t)m_sizeCol.size() > _colNumber) {
|
if ((int64_t)m_sizeCol.size() > _colNumber) {
|
||||||
size_t errorControl = m_subWidget.size();
|
size_t errorControl = m_subWidget.size();
|
||||||
// remove subWidget :
|
// remove subWidget :
|
||||||
@ -168,7 +168,7 @@ void widget::Gird::setColNumber(int32_t _colNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::setColSize(int32_t _colId, int32_t _size) {
|
void ewol::widget::Gird::setColSize(int32_t _colId, int32_t _size) {
|
||||||
if ((int64_t)m_sizeCol.size() > _colId) {
|
if ((int64_t)m_sizeCol.size() > _colId) {
|
||||||
m_sizeCol[_colId] = _size;
|
m_sizeCol[_colId] = _size;
|
||||||
} else {
|
} else {
|
||||||
@ -178,11 +178,11 @@ void widget::Gird::setColSize(int32_t _colId, int32_t _size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::setRowSize(int32_t _size) {
|
void ewol::widget::Gird::setRowSize(int32_t _size) {
|
||||||
m_sizeRow = _size;
|
m_sizeRow = _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Gird::getColSize(int32_t _colId) {
|
int32_t ewol::widget::Gird::getColSize(int32_t _colId) {
|
||||||
if ((int64_t)m_sizeCol.size() > _colId) {
|
if ((int64_t)m_sizeCol.size() > _colId) {
|
||||||
if (m_sizeCol[_colId] <= 0) {
|
if (m_sizeCol[_colId] <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -193,11 +193,11 @@ int32_t widget::Gird::getColSize(int32_t _colId) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Gird::getRowSize(void) {
|
int32_t ewol::widget::Gird::getRowSize(void) {
|
||||||
return m_sizeRow;
|
return m_sizeRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::subWidgetRemoveAll(void) {
|
void ewol::widget::Gird::subWidgetRemoveAll(void) {
|
||||||
size_t errorControl = m_subWidget.size();
|
size_t errorControl = m_subWidget.size();
|
||||||
// the size automaticly decrement with the auto call of the onObjectRemove function
|
// the size automaticly decrement with the auto call of the onObjectRemove function
|
||||||
while (m_subWidget.size() > 0 ) {
|
while (m_subWidget.size() > 0 ) {
|
||||||
@ -218,7 +218,7 @@ void widget::Gird::subWidgetRemoveAll(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::Widget* _newWidget) {
|
void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ void widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::Widget* _n
|
|||||||
m_subWidget.push_back(prop);
|
m_subWidget.push_back(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::subWidgetRemove(ewol::Widget* _newWidget)
|
void ewol::widget::Gird::subWidgetRemove(ewol::Widget* _newWidget)
|
||||||
{
|
{
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
return;
|
return;
|
||||||
@ -281,7 +281,7 @@ void widget::Gird::subWidgetRemove(ewol::Widget* _newWidget)
|
|||||||
EWOL_WARNING("[" << getId() << "] Can not remove unExistant widget");
|
EWOL_WARNING("[" << getId() << "] Can not remove unExistant widget");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::subWidgetRemove(int32_t _colId, int32_t _rowId) {
|
void ewol::widget::Gird::subWidgetRemove(int32_t _colId, int32_t _rowId) {
|
||||||
if (_colId<0 || _rowId<0) {
|
if (_colId<0 || _rowId<0) {
|
||||||
EWOL_WARNING("[" << getId() << "] try to remove widget with id < 0 col=" << _colId << " row=" << _rowId);
|
EWOL_WARNING("[" << getId() << "] try to remove widget with id < 0 col=" << _colId << " row=" << _rowId);
|
||||||
return;
|
return;
|
||||||
@ -311,7 +311,7 @@ void widget::Gird::subWidgetRemove(int32_t _colId, int32_t _rowId) {
|
|||||||
EWOL_WARNING("[" << getId() << "] Can not remove unExistant widget");
|
EWOL_WARNING("[" << getId() << "] Can not remove unExistant widget");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::subWidgetUnLink(ewol::Widget* _newWidget) {
|
void ewol::widget::Gird::subWidgetUnLink(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ void widget::Gird::subWidgetUnLink(ewol::Widget* _newWidget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::subWidgetUnLink(int32_t _colId, int32_t _rowId) {
|
void ewol::widget::Gird::subWidgetUnLink(int32_t _colId, int32_t _rowId) {
|
||||||
if (_colId<0 || _rowId<0) {
|
if (_colId<0 || _rowId<0) {
|
||||||
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;
|
||||||
@ -341,7 +341,7 @@ void widget::Gird::subWidgetUnLink(int32_t _colId, int32_t _rowId) {
|
|||||||
EWOL_WARNING("[" << getId() << "] Can not unLink unExistant widget");
|
EWOL_WARNING("[" << getId() << "] Can not unLink unExistant widget");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::Gird::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
ewol::Widget::systemDraw(_displayProp);
|
ewol::Widget::systemDraw(_displayProp);
|
||||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii].widget) {
|
if (NULL != m_subWidget[iii].widget) {
|
||||||
@ -350,7 +350,7 @@ void widget::Gird::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::onRegenerateDisplay(void) {
|
void ewol::widget::Gird::onRegenerateDisplay(void) {
|
||||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii].widget) {
|
if (NULL != m_subWidget[iii].widget) {
|
||||||
m_subWidget[iii].widget->onRegenerateDisplay();
|
m_subWidget[iii].widget->onRegenerateDisplay();
|
||||||
@ -358,7 +358,7 @@ void widget::Gird::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget * widget::Gird::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget * ewol::widget::Gird::getWidgetAtPos(const vec2& _pos) {
|
||||||
if (true == isHide()) {
|
if (true == isHide()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ ewol::Widget * widget::Gird::getWidgetAtPos(const vec2& _pos) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::onObjectRemove(ewol::EObject * _removeObject) {
|
void ewol::widget::Gird::onObjectRemove(ewol::EObject * _removeObject) {
|
||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::onObjectRemove(_removeObject);
|
ewol::Widget::onObjectRemove(_removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -140,7 +141,7 @@ namespace widget {
|
|||||||
virtual void calculateSize(const vec2& _availlable);
|
virtual void calculateSize(const vec2& _availlable);
|
||||||
virtual void calculateMinMaxSize(void);
|
virtual void calculateMinMaxSize(void);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,25 +17,25 @@
|
|||||||
#define __class__ "Image"
|
#define __class__ "Image"
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Image();
|
return new ewol::widget::Image();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Image::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * const widget::Image::eventPressed = "ewol-widget-image-event-pressed";
|
const char * const ewol::widget::Image::eventPressed = "ewol-widget-image-event-pressed";
|
||||||
|
|
||||||
const char * const widget::Image::configRatio = "ratio";
|
const char * const ewol::widget::Image::configRatio = "ratio";
|
||||||
const char * const widget::Image::configSize = "size";
|
const char * const ewol::widget::Image::configSize = "size";
|
||||||
const char * const widget::Image::configBorder = "border";
|
const char * const ewol::widget::Image::configBorder = "border";
|
||||||
const char * const widget::Image::configSource = "src";
|
const char * const ewol::widget::Image::configSource = "src";
|
||||||
|
|
||||||
widget::Image::Image(const std::string& _file, const ewol::Dimension& _border) :
|
ewol::widget::Image::Image(const std::string& _file, const ewol::Dimension& _border) :
|
||||||
m_imageSize(vec2(0,0)),
|
m_imageSize(vec2(0,0)),
|
||||||
m_keepRatio(true) {
|
m_keepRatio(true) {
|
||||||
addObjectType("widget::Image");
|
addObjectType("ewol::widget::Image");
|
||||||
addEventId(eventPressed);
|
addEventId(eventPressed);
|
||||||
registerConfig(configRatio, "bool", NULL, "Keep ratio of the image");
|
registerConfig(configRatio, "bool", NULL, "Keep ratio of the image");
|
||||||
registerConfig(configSize, "Dimension", NULL, "Basic display size of the image");
|
registerConfig(configSize, "Dimension", NULL, "Basic display size of the image");
|
||||||
@ -45,7 +45,7 @@ widget::Image::Image(const std::string& _file, const ewol::Dimension& _border) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Image::setFile(const std::string& _file) {
|
void ewol::widget::Image::setFile(const std::string& _file) {
|
||||||
EWOL_VERBOSE("Set Image : " << _file);
|
EWOL_VERBOSE("Set Image : " << _file);
|
||||||
if (m_fileName != _file) {
|
if (m_fileName != _file) {
|
||||||
// copy data :
|
// copy data :
|
||||||
@ -57,7 +57,7 @@ void widget::Image::setFile(const std::string& _file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::setBorder(const ewol::Dimension& _border) {
|
void ewol::widget::Image::setBorder(const ewol::Dimension& _border) {
|
||||||
EWOL_VERBOSE("Set border=" << _border);
|
EWOL_VERBOSE("Set border=" << _border);
|
||||||
// copy data :
|
// copy data :
|
||||||
m_border = _border;
|
m_border = _border;
|
||||||
@ -67,7 +67,7 @@ void widget::Image::setBorder(const ewol::Dimension& _border) {
|
|||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::setKeepRatio(bool _keep) {
|
void ewol::widget::Image::setKeepRatio(bool _keep) {
|
||||||
if (m_keepRatio != _keep) {
|
if (m_keepRatio != _keep) {
|
||||||
// copy data :
|
// copy data :
|
||||||
m_keepRatio = _keep;
|
m_keepRatio = _keep;
|
||||||
@ -77,7 +77,7 @@ void widget::Image::setKeepRatio(bool _keep) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::setImageSize(const ewol::Dimension& _size) {
|
void ewol::widget::Image::setImageSize(const ewol::Dimension& _size) {
|
||||||
EWOL_VERBOSE("Set Image size : " << _size);
|
EWOL_VERBOSE("Set Image size : " << _size);
|
||||||
if (_size != m_imageSize) {
|
if (_size != m_imageSize) {
|
||||||
m_imageSize = _size;
|
m_imageSize = _size;
|
||||||
@ -88,7 +88,7 @@ void widget::Image::setImageSize(const ewol::Dimension& _size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::set(const std::string& _file, const ewol::Dimension& _border) {
|
void ewol::widget::Image::set(const std::string& _file, const ewol::Dimension& _border) {
|
||||||
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
|
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
|
||||||
// copy data :
|
// copy data :
|
||||||
if (m_border != _border) {
|
if (m_border != _border) {
|
||||||
@ -99,11 +99,11 @@ void widget::Image::set(const std::string& _file, const ewol::Dimension& _border
|
|||||||
setFile(_file);
|
setFile(_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::onDraw(void) {
|
void ewol::widget::Image::onDraw(void) {
|
||||||
m_compositing.draw();
|
m_compositing.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::onRegenerateDisplay(void) {
|
void ewol::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();
|
||||||
@ -149,7 +149,7 @@ void widget::Image::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::calculateMinMaxSize(void) {
|
void ewol::widget::Image::calculateMinMaxSize(void) {
|
||||||
vec2 imageBoder = m_border.getPixel()*2.0f;
|
vec2 imageBoder = m_border.getPixel()*2.0f;
|
||||||
vec2 imageSize = m_imageSize.getPixel();
|
vec2 imageSize = m_imageSize.getPixel();
|
||||||
if (imageSize!=vec2(0,0)) {
|
if (imageSize!=vec2(0,0)) {
|
||||||
@ -170,7 +170,7 @@ void widget::Image::calculateMinMaxSize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::Image::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Image::onEventInput(const ewol::EventInput& _event) {
|
||||||
//EWOL_DEBUG("Event on BT ...");
|
//EWOL_DEBUG("Event on BT ...");
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
if(ewol::keyEvent::statusSingle == _event.getStatus()) {
|
if(ewol::keyEvent::statusSingle == _event.getStatus()) {
|
||||||
@ -181,7 +181,7 @@ bool widget::Image::onEventInput(const ewol::EventInput& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Image::loadXML(exml::Element* _node) {
|
bool ewol::widget::Image::loadXML(exml::Element* _node) {
|
||||||
if (NULL == _node) {
|
if (NULL == _node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ bool widget::Image::loadXML(exml::Element* _node) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Image::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::Image::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == ewol::Widget::onSetConfig(_conf)) {
|
if (true == ewol::Widget::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ bool widget::Image::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Image::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::Image::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
extern const char * const ewolEventImagePressed;
|
extern const char * const ewolEventImagePressed;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -124,6 +125,7 @@ namespace widget {
|
|||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
virtual bool loadXML(exml::Element* _node);
|
virtual bool loadXML(exml::Element* _node);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ static float l_ratio(1.0/7.0);
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Joystick"
|
#define __class__ "Joystick"
|
||||||
|
|
||||||
widget::Joystick::Joystick(void) {
|
ewol::widget::Joystick::Joystick(void) {
|
||||||
addObjectType("widget::Joystick");
|
addObjectType("ewol::widget::Joystick");
|
||||||
addEventId(ewolEventJoystickEnable);
|
addEventId(ewolEventJoystickEnable);
|
||||||
addEventId(ewolEventJoystickDisable);
|
addEventId(ewolEventJoystickDisable);
|
||||||
addEventId(ewolEventJoystickMove);
|
addEventId(ewolEventJoystickMove);
|
||||||
@ -51,18 +51,18 @@ widget::Joystick::Joystick(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::Joystick::~Joystick(void) {
|
ewol::widget::Joystick::~Joystick(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Joystick::calculateSize(const vec2& availlable) {
|
void ewol::widget::Joystick::calculateSize(const vec2& availlable) {
|
||||||
float minimumSize = etk_min(availlable.x(), availlable.y());
|
float minimumSize = etk_min(availlable.x(), availlable.y());
|
||||||
m_size.setValue(minimumSize, minimumSize);
|
m_size.setValue(minimumSize, minimumSize);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Joystick::onRegenerateDisplay(void) {
|
void ewol::widget::Joystick::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ Sine Function: sin(teta) = Opposite / Hypotenuse
|
|||||||
Cosine Function: cos(teta) = Adjacent / Hypotenuse
|
Cosine Function: cos(teta) = Adjacent / Hypotenuse
|
||||||
Tangent Function: tan(teta) = Opposite / Adjacent
|
Tangent Function: tan(teta) = Opposite / Adjacent
|
||||||
*/
|
*/
|
||||||
bool widget::Joystick::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Joystick::onEventInput(const ewol::EventInput& _event) {
|
||||||
/*
|
/*
|
||||||
if (1 == IdInput) {
|
if (1 == IdInput) {
|
||||||
if( ewol::keyEvent::statusDown == typeEvent
|
if( ewol::keyEvent::statusDown == typeEvent
|
||||||
@ -173,7 +173,7 @@ bool widget::Joystick::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Joystick::ratio(float newRatio) {
|
void ewol::widget::Joystick::ratio(float newRatio) {
|
||||||
if (newRatio > 1) {
|
if (newRatio > 1) {
|
||||||
newRatio = 1;
|
newRatio = 1;
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ void widget::Joystick::ratio(float newRatio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Joystick::background(std::string imageNameInData, bool display) {
|
void ewol::widget::Joystick::background(std::string imageNameInData, bool display) {
|
||||||
// TODO : check if it existed
|
// TODO : check if it existed
|
||||||
m_background = imageNameInData;
|
m_background = imageNameInData;
|
||||||
m_displayBackground = display;
|
m_displayBackground = display;
|
||||||
@ -190,14 +190,14 @@ void widget::Joystick::background(std::string imageNameInData, bool display) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Joystick::foreground(std::string imageNameInData) {
|
void ewol::widget::Joystick::foreground(std::string imageNameInData) {
|
||||||
// TODO : check if it existed
|
// TODO : check if it existed
|
||||||
m_foreground = imageNameInData;
|
m_foreground = imageNameInData;
|
||||||
EWOL_INFO("Set default Joystick Foreground at " << m_foreground);
|
EWOL_INFO("Set default Joystick Foreground at " << m_foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Joystick::getProperty(float& distance, float& angle) {
|
void ewol::widget::Joystick::getProperty(float& distance, float& angle) {
|
||||||
distance = m_distance;
|
distance = m_distance;
|
||||||
angle = m_angle+M_PI/2;
|
angle = m_angle+M_PI/2;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ extern const char * const ewolEventJoystickEnable;
|
|||||||
extern const char * const ewolEventJoystickDisable;
|
extern const char * const ewolEventJoystickDisable;
|
||||||
extern const char * const ewolEventJoystickMove;
|
extern const char * const ewolEventJoystickMove;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -80,6 +81,7 @@ namespace widget {
|
|||||||
virtual void onRegenerateDisplay(void);
|
virtual void onRegenerateDisplay(void);
|
||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,24 +15,24 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Label"
|
#define __class__ "Label"
|
||||||
|
|
||||||
const char * const widget::Label::eventPressed = "ewol-widget-label-event-pressed";
|
const char * const ewol::widget::Label::eventPressed = "ewol-widget-label-event-pressed";
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Label();
|
return new ewol::widget::Label();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Label::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Label::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Label::Label(std::string _newLabel) {
|
ewol::widget::Label::Label(std::string _newLabel) {
|
||||||
addObjectType("widget::Label");
|
addObjectType("ewol::widget::Label");
|
||||||
m_label = _newLabel;
|
m_label = _newLabel;
|
||||||
addEventId(eventPressed);
|
addEventId(eventPressed);
|
||||||
setCanHaveFocus(false);
|
setCanHaveFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Label::calculateMinMaxSize(void) {
|
void ewol::widget::Label::calculateMinMaxSize(void) {
|
||||||
vec2 tmpMax = m_userMaxSize.getPixel();
|
vec2 tmpMax = m_userMaxSize.getPixel();
|
||||||
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
|
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
|
||||||
if (tmpMax.x() <= 999999) {
|
if (tmpMax.x() <= 999999) {
|
||||||
@ -47,21 +47,21 @@ void widget::Label::calculateMinMaxSize(void) {
|
|||||||
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Label::setLabel(const std::string& _newLabel) {
|
void ewol::widget::Label::setLabel(const std::string& _newLabel) {
|
||||||
m_label = _newLabel;
|
m_label = _newLabel;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string widget::Label::getLabel(void) {
|
std::string ewol::widget::Label::getLabel(void) {
|
||||||
return m_label;
|
return m_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Label::onDraw(void) {
|
void ewol::widget::Label::onDraw(void) {
|
||||||
m_text.draw();
|
m_text.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Label::onRegenerateDisplay(void) {
|
void ewol::widget::Label::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
m_text.clear();
|
m_text.clear();
|
||||||
int32_t paddingSize = 2;
|
int32_t paddingSize = 2;
|
||||||
@ -110,7 +110,7 @@ void widget::Label::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Label::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Label::onEventInput(const ewol::EventInput& _event) {
|
||||||
//EWOL_DEBUG("Event on Label ...");
|
//EWOL_DEBUG("Event on Label ...");
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
|
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
|
||||||
@ -122,7 +122,7 @@ bool widget::Label::onEventInput(const ewol::EventInput& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Label::loadXML(exml::Element* _node) {
|
bool ewol::widget::Label::loadXML(exml::Element* _node) {
|
||||||
if (NULL == _node) {
|
if (NULL == _node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -66,6 +67,7 @@ namespace widget {
|
|||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
virtual bool loadXML(exml::Element* _node);
|
virtual bool loadXML(exml::Element* _node);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,22 +14,22 @@
|
|||||||
#define __class__ "Layer"
|
#define __class__ "Layer"
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Layer();
|
return new ewol::widget::Layer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Layer::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Layer::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Layer::Layer(void) {
|
ewol::widget::Layer::Layer(void) {
|
||||||
addObjectType("widget::Layer");
|
addObjectType("ewol::widget::Layer");
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Layer::~Layer(void) {
|
ewol::widget::Layer::~Layer(void) {
|
||||||
EWOL_DEBUG("[" << getId() << "] Layer : destroy");
|
EWOL_DEBUG("[" << getId() << "] Layer : destroy");
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::Layer::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::Layer::getWidgetAtPos(const vec2& _pos) {
|
||||||
if (true == isHide()) {
|
if (true == isHide()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#include <ewol/widget/ContainerN.h>
|
#include <ewol/widget/ContainerN.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -36,7 +37,7 @@ namespace widget {
|
|||||||
public: // Derived function
|
public: // Derived function
|
||||||
virtual ewol::Widget* getWidgetAtPos(const vec2& _pos);
|
virtual ewol::Widget* getWidgetAtPos(const vec2& _pos);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
#define __class__ "List"
|
#define __class__ "List"
|
||||||
|
|
||||||
|
|
||||||
widget::List::List(void) {
|
ewol::widget::List::List(void) {
|
||||||
addObjectType("widget::List");
|
addObjectType("ewol::widget::List");
|
||||||
m_paddingSizeX = 2;
|
m_paddingSizeX = 2;
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
m_paddingSizeY = 10;
|
m_paddingSizeY = 10;
|
||||||
@ -28,7 +28,7 @@ widget::List::List(void) {
|
|||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::List::~List(void) {
|
ewol::widget::List::~List(void) {
|
||||||
//clean all the object
|
//clean all the object
|
||||||
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
||||||
delete(m_listOObject[iii]);
|
delete(m_listOObject[iii]);
|
||||||
@ -37,7 +37,7 @@ widget::List::~List(void) {
|
|||||||
m_listOObject.clear();
|
m_listOObject.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::setRawVisible(int32_t _id) {
|
void ewol::widget::List::setRawVisible(int32_t _id) {
|
||||||
EWOL_DEBUG("Set Raw visible : " << _id);
|
EWOL_DEBUG("Set Raw visible : " << _id);
|
||||||
if (_id<0) {
|
if (_id<0) {
|
||||||
return;
|
return;
|
||||||
@ -63,7 +63,7 @@ void widget::List::setRawVisible(int32_t _id) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::calculateMinMaxSize(void) {
|
void ewol::widget::List::calculateMinMaxSize(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);
|
||||||
int32_t minHeight = ewol::getHeight(fontId);
|
int32_t minHeight = ewol::getHeight(fontId);
|
||||||
@ -73,7 +73,7 @@ void widget::List::calculateMinMaxSize(void) {
|
|||||||
m_minSize.setValue(200, 150);
|
m_minSize.setValue(200, 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::addOObject(ewol::Compositing* _newObject, int32_t _pos) {
|
void ewol::widget::List::addOObject(ewol::Compositing* _newObject, int32_t _pos) {
|
||||||
if (NULL == _newObject) {
|
if (NULL == _newObject) {
|
||||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||||
return;
|
return;
|
||||||
@ -85,7 +85,7 @@ void widget::List::addOObject(ewol::Compositing* _newObject, int32_t _pos) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::clearOObjectList(void) {
|
void ewol::widget::List::clearOObjectList(void) {
|
||||||
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
||||||
delete(m_listOObject[iii]);
|
delete(m_listOObject[iii]);
|
||||||
m_listOObject[iii] = NULL;
|
m_listOObject[iii] = NULL;
|
||||||
@ -93,7 +93,7 @@ void widget::List::clearOObjectList(void) {
|
|||||||
m_listOObject.clear();
|
m_listOObject.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::onDraw(void) {
|
void ewol::widget::List::onDraw(void) {
|
||||||
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
||||||
if (NULL != m_listOObject[iii]) {
|
if (NULL != m_listOObject[iii]) {
|
||||||
m_listOObject[iii]->draw();
|
m_listOObject[iii]->draw();
|
||||||
@ -102,7 +102,7 @@ void widget::List::onDraw(void) {
|
|||||||
WidgetScrooled::onDraw();
|
WidgetScrooled::onDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::onRegenerateDisplay(void) {
|
void ewol::widget::List::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
|
|
||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
@ -212,7 +212,7 @@ void widget::List::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::List::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::List::onEventInput(const ewol::EventInput& _event) {
|
||||||
vec2 relativePos = relativePosition(_event.getPos());
|
vec2 relativePos = relativePosition(_event.getPos());
|
||||||
|
|
||||||
if (true == WidgetScrooled::onEventInput(_event)) {
|
if (true == WidgetScrooled::onEventInput(_event)) {
|
||||||
@ -240,10 +240,10 @@ bool widget::List::onEventInput(const ewol::EventInput& _event) {
|
|||||||
return isUsed;
|
return isUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::onGetFocus(void) {
|
void ewol::widget::List::onGetFocus(void) {
|
||||||
EWOL_DEBUG("Ewol::List get focus");
|
EWOL_DEBUG("Ewol::List get focus");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::List::onLostFocus(void) {
|
void ewol::widget::List::onLostFocus(void) {
|
||||||
EWOL_DEBUG("Ewol::List Lost focus");
|
EWOL_DEBUG("Ewol::List Lost focus");
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
#include <ewol/widget/WidgetScrolled.h>
|
#include <ewol/widget/WidgetScrolled.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compositing.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -81,6 +82,7 @@ namespace widget {
|
|||||||
virtual void onRegenerateDisplay(void);
|
virtual void onRegenerateDisplay(void);
|
||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,8 +21,8 @@ extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-fo
|
|||||||
extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate";
|
extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate";
|
||||||
|
|
||||||
|
|
||||||
widget::ListFileSystem::ListFileSystem(void) {
|
ewol::widget::ListFileSystem::ListFileSystem(void) {
|
||||||
addObjectType("widget::ListFileSystem");
|
addObjectType("ewol::widget::ListFileSystem");
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
m_showFile = true;
|
m_showFile = true;
|
||||||
m_showTemporaryFile = true;
|
m_showTemporaryFile = true;
|
||||||
@ -40,7 +40,7 @@ widget::ListFileSystem::ListFileSystem(void) {
|
|||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
widget::ListFileSystem::~ListFileSystem(void) {
|
ewol::widget::ListFileSystem::~ListFileSystem(void) {
|
||||||
for (size_t iii=0; iii<m_list.size(); iii++) {
|
for (size_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
delete(m_list[iii]);
|
delete(m_list[iii]);
|
||||||
@ -49,12 +49,12 @@ widget::ListFileSystem::~ListFileSystem(void) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
etk::Color<> widget::ListFileSystem::getBasicBG(void) {
|
etk::Color<> ewol::widget::ListFileSystem::getBasicBG(void) {
|
||||||
return etk::Color<>(0x00000010);
|
return etk::Color<>(0x00000010);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::ListFileSystem::regenerateView(void) {
|
void ewol::widget::ListFileSystem::regenerateView(void) {
|
||||||
// clean the list of files :
|
// clean the list of files :
|
||||||
for (size_t iii=0; iii<m_list.size(); iii++) {
|
for (size_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
@ -73,36 +73,36 @@ void widget::ListFileSystem::regenerateView(void) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ListFileSystem::setShowHiddenFiles(bool _state) {
|
void ewol::widget::ListFileSystem::setShowHiddenFiles(bool _state) {
|
||||||
m_showHidden = _state;
|
m_showHidden = _state;
|
||||||
regenerateView();
|
regenerateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ListFileSystem::setShowTemporaryFiles(bool _state) {
|
void ewol::widget::ListFileSystem::setShowTemporaryFiles(bool _state) {
|
||||||
m_showTemporaryFile = _state;
|
m_showTemporaryFile = _state;
|
||||||
regenerateView();
|
regenerateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ListFileSystem::setShowFiles(bool _state) {
|
void ewol::widget::ListFileSystem::setShowFiles(bool _state) {
|
||||||
m_showFile = _state;
|
m_showFile = _state;
|
||||||
regenerateView();
|
regenerateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ListFileSystem::setShowFolder(bool _state) {
|
void ewol::widget::ListFileSystem::setShowFolder(bool _state) {
|
||||||
m_showFolder = _state;
|
m_showFolder = _state;
|
||||||
regenerateView();
|
regenerateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ListFileSystem::setFolder(std::string _newFolder) {
|
void ewol::widget::ListFileSystem::setFolder(std::string _newFolder) {
|
||||||
m_folder = _newFolder;
|
m_folder = _newFolder;
|
||||||
regenerateView();
|
regenerateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string widget::ListFileSystem::getFolder(void) {
|
std::string ewol::widget::ListFileSystem::getFolder(void) {
|
||||||
return m_folder;
|
return m_folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string widget::ListFileSystem::getSelect(void) {
|
std::string ewol::widget::ListFileSystem::getSelect(void) {
|
||||||
std::string tmpVal = "";
|
std::string tmpVal = "";
|
||||||
if (m_selectedLine >= 0) {
|
if (m_selectedLine >= 0) {
|
||||||
if (m_list[m_selectedLine] != NULL) {
|
if (m_list[m_selectedLine] != NULL) {
|
||||||
@ -113,7 +113,7 @@ std::string widget::ListFileSystem::getSelect(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// select the specific file
|
// select the specific file
|
||||||
void widget::ListFileSystem::setSelect( std::string _data) {
|
void ewol::widget::ListFileSystem::setSelect( std::string _data) {
|
||||||
// remove selected line
|
// remove selected line
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
// search the coresponding file :
|
// search the coresponding file :
|
||||||
@ -129,16 +129,16 @@ void widget::ListFileSystem::setSelect( std::string _data) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t widget::ListFileSystem::getNuberOfColomn(void) {
|
uint32_t ewol::widget::ListFileSystem::getNuberOfColomn(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::ListFileSystem::getTitle(int32_t _colomn, std::string &_myTitle, etk::Color<>& _fg, etk::Color<>& _bg) {
|
bool ewol::widget::ListFileSystem::getTitle(int32_t _colomn, std::string &_myTitle, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||||
_myTitle = "title";
|
_myTitle = "title";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t widget::ListFileSystem::getNuberOfRaw(void) {
|
uint32_t ewol::widget::ListFileSystem::getNuberOfRaw(void) {
|
||||||
int32_t offset = 0;
|
int32_t offset = 0;
|
||||||
if (true == m_showFolder) {
|
if (true == m_showFolder) {
|
||||||
offset = 2;
|
offset = 2;
|
||||||
@ -146,7 +146,7 @@ uint32_t widget::ListFileSystem::getNuberOfRaw(void) {
|
|||||||
return m_list.size() + offset;
|
return m_list.size() + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
bool ewol::widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||||
int32_t offset = 0;
|
int32_t offset = 0;
|
||||||
if (true == m_showFolder) {
|
if (true == m_showFolder) {
|
||||||
offset = 2;
|
offset = 2;
|
||||||
@ -180,7 +180,7 @@ bool widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std::stri
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool widget::ListFileSystem::onItemEvent(int32_t _IdInput,
|
bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
|
||||||
enum ewol::keyEvent::status _typeEvent,
|
enum ewol::keyEvent::status _typeEvent,
|
||||||
int32_t _colomn,
|
int32_t _colomn,
|
||||||
int32_t _raw,
|
int32_t _raw,
|
||||||
|
@ -17,7 +17,8 @@ extern const char * const ewolEventFSFileValidate;
|
|||||||
extern const char * const ewolEventFSFolderSelect;
|
extern const char * const ewolEventFSFolderSelect;
|
||||||
extern const char * const ewolEventFSFolderValidate;
|
extern const char * const ewolEventFSFolderValidate;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -54,6 +55,7 @@ namespace widget {
|
|||||||
void setShowHiddenFiles(bool _state);
|
void setShowHiddenFiles(bool _state);
|
||||||
void setShowTemporaryFiles(bool _state);
|
void setShowTemporaryFiles(bool _state);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,35 +18,35 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Menu"
|
#define __class__ "Menu"
|
||||||
|
|
||||||
widget::Menu::Menu(void) {
|
ewol::widget::Menu::Menu(void) {
|
||||||
addObjectType("widget::Menu");
|
addObjectType("ewol::widget::Menu");
|
||||||
m_staticId = 0;
|
m_staticId = 0;
|
||||||
m_widgetContextMenu = NULL;
|
m_widgetContextMenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Menu::~Menu(void) {
|
ewol::widget::Menu::~Menu(void) {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Menu::subWidgetRemoveAll(void) {
|
void ewol::widget::Menu::subWidgetRemoveAll(void) {
|
||||||
clear();
|
clear();
|
||||||
widget::Sizer::subWidgetRemoveAll();
|
widget::Sizer::subWidgetRemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Menu::subWidgetAdd(ewol::Widget* _newWidget) {
|
int32_t ewol::widget::Menu::subWidgetAdd(ewol::Widget* _newWidget) {
|
||||||
EWOL_ERROR("Not availlable");
|
EWOL_ERROR("Not availlable");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Menu::subWidgetRemove(ewol::Widget* _newWidget) {
|
void ewol::widget::Menu::subWidgetRemove(ewol::Widget* _newWidget) {
|
||||||
EWOL_ERROR("Not availlable");
|
EWOL_ERROR("Not availlable");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Menu::subWidgetUnLink(ewol::Widget* _newWidget) {
|
void ewol::widget::Menu::subWidgetUnLink(ewol::Widget* _newWidget) {
|
||||||
EWOL_ERROR("Not availlable");
|
EWOL_ERROR("Not availlable");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Menu::clear(void) {
|
void ewol::widget::Menu::clear(void) {
|
||||||
for (size_t iii=0; iii < m_listElement.size(); iii++) {
|
for (size_t iii=0; iii < m_listElement.size(); iii++) {
|
||||||
if (m_listElement[iii] != NULL) {
|
if (m_listElement[iii] != NULL) {
|
||||||
delete(m_listElement[iii]);
|
delete(m_listElement[iii]);
|
||||||
@ -56,19 +56,19 @@ void widget::Menu::clear(void) {
|
|||||||
m_listElement.clear();
|
m_listElement.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Menu::addTitle(std::string _label,
|
int32_t ewol::widget::Menu::addTitle(std::string _label,
|
||||||
std::string _image,
|
std::string _image,
|
||||||
const char * _generateEvent,
|
const char * _generateEvent,
|
||||||
const std::string _message) {
|
const std::string _message) {
|
||||||
return add(-1, _label, _image, _generateEvent, _message);
|
return add(-1, _label, _image, _generateEvent, _message);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Menu::add(int32_t _parent,
|
int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||||
std::string _label,
|
std::string _label,
|
||||||
std::string _image,
|
std::string _image,
|
||||||
const char *_generateEvent,
|
const char *_generateEvent,
|
||||||
const std::string _message) {
|
const std::string _message) {
|
||||||
widget::MenuElement *tmpObject = new widget::MenuElement();
|
ewol::widget::MenuElement *tmpObject = new ewol::widget::MenuElement();
|
||||||
if (NULL == tmpObject) {
|
if (NULL == tmpObject) {
|
||||||
EWOL_ERROR("Allocation problem");
|
EWOL_ERROR("Allocation problem");
|
||||||
return -1;
|
return -1;
|
||||||
@ -110,12 +110,12 @@ int32_t widget::Menu::add(int32_t _parent,
|
|||||||
return tmpObject->m_localId;
|
return tmpObject->m_localId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Menu::addSpacer(void) {
|
void ewol::widget::Menu::addSpacer(void) {
|
||||||
EWOL_TODO("NOT now...");
|
EWOL_TODO("NOT now...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Menu::onReceiveMessage(const ewol::EMessage& _msg) {
|
void ewol::widget::Menu::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||||
/*
|
/*
|
||||||
if (true == ewol::sizer::onReceiveMessage(_msg) {
|
if (true == ewol::sizer::onReceiveMessage(_msg) {
|
||||||
return true;
|
return true;
|
||||||
@ -251,7 +251,7 @@ void widget::Menu::onReceiveMessage(const ewol::EMessage& _msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Menu::onObjectRemove(ewol::EObject * _removeObject) {
|
void ewol::widget::Menu::onObjectRemove(ewol::EObject * _removeObject) {
|
||||||
widget::Sizer::onObjectRemove(_removeObject);
|
widget::Sizer::onObjectRemove(_removeObject);
|
||||||
if (m_widgetContextMenu == _removeObject) {
|
if (m_widgetContextMenu == _removeObject) {
|
||||||
m_widgetContextMenu = NULL;
|
m_widgetContextMenu = NULL;
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/widget/Sizer.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/ContextMenu.h>
|
#include <ewol/widget/ContextMenu.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
class MenuElement {
|
class MenuElement {
|
||||||
public :
|
public :
|
||||||
MenuElement(void) : m_widgetPointer(NULL) { };
|
MenuElement(void) : m_widgetPointer(NULL) { };
|
||||||
@ -53,6 +54,7 @@ namespace widget {
|
|||||||
virtual void onReceiveMessage(const ewol::EMessage& _msg);
|
virtual void onReceiveMessage(const ewol::EMessage& _msg);
|
||||||
virtual void onObjectRemove(ewol::EObject * _removeObject);
|
virtual void onObjectRemove(ewol::EObject * _removeObject);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,14 +18,14 @@ extern const char * const ewolEventMeshPressed = "ewol-mesh-Pressed";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
widget::Mesh::Mesh(const std::string& _filename) :
|
ewol::widget::Mesh::Mesh(const std::string& _filename) :
|
||||||
m_meshName(_filename),
|
m_meshName(_filename),
|
||||||
m_object(NULL),
|
m_object(NULL),
|
||||||
m_position(0,0,0),
|
m_position(0,0,0),
|
||||||
m_angle(0,0,0),
|
m_angle(0,0,0),
|
||||||
m_angleSpeed(0,0,0),
|
m_angleSpeed(0,0,0),
|
||||||
m_cameraDistance(10.0) {
|
m_cameraDistance(10.0) {
|
||||||
addObjectType("widget::Mesh");
|
addObjectType("ewol::widget::Mesh");
|
||||||
addEventId(ewolEventMeshPressed);
|
addEventId(ewolEventMeshPressed);
|
||||||
// Limit event at 1:
|
// Limit event at 1:
|
||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
@ -37,11 +37,11 @@ widget::Mesh::Mesh(const std::string& _filename) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Mesh::~Mesh(void) {
|
ewol::widget::Mesh::~Mesh(void) {
|
||||||
ewol::Mesh::release(m_object);
|
ewol::Mesh::release(m_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::onDraw(void) {
|
void ewol::widget::Mesh::onDraw(void) {
|
||||||
mat4 transformationMatrix = etk::matTranslate(vec3(0,0,-m_cameraDistance))
|
mat4 transformationMatrix = etk::matTranslate(vec3(0,0,-m_cameraDistance))
|
||||||
* etk::matTranslate(m_position)
|
* etk::matTranslate(m_position)
|
||||||
* etk::matRotate(vec3(1,0,0),m_angle.x())
|
* etk::matRotate(vec3(1,0,0),m_angle.x())
|
||||||
@ -52,7 +52,7 @@ void widget::Mesh::onDraw(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
ewol::openGL::push();
|
ewol::openGL::push();
|
||||||
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
|
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
|
||||||
glViewport( m_origin.x(),
|
glViewport( m_origin.x(),
|
||||||
@ -71,18 +71,18 @@ void widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
ewol::openGL::pop();
|
ewol::openGL::pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::onRegenerateDisplay(void) {
|
void ewol::widget::Mesh::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::periodicCall(const ewol::EventTime& _event) {
|
void ewol::widget::Mesh::periodicCall(const ewol::EventTime& _event) {
|
||||||
m_angle += m_angleSpeed*_event.getDeltaCall();
|
m_angle += m_angleSpeed*_event.getDeltaCall();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Mesh::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Mesh::onEventInput(const ewol::EventInput& _event) {
|
||||||
//EWOL_DEBUG("Event on BT ...");
|
//EWOL_DEBUG("Event on BT ...");
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
if(ewol::keyEvent::statusSingle == _event.getStatus()) {
|
if(ewol::keyEvent::statusSingle == _event.getStatus()) {
|
||||||
@ -93,7 +93,7 @@ bool widget::Mesh::onEventInput(const ewol::EventInput& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::setFile(const std::string& _filename) {
|
void ewol::widget::Mesh::setFile(const std::string& _filename) {
|
||||||
if( _filename!=""
|
if( _filename!=""
|
||||||
&& m_meshName != _filename ) {
|
&& m_meshName != _filename ) {
|
||||||
ewol::Mesh::release(m_object);
|
ewol::Mesh::release(m_object);
|
||||||
@ -106,17 +106,17 @@ void widget::Mesh::setFile(const std::string& _filename) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::setPosition(const vec3& _pos) {
|
void ewol::widget::Mesh::setPosition(const vec3& _pos) {
|
||||||
m_position = _pos;
|
m_position = _pos;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::setAngle(const vec3& _angle) {
|
void ewol::widget::Mesh::setAngle(const vec3& _angle) {
|
||||||
m_angle = _angle;
|
m_angle = _angle;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::setAngleSpeed(const vec3& _speed) {
|
void ewol::widget::Mesh::setAngleSpeed(const vec3& _speed) {
|
||||||
if (_speed!=vec3(0,0,0)) {
|
if (_speed!=vec3(0,0,0)) {
|
||||||
periodicCallEnable();
|
periodicCallEnable();
|
||||||
} else {
|
} else {
|
||||||
@ -126,7 +126,7 @@ void widget::Mesh::setAngleSpeed(const vec3& _speed) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Mesh::setDistance(float _distance)
|
void ewol::widget::Mesh::setDistance(float _distance)
|
||||||
{
|
{
|
||||||
m_cameraDistance = _distance;
|
m_cameraDistance = _distance;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
extern const char * const ewolEventMeshPressed;
|
extern const char * const ewolEventMeshPressed;
|
||||||
|
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -66,6 +67,7 @@ namespace widget {
|
|||||||
*/
|
*/
|
||||||
void setDistance(float distance);
|
void setDistance(float distance);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,26 +15,26 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "PopUp"
|
#define __class__ "PopUp"
|
||||||
|
|
||||||
const char* const widget::PopUp::configShaper="shaper";
|
const char* const ewol::widget::PopUp::configShaper="shaper";
|
||||||
const char* const widget::PopUp::configRemoveOnExternClick="out-click-remove";
|
const char* const ewol::widget::PopUp::configRemoveOnExternClick="out-click-remove";
|
||||||
const char* const widget::PopUp::configAnimation="animation";
|
const char* const ewol::widget::PopUp::configAnimation="animation";
|
||||||
const char* const widget::PopUp::configLockExpand="lock";
|
const char* const ewol::widget::PopUp::configLockExpand="lock";
|
||||||
|
|
||||||
static const char* annimationIncrease = "increase";
|
static const char* annimationIncrease = "increase";
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::PopUp();
|
return new ewol::widget::PopUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::PopUp::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::PopUp::PopUp(const std::string& _shaperName) :
|
ewol::widget::PopUp::PopUp(const std::string& _shaperName) :
|
||||||
m_shaper(_shaperName),
|
m_shaper(_shaperName),
|
||||||
m_lockExpand(true,true),
|
m_lockExpand(true,true),
|
||||||
m_closeOutEvent(false) {
|
m_closeOutEvent(false) {
|
||||||
addObjectType("widget::PopUp");
|
addObjectType("ewol::widget::PopUp");
|
||||||
m_userExpand.setValue(false, false);
|
m_userExpand.setValue(false, false);
|
||||||
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
|
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
|
||||||
registerConfig(configShaper, "string", NULL, "The shaper properties");
|
registerConfig(configShaper, "string", NULL, "The shaper properties");
|
||||||
@ -46,11 +46,11 @@ widget::PopUp::PopUp(const std::string& _shaperName) :
|
|||||||
addAnnimationType(ewol::Widget::annimationModeEnableAdd, annimationIncrease);
|
addAnnimationType(ewol::Widget::annimationModeEnableAdd, annimationIncrease);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::PopUp::~PopUp(void) {
|
ewol::widget::PopUp::~PopUp(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::lockExpand(const bvec2& _lockExpand) {
|
void ewol::widget::PopUp::lockExpand(const bvec2& _lockExpand) {
|
||||||
if (_lockExpand != m_lockExpand) {
|
if (_lockExpand != m_lockExpand) {
|
||||||
m_lockExpand = _lockExpand;
|
m_lockExpand = _lockExpand;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -58,12 +58,12 @@ void widget::PopUp::lockExpand(const bvec2& _lockExpand) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::setShaperName(const std::string& _shaperName) {
|
void ewol::widget::PopUp::setShaperName(const std::string& _shaperName) {
|
||||||
m_shaper.setSource(_shaperName);
|
m_shaper.setSource(_shaperName);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::calculateSize(const vec2& _available) {
|
void ewol::widget::PopUp::calculateSize(const vec2& _available) {
|
||||||
ewol::Widget::calculateSize(_available);
|
ewol::Widget::calculateSize(_available);
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
@ -97,7 +97,7 @@ void widget::PopUp::calculateSize(const vec2& _available) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::PopUp::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
if (true == m_hide){
|
if (true == m_hide){
|
||||||
// widget is hidden ...
|
// widget is hidden ...
|
||||||
return;
|
return;
|
||||||
@ -113,11 +113,11 @@ void widget::PopUp::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::onDraw(void) {
|
void ewol::widget::PopUp::onDraw(void) {
|
||||||
m_shaper.draw();
|
m_shaper.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::onRegenerateDisplay(void) {
|
void ewol::widget::PopUp::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
m_shaper.clear();
|
m_shaper.clear();
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
@ -147,7 +147,7 @@ void widget::PopUp::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::PopUp::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::PopUp::getWidgetAtPos(const vec2& _pos) {
|
||||||
ewol::Widget* val = widget::Container::getWidgetAtPos(_pos);
|
ewol::Widget* val = widget::Container::getWidgetAtPos(_pos);
|
||||||
if (NULL != val) {
|
if (NULL != val) {
|
||||||
return val;
|
return val;
|
||||||
@ -155,7 +155,7 @@ ewol::Widget* widget::PopUp::getWidgetAtPos(const vec2& _pos) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::PopUp::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::PopUp::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == widget::Container::onSetConfig(_conf)) {
|
if (true == widget::Container::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ bool widget::PopUp::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::PopUp::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::PopUp::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == widget::Container::onGetConfig(_config, _result)) {
|
if (true == widget::Container::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ bool widget::PopUp::onGetConfig(const char* _config, std::string& _result) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::PopUp::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::PopUp::onEventInput(const ewol::EventInput& _event) {
|
||||||
if (0 != _event.getId()) {
|
if (0 != _event.getId()) {
|
||||||
if (true == m_closeOutEvent) {
|
if (true == m_closeOutEvent) {
|
||||||
vec2 padding = m_shaper.getPadding();
|
vec2 padding = m_shaper.getPadding();
|
||||||
@ -224,7 +224,7 @@ bool widget::PopUp::onEventInput(const ewol::EventInput& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::PopUp::onStartAnnimation(enum ewol::Widget::annimationMode _mode) {
|
bool ewol::widget::PopUp::onStartAnnimation(enum ewol::Widget::annimationMode _mode) {
|
||||||
if (m_annimationType[_mode] != annimationIncrease) {
|
if (m_annimationType[_mode] != annimationIncrease) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -235,11 +235,11 @@ bool widget::PopUp::onStartAnnimation(enum ewol::Widget::annimationMode _mode) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::onStopAnnimation(void) {
|
void ewol::widget::PopUp::onStopAnnimation(void) {
|
||||||
periodicCallDisable();
|
periodicCallDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::periodicCall(const ewol::EventTime& _event) {
|
void ewol::widget::PopUp::periodicCall(const ewol::EventTime& _event) {
|
||||||
if (false == m_shaper.periodicCall(_event) ) {
|
if (false == m_shaper.periodicCall(_event) ) {
|
||||||
stopAnnimation();
|
stopAnnimation();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -86,7 +87,7 @@ namespace widget {
|
|||||||
virtual bool onStartAnnimation(enum ewol::Widget::annimationMode _mode);
|
virtual bool onStartAnnimation(enum ewol::Widget::annimationMode _mode);
|
||||||
virtual void onStopAnnimation(void);
|
virtual void onStopAnnimation(void);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,22 +15,22 @@
|
|||||||
#define __class__ "ProgressBar"
|
#define __class__ "ProgressBar"
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::ProgressBar();
|
return new ewol::widget::ProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ProgressBar::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::ProgressBar::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* const widget::ProgressBar::configColorBg = "color-bg";
|
const char* const ewol::widget::ProgressBar::configColorBg = "color-bg";
|
||||||
const char* const widget::ProgressBar::configColorFgOn = "color-on";
|
const char* const ewol::widget::ProgressBar::configColorFgOn = "color-on";
|
||||||
const char* const widget::ProgressBar::configColorFgOff = "color-off";
|
const char* const ewol::widget::ProgressBar::configColorFgOff = "color-off";
|
||||||
const char* const widget::ProgressBar::configValue = "value";
|
const char* const ewol::widget::ProgressBar::configValue = "value";
|
||||||
|
|
||||||
const int32_t dotRadius = 6;
|
const int32_t dotRadius = 6;
|
||||||
|
|
||||||
widget::ProgressBar::ProgressBar(void) {
|
ewol::widget::ProgressBar::ProgressBar(void) {
|
||||||
addObjectType("widget::ProgressBar");
|
addObjectType("ewol::widget::ProgressBar");
|
||||||
m_value = 0.0;
|
m_value = 0.0;
|
||||||
|
|
||||||
m_textColorFg = etk::color::black;
|
m_textColorFg = etk::color::black;
|
||||||
@ -47,27 +47,27 @@ widget::ProgressBar::ProgressBar(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::ProgressBar::~ProgressBar(void) {
|
ewol::widget::ProgressBar::~ProgressBar(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ProgressBar::calculateMinMaxSize(void) {
|
void ewol::widget::ProgressBar::calculateMinMaxSize(void) {
|
||||||
vec2 tmpMin = m_userMinSize.getPixel();
|
vec2 tmpMin = m_userMinSize.getPixel();
|
||||||
m_minSize.setValue( etk_max(tmpMin.x(), 40),
|
m_minSize.setValue( etk_max(tmpMin.x(), 40),
|
||||||
etk_max(tmpMin.y(), dotRadius*2) );
|
etk_max(tmpMin.y(), dotRadius*2) );
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ProgressBar::setValue(float _val) {
|
void ewol::widget::ProgressBar::setValue(float _val) {
|
||||||
m_value = etk_avg(0, _val, 1);
|
m_value = etk_avg(0, _val, 1);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ProgressBar::onDraw(void) {
|
void ewol::widget::ProgressBar::onDraw(void) {
|
||||||
m_draw.draw();
|
m_draw.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ProgressBar::onRegenerateDisplay(void) {
|
void ewol::widget::ProgressBar::onRegenerateDisplay(void) {
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
m_draw.clear();
|
m_draw.clear();
|
||||||
@ -93,7 +93,7 @@ void widget::ProgressBar::onRegenerateDisplay(void) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool widget::ProgressBar::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::ProgressBar::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == ewol::Widget::onSetConfig(_conf)) {
|
if (true == ewol::Widget::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ bool widget::ProgressBar::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::ProgressBar::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::ProgressBar::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -53,7 +54,7 @@ namespace widget {
|
|||||||
virtual void onRegenerateDisplay(void);
|
virtual void onRegenerateDisplay(void);
|
||||||
virtual void calculateMinMaxSize(void);
|
virtual void calculateMinMaxSize(void);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,38 +15,38 @@
|
|||||||
#define __class__ "Scroll"
|
#define __class__ "Scroll"
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Scroll();
|
return new ewol::widget::Scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Scroll::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Scroll::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* const widget::Scroll::configLimit = "limit";
|
const char* const ewol::widget::Scroll::configLimit = "limit";
|
||||||
|
|
||||||
widget::Scroll::Scroll(void) :
|
ewol::widget::Scroll::Scroll(void) :
|
||||||
m_limit(0.15,0.5),
|
m_limit(0.15,0.5),
|
||||||
m_pixelScrolling(20),
|
m_pixelScrolling(20),
|
||||||
m_highSpeedStartPos(0,0),
|
m_highSpeedStartPos(0,0),
|
||||||
m_highSpeedMode(speedModeDisable),
|
m_highSpeedMode(speedModeDisable),
|
||||||
m_highSpeedButton(-1),
|
m_highSpeedButton(-1),
|
||||||
m_highSpeedType(ewol::keyEvent::typeUnknow) {
|
m_highSpeedType(ewol::keyEvent::typeUnknow) {
|
||||||
addObjectType("widget::Scroll");
|
addObjectType("ewol::widget::Scroll");
|
||||||
registerConfig(configLimit, "vec2", NULL, "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end");
|
registerConfig(configLimit, "vec2", NULL, "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end");
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Scroll::~Scroll(void) {
|
ewol::widget::Scroll::~Scroll(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Scroll::setLimit(const vec2& _limit) {
|
void ewol::widget::Scroll::setLimit(const vec2& _limit) {
|
||||||
m_limit = _limit;
|
m_limit = _limit;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SCROLL_BAR_SPACE (15)
|
#define SCROLL_BAR_SPACE (15)
|
||||||
|
|
||||||
void widget::Scroll::calculateMinMaxSize(void) {
|
void ewol::widget::Scroll::calculateMinMaxSize(void) {
|
||||||
// call main class !! and not containter class ...
|
// call main class !! and not containter class ...
|
||||||
ewol::Widget::calculateMinMaxSize();
|
ewol::Widget::calculateMinMaxSize();
|
||||||
// call sub classes
|
// call sub classes
|
||||||
@ -55,7 +55,7 @@ void widget::Scroll::calculateMinMaxSize(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Scroll::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::Scroll::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
if (m_hide == true) {
|
if (m_hide == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,11 +67,11 @@ void widget::Scroll::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
ewol::Widget::systemDraw(_displayProp);
|
ewol::Widget::systemDraw(_displayProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Scroll::onDraw(void) {
|
void ewol::widget::Scroll::onDraw(void) {
|
||||||
m_draw.draw();
|
m_draw.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Scroll::onRegenerateDisplay(void) {
|
void ewol::widget::Scroll::onRegenerateDisplay(void) {
|
||||||
// call upper class
|
// call upper class
|
||||||
widget::Container::onRegenerateDisplay();
|
widget::Container::onRegenerateDisplay();
|
||||||
if (true == needRedraw()) {
|
if (true == needRedraw()) {
|
||||||
@ -115,7 +115,7 @@ void widget::Scroll::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Scroll::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Scroll::onEventInput(const ewol::EventInput& _event) {
|
||||||
vec2 relativePos = relativePosition(_event.getPos());
|
vec2 relativePos = relativePosition(_event.getPos());
|
||||||
vec2 scrollOffset(0,0);
|
vec2 scrollOffset(0,0);
|
||||||
vec2 scrollSize(0,0);
|
vec2 scrollSize(0,0);
|
||||||
@ -332,7 +332,7 @@ bool widget::Scroll::onEventInput(const ewol::EventInput& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::Scroll::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::Scroll::getWidgetAtPos(const vec2& _pos) {
|
||||||
ewol::Widget* tmpWidget = widget::Container::getWidgetAtPos(_pos);
|
ewol::Widget* tmpWidget = widget::Container::getWidgetAtPos(_pos);
|
||||||
if (NULL != tmpWidget) {
|
if (NULL != tmpWidget) {
|
||||||
return tmpWidget;
|
return tmpWidget;
|
||||||
@ -340,7 +340,7 @@ ewol::Widget* widget::Scroll::getWidgetAtPos(const vec2& _pos) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Scroll::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::Scroll::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == widget::Container::onSetConfig(_conf)) {
|
if (true == widget::Container::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ bool widget::Scroll::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Scroll::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::Scroll::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == widget::Container::onGetConfig(_config, _result)) {
|
if (true == widget::Container::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -71,6 +72,7 @@ namespace widget {
|
|||||||
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
||||||
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,48 +14,48 @@
|
|||||||
#define __class__ "Sizer"
|
#define __class__ "Sizer"
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Sizer();
|
return new ewol::widget::Sizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Sizer::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
widget::Sizer::Sizer(enum displayMode _mode):
|
ewol::widget::Sizer::Sizer(enum displayMode _mode):
|
||||||
m_mode(_mode),
|
m_mode(_mode),
|
||||||
m_borderSize(),
|
m_borderSize(),
|
||||||
m_animation(animationNone),
|
m_animation(animationNone),
|
||||||
m_animationTime(0) {
|
m_animationTime(0) {
|
||||||
addObjectType("widget::Sizer");
|
addObjectType("ewol::widget::Sizer");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Sizer::~Sizer(void) {
|
ewol::widget::Sizer::~Sizer(void) {
|
||||||
// disable annimation to remore "remove" error
|
// disable annimation to remore "remove" error
|
||||||
m_animation = animationNone;
|
m_animation = animationNone;
|
||||||
m_animationTime = 0;
|
m_animationTime = 0;
|
||||||
//EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} sizer : destroy (mode=" << (m_mode == widget::sizer::modeVert?"Vert":"Hori") << ")");
|
//EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} sizer : destroy (mode=" << (m_mode == ewol::widget::Sizer::modeVert?"Vert":"Hori") << ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::Sizer::setBorderSize(const ewol::Dimension& _newBorderSize) {
|
void ewol::widget::Sizer::setBorderSize(const ewol::Dimension& _newBorderSize) {
|
||||||
m_borderSize = _newBorderSize;
|
m_borderSize = _newBorderSize;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::setMode(enum displayMode _mode) {
|
void ewol::widget::Sizer::setMode(enum displayMode _mode) {
|
||||||
m_mode = _mode;
|
m_mode = _mode;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum widget::Sizer::displayMode widget::Sizer::getMode(void) {
|
enum ewol::widget::Sizer::displayMode ewol::widget::Sizer::getMode(void) {
|
||||||
return m_mode;
|
return m_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::calculateSize(const vec2& _availlable) {
|
void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
|
||||||
ewol::Widget::calculateSize(_availlable);
|
ewol::Widget::calculateSize(_availlable);
|
||||||
vec2 tmpBorderSize = m_borderSize.getPixel();
|
vec2 tmpBorderSize = m_borderSize.getPixel();
|
||||||
//EWOL_DEBUG("[" << getId() << "] update size : " << _availlable << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
|
//EWOL_DEBUG("[" << getId() << "] update size : " << _availlable << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
|
||||||
@ -67,7 +67,7 @@ void widget::Sizer::calculateSize(const vec2& _availlable) {
|
|||||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
vec2 tmpSize = m_subWidget[iii]->getCalculateMinSize();
|
vec2 tmpSize = m_subWidget[iii]->getCalculateMinSize();
|
||||||
if (m_mode == widget::Sizer::modeVert) {
|
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||||
unexpandableSize += tmpSize.y();
|
unexpandableSize += tmpSize.y();
|
||||||
if (false == m_subWidget[iii]->canExpand().y()) {
|
if (false == m_subWidget[iii]->canExpand().y()) {
|
||||||
nbWidgetFixedSize++;
|
nbWidgetFixedSize++;
|
||||||
@ -88,7 +88,7 @@ void widget::Sizer::calculateSize(const vec2& _availlable) {
|
|||||||
float sizeToAddAtEveryOne = 0;
|
float sizeToAddAtEveryOne = 0;
|
||||||
// 2 cases : 1 or more can Expand, or all is done ...
|
// 2 cases : 1 or more can Expand, or all is done ...
|
||||||
if (0 != nbWidgetNotFixedSize) {
|
if (0 != nbWidgetNotFixedSize) {
|
||||||
if (m_mode == widget::Sizer::modeVert) {
|
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||||
sizeToAddAtEveryOne = (m_size.y() - unexpandableSize) / nbWidgetNotFixedSize;
|
sizeToAddAtEveryOne = (m_size.y() - unexpandableSize) / nbWidgetNotFixedSize;
|
||||||
} else {
|
} else {
|
||||||
sizeToAddAtEveryOne = (m_size.x() - unexpandableSize) / nbWidgetNotFixedSize;
|
sizeToAddAtEveryOne = (m_size.x() - unexpandableSize) / nbWidgetNotFixedSize;
|
||||||
@ -105,7 +105,7 @@ void widget::Sizer::calculateSize(const vec2& _availlable) {
|
|||||||
//EWOL_DEBUG("[" << getId() << "] set iii=" << iii << " ORIGIN : " << tmpOrigin << " & offset=" << m_offset);
|
//EWOL_DEBUG("[" << getId() << "] set iii=" << iii << " ORIGIN : " << tmpOrigin << " & offset=" << m_offset);
|
||||||
m_subWidget[iii]->setOrigin(vec2ClipInt32(tmpOrigin+m_offset));
|
m_subWidget[iii]->setOrigin(vec2ClipInt32(tmpOrigin+m_offset));
|
||||||
// Now update his size his size in X and the curent sizer size in Y:
|
// Now update his size his size in X and the curent sizer size in Y:
|
||||||
if (m_mode == widget::Sizer::modeVert) {
|
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||||
if (true == m_subWidget[iii]->canExpand().y()) {
|
if (true == m_subWidget[iii]->canExpand().y()) {
|
||||||
m_subWidget[iii]->calculateSize(vec2ClipInt32(vec2(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne)));
|
m_subWidget[iii]->calculateSize(vec2ClipInt32(vec2(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne)));
|
||||||
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
|
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
|
||||||
@ -128,7 +128,7 @@ void widget::Sizer::calculateSize(const vec2& _availlable) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::calculateMinMaxSize(void) {
|
void ewol::widget::Sizer::calculateMinMaxSize(void) {
|
||||||
//EWOL_DEBUG("[" << getId() << "] update minimum size");
|
//EWOL_DEBUG("[" << getId() << "] update minimum size");
|
||||||
m_subExpend.setValue(false, false);
|
m_subExpend.setValue(false, false);
|
||||||
m_minSize = m_userMinSize.getPixel();
|
m_minSize = m_userMinSize.getPixel();
|
||||||
@ -147,7 +147,7 @@ void widget::Sizer::calculateMinMaxSize(void) {
|
|||||||
vec2 tmpSize = m_subWidget[iii]->getCalculateMinSize();
|
vec2 tmpSize = m_subWidget[iii]->getCalculateMinSize();
|
||||||
//EWOL_DEBUG("[" << getId() << "] NewMinSize=" << tmpSize);
|
//EWOL_DEBUG("[" << getId() << "] NewMinSize=" << tmpSize);
|
||||||
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} Get minSize[" << iii << "] "<< tmpSize);
|
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} Get minSize[" << iii << "] "<< tmpSize);
|
||||||
if (m_mode == widget::Sizer::modeVert) {
|
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||||
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
||||||
if (tmpSize.x()>m_minSize.x()) {
|
if (tmpSize.x()>m_minSize.x()) {
|
||||||
m_minSize.setX(tmpSize.x());
|
m_minSize.setX(tmpSize.x());
|
||||||
@ -163,7 +163,7 @@ void widget::Sizer::calculateMinMaxSize(void) {
|
|||||||
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Sizer::loadXML(exml::Element* _node) {
|
bool ewol::widget::Sizer::loadXML(exml::Element* _node) {
|
||||||
if (NULL == _node) {
|
if (NULL == _node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -178,15 +178,15 @@ bool widget::Sizer::loadXML(exml::Element* _node) {
|
|||||||
if (tmpAttributeValue.size()!=0) {
|
if (tmpAttributeValue.size()!=0) {
|
||||||
if( compare_no_case(tmpAttributeValue, "vert") == true
|
if( compare_no_case(tmpAttributeValue, "vert") == true
|
||||||
|| compare_no_case(tmpAttributeValue, "vertical") == true) {
|
|| compare_no_case(tmpAttributeValue, "vertical") == true) {
|
||||||
m_mode = widget::Sizer::modeVert;
|
m_mode = ewol::widget::Sizer::modeVert;
|
||||||
} else {
|
} else {
|
||||||
m_mode = widget::Sizer::modeHori;
|
m_mode = ewol::widget::Sizer::modeHori;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Sizer::subWidgetAdd(ewol::Widget* _newWidget) {
|
int32_t ewol::widget::Sizer::subWidgetAdd(ewol::Widget* _newWidget) {
|
||||||
if (m_animation == animationNone) {
|
if (m_animation == animationNone) {
|
||||||
return widget::ContainerN::subWidgetAdd(_newWidget);
|
return widget::ContainerN::subWidgetAdd(_newWidget);
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ int32_t widget::Sizer::subWidgetAdd(ewol::Widget* _newWidget) {
|
|||||||
return widget::ContainerN::subWidgetAdd(_newWidget);
|
return widget::ContainerN::subWidgetAdd(_newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Sizer::subWidgetAddStart(ewol::Widget* _newWidget) {
|
int32_t ewol::widget::Sizer::subWidgetAddStart(ewol::Widget* _newWidget) {
|
||||||
if (m_animation == animationNone) {
|
if (m_animation == animationNone) {
|
||||||
return widget::ContainerN::subWidgetAddStart(_newWidget);
|
return widget::ContainerN::subWidgetAddStart(_newWidget);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ int32_t widget::Sizer::subWidgetAddStart(ewol::Widget* _newWidget) {
|
|||||||
return widget::ContainerN::subWidgetAddStart(_newWidget);
|
return widget::ContainerN::subWidgetAddStart(_newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::subWidgetRemove(ewol::Widget* _newWidget) {
|
void ewol::widget::Sizer::subWidgetRemove(ewol::Widget* _newWidget) {
|
||||||
if (m_animation == animationNone) {
|
if (m_animation == animationNone) {
|
||||||
widget::ContainerN::subWidgetRemove(_newWidget);
|
widget::ContainerN::subWidgetRemove(_newWidget);
|
||||||
return;
|
return;
|
||||||
@ -211,7 +211,7 @@ void widget::Sizer::subWidgetRemove(ewol::Widget* _newWidget) {
|
|||||||
widget::ContainerN::subWidgetRemove(_newWidget);
|
widget::ContainerN::subWidgetRemove(_newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::subWidgetUnLink(ewol::Widget* _newWidget) {
|
void ewol::widget::Sizer::subWidgetUnLink(ewol::Widget* _newWidget) {
|
||||||
if (m_animation == animationNone) {
|
if (m_animation == animationNone) {
|
||||||
widget::ContainerN::subWidgetUnLink(_newWidget);
|
widget::ContainerN::subWidgetUnLink(_newWidget);
|
||||||
return;
|
return;
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#include <ewol/widget/ContainerN.h>
|
#include <ewol/widget/ContainerN.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -119,7 +120,7 @@ namespace widget {
|
|||||||
virtual void subWidgetRemove(ewol::Widget* _newWidget);
|
virtual void subWidgetRemove(ewol::Widget* _newWidget);
|
||||||
virtual void subWidgetUnLink(ewol::Widget* _newWidget);
|
virtual void subWidgetUnLink(ewol::Widget* _newWidget);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,17 +16,17 @@ extern const char * const ewolEventSliderChange = "ewol-event-slider-change";
|
|||||||
#define __class__ "Slider"
|
#define __class__ "Slider"
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Slider();
|
return new ewol::widget::Slider();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Slider::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t dotRadius = 6;
|
const int32_t dotRadius = 6;
|
||||||
|
|
||||||
widget::Slider::Slider(void) {
|
ewol::widget::Slider::Slider(void) {
|
||||||
addObjectType("widget::Slider");
|
addObjectType("ewol::widget::Slider");
|
||||||
addEventId(ewolEventSliderChange);
|
addEventId(ewolEventSliderChange);
|
||||||
|
|
||||||
m_value = 0;
|
m_value = 0;
|
||||||
@ -42,43 +42,43 @@ widget::Slider::Slider(void) {
|
|||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Slider::~Slider(void) {
|
ewol::widget::Slider::~Slider(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::calculateMinMaxSize(void) {
|
void ewol::widget::Slider::calculateMinMaxSize(void) {
|
||||||
vec2 minTmp = m_userMinSize.getPixel();
|
vec2 minTmp = m_userMinSize.getPixel();
|
||||||
m_minSize.setValue(etk_max(minTmp.x(), 40),
|
m_minSize.setValue(etk_max(minTmp.x(), 40),
|
||||||
etk_max(minTmp.y(), dotRadius*2) );
|
etk_max(minTmp.y(), dotRadius*2) );
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::setValue(int32_t _val) {
|
void ewol::widget::Slider::setValue(int32_t _val) {
|
||||||
m_value = etk_max(etk_min(_val, m_max), m_min);
|
m_value = etk_max(etk_min(_val, m_max), m_min);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t widget::Slider::getValue(void) {
|
int32_t ewol::widget::Slider::getValue(void) {
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::setMin(int32_t _val) {
|
void ewol::widget::Slider::setMin(int32_t _val) {
|
||||||
m_min = _val;
|
m_min = _val;
|
||||||
m_value = etk_max(etk_min(m_value, m_max), m_min);
|
m_value = etk_max(etk_min(m_value, m_max), m_min);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::setMax(int32_t _val) {
|
void ewol::widget::Slider::setMax(int32_t _val) {
|
||||||
m_max = _val;
|
m_max = _val;
|
||||||
m_value = etk_max(etk_min(m_value, m_max), m_min);
|
m_value = etk_max(etk_min(m_value, m_max), m_min);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::onDraw(void) {
|
void ewol::widget::Slider::onDraw(void) {
|
||||||
m_draw.draw();
|
m_draw.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::onRegenerateDisplay(void) {
|
void ewol::widget::Slider::onRegenerateDisplay(void) {
|
||||||
if (needRedraw() == false) {
|
if (needRedraw() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void widget::Slider::onRegenerateDisplay(void) {
|
|||||||
m_draw.circle(dotRadius/1.6);
|
m_draw.circle(dotRadius/1.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Slider::onEventInput(const ewol::EventInput& _event) {
|
bool ewol::widget::Slider::onEventInput(const ewol::EventInput& _event) {
|
||||||
vec2 relativePos = relativePosition(_event.getPos());
|
vec2 relativePos = relativePosition(_event.getPos());
|
||||||
//EWOL_DEBUG("Event on Slider ...");
|
//EWOL_DEBUG("Event on Slider ...");
|
||||||
if (1 == _event.getId()) {
|
if (1 == _event.getId()) {
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
extern const char * const ewolEventSliderChange;
|
extern const char * const ewolEventSliderChange;
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -47,7 +48,7 @@ namespace widget {
|
|||||||
virtual void onRegenerateDisplay(void);
|
virtual void onRegenerateDisplay(void);
|
||||||
virtual bool onEventInput(const ewol::EventInput& _event);
|
virtual bool onEventInput(const ewol::EventInput& _event);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,18 +14,18 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Spacer"
|
#define __class__ "Spacer"
|
||||||
|
|
||||||
const char* const widget::Spacer::configColor = "color";
|
const char* const ewol::widget::Spacer::configColor = "color";
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::Spacer();
|
return new ewol::widget::Spacer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Spacer::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::Spacer::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Spacer::Spacer(void) {
|
ewol::widget::Spacer::Spacer(void) {
|
||||||
addObjectType("widget::Spacer");
|
addObjectType("ewol::widget::Spacer");
|
||||||
m_userMinSize = ewol::Dimension(vec2(10,10));
|
m_userMinSize = ewol::Dimension(vec2(10,10));
|
||||||
setCanHaveFocus(false);
|
setCanHaveFocus(false);
|
||||||
m_color = etk::color::black;
|
m_color = etk::color::black;
|
||||||
@ -33,16 +33,16 @@ widget::Spacer::Spacer(void) {
|
|||||||
registerConfig(configColor, "color", NULL, "background of the spacer");
|
registerConfig(configColor, "color", NULL, "background of the spacer");
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Spacer::~Spacer(void) {
|
ewol::widget::Spacer::~Spacer(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Spacer::onDraw(void) {
|
void ewol::widget::Spacer::onDraw(void) {
|
||||||
m_draw.draw();
|
m_draw.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BORDER_SIZE_TMP (4)
|
#define BORDER_SIZE_TMP (4)
|
||||||
void widget::Spacer::onRegenerateDisplay(void) {
|
void ewol::widget::Spacer::onRegenerateDisplay(void) {
|
||||||
if (false == needRedraw()) {
|
if (false == needRedraw()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ void widget::Spacer::onRegenerateDisplay(void) {
|
|||||||
m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) );
|
m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Spacer::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::Spacer::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == ewol::Widget::onSetConfig(_conf)) {
|
if (true == ewol::Widget::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ bool widget::Spacer::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Spacer::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::Spacer::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
if (true == ewol::Widget::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace ewol {
|
||||||
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -51,7 +52,7 @@ namespace widget {
|
|||||||
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
||||||
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
|
||||||
static const char* l_listsladingMode[widget::WSlider::sladingTransition_count] = {
|
static const char* l_listsladingMode[ewol::widget::WSlider::sladingTransition_count] = {
|
||||||
"transition vertical",
|
"transition vertical",
|
||||||
"transition horisantal"
|
"transition horisantal"
|
||||||
};
|
};
|
||||||
|
|
||||||
etk::CCout& operator <<(etk::CCout& _os, const enum widget::WSlider::sladingMode _obj) {
|
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::widget::WSlider::sladingMode _obj) {
|
||||||
_os << l_listsladingMode[_obj];
|
_os << l_listsladingMode[_obj];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
@ -24,39 +24,39 @@ etk::CCout& operator <<(etk::CCout& _os, const enum widget::WSlider::sladingMode
|
|||||||
#define __class__ "WSlider"
|
#define __class__ "WSlider"
|
||||||
|
|
||||||
// Event list of properties
|
// Event list of properties
|
||||||
const char* const widget::WSlider::eventStartSlide = "ewol-widget-wslider-event-start-slide";
|
const char* const ewol::widget::WSlider::eventStartSlide = "ewol-widget-wslider-event-start-slide";
|
||||||
const char* const widget::WSlider::eventStopSlide = "ewol-widget-wslider-event-stop-slide";
|
const char* const ewol::widget::WSlider::eventStopSlide = "ewol-widget-wslider-event-stop-slide";
|
||||||
// Config list of properties
|
// Config list of properties
|
||||||
const char* const widget::WSlider::configMode = "mode";
|
const char* const ewol::widget::WSlider::configMode = "mode";
|
||||||
|
|
||||||
static ewol::Widget* create(void) {
|
static ewol::Widget* create(void) {
|
||||||
return new widget::WSlider();
|
return new ewol::widget::WSlider();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::init(ewol::WidgetManager& _widgetManager) {
|
void ewol::widget::WSlider::init(ewol::WidgetManager& _widgetManager) {
|
||||||
_widgetManager.addWidgetCreator(__class__,&create);
|
_widgetManager.addWidgetCreator(__class__,&create);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::WSlider::WSlider(void) :
|
ewol::widget::WSlider::WSlider(void) :
|
||||||
m_windowsSources(0),
|
m_windowsSources(0),
|
||||||
m_windowsDestination(0),
|
m_windowsDestination(0),
|
||||||
m_windowsRequested(-1),
|
m_windowsRequested(-1),
|
||||||
m_slidingProgress(1.0f),
|
m_slidingProgress(1.0f),
|
||||||
m_transitionSpeed(1.0f),
|
m_transitionSpeed(1.0f),
|
||||||
m_transitionSlide(sladingTransitionHori) {
|
m_transitionSlide(sladingTransitionHori) {
|
||||||
addObjectType("widget::WSlider");
|
addObjectType("ewol::widget::WSlider");
|
||||||
addEventId(eventStartSlide);
|
addEventId(eventStartSlide);
|
||||||
addEventId(eventStopSlide);
|
addEventId(eventStopSlide);
|
||||||
// add configuration
|
// add configuration
|
||||||
registerConfig(configMode, "list", "vert;hori", "Transition mode of the slider");
|
registerConfig(configMode, "list", "vert;hori", "Transition mode of the slider");
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::WSlider::~WSlider(void) {
|
ewol::widget::WSlider::~WSlider(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::WSlider::calculateSize(const vec2& _availlable) {
|
void ewol::widget::WSlider::calculateSize(const vec2& _availlable) {
|
||||||
//EWOL_DEBUG("Update size");
|
//EWOL_DEBUG("Update size");
|
||||||
widget::ContainerN::calculateSize(_availlable);
|
widget::ContainerN::calculateSize(_availlable);
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ void widget::WSlider::calculateSize(const vec2& _availlable) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::subWidgetSelectSet(int32_t _id) {
|
void ewol::widget::WSlider::subWidgetSelectSet(int32_t _id) {
|
||||||
int32_t elementID = -1;
|
int32_t elementID = -1;
|
||||||
// search element in the list :
|
// search element in the list :
|
||||||
for (size_t iii=0 ; iii<m_subWidget.size() ; iii++) {
|
for (size_t iii=0 ; iii<m_subWidget.size() ; iii++) {
|
||||||
@ -130,7 +130,7 @@ void widget::WSlider::subWidgetSelectSet(int32_t _id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::subWidgetSelectSet(ewol::Widget* _widgetPointer) {
|
void ewol::widget::WSlider::subWidgetSelectSet(ewol::Widget* _widgetPointer) {
|
||||||
if (_widgetPointer == NULL) {
|
if (_widgetPointer == NULL) {
|
||||||
EWOL_ERROR("Can not change to a widget NULL");
|
EWOL_ERROR("Can not change to a widget NULL");
|
||||||
return;
|
return;
|
||||||
@ -146,7 +146,7 @@ void widget::WSlider::subWidgetSelectSet(ewol::Widget* _widgetPointer) {
|
|||||||
EWOL_ERROR("Can not change to a widget not present");
|
EWOL_ERROR("Can not change to a widget not present");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::subWidgetSelectSet(const std::string& _widgetName) {
|
void ewol::widget::WSlider::subWidgetSelectSet(const std::string& _widgetName) {
|
||||||
if (_widgetName == "") {
|
if (_widgetName == "") {
|
||||||
EWOL_ERROR("Can not change to a widget with no name (input)");
|
EWOL_ERROR("Can not change to a widget with no name (input)");
|
||||||
return;
|
return;
|
||||||
@ -162,14 +162,14 @@ void widget::WSlider::subWidgetSelectSet(const std::string& _widgetName) {
|
|||||||
EWOL_ERROR("Can not change to a widget not present");
|
EWOL_ERROR("Can not change to a widget not present");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::setTransitionMode(enum sladingMode _mode) {
|
void ewol::widget::WSlider::setTransitionMode(enum sladingMode _mode) {
|
||||||
if (m_transitionSlide != _mode) {
|
if (m_transitionSlide != _mode) {
|
||||||
m_transitionSlide = _mode;
|
m_transitionSlide = _mode;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::periodicCall(const ewol::EventTime& _event) {
|
void ewol::widget::WSlider::periodicCall(const ewol::EventTime& _event) {
|
||||||
if (m_slidingProgress >= 1.0) {
|
if (m_slidingProgress >= 1.0) {
|
||||||
m_windowsSources = m_windowsDestination;
|
m_windowsSources = m_windowsDestination;
|
||||||
if( m_windowsRequested != -1
|
if( m_windowsRequested != -1
|
||||||
@ -202,7 +202,7 @@ void widget::WSlider::periodicCall(const ewol::EventTime& _event) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::systemDraw(const ewol::DrawProperty& _displayProp) {
|
void ewol::widget::WSlider::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||||
if (true == m_hide){
|
if (true == m_hide){
|
||||||
// widget is hidden ...
|
// widget is hidden ...
|
||||||
return;
|
return;
|
||||||
@ -241,7 +241,7 @@ void widget::WSlider::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::onRegenerateDisplay(void) {
|
void ewol::widget::WSlider::onRegenerateDisplay(void) {
|
||||||
if (m_windowsDestination == m_windowsSources) {
|
if (m_windowsDestination == m_windowsSources) {
|
||||||
int32_t iii = m_windowsDestination;
|
int32_t iii = m_windowsDestination;
|
||||||
if (iii >= 0 || (size_t)iii < m_subWidget.size()) {
|
if (iii >= 0 || (size_t)iii < m_subWidget.size()) {
|
||||||
@ -265,7 +265,7 @@ void widget::WSlider::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::WSlider::onSetConfig(const ewol::EConfig& _conf) {
|
bool ewol::widget::WSlider::onSetConfig(const ewol::EConfig& _conf) {
|
||||||
if (true == widget::ContainerN::onSetConfig(_conf)) {
|
if (true == widget::ContainerN::onSetConfig(_conf)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ bool widget::WSlider::onSetConfig(const ewol::EConfig& _conf) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::WSlider::onGetConfig(const char* _config, std::string& _result) const {
|
bool ewol::widget::WSlider::onGetConfig(const char* _config, std::string& _result) const {
|
||||||
if (true == widget::ContainerN::onGetConfig(_config, _result)) {
|
if (true == widget::ContainerN::onGetConfig(_config, _result)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ bool widget::WSlider::onGetConfig(const char* _config, std::string& _result) con
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* widget::WSlider::getWidgetAtPos(const vec2& _pos) {
|
ewol::Widget* ewol::widget::WSlider::getWidgetAtPos(const vec2& _pos) {
|
||||||
if (true == isHide()) {
|
if (true == isHide()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#include <ewol/widget/ContainerN.h>
|
#include <ewol/widget/ContainerN.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
* @ingroup ewolWidgetGroup
|
* @ingroup ewolWidgetGroup
|
||||||
*/
|
*/
|
||||||
@ -97,8 +97,8 @@ namespace widget {
|
|||||||
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
virtual bool onSetConfig(const ewol::EConfig& _conf);
|
||||||
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
etk::CCout& operator <<(etk::CCout& _os, const enum widget::WSlider::sladingMode _obj);
|
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::widget::WSlider::sladingMode _obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,8 +14,10 @@
|
|||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Widget;
|
class Widget;
|
||||||
class WidgetManager;
|
namespace widget {
|
||||||
|
class Manager;
|
||||||
class Windows;
|
class Windows;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -31,6 +33,7 @@ namespace ewol {
|
|||||||
#define ULTIMATE_MAX_SIZE (99999999)
|
#define ULTIMATE_MAX_SIZE (99999999)
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
//namespace widget {
|
||||||
class DrawProperty{
|
class DrawProperty{
|
||||||
/*
|
/*
|
||||||
/--> m_windowsSize
|
/--> m_windowsSize
|
||||||
@ -768,8 +771,8 @@ namespace ewol {
|
|||||||
virtual void onStopAnnimation(void) { };
|
virtual void onStopAnnimation(void) { };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
//};
|
||||||
};// end of namespace
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "WidgetManager"
|
#define __class__ "ewol::widget::Manager"
|
||||||
|
|
||||||
ewol::WidgetManager::WidgetManager(void) :
|
ewol::widget::Manager::Manager(void) :
|
||||||
m_focusWidgetDefault(NULL),
|
m_focusWidgetDefault(NULL),
|
||||||
m_focusWidgetCurrent(NULL),
|
m_focusWidgetCurrent(NULL),
|
||||||
m_havePeriodic(false),
|
m_havePeriodic(false),
|
||||||
@ -58,7 +58,7 @@ ewol::WidgetManager::WidgetManager(void) :
|
|||||||
widget::PopUp::init(*this);
|
widget::PopUp::init(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::WidgetManager::~WidgetManager(void) {
|
ewol::widget::Manager::~Manager(void) {
|
||||||
EWOL_DEBUG(" == > Un-Init Widget-Manager");
|
EWOL_DEBUG(" == > Un-Init Widget-Manager");
|
||||||
EWOL_INFO("Realease all FOCUS");
|
EWOL_INFO("Realease all FOCUS");
|
||||||
focusSetDefault(NULL);
|
focusSetDefault(NULL);
|
||||||
@ -68,7 +68,7 @@ ewol::WidgetManager::~WidgetManager(void) {
|
|||||||
m_creatorList.clear();
|
m_creatorList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::rm(ewol::Widget* _newWidget) {
|
void ewol::widget::Manager::rm(ewol::Widget* _newWidget) {
|
||||||
periodicCallRm(_newWidget);
|
periodicCallRm(_newWidget);
|
||||||
focusRemoveIfRemove(_newWidget);
|
focusRemoveIfRemove(_newWidget);
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ void ewol::WidgetManager::rm(ewol::Widget* _newWidget) {
|
|||||||
* focus Area :
|
* focus Area :
|
||||||
* *************************************************************************/
|
* *************************************************************************/
|
||||||
|
|
||||||
void ewol::WidgetManager::focusKeep(ewol::Widget* _newWidget) {
|
void ewol::widget::Manager::focusKeep(ewol::Widget* _newWidget) {
|
||||||
if (NULL == _newWidget) {
|
if (NULL == _newWidget) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
return;
|
return;
|
||||||
@ -101,7 +101,7 @@ void ewol::WidgetManager::focusKeep(ewol::Widget* _newWidget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::focusSetDefault(ewol::Widget * _newWidget) {
|
void ewol::widget::Manager::focusSetDefault(ewol::Widget * _newWidget) {
|
||||||
if( NULL != _newWidget
|
if( NULL != _newWidget
|
||||||
&& false == _newWidget->canHaveFocus() ) {
|
&& false == _newWidget->canHaveFocus() ) {
|
||||||
EWOL_VERBOSE("Widget can not have focus, id=" << _newWidget->getId() );
|
EWOL_VERBOSE("Widget can not have focus, id=" << _newWidget->getId() );
|
||||||
@ -121,7 +121,7 @@ void ewol::WidgetManager::focusSetDefault(ewol::Widget * _newWidget) {
|
|||||||
m_focusWidgetDefault = _newWidget;
|
m_focusWidgetDefault = _newWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::focusRelease(void) {
|
void ewol::widget::Manager::focusRelease(void) {
|
||||||
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
||||||
// nothink to do ...
|
// nothink to do ...
|
||||||
return;
|
return;
|
||||||
@ -138,11 +138,11 @@ void ewol::WidgetManager::focusRelease(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Widget * ewol::WidgetManager::focusGet(void) {
|
ewol::Widget * ewol::widget::Manager::focusGet(void) {
|
||||||
return m_focusWidgetCurrent;
|
return m_focusWidgetCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::focusRemoveIfRemove(ewol::Widget* _newWidget) {
|
void ewol::widget::Manager::focusRemoveIfRemove(ewol::Widget* _newWidget) {
|
||||||
if (m_focusWidgetCurrent == _newWidget) {
|
if (m_focusWidgetCurrent == _newWidget) {
|
||||||
EWOL_WARNING("Release focus when remove widget");
|
EWOL_WARNING("Release focus when remove widget");
|
||||||
focusRelease();
|
focusRelease();
|
||||||
@ -153,7 +153,7 @@ void ewol::WidgetManager::focusRemoveIfRemove(ewol::Widget* _newWidget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::periodicCallAdd(ewol::Widget* _pWidget) {
|
void ewol::widget::Manager::periodicCallAdd(ewol::Widget* _pWidget) {
|
||||||
for (size_t iii=0; iii < m_listOfPeriodicWidget.size(); iii++) {
|
for (size_t iii=0; iii < m_listOfPeriodicWidget.size(); iii++) {
|
||||||
if (m_listOfPeriodicWidget[iii] == _pWidget) {
|
if (m_listOfPeriodicWidget[iii] == _pWidget) {
|
||||||
return;
|
return;
|
||||||
@ -169,7 +169,7 @@ void ewol::WidgetManager::periodicCallAdd(ewol::Widget* _pWidget) {
|
|||||||
m_havePeriodic = true;
|
m_havePeriodic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::periodicCallRm(ewol::Widget * _pWidget) {
|
void ewol::widget::Manager::periodicCallRm(ewol::Widget * _pWidget) {
|
||||||
int32_t nbElement = 0;
|
int32_t nbElement = 0;
|
||||||
for (int32_t iii=m_listOfPeriodicWidget.size()-1; iii >= 0 ; iii--) {
|
for (int32_t iii=m_listOfPeriodicWidget.size()-1; iii >= 0 ; iii--) {
|
||||||
if (m_listOfPeriodicWidget[iii] == _pWidget) {
|
if (m_listOfPeriodicWidget[iii] == _pWidget) {
|
||||||
@ -183,11 +183,11 @@ void ewol::WidgetManager::periodicCallRm(ewol::Widget * _pWidget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::periodicCallResume(int64_t _localTime) {
|
void ewol::widget::Manager::periodicCallResume(int64_t _localTime) {
|
||||||
m_lastPeriodicCallTime = _localTime;
|
m_lastPeriodicCallTime = _localTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::periodicCall(int64_t _localTime) {
|
void ewol::widget::Manager::periodicCall(int64_t _localTime) {
|
||||||
int64_t previousTime = m_lastPeriodicCallTime;
|
int64_t previousTime = m_lastPeriodicCallTime;
|
||||||
m_lastPeriodicCallTime = _localTime;
|
m_lastPeriodicCallTime = _localTime;
|
||||||
if (m_listOfPeriodicWidget.size() <= 0) {
|
if (m_listOfPeriodicWidget.size() <= 0) {
|
||||||
@ -223,23 +223,23 @@ void ewol::WidgetManager::periodicCall(int64_t _localTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::WidgetManager::periodicCallHave(void) {
|
bool ewol::widget::Manager::periodicCallHave(void) {
|
||||||
return m_havePeriodic;
|
return m_havePeriodic;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetManager::markDrawingIsNeeded(void) {
|
void ewol::widget::Manager::markDrawingIsNeeded(void) {
|
||||||
m_haveRedraw = true;
|
m_haveRedraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::WidgetManager::isDrawingNeeded(void) {
|
bool ewol::widget::Manager::isDrawingNeeded(void) {
|
||||||
bool tmp = m_haveRedraw;
|
bool tmp = m_haveRedraw;
|
||||||
m_haveRedraw = false;
|
m_haveRedraw = false;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// element that generate the list of elements
|
// element that generate the list of elements
|
||||||
void ewol::WidgetManager::addWidgetCreator(const std::string& _name,
|
void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
|
||||||
ewol::WidgetManager::creator_tf _pointer) {
|
ewol::widget::Manager::creator_tf _pointer) {
|
||||||
if (NULL == _pointer) {
|
if (NULL == _pointer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -254,10 +254,10 @@ void ewol::WidgetManager::addWidgetCreator(const std::string& _name,
|
|||||||
m_creatorList.add(nameLower, _pointer);
|
m_creatorList.add(nameLower, _pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* ewol::WidgetManager::create(const std::string& _name) {
|
ewol::Widget* ewol::widget::Manager::create(const std::string& _name) {
|
||||||
std::string nameLower = to_lower(_name);
|
std::string nameLower = to_lower(_name);
|
||||||
if (true == m_creatorList.exist(nameLower)) {
|
if (true == m_creatorList.exist(nameLower)) {
|
||||||
ewol::WidgetManager::creator_tf pointerFunction = m_creatorList[nameLower];
|
ewol::widget::Manager::creator_tf pointerFunction = m_creatorList[nameLower];
|
||||||
if (NULL != pointerFunction) {
|
if (NULL != pointerFunction) {
|
||||||
return pointerFunction();
|
return pointerFunction();
|
||||||
}
|
}
|
||||||
@ -266,12 +266,12 @@ ewol::Widget* ewol::WidgetManager::create(const std::string& _name) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::WidgetManager::exist(const std::string& _name) {
|
bool ewol::widget::Manager::exist(const std::string& _name) {
|
||||||
std::string nameLower = to_lower(_name);
|
std::string nameLower = to_lower(_name);
|
||||||
return m_creatorList.exist(nameLower);
|
return m_creatorList.exist(nameLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ewol::WidgetManager::list(void) {
|
std::string ewol::widget::Manager::list(void) {
|
||||||
std::string tmpVal;
|
std::string tmpVal;
|
||||||
for (int32_t iii=0; iii<m_creatorList.size() ; iii++) {
|
for (int32_t iii=0; iii<m_creatorList.size() ; iii++) {
|
||||||
tmpVal += m_creatorList.getKey(iii);
|
tmpVal += m_creatorList.getKey(iii);
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class WidgetManager {
|
namespace widget {
|
||||||
|
class Manager {
|
||||||
public:
|
public:
|
||||||
typedef ewol::Widget* (*creator_tf)(void);
|
typedef ewol::Widget* (*creator_tf)(void);
|
||||||
private:
|
private:
|
||||||
@ -30,8 +31,8 @@ namespace ewol {
|
|||||||
int64_t m_applWakeUpTime; //!< Time of the application initialize
|
int64_t m_applWakeUpTime; //!< Time of the application initialize
|
||||||
int64_t m_lastPeriodicCallTime; //!< last call time ...
|
int64_t m_lastPeriodicCallTime; //!< last call time ...
|
||||||
public:
|
public:
|
||||||
WidgetManager(void);
|
Manager(void);
|
||||||
~WidgetManager(void);
|
~Manager(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);
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ namespace ewol {
|
|||||||
bool exist(const std::string& _name);
|
bool exist(const std::string& _name);
|
||||||
std::string list(void);
|
std::string list(void);
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user