2012-08-01 14:03:33 -07:00
|
|
|
#ifndef ELM_WIDGET_FILESELECTOR_H
|
|
|
|
#define ELM_WIDGET_FILESELECTOR_H
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "Elementary.h"
|
2012-08-01 14:03:33 -07:00
|
|
|
|
2014-08-07 09:26:47 -07:00
|
|
|
/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
|
|
|
|
* CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
|
|
|
|
* FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
|
|
|
|
* IT AT RUNTIME.
|
|
|
|
*/
|
|
|
|
|
2012-08-01 14:03:33 -07:00
|
|
|
/**
|
|
|
|
* @addtogroup Widget
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @section elm-fileselector-class The Elementary Fileselector Class
|
|
|
|
*
|
|
|
|
* Elementary, besides having the @ref Fileselector widget, exposes its
|
|
|
|
* foundation -- the Elementary Fileselector Class -- in order to create other
|
|
|
|
* widgets which are a fileselector with some more logic on top.
|
|
|
|
*/
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
typedef struct _Elm_Fileselector_Filter Elm_Fileselector_Filter;
|
|
|
|
|
2012-08-01 14:03:33 -07:00
|
|
|
/**
|
|
|
|
* Base layout smart data extended with fileselector instance data.
|
|
|
|
*/
|
2014-04-22 05:51:46 -07:00
|
|
|
typedef struct _Elm_Fileselector_Data Elm_Fileselector_Data;
|
|
|
|
struct _Elm_Fileselector_Data
|
2012-08-01 14:03:33 -07:00
|
|
|
{
|
|
|
|
EINA_REFCOUNT;
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
Evas_Object *path_entry;
|
2013-09-25 07:43:22 -07:00
|
|
|
Evas_Object *name_entry;
|
2014-06-10 02:50:01 -07:00
|
|
|
Evas_Object *search_entry;
|
2013-10-17 22:25:20 -07:00
|
|
|
Evas_Object *files_view;
|
2013-06-18 17:00:41 -07:00
|
|
|
Evas_Object *up_button;
|
|
|
|
Evas_Object *home_button;
|
|
|
|
Evas_Object *spinner;
|
|
|
|
Evas_Object *filter_hoversel;
|
|
|
|
Evas_Object *ok_button;
|
|
|
|
Evas_Object *cancel_button;
|
|
|
|
|
|
|
|
Eina_List *filter_list;
|
|
|
|
Elm_Fileselector_Filter *current_filter;
|
2012-08-01 14:03:33 -07:00
|
|
|
|
2013-10-16 19:04:57 -07:00
|
|
|
/* a list of selected paths. only for multi selection */
|
|
|
|
Eina_List *paths;
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
const char *path;
|
|
|
|
const char *selection;
|
2013-09-30 08:49:50 -07:00
|
|
|
Ecore_Idler *populate_idler;
|
2014-09-02 20:44:05 -07:00
|
|
|
Ecore_Idler *path_entry_idler;
|
2012-08-01 14:03:33 -07:00
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
const char *path_separator;
|
2014-06-10 02:50:01 -07:00
|
|
|
const char *search_string;
|
2012-08-01 14:03:33 -07:00
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
Eio_File *current;
|
2013-10-20 19:14:47 -07:00
|
|
|
Eio_Monitor *monitor;
|
|
|
|
Eina_List *handlers;
|
2012-08-01 14:03:33 -07:00
|
|
|
|
2013-12-03 01:28:52 -08:00
|
|
|
Evas_Coord_Size thumbnail_size;
|
|
|
|
|
2013-12-18 03:05:35 -08:00
|
|
|
/* a sort method to decide orders of files/directories */
|
|
|
|
int (*sort_method)(const char *, const char *);
|
|
|
|
|
2013-12-05 03:23:47 -08:00
|
|
|
Elm_Fileselector_Mode mode;
|
2013-12-18 03:05:35 -08:00
|
|
|
Elm_Fileselector_Sort sort_type;
|
2012-08-01 14:03:33 -07:00
|
|
|
|
2013-12-05 03:23:47 -08:00
|
|
|
Eina_Bool only_folder : 1;
|
|
|
|
Eina_Bool expand : 1;
|
|
|
|
Eina_Bool double_tap_navigation : 1;
|
|
|
|
Eina_Bool multi : 1;
|
2013-10-16 19:04:57 -07:00
|
|
|
|
|
|
|
/* this flag is only for multi selection.
|
2014-08-13 03:50:38 -07:00
|
|
|
* If this flag is set to @c EINA_TRUE, it means directory is selected
|
2013-10-16 19:04:57 -07:00
|
|
|
* so that fileselector will clear current selection when user clicked
|
|
|
|
* another item. */
|
2013-12-05 03:23:47 -08:00
|
|
|
Eina_Bool dir_selected : 1;
|
2013-10-17 20:16:54 -07:00
|
|
|
|
2013-12-05 03:23:47 -08:00
|
|
|
Eina_Bool hidden_visible : 1;
|
2012-08-01 14:03:33 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sel_data
|
|
|
|
{
|
2014-10-28 18:07:44 -07:00
|
|
|
Evas_Object *fs;
|
|
|
|
Eina_Stringshare *path;
|
|
|
|
Eina_Stringshare *selected;
|
2012-08-01 14:03:33 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Listing_Request Listing_Request;
|
|
|
|
struct _Listing_Request
|
|
|
|
{
|
2014-04-22 05:51:46 -07:00
|
|
|
Elm_Fileselector_Data *sd;
|
2012-08-01 14:03:33 -07:00
|
|
|
Elm_Object_Item *parent_it;
|
|
|
|
|
|
|
|
Evas_Object *obj;
|
|
|
|
const char *path;
|
2013-09-10 02:47:30 -07:00
|
|
|
const char *selected;
|
2012-08-01 14:03:33 -07:00
|
|
|
Eina_Bool first : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ELM_DIRECTORY = 0,
|
|
|
|
ELM_FILE_IMAGE = 1,
|
|
|
|
ELM_FILE_UNKNOW = 2,
|
|
|
|
ELM_FILE_LAST
|
|
|
|
} Elm_Fileselector_Type;
|
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
typedef enum {
|
|
|
|
ELM_FILESELECTOR_MIME_FILTER = 0,
|
|
|
|
ELM_FILESELECTOR_CUSTOM_FILTER,
|
|
|
|
ELM_FILESELECTOR_FILTER_LAST
|
|
|
|
} Elm_Fileselector_Filter_Type;
|
|
|
|
|
|
|
|
typedef struct _Elm_Fileselector_Custom_Filter Elm_Fileselector_Custom_Filter;
|
|
|
|
struct _Elm_Fileselector_Custom_Filter
|
|
|
|
{
|
|
|
|
Elm_Fileselector_Filter_Func func;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2013-06-18 17:00:41 -07:00
|
|
|
struct _Elm_Fileselector_Filter
|
|
|
|
{
|
2013-12-28 20:23:17 -08:00
|
|
|
const char *filter_name;
|
2014-04-22 05:51:46 -07:00
|
|
|
Elm_Fileselector_Data *sd;
|
2013-12-28 20:23:17 -08:00
|
|
|
|
|
|
|
union {
|
|
|
|
char **mime_types;
|
|
|
|
Elm_Fileselector_Custom_Filter *custom;
|
|
|
|
} filter;
|
2013-06-18 17:00:41 -07:00
|
|
|
|
2013-12-28 20:23:17 -08:00
|
|
|
Elm_Fileselector_Filter_Type filter_type;
|
2013-06-18 17:00:41 -07:00
|
|
|
};
|
|
|
|
|
2012-08-01 14:03:33 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ELM_FILESELECTOR_DATA_GET(o, sd) \
|
2014-06-03 03:35:28 -07:00
|
|
|
Elm_Fileselector_Data * sd = eo_data_scope_get(o, ELM_FILESELECTOR_CLASS)
|
2012-08-01 14:03:33 -07:00
|
|
|
|
|
|
|
#define ELM_FILESELECTOR_DATA_GET_OR_RETURN(o, ptr) \
|
|
|
|
ELM_FILESELECTOR_DATA_GET(o, ptr); \
|
2014-01-15 10:33:40 -08:00
|
|
|
if (EINA_UNLIKELY(!ptr)) \
|
2012-08-01 14:03:33 -07:00
|
|
|
{ \
|
2014-01-15 10:33:40 -08:00
|
|
|
CRI("No widget data for object %p (%s)", \
|
|
|
|
o, evas_object_type_get(o)); \
|
2012-08-01 14:03:33 -07:00
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ELM_FILESELECTOR_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
|
|
|
|
ELM_FILESELECTOR_DATA_GET(o, ptr); \
|
2014-01-15 10:33:40 -08:00
|
|
|
if (EINA_UNLIKELY(!ptr)) \
|
2012-08-01 14:03:33 -07:00
|
|
|
{ \
|
2014-01-15 10:33:40 -08:00
|
|
|
CRI("No widget data for object %p (%s)", \
|
|
|
|
o, evas_object_type_get(o)); \
|
2012-08-01 14:03:33 -07:00
|
|
|
return val; \
|
|
|
|
}
|
|
|
|
|
2014-01-15 10:33:40 -08:00
|
|
|
#define ELM_FILESELECTOR_CHECK(obj) \
|
2014-06-03 03:35:28 -07:00
|
|
|
if (EINA_UNLIKELY(!eo_isa((obj), ELM_FILESELECTOR_CLASS))) \
|
2012-08-01 14:03:33 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
#endif
|