File Selector

Enumerations

enum  Elm_Fileselector_Mode {
  ELM_FILESELECTOR_LIST = 0,
  ELM_FILESELECTOR_GRID,
  ELM_FILESELECTOR_LAST
}
 Defines how a file selector widget is to layout its contents (file system entries). More...

Functions

Evas_Object * elm_fileselector_add (Evas_Object *parent)
 Add a new file selector widget to the given parent Elementary (container) object.
void elm_fileselector_is_save_set (Evas_Object *obj, Eina_Bool is_save)
 Enable/disable the file name entry box where the user can type in a name for a file, in a given file selector widget.
Eina_Bool elm_fileselector_is_save_get (const Evas_Object *obj)
 Get whether the given file selector is in "saving dialog" mode.
void elm_fileselector_folder_only_set (Evas_Object *obj, Eina_Bool only)
 Enable/disable folder-only view for a given file selector widget.
Eina_Bool elm_fileselector_folder_only_get (const Evas_Object *obj)
 Get whether folder-only view is set for a given file selector widget.
void elm_fileselector_buttons_ok_cancel_set (Evas_Object *obj, Eina_Bool buttons)
 Enable/disable the "ok" and "cancel" buttons on a given file selector widget.
Eina_Bool elm_fileselector_buttons_ok_cancel_get (const Evas_Object *obj)
 Get whether the "ok" and "cancel" buttons on a given file selector widget are being shown.
void elm_fileselector_expandable_set (Evas_Object *obj, Eina_Bool expand)
 Enable/disable a tree view in the given file selector widget, if it's in ELM_FILESELECTOR_LIST mode
Eina_Bool elm_fileselector_expandable_get (const Evas_Object *obj)
 Get whether tree view is enabled for the given file selector widget.
void elm_fileselector_path_set (Evas_Object *obj, const char *path)
 Set, programmatically, the directory that a given file selector widget will display contents from.
const char * elm_fileselector_path_get (const Evas_Object *obj)
 Get the parent directory's path that a given file selector widget is displaying.
Eina_Bool elm_fileselector_selected_set (Evas_Object *obj, const char *path)
 Set, programmatically, the currently selected file/directory in the given file selector widget.
const char * elm_fileselector_selected_get (const Evas_Object *obj)
 Get the currently selected item's (full) path, in the given file selector widget.
void elm_fileselector_mode_set (Evas_Object *obj, Elm_Fileselector_Mode mode)
 Set the mode in which a given file selector widget will display (layout) file system entries in its view.
Elm_Fileselector_Mode elm_fileselector_mode_get (const Evas_Object *obj)
 Get the mode in which a given file selector widget is displaying (layouting) file system entries in its view.

Detailed Description

fileselector_inheritance_tree.png
preview-00.png

A file selector is a widget that allows a user to navigate through a file system, reporting file selections back via its API.

It contains shortcut buttons for home directory (~) and to jump one directory upwards (..), as well as cancel/ok buttons to confirm/cancel a given selection. After either one of those two former actions, the file selector will issue its "done" smart callback.

There's a text entry on it, too, showing the name of the current selection. There's the possibility of making it editable, so it is useful on file saving dialogs on applications, where one gives a file name to save contents to, in a given directory in the system. This custom file name will be reported on the "done" smart callback (explained in sequence).

Finally, it has a view to display file system items into in two possible forms:

  • list
  • grid

If Elementary is built with support of the Ethumb thumbnailing library, the second form of view will display preview thumbnails of files which it supports.

This widget inherits from the Layout one, so that all the functions acting on it also work for file selector objects.

This widget emits the following signals, besides the ones sent from Layout:

  • "selected" - the user has clicked on a file (when not in folders-only mode) or directory (when in folders-only mode)
  • "directory,open" - the list has been populated with new content (event_info is a pointer to the directory's path, a stringshared string)
  • "done" - the user has clicked on the "ok" or "cancel" buttons (event_info is a pointer to the selection's path, a stringshared string)

Here is an example on its usage:


Enumeration Type Documentation

Defines how a file selector widget is to layout its contents (file system entries).

Enumerator:
ELM_FILESELECTOR_LIST 

layout as a list

ELM_FILESELECTOR_GRID 

layout as a grid

ELM_FILESELECTOR_LAST 

sentinel (helper) value, not used


Function Documentation

Evas_Object* elm_fileselector_add ( Evas_Object *  parent)

Add a new file selector widget to the given parent Elementary (container) object.

Parameters:
parentThe parent object
Returns:
a new file selector widget handle or NULL, on errors

This function inserts a new file selector widget on the canvas.

Eina_Bool elm_fileselector_buttons_ok_cancel_get ( const Evas_Object *  obj)

Get whether the "ok" and "cancel" buttons on a given file selector widget are being shown.

Parameters:
objThe file selector object
Returns:
EINA_TRUE if they are being shown, EINA_FALSE otherwise (and on errors)
See also:
elm_fileselector_buttons_ok_cancel_set() for more details
void elm_fileselector_buttons_ok_cancel_set ( Evas_Object *  obj,
Eina_Bool  buttons 
)

Enable/disable the "ok" and "cancel" buttons on a given file selector widget.

Parameters:
objThe file selector object
buttonsEINA_TRUE to show buttons, EINA_FALSE to hide.
Note:
A file selector without those buttons will never emit the "done" smart event, and is only usable if one is just hooking to the other two events.
See also:
elm_fileselector_buttons_ok_cancel_get()

References elm_button_add().

Eina_Bool elm_fileselector_expandable_get ( const Evas_Object *  obj)

Get whether tree view is enabled for the given file selector widget.

Parameters:
objThe file selector object
Returns:
EINA_TRUE if obj is in tree view, EINA_FALSE otherwise (and or errors)
See also:
elm_fileselector_expandable_set() for more details
void elm_fileselector_expandable_set ( Evas_Object *  obj,
Eina_Bool  expand 
)

Enable/disable a tree view in the given file selector widget, if it's in ELM_FILESELECTOR_LIST mode

Parameters:
objThe file selector object
expandEINA_TRUE to enable tree view, EINA_FALSE to disable

In a tree view, arrows are created on the sides of directories, allowing them to expand in place.

Note:
If it's in other mode, the changes made by this function will only be visible when one switches back to "list" mode.
See also:
elm_fileselector_expandable_get()

Referenced by elm_fileselector_button_expandable_set().

Eina_Bool elm_fileselector_folder_only_get ( const Evas_Object *  obj)

Get whether folder-only view is set for a given file selector widget.

Parameters:
objThe file selector object
Returns:
only EINA_TRUE if obj is only displaying directories, EINA_FALSE if files are being displayed in it too (and on errors)
See also:
elm_fileselector_folder_only_get()
void elm_fileselector_folder_only_set ( Evas_Object *  obj,
Eina_Bool  only 
)

Enable/disable folder-only view for a given file selector widget.

Parameters:
objThe file selector object
onlyEINA_TRUE to make obj only display directories, EINA_FALSE to make files to be displayed in it too

If enabled, the widget's view will only display folder items, naturally.

See also:
elm_fileselector_folder_only_get()

Referenced by elm_fileselector_button_folder_only_set().

Eina_Bool elm_fileselector_is_save_get ( const Evas_Object *  obj)

Get whether the given file selector is in "saving dialog" mode.

Parameters:
objThe file selector object
Returns:
EINA_TRUE, if the file selector is in "saving dialog" mode, EINA_FALSE otherwise (and on errors)
See also:
elm_fileselector_is_save_set() for more details

References elm_object_disabled_get().

void elm_fileselector_is_save_set ( Evas_Object *  obj,
Eina_Bool  is_save 
)

Enable/disable the file name entry box where the user can type in a name for a file, in a given file selector widget.

Parameters:
objThe file selector object
is_saveEINA_TRUE to make the file selector a "saving dialog", EINA_FALSE otherwise

Having the entry editable is useful on file saving dialogs on applications, where one gives a file name to save contents to, in a given directory in the system. This custom file name will be reported on the "done" smart callback.

See also:
elm_fileselector_is_save_get()

References elm_layout_signal_emit(), and elm_object_disabled_set().

Referenced by elm_fileselector_button_is_save_set().

Elm_Fileselector_Mode elm_fileselector_mode_get ( const Evas_Object *  obj)

Get the mode in which a given file selector widget is displaying (layouting) file system entries in its view.

Parameters:
objThe fileselector object
Returns:
The mode in which the fileselector is at
See also:
elm_fileselector_mode_set() for more details

References ELM_FILESELECTOR_LAST.

void elm_fileselector_mode_set ( Evas_Object *  obj,
Elm_Fileselector_Mode  mode 
)

Set the mode in which a given file selector widget will display (layout) file system entries in its view.

Parameters:
objThe file selector object
modeThe mode of the fileselector, being it one of ELM_FILESELECTOR_LIST (default) or ELM_FILESELECTOR_GRID. The first one, naturally, will display the files in a list. The latter will make the widget to display its entries in a grid form.
Note:
By using elm_fileselector_expandable_set(), the user may trigger a tree view for that list.
If Elementary is built with support of the Ethumb thumbnailing library, the second form of view will display preview thumbnails of files which it supports. You must have elm_need_ethumb() called in your Elementary for thumbnailing to work, though.
See also:
elm_fileselector_expandable_set().
elm_fileselector_mode_get().

References ELM_FILESELECTOR_LIST.

const char* elm_fileselector_path_get ( const Evas_Object *  obj)

Get the parent directory's path that a given file selector widget is displaying.

Parameters:
objThe file selector object
Returns:
The (full) path of the directory the file selector is displaying, a stringshared string
See also:
elm_fileselector_path_set()
void elm_fileselector_path_set ( Evas_Object *  obj,
const char *  path 
)

Set, programmatically, the directory that a given file selector widget will display contents from.

Parameters:
objThe file selector object
pathThe path to display in obj

This will change the directory that obj is displaying. It will also clear the text entry area on the obj object, which displays select files' names.

See also:
elm_fileselector_path_get()
const char* elm_fileselector_selected_get ( const Evas_Object *  obj)

Get the currently selected item's (full) path, in the given file selector widget.

Parameters:
objThe file selector object
Returns:
The absolute path of the selected item, a stringshared string
Note:
Custom editions on obj object's text entry, if made, will appear on the return string of this function, naturally.
See also:
elm_fileselector_selected_set() for more details

References elm_entry_markup_to_utf8(), ELM_FILESELECTOR_LIST, elm_gengrid_selected_item_get(), elm_genlist_selected_item_get(), and elm_object_item_data_get().

Eina_Bool elm_fileselector_selected_set ( Evas_Object *  obj,
const char *  path 
)

Set, programmatically, the currently selected file/directory in the given file selector widget.

Parameters:
objThe file selector object
pathThe (full) path to a file or directory
Returns:
EINA_TRUE on success, EINA_FALSE on failure. The latter case occurs if the directory or file pointed to do not exist.
See also:
elm_fileselector_selected_get()

References elm_entry_utf8_to_markup().

Referenced by elm_fileselector_button_path_set().