From c4b70a4bdc9f86351aa42963d18e384b655d2094 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Thu, 8 Mar 2012 18:08:25 +0100 Subject: [PATCH] Some clean and normalisation --- Sources/libetk/Linux.mk | 10 ++ Sources/libetk/etk/Stream.h | 25 +++ Sources/libetk/etk/Types.h | 19 +-- Sources/libewol/Linux.mk | 12 +- Sources/libewol/ewol/Widget.cpp | 15 +- Sources/libewol/ewol/Widget.h | 9 +- Sources/libewol/ewol/Windows.cpp | 6 +- Sources/libewol/ewol/Windows.h | 5 + Sources/libewol/ewol/base/MainThread.cpp | 4 - .../ewol/base/eventInputManagement.cpp | 149 ++++++++++++++---- Sources/libewol/ewol/widget/ContextMenu.cpp | 6 + Sources/libewol/ewol/widget/ContextMenu.h | 5 + Sources/libewol/ewol/widget/PopUp.cpp | 24 +-- Sources/libewol/ewol/widget/PopUp.h | 6 +- Sources/libewol/ewol/widget/SizerHori.cpp | 24 +-- Sources/libewol/ewol/widget/SizerHori.h | 6 +- Sources/libewol/ewol/widget/SizerVert.cpp | 23 +-- Sources/libewol/ewol/widget/SizerVert.h | 7 +- Sources/libewol/ewol/widgetMeta/Keyboard.cpp | 21 ++- Sources/libewol/ewol/widgetMeta/Keyboard.h | 13 +- 20 files changed, 256 insertions(+), 133 deletions(-) diff --git a/Sources/libetk/Linux.mk b/Sources/libetk/Linux.mk index 08557d32..0bc8a9d0 100644 --- a/Sources/libetk/Linux.mk +++ b/Sources/libetk/Linux.mk @@ -10,12 +10,22 @@ LOCAL_C_INCLUDES := -I$(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_LDLIBS := +ifeq ($(DEBUG),1) LOCAL_CFLAGS := -D__PLATFORM__Linux \ -Wno-write-strings \ -DETK_DEBUG_LEVEL=3 \ -DEWOL_DEBUG_LEVEL=3 \ -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ -DVERSION_BUILD_TIME="\"pasd_heure\"" +else +LOCAL_CFLAGS := -D__PLATFORM__Linux \ + -Wno-write-strings \ + -DETK_DEBUG_LEVEL=1 \ + -DEWOL_DEBUG_LEVEL=1 \ + -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ + -DVERSION_BUILD_TIME="\"pasd_heure\"" +endif + # load the common sources file of the platform include $(LOCAL_PATH)/file.mk diff --git a/Sources/libetk/etk/Stream.h b/Sources/libetk/etk/Stream.h index 0b781e67..8bdda873 100644 --- a/Sources/libetk/etk/Stream.h +++ b/Sources/libetk/etk/Stream.h @@ -124,6 +124,31 @@ namespace etk{ } return *this; } + CCout& operator << (coord2D_ts t) { + snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", t.x, t.y); + strncat(m_tmpChar, tmp, MAX_LOG_SIZE); + return *this; + } + CCout& operator << (coord3D_ts t) { + snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", t.x, t.y, t.z); + strncat(m_tmpChar, tmp, MAX_LOG_SIZE); + return *this; + } + CCout& operator << (texCoord_ts t) { + snprintf(tmp, MAX_LOG_SIZE_TMP, "{%f,%f}", t.u, t.v); + strncat(m_tmpChar, tmp, MAX_LOG_SIZE); + return *this; + } + CCout& operator << (color_ts t) { + snprintf(tmp, MAX_LOG_SIZE_TMP, "(r=%f,g=%f,b=%f,a=%f)", t.red, t.green, t.blue, t.alpha); + strncat(m_tmpChar, tmp, MAX_LOG_SIZE); + return *this; + } + CCout& operator << (clipping_ts t) { + snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h); + strncat(m_tmpChar, tmp, MAX_LOG_SIZE); + return *this; + } CCout& operator << (CStart ccc) { pthread_mutex_lock(&m_mutex); return *this; diff --git a/Sources/libetk/etk/Types.h b/Sources/libetk/etk/Types.h index b700a49a..f060f95c 100644 --- a/Sources/libetk/etk/Types.h +++ b/Sources/libetk/etk/Types.h @@ -25,9 +25,7 @@ #ifndef __ETK_TYPES_H__ #define __ETK_TYPES_H__ -// includes system, malloc, EXIT_SUCCESS #include -// includes fopen, fwrite, fseek, ftell #include #include #include @@ -72,30 +70,17 @@ extern "C" #define oglTypeFloat_t GL_FLOAT #endif - struct etkPointAndPositionDouble{ - etkFloat_t x; - etkFloat_t y; - }; - - struct etkPointAndPositionInt{ - int32_t x; - int32_t y; - }; - - typedef etkPointAndPositionDouble point_ts; - typedef etkPointAndPositionDouble position_ts; - typedef etkPointAndPositionDouble size_ts; - typedef etkPointAndPositionInt intSize_ts; - typedef struct { etkFloat_t x; etkFloat_t y; etkFloat_t z; }coord3D_ts; + typedef struct { etkFloat_t x; etkFloat_t y; }coord2D_ts; + typedef struct { etkFloat_t u; etkFloat_t v; diff --git a/Sources/libewol/Linux.mk b/Sources/libewol/Linux.mk index 393842cc..ca6e8e54 100644 --- a/Sources/libewol/Linux.mk +++ b/Sources/libewol/Linux.mk @@ -10,6 +10,7 @@ LOCAL_C_INCLUDES := -I$(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_LDLIBS := -lGL -lGLU -lz -lX11 +ifeq ($(DEBUG),1) LOCAL_CFLAGS := -D__PLATFORM__Linux \ -Wno-write-strings \ -DETK_DEBUG_LEVEL=3 \ @@ -17,8 +18,15 @@ LOCAL_CFLAGS := -D__PLATFORM__Linux \ -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ -DVERSION_BUILD_TIME="\"pasd_heure\"" \ -DEWOL_USE_FREE_TYPE - -# `pkg-config --cflags freetype2` +else +LOCAL_CFLAGS := -D__PLATFORM__Linux \ + -Wno-write-strings \ + -DETK_DEBUG_LEVEL=1 \ + -DEWOL_DEBUG_LEVEL=1 \ + -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ + -DVERSION_BUILD_TIME="\"pasd_heure\"" \ + -DEWOL_USE_FREE_TYPE +endif # load the common sources file of the platform include $(LOCAL_PATH)/file.mk diff --git a/Sources/libewol/ewol/Widget.cpp b/Sources/libewol/ewol/Widget.cpp index 770e4991..7e30e395 100644 --- a/Sources/libewol/ewol/Widget.cpp +++ b/Sources/libewol/ewol/Widget.cpp @@ -133,22 +133,17 @@ ewol::Widget * ewol::Widget::GetWidgetAtPos(coord2D_ts pos) return this; } -bool ewol::Widget::GenEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos) -{ - eventPosition_ts eventPos; - eventPos.abs = pos; - eventPos.local.x = pos.x - m_origin.x; - eventPos.local.y = pos.y - m_origin.y; - //EWOL_DEBUG(" event on abs=(" << eventPos.abs.x << "," << eventPos.abs.y << ") local=(" << eventPos.local.x << "," << eventPos.local.y << ")"); - return OnEventInput(IdInput, typeEvent, eventPos); -} bool ewol::Widget::GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue) { return false; } - +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::Widget::OnFlipFlopEvent(void) { if (true == m_needFlipFlop) { diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index cfad0cee..af285e78 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -170,11 +170,7 @@ namespace ewol { * @return pointer on the widget found */ virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); - // external acces to set an input event on this widget. - // TODO : deprecated ... - bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos); // call when input event arrive and call OnEventInput, if no event detected virtual bool GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue); - // TODO : Remasterised ... /** * @brief Manage input event of this Widget * @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger)) @@ -202,6 +198,11 @@ namespace ewol { void MarkToReedraw(void) { m_needRegenerateDisplay = true; }; bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; }; public: + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); public: bool GenDraw(void); diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 6eb08ca9..f545ce8d 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -290,7 +290,11 @@ void ewol::Windows::KeyboardHide(void) } - +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::Windows::OnFlipFlopEvent(void) { bool needFlipFlop = m_needFlipFlop; diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index ccc7117d..933105ef 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -87,6 +87,11 @@ namespace ewol { public: void KeyboardShow(ewol::keyboardMode_te mode); void KeyboardHide(void); + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); /** * @brief Inform object that an other object is removed ... diff --git a/Sources/libewol/ewol/base/MainThread.cpp b/Sources/libewol/ewol/base/MainThread.cpp index 33882f2e..b9c5c5fb 100644 --- a/Sources/libewol/ewol/base/MainThread.cpp +++ b/Sources/libewol/ewol/base/MainThread.cpp @@ -151,10 +151,6 @@ static void* BaseAppEntry(void* param) //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); { eventInputState_ts * tmpData = (eventInputState_ts*)data.data; - bool isdown = true; - if (true==tmpData->state) { - isdown = false; - } coord2D_ts pos; pos.x = tmpData->x; pos.y = tmpData->y; diff --git a/Sources/libewol/ewol/base/eventInputManagement.cpp b/Sources/libewol/ewol/base/eventInputManagement.cpp index d8a18c9d..1ceea2f4 100644 --- a/Sources/libewol/ewol/base/eventInputManagement.cpp +++ b/Sources/libewol/ewol/base/eventInputManagement.cpp @@ -26,8 +26,8 @@ typedef struct { coord2D_ts origin; coord2D_ts size; coord2D_ts downStart; - coord2D_ts lastEventPos; bool isDown; + bool isInside; int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 } InputPoperty_ts; @@ -37,7 +37,7 @@ InputPoperty_ts eventInputSaved[MAX_MANAGE_INPUT]; /** * @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] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject * @note : Sub classes must call this class * @return --- */ @@ -58,18 +58,18 @@ static void CleanInputElement(int32_t idInput) eventInputSaved[idInput].curentWidgetEvent = NULL; eventInputSaved[idInput].origin.x = 0; eventInputSaved[idInput].origin.y = 0; - eventInputSaved[idInput].size.x = 0; - eventInputSaved[idInput].size.y = 0; + eventInputSaved[idInput].size.x = 99999999; + eventInputSaved[idInput].size.y = 99999999; eventInputSaved[idInput].downStart.x = 0; eventInputSaved[idInput].downStart.y = 0; - eventInputSaved[idInput].lastEventPos.x = 0; - eventInputSaved[idInput].lastEventPos.y = 0; eventInputSaved[idInput].isDown = false; + eventInputSaved[idInput].isInside = true; eventInputSaved[idInput].nbClickEvent = 0; } void ewol::eventInput::Init(void) { + EWOL_INFO("Init"); for(int32_t iii=0; iii on PC, the ID does not change (IHM is not the same + * + * @param[in] destWidget Pointer of the widget destination + * @param[in] realInputId System Id + * + * @return the ewol input id + */ +static int32_t localGetDestinationId(ewol::Widget* destWidget, int32_t realInputId) +{ + #ifdef __MODE__Touch + int32_t lastMinimum = 0; + for(int32_t iii=0; iii MAX_MANAGE_INPUT - || pointerID < 0) { + || pointerID <= 0) { // not manage input return; } if (true == eventInputSaved[pointerID].isUsed) { - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [MOVE] (" << pos.x << "," << pos.y << ")"); - localEventInput(eventInputSaved[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_MOVE, pos); + + if (true == eventInputSaved[pointerID].isInside) { + if( eventInputSaved[pointerID].origin.x > pos.x + || eventInputSaved[pointerID].origin.y > pos.y + || (eventInputSaved[pointerID].origin.x + eventInputSaved[pointerID].size.x) < pos.x + || (eventInputSaved[pointerID].origin.y + eventInputSaved[pointerID].size.y) < pos.y) { + eventInputSaved[pointerID].isInside = false; + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [LEAVE] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos); + } + } else { + if( ( eventInputSaved[pointerID].origin.x <= pos.x + && (eventInputSaved[pointerID].origin.x + eventInputSaved[pointerID].size.x) >= pos.x ) + && ( eventInputSaved[pointerID].origin.y <= pos.y + && (eventInputSaved[pointerID].origin.y + eventInputSaved[pointerID].size.y) >= pos.y ) ) { + eventInputSaved[pointerID].isInside = true; + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [ENTER] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos); + } + } + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [MOVE] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos); } } void ewol::eventInput::State(int pointerID, bool isDown, coord2D_ts pos) { if( pointerID > MAX_MANAGE_INPUT - || pointerID < 0) { + || pointerID <= 0) { // not manage input return; } @@ -140,9 +188,22 @@ void ewol::eventInput::State(int pointerID, bool isDown, coord2D_ts pos) int64_t currentTime = GetCurrentTime(); if (true == isDown) { - EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [DOWN] x=" << pos.x << " y=" << pos.y); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [DOWN] " << pos); if(true == eventInputSaved[pointerID].isUsed) { - // bad case ... ??? + // we have an event previously ... check delay between click and offset position + if (currentTime - eventInputSaved[pointerID].lastTimeEvent > separateClickTime) { + CleanInputElement(pointerID); + } else if( abs(eventInputSaved[pointerID].downStart.x - pos.x) >= offsetMoveClicked + || abs(eventInputSaved[pointerID].downStart.y - pos.y) >= offsetMoveClicked ){ + CleanInputElement(pointerID); + } + } + if(true == eventInputSaved[pointerID].isUsed) { + // save start time + eventInputSaved[pointerID].lastTimeEvent = currentTime; + // generate DOWN Event + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [DOWN] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos); } else { // Mark it used : eventInputSaved[pointerID].isUsed = true; @@ -150,28 +211,37 @@ void ewol::eventInput::State(int pointerID, bool isDown, coord2D_ts pos) eventInputSaved[pointerID].downStart = pos; // save start time eventInputSaved[pointerID].lastTimeEvent = currentTime; + // Set the element inside ... + eventInputSaved[pointerID].isInside = true; // get destination widget : if(NULL != gui_uniqueWindows) { eventInputSaved[pointerID].curentWidgetEvent = gui_uniqueWindows->GetWidgetAtPos(pos); } else { eventInputSaved[pointerID].curentWidgetEvent = NULL; } + if (NULL != eventInputSaved[pointerID].curentWidgetEvent) { + eventInputSaved[pointerID].origin = eventInputSaved[pointerID].curentWidgetEvent->GetOrigin(); + eventInputSaved[pointerID].size = eventInputSaved[pointerID].curentWidgetEvent->GetSize(); + eventInputSaved[pointerID].destinationInputId = localGetDestinationId(eventInputSaved[pointerID].curentWidgetEvent, pointerID); + } else { + eventInputSaved[pointerID].destinationInputId = -1; + } // generate DOWN Event - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [DOWN] (" << pos.x << "," << pos.y << ")"); - localEventInput(eventInputSaved[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_DOWN, pos); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [DOWN] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos); } } else { - EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [UP] (" << pos.x << "," << pos.y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [UP] " << pos); if(false == eventInputSaved[pointerID].isUsed) { // bad case ... ??? - EWOL_WARNING("Up event without previous down ... "); + EWOL_VERBOSE("Up event without previous down ... "); // Mark it un-used : eventInputSaved[pointerID].isUsed = false; // revove the widget ... eventInputSaved[pointerID].curentWidgetEvent = NULL; } else { // generate UP Event - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [UP] (" << pos.x << "," << pos.y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [UP] " << pos); localEventInput(eventInputSaved[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos); // generate event (single) if( abs(eventInputSaved[pointerID].downStart.x - pos.x) < offsetMoveClicked @@ -180,14 +250,33 @@ void ewol::eventInput::State(int pointerID, bool isDown, coord2D_ts pos) eventInputSaved[pointerID].downStart = pos; // save start time eventInputSaved[pointerID].lastTimeEvent = currentTime; - // generate event : - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [SINGLE] (" << pos.x << "," << pos.y << ")"); - localEventInput(eventInputSaved[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_SINGLE, pos); + if (eventInputSaved[pointerID].nbClickEvent == 0) { + // generate event SINGLE : + eventInputSaved[pointerID].nbClickEvent++; + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [SINGLE] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_SINGLE, pos); + } else if (eventInputSaved[pointerID].nbClickEvent == 1) { + // generate event DOUBLE : + eventInputSaved[pointerID].nbClickEvent++; + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [DOUBLE] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOUBLE, pos); + } else if (eventInputSaved[pointerID].nbClickEvent == 2) { + // generate event TRIPLE : + eventInputSaved[pointerID].nbClickEvent++; + EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [TRIPLE] " << pos); + localEventInput(eventInputSaved[pointerID].curentWidgetEvent, eventInputSaved[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_TRIPLE, pos); + } else { + #if 0 + eventInputSaved[pointerID].nbClickEvent++; + EWOL_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventInputSaved[pointerID].destinationInputId << " [" << eventInputSaved[pointerID].nbClickEvent <<"] (" << pos.x << "," << pos.y << ")"); + #else + eventInputSaved[pointerID].nbClickEvent = 0; + #endif + } } - // Mark it un-used : - eventInputSaved[pointerID].isUsed = false; - // revove the widget ... - eventInputSaved[pointerID].curentWidgetEvent = NULL; + #ifdef __MODE__Touch + CleanInputElement(pointerID); + #endif } } } diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index 76d21585..6da21c89 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -318,6 +318,12 @@ void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arr MarkToReedraw(); } + +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::ContextMenu::OnFlipFlopEvent(void) { //EWOL_DEBUG("Flip-Flop"); diff --git a/Sources/libewol/ewol/widget/ContextMenu.h b/Sources/libewol/ewol/widget/ContextMenu.h index 4b293b62..99c2ad2b 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.h +++ b/Sources/libewol/ewol/widget/ContextMenu.h @@ -74,6 +74,11 @@ namespace ewol { */ virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos); + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); }; }; diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index c94f28da..41084172 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -205,30 +205,18 @@ ewol::Widget * ewol::PopUp::GetWidgetAtPos(coord2D_ts pos) return this; } -bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) -{ -/* - if (NULL != m_subWidget[m_currentCreateId]) { - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); - if( (tmpOrigin.x <= pos.local.x && tmpOrigin.x + tmpSize.x >= pos.local.x) - && (tmpOrigin.y <= pos.local.y && tmpOrigin.y + tmpSize.y >= pos.local.y) ) - { - return m_subWidget[m_currentCreateId]->GenEventInput(IdInput, typeEvent, pos.abs); - } else { - //EWOL_INFO("Event ouside the Pop-up"); - } - } -*/ - return true; -} - void ewol::PopUp::SetDisplayRatio(etkFloat_t ratio) { m_displayRatio = ratio; } + +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::PopUp::OnFlipFlopEvent(void) { bool needFlipFlop = m_needFlipFlop; diff --git a/Sources/libewol/ewol/widget/PopUp.h b/Sources/libewol/ewol/widget/PopUp.h index bfd76c26..082dfffc 100644 --- a/Sources/libewol/ewol/widget/PopUp.h +++ b/Sources/libewol/ewol/widget/PopUp.h @@ -63,7 +63,11 @@ namespace ewol { * @return pointer on the widget found */ virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); - virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos); + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); /** * @brief Inform object that an other object is removed ... diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 5434e591..1dfb3c98 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -259,25 +259,11 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(coord2D_ts pos) } -bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) -{ -/* - for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); - if( (tmpOrigin.x <= pos.abs.x && tmpOrigin.x + tmpSize.x >= pos.abs.x) - && (tmpOrigin.y <= pos.abs.y && tmpOrigin.y + tmpSize.y >= pos.abs.y) ) - { - return m_subWidget[m_currentCreateId][iii]->GenEventInput(IdInput, typeEvent, pos.abs); - } - } - } -*/ - return true; -} - - +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::SizerHori::OnFlipFlopEvent(void) { bool needFlipFlop = m_needFlipFlop; diff --git a/Sources/libewol/ewol/widget/SizerHori.h b/Sources/libewol/ewol/widget/SizerHori.h index e14a48ea..d72a3d14 100644 --- a/Sources/libewol/ewol/widget/SizerHori.h +++ b/Sources/libewol/ewol/widget/SizerHori.h @@ -63,7 +63,11 @@ namespace ewol { * @return pointer on the widget found */ virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); - virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos); + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); /** * @brief Inform object that an other object is removed ... diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 0357b861..11ec7168 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -258,24 +258,12 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(coord2D_ts pos) return this; } -bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) -{ -/* - for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); - if( (tmpOrigin.x <= pos.abs.x && tmpOrigin.x + tmpSize.x >= pos.abs.x) - && (tmpOrigin.y <= pos.abs.y && tmpOrigin.y + tmpSize.y >= pos.abs.y) ) - { - return m_subWidget[m_currentCreateId][iii]->GenEventInput(IdInput, typeEvent, pos.abs); - } - } - } -*/ - return true; -} +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::SizerVert::OnFlipFlopEvent(void) { bool needFlipFlop = m_needFlipFlop; @@ -293,6 +281,7 @@ void ewol::SizerVert::OnFlipFlopEvent(void) } } + /** * @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 diff --git a/Sources/libewol/ewol/widget/SizerVert.h b/Sources/libewol/ewol/widget/SizerVert.h index 7496ab51..04de0b1d 100644 --- a/Sources/libewol/ewol/widget/SizerVert.h +++ b/Sources/libewol/ewol/widget/SizerVert.h @@ -64,8 +64,11 @@ namespace ewol { * @return pointer on the widget found */ virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); - - virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos); + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); /** * @brief Inform object that an other object is removed ... diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp index 3b640c23..f430749d 100644 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp +++ b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp @@ -313,16 +313,21 @@ void ewol::Keyboard::OnRegenerateDisplay(void) } } -bool ewol::Keyboard::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) + +/** + * @brief Get the widget at the specific windows absolute position + * @param[in] pos gAbsolute position of the requested widget knowledge + * @return NULL No widget found + * @return pointer on the widget found + */ +ewol::Widget * ewol::Keyboard::GetWidgetAtPos(coord2D_ts pos) { if (NULL != m_subWidget[m_currentCreateId]) { - return m_subWidget[m_currentCreateId]->GenEventInput(IdInput, typeEvent, pos.abs); + return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos); } - return false; + return this; } - - /** * @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 @@ -339,7 +344,11 @@ void ewol::Keyboard::OnObjectRemove(ewol::EObject * removeObject) } - +/** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ void ewol::Keyboard::OnFlipFlopEvent(void) { bool needFlipFlop = m_needFlipFlop; diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.h b/Sources/libewol/ewol/widgetMeta/Keyboard.h index fab14668..bf63b95d 100644 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.h +++ b/Sources/libewol/ewol/widgetMeta/Keyboard.h @@ -43,6 +43,11 @@ namespace ewol { public: Keyboard(void); ~Keyboard(void); + /** + * @brief Event generated to inform a flip-flop has occured on the current widget + * @param --- + * @return --- + */ virtual void OnFlipFlopEvent(void); /** * @brief Receive a message from an other EObject with a specific eventId and data @@ -59,6 +64,13 @@ namespace ewol { * @return --- */ virtual void OnObjectRemove(ewol::EObject * removeObject); + /** + * @brief Get the widget at the specific windows absolute position + * @param[in] pos gAbsolute position of the requested widget knowledge + * @return NULL No widget found + * @return pointer on the widget found + */ + virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); void SetMode(keyboardMode_te mode); bool IsHide(void) { return m_isHide; }; void Hide(void) { m_isHide=true; }; @@ -77,7 +89,6 @@ namespace ewol { virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1); virtual void SetExpendX(bool newExpend=false); virtual void SetExpendY(bool newExpend=false); - virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos); }; };