diff --git a/Sources/libewol/ewol/OObject.h b/Sources/libewol/ewol/OObject.h index e7858655..e1602b5e 100644 --- a/Sources/libewol/ewol/OObject.h +++ b/Sources/libewol/ewol/OObject.h @@ -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) { }; }; }; diff --git a/Sources/libewol/ewol/OObject/2DColored.cpp b/Sources/libewol/ewol/OObject/2DColored.cpp index 7dbb322d..f645850d 100644 --- a/Sources/libewol/ewol/OObject/2DColored.cpp +++ b/Sources/libewol/ewol/OObject/2DColored.cpp @@ -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 & input, etk::VectorType & output ) { diff --git a/Sources/libewol/ewol/OObject/2DColored.h b/Sources/libewol/ewol/OObject/2DColored.h index 4794416e..1487e712 100644 --- a/Sources/libewol/ewol/OObject/2DColored.h +++ b/Sources/libewol/ewol/OObject/2DColored.h @@ -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); }; }; diff --git a/Sources/libewol/ewol/OObject/2DText.cpp b/Sources/libewol/ewol/OObject/2DText.cpp index e1d733e6..c2f0245e 100644 --- a/Sources/libewol/ewol/OObject/2DText.cpp +++ b/Sources/libewol/ewol/OObject/2DText.cpp @@ -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; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point - public: - virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y); }; }; diff --git a/Sources/libewol/ewol/OObject/2DTextColored.cpp b/Sources/libewol/ewol/OObject/2DTextColored.cpp index 42454efe..02735d12 100644 --- a/Sources/libewol/ewol/OObject/2DTextColored.cpp +++ b/Sources/libewol/ewol/OObject/2DTextColored.cpp @@ -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; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point - public: - virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y); }; }; diff --git a/Sources/libewol/ewol/Widget.cpp b/Sources/libewol/ewol/Widget.cpp index 67969f9f..cdeda7dd 100644 --- a/Sources/libewol/ewol/Widget.cpp +++ b/Sources/libewol/ewol/Widget.cpp @@ -25,7 +25,7 @@ #include #include #include - +#include 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; +} diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index b786fc14..242fa985 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -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 m_inputShortCutEvent; //!< generic short-cut event etk::VectorType m_externEvent; //!< Generic list of event generation for output link etk::VectorType 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 diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 85b75c60..c0c7785f 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -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); diff --git a/Sources/libewol/ewol/base/gui.cpp b/Sources/libewol/ewol/base/gui.cpp index e0343f35..5d74202c 100644 --- a/Sources/libewol/ewol/base/gui.cpp +++ b/Sources/libewol/ewol/base/gui.cpp @@ -312,3 +312,38 @@ void EWOL_NativeGLDestroy(void) ewol::UpdateTextureContextIsDestroy(); } + +#include + + +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); + + +} diff --git a/Sources/libewol/ewol/importgl.h b/Sources/libewol/ewol/importgl.h index db83feb3..eab113df 100644 --- a/Sources/libewol/ewol/importgl.h +++ b/Sources/libewol/ewol/importgl.h @@ -9,6 +9,7 @@ extern "C" { #if defined(__PLATFORM__Linux) #include #include + void glOrthoEwol(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal); #elif defined(__PLATFORM__DoubleBuffer) #elif defined(__PLATFORM__Android) diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 49954585..6c93bb52 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -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; diff --git a/Sources/libewol/ewol/widget/Button.h b/Sources/libewol/ewol/widget/Button.h index cc76064a..0b25bbaa 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -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); }; }; diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index 343ebbb5..6c476fcd 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -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; diff --git a/Sources/libewol/ewol/widget/CheckBox.h b/Sources/libewol/ewol/widget/CheckBox.h index ca4ab755..05dd5732 100644 --- a/Sources/libewol/ewol/widget/CheckBox.h +++ b/Sources/libewol/ewol/widget/CheckBox.h @@ -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); }; }; diff --git a/Sources/libewol/ewol/widget/Drawable.cpp b/Sources/libewol/ewol/widget/Drawable.cpp index 1acf53ab..1dd81516 100644 --- a/Sources/libewol/ewol/widget/Drawable.cpp +++ b/Sources/libewol/ewol/widget/Drawable.cpp @@ -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 { diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 96c1e38b..743ca8f3 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -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) { diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index deb167a6..39d22162 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -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(); } diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 5d1b0a73..6ecceb72 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -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; iiiGetMinSize(); diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index e7fdc4f0..a28df76b 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -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; iiiGetMinSize(); diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.cpp b/Sources/libewol/ewol/widget/WidgetScrolled.cpp index 82bfdf27..1125d796 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.cpp +++ b/Sources/libewol/ewol/widget/WidgetScrolled.cpp @@ -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; diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index 4e8fcfbf..ed3a9bb1 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -71,7 +71,6 @@ const char * const ewolEventFileChooserSelectFolder = "ewol-event-file-chooser class FileChooserFolderList : public ewol::List { private: - //etk::Vector m_listDirectory; etk::VectorType 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::widgetManager::Get(m_widgetTitleId)); + ewol::Label * tmpWidget = dynamic_cast(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::widgetManager::Get(m_widgetValidateId)); + ewol::Button * tmpWidget = dynamic_cast(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::widgetManager::Get(m_widgetCancelId)); + ewol::Button * tmpWidget = dynamic_cast(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::widgetManager::Get(m_widgetCurrentFileNameId)); + ewol::Entry * tmpWidget = dynamic_cast(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::widgetManager::Get(m_widgetCurrentFileNameId)); + ewol::Entry * tmpWidget = dynamic_cast(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(ewol::widgetManager::Get(m_widgetListFolderId)); + FileChooserFolderList * myListFolder = dynamic_cast(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(ewol::widgetManager::Get(m_widgetListFileId)); + FileChooserFileList * myListFile = dynamic_cast(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(ewol::widgetManager::Get(m_widgetListFileId)); - FileChooserFolderList * myListFolder = reinterpret_cast(ewol::widgetManager::Get(m_widgetListFolderId)); - ewol::Entry * myEntry = reinterpret_cast(ewol::widgetManager::Get(m_widgetCurrentFolderId)); - ewol::CheckBox * myhidenFiles = reinterpret_cast(ewol::widgetManager::Get(m_widgetCheckBoxId)); + FileChooserFileList * myListFile = dynamic_cast(ewol::widgetManager::Get(m_widgetListFileId)); + FileChooserFolderList * myListFolder = dynamic_cast(ewol::widgetManager::Get(m_widgetListFolderId)); + ewol::Entry * myEntry = dynamic_cast(ewol::widgetManager::Get(m_widgetCurrentFolderId)); + ewol::CheckBox * myhidenFiles = dynamic_cast(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) { diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp index be1cdf20..f26155d6 100644 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp +++ b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp @@ -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::widgetManager::Get(widgetID)); + ewol::Button * bt = dynamic_cast(ewol::widgetManager::Get(widgetID)); EWOL_DEBUG("kbevent : \"" << bt->GetLabel() << "\""); etk::UString data = bt->GetLabel(); if (data == "DEL") { diff --git a/Sources/libewol/file.mk b/Sources/libewol/file.mk index ecc31e60..9ab303cf 100644 --- a/Sources/libewol/file.mk +++ b/Sources/libewol/file.mk @@ -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 \