class: ewol::widget::FileChooser
Description:
File Chooser is a simple selector of file for opening, saving, and what you want ...As all other pop-up methode ( wost case we can have) the creating is simple , but event back is not all the time simple:
Fist global static declaration and inclusion:
#include <ewol/widget/meta/FileChooser.h>
The first step is to create the file chooser pop-up : (never in the constructor!!!)
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::Widget::FileChooser::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not open File chooser !!! "); return -1; } // register on the Validate event: tmpWidget->signalValidate.bind(shared_from_this(), &::onCallbackOpenFile); // no need of this event watching ... tmpWidget->signalCancel.bind(shared_from_this(), &::onCallbackClosePopUp); // set the title: tmpWidget->setTitle("Open files ..."); // Set the validate Label: tmpWidget->setValidateLabel("Open"); // simply set a folder (by default this is the home folder) //tmpWidget->setFolder("/home/me"); // add the widget as windows pop-up ... std::shared_ptr<ewol::widget::Windows> tmpWindows = getWindows(); if (tmpWindows == nullptr) { APPL_ERROR("Can not get the current windows !!! "); return -1; } tmpWindows->popUpWidgetPush(tmpWidget);
Now we just need to wait the the open event message.
void::onCallbackOpenFile(const std::string& _value) { APPL_INFO("Request open file : '" << _value << "'"); } void::onCallbackClosePopUp() { APPL_INFO("The File chooser has been closed"); }This is the best example of a Meta-widget.
Constructor and Destructor:
# FileChooser ();
+ virtual ~FileChooser ();
Synopsis:
+ ewol::object::Signal<void> signalCancel;
+ ewol::object::Signal<std::string> signalValidate;
# void init ();
+ DECLARE_WIDGET_FACTORY (FileChooser ,
"FileChooser" );
+ void setTitle (const std::string & _label);
+ void setValidateLabel (const std::string & _label);
+ void setCancelLabel (const std::string & _label);
+ void setFolder (const std::string & _folder);
+ void setFileName (const std::string & _filename);
+ std::string getCompleateFileName ();
+ void updateCurrentFolder ();
+ virtual void onGetFocus ();
Object Hierarchy:
+std::enable_shared_from_this<Object>
+ewol::object::ParameterList
+ewol::object::SignalList
+--> +ewol::Object
+--> +ewol::Widget
+--> +ewol::widget::Container
+--> +ewol::widget::Composer
+--> ewol::widget::FileChooser
Detail:
signalCancel
+ ewol::object::Signal<void> signalCancel;
signalValidate
+ ewol::object::Signal<std::string> signalValidate;
FileChooser
# FileChooser ();
init
# void init ();
DECLARE_WIDGET_FACTORY
+ DECLARE_WIDGET_FACTORY (FileChooser ,
"FileChooser" );
~FileChooser
+ virtual ~FileChooser ();
setTitle
+ void setTitle (const std::string & _label);
setValidateLabel
+ void setValidateLabel (const std::string & _label);
setCancelLabel
+ void setCancelLabel (const std::string & _label);
setFolder
+ void setFolder (const std::string & _folder);
setFileName
+ void setFileName (const std::string & _filename);
getCompleateFileName
+ std::string getCompleateFileName ();
updateCurrentFolder
+ void updateCurrentFolder ();
onGetFocus
+ virtual void onGetFocus ();
Event of the focus has been grep by the current widget
+std::enable_shared_from_this<Object>
+ewol::object::ParameterList
+ewol::object::SignalList
+--> +ewol::Object
+--> +ewol::Widget
+--> +ewol::widget::Container
+--> +ewol::widget::Composer
+--> ewol::widget::FileChooser
Detail:
signalCancel
+ ewol::object::Signal<void> signalCancel;
signalValidate
+ ewol::object::Signal<std::string> signalValidate;
FileChooser
# FileChooser ();
init
# void init ();
DECLARE_WIDGET_FACTORY
+ DECLARE_WIDGET_FACTORY (FileChooser ,
"FileChooser" );
~FileChooser
+ virtual ~FileChooser ();
setTitle
+ void setTitle (const std::string & _label);
setValidateLabel
+ void setValidateLabel (const std::string & _label);
setCancelLabel
+ void setCancelLabel (const std::string & _label);
setFolder
+ void setFolder (const std::string & _folder);
setFileName
+ void setFileName (const std::string & _filename);
getCompleateFileName
+ std::string getCompleateFileName ();
updateCurrentFolder
+ void updateCurrentFolder ();
onGetFocus
+ virtual void onGetFocus ();Event of the focus has been grep by the current widget