From 6446535f317669439c0233a1a93eae5ca7737c22 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Thu, 9 Feb 2012 17:22:52 +0100 Subject: [PATCH] upgrade the windows display and the file chooser system --- Sources/libewol/ewol/Windows.cpp | 33 ++------ Sources/libewol/ewol/Windows.h | 5 +- Sources/libewol/ewol/base/gui.cpp | 16 ++-- Sources/libewol/ewol/widget/Button.cpp | 1 + Sources/libewol/ewol/widget/Button.h | 1 - Sources/libewol/ewol/widget/CheckBox.cpp | 2 + Sources/libewol/ewol/widget/CheckBox.h | 1 - Sources/libewol/ewol/widget/Entry.cpp | 11 +-- Sources/libewol/ewol/widget/Entry.h | 1 - Sources/libewol/ewol/widget/Label.cpp | 26 +----- Sources/libewol/ewol/widget/List.cpp | 6 +- .../libewol/ewol/widgetMeta/FileChooser.cpp | 80 ++++++++++++++++--- Sources/libewol/ewol/widgetMeta/FileChooser.h | 3 + Sources/libewol/ewol/widgetMeta/Keyboard.cpp | 16 ++-- 14 files changed, 111 insertions(+), 91 deletions(-) diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 3a226802..cda5f53c 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -39,17 +39,11 @@ //list of local events : -const char * ewolEventWindowsClose = "ewol Windows close"; -const char * ewolEventWindowsMinimize = "ewol Windows minimize"; -const char * ewolEventWindowsExpend = "ewol Windows expend/unExpend"; -const char * ewolEventWindowsHideKeyboard = "ewol Windows hideKeyboard"; +extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKeyboard"; ewol::Windows::Windows(void) { - AddEventId(ewolEventWindowsClose); - AddEventId(ewolEventWindowsMinimize); - AddEventId(ewolEventWindowsExpend); SetCanHaveFocus(true); m_subWidget = NULL; m_popUpWidget = NULL; @@ -198,26 +192,6 @@ bool ewol::Windows::OnDraw(void) } -bool ewol::Windows::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) -{ - bool eventIsOK = false; - //EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); - if(ewolEventWindowsClose == generateEventId) { - EWOL_INFO("Request close of the windows"); - ewol::Stop(); - eventIsOK = true; - } else if(ewolEventWindowsMinimize == generateEventId) { - EWOL_INFO("Request Minimize of the windows"); - eventIsOK = true; - } else if(ewolEventWindowsExpend == generateEventId) { - EWOL_INFO("Request Expend of the windows"); - eventIsOK = true; - } - - return eventIsOK; -} - - void ewol::Windows::SetSubWidget(ewol::Widget * widget) { @@ -260,12 +234,14 @@ bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateE if(ewolEventWindowsHideKeyboard == generateEventId) { EWOL_INFO("Request Hide keyboard"); KeyboardHide(); + return true; } - return true; + return false; } void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode) { +#if defined(__PLATFORM__Android) if (NULL == m_keyBoardwidget) { // Create the keyboard ... m_keyBoardwidget = new ewol::Keyboard(); @@ -281,6 +257,7 @@ void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode) } CalculateSize(m_size.x, m_size.y); MarkToReedraw(); +#endif } diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index c092e9a8..46c34c07 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -51,11 +51,8 @@ namespace ewol { virtual bool OnKill(void) { return true; }; virtual void OnReduce(void) { }; virtual void On(void) { }; - // from Widget management : - virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); - virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y); - // Widget overwrite function public: + virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y); private: diff --git a/Sources/libewol/ewol/base/gui.cpp b/Sources/libewol/ewol/base/gui.cpp index f15028b8..2cef684f 100644 --- a/Sources/libewol/ewol/base/gui.cpp +++ b/Sources/libewol/ewol/base/gui.cpp @@ -77,10 +77,10 @@ void guiAbstraction::SendKeyboardEvent(bool isDown, etk::String &keyInput) ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet(); if (NULL != tmpWidget) { if(true == isDown) { - EWOL_DEBUG("X11 PRESSED : \"" << keyInput << "\" size=" << keyInput.Size()); + EWOL_VERBOSE("X11 PRESSED : \"" << keyInput << "\" size=" << keyInput.Size()); tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_DOWN, keyInput.c_str()); } else { - EWOL_DEBUG("X11 Release : \"" << keyInput << "\" size=" << keyInput.Size()); + EWOL_VERBOSE("X11 Release : \"" << keyInput << "\" size=" << keyInput.Size()); tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_UP, keyInput.c_str()); } } @@ -150,7 +150,7 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y ) if(0<=pointerID && pointerID < NB_MAX_INPUT ) { // Send Down message if (NULL != gui_uniqueWindows) { - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [DOWN] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [DOWN] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y); } // Check double or triple click event ... @@ -180,7 +180,7 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y ) if(0<=pointerID && pointerID < NB_MAX_INPUT ) { // Send Down message if (NULL != gui_uniqueWindows) { - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [UP] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [UP] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y); } if (m_previousBouttonId != pointerID) { @@ -193,14 +193,14 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y ) m_previousDouble = false; } else { int64_t currentTime = GetCurrentTime(); // return the tic in 1ms - EWOL_DEBUG("time is : " << (int)currentTime << " "<< (int)(currentTime/1000) <<"s " << (int)((currentTime%100)*10) << "ms delta : " << (currentTime - m_previousTime) << "<" << separateClickTime ); + EWOL_VERBOSE("time is : " << (int)currentTime << " "<< (int)(currentTime/1000) <<"s " << (int)((currentTime%100)*10) << "ms delta : " << (currentTime - m_previousTime) << "<" << separateClickTime ); if (currentTime - m_previousTime >= separateClickTime) { //check if the same area click : if( abs(m_previousDown_x - x) < offsetMoveClicked && abs(m_previousDown_y - y) < offsetMoveClicked ) { // might generate an sigle event : - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [SINGLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [SINGLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y); m_previous_x = m_previousDown_x; m_previous_y = m_previousDown_y; @@ -223,12 +223,12 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y ) { // might generate an sigle event : if (false == m_previousDouble) { - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [DOUBLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [DOUBLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)x, (etkFloat_t)y); m_previousTime = currentTime; m_previousDouble = true; } else { - EWOL_DEBUG("GUI : Input ID=" << pointerID << " [TRIPLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); + EWOL_VERBOSE("GUI : Input ID=" << pointerID << " [TRIPLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")"); gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y); // reset values ... m_previousDown_x = -1; diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 3f762802..85b8ea57 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -161,6 +161,7 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, et if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { // nothing to do ... GenEventInputExternal(ewolEventButtonPressed, x, y); + MarkToReedraw(); return true; } } diff --git a/Sources/libewol/ewol/widget/Button.h b/Sources/libewol/ewol/widget/Button.h index 088badd9..cf7d913c 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -58,7 +58,6 @@ namespace ewol { virtual void OnRegenerateDisplay(void); public: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); - //virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y); virtual bool OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]); }; }; diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index e57b7cd1..73632d59 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -149,6 +149,7 @@ bool ewol::CheckBox::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, } GenEventInputExternal(ewolEventCheckBoxClicked, x, y); ewol::widgetManager::FocusKeep(this); + MarkToReedraw(); return true; } } @@ -169,6 +170,7 @@ bool ewol::CheckBox::OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX } else { m_value = true; } + MarkToReedraw(); return GenEventInputExternal(ewolEventCheckBoxClicked, -1,-1); } return false; diff --git a/Sources/libewol/ewol/widget/CheckBox.h b/Sources/libewol/ewol/widget/CheckBox.h index c0c75ada..c77c0650 100644 --- a/Sources/libewol/ewol/widget/CheckBox.h +++ b/Sources/libewol/ewol/widget/CheckBox.h @@ -52,7 +52,6 @@ namespace ewol { virtual void OnRegenerateDisplay(void); public: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); - //virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y); virtual bool OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]); }; }; diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index 6ea88ec8..19a67048 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -65,17 +65,15 @@ ewol::Entry::Entry(void) Init(); m_data = ""; UpdateTextPosition(); + MarkToReedraw(); } ewol::Entry::Entry(etk::String newData) { Init(); SetValue(newData); - /* - m_data = newData; - m_displayCursorPos = m_data.Size(); UpdateTextPosition(); - */ + MarkToReedraw(); } @@ -91,6 +89,7 @@ bool ewol::Entry::CalculateMinSize(void) m_minSize.x = m_userSize; m_minSize.y = minHeight + 2*(m_borderSize + 2*m_paddingSize); UpdateTextPosition(); + MarkToReedraw(); return true; } @@ -166,7 +165,7 @@ bool ewol::Entry::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etk // nothing to do ... GenEventInputExternal(ewolEventEntryClick, x, y); ewol::widgetManager::FocusKeep(this); - ewol::KeyboardShow(KEYBOARD_MODE_CODE); + MarkToReedraw(); return true; } } @@ -227,11 +226,13 @@ void ewol::Entry::UpdateTextPosition(void) void ewol::Entry::OnGetFocus(void) { m_displayCursor = true; + ewol::KeyboardShow(ewol::KEYBOARD_MODE_CODE); MarkToReedraw(); } void ewol::Entry::OnLostFocus(void) { m_displayCursor = false; + ewol::KeyboardHide(); MarkToReedraw(); } diff --git a/Sources/libewol/ewol/widget/Entry.h b/Sources/libewol/ewol/widget/Entry.h index f8b099b7..c58ef3f0 100644 --- a/Sources/libewol/ewol/widget/Entry.h +++ b/Sources/libewol/ewol/widget/Entry.h @@ -62,7 +62,6 @@ namespace ewol { virtual void OnRegenerateDisplay(void); public: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); - //virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y); virtual bool OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]); protected: virtual void OnGetFocus(void); diff --git a/Sources/libewol/ewol/widget/Label.cpp b/Sources/libewol/ewol/widget/Label.cpp index edfe4a8e..3de50fb8 100644 --- a/Sources/libewol/ewol/widget/Label.cpp +++ b/Sources/libewol/ewol/widget/Label.cpp @@ -106,24 +106,13 @@ void ewol::Label::OnRegenerateDisplay(void) tmpText->Text(tmpOriginX, tmpOriginY, m_label.c_str(), m_size.x - 2*paddingSize); AddOObject(tmpText, "LabelText"); - /* - // Regenerate the event Area: - EventAreaRemoveAll(); - coord origin; - coord size; - origin.x = tmpOriginX; - origin.y = tmpOriginY; - size.x = m_minSize.x; - size.y = m_minSize.y; - AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventLabelPressed); - */ } } bool ewol::Label::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { - EWOL_DEBUG("Event on Label ..."); + //EWOL_DEBUG("Event on Label ..."); if (1 == IdInput) { if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { // nothing to do ... @@ -135,16 +124,3 @@ bool ewol::Label::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etk } -/* -bool ewol::Label::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) -{ - bool eventIsOK = false; - //EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); - if(ewolEventLabelPressed == generateEventId) { - EWOL_INFO("LBL pressed ... " << m_label); - //ewol::widgetManager::FocusKeep(this); - } - return eventIsOK; -} -*/ - diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 68f653f9..d91364d5 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -135,5 +135,9 @@ bool ewol::List::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkF int32_t rawID = (y - m_origin.y) / (minHeight + 2*m_paddingSizeY); //EWOL_DEBUG("OnEventInput(" << IdInput << "," << typeEvent << "," << 0 << "," << rawID << "," << x <<"," << y << ");"); - return OnItemEvent(IdInput, typeEvent, 0, rawID, x, y); + bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, x, y); + if (true == isUsed) { + ewol::widgetManager::FocusKeep(this); + } + return isUsed; } \ No newline at end of file diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index e086765f..9d838908 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include //#include #include @@ -314,6 +315,7 @@ class FileChooserFileList : public ewol::List extern const char * const ewolEventFileChooserCancel = "ewol-event-file-chooser-cancel"; extern const char * const ewolEventFileChooserValidate = "ewol-event-file-chooser-validate"; +extern const char * const ewolEventFileChooserHidenFileChange = "ewol-event-file-chooser-Show/Hide-hiden-Files"; ewol::FileChooser::FileChooser(void) @@ -325,8 +327,10 @@ ewol::FileChooser::FileChooser(void) m_widgetValidateId = -1; m_widgetCancelId = -1; m_widgetCurrentFolderId = -1; + m_widgetCurrentFileNameId = -1; m_widgetListFolderId = -1; m_widgetListFileId = -1; + m_widgetCheckBoxId = -1; m_hasSelectedFile = false; ewol::SizerVert * mySizerVert = NULL; @@ -337,6 +341,7 @@ ewol::FileChooser::FileChooser(void) FileChooserFileList * myListFile = NULL; FileChooserFolderList * myListFolder = NULL; ewol::Label * myLabel = NULL; + ewol::CheckBox * myCheckBox = NULL; #ifdef __PLATFORM__Android m_folder = "/mnt/sdcard/"; SetDisplayRatio(0.90); @@ -344,6 +349,7 @@ ewol::FileChooser::FileChooser(void) m_folder = "/home/"; SetDisplayRatio(0.80); #endif + m_file = ""; mySizerVert = new ewol::SizerVert(); mySizerVert->LockExpendContamination(true); @@ -354,12 +360,29 @@ ewol::FileChooser::FileChooser(void) m_widgetTitleId = myLabel->GetWidgetId(); mySizerVert->SubWidgetAdd(myLabel); - myEntry = new ewol::Entry("~/"); - m_widgetCurrentFolderId = myEntry->GetWidgetId(); - myEntry->SetExpendX(true); - myEntry->SetFillX(true); - myEntry->SetWidth(200); - mySizerVert->SubWidgetAdd(myEntry); + mySizerHori = new ewol::SizerHori(); + mySizerVert->SubWidgetAdd(mySizerHori); + myLabel = new ewol::Label("Folder : "); + myLabel->SetFillY(true); + mySizerHori->SubWidgetAdd(myLabel); + myEntry = new ewol::Entry(m_folder); + m_widgetCurrentFolderId = myEntry->GetWidgetId(); + myEntry->SetExpendX(true); + myEntry->SetFillX(true); + myEntry->SetWidth(200); + mySizerHori->SubWidgetAdd(myEntry); + + mySizerHori = new ewol::SizerHori(); + mySizerVert->SubWidgetAdd(mySizerHori); + myLabel = new ewol::Label("File Name : "); + myLabel->SetFillY(true); + mySizerHori->SubWidgetAdd(myLabel); + myEntry = new ewol::Entry(m_file); + m_widgetCurrentFileNameId = myEntry->GetWidgetId(); + myEntry->SetExpendX(true); + myEntry->SetFillX(true); + myEntry->SetWidth(200); + mySizerHori->SubWidgetAdd(myEntry); mySizerHori = new ewol::SizerHori(); mySizerVert->SubWidgetAdd(mySizerHori); @@ -390,6 +413,11 @@ ewol::FileChooser::FileChooser(void) mySizerHori = new ewol::SizerHori(); mySizerVert->SubWidgetAdd(mySizerHori); + myCheckBox = new ewol::CheckBox("Show hiden files"); + m_widgetCheckBoxId = myCheckBox->GetWidgetId(); + myCheckBox->ExternLinkOnEvent(ewolEventCheckBoxClicked, GetWidgetId(), ewolEventFileChooserHidenFileChange); + myCheckBox->SetValue(false); + mySizerHori->SubWidgetAdd(myCheckBox); mySpacer = new ewol::Spacer(); mySpacer->SetExpendX(true); mySizerHori->SubWidgetAdd(mySpacer); @@ -446,6 +474,16 @@ void ewol::FileChooser::SetFolder(etk::String folder) UpdateCurrentFolder(); } +void ewol::FileChooser::SetFileName(etk::String filename) +{ + m_file = filename; + ewol::Entry * tmpWidget = (ewol::Entry*)ewol::widgetManager::Get(m_widgetCurrentFileNameId); + if (NULL == tmpWidget) { + return; + } + tmpWidget->SetValue(filename); +} + bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) @@ -454,6 +492,10 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener if (ewolEventFileChooserCancel == generateEventId) { //==> Auto remove ... + } else if (ewolEventFileChooserHidenFileChange == generateEventId) { + // regenerate the display ... + UpdateCurrentFolder(); + return true; } else if (ewolEventFileChooserSelectFolder == generateEventId) { //==> this is an internal event ... FileChooserFolderList * myListFolder = (FileChooserFolderList *)ewol::widgetManager::Get(m_widgetListFolderId); @@ -472,17 +514,16 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener if (m_folder != "/" ) { m_folder += "/"; } + SetFileName(""); UpdateCurrentFolder(); m_hasSelectedFile = false; return true; } else if (ewolEventFileChooserSelectFile == generateEventId) { m_hasSelectedFile = true; FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId); - m_file = myListFile->GetSelectedLine(); + etk::String file = myListFile->GetSelectedLine(); + SetFileName(file); } else if (ewolEventFileChooserValidateFile == generateEventId) { - m_hasSelectedFile = true; - FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId); - m_file = myListFile->GetSelectedLine(); // select the File ==> generate a validate return GenEventInputExternal(ewolEventFileChooserValidate, x, y);; } else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) { @@ -498,9 +539,17 @@ void ewol::FileChooser::UpdateCurrentFolder(void) FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId); FileChooserFolderList * myListFolder = (FileChooserFolderList *)ewol::widgetManager::Get(m_widgetListFolderId); ewol::Entry * myEntry = (ewol::Entry *)ewol::widgetManager::Get(m_widgetCurrentFolderId); + ewol::CheckBox * myhidenFiles = (ewol::CheckBox *)ewol::widgetManager::Get(m_widgetCheckBoxId); myListFile->ClearElements(); myListFolder->ClearElements(); + bool ShowHidenFile = true; + if (NULL != myhidenFiles) { + ShowHidenFile = myhidenFiles->GetValue(); + } else { + EWOL_ERROR("Can not get the hiden property of the file choozer..."); + } + myEntry->SetValue(m_folder); myListFolder->AddElement(etk::String(".")); @@ -513,10 +562,16 @@ void ewol::FileChooser::UpdateCurrentFolder(void) while ((ent = readdir(dir)) != NULL) { etk::String tmpString(ent->d_name); if (DT_REG == ent->d_type) { - myListFile->AddElement(tmpString); + if (tmpString.c_str()[0] != '.' || true==ShowHidenFile) + { + myListFile->AddElement(tmpString); + } } else if (DT_DIR == ent->d_type) { if (tmpString != "." && tmpString != "..") { - myListFolder->AddElement(tmpString); + if (tmpString.c_str()[0] != '.' || true==ShowHidenFile) + { + myListFolder->AddElement(tmpString); + } } } } @@ -524,6 +579,7 @@ void ewol::FileChooser::UpdateCurrentFolder(void) } else { EWOL_ERROR("could not open directory : \"" << m_folder << "\""); } + MarkToReedraw(); } diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.h b/Sources/libewol/ewol/widgetMeta/FileChooser.h index 903a9b21..abdfdb51 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.h +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.h @@ -43,6 +43,7 @@ namespace ewol { void SetValidateLabel(etk::String label); void SetCancelLabel(etk::String label); void SetFolder(etk::String folder); + void SetFileName(etk::String filename); etk::String GetCompleateFileName(void); void UpdateCurrentFolder(void); private: @@ -50,8 +51,10 @@ namespace ewol { int32_t m_widgetValidateId; int32_t m_widgetCancelId; int32_t m_widgetCurrentFolderId; + int32_t m_widgetCurrentFileNameId; int32_t m_widgetListFolderId; int32_t m_widgetListFileId; + int32_t m_widgetCheckBoxId; bool m_hasSelectedFile; etk::String m_folder; etk::String m_file; diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp index 3e901448..b043aa28 100644 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp +++ b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp @@ -159,20 +159,26 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode) mySizerHori = new ewol::SizerHori(); mySizerVert->SubWidgetAdd(mySizerHori); ADD_BUTTON(mySizerHori,myButton,"Hide",ewolEventKeyboardHide); + myButton->SetExpendX(false); ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent); + myButton->SetExpendX(false); ADD_BUTTON(mySizerHori,myButton,"Pomme",ewolEventKeyEvent); + myButton->SetExpendX(false); ADD_BUTTON(mySizerHori,myButton,"Alt",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton," ",ewolEventKeyEvent); + myButton->SetExpendX(false); + ADD_BUTTON(mySizerHori,myButton," ",ewolEventKeyEvent); ADD_BUTTON(mySizerHori,myButton,"AltGr",ewolEventKeyEvent); + myButton->SetExpendX(false); ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent); + myButton->SetExpendX(false); } -bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y) +bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { - EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << eventExternId << "\"" ); - if (ewolEventKeyEvent == eventExternId) { + EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << data << "\"" ); + if (ewolEventKeyEvent == generateEventId) { ewol::Button * bt = (ewol::Button *)ewol::widgetManager::Get(widgetID); EWOL_DEBUG("kbevent : \"" << bt->GetLabel() << "\""); etk::String data = bt->GetLabel(); @@ -189,7 +195,7 @@ bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generate guiAbstraction::SendKeyboardEvent(true, data); guiAbstraction::SendKeyboardEvent(false, data); return true; - } else if (ewolEventKeyboardHide == eventExternId) { + } else if (ewolEventKeyboardHide == generateEventId) { Hide(); ewol::ForceRedrawAll(); }