1.8
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FileDialog Class Referenceabstract

A FileDialog is a widget that allows user to: More...

Inheritance diagram for FileDialog:
Inheritance graph
[legend]

Public Member Functions

 FileDialog (const Rect &rect={}) noexcept
 Create a file open dialog window and list the contents of current directory. More...
 
 FileDialog (const std::string &filepath, const Rect &rect={}) noexcept
 Create a file dialog window. More...
 
 FileDialog (Serializer::Properties &props) noexcept
 Create a file dialog window. More...
 
void serialize (Serializer &serializer) const override
 
void show () override
 Show the Widget. More...
 
void show_centered () override
 Show the window centered. More...
 
- Public Member Functions inherited from Dialog
 Dialog (const Rect &rect={}) noexcept
 Create a dialog with two buttons to handle decision. More...
 
 Dialog (Serializer::Properties &props) noexcept
 
void button (ButtonId button, const std::string &text)
 Set Button details for this dialog. More...
 
void icon (const Image &icon)
 Set a icon in a title area of a dialog. More...
 
void layout () override
 Perform layout on dialog Widget. More...
 
Size min_size_hint () const override
 Get a minimum size hint of the Dialog Widget. More...
 
void resize (const Size &size) override
 Resize the Dialog Widget. More...
 
void title (const Image &icon, const std::string &title)
 Set the title info for this dialog. More...
 
void title (const std::string &title)
 Set a title text for this dialog. More...
 
void widget (const std::shared_ptr< Widget > &widget)
 Set a widget for this dialog. More...
 
- Public Member Functions inherited from PopupType< T >
 PopupType (const Size &size={}, const Point &point={}) noexcept
 
 PopupType (Serializer::Properties &props) noexcept
 
void hide () override
 Hide the Widget. More...
 
void show () override
 Show the Widget. More...
 
virtual void show_modal (bool center=false)
 Show the window in modal mode. More...
 

Public Attributes

Signal on_selected
 Event signal. More...
 
- Public Attributes inherited from Dialog
Signal on_button1_click
 Event signal. More...
 
Signal on_button2_click
 Signal when button2 is clicked. More...
 

Protected Member Functions

 FileDialog (Serializer::Properties &props, bool is_derived) noexcept
 
bool list_files (const std::string &filepath)
 List the contents of file path directory. More...
 
void list_item_selected (int index)
 Get the List Item selected index. More...
 
virtual void selected (const std::string &fselect)=0
 File selected. More...
 
- Protected Member Functions inherited from Dialog
 Dialog (Serializer::Properties &props, bool is_derived) noexcept
 
void initialize (bool init_inherited_properties=true)
 
- Protected Member Functions inherited from PopupType< T >
 PopupType (Serializer::Properties &props, bool is_derived) noexcept
 

Protected Attributes

std::string m_filepath
 File path of a directory. More...
 
std::shared_ptr< ListBoxm_flist
 List Box for file listing. More...
 
- Protected Attributes inherited from Dialog
Button m_button1
 Button for okay or cancel. More...
 
Button m_button2
 Button for okay or cancel. More...
 
VerticalBoxSizer m_content
 Content sizer. More...
 
std::shared_ptr< StaticGridm_grid
 Grid for organizing okay & cancel Buttons. More...
 
VerticalBoxSizer m_layout
 Layout sizer. More...
 
ImageLabel m_title
 Dialog title. More...
 

Additional Inherited Members

- Public Types inherited from Dialog
enum class  ButtonId { button1 , button2 }
 Used to identify the button on the dialog. More...
 

Detailed Description

A FileDialog is a widget that allows user to:

  1. Choose a file from the file system.
  2. View the contents of file system directories.
  3. Select a location for saving a file.
Note
FileDialog widget is using a std::experimental::filesystem library

Constructor & Destructor Documentation

◆ FileDialog() [1/4]

FileDialog ( const Rect rect = {})
explicitnoexcept

Create a file open dialog window and list the contents of current directory.

Parameters
[in]rectInitial rectangle of the Widget.

◆ FileDialog() [2/4]

FileDialog ( const std::string &  filepath,
const Rect rect = {} 
)
explicitnoexcept

Create a file dialog window.

Parameters
[in]rectInitial rectangle of the Widget.
[in]filepathis to list the contents filepath directory.
Note
filepath should be a directory. If the file path is regular file, then content of its parent directory will be listed.

◆ FileDialog() [3/4]

FileDialog ( Serializer::Properties props)
inlineexplicitnoexcept

Create a file dialog window.

Parameters
[in]propslist of widget argument and its properties.

◆ FileDialog() [4/4]

FileDialog ( Serializer::Properties props,
bool  is_derived 
)
explicitprotectednoexcept

Member Function Documentation

◆ list_files()

bool list_files ( const std::string &  filepath)
protected

List the contents of file path directory.

◆ list_item_selected()

void list_item_selected ( int  index)
protected

Get the List Item selected index.

◆ selected()

virtual void selected ( const std::string &  fselect)
protectedpure virtual

File selected.

Parameters
[in]fselectSelected filename.

Implemented in FileSaveDialog, and FileOpenDialog.

◆ serialize()

void serialize ( Serializer serializer) const
override

◆ show()

void show ( )
override

Show the Widget.

This changes the visible() state of the Widget.

◆ show_centered()

void show_centered ( )
overridevirtual

Show the window centered.

Position the window the center of its parent, or if it has no parent, the screen.

Reimplemented from PopupType< T >.

Reimplemented in FileSaveDialog.

Member Data Documentation

◆ m_filepath

std::string m_filepath
protected

File path of a directory.

◆ m_flist

std::shared_ptr<ListBox> m_flist
protected

List Box for file listing.

◆ on_selected

Signal on_selected

Event signal.

Invoked when a selection is made.