From b4dba28f1505c41b8fb04925cc8feda39155f5a1 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Thu, 16 Feb 2012 18:19:24 +0100 Subject: [PATCH] Rewark button, add context menu management --- Sources/libetk/Android.mk | 3 +- Sources/libetk/Linux.mk | 3 +- Sources/libewol/Android.mk | 1 + Sources/libewol/Linux.mk | 4 +- Sources/libewol/ewol/Widget.h | 37 --- Sources/libewol/ewol/Windows.cpp | 8 + Sources/libewol/ewol/base/gui.cpp | 9 + Sources/libewol/ewol/ewol.h | 1 + Sources/libewol/ewol/widget/Button.cpp | 47 ++-- Sources/libewol/ewol/widget/Button.h | 5 +- Sources/libewol/ewol/widget/ContextMenu.cpp | 239 ++++++++++++++++++ Sources/libewol/ewol/widget/ContextMenu.h | 72 ++++++ Sources/libewol/ewol/widget/PopUp.cpp | 2 +- .../libewol/ewol/widgetMeta/FileChooser.cpp | 15 +- Sources/libewol/file.mk | 1 + 15 files changed, 377 insertions(+), 70 deletions(-) create mode 100644 Sources/libewol/ewol/widget/ContextMenu.cpp create mode 100644 Sources/libewol/ewol/widget/ContextMenu.h diff --git a/Sources/libetk/Android.mk b/Sources/libetk/Android.mk index 76d9e2f3..22e95565 100644 --- a/Sources/libetk/Android.mk +++ b/Sources/libetk/Android.mk @@ -15,7 +15,8 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS := -D__PLATFORM__Android \ -Wno-write-strings \ -DDATA_IN_APK \ - -DETK_DEBUG_LEVEL=3 + -DETK_DEBUG_LEVEL=3 \ + -std=c++0x diff --git a/Sources/libetk/Linux.mk b/Sources/libetk/Linux.mk index 08557d32..7caa4dea 100644 --- a/Sources/libetk/Linux.mk +++ b/Sources/libetk/Linux.mk @@ -15,7 +15,8 @@ LOCAL_CFLAGS := -D__PLATFORM__Linux \ -DETK_DEBUG_LEVEL=3 \ -DEWOL_DEBUG_LEVEL=3 \ -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ - -DVERSION_BUILD_TIME="\"pasd_heure\"" + -DVERSION_BUILD_TIME="\"pasd_heure\"" \ + -std=c++0x # load the common sources file of the platform include $(LOCAL_PATH)/file.mk diff --git a/Sources/libewol/Android.mk b/Sources/libewol/Android.mk index 4f1e9686..3ad4792e 100644 --- a/Sources/libewol/Android.mk +++ b/Sources/libewol/Android.mk @@ -19,6 +19,7 @@ LOCAL_CFLAGS := -D__PLATFORM__Android \ -DVERSION_BUILD_TIME="\"pasd_heure\"" \ -DEWOL_USE_FREE_TYPE \ -DDATA_IN_APK \ + -std=c++0x # load the common sources file of the platform include $(LOCAL_PATH)/file.mk diff --git a/Sources/libewol/Linux.mk b/Sources/libewol/Linux.mk index 5bbb58c0..d8a82aae 100644 --- a/Sources/libewol/Linux.mk +++ b/Sources/libewol/Linux.mk @@ -17,7 +17,9 @@ LOCAL_CFLAGS := -D__PLATFORM__Linux \ -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ -DVERSION_BUILD_TIME="\"pasd_heure\"" \ -DEWOL_USE_FREE_TYPE \ - `pkg-config --cflags freetype2` + -std=c++0x + +# `pkg-config --cflags freetype2` # load the common sources file of the platform include $(LOCAL_PATH)/file.mk diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index db8f2613..f95094f6 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -98,43 +98,6 @@ namespace ewol { } eventKbMoveType_te; char* GetCharTypeMoveEvent(eventKbMoveType_te type); - /* - enum { - FLAG_EVENT_INPUT_1 = 1 << 0, - FLAG_EVENT_INPUT_2 = 1 << 1, - FLAG_EVENT_INPUT_3 = 1 << 2, - FLAG_EVENT_INPUT_4 = 1 << 3, - FLAG_EVENT_INPUT_5 = 1 << 4, - FLAG_EVENT_INPUT_6 = 1 << 5, - FLAG_EVENT_INPUT_7 = 1 << 6, - FLAG_EVENT_INPUT_8 = 1 << 7, - FLAG_EVENT_INPUT_9 = 1 << 8, - FLAG_EVENT_INPUT_10 = 1 << 9, - FLAG_EVENT_INPUT_11 = 1 << 10, - FLAG_EVENT_INPUT_12 = 1 << 11, - FLAG_EVENT_INPUT_13 = 1 << 12, - FLAG_EVENT_INPUT_14 = 1 << 13, - FLAG_EVENT_INPUT_15 = 1 << 14, - FLAG_EVENT_INPUT_16 = 1 << 15, - FLAG_EVENT_INPUT_17 = 1 << 16, - - FLAG_EVENT_INPUT_MOTION = 1 << 20, - FLAG_EVENT_INPUT_ENTER = 1 << 21, - FLAG_EVENT_INPUT_LEAVE = 1 << 22, - FLAG_EVENT_INPUT_DOWN = 1 << 23, - FLAG_EVENT_INPUT_UP = 1 << 24, - FLAG_EVENT_INPUT_CLICKED = 1 << 25, - FLAG_EVENT_INPUT_CLICKED_DOUBLE = 1 << 26, - FLAG_EVENT_INPUT_CLICKED_TRIPLE = 1 << 27, - FLAG_EVENT_INPUT_CLICKED_ALL = FLAG_EVENT_INPUT_CLICKED + FLAG_EVENT_INPUT_CLICKED_DOUBLE + FLAG_EVENT_INPUT_CLICKED_TRIPLE, - }; - - #define FLAG_EVENT_INPUT_BT_LEFT (FLAG_EVENT_INPUT_1) - #define FLAG_EVENT_INPUT_BT_CENTER (FLAG_EVENT_INPUT_2) - #define FLAG_EVENT_INPUT_BT_RIGHT (FLAG_EVENT_INPUT_3) - #define FLAG_EVENT_INPUT_BT_SCROOL_UP (FLAG_EVENT_INPUT_4) - #define FLAG_EVENT_INPUT_BT_SCROOL_DOWN (FLAG_EVENT_INPUT_5) - */ #define UTF8_MAX_SIZE (8) #define EWOL_EVENT_AREA (0) diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 6b33ec12..7a0c7ed5 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -144,8 +144,16 @@ void ewol::Windows::SysDraw(void) 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); diff --git a/Sources/libewol/ewol/base/gui.cpp b/Sources/libewol/ewol/base/gui.cpp index 2364b551..7ee70f17 100644 --- a/Sources/libewol/ewol/base/gui.cpp +++ b/Sources/libewol/ewol/base/gui.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,14 @@ ewol::Windows* gui_uniqueWindows = NULL; etkFloat_t gui_width = 320; etkFloat_t gui_height = 480; +void ewol::RmPopUp(void) +{ + if (NULL != gui_uniqueWindows) { + gui_uniqueWindows->PopUpWidgetPop(); + } +} + + void EWOL_NativeResize(int w, int h ) { gui_width = w; diff --git a/Sources/libewol/ewol/ewol.h b/Sources/libewol/ewol/ewol.h index 9f02a790..825be2de 100644 --- a/Sources/libewol/ewol/ewol.h +++ b/Sources/libewol/ewol/ewol.h @@ -42,6 +42,7 @@ namespace ewol { void KeyboardShow(ewol::keyboardMode_te mode); void KeyboardHide(void); void ForceRedrawAll(void); + void RmPopUp(void); int32_t CmdLineNb(void); etk::UString CmdLineGet(int32_t id); diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 4d8cff95..523b11da 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -44,6 +44,13 @@ void ewol::Button::Init(void) AddEventId(ewolEventButtonEnter); AddEventId(ewolEventButtonLeave); + m_padding.x = 4; + #ifdef __PLATFORM__Android + m_padding.y = 12; + #else + m_padding.y = 4; + #endif + m_textColorFg.red = 0.0; m_textColorFg.green = 0.0; m_textColorFg.blue = 0.0; @@ -79,8 +86,8 @@ bool ewol::Button::CalculateMinSize(void) int32_t fontId = GetDefaultFontId(); int32_t minWidth = ewol::GetWidth(fontId, m_label); int32_t minHeight = ewol::GetHeight(fontId); - m_minSize.x = 16+minWidth; - m_minSize.y = 16+minHeight; + m_minSize.x = m_padding.x*2 + minWidth; + m_minSize.y = m_padding.y*2 + minHeight; MarkToReedraw(); return true; } @@ -108,17 +115,13 @@ void ewol::Button::OnRegenerateDisplay(void) // clean the object list ... ClearOObjectList(); - // TODO later : Add this in the basic element of the widget ... - int32_t borderSize = 2; - int32_t paddingSize = 3; - int32_t tmpSizeX = m_minSize.x; int32_t tmpSizeY = m_minSize.y; - int32_t tmpOriginX = (m_size.x - tmpSizeX) / 2; - int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2; + int32_t tmpOriginX = (m_size.x - m_minSize.x) / 2; + int32_t tmpOriginY = (m_size.y - m_minSize.y) / 2; // no change for the text orogin : - int32_t tmpTextOriginX = (m_size.x - tmpSizeX) / 2 + borderSize + 2*paddingSize; - int32_t tmpTextOriginY = (m_size.y - tmpSizeY) / 2 + borderSize + 2*paddingSize; + int32_t tmpTextOriginX = (m_size.x - m_minSize.x) / 2 + m_padding.x; + int32_t tmpTextOriginY = (m_size.y - m_minSize.y) / 2 + m_padding.y; if (true==m_userFillX) { tmpSizeX = m_size.x; @@ -128,10 +131,10 @@ void ewol::Button::OnRegenerateDisplay(void) tmpSizeY = m_size.y; tmpOriginY = 0; } - tmpOriginX += paddingSize; - tmpOriginY += paddingSize; - tmpSizeX -= 2*paddingSize; - tmpSizeY -= 2*paddingSize; + tmpOriginX += m_padding.x; + tmpOriginY += m_padding.y; + tmpSizeX -= 2*m_padding.x; + tmpSizeY -= 2*m_padding.y; ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg); /* @@ -143,19 +146,19 @@ void ewol::Button::OnRegenerateDisplay(void) textPos.x = tmpTextOriginX; textPos.y = tmpTextOriginY; clipping_ts drawClipping; - drawClipping.x = paddingSize; - drawClipping.y = paddingSize; - drawClipping.w = m_size.x - borderSize - 2*paddingSize; - drawClipping.h = m_size.y - borderSize - 2*paddingSize; + drawClipping.x = m_padding.x; + drawClipping.y = m_padding.y; + drawClipping.w = m_size.x - 2*m_padding.x; + drawClipping.h = m_size.y - 2*m_padding.y; tmpText->Text(textPos, drawClipping, m_label); ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored; tmpOObjects->SetColor(m_textColorBg); + tmpOriginX -= m_padding.x/2; + tmpOriginY -= m_padding.y/2; + tmpSizeX += m_padding.x/1; + tmpSizeY += m_padding.y/1; tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); - /* - tmpOObjects->SetColor(m_textColorFg); - tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, borderSize); - */ AddOObject(tmpOObjects, "BouttonDecoration"); AddOObject(tmpText, "BouttonText"); diff --git a/Sources/libewol/ewol/widget/Button.h b/Sources/libewol/ewol/widget/Button.h index 8c630f6d..157d619d 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -44,13 +44,10 @@ namespace ewol { virtual bool CalculateMinSize(void); void SetLabel(etk::UString newLabel); etk::UString GetLabel(void) {return m_label;}; - // TODO : - //void SetSize(int32_t size); - //void SetFont(etk::UString fontName); - //void ResetDefaultParameters(void); void SetValue(bool val); bool GetValue(void); private: + coord2D_ts m_padding; etk::UString m_label; color_ts m_textColorFg; //!< Text color color_ts m_textColorBg; //!< Background color diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp new file mode 100644 index 00000000..9ada5983 --- /dev/null +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -0,0 +1,239 @@ +/** + ******************************************************************************* + * @file ewol/widget/ContextMenu.cpp + * @brief ewol Contextual Menu widget system (Sources) + * @author Edouard DUPIN + * @date 16/02/2012 + * @par Project + * ewol + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + + + +#include +#include + +#undef __class__ +#define __class__ "ewol::ContextMenu" + +ewol::ContextMenu::ContextMenu(void) +{ + //GenericDrawDisable(); + SpecificDrawEnable(); + m_userExpendX = true; + m_userExpendY = true; + + m_padding.x = 4; + m_padding.y = 4; + m_offset = 20; + + m_colorBackGroung.red = 1.0; + m_colorBackGroung.green = 1.0; + m_colorBackGroung.blue = 1.0; + m_colorBackGroung.alpha = 1.0; + + m_colorBorder.red = 0.0; + m_colorBorder.green = 0.0; + m_colorBorder.blue = 0.0; + m_colorBorder.alpha = 0.50; + + m_arrowPos = {0,0}; + m_arrawBorder = ewol::CONTEXT_MENU_MARK_TOP; +} + +ewol::ContextMenu::~ContextMenu(void) +{ + SubWidgetRemove(); +} + + +bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) +{ + EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); + // pop-up fill all the display : + m_size.x = availlableX; + m_size.y = availlableY; + + if (NULL != m_subWidget) { + coord subWidgetSize; + coord subWidgetOrigin; + subWidgetSize = m_subWidget->GetMinSize(); + if (true == m_subWidget->CanExpentX()) { + subWidgetSize.x = m_size.x; + } + if (true == m_subWidget->CanExpentY()) { + subWidgetSize.y = m_size.y; + } + int32_t minWidth = 100; + int32_t maxWidth = 300; + subWidgetSize.x = (int32_t)etk_max(minWidth, subWidgetSize.x); + subWidgetSize.x = (int32_t)etk_min(maxWidth, subWidgetSize.x); + subWidgetSize.y = (int32_t)subWidgetSize.y; + + // set config to the Sub-widget + switch (m_arrawBorder) + { + case ewol::CONTEXT_MENU_MARK_TOP: + subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2); + subWidgetOrigin.y = (int32_t)(m_arrowPos.y + m_offset); + break; + case ewol::CONTEXT_MENU_MARK_RIGHT: + case ewol::CONTEXT_MENU_MARK_BOTTOM: + case ewol::CONTEXT_MENU_MARK_LEFT: + default: + subWidgetOrigin.x = (int32_t)(m_size.x - m_origin.x - subWidgetSize.x)/2 + m_origin.x; + subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y; + break; + } + + m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y); + m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y); + } + MarkToReedraw(); + return true; +} + + +bool ewol::ContextMenu::CalculateMinSize(void) +{ + EWOL_DEBUG("CalculateMinSize"); + m_userExpendX=false; + m_userExpendY=false; + m_minSize.x = 50.0; + m_minSize.y = 50.0; + if (NULL != m_subWidget) { + m_subWidget->CalculateMinSize(); + coord tmpSize = m_subWidget->GetMinSize(); + m_minSize.x = tmpSize.x; + m_minSize.y = tmpSize.y; + } + EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")"); + MarkToReedraw(); + return true; +} + +void ewol::ContextMenu::SetMinSise(etkFloat_t x, etkFloat_t y) +{ + EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)"); +} + +void ewol::ContextMenu::SetExpendX(bool newExpend) +{ + EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)"); +} + +void ewol::ContextMenu::SetExpendY(bool newExpend) +{ + EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)"); +} + + +void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget) +{ + if (NULL == newWidget) { + return; + } + m_subWidget = newWidget; + newWidget->SetParrent(this); +} + + +void ewol::ContextMenu::SubWidgetRemove(void) +{ + if (NULL != m_subWidget) { + delete(m_subWidget); + m_subWidget = NULL; + } +} + +bool ewol::ContextMenu::OnDraw(void) +{ + if (NULL != m_subWidget) { + m_subWidget->GenDraw(); + } + return true; +} + + +void ewol::ContextMenu::OnRegenerateDisplay(void) +{ + if (true == NeedRedraw()) { + } + // generate a white background and take gray on other surfaces + ClearOObjectList(); + ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); + AddOObject(BGOObjects, "ListDeco"); + + if (NULL != m_subWidget) { + coord tmpSize = m_subWidget->GetSize(); + coord tmpOrigin = m_subWidget->GetOrigin(); + + // display border ... + BGOObjects->SetColor(m_colorBorder); + BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y); + int32_t laking = m_offset - m_padding.y; + BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking); + BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y+laking); + + BGOObjects->Rectangle(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, tmpSize.x + m_padding.x*2, tmpSize.y + m_padding.y*2); + // set the area in white ... + BGOObjects->SetColor(m_colorBackGroung); + BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); + } + if (NULL != m_subWidget) { + m_subWidget->OnRegenerateDisplay(); + } +} + + +bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) +{ + if (NULL != m_subWidget) { + coord tmpSize = m_subWidget->GetSize(); + coord tmpOrigin = m_subWidget->GetOrigin(); + if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) + && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) + { + return m_subWidget->GenEventInput(IdInput, typeEvent, x, y); + } else { + //EWOL_INFO("Event ouside the context menu"); + if (IdInput > 0) { + if( typeEvent == ewol::EVENT_INPUT_TYPE_DOWN + || typeEvent == ewol::EVENT_INPUT_TYPE_MOVE + || typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE + || typeEvent == ewol::EVENT_INPUT_TYPE_DOUBLE + || typeEvent == ewol::EVENT_INPUT_TYPE_TRIPLE + || typeEvent == ewol::EVENT_INPUT_TYPE_UP + || typeEvent == ewol::EVENT_INPUT_TYPE_ENTER + || typeEvent == ewol::EVENT_INPUT_TYPE_LEAVE ) { + ewol::RmPopUp(); + } + } + } + + } + return true; +} + + +void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arrowPos) +{ + EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")"); + m_arrawBorder = position; + m_arrowPos = arrowPos; + MarkToReedraw(); +} diff --git a/Sources/libewol/ewol/widget/ContextMenu.h b/Sources/libewol/ewol/widget/ContextMenu.h new file mode 100644 index 00000000..a25254cd --- /dev/null +++ b/Sources/libewol/ewol/widget/ContextMenu.h @@ -0,0 +1,72 @@ +/** + ******************************************************************************* + * @file ewol/widget/ContextMenu.h + * @brief ewol contextual Menu widget system (header) + * @author Edouard DUPIN + * @date 16/02/2012 + * @par Project + * ewol + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#ifndef __EWOL_CONTEXT_MENU_H__ +#define __EWOL_CONTEXT_MENU_H__ + +#include +#include +#include + +namespace ewol { + typedef enum { + CONTEXT_MENU_MARK_TOP, + CONTEXT_MENU_MARK_RIGHT, + CONTEXT_MENU_MARK_BOTTOM, + CONTEXT_MENU_MARK_LEFT, + CONTEXT_MENU_MARK_NONE + }markPosition_te; + class ContextMenu : public ewol::Widget + { + public: + ContextMenu(void); + virtual ~ContextMenu(void); + public: + virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); // this generate the current size ... + virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer + virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1); + virtual void SetExpendX(bool newExpend=false); + virtual void SetExpendY(bool newExpend=false); + private: + color_ts m_colorBackGroung; + color_ts m_colorBorder; + coord2D_ts m_padding; + coord2D_ts m_arrowPos; + etkFloat_t m_offset; + markPosition_te m_arrawBorder; + ewol::Widget* m_subWidget; + public: + void SubWidgetSet(ewol::Widget* newWidget); + void SubWidgetRemove(void); + void SetPositionMark(markPosition_te position, coord2D_ts arrowPos); + protected: + virtual bool OnDraw(void); + public: + virtual void OnRegenerateDisplay(void); + public: + virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); + }; +}; + +#endif diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index f6955239..1755d8e2 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -70,7 +70,7 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) if (true == m_subWidget->CanExpentY()) { subWidgetSize.y = m_size.y; } - if (m_displayRatio>0.1 && m_displayRatio<=100) { + if (m_displayRatio>0.1 && m_displayRatio<=1) { subWidgetSize.x = etk_max(m_size.x*m_displayRatio, subWidgetSize.x); subWidgetSize.y = etk_max(m_size.y*m_displayRatio, subWidgetSize.y); } diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index 57b2bcd1..20761282 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -44,6 +44,8 @@ extern "C" { #define __class__ "ewol::FileChooser(FolderList)" +#include + void SortList(etk::VectorType &m_listDirectory) { etk::VectorType tmpList = m_listDirectory; @@ -514,6 +516,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener if (ewolEventFileChooserEntryFolder == generateEventId) { //==> change the folder name // TODO : Change the folder, if it exit ... + return true; } else if (ewolEventFileChooserEntryFile == generateEventId) { //==> change the file name ewol::Entry * tmpWidget = (ewol::Entry*)ewol::widgetManager::Get(m_widgetCurrentFileNameId); @@ -521,9 +524,12 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener m_file = tmpWidget->GetValue(); } // TODO : Remove file selection + return true; } else if (ewolEventFileChooserCancel == generateEventId) { //==> Auto remove ... - // TODO : ... + bool tmppp = GenEventInputExternal(generateEventId, x, y); + ewol::RmPopUp(); + return tmppp; } else if (ewolEventFileChooserHidenFileChange == generateEventId) { // regenerate the display ... UpdateCurrentFolder(); @@ -558,13 +564,16 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId); etk::UString file = myListFile->GetSelectedLine(); SetFileName(file); + GenEventInputExternal(generateEventId, x, y); } else if (ewolEventFileChooserValidateFile == generateEventId) { // select the File ==> generate a validate - return GenEventInputExternal(ewolEventFileChooserValidate, x, y);; + bool tmppp = GenEventInputExternal(ewolEventFileChooserValidate, x, y); + ewol::RmPopUp(); + return tmppp; } else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) { return false; } - return GenEventInputExternal(generateEventId, x, y); + return false; }; diff --git a/Sources/libewol/file.mk b/Sources/libewol/file.mk index 8a5b8168..0fd1f752 100644 --- a/Sources/libewol/file.mk +++ b/Sources/libewol/file.mk @@ -23,6 +23,7 @@ FILE_LIST = ewol/ewol.cpp \ ewol/widget/CheckBox.cpp \ ewol/widget/Entry.cpp \ ewol/widget/List.cpp \ + ewol/widget/ContextMenu.cpp \ ewol/widget/PopUp.cpp \ ewol/widget/SizerHori.cpp \ ewol/widget/SizerVert.cpp \