From 63bcc65e0e7eee0dba7374b21bf367e107b95660 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Thu, 5 Jan 2012 18:34:53 +0100 Subject: [PATCH] Update the access of the widget File chooser --- jni/Main.cpp | 23 ++++++++++++++++++++--- project.properties | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/jni/Main.cpp b/jni/Main.cpp index 5aca06e..f2f7bb0 100644 --- a/jni/Main.cpp +++ b/jni/Main.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -119,8 +120,9 @@ class MaListExemple : public ewol::List -const char * const drawerEventRequestOpenFile = "Drawer Request Open File"; -const char * const drawerEventRequestOpenFileClosed = "Drawer Close Open File"; +const char * const drawerEventRequestOpenFile = "Drawer Request Open File"; +const char * const drawerEventRequestOpenFileClosed = "Drawer Close Open File"; +const char * const drawerEventRequestOpenFileSelected = "Drawer Open Selected File"; class Plop :public ewol::Windows @@ -206,13 +208,28 @@ class Plop :public ewol::Windows ewol::FileChooser* tmpWidget = new ewol::FileChooser(); tmpWidget->SetTitle("Open Files ..."); tmpWidget->SetValidateLabel("Open"); - tmpWidget->SetFolder("/home/"); + tmpWidget->SetFolder("/"); PopUpWidgetPush(tmpWidget); if (false == tmpWidget->ExternLinkOnEvent("ewol event file chooser cancel", GetWidgetId(), drawerEventRequestOpenFileClosed) ) { DRAW_CRITICAL("link with an entry event"); } + if (false == tmpWidget->ExternLinkOnEvent("ewol event file chooser validate", GetWidgetId(), drawerEventRequestOpenFileSelected) ) { + DRAW_CRITICAL("link with an entry event"); + } } else if (eventExternId == drawerEventRequestOpenFileClosed) { PopUpWidgetPop(); + } else if (eventExternId == drawerEventRequestOpenFileSelected) { + // get widget: + ewol::FileChooser * tmpWidget = (ewol::FileChooser*)ewol::widgetManager::Get(widgetID); + if (NULL == tmpWidget) { + DRAW_ERROR("impossible to get pop_upWidget " << widgetID); + PopUpWidgetPop(); + return false; + } + // get the filename : + etk::String tmpData = tmpWidget->GetCompleateFileName(); + DRAW_DEBUG("Request opening the file : " << tmpData); + PopUpWidgetPop(); } return true; }; diff --git a/project.properties b/project.properties index f049142..5d85d77 100644 --- a/project.properties +++ b/project.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-10 +target=Google Inc.:Google APIs:13