#include <Elementary.h>
#include "elm_priv.h"
+#include "elm_widget_button.h"
-typedef struct _Widget_Data Widget_Data;
+static const char FILESELECTOR_BUTTON_SMART_NAME[] = "elm_fileselector_button";
-struct _Widget_Data
+typedef struct _Elm_Fileselector_Button_Smart_Data \
+ Elm_Fileselector_Button_Smart_Data;
+
+struct _Elm_Fileselector_Button_Smart_Data
{
- Evas_Object *self, *btn, *fs, *fsw;
- const char *window_title;
- Evas_Coord w, h;
+ Elm_Button_Smart_Data base;
+
+ Evas_Object *fs, *fsw;
+ const char *window_title;
+ Evas_Coord w, h;
+
struct
{
const char *path;
Eina_Bool folder_only : 1;
Eina_Bool is_save : 1;
} fsd;
- Eina_Bool inwin_mode : 1;
+
+ Eina_Bool inwin_mode : 1;
};
#define DEFAULT_WINDOW_TITLE "Select a file"
-static const char *widtype = NULL;
-
-static void _del_pre_hook(Evas_Object *obj);
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _disable_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data,
- Evas *e,
- Evas_Object *obj,
- void *event_info);
-static void _button_clicked(void *data,
- Evas_Object *obj,
- void *event_info);
-static void _on_focus_hook(void *data,
- Evas_Object *obj);
-static void _selection_done(void *data,
- Evas_Object *obj,
- void *event_info);
-static void _activate(Widget_Data *wd);
+#define ELM_FILESELECTOR_BUTTON_DATA_GET(o, sd) \
+ Elm_Fileselector_Button_Smart_Data * sd = evas_object_smart_data_get(o)
+
+#define ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(o, ptr) \
+ ELM_FILESELECTOR_BUTTON_DATA_GET(o, ptr); \
+ if (!ptr) \
+ { \
+ CRITICAL("No widget data for object %p (%s)", \
+ o, evas_object_type_get(o)); \
+ return; \
+ }
+
+#define ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
+ ELM_FILESELECTOR_BUTTON_DATA_GET(o, ptr); \
+ if (!ptr) \
+ { \
+ CRITICAL("No widget data for object %p (%s)", \
+ o, evas_object_type_get(o)); \
+ return val; \
+ }
+
+#define ELM_FILESELECTOR_BUTTON_CHECK(obj) \
+ if (!obj || !elm_widget_type_check \
+ ((obj), FILESELECTOR_BUTTON_SMART_NAME, __func__)) \
+ return
static const char SIG_FILE_CHOSEN[] = "file,chosen";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_FILE_CHOSEN, "s"},
- {NULL, NULL}
+static const Evas_Smart_Cb_Description _smart_callbacks[] = {
+ {SIG_FILE_CHOSEN, "s"},
+ {NULL, NULL}
};
-static void
-_del_pre_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- evas_object_event_callback_del_full(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- evas_object_smart_callback_del(wd->btn, "clicked", _button_clicked);
-}
+EVAS_SMART_SUBCLASS_NEW
+ (FILESELECTOR_BUTTON_SMART_NAME, _elm_fileselector_button,
+ Elm_Button_Smart_Class, Elm_Button_Smart_Class, elm_button_smart_class_get,
+ _smart_callbacks);
-static void
-_del_hook(Evas_Object *obj)
+static Eina_Bool
+_elm_fileselector_button_smart_theme(Evas_Object *obj)
{
- Evas_Object *win;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
+ char buf[4096];
+ const char *style;
- if (wd->window_title) eina_stringshare_del(wd->window_title);
- if (wd->fsd.path) eina_stringshare_del(wd->fsd.path);
- if (wd->fs)
- {
- win = evas_object_data_del(obj, "win");
- evas_object_del(win);
- }
- free(wd);
-}
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
-static void
-_on_focus_hook(void *data __UNUSED__,
- Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (elm_widget_focus_get(obj))
- elm_widget_focus_steal(wd->btn);
-}
+ style = eina_stringshare_add(elm_widget_style_get(obj));
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_widget_mirrored_set(wd->btn, rtl);
- elm_widget_mirrored_set(wd->fs, rtl);
-}
+ snprintf(buf, sizeof(buf), "fileselector_button/%s", style);
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- char buf[4096];
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-
- snprintf(buf, sizeof(buf), "fileselector_button/%s",
- elm_widget_style_get(obj));
- elm_object_style_set(wd->btn, buf);
- _sizing_eval(obj);
-}
+ /* file selector button's style has an extra bit */
+ eina_stringshare_replace(&(ELM_WIDGET_DATA(sd)->style), buf);
-static void
-_disable_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_widget_disabled_set(wd->btn, elm_widget_disabled_get(obj));
-}
+ if (!ELM_WIDGET_CLASS(_elm_fileselector_button_parent_sc)->theme(obj))
+ return EINA_FALSE;
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- if (!wd) return;
- evas_object_size_hint_min_get(wd->btn, &minw, &minh);
- evas_object_size_hint_max_get(wd->btn, &maxw, &maxh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
+ eina_stringshare_replace(&(ELM_WIDGET_DATA(sd)->style), style);
-static void
-_changed_size_hints(void *data,
- Evas *e __UNUSED__,
- Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- _sizing_eval(data);
-}
+ eina_stringshare_del(style);
-static void
-_activate_hook(Evas_Object *obj)
-{
- Widget_Data *wd;
- wd = elm_widget_data_get(obj);
- if (!wd) return;
- _activate(wd);
+ return EINA_TRUE;
}
static void
-_button_clicked(void *data,
+_selection_done(void *data,
Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
+ void *event_info)
{
- _activate(data);
-}
+ Elm_Fileselector_Button_Smart_Data *sd = data;
+ const char *file = event_info;
+ Evas_Object *del;
-static Evas_Object *
-_parent_win_get(Evas_Object *obj)
-{
- while ((obj) && (strcmp(elm_widget_type_get(obj), "win")))
- obj = elm_object_parent_widget_get(obj);
+ if (file) eina_stringshare_replace(&sd->fsd.path, file);
- return obj;
+ del = sd->fsw;
+ sd->fs = NULL;
+ sd->fsw = NULL;
+ evas_object_del(del);
+
+ evas_object_smart_callback_call
+ (ELM_WIDGET_DATA(sd)->obj, SIG_FILE_CHOSEN, (void *)sd->fsd.path);
}
static Evas_Object *
-_new_window_add(Widget_Data *wd)
+_new_window_add(Elm_Fileselector_Button_Smart_Data *sd)
{
Evas_Object *win, *bg;
win = elm_win_add(NULL, "fileselector_button", ELM_WIN_DIALOG_BASIC);
- elm_win_title_set(win, wd->window_title);
+ elm_win_title_set(win, sd->window_title);
elm_win_autodel_set(win, EINA_TRUE);
- evas_object_smart_callback_add(win, "delete,request", _selection_done, wd);
+ evas_object_smart_callback_add(win, "delete,request", _selection_done, sd);
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);
- evas_object_resize(win, wd->w, wd->h);
+ evas_object_resize(win, sd->w, sd->h);
return win;
}
+static Evas_Object *
+_parent_win_get(Evas_Object *obj)
+{
+ while ((obj) && (strcmp(elm_widget_type_get(obj), "elm_win")))
+ obj = elm_object_parent_widget_get(obj);
+
+ return obj;
+}
+
static void
-_activate(Widget_Data *wd)
+_activate(Elm_Fileselector_Button_Smart_Data *sd)
{
Eina_Bool is_inwin = EINA_FALSE;
- if (wd->fs) return;
+ if (sd->fs) return;
- if (wd->inwin_mode)
+ if (sd->inwin_mode)
{
- wd->fsw = _parent_win_get(wd->self);
+ sd->fsw = _parent_win_get(ELM_WIDGET_DATA(sd)->obj);
- if (!wd->fsw)
- wd->fsw = _new_window_add(wd);
+ if (!sd->fsw)
+ sd->fsw = _new_window_add(sd);
else
{
- wd->fsw = elm_win_inwin_add(wd->fsw);
+ sd->fsw = elm_win_inwin_add(sd->fsw);
is_inwin = EINA_TRUE;
}
}
else
- wd->fsw = _new_window_add(wd);
-
- wd->fs = elm_fileselector_add(wd->fsw);
- elm_widget_mirrored_set(wd->fs, elm_widget_mirrored_get(wd->self));
- elm_widget_mirrored_automatic_set(wd->fs, EINA_FALSE);
- elm_fileselector_expandable_set(wd->fs, wd->fsd.expandable);
- elm_fileselector_folder_only_set(wd->fs, wd->fsd.folder_only);
- elm_fileselector_is_save_set(wd->fs, wd->fsd.is_save);
- elm_fileselector_selected_set(wd->fs, wd->fsd.path);
- evas_object_size_hint_weight_set(wd->fs, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(wd->fs, "done", _selection_done, wd);
- evas_object_show(wd->fs);
+ sd->fsw = _new_window_add(sd);
+
+ sd->fs = elm_fileselector_add(sd->fsw);
+ elm_widget_mirrored_set
+ (sd->fs, elm_widget_mirrored_get(ELM_WIDGET_DATA(sd)->obj));
+ elm_widget_mirrored_automatic_set(sd->fs, EINA_FALSE);
+ elm_fileselector_expandable_set(sd->fs, sd->fsd.expandable);
+ elm_fileselector_folder_only_set(sd->fs, sd->fsd.folder_only);
+ elm_fileselector_is_save_set(sd->fs, sd->fsd.is_save);
+ elm_fileselector_selected_set(sd->fs, sd->fsd.path);
+ evas_object_size_hint_weight_set
+ (sd->fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(sd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(sd->fs, "done", _selection_done, sd);
+ evas_object_show(sd->fs);
if (is_inwin)
{
- elm_win_inwin_content_set(wd->fsw, wd->fs);
- elm_win_inwin_activate(wd->fsw);
+ elm_win_inwin_content_set(sd->fsw, sd->fs);
+ elm_win_inwin_activate(sd->fsw);
}
else
{
- elm_win_resize_object_add(wd->fsw, wd->fs);
- evas_object_show(wd->fsw);
+ elm_win_resize_object_add(sd->fsw, sd->fs);
+ evas_object_show(sd->fsw);
}
}
static void
-_selection_done(void *data,
+_button_clicked(void *data,
Evas_Object *obj __UNUSED__,
- void *event_info)
+ void *event_info __UNUSED__)
{
- const char *file = event_info;
- Widget_Data *wd = data;
- Evas_Object *del;
- if (!wd) return;
+ _activate(data);
+}
+
+static void
+_elm_fileselector_button_smart_add(Evas_Object *obj)
+{
+ EVAS_SMART_DATA_ALLOC(obj, Elm_Fileselector_Button_Smart_Data);
- if (file) eina_stringshare_replace(&wd->fsd.path, file);
+ ELM_WIDGET_CLASS(_elm_fileselector_button_parent_sc)->base.add(obj);
- del = wd->fsw;
- wd->fs = NULL;
- wd->fsw = NULL;
- evas_object_del(del);
+ priv->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE);
+ if (getenv("HOME")) priv->fsd.path = eina_stringshare_add(getenv("HOME"));
+ else priv->fsd.path = eina_stringshare_add("/");
- evas_object_smart_callback_call(wd->self, SIG_FILE_CHOSEN,
- (void *)wd->fsd.path);
+ priv->fsd.expandable = _elm_config->fileselector_expand_enable;
+ priv->inwin_mode = _elm_config->inwin_dialogs_enable;
+ priv->w = 400;
+ priv->h = 400;
+
+ elm_widget_mirrored_automatic_set(obj, EINA_FALSE);
+
+ evas_object_smart_callback_add(obj, "clicked", _button_clicked, priv);
+
+ _elm_fileselector_button_smart_theme(obj);
+ elm_widget_can_focus_set(obj, EINA_TRUE);
}
static void
-_elm_fileselector_button_label_set(Evas_Object *obj, const char *item,
- const char *label)
+_elm_fileselector_button_smart_del(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (item && strcmp(item, "default")) return;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_object_text_set(wd->btn, label);
-}
+ Evas_Object *win;
-static const char *
-_elm_fileselector_button_label_get(const Evas_Object *obj, const char *item)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return NULL;
- if (!wd) return NULL;
- return elm_object_text_get(wd->btn);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
+
+ if (sd->window_title) eina_stringshare_del(sd->window_title);
+ if (sd->fsd.path) eina_stringshare_del(sd->fsd.path);
+ if (sd->fs)
+ {
+ win = evas_object_data_del(obj, "win");
+ evas_object_del(win);
+ }
+
+ ELM_WIDGET_CLASS(_elm_fileselector_button_parent_sc)->base.del(obj);
}
static void
-_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+_elm_fileselector_button_smart_set_user(Elm_Button_Smart_Class *sc)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_object_part_content_set(wd->btn, part, content);
-}
+ ELM_WIDGET_CLASS(sc)->base.add = _elm_fileselector_button_smart_add;
+ ELM_WIDGET_CLASS(sc)->base.del = _elm_fileselector_button_smart_del;
-static Evas_Object *
-_content_get_hook(const Evas_Object *obj, const char *part)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_object_part_content_get(wd->btn, part);
-}
+ ELM_WIDGET_CLASS(sc)->theme = _elm_fileselector_button_smart_theme;
-static Evas_Object *
-_content_unset_hook(Evas_Object *obj, const char *part)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_object_part_content_unset(wd->btn, part);
+ sc->admits_autorepeat = EINA_FALSE;
}
EAPI Evas_Object *
elm_fileselector_button_add(Evas_Object *parent)
{
- Evas_Object *obj;
Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "fileselector_button");
- elm_widget_type_set(obj, "fileselector_button");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
- elm_widget_data_set(obj, wd);
- elm_widget_del_pre_hook_set(obj, _del_pre_hook);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_disable_hook_set(obj, _disable_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_activate_hook_set(obj, _activate_hook);
- elm_widget_text_set_hook_set(obj, _elm_fileselector_button_label_set);
- elm_widget_text_get_hook_set(obj, _elm_fileselector_button_label_get);
- elm_widget_content_set_hook_set(obj, _content_set_hook);
- elm_widget_content_get_hook_set(obj, _content_get_hook);
- elm_widget_content_unset_hook_set(obj, _content_unset_hook);
-
- wd->self = obj;
- wd->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE);
- if (getenv("HOME")) wd->fsd.path = eina_stringshare_add(getenv("HOME"));
- else wd->fsd.path = eina_stringshare_add("/");
- wd->fsd.expandable = _elm_config->fileselector_expand_enable;
- wd->inwin_mode = _elm_config->inwin_dialogs_enable;
- wd->w = 400;
- wd->h = 400;
-
- wd->btn = elm_button_add(parent);
- elm_widget_mirrored_automatic_set(wd->btn, EINA_FALSE);
- elm_widget_resize_object_set(obj, wd->btn);
- evas_object_event_callback_add(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- evas_object_smart_callback_add(wd->btn, "clicked", _button_clicked, wd);
- elm_widget_sub_object_add(obj, wd->btn);
-
- _theme_hook(obj);
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
+ Evas_Object *obj;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
+
+ e = evas_object_evas_get(parent);
+ if (!e) return NULL;
+
+ obj = evas_object_smart_add(e, _elm_fileselector_button_smart_class_new());
+
+ if (!elm_widget_sub_object_add(parent, obj))
+ ERR("could not add %p as sub object of %p", obj, parent);
+
return obj;
}
-
EAPI void
elm_fileselector_button_window_title_set(Evas_Object *obj,
- const char *title)
+ const char *title)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- eina_stringshare_replace(&wd->window_title, title);
+ eina_stringshare_replace(&sd->window_title, title);
- if (wd->fsw)
- elm_win_title_set(wd->fsw, wd->window_title);
+ if (sd->fsw) elm_win_title_set(sd->fsw, sd->window_title);
}
EAPI const char *
elm_fileselector_button_window_title_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj) NULL;
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return NULL;
- return wd->window_title;
+ return sd->window_title;
}
EAPI void
elm_fileselector_button_window_size_set(Evas_Object *obj,
- Evas_Coord width,
- Evas_Coord height)
+ Evas_Coord width,
+ Evas_Coord height)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- wd->w = width;
- wd->h = height;
+ sd->w = width;
+ sd->h = height;
- if (wd->fsw)
- evas_object_resize(wd->fsw, wd->w, wd->h);
+ if (sd->fsw) evas_object_resize(sd->fsw, sd->w, sd->h);
}
EAPI void
elm_fileselector_button_window_size_get(const Evas_Object *obj,
- Evas_Coord *width,
- Evas_Coord *height)
+ Evas_Coord *width,
+ Evas_Coord *height)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- if (width) *width = wd->w;
- if (height) *height = wd->h;
+ if (width) *width = sd->w;
+ if (height) *height = sd->h;
}
EAPI void
elm_fileselector_button_path_set(Evas_Object *obj,
- const char *path)
+ const char *path)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- eina_stringshare_replace(&wd->fsd.path, path);
+ eina_stringshare_replace(&sd->fsd.path, path);
- if (wd->fs)
- elm_fileselector_selected_set(wd->fs, wd->fsd.path);
+ if (sd->fs) elm_fileselector_selected_set(sd->fs, sd->fsd.path);
}
EAPI const char *
elm_fileselector_button_path_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->fsd.path;
+ ELM_FILESELECTOR_BUTTON_CHECK(obj) NULL;
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
+
+ return sd->fsd.path;
}
EAPI void
elm_fileselector_button_expandable_set(Evas_Object *obj,
- Eina_Bool value)
+ Eina_Bool value)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- wd->fsd.expandable = value;
+ sd->fsd.expandable = value;
- if (wd->fs)
- elm_fileselector_expandable_set(wd->fs, wd->fsd.expandable);
+ if (sd->fs) elm_fileselector_expandable_set(sd->fs, sd->fsd.expandable);
}
EAPI Eina_Bool
elm_fileselector_button_expandable_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj) EINA_FALSE;
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return EINA_FALSE;
- return wd->fsd.expandable;
+ return sd->fsd.expandable;
}
EAPI void
elm_fileselector_button_folder_only_set(Evas_Object *obj,
- Eina_Bool value)
+ Eina_Bool value)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- wd->fsd.folder_only = value;
+ sd->fsd.folder_only = value;
- if (wd->fs)
- elm_fileselector_folder_only_set(wd->fs, wd->fsd.folder_only);
+ if (sd->fs) elm_fileselector_folder_only_set(sd->fs, sd->fsd.folder_only);
}
EAPI Eina_Bool
elm_fileselector_button_folder_only_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj) EINA_FALSE;
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return EINA_FALSE;
- return wd->fsd.folder_only;
+ return sd->fsd.folder_only;
}
EAPI void
elm_fileselector_button_is_save_set(Evas_Object *obj,
- Eina_Bool value)
+ Eina_Bool value)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- wd->fsd.is_save = value;
+ sd->fsd.is_save = value;
- if (wd->fs)
- elm_fileselector_is_save_set(wd->fs, wd->fsd.is_save);
+ if (sd->fs) elm_fileselector_is_save_set(sd->fs, sd->fsd.is_save);
}
EAPI Eina_Bool
elm_fileselector_button_is_save_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj) EINA_FALSE;
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return EINA_FALSE;
- return wd->fsd.is_save;
+ return sd->fsd.is_save;
}
EAPI void
elm_fileselector_button_inwin_mode_set(Evas_Object *obj,
- Eina_Bool value)
+ Eina_Bool value)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj);
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return;
- wd->inwin_mode = value;
+ sd->inwin_mode = value;
}
EAPI Eina_Bool
elm_fileselector_button_inwin_mode_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_FILESELECTOR_BUTTON_CHECK(obj) EINA_FALSE;
+ ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd);
- if (!wd) return EINA_FALSE;
- return wd->inwin_mode;
+ return sd->inwin_mode;
}