forked from enlightenment/efl
[elementary] Documenting/exemplifying file selector
widget. SVN revision: 61401
This commit is contained in:
parent
8231e7d76e
commit
d1454b4742
|
@ -34,6 +34,8 @@
|
|||
* @ref clock_example
|
||||
*
|
||||
* @ref flipselector_example
|
||||
*
|
||||
* @ref fileselector_example
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1472,6 +1474,79 @@
|
|||
* @example flipselector_example.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page fileselector_example File selector widget example
|
||||
*
|
||||
* This code places two Elementary file selector widgets on a window.
|
||||
* The one on the left is layouting file system items in a @b list,
|
||||
* while the the other is layouting them in a @b grid.
|
||||
*
|
||||
* The one having the majority of hooks of interest is on the left,
|
||||
* which we create as follows:
|
||||
* @dontinclude fileselector_example.c
|
||||
* @skip first file selector
|
||||
* @until object_show
|
||||
*
|
||||
* Note that we enable custom edition of file/directory selection, via
|
||||
* the text entry it has on its bottom, via
|
||||
* elm_fileselector_is_save_set(). It starts with the list view, which
|
||||
* is the default, and we make it not expandable in place
|
||||
* (elm_fileselector_expandable_set()), so that it replaces its view's
|
||||
* contents with the current directory's entries each time one
|
||||
* navigates to a different folder. For both of file selectors we are
|
||||
* starting to list the contents found in the @c "/tmp" directory
|
||||
* (elm_fileselector_path_set()).
|
||||
*
|
||||
* Note the code setting it to "grid mode" and observe the differences
|
||||
* in the file selector's views, in the example. We also hide the
|
||||
* second file selector's Ok/Cancel buttons -- since it's there just
|
||||
* to show the grid view (and navigation) -- via
|
||||
* elm_fileselector_buttons_ok_cancel_set().
|
||||
*
|
||||
* The @c "done" event, which triggers the callback below
|
||||
* @dontinclude fileselector_example.c
|
||||
* @skip 'done' cb
|
||||
* @until }
|
||||
* will be called at the time one clicks the "Ok"/"Cancel" buttons of
|
||||
* the file selector (on the left). Note that it will print the path
|
||||
* to the current selection, if any.
|
||||
*
|
||||
* The @c "selected" event, which triggers the callback below
|
||||
* @dontinclude fileselector_example.c
|
||||
* @skip bt = 'selected' cb
|
||||
* @until }
|
||||
* takes place when one selects a file (if the file selector is @b not
|
||||
* under folders-only mode) or when one selects a folder (when in
|
||||
* folders-only mode). Experiment it by selecting different file
|
||||
* system entries.
|
||||
*
|
||||
* What comes next is the code creating the three check boxes and two
|
||||
* buttons below the file selector in the right. They will exercise a
|
||||
* bunch of functions on the file selector's API, for the instance on
|
||||
* the left. Experiment with them, specially the buttons, to get the
|
||||
* difference between elm_fileselector_path_get() and
|
||||
* elm_fileselector_selected_get().
|
||||
*
|
||||
* Finally, there's the code adding the second file selector, on the
|
||||
* right:
|
||||
* @dontinclude fileselector_example.c
|
||||
* @skip second file selector
|
||||
* @until object_show
|
||||
*
|
||||
* Pay attention to the code setting it to "grid mode" and observe the
|
||||
* differences in the file selector's views, in the example. We also
|
||||
* hide the second file selector's Ok/Cancel buttons -- since it's
|
||||
* there just to show the grid view (and navigation) -- via
|
||||
* elm_fileselector_buttons_ok_cancel_set().
|
||||
*
|
||||
* See the full @ref fileselector_example.c "example", whose window
|
||||
* should look like this picture:
|
||||
* @image html screenshots/fileselector_example.png
|
||||
* @image latex screenshots/fileselector_example.eps
|
||||
*
|
||||
* @example fileselector_example.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page tutorial_hover Hover example
|
||||
* @dontinclude hover_example_01.c
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
|
@ -58,6 +58,8 @@ SRCS = \
|
|||
calendar_example_06.c \
|
||||
clock_example.c \
|
||||
image_example_01.c \
|
||||
flipselector_example.c \
|
||||
fileselector_example.c \
|
||||
theme_example.edc
|
||||
|
||||
pkglib_PROGRAMS =
|
||||
|
@ -109,6 +111,7 @@ pkglib_PROGRAMS += \
|
|||
clock_example \
|
||||
image_example_01 \
|
||||
flipselector_example \
|
||||
fileselector_example \
|
||||
theme_example.edj
|
||||
|
||||
# This variable will hold the list of screenshots that will be made
|
||||
|
@ -139,7 +142,8 @@ SCREENSHOTS = \
|
|||
calendar_example_06:calendar_example_06.png:0.0 \
|
||||
clock_example:clock_example.png:0.5 \
|
||||
image_example_01:image_example_01.png:0.0 \
|
||||
flipselector_example:flipselector_example.png:0.0
|
||||
flipselector_example:flipselector_example.png:0.0 \
|
||||
fileselector_example:fileselector_example.png:0.0
|
||||
|
||||
screenshots: all
|
||||
@mkdir -p $(top_srcdir)/doc/img/screenshots
|
||||
|
|
|
@ -0,0 +1,244 @@
|
|||
/**
|
||||
* Simple Elementary's <b>file selector widget</b> example,
|
||||
* illustrating its usage and API.
|
||||
*
|
||||
* See stdout/stderr for output. Compile with:
|
||||
*
|
||||
* @verbatim
|
||||
* gcc -g `pkg-config --cflags --libs elementary` file selector_example.c -o file selector_example
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#else
|
||||
# define __UNUSED__
|
||||
#endif
|
||||
|
||||
static void
|
||||
_on_done(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
elm_exit();
|
||||
}
|
||||
|
||||
/* 'done' cb */
|
||||
static void
|
||||
_fs_done(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info)
|
||||
{
|
||||
const char *selected = event_info;
|
||||
/* event_info contains the full path of the selected file or NULL
|
||||
* if none is selected (or cancel is pressed) */
|
||||
|
||||
printf("We're done! Selected file is: %s\n",
|
||||
selected ? selected : "*none!*");
|
||||
|
||||
_on_done(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* 'selected' cb */
|
||||
static void
|
||||
_fs_selected(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info)
|
||||
{
|
||||
const char *selected = event_info;
|
||||
/* event_info contains the full path of the selected file */
|
||||
|
||||
printf("There's been a selection: %s\n", selected);
|
||||
}
|
||||
|
||||
static void
|
||||
_is_save_clicked(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fs = data;
|
||||
Eina_Bool old_val = elm_fileselector_is_save_get(fs);
|
||||
|
||||
printf("%s text entry with selected item's name\n",
|
||||
old_val ? "Disabling" : "Enabling");
|
||||
|
||||
elm_fileselector_is_save_set(fs, !old_val);
|
||||
}
|
||||
|
||||
static void
|
||||
_folder_only_clicked(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fs = data;
|
||||
Eina_Bool old_val = elm_fileselector_folder_only_get(fs);
|
||||
|
||||
printf("%s folder-only mode\n",
|
||||
old_val ? "Disabling" : "Enabling");
|
||||
|
||||
elm_fileselector_folder_only_set(fs, !old_val);
|
||||
}
|
||||
|
||||
static void
|
||||
_expandable_clicked(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fs = data;
|
||||
Eina_Bool old_val = elm_fileselector_expandable_get(fs);
|
||||
|
||||
printf("%s tree-view mode\n",
|
||||
old_val ? "Disabling" : "Enabling");
|
||||
|
||||
elm_fileselector_expandable_set(fs, !old_val);
|
||||
}
|
||||
|
||||
static void
|
||||
_sel_get_clicked(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fs = data;
|
||||
printf("Current selection is: %s\n", elm_fileselector_selected_get(fs));
|
||||
}
|
||||
|
||||
static void
|
||||
_path_get_clicked(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fs = data;
|
||||
printf("Current selection's directory path is: %s\n",
|
||||
elm_fileselector_path_get(fs));
|
||||
}
|
||||
|
||||
EAPI int
|
||||
elm_main(int argc __UNUSED__,
|
||||
char **argv __UNUSED__)
|
||||
{
|
||||
Evas_Object *win, *fs, *bg, *vbox, *buttons_bx, *bt, *sep, *bx;
|
||||
|
||||
/* Set the locale according to the system pref. If you dont do so
|
||||
* the file selector will order the files list in a case sensitive
|
||||
* manner
|
||||
*/
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
elm_need_ethumb(); /* let's have thumbnails of images on grid view */
|
||||
|
||||
win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "File Selector Example");
|
||||
evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(bg);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
elm_box_horizontal_set(bx, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
/* evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); */
|
||||
evas_object_show(bx);
|
||||
|
||||
vbox = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(vbox);
|
||||
elm_box_pack_end(bx, vbox);
|
||||
|
||||
/* first file selector, in list mode */
|
||||
fs = elm_fileselector_add(win);
|
||||
/* enable the fs file name entry */
|
||||
elm_fileselector_is_save_set(fs, EINA_TRUE);
|
||||
/* custom list view */
|
||||
elm_fileselector_expandable_set(fs, EINA_FALSE);
|
||||
/* start the fileselector in the /tmp/ dir */
|
||||
elm_fileselector_path_set(fs, "/tmp");
|
||||
|
||||
evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(vbox, fs);
|
||||
evas_object_show(fs);
|
||||
|
||||
/* the 'done' cb is called when the user presses ok/cancel */
|
||||
evas_object_smart_callback_add(fs, "done", _fs_done, win);
|
||||
/* the 'selected' cb is called when the user clicks on a file/dir */
|
||||
evas_object_smart_callback_add(fs, "selected", _fs_selected, win);
|
||||
|
||||
/* test buttons */
|
||||
sep = elm_separator_add(win);
|
||||
elm_separator_horizontal_set(sep, EINA_TRUE);
|
||||
elm_box_pack_end(vbox, sep);
|
||||
evas_object_show(sep);
|
||||
|
||||
buttons_bx = elm_box_add(win);
|
||||
elm_box_horizontal_set(buttons_bx, EINA_TRUE);
|
||||
elm_box_pack_end(vbox, buttons_bx);
|
||||
evas_object_show(buttons_bx);
|
||||
|
||||
bt = elm_check_add(win);
|
||||
elm_object_text_set(bt, "editable selection");
|
||||
elm_check_state_set(bt, elm_fileselector_is_save_get(fs));
|
||||
evas_object_smart_callback_add(bt, "changed", _is_save_clicked, fs);
|
||||
elm_box_pack_end(buttons_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_check_add(win);
|
||||
elm_object_text_set(bt, "folders only");
|
||||
elm_check_state_set(bt, elm_fileselector_folder_only_get(fs));
|
||||
evas_object_smart_callback_add(bt, "changed", _folder_only_clicked, fs);
|
||||
elm_box_pack_end(buttons_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_check_add(win);
|
||||
elm_object_text_set(bt, "expandable");
|
||||
elm_check_state_set(bt, elm_fileselector_expandable_get(fs));
|
||||
evas_object_smart_callback_add(bt, "changed", _expandable_clicked, fs);
|
||||
elm_box_pack_end(buttons_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
buttons_bx = elm_box_add(win);
|
||||
elm_box_horizontal_set(buttons_bx, EINA_TRUE);
|
||||
elm_box_pack_end(vbox, buttons_bx);
|
||||
evas_object_show(buttons_bx);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Print selection");
|
||||
evas_object_smart_callback_add(bt, "clicked", _sel_get_clicked, fs);
|
||||
elm_box_pack_end(buttons_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Print path");
|
||||
evas_object_smart_callback_add(bt, "clicked", _path_get_clicked, fs);
|
||||
elm_box_pack_end(buttons_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
sep = elm_separator_add(win);
|
||||
elm_separator_horizontal_set(sep, EINA_FALSE);
|
||||
elm_box_pack_end(bx, sep);
|
||||
evas_object_show(sep);
|
||||
|
||||
/* second file selector, now with grid view */
|
||||
fs = elm_fileselector_add(win);
|
||||
elm_fileselector_is_save_set(fs, EINA_TRUE);
|
||||
elm_fileselector_mode_set(fs, ELM_FILESELECTOR_GRID);
|
||||
elm_fileselector_buttons_ok_cancel_set(fs, EINA_FALSE);
|
||||
elm_fileselector_path_set(fs, "/tmp");
|
||||
|
||||
evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(bx, fs);
|
||||
evas_object_show(fs);
|
||||
|
||||
evas_object_resize(win, 800, 600);
|
||||
evas_object_show(win);
|
||||
|
||||
elm_run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
ELM_MAIN()
|
|
@ -6308,33 +6308,314 @@ extern "C" {
|
|||
* "changed" - when the slideshow switch to another item
|
||||
*/
|
||||
|
||||
/* file selector */
|
||||
/**
|
||||
* @defgroup Fileselector File Selector
|
||||
*
|
||||
* 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 (@c ~) 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 @c "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 @c
|
||||
* "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.
|
||||
*
|
||||
* Smart callbacks one can register to:
|
||||
*
|
||||
* - @c "selected" - the user has clicked on a file (when not in
|
||||
* folders-only mode) or directory (when in folders-only mode)
|
||||
* - @c "directory,open" - the list has been populated with new
|
||||
* content (@c event_info is a pointer to the directory's
|
||||
* path, a @b stringshared string)
|
||||
* - @c "done" - the user has clicked on the "ok" or "cancel"
|
||||
* buttons (@c event_info is a pointer to the selection's
|
||||
* path, a @b stringshared string)
|
||||
*
|
||||
* Here is an example on its usage:
|
||||
* @li @ref fileselector_example
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Fileselector
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines how a file selector widget is to layout its contents
|
||||
* (file system entries).
|
||||
*/
|
||||
typedef enum _Elm_Fileselector_Mode
|
||||
{
|
||||
ELM_FILESELECTOR_LIST = 0,
|
||||
ELM_FILESELECTOR_GRID,
|
||||
ELM_FILESELECTOR_LAST
|
||||
ELM_FILESELECTOR_LIST = 0, /**< layout as a list */
|
||||
ELM_FILESELECTOR_GRID, /**< layout as a grid */
|
||||
ELM_FILESELECTOR_LAST /**< sentinel (helper) value, not used */
|
||||
} Elm_Fileselector_Mode;
|
||||
|
||||
/**
|
||||
* Add a new file selector widget to the given parent Elementary
|
||||
* (container) object
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return a new file selector widget handle or @c NULL, on errors
|
||||
*
|
||||
* This function inserts a new file selector widget on the canvas.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Evas_Object *elm_fileselector_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Enable/disable the file name entry box where the user can type
|
||||
* in a name for a file, in a given file selector widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param is_save @c EINA_TRUE to make the file selector a "saving
|
||||
* dialog", @c 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 @c "done" smart callback.
|
||||
*
|
||||
* @see elm_fileselector_is_save_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void elm_fileselector_is_save_set(Evas_Object *obj, Eina_Bool is_save) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get whether the given file selector is in "saving dialog" mode
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return @c EINA_TRUE, if the file selector is in "saving dialog"
|
||||
* mode, @c EINA_FALSE otherwise (and on errors)
|
||||
*
|
||||
* @see elm_fileselector_is_save_set() for more details
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool elm_fileselector_is_save_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Enable/disable folder-only view for a given file selector widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param only @c EINA_TRUE to make @p obj only display
|
||||
* directories, @c EINA_FALSE to make files to be displayed in it
|
||||
* too
|
||||
*
|
||||
* If enabled, the widget's view will only display folder items,
|
||||
* naturally.
|
||||
*
|
||||
* @see elm_fileselector_folder_only_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void elm_fileselector_folder_only_set(Evas_Object *obj, Eina_Bool only) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get whether folder-only view is set for a given file selector
|
||||
* widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return only @c EINA_TRUE if @p obj is only displaying
|
||||
* directories, @c EINA_FALSE if files are being displayed in it
|
||||
* too (and on errors)
|
||||
*
|
||||
* @see elm_fileselector_folder_only_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool elm_fileselector_folder_only_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Enable/disable the "ok" and "cancel" buttons on a given file
|
||||
* selector widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param only @c EINA_TRUE to show them, @c EINA_FALSE to hide.
|
||||
*
|
||||
* @note A file selector without those buttons will never emit the
|
||||
* @c "done" smart event, and is only usable if one is just hooking
|
||||
* to the other two events.
|
||||
*
|
||||
* @see elm_fileselector_buttons_ok_cancel_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, Eina_Bool buttons) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get whether the "ok" and "cancel" buttons on a given file
|
||||
* selector widget are being shown.
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return @c EINA_TRUE if they are being shown, @c EINA_FALSE
|
||||
* otherwise (and on errors)
|
||||
*
|
||||
* @see elm_fileselector_buttons_ok_cancel_set() for more details
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_fileselector_expandable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Enable/disable a tree view in the given file selector widget,
|
||||
* <b>if it's in @c #ELM_FILESELECTOR_LIST mode</b>
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param expand @c EINA_TRUE to enable tree view, @c 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 elm_fileselector_expandable_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void elm_fileselector_expandable_set(Evas_Object *obj, Eina_Bool expand) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get whether tree view is enabled for the given file selector
|
||||
* widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return @c EINA_TRUE if @p obj is in tree view, @c EINA_FALSE
|
||||
* otherwise (and or errors)
|
||||
*
|
||||
* @see elm_fileselector_expandable_set() for more details
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool elm_fileselector_expandable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set, programmatically, the @b directory that a given file
|
||||
* selector widget will display contents from
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param path The path to display in @p obj
|
||||
*
|
||||
* This will change the @b directory that @p obj is displaying. It
|
||||
* will also clear the text entry area on the @p obj object, which
|
||||
* displays select files' names.
|
||||
*
|
||||
* @see elm_fileselector_path_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void elm_fileselector_path_set(Evas_Object *obj, const char *path) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the parent directory's path that a given file selector
|
||||
* widget is displaying
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return The (ful) path of the directory the fileselector is
|
||||
* displaying, a @b stringshared string
|
||||
*
|
||||
* @see elm_fileselector_path_set()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI const char *elm_fileselector_path_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set, programmatically, the currently selected file/directory in
|
||||
* the given file selector widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param path The (full) path to a file or directory
|
||||
* @return @c EINA_TRUE on success, @c EINA_FALSE on failure. The
|
||||
* latter case occurs if the directory or file pointed to do not
|
||||
* exist.
|
||||
*
|
||||
* @see elm_fileselector_selected_get()
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool elm_fileselector_selected_set(Evas_Object *obj, const char *path) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the currently selected item's (full) path, in the given file
|
||||
* selector widget
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return The absolute path of the selected item, a @b
|
||||
* stringshared string
|
||||
*
|
||||
* @note Custom editions on @p obj object's text entry, if made,
|
||||
* will appear on the return string of this function, naturally.
|
||||
*
|
||||
* @see elm_fileselector_selected_set() for more details
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set the mode in which a given file selector widget will display
|
||||
* (layout) file system entries in its view
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param mode The 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.
|
||||
*
|
||||
* @note 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 elm_fileselector_expandable_set().
|
||||
* @see elm_fileselector_mode_get().
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void elm_fileselector_mode_set(Evas_Object *obj, Elm_Fileselector_Mode mode) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get the mode in which a given file selector widget is displaying
|
||||
* (layouting) file system entries in its view
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return The mode in which the fileselector is at
|
||||
*
|
||||
* @see elm_fileselector_mode_set() for more details
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Elm_Fileselector_Mode elm_fileselector_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/* smart callbacks called:
|
||||
* "selected" - the user click on a file
|
||||
* "directory,open" - the list is populate with a new content. event_info is a directory.
|
||||
* "done" - the user click on the ok or cancel buttons
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* progressbar */
|
||||
|
|
|
@ -1,27 +1,13 @@
|
|||
/**
|
||||
* @defgroup Fileselector Fileselector
|
||||
*
|
||||
* A fileselector is a widget that allows a user to navigate through a
|
||||
* tree of files. It contains buttons for Home(~) and Up(..) as well
|
||||
* as cancel/ok buttons to confirm/cancel a selection. This widget is
|
||||
* currently very much in progress.
|
||||
*
|
||||
* TODO
|
||||
* child elements focusing support
|
||||
* userdefined icon/label cb
|
||||
* show/hide/add buttons ???
|
||||
* show/Hide hidden files
|
||||
* double click to choose a file
|
||||
* multiselection
|
||||
* make variable/function names that are sensible
|
||||
* Filter support
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* "selected" - the user clicks on a file
|
||||
* "directory,open" - the list is populated with new content.
|
||||
* event_info is a directory.
|
||||
* "done" - the user clicks on the ok or cancel button
|
||||
/*
|
||||
* TODO:
|
||||
* - child elements focusing support
|
||||
* - user defined icon/label cb
|
||||
* - show/hide/add buttons ???
|
||||
* - show/hide hidden files
|
||||
* - double click to choose a file
|
||||
* - multi-selection
|
||||
* - make variable/function names that are sensible
|
||||
* - Filter support
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -810,14 +796,6 @@ _populate(Evas_Object *obj,
|
|||
|
||||
/*** API ***/
|
||||
|
||||
/**
|
||||
* Add a new Fileselector object
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL if it cannot be created
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_fileselector_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -951,15 +929,6 @@ elm_fileselector_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* This enables/disables the file name entry box where the user can
|
||||
* type in a name for the file to be saved as.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @param is_save If true, the fileselector is a save dialog
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_fileselector_is_save_set(Evas_Object *obj,
|
||||
Eina_Bool is_save)
|
||||
|
@ -976,14 +945,6 @@ elm_fileselector_is_save_set(Evas_Object *obj,
|
|||
edje_object_signal_emit(wd->edje, "elm,state,save,off", "elm");
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns whether the fileselector is a "save" type fileselector
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return If true, the fileselector is a save type.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_fileselector_is_save_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -993,15 +954,6 @@ elm_fileselector_is_save_get(const Evas_Object *obj)
|
|||
return elm_object_disabled_get(wd->filename_entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* This enables/disables folder-only view in the fileselector.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @param only If true, the fileselector will only display directories.
|
||||
* If false, files are displayed also.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_fileselector_folder_only_set(Evas_Object *obj,
|
||||
Eina_Bool only)
|
||||
|
@ -1014,15 +966,6 @@ elm_fileselector_folder_only_set(Evas_Object *obj,
|
|||
if (wd->path) _populate(obj, wd->path, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the state of file display in the fileselector.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return If true, files are not being shown in the fileselector.
|
||||
* If false, files are being shown.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_fileselector_folder_only_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1032,15 +975,6 @@ elm_fileselector_folder_only_get(const Evas_Object *obj)
|
|||
return wd->only_folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* This enables/disables the ok,cancel buttons.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @param only If true, a box containing ok and cancel buttons is created.
|
||||
* If false, the box and the buttons are destroyed.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj,
|
||||
Eina_Bool visible)
|
||||
|
@ -1083,15 +1017,6 @@ elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the state of the box containing ok and cancel buttons.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return If true, the box exists.
|
||||
* If false, the box does not exist.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1101,21 +1026,6 @@ elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj)
|
|||
return wd->ok_button ? EINA_TRUE : EINA_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This enables a tree view in the fileselector, <b>if in @c
|
||||
* ELM_FILESELECTOR_LIST mode</b>. If it's in other mode, the changes
|
||||
* made by this function will only be visible when one switches back
|
||||
* to list mode.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @param expand If true, tree view is enabled.
|
||||
* If false, tree view is disabled.
|
||||
*
|
||||
* In a tree view, arrows are created on the sides of directories,
|
||||
* allowing them to expand in place.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_fileselector_expandable_set(Evas_Object *obj,
|
||||
Eina_Bool expand)
|
||||
|
@ -1131,15 +1041,6 @@ elm_fileselector_expandable_set(Evas_Object *obj,
|
|||
if (wd->path) _populate(obj, wd->path, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the state of tree view in the fileselector.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return If true, tree view is enabled and folders will be expandable.
|
||||
* If false, tree view is disabled.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_fileselector_expandable_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1149,14 +1050,6 @@ elm_fileselector_expandable_get(const Evas_Object *obj)
|
|||
return wd->expand;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the path that the fileselector will display.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @param path The path of the fileselector
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_fileselector_path_set(Evas_Object *obj,
|
||||
const char *path)
|
||||
|
@ -1165,14 +1058,6 @@ elm_fileselector_path_set(Evas_Object *obj,
|
|||
_populate(obj, path, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the path that the fileselector displays.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return The path that the fileselector is displaying
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_fileselector_path_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1182,22 +1067,6 @@ elm_fileselector_path_get(const Evas_Object *obj)
|
|||
return wd->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the mode in which the fileselector will display files.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
|
||||
* @param mode The mode of the fileselector, being it one of @c
|
||||
* ELM_FILESELECTOR_LIST (default) or @c ELM_FILESELECTOR_GRID. The
|
||||
* first one, naturally, will display the files in a list. By using
|
||||
* elm_fileselector_expandable_set(), the user will trigger a tree
|
||||
* view for that list. The latter will make the widget to display its
|
||||
* entries in a grid form.
|
||||
*
|
||||
* @see elm_fileselector_expandable_set().
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI void
|
||||
elm_fileselector_mode_set(Evas_Object *obj,
|
||||
Elm_Fileselector_Mode mode)
|
||||
|
@ -1237,14 +1106,6 @@ elm_fileselector_mode_set(Evas_Object *obj,
|
|||
_populate(obj, wd->path, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the mode in which the fileselector is displaying files.
|
||||
*
|
||||
* @param obj The fileselector object
|
||||
* @return The mode in which the fileselector is at
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Elm_Fileselector_Mode
|
||||
elm_fileselector_mode_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1256,14 +1117,6 @@ elm_fileselector_mode_get(const Evas_Object *obj)
|
|||
return wd->mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the currently selected path in the file selector.
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @return The absolute path of the selected object in the fileselector
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_fileselector_selected_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1300,17 +1153,6 @@ elm_fileselector_selected_get(const Evas_Object *obj)
|
|||
return wd->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the currently selected path in the file selector.
|
||||
*
|
||||
* @param obj The file selector object
|
||||
* @param path The path to a file or directory
|
||||
* @return @c EINA_TRUE on success, @c EINA_FALSE on failure. The
|
||||
* latter case occurs if the directory or file pointed to do not
|
||||
* exist.
|
||||
*
|
||||
* @ingroup Fileselector
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_fileselector_selected_set(Evas_Object *obj,
|
||||
const char *path)
|
||||
|
|
Loading…
Reference in New Issue