Download

Support

Ewl_Filepicker: Allows selecting files from a list


Detailed Description

A widget to allow selecting ifles

Remarks:
Inherits from Ewl_Box.

Tutorial

The Ewl_Filepicker widget provides a method for selecting files. The filepicker can support multiple views of the files, this also allows the app to provide it's own view.

 Ewl_Widget *fp;
 fp = ewl_filepicker_new();
 ewl_widget_show(fp);

The filepicker will default to the users home directory. If that dosen't exist it will attemp to use /tmp, failing that it will fall back to the / directory. The following two calls can be used to retrieve or set the current directory.

 ewl_filepicker_directory_set(fp);
 ewl_filepicker_directory_get(fp);

Along with changing the directory you can also specify if the picker will allow for multiple file selections, showing dot files, showing the favorites panel or setting the file filter. This is done with the following code:

 ewl_filepicker_multiselect_set(fp, TRUE);
 ms = ewl_filepicker_multiselect_get(fp);

 ewl_filepicker_show_dot_files_set(fp, TRUE);
 dot = ewl_filepicker_show_dot_files_get(fp);

 ewl_filepicker_show_favorites_set(fp, TRUE);
 fav = ewl_filepicker_show_favorites_get(fp);

 ewl_filepicker_filter_set(fp, filter);
 filter = ewl_filepicker_filter_get(fp);

You can also change the view used for the file list.

 ewl_filepicker_list_view_set(fp, view);
 view = ewl_filepicker_list_view_get(fp);

Adding Views

A view of the file list in the filepicker is a subclass of the Ewl_Filelist widget. These subclasses will provide the code for the actual list display. They will receive callbacks as settings are changed on the filepicker to notify of the display changes.

If you wish to write your own view you will need to create an Ewl_View and set the constructor for your widget as the construct field. The constructor will need to setup the appropriate callbacks to as specified in the Ewl_Filelist structure.


Data Structures

struct  Ewl_Filepicker
 Inherits from Ewl_Box and extends to provide a filepicker. More...

Defines

#define EWL_FILEPICKER(fp)   ((Ewl_Filepicker *)fp)
#define EWL_FILEPICKER_IS(w)   (ewl_widget_type_is(EWL_WIDGET(w), EWL_FILEPICKER_TYPE))
#define EWL_FILEPICKER_TYPE   "filepicker"

Typedefs

typedef Ewl_Filepicker Ewl_Filepicker

Functions

const char * ewl_filepicker_directory_get (Ewl_Filepicker *fp)
 Retrieve the current directory from the filepicker.
void ewl_filepicker_directory_set (Ewl_Filepicker *fp, const char *dir)
 Set the current directory to be displayed in the filepicker.
Ewl_Filelist_Filterewl_filepicker_filter_add (Ewl_Filepicker *fp, const char *name, const char *extension, Ecore_List *mime_types)
 Add the filter named name to the combo box in the filepicker.
Ewl_Filelist_Filterewl_filepicker_filter_get (Ewl_Filepicker *fp)
 Retrieves the current filter used in the filepicker. Do not free the filter!
void ewl_filepicker_filter_set (Ewl_Filepicker *fp, Ewl_Filelist_Filter *filter)
 Set the given filter into the file picker and updates the combo.
int ewl_filepicker_init (Ewl_Filepicker *fp)
 Initialize an Ewl_Filepicker to default values.
Ewl_Filelist_View ewl_filepicker_list_view_get (Ewl_Filepicker *fp)
 Retrieves the current view used for the file list.
void ewl_filepicker_list_view_set (Ewl_Filepicker *fp, Ewl_Filelist_View view)
 Sets the given view to be used to display the file list.
unsigned int ewl_filepicker_multiselect_get (Ewl_Filepicker *fp)
 Retrieves the current multi-select value from the filepicker.
void ewl_filepicker_multiselect_set (Ewl_Filepicker *fp, unsigned int ms)
 Sets the multiselect state of the filepicker to the given value.
Ewl_Widgetewl_filepicker_new (void)
 Creates a new Ewl_Filepicker widget.
unsigned int ewl_filepicker_return_directories_get (Ewl_Filepicker *fp)
 Gets the filepicker's policy on returning directories.
void ewl_filepicker_return_directories_set (Ewl_Filepicker *fp, unsigned int t)
 Sets the filepicker's policy on returning directories.
unsigned int ewl_filepicker_save_as_get (Ewl_Filepicker *fp)
 Gets the current type of the filepicker.
Ewl_Widgetewl_filepicker_save_as_new (void)
 A convenience function to create a Save As widget.
void ewl_filepicker_save_as_set (Ewl_Filepicker *fp, unsigned int t)
 Sets the type for the filepicker.
char * ewl_filepicker_selected_file_get (Ewl_Filepicker *fp)
 Retrieves the currently selected file from the filepicker.
void ewl_filepicker_selected_file_set (Ewl_Filepicker *fp, const char *file)
 Sets the given file as selected in the filepicker.
Ecore_List * ewl_filepicker_selected_files_get (Ewl_Filepicker *fp)
 Retrieves the list of selected files in the filepicker.
void ewl_filepicker_selected_files_set (Ewl_Filepicker *fp, Ecore_List *files)
 Sets the given files as selected in the filepicker.
unsigned int ewl_filepicker_show_dot_files_get (Ewl_Filepicker *fp)
 Retrieves the current show dot files setting of the filepicker.
void ewl_filepicker_show_dot_files_set (Ewl_Filepicker *fp, unsigned int dot)
 Set the show dot files setting of the filepicker to the given value.
unsigned int ewl_filepicker_show_favorites_get (Ewl_Filepicker *fp)
 Retrieves the current show favorites setting of the filepicker.
void ewl_filepicker_show_favorites_set (Ewl_Filepicker *fp, unsigned int show)
 Sets the show favorites setting of the file picker.

Define Documentation

#define EWL_FILEPICKER ( fp   )     ((Ewl_Filepicker *)fp)

Typecast a pointer to an Ewl_Filepicker pointer.

#define EWL_FILEPICKER_IS (  )     (ewl_widget_type_is(EWL_WIDGET(w), EWL_FILEPICKER_TYPE))

Returns TRUE if the widget is an Ewl_Filepicker, FALSE otherwise

#define EWL_FILEPICKER_TYPE   "filepicker"

The type name for the Ewl_Filepicker widget


Typedef Documentation

The Ewl_Filepicker provides a widget for picking files


Function Documentation

const char* ewl_filepicker_directory_get ( Ewl_Filepicker fp  ) 

Retrieve the current directory from the filepicker.

Parameters:
fp,: The filepicker to get the directory from
Returns:
Returns the current directory displayed in the file dialog

void ewl_filepicker_directory_set ( Ewl_Filepicker fp,
const char *  dir 
)

Set the current directory to be displayed in the filepicker.

Parameters:
fp,: The filepicker to set the directory on
dir,: The directory to set
Returns:
Returns no value.

Ewl_Filelist_Filter* ewl_filepicker_filter_add ( Ewl_Filepicker fp,
const char *  name,
const char *  extension,
Ecore_List *  mime_types 
)

Add the filter named name to the combo box in the filepicker.

Parameters:
fp,: The filepicker to work with
name,: The name to display for the filter
extension,: The extension to filter for
mime_types,: The mime types to filter for
Returns:
Returns the filter created. Do not free the returned filter.

Ewl_Filelist_Filter* ewl_filepicker_filter_get ( Ewl_Filepicker fp  ) 

Retrieves the current filter used in the filepicker. Do not free the filter!

Parameters:
fp,: The filepicker to get the filter from
Returns:
Returns the current filter used in the filepicker

void ewl_filepicker_filter_set ( Ewl_Filepicker fp,
Ewl_Filelist_Filter filter 
)

Set the given filter into the file picker and updates the combo.

Parameters:
fp,: The filepicker to set the filter on
filter,: The filter to set on the filepicker
Returns:
Returns no value.

int ewl_filepicker_init ( Ewl_Filepicker fp  ) 

Initialize an Ewl_Filepicker to default values.

Parameters:
fp,: The filepicker to initialize
Returns:
Returns TRUE on success or FALSE on failure

Ewl_Filelist_View ewl_filepicker_list_view_get ( Ewl_Filepicker fp  ) 

Retrieves the current view used for the file list.

Parameters:
fp,: The filepicker to get the value from
Returns:
Returns the current view set on the filepicker

void ewl_filepicker_list_view_set ( Ewl_Filepicker fp,
Ewl_Filelist_View  view 
)

Sets the given view to be used to display the file list.

Parameters:
fp,: The filepicker to change
view,: The view to use for the file list
Returns:
Returns no value

unsigned int ewl_filepicker_multiselect_get ( Ewl_Filepicker fp  ) 

Retrieves the current multi-select value from the filepicker.

Parameters:
fp,: The filepicker to get the multiselect value from
Returns:
Returns the current multi-select value of the filepicker

void ewl_filepicker_multiselect_set ( Ewl_Filepicker fp,
unsigned int  ms 
)

Sets the multiselect state of the filepicker to the given value.

Parameters:
fp,: The filepicker to set the multi-select flag
ms,: The multi-select setting to place on the filepicker
Returns:
Returns no value.

Ewl_Widget* ewl_filepicker_new ( void   ) 

Creates a new Ewl_Filepicker widget.

Returns:
Returns a new Ewl_Filepicker widget or NULL on failure

unsigned int ewl_filepicker_return_directories_get ( Ewl_Filepicker fp  ) 

Gets the filepicker's policy on returning directories.

Parameters:
fp,: The filepicker to work with
Returns:
Returns non-zero if the filepicker can return directories

void ewl_filepicker_return_directories_set ( Ewl_Filepicker fp,
unsigned int  t 
)

Sets the filepicker's policy on returning directories.

Parameters:
fp,: The filepicker to work with
t,: Non-zero to allow the filepicker to open directories
Returns:
Returns no value

unsigned int ewl_filepicker_save_as_get ( Ewl_Filepicker fp  ) 

Gets the current type of the filepicker.

Parameters:
fp,: The filepicker to work with
Returns:
Returns non-zero if the filepicker is currently a Save As type

Ewl_Widget* ewl_filepicker_save_as_new ( void   ) 

A convenience function to create a Save As widget.

Returns:
Returns a created Save As widget or NULL on failure

void ewl_filepicker_save_as_set ( Ewl_Filepicker fp,
unsigned int  t 
)

Sets the type for the filepicker.

Parameters:
fp,: The filepicker to work with
t,: Non-zero to set the filepicker to a save type
Returns:
Returns no value

char* ewl_filepicker_selected_file_get ( Ewl_Filepicker fp  ) 

Retrieves the currently selected file from the filepicker.

Parameters:
fp,: The filepicker to get the selected file from
Returns:
Returns the full path of the currently selected file in the filepicker

void ewl_filepicker_selected_file_set ( Ewl_Filepicker fp,
const char *  file 
)

Sets the given file as selected in the filepicker.

Parameters:
fp,: The filepicker to set the selected file into
file,: The file to set selected in the filepicker
Returns:
Returns no value

Ecore_List* ewl_filepicker_selected_files_get ( Ewl_Filepicker fp  ) 

Retrieves the list of selected files in the filepicker.

Parameters:
fp,: The filepicker to work with
Returns:
Returns the Ecore_List of selected files in the filepicker

void ewl_filepicker_selected_files_set ( Ewl_Filepicker fp,
Ecore_List *  files 
)

Sets the given files as selected in the filepicker.

Parameters:
fp,: The filepicker to set the selected files into
files,: The Ecore_List of selected files to set into the filepicker
Returns:
Returns no value

unsigned int ewl_filepicker_show_dot_files_get ( Ewl_Filepicker fp  ) 

Retrieves the current show dot files setting of the filepicker.

Parameters:
fp,: The filepicker to get the showdot files setting from
Returns:
Returns the current show dot files setting of the filepicker

void ewl_filepicker_show_dot_files_set ( Ewl_Filepicker fp,
unsigned int  dot 
)

Set the show dot files setting of the filepicker to the given value.

Parameters:
fp,: The filepicker to set the value into
dot,: The show dot files setting to set.
Returns:
Returns no value.

unsigned int ewl_filepicker_show_favorites_get ( Ewl_Filepicker fp  ) 

Retrieves the current show favorites setting of the filepicker.

Parameters:
fp,: The filepicker to get the show favorites value from
Returns:
Returns the current show favorites setting of the filepicker

void ewl_filepicker_show_favorites_set ( Ewl_Filepicker fp,
unsigned int  show 
)

Sets the show favorites setting of the file picker.

Parameters:
fp,: The filepicker to change
show,: The show favorites setting to apply
Returns:
Returns no value


Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sun Sep 27 01:49:46 2009