change open Gl working
This commit is contained in:
parent
227c141993
commit
ac952176f2
@ -50,8 +50,6 @@ namespace ewol {
|
||||
public:
|
||||
// use to crop element outside the display
|
||||
virtual void UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY) { };
|
||||
// Move to the correct position display
|
||||
virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y) { };
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -75,13 +75,6 @@ void ewol::OObject2DColored::Clear(void)
|
||||
m_coordColor.Clear();
|
||||
}
|
||||
|
||||
void ewol::OObject2DColored::UpdateOrigin(etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_coord.Size(); iii++) {
|
||||
m_coord[iii].x += x;
|
||||
m_coord[iii].y += y;
|
||||
}
|
||||
}
|
||||
|
||||
void generatePolyGone(etk::VectorType<coord2D_ts> & input, etk::VectorType<coord2D_ts> & output )
|
||||
{
|
||||
|
@ -53,9 +53,7 @@ namespace ewol {
|
||||
void Line(etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey, etkFloat_t thickness);
|
||||
void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h);
|
||||
void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, clipping_ts& drawClipping);
|
||||
//void RectangleAngle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t angle);
|
||||
void RectangleBorder(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t thickness);
|
||||
//void RectangleBorder(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t thickness, etkFloat_t angle);
|
||||
void Circle(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness);
|
||||
void CirclePart(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness, etkFloat_t angleStart, etkFloat_t angleStop);
|
||||
void Disc(etkFloat_t x, etkFloat_t y, etkFloat_t radius);
|
||||
@ -63,7 +61,6 @@ namespace ewol {
|
||||
public:
|
||||
// Ewol internal ... : done to update at the origin of the widget ...
|
||||
virtual void UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY);
|
||||
virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -102,13 +102,6 @@ int32_t ewol::OObject2DText::Text(coord2D_ts textPos, clipping_ts drawClipping,
|
||||
}
|
||||
return ewol::DrawText(m_FontId, textPos, drawClipping, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
|
||||
}
|
||||
void ewol::OObject2DText::UpdateOrigin(etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_coord.Size(); iii++) {
|
||||
m_coord[iii].x += x;
|
||||
m_coord[iii].y += y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -47,8 +47,6 @@ namespace ewol {
|
||||
int32_t m_FontTextureId; //!< font internal Texture ID
|
||||
etk::VectorType<coord2D_ts> m_coord; //!< internal coord of the object
|
||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
public:
|
||||
virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -139,15 +139,6 @@ int32_t ewol::OObject2DTextColored::Text(coord2D_ts textPos, clipping_ts drawCli
|
||||
}
|
||||
|
||||
|
||||
void ewol::OObject2DTextColored::UpdateOrigin(etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_coord.Size(); iii++) {
|
||||
m_coord[iii].x += x;
|
||||
m_coord[iii].y += y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ewol::OObject2DTextColored::SetColor(color_ts color)
|
||||
{
|
||||
m_color = color;
|
||||
|
@ -53,7 +53,6 @@ namespace ewol {
|
||||
public:
|
||||
void SetFontID(int32_t fontID) { m_FontId = fontID; };
|
||||
int32_t GetFontID(void) { return m_FontId; };
|
||||
virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -109,12 +109,3 @@ void ewol::OObject2DTextured::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextured::UpdateOrigin(etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_coord.Size(); iii++) {
|
||||
m_coord[iii].x += x;
|
||||
m_coord[iii].y += y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,6 @@ namespace ewol {
|
||||
int32_t m_textureId; //!< texture internal ID
|
||||
etk::VectorType<coord2D_ts> m_coord; //!< internal coord of the object
|
||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
public:
|
||||
virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/WidgetMessageMultiCast.h>
|
||||
|
||||
#include <ewol/importgl.h>
|
||||
|
||||
char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
|
||||
{
|
||||
@ -109,6 +109,20 @@ int32_t ewol::Widget::GetWidgetId(void)
|
||||
return ewol::widgetManager::Get(this);
|
||||
}
|
||||
|
||||
coord2D_ts ewol::Widget::GetRealOrigin(void)
|
||||
{
|
||||
coord2D_ts parentCoord;
|
||||
if( NULL != m_parrent) {
|
||||
parentCoord = m_parrent->GetRealOrigin();
|
||||
parentCoord.x += m_origin.x;
|
||||
parentCoord.y += m_origin.y;
|
||||
} else {
|
||||
parentCoord.x = m_origin.x;
|
||||
parentCoord.y = m_origin.y;
|
||||
}
|
||||
return parentCoord;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Widget::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
{
|
||||
@ -121,7 +135,7 @@ bool ewol::Widget::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
|
||||
bool ewol::Widget::GenEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
return OnEventInput(IdInput, typeEvent, x, y);
|
||||
return OnEventInput(IdInput, typeEvent, x-m_origin.x, y-m_origin.y);
|
||||
}
|
||||
|
||||
bool ewol::Widget::GenEventInputExternal(const char * generateEventId, etkFloat_t x, etkFloat_t y)
|
||||
@ -149,78 +163,7 @@ bool ewol::Widget::GenEventInputExternal(const char * generateEventId, etkFloat_
|
||||
|
||||
bool ewol::Widget::GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue)
|
||||
{
|
||||
bool ended = false;
|
||||
//EWOL_WARNING("Input event : " << IdInput << " pos(" << x << "," << y << ")");
|
||||
for(int32_t iii=m_inputShortCutEvent.Size()-1; iii>=0; iii--) {
|
||||
if( m_inputShortCutEvent[iii].shift == shift
|
||||
&& m_inputShortCutEvent[iii].control == control
|
||||
&& m_inputShortCutEvent[iii].alt == alt
|
||||
&& m_inputShortCutEvent[iii].meta == meta
|
||||
&& m_inputShortCutEvent[iii].UnicodeValue == unicodeValue)
|
||||
{
|
||||
if (true == GenEventInputExternal(m_inputShortCutEvent[iii].generateEventId, -1, -1)) {
|
||||
ended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (false == ended) {
|
||||
return OnEventInput(IdInput, typeEvent, -1, -1);
|
||||
}
|
||||
*/
|
||||
return ended;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Widget::AddEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue, const char * generateEventId)
|
||||
{
|
||||
eventShortCut_ts newEvent;
|
||||
newEvent.generateEventId = generateEventId;
|
||||
newEvent.shift = shift;
|
||||
newEvent.control = control;
|
||||
newEvent.alt = alt;
|
||||
newEvent.meta = meta;
|
||||
newEvent.UnicodeValue = unicodeValue;
|
||||
m_inputShortCutEvent.PushBack(newEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Widget::AddEventShortCut(char * descriptiveString, const char * generateEventId)
|
||||
{
|
||||
if( NULL==descriptiveString
|
||||
|| 0==strlen(descriptiveString))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool shift = false;
|
||||
bool control = false;
|
||||
bool alt = false;
|
||||
bool meta = false;
|
||||
uint32_t UnicodeValue = 0;
|
||||
|
||||
// parsing of the string :
|
||||
//"ctrl+shift+alt+meta+s"
|
||||
char * tmp = strstr(descriptiveString, "ctrl");
|
||||
if(NULL != tmp) {
|
||||
control = true;
|
||||
}
|
||||
tmp = strstr(descriptiveString, "shift");
|
||||
if(NULL != tmp) {
|
||||
shift = true;
|
||||
}
|
||||
tmp = strstr(descriptiveString, "alt");
|
||||
if(NULL != tmp) {
|
||||
alt = true;
|
||||
}
|
||||
tmp = strstr(descriptiveString, "meta");
|
||||
if(NULL != tmp) {
|
||||
meta = true;
|
||||
}
|
||||
UnicodeValue = descriptiveString[strlen(descriptiveString) -1];
|
||||
// add with generic Adding function ...
|
||||
return AddEventShortCut(shift, control, alt, meta, UnicodeValue, generateEventId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -264,3 +207,42 @@ void ewol::Widget::DoubleBufferFlipFlop(void)
|
||||
|
||||
|
||||
|
||||
|
||||
bool ewol::Widget::SetFocus(void)
|
||||
{
|
||||
if (true == m_canFocus) {
|
||||
m_hasFocus = true;
|
||||
OnGetFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ewol::Widget::RmFocus(void)
|
||||
{
|
||||
if (true == m_canFocus) {
|
||||
m_hasFocus = false;
|
||||
OnLostFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::Widget::SetCanHaveFocus(bool canFocusState)
|
||||
{
|
||||
m_canFocus = canFocusState;
|
||||
if (true == m_hasFocus) {
|
||||
(void)RmFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ewol::Widget::GenDraw(void)
|
||||
{
|
||||
glTranslatef(m_origin.x,m_origin.y, 0);
|
||||
//EWOL_DEBUG("Draw Custum...");
|
||||
bool valRet = OnDraw();
|
||||
glTranslatef(-m_origin.x,-m_origin.y, 0);
|
||||
return valRet;
|
||||
}
|
||||
|
@ -100,19 +100,10 @@ namespace ewol {
|
||||
|
||||
char* GetCharTypeMoveEvent(eventKbMoveType_te type);
|
||||
|
||||
#define UTF8_MAX_SIZE (8)
|
||||
#define EWOL_EVENT_AREA (0)
|
||||
#define EWOL_EVENT_SHORTCUT (1)
|
||||
// TODO : Remove this and set it at the Windows only ...
|
||||
extern "C" {
|
||||
typedef struct {
|
||||
const char * generateEventId; // event generate ID (to be unique it was pointer on the string name)
|
||||
bool shift;
|
||||
bool control;
|
||||
bool alt;
|
||||
bool meta;
|
||||
uint32_t UnicodeValue;
|
||||
} eventShortCut_ts;
|
||||
typedef struct {
|
||||
const char * generateEventId; //!< event generate ID (to be unique it was pointer on the string name)
|
||||
int32_t widgetCall; //!< unique ID of the widget
|
||||
@ -131,6 +122,7 @@ namespace ewol {
|
||||
void SetParrent(ewol::Widget * newParrent) { m_parrent = newParrent; };
|
||||
void UnlinkParrent(void) { if (NULL != m_parrent) { m_parrent->removedChild(this); m_parrent=NULL; } };
|
||||
virtual void removedChild(ewol::Widget * removedChild) { };
|
||||
coord2D_ts GetRealOrigin(void); // this fnction call all the parrent to get his real position ...
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// -- Widget Size:
|
||||
@ -173,33 +165,11 @@ namespace ewol {
|
||||
bool m_hasFocus; //!< set the focus on this widget
|
||||
bool m_canFocus; //!< the focus can be done on this widget
|
||||
public:
|
||||
bool SetFocus(void)
|
||||
{
|
||||
if (true == m_canFocus) {
|
||||
m_hasFocus = true;
|
||||
OnGetFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool RmFocus(void)
|
||||
{
|
||||
if (true == m_canFocus) {
|
||||
m_hasFocus = false;
|
||||
OnLostFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool GetFocus(void) { return m_hasFocus;};
|
||||
bool CanHaveFocus(void) { return m_canFocus;};
|
||||
void SetCanHaveFocus(bool canFocusState)
|
||||
{
|
||||
m_canFocus = canFocusState;
|
||||
if (true == m_hasFocus) {
|
||||
(void)RmFocus();
|
||||
}
|
||||
}
|
||||
bool SetFocus(void);
|
||||
bool RmFocus(void);
|
||||
void SetCanHaveFocus(bool canFocusState);
|
||||
protected:
|
||||
virtual void OnGetFocus(void) {};
|
||||
virtual void OnLostFocus(void) {};
|
||||
@ -209,23 +179,19 @@ namespace ewol {
|
||||
// -- Shortcut: (only for computer) ==> must be manage otherwise for tablette pc
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
private:
|
||||
etk::VectorType<eventShortCut_ts> m_inputShortCutEvent; //!< generic short-cut event
|
||||
etk::VectorType<eventExtern_ts> m_externEvent; //!< Generic list of event generation for output link
|
||||
etk::VectorType<const char*> m_ListEventAvaillable; //!< List of all event availlable for this widget
|
||||
public:
|
||||
// external acces to set an input event on this widget.
|
||||
bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t X, etkFloat_t Y); // call when input event arrive and call OnEventInput, if no event detected
|
||||
bool GenEventInputExternal(const char * generateEventId, etkFloat_t x, etkFloat_t y);
|
||||
bool GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue);
|
||||
virtual bool GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue);
|
||||
protected:
|
||||
void AddEventId(const char * generateEventId) {
|
||||
if (NULL != generateEventId) {
|
||||
m_ListEventAvaillable.PushBack(generateEventId);
|
||||
}
|
||||
}
|
||||
//void EventAreaRemoveAll(void) { m_inputAreaEvent.Clear();m_inputShortCutEvent.Clear(); };
|
||||
bool AddEventShortCut(bool shift, bool control, bool alt, bool pomme, uint32_t unicodeValue, const char * generateEventId);
|
||||
bool AddEventShortCut(char * descriptiveString, const char * generateEventId);
|
||||
public:
|
||||
// to link an extern widget at the internal event of this one it will access by here :
|
||||
bool ExternLinkOnEvent(const char * eventName, int32_t widgetId, const char * eventExternId = NULL);
|
||||
@ -243,16 +209,14 @@ namespace ewol {
|
||||
virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) { return false; };
|
||||
virtual bool OnEventKbMove(eventKbType_te typeEvent, eventKbMoveType_te moveTypeEvent) { return false; };
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// -- Drawing : Special case ==> have internal system drawing management to prevent reconstriction of a widget
|
||||
// -- this will automaticly regenerate the same view in openGL
|
||||
// -- Drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
protected:
|
||||
int32_t m_currentDrawId;
|
||||
int32_t m_currentCreateId;
|
||||
bool m_needFlipFlop;
|
||||
bool m_needRegenerateDisplay;
|
||||
int8_t m_currentDrawId; //!< Id of the element that might be displayed by the Gui thread
|
||||
int8_t m_currentCreateId; //!< Id of the element might be modify
|
||||
bool m_needFlipFlop; //!< A flip flop need to be done
|
||||
bool m_needRegenerateDisplay; //!< the display might be done the next regeneration
|
||||
virtual bool OnDraw(void) { return true; };
|
||||
protected:
|
||||
void MarkToReedraw(void) { m_needRegenerateDisplay = true; };
|
||||
@ -260,14 +224,7 @@ namespace ewol {
|
||||
public:
|
||||
void DoubleBufferFlipFlop(void);
|
||||
virtual void OnRegenerateDisplay(void) { /* nothing to do */ };
|
||||
bool GenDraw(void)
|
||||
{
|
||||
// TODO : Set here the open gl moving ...
|
||||
//EWOL_DEBUG("Draw Custum...");
|
||||
bool valRet = OnDraw();
|
||||
|
||||
return valRet;
|
||||
};
|
||||
bool GenDraw(void);
|
||||
|
||||
}; // end of the class Widget declaration
|
||||
};// end of nameSpace
|
||||
|
@ -139,33 +139,14 @@ void ewol::Windows::SysDraw(void)
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#if defined(__PLATFORM__Android)
|
||||
glOrtho(-m_size.x/2, m_size.x/2, m_size.y/2, -m_size.y/2, -1, 1);
|
||||
glOrthoEwol(-m_size.x/2, m_size.x/2, m_size.y/2, -m_size.y/2, -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glTranslatef(-m_size.x/2, -m_size.y/2, -1.0);
|
||||
#else
|
||||
glOrtho(0., m_size.x, 0., -m_size.y, 1., 20.);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, -m_size.y, -5);
|
||||
#endif
|
||||
//http://www.khronos.org/opengles/documentation/opengles1_0/html/glBlendFunc.html
|
||||
|
||||
//glEnable(GL_POLYGON_SMOOTH);
|
||||
//glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glShadeModel(GL_POLYGON_SMOOTH);
|
||||
//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
|
||||
|
||||
GenDraw();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -312,3 +312,38 @@ void EWOL_NativeGLDestroy(void)
|
||||
ewol::UpdateTextureContextIsDestroy();
|
||||
}
|
||||
|
||||
|
||||
#include <ewol/importgl.h>
|
||||
|
||||
|
||||
void glOrthoEwol(GLfloat left,
|
||||
GLfloat right,
|
||||
GLfloat bottom,
|
||||
GLfloat top,
|
||||
GLfloat nearVal,
|
||||
GLfloat farVal)
|
||||
{
|
||||
GLfloat myMatrix[4*4];
|
||||
int iii;
|
||||
for(iii=0; iii<4*4 ; iii++) {
|
||||
myMatrix[iii] = 0;
|
||||
}
|
||||
myMatrix[0] = 2.0 / (right - left);
|
||||
myMatrix[5] = 2.0 / (top - bottom);
|
||||
myMatrix[10] = -2.0 / (farVal - nearVal);
|
||||
#if 1
|
||||
myMatrix[3] = -1*(right + left) / (right - left);
|
||||
myMatrix[7] = -1*(top + bottom) / (top - bottom);
|
||||
myMatrix[11] = -1*(farVal + nearVal) / (farVal - nearVal);
|
||||
#else
|
||||
// test if matrix is not corectly instanciate ...
|
||||
myMatrix[12] = -1*(right + left) / (right - left);
|
||||
myMatrix[13] = -1*(top + bottom) / (top - bottom);
|
||||
myMatrix[14] = -1*(farVal + nearVal) / (farVal - nearVal);
|
||||
#endif
|
||||
myMatrix[15] = 1;
|
||||
|
||||
glLoadMatrixf(myMatrix);
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ extern "C" {
|
||||
#if defined(__PLATFORM__Linux)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
void glOrthoEwol(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
|
||||
#elif defined(__PLATFORM__DoubleBuffer)
|
||||
|
||||
#elif defined(__PLATFORM__Android)
|
||||
|
@ -201,12 +201,11 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, et
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
|
||||
bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
|
||||
{
|
||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||
if( UTF8_data != NULL
|
||||
&& typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||
&& UTF8_data[0] == '\r') {
|
||||
if( typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||
&& unicodeData == '\r') {
|
||||
GenEventInputExternal(ewolEventButtonEnter, -1, -1);
|
||||
}
|
||||
return false;
|
||||
|
@ -62,7 +62,7 @@ namespace ewol {
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -168,13 +168,12 @@ bool ewol::CheckBox::OnEventInput(int32_t IdInput, eventInputType_te typeEvent,
|
||||
}
|
||||
|
||||
|
||||
bool ewol::CheckBox::OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
|
||||
bool ewol::CheckBox::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData)
|
||||
{
|
||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||
if( UTF8_data != NULL
|
||||
&& typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||
&& ( UTF8_data[0] == '\r'
|
||||
|| UTF8_data[0] == ' ')
|
||||
if( typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||
&& ( unicodeData == '\r'
|
||||
|| unicodeData == ' ')
|
||||
) {
|
||||
if(true == m_value) {
|
||||
m_value = false;
|
||||
|
@ -52,7 +52,7 @@ namespace ewol {
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
virtual bool OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
||||
virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widget/Drawable.h
|
||||
* @brief basic ewol drawable widget (header)
|
||||
* @file ewol/widget/Drawable.cpp
|
||||
* @brief basic ewol drawable widget (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 18/02/2012
|
||||
* @par Project
|
||||
@ -52,7 +52,7 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
//EWOL_INFO("UPDATE AT size : (" << m_size.x << "," << m_size.y << ")");
|
||||
newObject->UpdateSize(m_size.x, m_size.y);
|
||||
//EWOL_INFO("UPDATE AT origin : (" << m_origin.x << "," << m_origin.y << ")");
|
||||
newObject->UpdateOrigin(m_origin.x, m_origin.y);
|
||||
//newObject->UpdateOrigin(m_origin.x, m_origin.y);
|
||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
||||
} else {
|
||||
|
@ -165,11 +165,7 @@ bool ewol::List::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkF
|
||||
//int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t minHeight = ewol::GetHeight(fontId);
|
||||
|
||||
int32_t startRaw = m_originScrooled.y / (minHeight + 2*m_paddingSizeY) - 1;
|
||||
if (startRaw<0) {
|
||||
startRaw = 0;
|
||||
}
|
||||
int32_t rawID = (y - m_origin.y) / (minHeight + 2*m_paddingSizeY) + startRaw;
|
||||
int32_t rawID = (y+m_originScrooled.y) / (minHeight + 2*m_paddingSizeY);
|
||||
//EWOL_DEBUG("OnEventInput(" << IdInput << "," << typeEvent << "," << 0 << "," << rawID << "," << x <<"," << y << ");");
|
||||
bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, x, y);
|
||||
if (true == isUsed) {
|
||||
|
@ -142,6 +142,8 @@ void ewol::PopUp::SubWidgetRemove(void)
|
||||
|
||||
bool ewol::PopUp::OnDraw(void)
|
||||
{
|
||||
// draw upper classes
|
||||
ewol::Drawable::OnDraw();
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->GenDraw();
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl
|
||||
}
|
||||
}
|
||||
coord tmpOrigin;
|
||||
tmpOrigin.x = m_origin.x;
|
||||
tmpOrigin.y = m_origin.y;
|
||||
tmpOrigin.x = 0;
|
||||
tmpOrigin.y = 0;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
coord tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
|
@ -73,8 +73,8 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl
|
||||
}
|
||||
}
|
||||
coord tmpOrigin;
|
||||
tmpOrigin.x = m_origin.x;
|
||||
tmpOrigin.y = m_origin.y;
|
||||
tmpOrigin.x = 0;
|
||||
tmpOrigin.y = 0;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
coord tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
|
@ -71,8 +71,6 @@ bool ewol::WidgetScrooled::OnEventInput(int32_t IdInput, ewol::eventInputType_te
|
||||
#ifdef __MODE__Touch
|
||||
if (1 == IdInput) {
|
||||
EWOL_VERBOSE("event 1 << " << (int32_t)typeEvent << "(" << x << "," << y << ")");
|
||||
x -= m_origin.x;
|
||||
y -= m_origin.y;
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_INIT;
|
||||
m_highSpeedStartPos.x = x;
|
||||
@ -133,8 +131,6 @@ bool ewol::WidgetScrooled::OnEventInput(int32_t IdInput, ewol::eventInputType_te
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}else if (2 == IdInput) {
|
||||
x -= m_origin.x;
|
||||
y -= m_origin.y;
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_INIT;
|
||||
m_highSpeedStartPos.x = x;
|
||||
|
@ -71,7 +71,6 @@ const char * const ewolEventFileChooserSelectFolder = "ewol-event-file-chooser
|
||||
class FileChooserFolderList : public ewol::List
|
||||
{
|
||||
private:
|
||||
//etk::Vector<etk::UString> m_listDirectory;
|
||||
etk::VectorType<etk::UString *> m_listDirectory;
|
||||
int32_t m_selectedLine;
|
||||
public:
|
||||
@ -467,7 +466,7 @@ ewol::FileChooser::~FileChooser(void)
|
||||
|
||||
void ewol::FileChooser::SetTitle(etk::UString label)
|
||||
{
|
||||
ewol::Label * tmpWidget = reinterpret_cast<ewol::Label*>(ewol::widgetManager::Get(m_widgetTitleId));
|
||||
ewol::Label * tmpWidget = dynamic_cast<ewol::Label*>(ewol::widgetManager::Get(m_widgetTitleId));
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
@ -476,7 +475,7 @@ void ewol::FileChooser::SetTitle(etk::UString label)
|
||||
|
||||
void ewol::FileChooser::SetValidateLabel(etk::UString label)
|
||||
{
|
||||
ewol::Button * tmpWidget = reinterpret_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetValidateId));
|
||||
ewol::Button * tmpWidget = dynamic_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetValidateId));
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
@ -485,7 +484,7 @@ void ewol::FileChooser::SetValidateLabel(etk::UString label)
|
||||
|
||||
void ewol::FileChooser::SetCancelLabel(etk::UString label)
|
||||
{
|
||||
ewol::Button * tmpWidget = reinterpret_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetCancelId));
|
||||
ewol::Button * tmpWidget = dynamic_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetCancelId));
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
@ -501,7 +500,7 @@ void ewol::FileChooser::SetFolder(etk::UString folder)
|
||||
void ewol::FileChooser::SetFileName(etk::UString filename)
|
||||
{
|
||||
m_file = filename;
|
||||
ewol::Entry * tmpWidget = reinterpret_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||
ewol::Entry * tmpWidget = dynamic_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
@ -519,7 +518,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
||||
return true;
|
||||
} else if (ewolEventFileChooserEntryFile == generateEventId) {
|
||||
//==> change the file name
|
||||
ewol::Entry * tmpWidget = reinterpret_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||
ewol::Entry * tmpWidget = dynamic_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||
if (NULL != tmpWidget) {
|
||||
m_file = tmpWidget->GetValue();
|
||||
}
|
||||
@ -536,7 +535,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
||||
return true;
|
||||
} else if (ewolEventFileChooserSelectFolder == generateEventId) {
|
||||
//==> this is an internal event ...
|
||||
FileChooserFolderList * myListFolder = reinterpret_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||
FileChooserFolderList * myListFolder = dynamic_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||
etk::UString tmpString = myListFolder->GetSelectedLine();
|
||||
EWOL_DEBUG(" old PATH : \"" << m_folder << "\" + \"" << tmpString << "\"");
|
||||
m_folder = m_folder + tmpString;
|
||||
@ -561,17 +560,16 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
||||
return true;
|
||||
} else if (ewolEventFileChooserSelectFile == generateEventId) {
|
||||
m_hasSelectedFile = true;
|
||||
FileChooserFileList * myListFile = reinterpret_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||
FileChooserFileList * myListFile = dynamic_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||
etk::UString file = myListFile->GetSelectedLine();
|
||||
SetFileName(file);
|
||||
GenEventInputExternal(generateEventId, x, y);
|
||||
} else if (ewolEventFileChooserValidateFile == generateEventId) {
|
||||
} else if( ewolEventFileChooserValidateFile == generateEventId
|
||||
|| (ewolEventFileChooserValidate == generateEventId && true == m_hasSelectedFile) ) {
|
||||
// select the File ==> generate a validate
|
||||
bool tmppp = GenEventInputExternal(ewolEventFileChooserValidate, x, y);
|
||||
ewol::RmPopUp(GetWidgetId());
|
||||
return tmppp;
|
||||
} else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@ -580,10 +578,10 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
||||
|
||||
void ewol::FileChooser::UpdateCurrentFolder(void)
|
||||
{
|
||||
FileChooserFileList * myListFile = reinterpret_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||
FileChooserFolderList * myListFolder = reinterpret_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||
ewol::Entry * myEntry = reinterpret_cast<ewol::Entry *>(ewol::widgetManager::Get(m_widgetCurrentFolderId));
|
||||
ewol::CheckBox * myhidenFiles = reinterpret_cast<ewol::CheckBox *>(ewol::widgetManager::Get(m_widgetCheckBoxId));
|
||||
FileChooserFileList * myListFile = dynamic_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||
FileChooserFolderList * myListFolder = dynamic_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||
ewol::Entry * myEntry = dynamic_cast<ewol::Entry *>(ewol::widgetManager::Get(m_widgetCurrentFolderId));
|
||||
ewol::CheckBox * myhidenFiles = dynamic_cast<ewol::CheckBox *>(ewol::widgetManager::Get(m_widgetCheckBoxId));
|
||||
|
||||
myListFile->ClearElements();
|
||||
myListFolder->ClearElements();
|
||||
@ -604,7 +602,7 @@ void ewol::FileChooser::UpdateCurrentFolder(void)
|
||||
struct dirent *ent;
|
||||
dir = opendir(m_folder.Utf8Data());
|
||||
if (dir != NULL) {
|
||||
/* print all the files and directories within directory */
|
||||
// for each element in the drectory...
|
||||
while ((ent = readdir(dir)) != NULL) {
|
||||
etk::UString tmpString(ent->d_name);
|
||||
if (DT_REG == ent->d_type) {
|
||||
|
@ -182,7 +182,7 @@ bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generate
|
||||
{
|
||||
EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << data << "\"" );
|
||||
if (ewolEventKeyEvent == generateEventId) {
|
||||
ewol::Button * bt = reinterpret_cast<ewol::Button *>(ewol::widgetManager::Get(widgetID));
|
||||
ewol::Button * bt = dynamic_cast<ewol::Button *>(ewol::widgetManager::Get(widgetID));
|
||||
EWOL_DEBUG("kbevent : \"" << bt->GetLabel() << "\"");
|
||||
etk::UString data = bt->GetLabel();
|
||||
if (data == "DEL") {
|
||||
|
@ -18,6 +18,7 @@ FILE_LIST = ewol/ewol.cpp \
|
||||
ewol/WidgetMessageMultiCast.cpp \
|
||||
ewol/Windows.cpp \
|
||||
ewol/widget/WidgetScrolled.cpp \
|
||||
ewol/widget/WidgetShortCut.cpp \
|
||||
ewol/widget/Drawable.cpp \
|
||||
ewol/widget/Button.cpp \
|
||||
ewol/widget/Label.cpp \
|
||||
|
Loading…
x
Reference in New Issue
Block a user