[DEV] rework the internal arch eneded (not work)

This commit is contained in:
Edouard DUPIN 2013-12-12 22:18:56 +01:00
parent dad1b90812
commit 3e8b6d8b91
152 changed files with 3643 additions and 5515 deletions

2
build

@ -1 +1 @@
Subproject commit 5ea83bfddea9a0c93f65170b73d3be07f8a100e0
Subproject commit 3498be99a18dd11444dbe87f1557471e65529bbc

67
data/icon.svg Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="icon.png">
<defs
id="defs2987" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11"
inkscape:cx="30.005485"
inkscape:cy="29.382025"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:snap-global="true"
inkscape:window-width="1680"
inkscape:window-height="997"
inkscape:window-x="1280"
inkscape:window-y="-1"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3017" />
</sodipodi:namedview>
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 5,34 C 3.6124106,13.444964 16.586789,5.3866714 30,4 44.970045,3.7783363 60,15 60,29 58,27 59,28 55,24 53.738505,16.334157 40.286532,8.5752748 30,9 19.754382,8.6725099 9.5334403,18.37792 10,29 c 5,0 15,0 20,0 0,5 0,10 0,15 -5,0 -15,0 -20,0 0,10 11.666667,15 20,15 8.333333,0 24,-6 25,-15 3,-3 1,-1 5,-5 C 60,57 49,63 30,64 18.156114,62.827224 5,59 5,39 c 5,0 15,0 20,0 0,-3 0,-2 0,-5 -5,0 -15,0 -20,0 z"
id="path3854"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

2
external/ege vendored

@ -1 +1 @@
Subproject commit bc3e08d665834900a81a7e1cd0e703793f25d208
Subproject commit 2c54a551b4a007d79a9f7a4367e019f11bc94f7b

View File

@ -1,214 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_DIMENSION_H__
#define __EWOL_DIMENSION_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <etk/math/Vector2D.h>
namespace ewol {
/**
* @brief in the dimention class we store the data as the more usefull unit (pixel)
* but one case need to be dynamic the %, then when requested in % the register the % value
*/
class Dimension {
public:
enum distance {
Pourcent=0,
Pixel,
Meter,
Centimeter,
Millimeter,
Kilometer,
Inch,
foot,
};
private:
vec2 m_data;
enum distance m_type;
public:
/**
* @brief Constructor (default :0,0 mode pixel)
*/
Dimension(void);
/**
* @brief Constructor
* @param[in] _size Requested dimention
* @param[in] _type Unit of the Dimention
*/
Dimension(const vec2& _size, enum ewol::Dimension::distance _type=ewol::Dimension::Pixel);
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const std::string& _config) :
m_data(0,0),
m_type(ewol::Dimension::Pixel) {
set(_config);
};
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const char* _config) :
m_data(0,0),
m_type(ewol::Dimension::Pixel) {
set(_config);
};
/**
* @brief Destructor
*/
~Dimension(void);
/**
* @brief string cast :
*/
operator std::string(void) const;
/**
* @brief get the current dimention in requested type
* @param[in] _type Type of unit requested.
* @return dimention requested.
*/
vec2 get(enum distance _type) const;
/**
* @brief set the current dimention in requested type
* @param[in] _size Dimention to set
* @param[in] _type Type of unit requested.
*/
void set(const vec2& _size, enum distance _type);
private:
/**
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
public:
/**
* @brief get the current dimention in pixel
* @return dimention in Pixel
*/
vec2 getPixel(void) const;
/**
* @brief get the current dimention in Pourcent
* @return dimention in Pourcent
*/
vec2 getPourcent(void) const;
/**
* @brief get the current dimention in Meter
* @return dimention in Meter
*/
vec2 getMeter(void) const;
/**
* @brief get the current dimention in Centimeter
* @return dimention in Centimeter
*/
vec2 getCentimeter(void) const;
/**
* @brief get the current dimention in Millimeter
* @return dimention in Millimeter
*/
vec2 getMillimeter(void) const;
/**
* @brief get the current dimention in Kilometer
* @return dimention in Kilometer
*/
vec2 getKilometer(void) const;
/**
* @brief get the current dimention in Inch
* @return dimention in Inch
*/
vec2 getInch(void) const;
/**
* @brief get the current dimention in Foot
* @return dimention in Foot
*/
vec2 getFoot(void) const;
/*****************************************************
* = assigment
*****************************************************/
const Dimension& operator= (const Dimension& _obj ) {
if (this!=&_obj) {
m_data = _obj.m_data;
m_type = _obj.m_type;
}
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator == (const Dimension& _obj) const {
if( m_data == _obj.m_data
&& m_type == _obj.m_type) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Dimension& _obj) const {
if( m_data != _obj.m_data
|| m_type != _obj.m_type) {
return true;
}
return false;
}
/**
* @breif get the dimension type
* @return the type
*/
enum distance getType(void) const {
return m_type;
};
};
etk::CCout& operator <<(etk::CCout& _os, enum ewol::Dimension::distance _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension& _obj);
namespace dimension {
/**
* @brief basic init
*/
void init(void);
/**
* @brief basic un-init
*/
void unInit(void);
/**
* @brief set the Milimeter ratio for calculation
* @param[in] Ratio Milimeter ration for the screen calculation interpolation
* @param[in] type Unit type requested.
* @note: same as @ref setPixelPerInch (internal manage convertion)
*/
void setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type);
/**
* @brief set the current Windows size
* @param[in] size size of the current windows in pixel.
*/
void setPixelWindowsSize(const vec2& _size);
/**
* @brief get the Windows size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
vec2 getWindowsSize(enum ewol::Dimension::distance _type);
/**
* @brief get the Windows diagonal size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
float getWindowsDiag(enum ewol::Dimension::distance _type);
};
};
#endif

View File

@ -1,59 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/Light.h>
#include <ewol/debug.h>
ewol::Light::Light(void) :
m_direction(0,0,0),
m_halfplane(0,0,0),
m_ambientColor(0,0,0,0),
m_diffuseColor(0,0,0,0),
m_specularColor(0,0,0,0),
m_GL_direction(0),
m_GL_halfplane(0),
m_GL_ambientColor(0),
m_GL_diffuseColor(0),
m_GL_specularColor(0) {
// nothing to do else ...
}
ewol::Light::~Light(void) {
}
void ewol::Light::link(ewol::Program* _prog, const std::string& _baseName) {
if (NULL == _prog) {
return;
}
m_GL_direction = _prog->getUniform(_baseName+".direction");
m_GL_halfplane = _prog->getUniform(_baseName+".halfplane");
m_GL_ambientColor = _prog->getUniform(_baseName+".ambientColor");
m_GL_diffuseColor = _prog->getUniform(_baseName+".diffuseColor");
m_GL_specularColor = _prog->getUniform(_baseName+".specularColor");
}
void ewol::Light::draw(ewol::Program* _prog) {
_prog->uniform3(m_GL_direction, m_direction);
_prog->uniform3(m_GL_halfplane, m_halfplane);
_prog->uniform4(m_GL_ambientColor, m_ambientColor);
_prog->uniform4(m_GL_diffuseColor, m_diffuseColor);
_prog->uniform4(m_GL_specularColor, m_specularColor);
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Light& _obj) {
_os << "light:{";
_os << "dir=" << _obj.m_direction;
_os << " halfplan=" << _obj.m_halfplane;
_os << " color:{ anbiant=" << _obj.m_ambientColor;
_os << " diffuse=" << _obj.m_diffuseColor;
_os << " specular=" << _obj.m_specularColor;
_os << "}}";
return _os;
}

View File

@ -1,61 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_LIGHT_H__
#define __EWOL_LIGHT_H__
#include <etk/types.h>
#include <etk/math/Vector3D.h>
#include <etk/math/Vector4D.h>
#include <ewol/resources/Program.h>
namespace ewol {
class Light {
private:
// values
vec3 m_direction;
vec3 m_halfplane;
vec4 m_ambientColor;
vec4 m_diffuseColor;
vec4 m_specularColor;
private:
// GL index
int32_t m_GL_direction;
int32_t m_GL_halfplane;
int32_t m_GL_ambientColor;
int32_t m_GL_diffuseColor;
int32_t m_GL_specularColor;
public:
Light(void);
~Light(void);
void link(ewol::Program* _prog, const std::string& _baseName);
void draw(ewol::Program* _prog);
void setDirection(const vec3& val) {
m_direction = val;
}
void setHalfPlane(const vec3& val) {
m_halfplane = val;
}
void setAmbientColor(const vec4& val) {
m_ambientColor = val;
}
void setDiffuseColor(const vec4& val) {
m_diffuseColor = val;
}
void setSpecularColor(const vec4& val) {
m_specularColor = val;
}
friend etk::CCout& operator <<(etk::CCout& _os, const ewol::Light& _obj);
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::Light& _obj);
};
#endif

View File

@ -1,76 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/resources/ResourceManager.h>
#include <ewol/Material.h>
#include <ewol/debug.h>
ewol::MaterialGlId::MaterialGlId(void) :
m_GL_ambientFactor(0),
m_GL_diffuseFactor(0),
m_GL_specularFactor(0),
m_GL_shininess(0),
m_GL_texture0(0) {
// nothing to do else ...
}
void ewol::MaterialGlId::link(ewol::Program* _prog, const std::string& _baseName) {
if (NULL == _prog) {
return;
}
m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor");
m_GL_diffuseFactor = _prog->getUniform(_baseName+".diffuseFactor");
m_GL_specularFactor = _prog->getUniform(_baseName+".specularFactor");
m_GL_shininess = _prog->getUniform(_baseName+".shininess");
m_GL_texture0 = _prog->getUniform("EW_texID");
}
ewol::Material::Material(void) :
m_ambientFactor(1,1,1,1),
m_diffuseFactor(0,0,0,1),
m_specularFactor(0,0,0,1),
m_shininess(1),
m_texture0(NULL) {
// nothing to do else ...
}
ewol::Material::~Material(void) {
if(NULL!=m_texture0) {
ewol::TextureFile::release(m_texture0);
}
}
void ewol::Material::draw(ewol::Program* _prog, const MaterialGlId& _glID) {
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
_prog->uniform1f(_glID.m_GL_shininess, m_shininess);
if (NULL != m_texture0) {
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getId());
}
}
void ewol::Material::setTexture0(const std::string& _filename) {
ivec2 tmpSize(256, 256);
// prevent overloard error :
ewol::TextureFile* tmpCopy = m_texture0;
m_texture0 = ewol::TextureFile::keep(_filename, tmpSize);
if (NULL == m_texture0 ) {
EWOL_ERROR("Can not load specific texture : " << _filename);
// retreave previous texture:
m_texture0 = tmpCopy;
return;
}
if (NULL != tmpCopy) {
// really release previous texture. In case of same texture loading, then we did not have reload it .. just increase and decrease index...
ewol::TextureFile::release(tmpCopy);
}
}

View File

@ -1,69 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_MATERIAL_H__
#define __EWOL_MATERIAL_H__
#include <etk/types.h>
#include <etk/math/Vector3D.h>
#include <etk/math/Vector4D.h>
#include <ewol/resources/Program.h>
#include <ewol/resources/Image.h>
namespace ewol {
class MaterialGlId {
public:
// GL index
int32_t m_GL_ambientFactor;
int32_t m_GL_diffuseFactor;
int32_t m_GL_specularFactor;
int32_t m_GL_shininess;
int32_t m_GL_texture0;
MaterialGlId(void);
void link(ewol::Program* _prog, const std::string& _baseName);
};
class Material {
private:
// values
vec4 m_ambientFactor;
vec4 m_diffuseFactor;
vec4 m_specularFactor;
float m_shininess;
ewol::TextureFile* m_texture0;
public:
std::vector<uint32_t> m_listIndexFaces;
public:
Material(void);
~Material(void);
void draw(ewol::Program* _prog, const MaterialGlId& _glID);
void setAmbientFactor(const vec4& _val) {
m_ambientFactor = _val;
}
void setDiffuseFactor(const vec4& _val) {
m_diffuseFactor = _val;
}
void setSpecularFactor(const vec4& _val) {
m_specularFactor = _val;
}
void setShininess(float _val) {
m_shininess = _val;
}
void setTexture0(const std::string& _filename);
void setImageSize(const ivec2& _newSize) { if (m_texture0 == NULL){return;} m_texture0->setImageSize(_newSize); };
// get the reference on this image to draw nomething on it ...
egami::Image* get(void) { if (m_texture0 == NULL){return NULL;} return &m_texture0->get(); };
// flush the data to send it at the openGl system
void flush(void) { if (m_texture0 == NULL){return;} m_texture0->flush(); };
};
};
#endif

View File

@ -1,85 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_CLIPBOARD_H__
#define __EWOL_CLIPBOARD_H__
#include <ewol/debug.h>
#include <etk/UString.h>
namespace ewol {
namespace clipBoard
{
enum clipboardListe {
clipboard0, //!< internal clipboard 0
clipboard1, //!< internal clipboard 1
clipboard2, //!< internal clipboard 2
clipboard3, //!< internal clipboard 3
clipboard4, //!< internal clipboard 4
clipboard5, //!< internal clipboard 5
clipboard6, //!< internal clipboard 6
clipboard7, //!< internal clipboard 7
clipboard8, //!< internal clipboard 8
clipboard9, //!< internal clipboard 9
clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer
clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button
clipboardCount, //!< Total number of clipboard
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::clipBoard::clipboardListe _obj);
/**
* @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change
* @param[in] _clipboardID Select the specific ID of the clipboard
* @param[in] _data The string that might be send to the clipboard
*/
void set(enum ewol::clipBoard::clipboardListe _clipboardID, const std::string& _data);
/**
* @brief Call system to request the current clipboard.
* @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread,
* we need the call the system to send us the buffer, this is really ambigous, but the widget (who has focus) receive the
* notification of the arrival of this buffer id
* @param[in] _clipboardID the needed clipboard ID
*/
void request(enum ewol::clipBoard::clipboardListe _clipboardID);
/**
* @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the
* Gui abstraction to set the buffer we receive. The end user must not use it.
* @param[in] _clipboardID selected clipboard ID
* @param[in] _data new buffer data
*/
void setSystem(enum ewol::clipBoard::clipboardListe _clipboardID,const std::string& _data);
/**
* @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in
* the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it.
* @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard
* @param[in] _clipboardID selected clipboard ID
* @return the requested buffer
*/
const std::string& get(enum ewol::clipBoard::clipboardListe _clipboardID);
// internal section
/**
* @brief initialize the clipboard system (done by ewol)
*/
void init(void);
/**
* @brief Un-Initialize the clipboard system (done by ewol)
*/
void unInit(void);
};
};
#endif

View File

@ -1,47 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_COMMAND_LINE_H__
#define __EWOL_COMMAND_LINE_H__
#include <etk/types.h>
#include <etk/UString.h>
namespace ewol {
class CommandLine {
private:
std::vector<std::string> m_listArgs; //!< list of all argument parsed
public:
/**
* @brief Parse the command line parameters
*/
void parse(int32_t _argc, const char* _argv[]);
/**
* @brief get the number of element in the Command line
* @return the number of element
*/
int32_t size(void);
/**
* @brief get an element with a specific ID
* @return _id The cmdLine Id element
*/
const std::string& get(int32_t _id);
/**
* @brief add one element at the Command line
* @param[in] _newElement String in the input that might be added.
*/
void add(const std::string& _newElement);
/**
* @brief remove an element
* @param[in] _id Id of the element
*/
void remove(int32_t _id);
};
};
#endif

View File

@ -13,30 +13,30 @@
#define __class__ "ewol::compositing::Area"
ewol::compositing::Area::Area(const ivec2& _size) :
m_position(0.0, 0.0, 0.0),
m_color(etk::color::white),
m_GLprogram(NULL),
m_GLPosition(-1),
m_GLMatrix(-1),
m_GLColor(-1),
m_GLtexture(-1),
m_GLtexID(-1),
m_resource(NULL) {
m_resource = ewol::Texture::keep();
m_position(0.0, 0.0, 0.0),
m_color(etk::color::white),
m_GLprogram(NULL),
m_GLPosition(-1),
m_GLMatrix(-1),
m_GLColor(-1),
m_GLtexture(-1),
m_GLtexID(-1),
m_resource(NULL) {
m_resource = ewol::resource::Texture::keep();
m_resource->setImageSize(_size);
m_resource->flush();
loadProgram();
}
ewol::compositing::Area::~Area(void) {
ewol::Texture::release(m_resource);
ewol::Program::release(m_GLprogram);
ewol::resource::Texture::release(m_resource);
ewol::resource::Program::release(m_GLprogram);
}
void ewol::compositing::Area::loadProgram(void) {
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
m_GLprogram = ewol::resource::Program::keep("DATA:textured3D.prog");
if (NULL != m_GLprogram) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");

View File

@ -9,25 +9,27 @@
#ifndef __EWOL_COMPOSITING_AREA_H__
#define __EWOL_COMPOSITING_AREA_H__
#include <etk/Color.h>
#include <ewol/debug.h>
#include <ewol/compositing/Compose.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/resource/Program.h>
#include <ewol/resource/Texture.h>
namespace ewol {
namespace compositing {
class Area : public ewol::compositing::Compose {
class Area : public ewol::Compositing {
private:
vec3 m_position; //!< The current position to draw
etk::Color<> m_color; //!< The text foreground color
private:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
int32_t m_GLtexture; //!< openGL id on the element (Texture position)
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
int32_t m_GLtexture; //!< openGL id on the element (Texture position)
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
private:
ewol::Texture* m_resource; //!< texture resources
ewol::resource::Texture* m_resource; //!< texture resources
std::vector<vec3 > m_coord; //!< internal coord of the object
std::vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
std::vector<etk::Color<float> > m_coordColor; //!< internal color of the different point

View File

@ -1,66 +0,0 @@
/**
* @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

View File

@ -13,41 +13,41 @@
#include <ewol/compositing/Compositing.h>
ewol::compositing::Compose::Compose(void) {
ewol::Compositing::Compositing(void) {
// nothing to do
}
ewol::compositing::Compose::~Compose(void) {
ewol::Compositing::~Compositing(void) {
// nothing to do
}
void ewol::compositing::Compose::resetMatrix(void) {
void ewol::Compositing::resetMatrix(void) {
m_matrixApply.identity();
}
void ewol::compositing::Compose::translate(const vec3& _vect) {
void ewol::Compositing::translate(const vec3& _vect) {
m_matrixApply *= etk::matTranslate(_vect);
}
void ewol::compositing::Compose::rotate(const vec3& _vect, float _angle) {
void ewol::Compositing::rotate(const vec3& _vect, float _angle) {
m_matrixApply *= etk::matRotate(_vect, _angle);
}
void ewol::compositing::Compose::scale(const vec3& _vect) {
void ewol::Compositing::scale(const vec3& _vect) {
m_matrixApply *= etk::matScale(_vect);
}
void ewol::compositing::Compose::clear(void) {
void ewol::Compositing::clear(void) {
m_matrixApply.identity();
}
void ewol::compositing::Compose::setMatrix(const mat4& _mat) {
void ewol::Compositing::setMatrix(const mat4& _mat) {
m_matrixApply = _mat;
}

View File

@ -0,0 +1,64 @@
/**
* @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

View File

@ -277,14 +277,14 @@ void ewol::compositing::Drawing::resetCount(void) {
}
void ewol::compositing::Drawing::unLoadProgram(void) {
ewol::Program::release(m_GLprogram);
ewol::resource::Program::release(m_GLprogram);
}
void ewol::compositing::Drawing::loadProgram(void) {
// remove previous loading ... in case
unLoadProgram();
// oad the new ...
m_GLprogram = ewol::Program::keep("DATA:color3.prog");
m_GLprogram = ewol::resource::Program::keep("DATA:color3.prog");
// get the shader resource :
if (NULL != m_GLprogram ) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");

View File

@ -12,13 +12,13 @@
#include <etk/Color.h>
#include <ewol/debug.h>
#include <ewol/compositing/Compose.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/resource/Program.h>
namespace ewol {
namespace compositing {
class Drawing : public ewol::compositing::Compose {
class Drawing : public ewol::Compositing {
private:
vec3 m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position
@ -28,10 +28,10 @@ namespace ewol {
etk::Color<> m_color; //!< The text foreground color
etk::Color<> m_colorBg; //!< The text background color
private:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
private: // Background Color (display only when needed)
std::vector<vec3 > m_coord; //!< internal position for the text display
std::vector<etk::Color<float> > m_coordColor; //!< internal color of the background
@ -53,10 +53,10 @@ namespace ewol {
* @brief Un-Load the openGL program and get all the ID needed
*/
void unLoadProgram(void);
float m_thickness; //!< when drawing line and other things
int32_t m_triElement; //!< special counter of the single dot generated
vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle
etk::Color<float> m_tricolor[3]; //!< Register every the associated color foreground
float m_thickness; //!< when drawing line and other things
int32_t m_triElement; //!< special counter of the single dot generated
vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle
etk::Color<float> m_tricolor[3]; //!< Register every the associated color foreground
// internal API for the generation abstraction of triangles
/**
* @brief Lunch the generation of triangle

View File

@ -31,14 +31,14 @@ ewol::compositing::Image::Image(const std::string& _imageName) :
}
ewol::compositing::Image::~Image(void) {
ewol::TextureFile::release(m_resource);
ewol::Program::release(m_GLprogram);
ewol::resource::TextureFile::release(m_resource);
ewol::resource::Program::release(m_GLprogram);
}
void ewol::compositing::Image::loadProgram(void) {
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
m_GLprogram = ewol::resource::Program::keep("DATA:textured3D.prog");
if (NULL!=m_GLprogram) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");
@ -85,7 +85,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
void ewol::compositing::Image::clear(void) {
// call upper class
ewol::compositing::Compose::clear();
ewol::Compositing::clear();
// reset Buffer :
m_coord.clear();
m_coordTex.clear();
@ -229,12 +229,12 @@ void ewol::compositing::Image::printPart(const vec2& _size,
void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2& _size) {
clear();
// remove old one
ewol::TextureFile::release(m_resource);
ewol::resource::TextureFile::release(m_resource);
ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded...
if (_newFile != "") {
// link to new one
m_resource = ewol::TextureFile::keep(_newFile, tmpSize);
m_resource = ewol::resource::TextureFile::keep(_newFile, tmpSize);
if (NULL == m_resource) {
EWOL_ERROR("Can not get Image resource");
}

View File

@ -10,12 +10,13 @@
#define __EWOL_COMPOSITING_IMAGE_H__
#include <ewol/debug.h>
#include <ewol/compositing/Compose.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/resource/Program.h>
#include <ewol/resource/Image.h>
namespace ewol {
namespace compositing {
class Image : public ewol::compositing::Compose {
class Image : public ewol::Compositing {
private:
vec3 m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position
@ -25,14 +26,14 @@ namespace ewol {
etk::Color<> m_color; //!< The text foreground color
float m_angle; //!< Angle to set at the axes
private:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
int32_t m_GLtexture; //!< openGL id on the element (Texture position)
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
private:
ewol::TextureFile* m_resource; //!< texture resources
ewol::resource::TextureFile* m_resource; //!< texture resources
std::vector<vec3 > m_coord; //!< internal coord of the object
std::vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
std::vector<etk::Color<float> > m_coordColor; //!< internal color of the different point

View File

@ -47,9 +47,9 @@ ewol::compositing::Shaper::~Shaper(void) {
}
void ewol::compositing::Shaper::unLoadProgram(void) {
ewol::Program::release(m_GLprogram);
ewol::TextureFile::release(m_resourceTexture);
ewol::ConfigFile::release(m_config);
ewol::resource::Program::release(m_GLprogram);
ewol::resource::TextureFile::release(m_resourceTexture);
ewol::resource::ConfigFile::release(m_config);
}
void ewol::compositing::Shaper::loadProgram(void) {
@ -57,7 +57,7 @@ void ewol::compositing::Shaper::loadProgram(void) {
EWOL_DEBUG("no Shaper set for loading resources ...");
return;
}
m_config = ewol::ConfigFile::keep(m_name);
m_config = ewol::resource::ConfigFile::keep(m_name);
if (NULL != m_config) {
m_confIdPaddingX = m_config->request("PaddingX");
m_confIdPaddingY = m_config->request("PaddingY");
@ -73,7 +73,7 @@ void ewol::compositing::Shaper::loadProgram(void) {
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::keep(tmpFilename);
m_GLprogram = ewol::resource::Program::keep(tmpFilename);
if (NULL !=m_GLprogram) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord2d");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
@ -93,7 +93,7 @@ void ewol::compositing::Shaper::loadProgram(void) {
if (basicImageFile != "") {
tmpFilename = file.getRelativeFolder() + basicImageFile;
ivec2 size(64,64);
m_resourceTexture = ewol::TextureFile::keep(tmpFilename, size);
m_resourceTexture = ewol::resource::TextureFile::keep(tmpFilename, size);
}
}
}
@ -148,7 +148,7 @@ bool ewol::compositing::Shaper::changeStatusIn(int32_t _newStatusId) {
return false;
}
bool ewol::compositing::Shaper::periodicCall(const ewol::EventTime& _event) {
bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
//EWOL_DEBUG("call=" << _event);
// start :
if (m_stateTransition >= 1.0) {
@ -177,8 +177,8 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::EventTime& _event) {
m_nextStatusRequested = -1;
}
}
float timeRelativity = m_config->getFloat(m_confIdChangeTime)/1000.0;
m_stateTransition += _event.getDeltaCall()/timeRelativity;
float timeRelativity = m_config->getFloat(m_confIdChangeTime) / 1000.0;
m_stateTransition += _event.getDeltaCall() / timeRelativity;
//m_stateTransition += _event.getDeltaCall();
m_stateTransition = etk_avg(0.0f, m_stateTransition, 1.0f);
//EWOL_DEBUG("relative=" << timeRelativity << " Transition : " << m_stateTransition);

View File

@ -10,9 +10,11 @@
#define __EWOL_COMPOSITING_SHAPER_H__
#include <ewol/debug.h>
#include <ewol/compositing/Compose.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/renderer/EventTime.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/resource/Program.h>
#include <ewol/resource/ConfigFile.h>
#include <ewol/resource/Image.h>
#include <ewol/event/Time.h>
namespace ewol {
namespace compositing {
@ -21,30 +23,30 @@ namespace ewol {
*/
// TODO : load image
// TODO : Abstaraction between states (call by name and the system greate IDs
class Shaper : public ewol::compositing::Compose {
class Shaper : public ewol::Compositing {
private:
std::string m_name; //!< Name of the configuration of the shaper.
// External theme config:
ewol::ConfigFile* m_config; //!< pointer on the config file resources
int32_t m_confIdPaddingX; //!< ConfigFile padding property X
int32_t m_confIdPaddingY; //!< ConfigFile padding property Y
int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property
int32_t m_confProgramFile; //!< ConfigFile opengGl program Name
int32_t m_confImageFile; //!< ConfigFile opengGl program Name
ewol::resource::ConfigFile* m_config; //!< pointer on the config file resources
int32_t m_confIdPaddingX; //!< ConfigFile padding property X
int32_t m_confIdPaddingY; //!< ConfigFile padding property Y
int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property
int32_t m_confProgramFile; //!< ConfigFile opengGl program Name
int32_t m_confImageFile; //!< ConfigFile opengGl program Name
// openGL shaders programs:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLPropertySize; //!< openGL id on the element (widget size)
int32_t m_GLPropertyOrigin; //!< openGL id on the element (widget origin)
int32_t m_GLPropertyInsidePos; //!< openGL id on the element (widget internal element position)
int32_t m_GLPropertyInsideSize; //!< openGL id on the element (widget internal element size)
int32_t m_GLStateOld; //!< openGL id on the element (old state displayed)
int32_t m_GLStateNew; //!< openGL id on the element (new state displayed)
int32_t m_GLStateTransition; //!< openGL id on the element (transition ofset [0.0..1.0] )
int32_t m_GLtexID; //!< openGL id on the element (texture image)
ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLPropertySize; //!< openGL id on the element (widget size)
int32_t m_GLPropertyOrigin; //!< openGL id on the element (widget origin)
int32_t m_GLPropertyInsidePos; //!< openGL id on the element (widget internal element position)
int32_t m_GLPropertyInsideSize; //!< openGL id on the element (widget internal element size)
int32_t m_GLStateOld; //!< openGL id on the element (old state displayed)
int32_t m_GLStateNew; //!< openGL id on the element (new state displayed)
int32_t m_GLStateTransition; //!< openGL id on the element (transition ofset [0.0..1.0] )
int32_t m_GLtexID; //!< openGL id on the element (texture image)
// For the Image :
ewol::TextureFile* m_resourceTexture; //!< texture resources (for the image)
ewol::resource::TextureFile* m_resourceTexture; //!< texture resources (for the image)
// internal needed data :
int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it
vec2 m_propertyOrigin; //!< widget origin
@ -117,7 +119,7 @@ namespace ewol {
* @return true The widget must call this fuction periodicly (and redraw itself)
* @return false No need to request the periodic call.
*/
bool periodicCall(const ewol::EventTime& _event);
bool periodicCall(const ewol::event::Time& _event);
/**
* @brief set the widget origin (needed fot the display)
* @param[in] _newOri : the new widget origin

View File

@ -13,7 +13,7 @@
#define __class__ "ewol::compositing::Sprite"
ewol::compositing::Sprite::Sprite(const std::string& _imageName, const ivec2& _nbSprite) :
ewol::Image(_imageName),
ewol::compositing::Image(_imageName),
m_nbSprite(_nbSprite),
m_unitarySpriteSize(0,0) {
/*

View File

@ -11,11 +11,11 @@
#include <ewol/debug.h>
#include <ewol/compositing/Image.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/resource/Manager.h>
namespace ewol {
namespace compositing {
class Sprite : public ewol::compositing::Compose {
class Sprite : public ewol::compositing::Image {
protected:
ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal
vec2 m_unitarySpriteSize; //!< size of a unique sprite

View File

@ -8,7 +8,7 @@
#include <ewol/debug.h>
#include <ewol/compositing/Text.h>
#include <ewol/renderer/eContext.h>
#include <ewol/context/Context.h>
#include <etk/UString.h>
#undef __class__
@ -30,7 +30,7 @@ ewol::compositing::Text::Text(const std::string& _fontName, int32_t _fontSize) :
m_previousCharcode(0),
m_startTextpos(0),
m_stopTextPos(0),
m_alignement(ewol::Text::alignDisable),
m_alignement(alignDisable),
m_GLprogram(NULL),
m_GLPosition(-1),
m_GLMatrix(-1),
@ -46,14 +46,14 @@ ewol::compositing::Text::Text(const std::string& _fontName, int32_t _fontSize) :
ewol::compositing::Text::~Text(void) {
ewol::TexturedFont::release(m_font);
ewol::Program::release(m_GLprogram);
ewol::resource::TexturedFont::release(m_font);
ewol::resource::Program::release(m_GLprogram);
}
void ewol::compositing::Text::loadProgram(void) {
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::keep("DATA:text.prog");
m_GLprogram = ewol::resource::Program::keep("DATA:text.prog");
if (m_GLprogram != NULL) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord2d");
m_GLColor = m_GLprogram->getAttribute("EW_color");

View File

@ -12,9 +12,9 @@
#include <etk/Color.h>
#include <ewol/debug.h>
#include <ewol/compositing/Compose.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/compositing/Drawing.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/resource/TexturedFont.h>
#include <exml/exml.h>
#include <string>
@ -22,6 +22,7 @@ namespace ewol {
namespace compositing {
/**
* @brief This class represent the specific display for every char in the string ...
* @not-in-doc
*/
class TextDecoration {
public:
@ -35,7 +36,7 @@ namespace ewol {
}
};
class Text : public ewol::compositing::Compose {
class Text : public ewol::Compositing {
public:
enum aligneMode {
alignDisable,
@ -45,9 +46,9 @@ namespace ewol {
alignJustify
};
private:
ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ...
ewol::compositing::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ...
public:
ewol::Drawing& getDrawing(void) {
ewol::compositing::Drawing& getDrawing(void) {
return m_vectorialDraw;
};
private:
@ -74,7 +75,7 @@ namespace ewol {
float m_stopTextPos; //!< end of the alignement (when a string is too hight it cut at the word previously this virtual line and the center is perform with this one)
enum aligneMode m_alignement; //!< Current Alignement mode (justify/left/right ...)
private:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
@ -84,7 +85,7 @@ namespace ewol {
int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection)
int32_t m_cursorPos; //!< Cursor position (default no cursor == > -100)
private:
ewol::TexturedFont* m_font; //!< Font resources
ewol::resource::TexturedFont* m_font; //!< Font resources
private: // Text
std::vector<vec2 > m_coord; //!< internal coord of the object
std::vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
@ -325,7 +326,7 @@ namespace ewol {
* @param[in] _alignement mode of alignement for the Text.
* @note The text align in center change of line every display done (even if it was just a char)
*/
void setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::Text::aligneMode _alignement=ewol::Text::alignDisable);
void setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::compositing::Text::aligneMode _alignement=ewol::compositing::Text::alignDisable);
/**
* @brief disable the alignement system
*/
@ -334,7 +335,7 @@ namespace ewol {
* @brief get the current alignement property
* @return the curent alignement type
*/
enum ewol::Text::aligneMode getAlignement(void);
enum ewol::compositing::Text::aligneMode getAlignement(void);
/**
* @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention.

View File

@ -10,9 +10,9 @@
#include <ewol/resources/FontFreeType.h>
#undef __class__
#define __class__ "ConfigFont"
#define __class__ "context::ConfigFont"
ewol::ConfigFont::ConfigFont(void) :
ewol::context::ConfigFont::ConfigFont(void) :
m_folder("DATA:fonts"),
m_name("Arial;Helvetica"),
m_size(10),
@ -20,12 +20,12 @@ ewol::ConfigFont::ConfigFont(void) :
ewol::freeTypeInit();
}
ewol::ConfigFont::~ConfigFont(void) {
ewol::context::ConfigFont::~ConfigFont(void) {
// UnInit FreeTypes
ewol::freeTypeUnInit();
}
void ewol::ConfigFont::set(const std::string& _fontName, int32_t _size) {
void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) {
m_name = _fontName;
m_size = _size;
EWOL_INFO("Set default Font : '" << _fontName << "' size=" << _size);

View File

@ -0,0 +1,87 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_CONFIG_FONT_H__
#define __EWOL_CONFIG_FONT_H__
#include <etk/types.h>
#include <etk/UString.h>
namespace ewol {
namespace context {
class ConfigFont {
public:
/**
* Constructor / destructor
*/
ConfigFont(void);
~ConfigFont(void);
private:
std::string m_folder;
public:
/**
* @brief Specify the default font folder for the Ewol search system (only needed when embended font)
* @param[in] _folder basic folder of the font (ex: DATA:fonts)
*/
void setFolder(const std::string& _folder) {
m_folder = _folder;
};
/**
* @brief get the default font folder.
* @return The default font folder.
*/
const std::string& getFolder(void) {
return m_folder;
};
private:
std::string m_name;
int32_t m_size;
public:
/**
* @brief set the defaut font for all the widgets and basics display.
* @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
* @param[in] _size The default size of the font default=10.
*/
void set(const std::string& _fontName, int32_t _size);
/**
* @brief get the current default font name
* @raturn a reference on the font name string
*/
const std::string& getName(void) {
return m_name;
};
/**
* @brief get the default font size.
* @return the font size.
*/
int32_t getSize(void) {
return m_size;
};
private:
bool m_useExternal;
public:
/**
* @brief set use of internal/external Font
* @param[in] _val true to enable search of internal data.
*/
void setUseExternal(bool _val) {
m_useExternal=_val;
};
/**
* @brief get the use of internal/external Font
* @return true to enable search of internal data.
*/
bool getUseExternal(void) {
return m_useExternal;
};
};
};
};
#endif

View File

@ -11,60 +11,62 @@
#include <etk/types.h>
#include <etk/MessageFifo.h>
#include <ewol/key.h>
#include <ewol/ewol.h>
#include <ewol/clipBoard.h>
#include <ewol/key/key.h>
#include <ewol/object/Manager.h>
#include <ewol/resource/Manager.h>
#include <ewol/widget/Manager.h>
#include <ewol/widget/Windows.h>
#include <ewol/renderer/eInput.h>
#include <ewol/renderer/Fps.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/ConfigFont.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/commandLine.h>
#include <ewol/context/clipBoard.h>
#include <ewol/context/ConfigFont.h>
#include <ewol/context/commandLine.h>
#include <ewol/context/InputManager.h>
#include <ewol/context/Fps.h>
namespace ewol {
class eSystemMessage;
/**
* @not-in-doc
*/
enum orientation{
screenAuto = 0,
screenLandscape,
screenPortrait
};
class eContext {
class Context {
private:
ewol::CommandLine m_commandLine; //!< Start command line information
ewol::context::CommandLine m_commandLine; //!< Start command line information
public:
ewol::CommandLine& getCmd(void) {
ewol::context::CommandLine& getCmd(void) {
return m_commandLine;
};
private:
ewol::ConfigFont m_configFont; //!< global font configuration
ewol::context::ConfigFont m_configFont; //!< global font configuration
public:
ewol::ConfigFont& getFontDefault(void) {
ewol::context::ConfigFont& getFontDefault(void) {
return m_configFont;
};
private:
ewol::WidgetManager m_widgetManager; //!< global widget manager
ewol::widget::Manager m_widgetManager; //!< global widget manager
public:
ewol::WidgetManager& getWidgetManager(void) {
ewol::widget::Manager& getWidgetManager(void) {
return m_widgetManager;
};
private:
ewol::EObjectManager m_EObjectManager; //!< eObject Manager main instance
ewol::object::Manager m_EObjectManager; //!< eObject Manager main instance
public:
ewol::EObjectManager& getEObjectManager(void) {
ewol::object::Manager& getEObjectManager(void) {
return m_EObjectManager;
};
private:
ewol::ResourceManager m_resourceManager; //!< global resources Manager
ewol::resource::Manager m_resourceManager; //!< global resources Manager
public:
ewol::ResourceManager& getResourcesManager(void) {
ewol::resource::Manager& getResourcesManager(void) {
return m_resourceManager;
};
public:
eContext(int32_t _argc=0, const char* _argv[]=NULL);
virtual ~eContext(void);
Context(int32_t _argc=0, const char* _argv[]=NULL);
virtual ~Context(void);
protected:
/**
* @brief set the curent interface.
@ -78,13 +80,13 @@ namespace ewol {
void unLockContext(void);
private:
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
ewol::eInput m_input;
ewol::InputManager m_input;
etk::MessageFifo<ewol::eSystemMessage*> m_msgSystem;
bool m_displayFps;
ewol::Fps m_FpsSystemEvent;
ewol::Fps m_FpsSystemContext;
ewol::Fps m_FpsSystem;
ewol::Fps m_FpsFlush;
ewol::context::Fps m_FpsSystemEvent;
ewol::context::Fps m_FpsSystemContext;
ewol::context::Fps m_FpsSystem;
ewol::context::Fps m_FpsFlush;
/**
* @brief Processing all the event arrived ... (commoly called in draw function)
*/
@ -303,13 +305,13 @@ namespace ewol {
* @brief From everyware in the program, we can get the context inteface.
* @return current reference on the instance.
*/
eContext& getContext(void);
Context& getContext(void);
};
//!< must be define in CPP by the application ... this are the main init and unInit of the Application
// return false if an error occured
bool APP_Init(ewol::eContext& _context);
void APP_UnInit(ewol::eContext& _context);
void APP_UnInit(ewol::Context& _context);
#endif

View File

@ -17,7 +17,7 @@
static bool isInit = false;
static vec2 ratio(9999999,888888);
static vec2 invRatio(1,1);
static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel);
static ewol::context::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel);
static const float inchToMillimeter = 1.0f/25.4f;
static const float footToMillimeter = 1.0f/304.8f;
@ -31,87 +31,87 @@ static const float millimeterToCentimeter = 10.0f;
static const float millimeterToKilometer = 1000000.0f;
void ewol::dimension::init(void) {
void ewol::context::Dimension::init(void) {
if (true == isInit) {
return;
}
ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch);
ewol::context::Dimension conversion(vec2(72,72), ewol::context::Dimension::Inch);
ratio = conversion.getMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.set(vec2(200,200), ewol::Dimension::Pixel);
windowsSize.set(vec2(200,200), ewol::context::Dimension::Pixel);
isInit = true;
}
void ewol::dimension::unInit(void) {
void ewol::context::Dimension::unInit(void) {
isInit = false;
ratio.setValue(9999999,888888);
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.set(vec2(9999999,88888), ewol::Dimension::Pixel);
windowsSize.set(vec2(9999999,88888), ewol::context::Dimension::Pixel);
}
void ewol::dimension::setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type) {
ewol::dimension::init();
void ewol::context::Dimension::setPixelRatio(const vec2& _ratio, enum ewol::context::Dimension::distance _type) {
ewol::context::Dimension::init();
EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type);
ewol::Dimension conversion(_ratio, _type);
ewol::context::Dimension conversion(_ratio, _type);
EWOL_INFO(" == > " << conversion);
ratio = conversion.getMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio);
}
void ewol::dimension::setPixelWindowsSize(const vec2& _size) {
void ewol::context::Dimension::setPixelWindowsSize(const vec2& _size) {
windowsSize = _size;
EWOL_VERBOSE("Set a new Windows property size " << windowsSize << "px");
}
vec2 ewol::dimension::getWindowsSize(enum ewol::Dimension::distance _type) {
vec2 ewol::context::Dimension::getWindowsSize(enum ewol::context::Dimension::distance _type) {
return windowsSize.get(_type);
}
float ewol::dimension::getWindowsDiag(enum ewol::Dimension::distance _type) {
vec2 size = ewol::dimension::getWindowsSize(_type);
float ewol::context::Dimension::getWindowsDiag(enum ewol::context::Dimension::distance _type) {
vec2 size = ewol::context::Dimension::getWindowsSize(_type);
return size.length();
}
ewol::Dimension::Dimension(void) :
ewol::context::Dimension::Dimension(void) :
m_data(0,0),
m_type(ewol::Dimension::Pixel) {
m_type(ewol::context::Dimension::Pixel) {
// notinh to do ...
}
ewol::Dimension::Dimension(const vec2& _size, enum ewol::Dimension::distance _type) :
ewol::context::Dimension::Dimension(const vec2& _size, enum ewol::context::Dimension::distance _type) :
m_data(0,0),
m_type(ewol::Dimension::Pixel) {
m_type(ewol::context::Dimension::Pixel) {
set(_size, _type);
}
void ewol::Dimension::set(std::string _config) {
void ewol::context::Dimension::set(std::string _config) {
m_data.setValue(0,0);
m_type = ewol::Dimension::Pixel;
enum distance type = ewol::Dimension::Pixel;
m_type = ewol::context::Dimension::Pixel;
enum distance type = ewol::context::Dimension::Pixel;
if (end_with(_config, "%", false) == true) {
type = ewol::Dimension::Pourcent;
type = ewol::context::Dimension::Pourcent;
_config.erase(_config.size()-1, 1);
} else if (end_with(_config, "px",false) == true) {
type = ewol::Dimension::Pixel;
type = ewol::context::Dimension::Pixel;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "ft",false) == true) {
type = ewol::Dimension::foot;
type = ewol::context::Dimension::foot;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "in",false) == true) {
type = ewol::Dimension::Inch;
type = ewol::context::Dimension::Inch;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "km",false) == true) {
type = ewol::Dimension::Kilometer;
type = ewol::context::Dimension::Kilometer;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "mm",false) == true) {
type = ewol::Dimension::Millimeter;
type = ewol::context::Dimension::Millimeter;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "cm",false) == true) {
type = ewol::Dimension::Centimeter;
type = ewol::context::Dimension::Centimeter;
_config.erase(_config.size()-2, 2);
} else if (end_with(_config, "m",false) == true) {
type = ewol::Dimension::Meter;
type = ewol::context::Dimension::Meter;
_config.erase(_config.size()-1, 1);
} else {
EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\"");
@ -122,104 +122,104 @@ void ewol::Dimension::set(std::string _config) {
EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this );
}
ewol::Dimension::~Dimension(void) {
ewol::context::Dimension::~Dimension(void) {
// nothing to do ...
}
ewol::Dimension::operator std::string(void) const {
ewol::context::Dimension::operator std::string(void) const {
std::string str;
str = get(getType());
switch(getType()) {
case ewol::Dimension::Pourcent:
case ewol::context::Dimension::Pourcent:
str += "%";
break;
case ewol::Dimension::Pixel:
case ewol::context::Dimension::Pixel:
str += "px";
break;
case ewol::Dimension::Meter:
case ewol::context::Dimension::Meter:
str += "m";
break;
case ewol::Dimension::Centimeter:
case ewol::context::Dimension::Centimeter:
str += "cm";
break;
case ewol::Dimension::Millimeter:
case ewol::context::Dimension::Millimeter:
str += "mm";
break;
case ewol::Dimension::Kilometer:
case ewol::context::Dimension::Kilometer:
str += "km";
break;
case ewol::Dimension::Inch:
case ewol::context::Dimension::Inch:
str += "in";
break;
case ewol::Dimension::foot:
case ewol::context::Dimension::foot:
str += "ft";
break;
}
return str;
}
vec2 ewol::Dimension::get(enum ewol::Dimension::distance _type) const {
vec2 ewol::context::Dimension::get(enum ewol::context::Dimension::distance _type) const {
switch(_type) {
case ewol::Dimension::Pourcent:
case ewol::context::Dimension::Pourcent:
return getPourcent();
case ewol::Dimension::Pixel:
case ewol::context::Dimension::Pixel:
return getPixel();
case ewol::Dimension::Meter:
case ewol::context::Dimension::Meter:
return getMeter();
case ewol::Dimension::Centimeter:
case ewol::context::Dimension::Centimeter:
return getCentimeter();
case ewol::Dimension::Millimeter:
case ewol::context::Dimension::Millimeter:
return getMillimeter();
case ewol::Dimension::Kilometer:
case ewol::context::Dimension::Kilometer:
return getKilometer();
case ewol::Dimension::Inch:
case ewol::context::Dimension::Inch:
return getInch();
case ewol::Dimension::foot:
case ewol::context::Dimension::foot:
return getFoot();
}
return vec2(0,0);
}
void ewol::Dimension::set(const vec2& _size, enum ewol::Dimension::distance _type) {
void ewol::context::Dimension::set(const vec2& _size, enum ewol::context::Dimension::distance _type) {
// set min max on input to limit error :
vec2 size(etk_avg(0.0f,_size.x(),9999999.0f),
etk_avg(0.0f,_size.y(),9999999.0f));
switch(_type) {
case ewol::Dimension::Pourcent: {
case ewol::context::Dimension::Pourcent: {
vec2 size2(etk_avg(0.0f,_size.x(),100.0f),
etk_avg(0.0f,_size.y(),100.0f));
m_data = vec2(size2.x()*0.01f, size2.y()*0.01f);
//EWOL_VERBOSE("Set % : " << size2 << " == > " << m_data);
break;
}
case ewol::Dimension::Pixel:
case ewol::context::Dimension::Pixel:
m_data = size;
break;
case ewol::Dimension::Meter:
case ewol::context::Dimension::Meter:
m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y());
break;
case ewol::Dimension::Centimeter:
case ewol::context::Dimension::Centimeter:
m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y());
break;
case ewol::Dimension::Millimeter:
case ewol::context::Dimension::Millimeter:
m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y());
break;
case ewol::Dimension::Kilometer:
case ewol::context::Dimension::Kilometer:
m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y());
break;
case ewol::Dimension::Inch:
case ewol::context::Dimension::Inch:
m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y());
break;
case ewol::Dimension::foot:
case ewol::context::Dimension::foot:
m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y());
break;
}
m_type = _type;
}
vec2 ewol::Dimension::getPixel(void) const {
if (m_type!=ewol::Dimension::Pourcent) {
vec2 ewol::context::Dimension::getPixel(void) const {
if (m_type!=ewol::context::Dimension::Pourcent) {
return m_data;
} else {
vec2 windDim = windowsSize.getPixel();
@ -229,8 +229,8 @@ vec2 ewol::Dimension::getPixel(void) const {
}
}
vec2 ewol::Dimension::getPourcent(void) const {
if (m_type!=ewol::Dimension::Pourcent) {
vec2 ewol::context::Dimension::getPourcent(void) const {
if (m_type!=ewol::context::Dimension::Pourcent) {
vec2 windDim = windowsSize.getPixel();
//EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ...
//printf(" windows dimention : %f,%f", windDim.x(),windDim.y());
@ -240,61 +240,61 @@ vec2 ewol::Dimension::getPourcent(void) const {
return vec2(m_data.x()*100.0f, m_data.y()*100.0f);;
}
vec2 ewol::Dimension::getMeter(void) const {
return ewol::Dimension::getMillimeter()*millimeterToMeter;
vec2 ewol::context::Dimension::getMeter(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToMeter;
}
vec2 ewol::Dimension::getCentimeter(void) const {
return ewol::Dimension::getMillimeter()*millimeterToCentimeter;
vec2 ewol::context::Dimension::getCentimeter(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToCentimeter;
}
vec2 ewol::Dimension::getMillimeter(void) const {
return ewol::Dimension::getPixel()*invRatio;
vec2 ewol::context::Dimension::getMillimeter(void) const {
return ewol::context::Dimension::getPixel()*invRatio;
}
vec2 ewol::Dimension::getKilometer(void) const {
return ewol::Dimension::getMillimeter()*millimeterToKilometer;
vec2 ewol::context::Dimension::getKilometer(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToKilometer;
}
vec2 ewol::Dimension::getInch(void) const {
return ewol::Dimension::getMillimeter()*millimeterToInch;
vec2 ewol::context::Dimension::getInch(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToInch;
}
vec2 ewol::Dimension::getFoot(void) const {
return ewol::Dimension::getMillimeter()*millimeterToFoot;
vec2 ewol::context::Dimension::getFoot(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToFoot;
}
etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::Dimension::distance _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::context::Dimension::distance _obj) {
switch(_obj) {
case ewol::Dimension::Pourcent:
case ewol::context::Dimension::Pourcent:
_os << "%";
break;
case ewol::Dimension::Pixel:
case ewol::context::Dimension::Pixel:
_os << "px";
break;
case ewol::Dimension::Meter:
case ewol::context::Dimension::Meter:
_os << "m";
break;
case ewol::Dimension::Centimeter:
case ewol::context::Dimension::Centimeter:
_os << "cm";
break;
case ewol::Dimension::Millimeter:
case ewol::context::Dimension::Millimeter:
_os << "mm";
break;
case ewol::Dimension::Kilometer:
case ewol::context::Dimension::Kilometer:
_os << "km";
break;
case ewol::Dimension::Inch:
case ewol::context::Dimension::Inch:
_os << "in";
break;
case ewol::Dimension::foot:
case ewol::context::Dimension::foot:
_os << "ft";
break;
}
return _os;
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Dimension& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::context::Dimension& _obj) {
_os << _obj.get(_obj.getType()) << _obj.getType();
return _os;
}

View File

@ -0,0 +1,214 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_DIMENSION_H__
#define __EWOL_DIMENSION_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <etk/math/Vector2D.h>
namespace ewol {
namespace context {
/**
* @brief in the dimention class we store the data as the more usefull unit (pixel)
* but one case need to be dynamic the %, then when requested in % the register the % value
*/
class Dimension {
public:
enum distance {
Pourcent=0,
Pixel,
Meter,
Centimeter,
Millimeter,
Kilometer,
Inch,
foot,
};
private:
vec2 m_data;
enum distance m_type;
public:
/**
* @brief Constructor (default :0,0 mode pixel)
*/
Dimension(void);
/**
* @brief Constructor
* @param[in] _size Requested dimention
* @param[in] _type Unit of the Dimention
*/
Dimension(const vec2& _size, enum ewol::context::Dimension::distance _type=ewol::context::Dimension::Pixel);
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const std::string& _config) :
m_data(0,0),
m_type(ewol::context::Dimension::Pixel) {
set(_config);
};
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const char* _config) :
m_data(0,0),
m_type(ewol::context::Dimension::Pixel) {
set(_config);
};
/**
* @brief Destructor
*/
~Dimension(void);
/**
* @brief string cast :
*/
operator std::string(void) const;
/**
* @brief get the current dimention in requested type
* @param[in] _type Type of unit requested.
* @return dimention requested.
*/
vec2 get(enum distance _type) const;
/**
* @brief set the current dimention in requested type
* @param[in] _size Dimention to set
* @param[in] _type Type of unit requested.
*/
void set(const vec2& _size, enum distance _type);
private:
/**
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
public:
/**
* @brief get the current dimention in pixel
* @return dimention in Pixel
*/
vec2 getPixel(void) const;
/**
* @brief get the current dimention in Pourcent
* @return dimention in Pourcent
*/
vec2 getPourcent(void) const;
/**
* @brief get the current dimention in Meter
* @return dimention in Meter
*/
vec2 getMeter(void) const;
/**
* @brief get the current dimention in Centimeter
* @return dimention in Centimeter
*/
vec2 getCentimeter(void) const;
/**
* @brief get the current dimention in Millimeter
* @return dimention in Millimeter
*/
vec2 getMillimeter(void) const;
/**
* @brief get the current dimention in Kilometer
* @return dimention in Kilometer
*/
vec2 getKilometer(void) const;
/**
* @brief get the current dimention in Inch
* @return dimention in Inch
*/
vec2 getInch(void) const;
/**
* @brief get the current dimention in Foot
* @return dimention in Foot
*/
vec2 getFoot(void) const;
/*****************************************************
* = assigment
*****************************************************/
const Dimension& operator= (const Dimension& _obj ) {
if (this!=&_obj) {
m_data = _obj.m_data;
m_type = _obj.m_type;
}
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator == (const Dimension& _obj) const {
if( m_data == _obj.m_data
&& m_type == _obj.m_type) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Dimension& _obj) const {
if( m_data != _obj.m_data
|| m_type != _obj.m_type) {
return true;
}
return false;
}
/**
* @breif get the dimension type
* @return the type
*/
enum distance getType(void) const {
return m_type;
};
public : // Global static access :
/**
* @brief basic init
*/
static void init(void);
/**
* @brief basic un-init
*/
static void unInit(void);
/**
* @brief set the Milimeter ratio for calculation
* @param[in] Ratio Milimeter ration for the screen calculation interpolation
* @param[in] type Unit type requested.
* @note: same as @ref setPixelPerInch (internal manage convertion)
*/
static void setPixelRatio(const vec2& _ratio, enum ewol::context::Dimension::distance _type);
/**
* @brief set the current Windows size
* @param[in] size size of the current windows in pixel.
*/
static void setPixelWindowsSize(const vec2& _size);
/**
* @brief get the Windows size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
static vec2 getWindowsSize(enum ewol::context::Dimension::distance _type);
/**
* @brief get the Windows diagonal size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
static float getWindowsDiag(enum ewol::context::Dimension::distance _type);
};
};
etk::CCout& operator <<(etk::CCout& _os, enum ewol::context::Dimension::distance _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::context::Dimension& _obj);
};
#endif

141
sources/ewol/context/Fps.h Normal file
View File

@ -0,0 +1,141 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_FPS_H__
#define __EWOL_FPS_H__
namespace ewol {
namespace context {
/**
* @brief This class is designed to count the number of frame per second in the main renderer system
* @not-in-doc
*/
class Fps {
// display every second ...
#define DISPLAY_PERIODE_US (1000000)
private:
int64_t startTime;
int64_t nbCallTime;
int64_t nbDisplayTime;
int64_t min;
int64_t avg;
int64_t max;
int64_t min_idle;
int64_t avg_idle;
int64_t max_idle;
int64_t ticTime;
bool display;
bool drwingDone;
const char * m_displayName;
bool m_displayFPS;
public:
/**
* @brief Constructor
*/
Fps(const char * displayName, bool displayFPS) {
startTime = -1;
nbCallTime = 0;
nbDisplayTime = 0;
min = 99999999999999LL;
avg = 0;
max = 0;
min_idle = 99999999999999LL;
avg_idle = 0;
max_idle = 0;
ticTime = 0;
display = false;
drwingDone = false;
m_displayName = displayName;
m_displayFPS = displayFPS;
}
/**
* @brief Destructor
*/
~Fps(void) {
}
/**
* @brief this might be call every time a diplay start
*/
void tic(void) {
int64_t currentTime = ewol::getTime();
ticTime = currentTime;
nbCallTime++;
if (startTime<0) {
startTime = currentTime;
}
//EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime));
if ( (currentTime - startTime) > DISPLAY_PERIODE_US) {
display = true;
}
}
/**
* @brief this might be call every time a diplay stop, it do the display every second
* @param[in] displayTime display curent time of the frame.
*/
void toc(bool displayTime = false) {
int64_t currentTime = ewol::getTime();
int64_t processTimeLocal = (currentTime - ticTime);
if (displayTime == true) {
EWOL_DEBUG(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms ");
}
if (drwingDone) {
min = etk_min(min, processTimeLocal);
max = etk_max(max, processTimeLocal);
avg += processTimeLocal;
drwingDone = false;
} else {
min_idle = etk_min(min_idle, processTimeLocal);
max_idle = etk_max(max_idle, processTimeLocal);
avg_idle += processTimeLocal;
}
}
/**
* @brief this might be call when a display is really done
*/
void incrementCounter(void) {
nbDisplayTime++;
drwingDone = true;
}
/**
* @brief draw debug display ...
*/
void draw(void) {
if (true == display) {
if (nbDisplayTime>0) {
EWOL_DEBUG(m_displayName << " : Active : "
<< (float)((float)min / 1000.0) << "ms "
<< (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms "
<< (float)((float)max / 1000.0) << "ms ");
}
if (nbCallTime-nbDisplayTime>0) {
EWOL_DEBUG(m_displayName << " : idle : "
<< (float)((float)min_idle / 1000.0) << "ms "
<< (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms "
<< (float)((float)max_idle / 1000.0) << "ms ");
}
if (true == m_displayFPS) {
EWOL_DEBUG("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps");
}
max = 0;
min = 99999999999999LL;
avg = 0;
max_idle = 0;
min_idle = 99999999999999LL;
avg_idle = 0;
nbCallTime = 0;
nbDisplayTime = 0;
startTime = -1;
display = false;
}
}
};
};
};
#endif

View File

@ -16,7 +16,7 @@
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eContext.h>
#include <ewol/renderer/eInput.h>
#include <ewol/renderer/InputManager.h>
#include <ewol/resources/Texture.h>
#include <ewol/widget/Widget.h>
@ -28,24 +28,24 @@
#define EVENT_DEBUG EWOL_VERBOSE
//#define EVENT_DEBUG EWOL_DEBUG
void ewol::eInput::calculateLimit(void) {
void ewol::context::InputManager::calculateLimit(void) {
m_eventInputLimit.sepatateTime = 300000; // µs
m_eventInputLimit.DpiOffset = m_dpi*100;
m_eventMouseLimit.sepatateTime = 300000; // µs
m_eventMouseLimit.DpiOffset = (float)m_dpi*(float)0.1;
}
void ewol::eInput::setDpi(int32_t newDPI) {
void ewol::context::InputManager::setDpi(int32_t newDPI) {
m_dpi = newDPI;
// recalculate the DPI system ...
calculateLimit();
}
bool ewol::eInput::localEventInput(enum ewol::keyEvent::type _type,
ewol::Widget* _destWidget,
int32_t _IdInput,
enum ewol::keyEvent::status _status,
vec2 _pos) {
bool ewol::context::InputManager::localEventInput(enum ewol::keyEvent::type _type,
ewol::Widget* _destWidget,
int32_t _IdInput,
enum ewol::keyEvent::status _status,
vec2 _pos) {
if (NULL != _destWidget) {
if (_type == ewol::keyEvent::typeMouse || _type == ewol::keyEvent::typeFinger) {
// create the system Event :
@ -59,9 +59,9 @@ bool ewol::eInput::localEventInput(enum ewol::keyEvent::type _type,
return false;
}
void ewol::eInput::abortElement(InputPoperty_ts *_eventTable,
int32_t _idInput,
enum ewol::keyEvent::type _type) {
void ewol::context::InputManager::abortElement(InputPoperty *_eventTable,
int32_t _idInput,
enum ewol::keyEvent::type _type) {
if (NULL == _eventTable) {
return;
}
@ -74,8 +74,8 @@ void ewol::eInput::abortElement(InputPoperty_ts *_eventTable,
}
}
void ewol::eInput::cleanElement(InputPoperty_ts *_eventTable,
int32_t _idInput) {
void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
int32_t _idInput) {
if (NULL == _eventTable) {
return;
}
@ -93,7 +93,7 @@ void ewol::eInput::cleanElement(InputPoperty_ts *_eventTable,
_eventTable[_idInput].posEvent.setValue(0,0);
}
void ewol::eInput::transfertEvent(ewol::Widget* _source, ewol::Widget* _destination) {
void ewol::context::InputManager::transfertEvent(ewol::Widget* _source, ewol::Widget* _destination) {
if( NULL == _source
|| NULL == _destination) {
// prevent errors ...
@ -123,7 +123,7 @@ void ewol::eInput::transfertEvent(ewol::Widget* _source, ewol::Widget* _destinat
}
}
void ewol::eInput::grabPointer(ewol::Widget* _widget) {
void ewol::context::InputManager::grabPointer(ewol::Widget* _widget) {
if(NULL == _widget) {
return;
}
@ -133,12 +133,12 @@ void ewol::eInput::grabPointer(ewol::Widget* _widget) {
_widget->getSize().y()/2.0f) );
}
void ewol::eInput::unGrabPointer(void) {
void ewol::context::InputManager::unGrabPointer(void) {
m_grabWidget = NULL;
m_context.grabPointerEvents(false, vec2(0,0));
}
void ewol::eInput::onObjectRemove(ewol::EObject * removeObject) {
void ewol::context::InputManager::onObjectRemove(ewol::EObject * removeObject) {
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (m_eventInputSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ...
@ -151,7 +151,7 @@ void ewol::eInput::onObjectRemove(ewol::EObject * removeObject) {
}
}
void ewol::eInput::newLayerSet(void) {
void ewol::context::InputManager::newLayerSet(void) {
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
abortElement(m_eventInputSaved, iii, ewol::keyEvent::typeFinger);
@ -161,7 +161,7 @@ void ewol::eInput::newLayerSet(void) {
}
}
ewol::eInput::eInput(ewol::eContext& _context) :
ewol::context::InputManager::InputManager(ewol::eContext& _context) :
m_grabWidget(NULL),
m_context(_context) {
setDpi(200);
@ -174,14 +174,14 @@ ewol::eInput::eInput(ewol::eContext& _context) :
EWOL_INFO("Init (end)");
}
ewol::eInput::~eInput(void) {
ewol::context::InputManager::~InputManager(void) {
EWOL_INFO("Un-Init (start)");
EWOL_INFO("Un-Init (end)");
}
int32_t ewol::eInput::localGetDestinationId(enum ewol::keyEvent::type _type,
ewol::Widget* _destWidget,
int32_t _realInputId) {
int32_t ewol::context::InputManager::localGetDestinationId(enum ewol::keyEvent::type _type,
ewol::Widget* _destWidget,
int32_t _realInputId) {
if (_type == ewol::keyEvent::typeFinger) {
int32_t lastMinimum = 0;
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
@ -199,15 +199,15 @@ int32_t ewol::eInput::localGetDestinationId(enum ewol::keyEvent::type _type,
}
// note if id<0 == > the it was finger event ...
void ewol::eInput::motion(enum ewol::keyEvent::type _type,
int _pointerID,
vec2 _pos) {
void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
int _pointerID,
vec2 _pos) {
EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos);
if (MAX_MANAGE_INPUT <= _pointerID) {
// reject pointer == > out of IDs...
return;
}
InputPoperty_ts *eventTable = NULL;
InputPoperty *eventTable = NULL;
if (_type == ewol::keyEvent::typeMouse) {
eventTable = m_eventMouseSaved;
} else if (_type == ewol::keyEvent::typeFinger) {
@ -328,10 +328,10 @@ void ewol::eInput::motion(enum ewol::keyEvent::type _type,
}
}
void ewol::eInput::state(enum ewol::keyEvent::type _type,
int _pointerID,
bool _isDown,
vec2 _pos)
void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
int _pointerID,
bool _isDown,
vec2 _pos)
{
if (MAX_MANAGE_INPUT <= _pointerID) {
// reject pointer == > out of IDs...
@ -339,8 +339,8 @@ void ewol::eInput::state(enum ewol::keyEvent::type _type,
}
EVENT_DEBUG("event pointerId=" << _pointerID);
// convert position in open-GL coordonates ...
InputPoperty_ts *eventTable = NULL;
inputLimit_ts localLimit;
InputPoperty *eventTable = NULL;
InputLimit localLimit;
if (_type == ewol::keyEvent::typeMouse) {
eventTable = m_eventMouseSaved;
localLimit = m_eventMouseLimit;

View File

@ -0,0 +1,126 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_SYSTEM_INPUT_H__
#define __EWOL_SYSTEM_INPUT_H__
#include <ewol/widget/Widget.h>
#define MAX_MANAGE_INPUT (15)
namespace ewol {
namespace context {
/**
* @brief internal structure
* @not-in-doc
*/
class InputPoperty {
public:
bool isUsed;
int32_t destinationInputId;
int64_t lastTimeEvent;
ewol::Widget* curentWidgetEvent;
vec2 origin;
vec2 size;
vec2 downStart;
vec2 posEvent;
bool isDown;
bool isInside;
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
};
/**
* @brief internal structure
* @not-in-doc
*/
class InputLimit {
int32_t sepatateTime;
int32_t DpiOffset;
};
class Context;
class InputManager {
// special grab pointer mode :
private:
ewol::Widget* m_grabWidget; //!< widget that grab the curent pointer.
private:
int32_t m_dpi;
InputLimit m_eventInputLimit;
InputLimit m_eventMouseLimit;
void calculateLimit(void);
InputPoperty m_eventInputSaved[MAX_MANAGE_INPUT];
InputPoperty m_eventMouseSaved[MAX_MANAGE_INPUT];
void abortElement(InputPoperty* _eventTable, int32_t _idInput, enum ewol::key::type _type);
void cleanElement(InputPoperty* _eventTable, int32_t _idInput);
/**
* @brief generate the event on the destinated widget.
* @param[in] _type Type of the event that might be sended.
* @param[in] _destWidget Pointer on the requested widget that element might be sended
* @param[in] _IdInput Id of the event (PC : [0..9] and touch : [1..9])
* @param[in] _typeEvent type of the eventg generated
* @param[in] _pos position of the event
* @return true if event has been greped
*/
bool localEventInput(enum ewol::keyEvent::type _type,
ewol::Widget* _destWidget,
int32_t _IdInput,
enum ewol::keyEvent::status _typeEvent,
vec2 _pos);
/**
* @brief convert the system event id in the correct EWOL id depending of the system management mode
* This function find the next input id unused on the specifiic widget
* == > on PC, the ID does not change (GUI is not the same)
* @param[in] _type Type of the kay event.
* @param[in] _destWidget Pointer of the widget destination
* @param[in] _realInputId system Id
* @return the ewol input id
*/
int32_t localGetDestinationId(enum ewol::keyEvent::type _type,
ewol::Widget* _destWidget,
int32_t _realInputId);
private:
ewol::eContext& m_context;
public:
InputManager(ewol::eContext& _context);
~InputManager(void);
void setDpi(int32_t newDPI);
// note if id<0 == > the it was finger event ...
void motion(enum ewol::keyEvent::type _type, int _pointerID, vec2 _pos );
void state(enum ewol::keyEvent::type _type, int _pointerID, bool _isDown, vec2 _pos);
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject
* @note : Sub classes must call this class
*/
void onObjectRemove(ewol::EObject* _removeObject);
/**
* @brief a new layer on the windows is set == > might remove all the property of the current element ...
*/
void newLayerSet(void);
/**
* @brief This is to transfert the event from one widget to another one
* @param _source the widget where the event came from
* @param _destination the widget where the event mitgh be generated now
*/
void transfertEvent(ewol::Widget* _source, ewol::Widget* _destination);
/**
* @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] _widget The widget that lock the pointer events
*/
void grabPointer(ewol::Widget* _widget);
/**
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/
void unGrabPointer(void);
};
};
};
#endif

View File

@ -23,9 +23,9 @@ note: la copy dans le :
10 : bouton du milieux
*/
//!< Local copy of the clipboards
static std::string mesCopy[ewol::clipBoard::clipboardCount];
static std::string mesCopy[ewol::clipBoard::context::clipboardCount];
static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1] = {
static const char* clipboardDescriptionString[ewol::clipBoard::context::clipboardCount+1] = {
"clipboard0",
"clipboard1",
"clipboard2",
@ -41,8 +41,8 @@ static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1]
"clipboardCount"
};
etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const enum ewol::clipBoard::clipboardListe _obj) {
if (_obj >= 0 && _obj <ewol::clipBoard::clipboardCount) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const enum ewol::context::clipBoard::clipboardListe _obj) {
if (_obj >= 0 && _obj <ewol::context::clipBoard::clipboardCount) {
_os << clipboardDescriptionString[_obj];
} else {
_os << "[ERROR]";
@ -51,52 +51,52 @@ etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const enum ewol::clipB
}
void ewol::clipBoard::init(void) {
void ewol::context::clipBoard::init(void) {
EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) {
for(int32_t i=0; i<ewol::context::clipBoard::clipboardCount; i++) {
mesCopy[i].clear();
}
}
void ewol::clipBoard::unInit(void) {
void ewol::context::clipBoard::unInit(void) {
EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) {
for(int32_t i=0; i<ewol::context::clipBoard::clipboardCount; i++) {
mesCopy[i].clear();
}
}
void ewol::clipBoard::set(enum ewol::clipBoard::clipboardListe _clipboardID, const std::string& _data) {
void ewol::context::clipBoard::set(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data) {
// check if ID is correct
if(0 == _data.size()) {
EWOL_INFO("request a copy of nothing");
return;
} else
if(_clipboardID >= ewol::clipBoard::clipboardCount) {
if(_clipboardID >= ewol::context::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error");
return;
}
ewol::clipBoard::setSystem(_clipboardID, _data);
ewol::context::clipBoard::setSystem(_clipboardID, _data);
if( ewol::clipBoard::clipboardStd == _clipboardID
|| ewol::clipBoard::clipboardSelection == _clipboardID) {
if( ewol::context::clipBoard::clipboardStd == _clipboardID
|| ewol::context::clipBoard::clipboardSelection == _clipboardID) {
ewol::getContext().clipBoardSet(_clipboardID);
EWOL_TODO("Set ClipBoard");
}
}
void ewol::clipBoard::request(enum ewol::clipBoard::clipboardListe _clipboardID) {
if(_clipboardID >= ewol::clipBoard::clipboardCount) {
void ewol::context::clipBoard::request(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
if(_clipboardID >= ewol::context::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error");
return;
}
if( ewol::clipBoard::clipboardStd == _clipboardID
|| ewol::clipBoard::clipboardSelection == _clipboardID) {
if( ewol::context::clipBoard::clipboardStd == _clipboardID
|| ewol::context::clipBoard::clipboardSelection == _clipboardID) {
ewol::getContext().clipBoardGet(_clipboardID);
EWOL_TODO("Get ClipBoard");
} else {
@ -107,8 +107,8 @@ void ewol::clipBoard::request(enum ewol::clipBoard::clipboardListe _clipboardID)
}
void ewol::clipBoard::setSystem(enum ewol::clipBoard::clipboardListe _clipboardID, const std::string& _data) {
if(_clipboardID >= ewol::clipBoard::clipboardCount) {
void ewol::context::clipBoard::setSystem(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data) {
if(_clipboardID >= ewol::context::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error");
return;
}
@ -117,9 +117,9 @@ void ewol::clipBoard::setSystem(enum ewol::clipBoard::clipboardListe _clipboardI
}
const std::string& ewol::clipBoard::get(enum ewol::clipBoard::clipboardListe _clipboardID) {
const std::string& ewol::context::clipBoard::get(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
static const std::string emptyString("");
if(_clipboardID >= ewol::clipBoard::clipboardCount) {
if(_clipboardID >= ewol::context::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error");
return emptyString;
}

View File

@ -0,0 +1,85 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_CLIPBOARD_H__
#define __EWOL_CLIPBOARD_H__
#include <ewol/debug.h>
#include <etk/UString.h>
// TODO : Remove this ... ==> set it in the context ....
namespace ewol {
namespace context {
namespace clipBoard {
enum clipboardListe {
clipboard0, //!< internal clipboard 0
clipboard1, //!< internal clipboard 1
clipboard2, //!< internal clipboard 2
clipboard3, //!< internal clipboard 3
clipboard4, //!< internal clipboard 4
clipboard5, //!< internal clipboard 5
clipboard6, //!< internal clipboard 6
clipboard7, //!< internal clipboard 7
clipboard8, //!< internal clipboard 8
clipboard9, //!< internal clipboard 9
clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer
clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button
clipboardCount, //!< Total number of clipboard
};
/**
* @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change
* @param[in] _clipboardID Select the specific ID of the clipboard
* @param[in] _data The string that might be send to the clipboard
*/
void set(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data);
/**
* @brief Call system to request the current clipboard.
* @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread,
* we need the call the system to send us the buffer, this is really ambigous, but the widget (who has focus) receive the
* notification of the arrival of this buffer id
* @param[in] _clipboardID the needed clipboard ID
*/
void request(enum ewol::context::clipBoard::clipboardListe _clipboardID);
/**
* @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the
* Gui abstraction to set the buffer we receive. The end user must not use it.
* @param[in] _clipboardID selected clipboard ID
* @param[in] _data new buffer data
*/
void setSystem(enum ewol::context::clipBoard::clipboardListe _clipboardID,const std::string& _data);
/**
* @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in
* the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it.
* @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard
* @param[in] _clipboardID selected clipboard ID
* @return the requested buffer
*/
const std::string& get(enum ewol::context::clipBoard::clipboardListe _clipboardID);
// internal section
/**
* @brief initialize the clipboard system (done by ewol)
*/
void init(void);
/**
* @brief Un-Initialize the clipboard system (done by ewol)
*/
void unInit(void);
};
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::context::clipBoard::clipboardListe _obj);
};
#endif

View File

@ -10,18 +10,18 @@
#include <ewol/commandLine.h>
#include <vector>
void ewol::CommandLine::parse(int32_t _argc, const char* _argv[]) {
void ewol::context::CommandLine::parse(int32_t _argc, const char* _argv[]) {
for (int32_t i=1 ; i<_argc; i++) {
EWOL_INFO("commandLine : \"" << _argv[i] << "\"" );
m_listArgs.push_back(_argv[i]);
}
}
int32_t ewol::CommandLine::size(void) {
int32_t ewol::context::CommandLine::size(void) {
return m_listArgs.size();
}
const std::string& ewol::CommandLine::get(int32_t _id) {
const std::string& ewol::context::CommandLine::get(int32_t _id) {
static const std::string errorArg("");
if ( _id < 0
&& _id >= (int64_t)m_listArgs.size()) {
@ -30,11 +30,11 @@ const std::string& ewol::CommandLine::get(int32_t _id) {
return m_listArgs[_id];
}
void ewol::CommandLine::add(const std::string& _newElement) {
void ewol::context::CommandLine::add(const std::string& _newElement) {
m_listArgs.push_back(_newElement);
}
void ewol::CommandLine::remove(int32_t _id) {
void ewol::context::CommandLine::remove(int32_t _id) {
m_listArgs.erase(m_listArgs.begin()+_id);
}

View File

@ -0,0 +1,49 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_COMMAND_LINE_H__
#define __EWOL_COMMAND_LINE_H__
#include <etk/types.h>
#include <etk/UString.h>
namespace ewol {
namespace context {
class CommandLine {
private:
std::vector<std::string> m_listArgs; //!< list of all argument parsed
public:
/**
* @brief Parse the command line parameters
*/
void parse(int32_t _argc, const char* _argv[]);
/**
* @brief get the number of element in the Command line
* @return the number of element
*/
int32_t size(void);
/**
* @brief get an element with a specific ID
* @return _id The cmdLine Id element
*/
const std::string& get(int32_t _id);
/**
* @brief add one element at the Command line
* @param[in] _newElement String in the input that might be added.
*/
void add(const std::string& _newElement);
/**
* @brief remove an element
* @param[in] _id Id of the element
*/
void remove(int32_t _id);
};
};
};
#endif

View File

@ -8,7 +8,7 @@
#include <ewol/cursor.h>
static const char* cursorDescriptionString[ewol::cursorCount+1] = {
static const char* cursorDescriptionString[ewol::context::cursorCount+1] = {
"cursorArrow",
"cursorLeftArrow",
"cursorInfo",
@ -33,8 +33,8 @@ static const char* cursorDescriptionString[ewol::cursorCount+1] = {
"cursorCount"
};
etk::CCout& ewol::operator <<(etk::CCout& _os, const enum ewol::cursorDisplay _obj) {
if (_obj >= 0 && _obj <ewol::cursorCount) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const enum ewol::context::cursorDisplay _obj) {
if (_obj >= 0 && _obj <ewol::context::cursorCount) {
_os << cursorDescriptionString[_obj];
} else {
_os << "[ERROR]";

View File

@ -0,0 +1,50 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_CURSOR_H__
#define __EWOL_CURSOR_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace context {
enum cursorDisplay {
cursorArrow, // this is the normal arrow ...
cursorLeftArrow,
cursorInfo,
cursorDestroy,
cursorHelp,
cursorCycle,
cursorSpray,
cursorWait,
cursorText,
cursorCrossHair,
cursorSlideUpDown, //!< change the position (slide) vertical
cursorSlideLeftRight, //!< change the position (slide) horizontal
cursorResizeUp,
cursorResizeDown,
cursorResizeLeft,
cursorResizeRight,
cursorCornerTopLeft,
cursorCornerTopRight,
cursorCornerButtomLeft,
cursorCornerButtomRight,
cursorNone,
// just for the count:
cursorCount
};
};
/**
* @brief Debug operator To display the curent element in a Human readable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::context::cursorDisplay _obj);
};
#endif

View File

@ -1,49 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_CURSOR_H__
#define __EWOL_CURSOR_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol
{
enum cursorDisplay {
cursorArrow, // this is the normal arrow ...
cursorLeftArrow,
cursorInfo,
cursorDestroy,
cursorHelp,
cursorCycle,
cursorSpray,
cursorWait,
cursorText,
cursorCrossHair,
cursorSlideUpDown, //!< change the position (slide) vertical
cursorSlideLeftRight, //!< change the position (slide) horizontal
cursorResizeUp,
cursorResizeDown,
cursorResizeLeft,
cursorResizeRight,
cursorCornerTopLeft,
cursorCornerTopRight,
cursorCornerButtomLeft,
cursorCornerButtomRight,
cursorNone,
// just for the count:
cursorCount
};
/**
* @brief Debug operator To display the curent element in a Human readable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::cursorDisplay _obj);
};
#endif

View File

@ -11,17 +11,17 @@
#undef __class__
#define __class__ "EventEntry"
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventEntry& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::Entry& _obj) {
_os << "{type=" << _obj.getType();
_os << " status=" << _obj.getStatus();
if (_obj.getType() == ewol::keyEvent::keyboardChar) {
if (_obj.getType() == ewol::key::keyboardChar) {
_os << " char=" << _obj.getChar();
}
_os << "}";
return _os;
}
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntrySystem& _obj) {
etk::CCout& operator <<(etk::CCout& _os, const ewol::event::EntrySystem& _obj) {
_os << _obj.m_event;
return _os;
}

View File

@ -0,0 +1,77 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_EVENT_ENTRY_H__
#define __EWOL_EVENT_ENTRY_H__
#include <etk/types.h>
#include <ewol/key/key.h>
namespace ewol {
namespace event {
class Entry {
private:
enum ewol::key::keyboard m_type; //!< type of hardware event
enum ewol::key::status m_status; //!< status of hardware event
ewol::key::Special m_specialKey; //!< input key status (prevent change in time..)
char32_t m_unicodeData; //!< Unicode data (in some case)
public:
Entry(enum ewol::key::keyboard _type,
enum ewol::key::status _status,
ewol::key::Special _specialKey,
char32_t _char) :
m_type(_type),
m_status(_status),
m_specialKey(_specialKey),
m_unicodeData(_char) {
};
void setType(enum ewol::key::keyboard _type) {
m_type = _type;
};
inline const enum ewol::key::keyboard& getType(void) const {
return m_type;
};
void setStatus(enum ewol::key::status _status) {
m_status = _status;
};
inline const enum ewol::key::status& getStatus(void) const {
return m_status;
};
void setSpecialKey(const ewol::key::Special& _specialKey) {
m_specialKey = _specialKey;
};
inline const ewol::key::Special& getSpecialKey(void) const {
return m_specialKey;
};
void setChar(char32_t _char) {
m_unicodeData = _char;
};
inline const char32_t& getChar(void) const {
return m_unicodeData;
};
};
class EntrySystem {
public:
EntrySystem(enum ewol::key::keyboard _type,
enum ewol::key::status _status,
ewol::key::Special _specialKey,
char32_t _char) :
m_event(_type, _status, _specialKey, _char) {
};
ewol::event::Entry m_event;
};
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::event::Entry& _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::event::EntrySystem& _obj);
};
#endif

View File

@ -11,7 +11,7 @@
#undef __class__
#define __class__ "EventInput"
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::Input& _obj) {
_os << "{type=" << _obj.getType();
_os << " status=" << _obj.getStatus();
_os << " id=" << _obj.getId();
@ -20,7 +20,7 @@ etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj) {
return _os;
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInputSystem& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::InputSystem& _obj) {
_os << _obj.m_event;
return _os;
}

View File

@ -0,0 +1,94 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_EVENT_INPUT_H__
#define __EWOL_EVENT_INPUT_H__
#include <etk/types.h>
namespace ewol {
namespace event {
class Input {
private:
enum ewol::key::type m_type;
enum ewol::key::status m_status;
uint8_t m_inputId;
vec2 m_pos;
public:
Input(enum ewol::key::type _type,
enum ewol::key::status _status,
uint8_t _id,
const vec2& _pos):
m_type(_type),
m_status(_status),
m_inputId(_id),
m_pos(_pos){
};
void setType(enum ewol::key::type _type) {
m_type = _type;
};
inline const enum ewol::key::type& getType(void) const {
return m_type;
};
void setStatus(enum ewol::key::status _status) {
m_status = _status;
};
inline const enum ewol::key::status& getStatus(void) const {
return m_status;
};
void setId(uint8_t _id) {
m_inputId = _id;
};
inline const uint8_t& getId(void) const {
return m_inputId;
};
void setPos(const vec2& _pos) {
m_pos = _pos;
};
inline const vec2& getPos(void) const {
return m_pos;
};
};
class InputSystem {
public:
InputSystem(enum ewol::key::type _type,
enum ewol::key::status _status,
uint8_t _id,
const vec2& _pos,
ewol::Widget* _dest,
int32_t _realIdEvent) :
m_event(_type, _status, _id, _pos),
m_dest(_dest),
m_realIdEvent(_realIdEvent) { };
ewol::event::Input m_event;
private:
ewol::Widget* m_dest;
int32_t m_realIdEvent;
public:
void setDestWidget(ewol::Widget* _dest) {
m_dest = _dest;
};
inline ewol::Widget* getDestWidget(void) const {
return m_dest;
};
void setRealId(int32_t _realIdEvent) {
m_realIdEvent = _realIdEvent;
};
inline int32_t getRealId(void) const {
return m_realIdEvent;
};
};
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::event::Input& _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::event::InputSystem& _obj);
};
#endif

View File

@ -9,9 +9,9 @@
#include <ewol/widget/Widget.h>
#undef __class__
#define __class__ "EventTime"
#define __class__ "event::Time"
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventTime& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::Time& _obj) {
_os << "{time=" << _obj.getTime();
_os << " uptime=" << _obj.getApplUpTime();
_os << " delta=" << _obj.getDelta();

67
sources/ewol/event/Time.h Normal file
View File

@ -0,0 +1,67 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_EVENT_CALL_TIME_H__
#define __EWOL_EVENT_CALL_TIME_H__
#include <etk/types.h>
namespace ewol {
namespace event {
class Time {
private:
int64_t m_timeSystem; //!< Current system time (micro-second)
int64_t m_timeUpAppl; //!< Current application wake up-time (micro-second)
float m_timeDelta; //!< Time from the last cycle call of the system (main appl tick) (second)
float m_timeDeltaCall; //!< Time from the last call (when we can manage periodic call with specifying periode) (second)
public:
Time(int64_t _timeSystem,
int64_t _timeUpAppl,
float _timeDelta,
float _timeDeltaCall) :
m_timeSystem(_timeSystem),
m_timeUpAppl(_timeUpAppl),
m_timeDelta(_timeDelta),
m_timeDeltaCall(_timeDeltaCall){
};
public:
void setTime(int64_t _timeSystem) {
m_timeSystem=_timeSystem;
};
inline int64_t getTime(void) const {
return m_timeSystem;
};
void setApplWakeUpTime(int64_t _timeUpAppl) {
m_timeUpAppl=_timeUpAppl;
};
inline int64_t getApplWakeUpTime(void) const {
return m_timeUpAppl;
};
inline int64_t getApplUpTime(void) const {
return m_timeSystem-m_timeUpAppl;
};
void setDelta(float _timeDelta) {
m_timeDelta=_timeDelta;
};
inline float getDelta(void) const {
return m_timeDelta;
};
void setDeltaCall(float _timeDeltaCall) {
m_timeDeltaCall=_timeDeltaCall;
};
inline float getDeltaCall(void) const {
return m_timeDeltaCall;
};
};
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::event::Time& _obj);
};
#endif

View File

@ -1,151 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/key.h>
static const char* statusDescriptionString[ewol::keyEvent::statusCount+1] = {
"statusUnknow",
"statusDown",
"statusMove",
"statusSingle",
"statusDouble",
"statusTriple",
"statusQuad",
"statusQuinte",
"statusUp",
"statusEnter",
"statusLeave",
"statusAbort",
"statusTransfert",
"statusCount"
};
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const enum ewol::keyEvent::status _obj) {
if (_obj >= 0 && _obj <ewol::keyEvent::statusCount) {
_os << statusDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}
static const char* keyboardDescriptionString[ewol::keyEvent::keyboardCount+1] = {
"keyboardUnknow",
"keyboardChar",
"keyboardLeft",
"keyboardRight",
"keyboardUp",
"keyboardDown",
"keyboardPageUp",
"keyboardPageDown",
"keyboardStart",
"keyboardEnd",
"keyboardPrint",
"keyboardStopDefil",
"keyboardWait",
"keyboardInsert",
"keyboardF1",
"keyboardF2",
"keyboardF3",
"keyboardF4",
"keyboardF5",
"keyboardF6",
"keyboardF7",
"keyboardF8",
"keyboardF9",
"keyboardF10",
"keyboardF11",
"keyboardF12",
"keyboardCapLock",
"keyboardShiftLeft",
"keyboardShiftRight",
"keyboardCtrlLeft",
"keyboardCtrlRight",
"keyboardMetaLeft",
"keyboardMetaRight",
"keyboardAlt",
"keyboardAltGr",
"keyboardContextMenu",
"keyboardNumLock",
"keyboardCount"
};
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const enum ewol::keyEvent::keyboard _obj) {
if (_obj >= 0 && _obj <ewol::keyEvent::keyboardCount) {
_os << keyboardDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}
static const char* typeDescriptionString[ewol::keyEvent::typeCount+1] = {
"typeUnknow",
"typeMouse",
"typeFinger",
"typeStylet",
"typeCount"
};
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const enum ewol::keyEvent::type _obj) {
if (_obj >= 0 && _obj < ewol::keyEvent::typeCount) {
_os << typeDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}
ewol::SpecialKey::SpecialKey(void) :
value(0) {
}
bool ewol::SpecialKey::isSetCapsLock(void) const {
return capLock;
}
bool ewol::SpecialKey::isSetShift(void) const {
return shift;
}
bool ewol::SpecialKey::isSetCtrl(void) const {
return ctrl;
}
bool ewol::SpecialKey::isSetMeta(void) const {
return meta;
}
bool ewol::SpecialKey::isSetAlt(void) const {
return alt;
}
bool ewol::SpecialKey::isSetAltGr(void) const {
return altGr;
}
bool ewol::SpecialKey::isSetNumLock(void) const {
return numLock;
}
bool ewol::SpecialKey::isSetInsert(void) const {
return insert;
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::SpecialKey _obj) {
_os << " capLock=" << _obj.capLock;
_os << " shift=" << _obj.shift;
_os << " ctrl=" << _obj.ctrl;
_os << " meta=" << _obj.meta;
_os << " alt=" << _obj.alt;
_os << " altGr=" << _obj.altGr;
_os << " verNum=" << _obj.numLock;
_os << " insert=" << _obj.insert;
return _os;
}

View File

@ -1,175 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_KEY_H__
#define __EWOL_KEY_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace keyEvent {
/**
* @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different
*/
enum type {
typeUnknow = 0, //!< Unknow input Type
typeMouse, //!< Mouse type
typeFinger, //!< Finger type
typeStylet, //!< Stylet type
typeCount //!< number of types
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::keyEvent::type _obj);
/**
* @brief Keybord event or joyestick event
*/
enum status {
statusUnknow = 0,
statusDown, // availlable on Keyboard too
statusMove,
statusSingle,
statusDouble,
statusTriple,
statusQuad,
statusQuinte,
statusUp, // availlable on Keyboard too
statusEnter,
statusLeave,
statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
statusCount, // number max of imput possible
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::keyEvent::status _obj);
/**
* @brief Keybord event or joyestick event
*/
enum keyboard {
keyboardUnknow = 0, //!< Unknown keyboard key
keyboardChar, //!< Char input is arrived ...
keyboardLeft, //!< Left key <--
keyboardRight, //!< Right key -->
keyboardUp, //!< Up key ^
keyboardDown, //!< Down key \/
keyboardPageUp, //!< Page Up key
keyboardPageDown, //!< page down key
keyboardStart, //!< Start key
keyboardEnd, //!< End key
keyboardPrint, //!< print screen key.
keyboardStopDefil, //!< Stop display key.
keyboardWait, //!< Wait key.
keyboardInsert, //!< insert key.
keyboardF1, //!< F1 key.
keyboardF2, //!< F2 key.
keyboardF3, //!< F3 key.
keyboardF4, //!< F4 key.
keyboardF5, //!< F5 key.
keyboardF6, //!< F6 key.
keyboardF7, //!< F7 key.
keyboardF8, //!< F8 key.
keyboardF9, //!< F9 key.
keyboardF10, //!< F10 key.
keyboardF11, //!< F11 key.
keyboardF12, //!< F12 key.
keyboardCapLock, //!< Capital Letter Lock key.
keyboardShiftLeft, //!< Shift left key.
keyboardShiftRight, //!< Shift right key.
keyboardCtrlLeft, //!< Control left key.
keyboardCtrlRight, //!< Control right key.
keyboardMetaLeft, //!< Meta left key (apple key or windows key).
keyboardMetaRight, //!< Meta right key (apple key or windows key).
keyboardAlt, //!< Alt key.
keyboardAltGr, //!< Alt ground key.
keyboardContextMenu, //!< Contextual menu key.
keyboardNumLock, //!< Numerical Lock key.
keyboardCount //!< number of posible key
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::keyEvent::keyboard _obj);
};
class SpecialKey {
public:
union {
uint32_t value;
struct {
unsigned capLock : 1;
unsigned shift : 1;
unsigned ctrl : 1;
unsigned meta : 1;
unsigned alt : 1;
unsigned altGr : 1;
unsigned numLock : 1;
unsigned insert : 1;
};
};
public:
/**
* @brief Main constructor
*/
SpecialKey(void);
/**
* @brief get the current CapLock Status
* @return The status value
*/
bool isSetCapsLock(void) const;
/**
* @brief get the current Shift key status
* @return The status value
*/
bool isSetShift(void) const;
/**
* @brief get the Current Control key status
* @return The status value
*/
bool isSetCtrl(void) const;
/**
* @brief get the current Meta key status (also named windows or apple key)
* @return The status value
*/
bool isSetMeta(void) const;
/**
* @brief get the current Alt key status
* @return The status value
*/
bool isSetAlt(void) const;
/**
* @brief get the current Alt-Gr key status
* @return The status value
*/
bool isSetAltGr(void) const;
/**
* @brief get the current Ver-num key status
* @return The status value
*/
bool isSetNumLock(void) const;
/**
* @brief get the current Intert key status
* @return The status value
*/
bool isSetInsert(void) const;
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const ewol::SpecialKey _obj);
};
#endif

View File

@ -0,0 +1,180 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/key/Special.h>
#define EWOL_FLAG_KEY_CAPS_LOCK 0x00000001
#define EWOL_FLAG_KEY_SHIFT 0x00000002
#define EWOL_FLAG_KEY_CTRL 0x00000004
#define EWOL_FLAG_KEY_META 0x00000008
#define EWOL_FLAG_KEY_ALT 0x00000010
#define EWOL_FLAG_KEY_ALTGR 0x00000020
#define EWOL_FLAG_KEY_NUM_LOCK 0x00000040
#define EWOL_FLAG_KEY_INSERT 0x00000080
ewol::key::Special::SpecialKey(void) :
m_value(0) {
}
bool ewol::key::Special::getCapsLock(void) const {
if ((m_value & EWOL_FLAG_KEY_CAPS_LOCK) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setCapsLock(bool _value) {
if ((m_value & EWOL_FLAG_KEY_CAPS_LOCK) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_CAPS_LOCK;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_CAPS_LOCK;
}
}
}
bool ewol::key::Special::getShift(void) const {
if ((m_value & EWOL_FLAG_KEY_SHIFT) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setShift(bool _value) {
if ((m_value & EWOL_FLAG_KEY_SHIFT) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_SHIFT;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_SHIFT;
}
}
}
bool ewol::key::Special::getCtrl(void) const {
if ((m_value & EWOL_FLAG_KEY_CTRL) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setCtrl(bool _value) {
if ((m_value & EWOL_FLAG_KEY_CTRL) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_CTRL;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_CTRL;
}
}
}
bool ewol::key::Special::getMeta(void) const {
if ((m_value & EWOL_FLAG_KEY_META) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setMeta(bool _value) {
if ((m_value & EWOL_FLAG_KEY_META) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_META;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_META;
}
}
}
bool ewol::key::Special::getAlt(void) const {
if ((m_value & EWOL_FLAG_KEY_ALT) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setAlt(bool _value) {
if ((m_value & EWOL_FLAG_KEY_ALT) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_ALT;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_ALT;
}
}
}
bool ewol::key::Special::getAltGr(void) const {
if ((m_value & EWOL_FLAG_KEY_ALTGR) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setAltGr(bool _value) {
if ((m_value & EWOL_FLAG_KEY_ALTGR) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_ALTGR;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_ALTGR;
}
}
}
bool ewol::key::Special::getNumLock(void) const {
if ((m_value & EWOL_FLAG_KEY_NUM_LOCK) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setNumLock(bool _value) {
if ((m_value & EWOL_FLAG_KEY_NUM_LOCK) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_NUM_LOCK;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_NUM_LOCK;
}
}
}
bool ewol::key::Special::getInsert(void) const {
if ((m_value & EWOL_FLAG_KEY_INSERT) != 0) {
return true;
}
return false;
}
void ewol::key::Special::setInsert(bool _value) {
if ((m_value & EWOL_FLAG_KEY_INSERT) != 0) {
if (_value == false) {
m_value -= EWOL_FLAG_KEY_INSERT;
}
} else {
if (_value == true) {
m_value += EWOL_FLAG_KEY_INSERT;
}
}
}
etk::CCout& ewol::key::operator <<(etk::CCout& _os, const ewol::key::Special _obj) {
_os << " capLock=" << _obj.getCapsLock();
_os << " shift=" << _obj.getShift();
_os << " ctrl=" << _obj.getCtrl();
_os << " meta=" << _obj.getMeta();
_os << " alt=" << _obj.getAlt();
_os << " altGr=" << _obj.getAltGr();
_os << " verNum=" << _obj.getNumLock();
_os << " insert=" << _obj.getInsert();
return _os;
}

115
sources/ewol/key/Special.h Normal file
View File

@ -0,0 +1,115 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_KEY_SPECIAL_H__
#define __EWOL_KEY_SPECIAL_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace key {
/**
* @brief This class consider generic special keyborad key (insert, control, shift ...)
*/
class Special {
private:
uint32_t m_value;
public:
/**
* @brief Main constructor
*/
Special(void);
/**
* @brief get the current CapLock Status
* @return The CapLock value
*/
bool getCapsLock(void) const;
/**
* @brief set the current CapLock Status
* @param[in] _value The new CapLock value
*/
void setCapsLock(bool _value);
/**
* @brief Get the current Shift key status
* @return The Shift value
*/
bool getShift(void) const;
/**
* @brief Set the current Shift key status
* @param[in] _value The new Shift value
*/
void setShift(bool _value);
/**
* @brief Get the Current Control key status
* @return The Control value
*/
bool getCtrl(void) const;
/**
* @brief Set the Current Control key status
* @param[in] _value The new Control value
*/
void setCtrl(bool _value);
/**
* @brief Get the current Meta key status (also named windows or apple key)
* @return The Meta value (name Windows key, apple key, command key ...)
*/
bool getMeta(void) const;
/**
* @brief Set the current Meta key status (also named windows or apple key)
* @param[in] _value The new Meta value (name Windows key, apple key, command key ...)
*/
void setMeta(bool _value);
/**
* @brief Get the current Alt key status
* @return The Alt value
*/
bool getAlt(void) const;
/**
* @brief Set the current Alt key status
* @param[in] _value The new Alt value
*/
void setAlt(bool _value);
/**
* @brief Get the current Alt-Gr key status
* @return The Alt-gr value (does not exist on MacOs)
*/
bool getAltGr(void) const;
/**
* @brief Set the current Alt-Gr key status
* @param[in] _value The new Alt-gr value (does not exist on MacOs)
*/
void setAltGr(bool _value);
/**
* @brief Get the current Ver-num key status
* @return The Numerical Lock value
*/
bool getNumLock(void) const;
/**
* @brief Set the current Ver-num key status
* @param[in] _value The new Numerical Lock value
*/
void setNumLock(bool _value);
/**
* @brief Get the current Intert key status
* @return The Insert value
*/
bool getInsert(void) const;
/**
* @brief Set the current Intert key status
* @param[in] _value The new Insert value
*/
void setInsert(bool _value);
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::key::Special _obj);
};
};
#endif

19
sources/ewol/key/key.h Normal file
View File

@ -0,0 +1,19 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_KEY_H__
#define __EWOL_KEY_H__
#include <ewol/key/keyboard.h>
#include <ewol/key/Special.h>
#include <ewol/key/status.h>
#include <ewol/key/type.h>
#endif

View File

@ -0,0 +1,60 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/key/keyboard.h>
static const char* keyboardDescriptionString[ewol::key::keyboardCount+1] = {
"keyboardUnknow",
"keyboardChar",
"keyboardLeft",
"keyboardRight",
"keyboardUp",
"keyboardDown",
"keyboardPageUp",
"keyboardPageDown",
"keyboardStart",
"keyboardEnd",
"keyboardPrint",
"keyboardStopDefil",
"keyboardWait",
"keyboardInsert",
"keyboardF1",
"keyboardF2",
"keyboardF3",
"keyboardF4",
"keyboardF5",
"keyboardF6",
"keyboardF7",
"keyboardF8",
"keyboardF9",
"keyboardF10",
"keyboardF11",
"keyboardF12",
"keyboardCapLock",
"keyboardShiftLeft",
"keyboardShiftRight",
"keyboardCtrlLeft",
"keyboardCtrlRight",
"keyboardMetaLeft",
"keyboardMetaRight",
"keyboardAlt",
"keyboardAltGr",
"keyboardContextMenu",
"keyboardNumLock",
"keyboardCount"
};
etk::CCout& ewol::key::operator <<(etk::CCout& _os, const enum ewol::key::keyboard _obj) {
if (_obj >= 0 && _obj <ewol::key::keyboardCount) {
_os << keyboardDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}

View File

@ -0,0 +1,71 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_KEY_KEYBOARD_H__
#define __EWOL_KEY_KEYBOARD_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace key {
/**
* @brief Keybord event or joystick event
*/
enum keyboard {
keyboardUnknow = 0, //!< Unknown keyboard key
keyboardChar, //!< Char input is arrived ...
keyboardLeft, //!< Left key <--
keyboardRight, //!< Right key -->
keyboardUp, //!< Up key ^
keyboardDown, //!< Down key \/
keyboardPageUp, //!< Page Up key
keyboardPageDown, //!< page down key
keyboardStart, //!< Start key
keyboardEnd, //!< End key
keyboardPrint, //!< print screen key.
keyboardStopDefil, //!< Stop display key.
keyboardWait, //!< Wait key.
keyboardInsert, //!< insert key.
keyboardF1, //!< F1 key.
keyboardF2, //!< F2 key.
keyboardF3, //!< F3 key.
keyboardF4, //!< F4 key.
keyboardF5, //!< F5 key.
keyboardF6, //!< F6 key.
keyboardF7, //!< F7 key.
keyboardF8, //!< F8 key.
keyboardF9, //!< F9 key.
keyboardF10, //!< F10 key.
keyboardF11, //!< F11 key.
keyboardF12, //!< F12 key.
keyboardCapLock, //!< Capital Letter Lock key.
keyboardShiftLeft, //!< Shift left key.
keyboardShiftRight, //!< Shift right key.
keyboardCtrlLeft, //!< Control left key.
keyboardCtrlRight, //!< Control right key.
keyboardMetaLeft, //!< Meta left key (apple key or windows key).
keyboardMetaRight, //!< Meta right key (apple key or windows key).
keyboardAlt, //!< Alt key.
keyboardAltGr, //!< Alt ground key.
keyboardContextMenu, //!< Contextual menu key.
keyboardNumLock, //!< Numerical Lock key.
keyboardCount //!< number of posible key
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::keyboard _obj);
};
};
#endif

View File

@ -0,0 +1,37 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/key/status.h>
static const char* statusDescriptionString[ewol::key::statusCount+1] = {
"statusUnknow",
"statusDown",
"statusMove",
"statusSingle",
"statusDouble",
"statusTriple",
"statusQuad",
"statusQuinte",
"statusUp",
"statusEnter",
"statusLeave",
"statusAbort",
"statusTransfert",
"statusCount"
};
etk::CCout& ewol::key::operator <<(etk::CCout& _os, const enum ewol::key::status _obj) {
if (_obj >= 0 && _obj <ewol::key::statusCount) {
_os << statusDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}

47
sources/ewol/key/status.h Normal file
View File

@ -0,0 +1,47 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_KEY_STATUS_H__
#define __EWOL_KEY_STATUS_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace key {
/**
* @brief Keybord event or joyestick event
*/
enum status {
statusUnknow = 0,
statusDown, // availlable on Keyboard too
statusMove,
statusSingle,
statusDouble,
statusTriple,
statusQuad,
statusQuinte,
statusUp, // availlable on Keyboard too
statusEnter,
statusLeave,
statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
statusCount, // number max of imput possible
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::status _obj);
};
};
#endif

28
sources/ewol/key/type.cpp Normal file
View File

@ -0,0 +1,28 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/key/type.h>
static const char* typeDescriptionString[ewol::key::typeCount+1] = {
"typeUnknow",
"typeMouse",
"typeFinger",
"typeStylet",
"typeCount"
};
etk::CCout& ewol::operator <<(etk::CCout& _os, const enum ewol::key::type _obj) {
if (_obj >= 0 && _obj < ewol::key::typeCount) {
_os << typeDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}

38
sources/ewol/key/type.h Normal file
View File

@ -0,0 +1,38 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_KEY_TYPE_H__
#define __EWOL_KEY_TYPE_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace key {
/**
* @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different
*/
enum type {
typeUnknow = 0, //!< Unknow input Type
typeMouse, //!< Mouse type
typeFinger, //!< Finger type
typeStylet, //!< Stylet type
typeCount //!< number of types
};
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::type _obj);
};
#endif

View File

@ -0,0 +1,19 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/object/Config.h>
#undef __class__
#define __class__ "object::Config"
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::object::Config& _obj) {
_os << "{";
_os << "config=\"" << _obj.getConfig() << "\"";
_os << " data=\"" << _obj.getData() << "\"}";
return _os;
}

View File

@ -0,0 +1,47 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_OBJECT_CONFIG_H__
#define __EWOL_OBJECT_CONFIG_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace object {
class Config {
private:
const char* m_config; //!< config properties.
std::string m_data; //!< compositing additionnal message Value.
public:
Config(const char* _config,
const std::string& _data) :
m_config(_config),
m_data(_data) {
};
void setConfig(const char* _config) {
m_config = _config;
};
inline const char* getConfig(void) const {
return m_config;
};
void setData(const std::string& _data) {
m_data = _data;
};
inline const std::string& getData(void) const {
return m_data;
};
};
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::object::Config& _obj);
};
#endif

View File

@ -6,19 +6,12 @@
* @license BSD v3 (see license file)
*/
#include <ewol/renderer/EObject.h>
#include <ewol/object/ConfigElement.h>
#undef __class__
#define __class__ "EConfig"
#define __class__ "object::ConfigElement"
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfig& _obj) {
_os << "{";
_os << "config=\"" << _obj.getConfig() << "\"";
_os << " data=\"" << _obj.getData() << "\"}";
return _os;
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::object::ConfigElement& _obj) {
_os << "{";
if (NULL != _obj.getConfig()) {
_os << "config=\"" << _obj.getConfig() << "\"";

View File

@ -0,0 +1,60 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_OBJECT_CONFIG_ELEMENT_H__
#define __EWOL_OBJECT_CONFIG_ELEMENT_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace object {
class ConfigElement {
private:
const char* m_config; //!< config properties (used for XML properties == > only : "[0-9a-zA-Z\-]" ==> this is a regExp control.
const char* m_type; //!< type of the config[integer,float,string,reg-exp,list].
const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] )
const char* m_description; //!< description to help user to configure it.
const char* m_default; //!< default value ...
public:
// note : no parameter capability is needed to create element in case of vector stoarage.
ConfigElement(const char* _config = NULL,
const char* _type = NULL,
const char* _control = NULL,
const char* _description = NULL,
const char* _default = NULL) :
m_config(_config),
m_type(_type),
m_control(_control),
m_description(_description),
m_default(_default) {
};
inline const char* getConfig(void) const {
return m_config;
};
inline const char* getType(void) const {
return m_type;
};
inline const char* getControl(void) const {
return m_control;
};
inline const char* getDescription(void) const {
return m_description;
};
inline const char* getDefault(void) const {
return m_default;
};
};
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::object::ConfigElement& _obj);
};
#endif

View File

@ -6,21 +6,21 @@
* @license BSD v3 (see license file)
*/
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eContext.h>
#include <ewol/object/Manager.h>
#include <ewol/contect/Context.h>
#include <ewol/ewol.h>
#undef __class__
#define __class__ "EObjectManager"
#define __class__ "ewol::object::Manager"
ewol::EObjectManager::EObjectManager(void) {
EWOL_DEBUG(" == > init EObject-Manager");
ewol::object::Manager::Manager(void) {
EWOL_DEBUG(" == > init Object-Manager");
// Can create mlemory leak ... == > but not predictable comportement otherwise ...
m_eObjectAutoRemoveList.clear();
m_eObjectList.clear();
}
ewol::EObjectManager::~EObjectManager(void) {
ewol::object::Manager::~Manager(void) {
bool hasError = false;
if (m_eObjectAutoRemoveList.size()!=0) {
EWOL_ERROR("Must not have anymore eObject to auto-remove !!!");
@ -35,8 +35,8 @@ ewol::EObjectManager::~EObjectManager(void) {
}
}
void ewol::EObjectManager::unInit(void) {
EWOL_DEBUG(" == > Un-Init EObject-Manager");
void ewol::object::Manager::unInit(void) {
EWOL_DEBUG(" == > Un-Init Object-Manager");
removeAllAutoRemove();
EWOL_INFO(" remove missing user widget");
size_t iii=0;
@ -46,7 +46,7 @@ void ewol::EObjectManager::unInit(void) {
|| m_eObjectList[iii]->getStatusResource() == true) {
iii++;
} else {
EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
EWOL_WARNING("Un-INIT : remove Object type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
delete(m_eObjectList[iii]);
m_eObjectList[iii] = NULL;
}
@ -61,7 +61,7 @@ void ewol::EObjectManager::unInit(void) {
if (m_eObjectList[iii]->getStatic() == true) {
iii++;
} else {
EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
EWOL_WARNING("Un-INIT : remove Object type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
delete(m_eObjectList[iii]);
m_eObjectList[iii] = NULL;
}
@ -73,7 +73,7 @@ void ewol::EObjectManager::unInit(void) {
EWOL_INFO(" remove static user widgets");
while(iii < m_eObjectList.size()) {
if (m_eObjectList[iii] != NULL) {
EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
EWOL_WARNING("Un-INIT : remove Object type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
delete(m_eObjectList[iii]);
m_eObjectList[iii] = NULL;
} else {
@ -82,19 +82,19 @@ void ewol::EObjectManager::unInit(void) {
}
}
void ewol::EObjectManager::add(ewol::EObject* _object) {
void ewol::object::Manager::add(ewol::Object* _object) {
if (NULL != _object) {
m_eObjectList.push_back(_object);
} else {
EWOL_ERROR("try to add an inexistant EObject in manager");
EWOL_ERROR("try to add an inexistant Object in manager");
}
}
int32_t ewol::EObjectManager::getNumberObject(void) {
int32_t ewol::object::Manager::getNumberObject(void) {
return m_eObjectList.size() + m_eObjectAutoRemoveList.size();
}
void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object) {
void ewol::object::Manager::informOneObjectIsRemoved(ewol::Object* _object) {
for (size_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] != NULL) {
m_eObjectList[iii]->onObjectRemove(_object);
@ -110,9 +110,9 @@ void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object) {
ewol::getContext().onObjectRemove(_object);
}
void ewol::EObjectManager::rm(ewol::EObject* _object) {
void ewol::object::Manager::rm(ewol::Object* _object) {
if (NULL == _object) {
EWOL_ERROR("Try to remove (NULL) EObject");
EWOL_ERROR("Try to remove (NULL) Object");
return;
}
for (size_t iii=0; iii<m_eObjectList.size(); iii++) {
@ -132,12 +132,12 @@ void ewol::EObjectManager::rm(ewol::EObject* _object) {
}
}
// in this case, we have an error ...
EWOL_ERROR("Try to remove EObject that is not referenced ...");
EWOL_ERROR("Try to remove Object that is not referenced ...");
}
void ewol::EObjectManager::autoRemove(ewol::EObject* _object) {
void ewol::object::Manager::autoRemove(ewol::Object* _object) {
if (NULL == _object) {
EWOL_ERROR("Try to Auto-Remove (NULL) EObject");
EWOL_ERROR("Try to Auto-Remove (NULL) Object");
return;
}
for (size_t iii=0; iii<m_eObjectList.size(); iii++) {
@ -145,22 +145,22 @@ void ewol::EObjectManager::autoRemove(ewol::EObject* _object) {
// remove Element
m_eObjectList[iii] = NULL;
m_eObjectList.erase(m_eObjectList.begin()+iii);
EWOL_DEBUG("Auto-Remove EObject : [" << _object->getId() << "] type=\"" << _object->getObjectType() << "\"");
EWOL_DEBUG("Auto-Remove Object : [" << _object->getId() << "] type=\"" << _object->getObjectType() << "\"");
informOneObjectIsRemoved(_object);
m_eObjectAutoRemoveList.push_back(_object);
ewol::getContext().forceRedrawAll();
return;
}
}
EWOL_ERROR("Try to Auto-Remove EObject that is not referenced ...");
EWOL_ERROR("Try to Auto-Remove Object that is not referenced ...");
}
// clean all EObject that request an autoRemove ...
void ewol::EObjectManager::removeAllAutoRemove(void) {
//EWOL_DEBUG("Auto-Remove EObject section : " << m_eObjectAutoRemoveList.size() << " elemeents");
// clean all Object that request an autoRemove ...
void ewol::object::Manager::removeAllAutoRemove(void) {
//EWOL_DEBUG("Auto-Remove Object section : " << m_eObjectAutoRemoveList.size() << " elemeents");
while(0<m_eObjectAutoRemoveList.size()) {
if (m_eObjectAutoRemoveList[0]!=NULL) {
EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->getObjectType() << "\"");
EWOL_DEBUG("Real Auto-Remove Object type=\"" << m_eObjectAutoRemoveList[0]->getObjectType() << "\"");
delete(m_eObjectAutoRemoveList[0]);
m_eObjectAutoRemoveList[0] = NULL;
} else {
@ -170,7 +170,7 @@ void ewol::EObjectManager::removeAllAutoRemove(void) {
m_eObjectAutoRemoveList.clear();
}
ewol::EObject* ewol::EObjectManager::get(const std::string& _name) {
ewol::Object* ewol::object::Manager::get(const std::string& _name) {
if (_name == "") {
return NULL;
}

View File

@ -0,0 +1,51 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_OBJECT_MANAGER_H__
#define __EWOL_OBJECT_MANAGER_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <ewol/object/MultiCast.h>
namespace ewol {
namespace object {
class Manager {
private:
std::vector<ewol::Object*> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
std::vector<ewol::Object*> m_eObjectAutoRemoveList; // all widget allocated
public:
Manager(void);
~Manager(void);
/**
* @brief remove all resources (un-init) out of the destructor (due to the system implementation)
*/
void unInit(void);
void add(ewol::Object* _object);
void rm(ewol::Object* _object);
int32_t getNumberObject(void);
void autoRemove(ewol::Object* _object);
void removeAllAutoRemove(void);
ewol::Object* get(const std::string& _name);
private:
void informOneObjectIsRemoved(ewol::Object* _object);
private:
ewol::object::MultiCast m_multiCast; //!< muticast manager
public:
ewol::object::MultiCast& multiCast(void) {
return m_multiCast;
};
};
};
};
#endif

View File

@ -6,12 +6,12 @@
* @license BSD v3 (see license file)
*/
#include <ewol/renderer/EObject.h>
#include <ewol/object/Object.h>
#undef __class__
#define __class__ "EMessage"
#define __class__ "object/Message"
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EMessage& _obj) {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::object::Message& _obj) {
_os << "{";
if (NULL != _obj.getMessage()) {
_os << "msg=\"" << _obj.getMessage() << "\"";

View File

@ -0,0 +1,56 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_OBJECT_MESSAGE_H__
#define __EWOL_OBJECT_MESSAGE_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace ewol {
namespace object {
class Message {
private:
ewol::Object* m_callerObject; //!< Caller class.
const char* m_event; //!< Event pointer == > unique Id define by the system ...
std::string m_data; //!< compositing additionnal message Value.
public:
Message(ewol::Object* _caller,
const char* _message,
const std::string& _data) :
m_callerObject(_caller),
m_event(_message),
m_data(_data) {
};
void setCaller(ewol::Object* _caller) {
m_callerObject = _caller;
};
inline ewol::Object* getCaller(void) const {
return m_callerObject;
};
void setMessage(const char* _message) {
m_event = _message;
};
inline const char* getMessage(void) const {
return m_event;
};
void setData(const std::string& _data) {
m_data = _data;
};
inline const std::string& getData(void) const {
return m_data;
};
};
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::object::Message& _obj);
};
#endif

View File

@ -7,24 +7,24 @@
*/
#include <ewol/debug.h>
#include <ewol/renderer/EMultiCast.h>
#include <ewol/renderer/eContext.h>
#include <ewol/object/MultiCast.h>
#include <ewol/context/Context.h>
#undef __class__
#define __class__ "EMultiCast"
#define __class__ "object::MultiCast"
ewol::EMultiCast::EMultiCast(void) {
ewol::object::MultiCast::MultiCast(void) {
EWOL_INFO("EObject message Multi-Cast");
}
ewol::EMultiCast::~EMultiCast(void) {
ewol::object::MultiCast::~MultiCast(void) {
EWOL_INFO("EObject message Multi-Cast");
m_messageList.clear();
}
void ewol::EMultiCast::add(ewol::EObject* _object, const char* const _message) {
void ewol::object::MultiCast::add(ewol::Object* _object, const char* const _message) {
if (NULL == _object) {
EWOL_ERROR("Add with NULL object");
return;
@ -38,7 +38,7 @@ void ewol::EMultiCast::add(ewol::EObject* _object, const char* const _message) {
}
void ewol::EMultiCast::rm(ewol::EObject* _object) {
void ewol::object::MultiCast::rm(ewol::Object* _object) {
if (NULL == _object) {
EWOL_ERROR("Rm with NULL object");
return;
@ -54,7 +54,7 @@ void ewol::EMultiCast::rm(ewol::EObject* _object) {
}
}
void ewol::EMultiCast::send(ewol::EObject* _object, const char* const _message, const std::string& _data) {
void ewol::object::MultiCast::send(ewol::Object* _object, const char* const _message, const std::string& _data) {
EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to :");
// send the message at all registered widget ...

View File

@ -0,0 +1,46 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_OBJECT_MULTICAST_H__
#define __EWOL_OBJECT_MULTICAST_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <vector>
#include <exml/exml.h>
#include <ewol/object/Object.h>
namespace ewol {
namespace object {
class MultiCast {
private:
class MessageList {
public:
MessageList(const char* _message=NULL, ewol::Object* _object=NULL) :
m_message(_message), m_object(_object) {
}
const char* m_message;
ewol::Object* m_object;
};
std::vector<MessageList> m_messageList; //!< List of all message ...
public:
MultiCast(void);
~MultiCast(void);
void anonymousSend(const char* const _messageId, const std::string& _data) {
send(NULL, _messageId, _data);
};
void send(ewol::Object* _object, const char* const _message, const std::string& _data);
void rm(ewol::Object* _object);
void add(ewol::Object* _object, const char* const _message);
};
};
};
#endif

View File

@ -6,41 +6,41 @@
* @license BSD v3 (see license file)
*/
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/object/Object.h>
#include <ewol/object/Manager.h>
#include <ewol/debug.h>
#include <ewol/renderer/eContext.h>
#include <ewol/context/Context.h>
#undef __class__
#define __class__ "ewol::EObject"
#define __class__ "ewol::Object"
const char* const ewol::EObject::configName = "name";
size_t ewol::EObject::m_valUID = 0;
const char* const ewol::Object::configName = "name";
size_t ewol::Object::m_valUID = 0;
ewol::EObject::EObject(void) :
ewol::Object::Object(void) :
m_static(false),
m_isResource(false) {
// note this is nearly atomic ... (but it is enough)
m_uniqueId = m_valUID++;
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
getEObjectManager().add(this);
registerConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
EWOL_DEBUG("new Object : [" << m_uniqueId << "]");
getObjectManager().add(this);
registerConfig(ewol::Object::configName, "string", NULL, "Object name, might be a unique reference in all the program");
}
ewol::EObject::EObject(const std::string& _name) :
ewol::Object::Object(const std::string& _name) :
m_static(false),
m_name(_name),
m_isResource(false) {
// note this is nearly atomic ... (but it is enough)
m_uniqueId = m_valUID++;
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
getEObjectManager().add(this);
registerConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
EWOL_DEBUG("new Object : [" << m_uniqueId << "]");
getObjectManager().add(this);
registerConfig(ewol::Object::configName, "string", NULL, "Object name, might be a unique reference in all the program");
}
ewol::EObject::~EObject(void) {
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "] : " << getTypeDescription());
getEObjectManager().rm(this);
ewol::Object::~Object(void) {
EWOL_DEBUG("delete Object : [" << m_uniqueId << "] : " << getTypeDescription());
getObjectManager().rm(this);
getMultiCast().rm(this);
for (size_t iii=0; iii<m_externEvent.size(); iii++) {
if (NULL!=m_externEvent[iii]) {
@ -53,22 +53,22 @@ ewol::EObject::~EObject(void) {
m_uniqueId = -1;
}
const char * const ewol::EObject::getObjectType(void) {
const char * const ewol::Object::getObjectType(void) {
if (m_listType.size() == 0) {
return "ewol::EObject";
return "ewol::Object";
}
return m_listType.back();
}
void ewol::EObject::addObjectType(const char* _type) {
void ewol::Object::addObjectType(const char* _type) {
if (_type == NULL) {
EWOL_ERROR(" try to add a type with no value...");
return;
}
m_listType.push_back(_type);
}
std::string ewol::EObject::getTypeDescription(void) {
std::string ret("ewol::EObject");
std::string ewol::Object::getTypeDescription(void) {
std::string ret("ewol::Object");
for(auto element : m_listType) {
ret += "|";
ret += element;
@ -76,8 +76,8 @@ std::string ewol::EObject::getTypeDescription(void) {
return ret;
}
bool ewol::EObject::isTypeCompatible(const std::string& _type) {
if (_type == "ewol::EObject") {
bool ewol::Object::isTypeCompatible(const std::string& _type) {
if (_type == "ewol::Object") {
return true;
}
for(auto element : m_listType) {
@ -88,65 +88,65 @@ bool ewol::EObject::isTypeCompatible(const std::string& _type) {
return false;
}
void ewol::EObject::autoDestroy(void) {
getEObjectManager().autoRemove(this);
void ewol::Object::autoDestroy(void) {
getObjectManager().autoRemove(this);
}
void ewol::EObject::removeObject(void) {
getEObjectManager().autoRemove(this);
void ewol::Object::removObject(void) {
getObjectManager().autoRemove(this);
}
void ewol::EObject::addEventId(const char * _generateEventId) {
void ewol::Object::addEventId(const char * _generateEventId) {
if (NULL != _generateEventId) {
m_availlableEventId.push_back(_generateEventId);
}
}
void ewol::EObject::generateEventId(const char * _generateEventId, const std::string& _data) {
int32_t nbObject = getEObjectManager().getNumberObject();
void ewol::Object::generateEventId(const char * _generateEventId, const std::string& _data) {
int32_t nbObject = getObjectManager().getNumberObject();
// for every element registered ...
for (size_t iii=0; iii<m_externEvent.size(); iii++) {
if (NULL!=m_externEvent[iii]) {
// if we find the event ...
if (m_externEvent[iii]->localEventId == _generateEventId) {
if (NULL != m_externEvent[iii]->destEObject) {
if (NULL != m_externEvent[iii]->destObject) {
if (m_externEvent[iii]->overloadData.size() <= 0){
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, _data);
EWOL_VERBOSE("send message " << tmpMsg);
m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg);
m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg);
} else {
// set the user requested data ...
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, m_externEvent[iii]->overloadData);
EWOL_VERBOSE("send message " << tmpMsg);
m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg);
m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg);
}
}
}
}
}
if (nbObject > getEObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous");
if (nbObject > getObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removObject() which is asynchronous");
}
}
void ewol::EObject::sendMultiCast(const char* const _messageId, const std::string& _data) {
int32_t nbObject = getEObjectManager().getNumberObject();
void ewol::Object::sendMultiCast(const char* const _messageId, const std::string& _data) {
int32_t nbObject = getObjectManager().getNumberObject();
getMultiCast().send(this, _messageId, _data);
if (nbObject > getEObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous");
if (nbObject > getObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removObject() which is asynchronous");
}
}
void ewol::EObject::registerMultiCast(const char* const _messageId) {
void ewol::Object::registerMultiCast(const char* const _messageId) {
getMultiCast().add(this, _messageId);
}
void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject,
void ewol::Object::registerOnEvent(ewol::Object * _destinationObject,
const char * _eventId,
const char * _eventIdgenerated,
const std::string& _overloadData) {
if (NULL == _destinationObject) {
EWOL_ERROR("Input ERROR NULL pointer EObject ...");
EWOL_ERROR("Input ERROR NULL pointer Object ...");
return;
}
if (NULL == _eventId) {
@ -175,13 +175,13 @@ void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject,
EWOL_ERROR("Can not register event on this Type=" << getObjectType() << " event=\"" << _eventId << "\" == > unknow event");
return;
}
ewol::EventExtGen * tmpEvent = new ewol::EventExtGen();
ewol::object::EventExtGen * tmpEvent = new ewol::object::EventExtGen();
if (NULL == tmpEvent) {
EWOL_ERROR("Allocation error in Register Event...");
return;
}
tmpEvent->localEventId = _eventId;
tmpEvent->destEObject = _destinationObject;
tmpEvent->destObject = _destinationObject;
tmpEvent->overloadData = _overloadData;
if (NULL != _eventIdgenerated) {
tmpEvent->destEventId = _eventIdgenerated;
@ -191,10 +191,10 @@ void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject,
m_externEvent.push_back(tmpEvent);
}
void ewol::EObject::unRegisterOnEvent(ewol::EObject * _destinationObject,
void ewol::Object::unRegisterOnEvent(ewol::Object * _destinationObject,
const char * _eventId) {
if (NULL == _destinationObject) {
EWOL_ERROR("Input ERROR NULL pointer EObject ...");
EWOL_ERROR("Input ERROR NULL pointer Object ...");
return;
}
// check if event existed :
@ -202,7 +202,7 @@ void ewol::EObject::unRegisterOnEvent(ewol::EObject * _destinationObject,
if (m_externEvent[iii] == NULL) {
continue;
}
if (m_externEvent[iii]->destEObject != _destinationObject) {
if (m_externEvent[iii]->destObject != _destinationObject) {
continue;
}
if (_eventId == NULL) {
@ -213,18 +213,18 @@ void ewol::EObject::unRegisterOnEvent(ewol::EObject * _destinationObject,
}
}
void ewol::EObject::onObjectRemove(ewol::EObject * _removeObject) {
void ewol::Object::onObjectRemove(ewol::Object * _removObject) {
for(int32_t iii=m_externEvent.size()-1; iii >= 0; iii--) {
if (NULL == m_externEvent[iii]) {
m_externEvent.erase(m_externEvent.begin()+iii);
} else if (m_externEvent[iii]->destEObject == _removeObject) {
} else if (m_externEvent[iii]->destObject == _removObject) {
m_externEvent.erase(m_externEvent.begin()+iii);
}
}
}
void ewol::EObject::registerConfig(const char* _config,
void ewol::Object::registerConfig(const char* _config,
const char* _type,
const char* _control,
const char* _description,
@ -244,7 +244,7 @@ void ewol::EObject::registerConfig(const char* _config,
}
bool ewol::EObject::loadXML(exml::Element* _node) {
bool ewol::Object::loadXML(exml::Element* _node) {
if (NULL == _node) {
return false;
}
@ -265,7 +265,7 @@ bool ewol::EObject::loadXML(exml::Element* _node) {
return errorOccured;
}
bool ewol::EObject::storeXML(exml::Element* _node) const {
bool ewol::Object::storeXML(exml::Element* _node) const {
if (NULL == _node) {
return false;
}
@ -288,9 +288,9 @@ bool ewol::EObject::storeXML(exml::Element* _node) const {
}
bool ewol::EObject::onSetConfig(const ewol::EConfig& _conf) {
bool ewol::Object::onSetConfig(const ewol::EConfig& _conf) {
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config : " << _conf);
if (_conf.getConfig() == ewol::EObject::configName) {
if (_conf.getConfig() == ewol::Object::configName) {
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config name : \"" << _conf.getData() << "\"");
setName(_conf.getData());
return true;
@ -298,15 +298,15 @@ bool ewol::EObject::onSetConfig(const ewol::EConfig& _conf) {
return false;
}
bool ewol::EObject::onGetConfig(const char* _config, std::string& _result) const {
if (_config == ewol::EObject::configName) {
bool ewol::Object::onGetConfig(const char* _config, std::string& _result) const {
if (_config == ewol::Object::configName) {
_result = getName();
return true;
}
return false;
}
bool ewol::EObject::setConfig(const std::string& _config, const std::string& _value) {
bool ewol::Object::setConfig(const std::string& _config, const std::string& _value) {
for(size_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].getConfig()) {
if (_config == m_listConfig[iii].getConfig() ) {
@ -319,7 +319,7 @@ bool ewol::EObject::setConfig(const std::string& _config, const std::string& _va
return false;
}
std::string ewol::EObject::getConfig(const char* _config) const {
std::string ewol::Object::getConfig(const char* _config) const {
std::string res="";
if (NULL != _config) {
(void)onGetConfig(_config, res);
@ -327,7 +327,7 @@ std::string ewol::EObject::getConfig(const char* _config) const {
return res;
}
std::string ewol::EObject::getConfig(const std::string& _config) const {
std::string ewol::Object::getConfig(const std::string& _config) const {
for(size_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].getConfig()) {
if (_config == m_listConfig[iii].getConfig() ) {
@ -340,30 +340,30 @@ std::string ewol::EObject::getConfig(const std::string& _config) const {
return "";
}
bool ewol::EObject::setConfigNamed(const std::string& _objectName, const ewol::EConfig& _conf) {
ewol::EObject* object = getEObjectManager().get(_objectName);
bool ewol::Object::setConfigNamed(const std::string& _objectName, const ewol::EConfig& _conf) {
ewol::Object* object = getObjectManager().get(_objectName);
if (object == NULL) {
return false;
}
return object->setConfig(_conf);
}
bool ewol::EObject::setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
ewol::EObject* object = getEObjectManager().get(_objectName);
bool ewol::Object::setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
ewol::Object* object = getObjectManager().get(_objectName);
if (object == NULL) {
return false;
}
return object->setConfig(_config, _value);
}
ewol::EObjectManager& ewol::EObject::getEObjectManager(void) {
return ewol::getContext().getEObjectManager();
ewol::ObjectManager& ewol::Object::getObjectManager(void) {
return ewol::getContext().getObjectManager();
}
ewol::EMultiCast& ewol::EObject::getMultiCast(void) {
return ewol::getContext().getEObjectManager().multiCast();
ewol::EMultiCast& ewol::Object::getMultiCast(void) {
return ewol::getContext().getObjectManager().multiCast();
}
ewol::eContext& ewol::EObject::getContext(void) {
ewol::eContext& ewol::Object::getContext(void) {
return ewol::getContext();
}

View File

@ -6,8 +6,8 @@
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_E_OBJECT_H__
#define __EWOL_E_OBJECT_H__
#ifndef __EWOL_OBJECT_H__
#define __EWOL_OBJECT_H__
#include <etk/types.h>
#include <etk/UString.h>
@ -16,31 +16,39 @@
#include <vector>
namespace ewol {
// some class need to define element befor other ...
class EObject;
class EObjectManager;
class EMultiCast;
class eContext;
class Object;
namespace object {
class Manager;
};
namespace context {
class MultiCast;
};
class Context;
};
#include <ewol/renderer/EConfig.h>
#include <ewol/renderer/EMessage.h>
#include <ewol/object/Config.h>
#include <ewol/object/ConfigElement.h>
#include <ewol/object/Message.h>
namespace ewol {
/**
* local class for event generation
*/
class EventExtGen {
public:
const char* localEventId; //!< local event Id generation
ewol::EObject* destEObject; //!< destination widget that might be call
const char* destEventId; //!< generated event ID on the distant widget
std::string overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget)
};
namespace object {
/**
* local class for event generation
* @not-in-doc
*/
class EventExtGen {
public:
const char* localEventId; //!< local event Id generation
ewol::Object* destObject; //!< destination widget that might be call
const char* destEventId; //!< generated event ID on the distant widget
std::string overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget)
};
}
/**
* @brief Basic message classes for ewol system
* this class mermit at every EObject to communicate between them.
* this class mermit at every Object to communicate between them.
*/
class EObject {
class Object {
private:
static size_t m_valUID; //!< stic used for the unique ID definition
public:
@ -50,16 +58,16 @@ namespace ewol {
/**
* @brief Constructor.
*/
EObject(void);
Object(void);
/**
* @brief Constructor.
* @param[in] _name Name of the EObject.
* @param[in] _name Name of the Object.
*/
EObject(const std::string& _name);
Object(const std::string& _name);
/**
* @brief Destructor
*/
virtual ~EObject(void);
virtual ~Object(void);
protected:
/**
* @brief Auto-destroy the object
@ -74,12 +82,12 @@ namespace ewol {
std::vector<const char*> m_listType;
public:
/**
* @brief get the current Object type of the EObject
* @brief get the current Object type of the Object
* @return the last type name of the element
*/
const char * const getObjectType(void);
/**
* @brief Get the herarchie of the EObject type.
* @brief Get the herarchie of the Object type.
* @return descriptive string.
*/
std::string getTypeDescription(void);
@ -91,7 +99,7 @@ namespace ewol {
bool isTypeCompatible(const std::string& _type);
protected:
/**
* @brief Add a type of the list of eObject.
* @brief Add a type of the list of Object.
* @param[in] _type new type to add.
*/
void addObjectType(const char* _type);
@ -99,7 +107,7 @@ namespace ewol {
bool m_static; //!< set this variable at true if this element must not be auto destroy (exemple : use static object)
public:
/**
* @brief get the static status of the EObject == > mark at true if the user set the object mark as static allocated element ==> not auto remove element
* @brief get the static status of the Object == > mark at true if the user set the object mark as static allocated element ==> not auto remove element
* @return true if it might not be removed == > usefull for conficuration class
*/
bool getStatic(void){
@ -109,29 +117,29 @@ namespace ewol {
int32_t m_uniqueId; //!< Object UniqueID == > TODO : Check if it use is needed
public:
/**
* @brief get the UniqueId of the EObject
* @brief get the UniqueId of the Object
* @return the requested ID
*/
int32_t getId(void){
return m_uniqueId;
};
private:
std::vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
std::vector<object::EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
std::vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
protected:
/**
* @brief add a specific event Id in the list to prevent wrong link on a EObject
* @brief add a specific event Id in the list to prevent wrong link on a Object
* @param[in] _generateEventId event Id to add
*/
void addEventId(const char * _generateEventId);
/**
* @brief generate event on all registered EObject
* @brief generate event on all registered Object
* @param[in] _generateEventId event Id that is curetly generated
* @param[in] _data data associated with the event
*/
void generateEventId(const char * _generateEventId, const std::string& _data = "");
/**
* @brief generate Multicast event on all EObject requested the event
* @brief generate Multicast event on all Object requested the event
* @param[in] _messageId Event Id that is generated
* @param[in] _data String that is send at all the destinations
*/
@ -143,41 +151,41 @@ namespace ewol {
void registerMultiCast(const char* const _messageId);
public:
/**
* @brief Register an EObject over an other to get event on the second...
* @brief Register an Object over an other to get event on the second...
* @param[in] _destinationObject pointer on the object that might be call when an event is generated
* @param[in] _eventId Event generate inside the object
* @param[in] _eventIdgenerated event generated when call the distant EObject.onReceiveMessage(...)
* @param[in] _eventIdgenerated event generated when call the distant Object.onReceiveMessage(...)
* @param[in] _overloadData When the user prever to receive a data specificly for this event ...
*/
void registerOnEvent(ewol::EObject * _destinationObject,
void registerOnEvent(ewol::Object * _destinationObject,
const char * _eventId,
const char * _eventIdgenerated = NULL,
const std::string& _overloadData = "");
/**
* @brief Un-Register an EObject over an other.
* @brief Un-Register an Object over an other.
* @param[in] _destinationObject pointer on the object that might be call when an event is generated
* @param[in] _eventId Event generate inside the object (NULL to remove all event on this object)
*/
void unRegisterOnEvent(ewol::EObject * _destinationObject,
void unRegisterOnEvent(ewol::Object * _destinationObject,
const char * _eventId = NULL);
/**
* @brief Inform object that an other object is removed ...
* @param[in] _removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject
* @param[in] _removObject Pointer on the Object remeved == > the user must remove all reference on this Object
* @note : Sub classes must call this class
*/
virtual void onObjectRemove(ewol::EObject * _removeObject);
virtual void onObjectRemove(ewol::Object * _removeObject);
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @brief Receive a message from an other Object with a specific eventId and data
* @param[in] _msg Message handle
*/
virtual void onReceiveMessage(const ewol::EMessage& _msg) {
virtual void onReceiveMessage(const ewol::object::Message& _msg) {
};
private:
std::vector<ewol::EConfigElement> m_listConfig;
std::vector<ewol::object::ConfigElement> m_listConfig;
protected:
/**
* @brief the EObject add a configuration capabilities
* @brief the Object add a configuration capabilities
* @param[in] _config Configuration name.
* @param[in] _type Type of the config.
* @param[in] _control control of the current type.
@ -190,13 +198,13 @@ namespace ewol {
const char* _description = NULL,
const char* _default = NULL);
/**
* @brief Configuration requested to the curent EObject
* @brief Configuration requested to the curent Object
* @param[in] _conf Configuration handle.
* @return true if the parametere has been used
*/
virtual bool onSetConfig(const ewol::EConfig& _conf);
virtual bool onSetConfig(const ewol::object::Config& _conf);
/**
* @brief Receive a configuration message from an other element system or from the curent EObject
* @brief Receive a configuration message from an other element system or from the curent Object
* @param[in] _config Configuration name.
* @param[out] _result Result of the request.
* @return true if the config is set
@ -207,23 +215,23 @@ namespace ewol {
* @brief get all the configuration list
* @return The list of all parameter availlable in the widget
*/
virtual const std::vector<ewol::EConfigElement>& getConfigList(void) {
virtual const std::vector<ewol::object::ConfigElement>& getConfigList(void) {
return m_listConfig;
};
/**
* @brief Configuration requested to the curent EObject (systrem mode)
* @brief Configuration requested to the curent Object (systrem mode)
* @param[in] _conf Configuration handle.
* @return true if config set correctly...
*/
bool setConfig(const ewol::EConfig& _conf) {
bool setConfig(const ewol::object::Config& _conf) {
return onSetConfig(_conf);
};
bool setConfig(const std::string& _config, const std::string& _value); // need a search ...
// TODO : Distingish global search and sub search ...
bool setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value); // need a search ...
bool setConfigNamed(const std::string& _objectName, const ewol::EConfig& _conf);
bool setConfigNamed(const std::string& _objectName, const ewol::object::Config& _conf);
/**
* @brief Configuration get from the curent EObject (systrem mode)
* @brief Configuration get from the curent Object (systrem mode)
* @param[in] _config Configuration name.
* @return the config properties
*/
@ -233,7 +241,7 @@ namespace ewol {
std::string m_name; //!< name of the element ...
public:
/**
* @brief get the eObject name
* @brief get the Object name
* @return The requested name
*/
const std::string& getName(void) const {
@ -263,20 +271,20 @@ namespace ewol {
virtual bool storeXML(exml::Element* _node) const;
public:
/**
* @breif get the current EObject manager.
* @breif get the current Object manager.
* @return the requested object manager.
*/
ewol::EObjectManager& getEObjectManager(void);
ewol::object::Manager& getObjectManager(void);
/**
* @breif get the current EObject Message Multicast manager.
* @breif get the current Object Message Multicast manager.
* @return the requested object manager.
*/
ewol::EMultiCast& getMultiCast(void);
ewol::context::MultiCast& getMultiCast(void);
/**
* @brief get the curent the system inteface.
* @return current reference on the instance.
*/
eContext& getContext(void);
ewol::Context& getContext(void);
private:
bool m_isResource; //!< enable this when you want to declare this element is auto-remove
public:

View File

@ -1,23 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/physicsShape/PhysicsBox.h>
bool ewol::PhysicsBox::parse(const char* _line) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_VERBOSE(" halfSize=" << m_size);
return true;
}
return false;
}

View File

@ -1,44 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_PHYSICS_BOX_H__
#define __EWOL_PHYSICS_BOX_H__
#include <etk/types.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol {
class PhysicsBox : public ewol::PhysicsShape {
public:
PhysicsBox(void) {};
virtual ~PhysicsBox(void) {};
public:
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual enum type getType(void) {
return ewol::PhysicsShape::box;
};
private:
vec3 m_size; // Box size property in X, Y and Z
public:
const vec3& getSize(void) const {
return m_size;
};
public:
virtual const PhysicsBox* toBox(void) const {
return this;
};
virtual PhysicsBox* toBox(void) {
return this;
};
};
};
#endif

View File

@ -1,28 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/physicsShape/PhysicsCapsule.h>
bool ewol::PhysicsCapsule::parse(const char* _line) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_VERBOSE(" radius=" << m_radius);
return true;
}
if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height );
EWOL_VERBOSE(" height=" << m_height);
return true;
}
return false;
}

View File

@ -1,52 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_PHYSICS_CAPSULE_H__
#define __EWOL_PHYSICS_CAPSULE_H__
#include <etk/types.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol {
class PhysicsCapsule : public ewol::PhysicsShape {
public:
PhysicsCapsule(void) {};
virtual ~PhysicsCapsule(void) {};
public:
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual enum type getType(void) {
return ewol::PhysicsShape::capsule;
};
private:
float m_radius;
public:
float getRadius(void) const {
return m_radius;
};
private:
float m_height;
public:
float getHeight(void) const {
return m_height;
};
public:
virtual const PhysicsCapsule* toCapsule(void) const {
return this;
};
virtual PhysicsCapsule* toCapsule(void) {
return this;
};
};
};
#endif

View File

@ -1,28 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/physicsShape/PhysicsCone.h>
bool ewol::PhysicsCone::parse(const char* _line) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_VERBOSE(" radius=" << m_radius);
return true;
}
if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height );
EWOL_VERBOSE(" height=" << m_height);
return true;
}
return false;
}

View File

@ -1,52 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_PHYSICS_CONE_H__
#define __EWOL_PHYSICS_CONE_H__
#include <etk/types.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol {
class PhysicsCone : public ewol::PhysicsShape {
public:
PhysicsCone(void) {};
virtual ~PhysicsCone(void) {};
public:
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual enum type getType(void) {
return ewol::PhysicsShape::cone;
};
private:
float m_radius;
public:
float getRadius(void) const {
return m_radius;
};
private:
float m_height;
public:
float getHeight(void) const {
return m_height;
};
public:
virtual const PhysicsCone* toCone(void) const {
return this;
};
virtual PhysicsCone* toCone(void) {
return this;
};
};
};
#endif

View File

@ -1,44 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/physicsShape/PhysicsConvexHull.h>
bool ewol::PhysicsConvexHull::parse(const char* _line) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0 == strncmp(_line, "points : ", 8) ) {
//EWOL_DEBUG("convex hull point parsing " << _line);
char* base = (char*)(&_line[8]);
char* tmp= strchr(base, '|');
vec3 pos(0,0,0);
while (tmp != NULL) {
*tmp = '\0';
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.push_back(pos);
base = tmp+1;
tmp= strchr(base, '|');
}
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.push_back(pos);
/*
for (int32_t iii=0; iii<m_points.size(); iii++) {
EWOL_VERBOSE(" parsed " << m_points[iii]);
}
*/
return true;
}
if(0 == strncmp(_line, "scale : ", 8) ) {
sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] );
EWOL_VERBOSE(" scale=" << m_scale);
return true;
}
return false;
}

View File

@ -1,52 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_PHYSICS_CONVEX_HULL_H__
#define __EWOL_PHYSICS_CONVEX_HULL_H__
#include <etk/types.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol {
class PhysicsConvexHull : public ewol::PhysicsShape {
public:
PhysicsConvexHull(void) {};
virtual ~PhysicsConvexHull(void) {};
public:
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual enum type getType(void) {
return ewol::PhysicsShape::convexHull;
};
private:
vec3 m_scale;
public:
vec3 getScale(void) const {
return m_scale;
};
private:
std::vector<vec3> m_points;
public:
const std::vector<vec3>& getPointList(void) const {
return m_points;
};
public:
virtual const PhysicsConvexHull* toConvexHull(void) const {
return this;
};
virtual PhysicsConvexHull* toConvexHull(void) {
return this;
};
};
};
#endif

View File

@ -1,22 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/physicsShape/PhysicsCylinder.h>
bool ewol::PhysicsCylinder::parse(const char* _line) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_VERBOSE(" halfSize=" << m_size);
return true;
}
return false;
}

Some files were not shown because too many files have changed in this diff Show More