elm_icon_standard_set(ic, "folder");
elm_icon_scale_set(ic, EINA_FALSE, EINA_FALSE);
Elm_Object_Item *it = elm_ctxpopup_item_append(ctxpopup, "Navigate to folder", ic, NULL, NULL);
-elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+elm_object_item_disabled_set(it, EINA_TRUE);
evas_object_size_hint_weight_set(ctxpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_move(ctxpopup, 0, 0);
_ctxpopup_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
printf("ctxpopup item selected: %s\n",
- elm_ctxpopup_item_label_get(event_info));
+ elm_object_item_text_get(event_info));
}
#define ITEM_NEW(_hov, _label, _icon) \
ITEM_NEW(ctxpopup, "Save file", "file");
ITEM_NEW(ctxpopup, "Delete file", "delete");
ITEM_NEW(ctxpopup, "Navigate to folder", "folder");
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
ITEM_NEW(ctxpopup, "Edit entry", "edit");
ITEM_NEW(ctxpopup, "Set date and time", "clock");
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
evas_object_size_hint_max_set(ctxpopup, 240, 240);
ITEM_NEW(ctxpopup, NULL, "delete");
ITEM_NEW(ctxpopup, NULL, "folder");
ITEM_NEW(ctxpopup, NULL, "edit");
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
ITEM_NEW(ctxpopup, NULL, "clock");
evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
ITEM_NEW(ctxpopup, "Eet", NULL);
ITEM_NEW(ctxpopup, "Evas", NULL);
ITEM_NEW(ctxpopup, "Ecore", NULL);
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
ITEM_NEW(ctxpopup, "Embryo", NULL);
ITEM_NEW(ctxpopup, "Edje", NULL);
static void
_ctxpopup_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
- printf("ctxpopup item selected: %s\n", elm_ctxpopup_item_label_get(event_info));
+ printf("ctxpopup item selected: %s\n", elm_object_item_text_get(event_info));
}
Elm_Object_Item *item_new(Evas_Object *ctxpopup, const char * label, const char *icon)
item_new(ctxpopup, "Save file", "file");
item_new(ctxpopup, "Delete file", "delete");
it = item_new(ctxpopup, "Navigate to folder", "folder");
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
item_new(ctxpopup, "Edit entry", "edit");
it = item_new(ctxpopup, "Set date and time", "clock");
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
evas_object_size_hint_max_set(ctxpopup, 240, 240);
item_new(ctxpopup, NULL, "delete");
item_new(ctxpopup, NULL, "folder");
it = item_new(ctxpopup, NULL, "edit");
- elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
+ elm_object_item_disabled_set(it, EINA_TRUE);
item_new(ctxpopup, NULL, "clock");
evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
* Default contents parts of the ctxpopup widget that you can use for are:
* @li "default" - A content of the ctxpopup
*
+ * Default contents parts of the naviframe items that you can use for are:
+ * @li "icon" - A icon in the title area
+ *
+ * Default text parts of the naviframe items that you can use for are:
+ * @li "default" - Title label in the title area
+ *
* @ref tutorial_ctxpopup shows the usage of a good deal of the API.
* @{
*/
* @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
*
* When disabled the item is greyed out to indicate it's state.
+ * @deprecated use elm_object_item_disabled_set() instead
*/
- EAPI void elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1);
/**
* @brief Get the ctxpopup item's disabled/enabled state.
*
* @return disabled @c EINA_TRUE, if disabled, @c EINA_FALSE otherwise
*
* @see elm_ctxpopup_item_disabled_set()
+ * @deprecated use elm_object_item_disabled_get() instead
*/
EAPI Eina_Bool elm_ctxpopup_item_disabled_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
*
* @see elm_ctxpopup_item_append()
* @see elm_ctxpopup_item_icon_set()
+ *
+ * @deprecated use elm_object_item_content_part_get() instead
*/
- EAPI Evas_Object *elm_ctxpopup_item_icon_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_ctxpopup_item_icon_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* @brief Sets the side icon associated with the ctxpopup item
*
* dissapear from the first item.
*
* @see elm_ctxpopup_item_append()
+ *
+ * @deprecated use elm_object_item_content_part_set() instead
+ *
*/
- EAPI void elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
* @brief Get the label for the given ctxpopup item.
*
*
* @see elm_ctxpopup_item_append()
* @see elm_ctxpopup_item_label_set()
+ *
+ * @deprecated use elm_object_item_text_get() instead
*/
- EAPI const char *elm_ctxpopup_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI const char *elm_ctxpopup_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* @brief (Re)set the label on the given ctxpopup item.
*
* @param it Ctxpopup item
* @param label String to set as label
+ *
+ * @deprecated use elm_object_item_text_set() instead
*/
- EAPI void elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
/**
* @brief Set an elm widget as the content of the ctxpopup.
*
const char *label;
Evas_Object *icon;
Evas_Smart_Cb func;
- Eina_Bool disabled:1;
};
struct _Widget_Data
const char *part__);
static Evas_Object * _content_get_hook(const Evas_Object *obj,
const char *part);
+static void _item_text_set_hook(Elm_Object_Item *it,
+ const char *part,
+ const char *label);
+static const char * _item_text_get_hook(const Elm_Object_Item *it,
+ const char *part);
+static void _item_content_set_hook(Elm_Object_Item *it,
+ const char *part,
+ Evas_Object *content);
+static Evas_Object * _item_content_get_hook(const Elm_Object_Item *it,
+ const char *part);
+static void _item_disable_set_hook(Elm_Object_Item *it);
+static void _item_signal_emit_hook(Elm_Object_Item *it,
+ const char *emission,
+ const char *source);
static void _bg_clicked_cb(void *data, Evas_Object *obj,
const char *emission,
const char *source);
if (item->label)
edje_object_part_text_set(VIEW(item), "elm.text", item->label);
- if (item->disabled)
+ if (elm_widget_item_disabled_get(item))
edje_object_signal_emit(VIEW(item), "elm,state,disabled", "elm");
edje_object_message_signal_process(VIEW(item));
}
static void
+_item_text_set_hook(Elm_Object_Item *it,
+ const char *part,
+ const char *label)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+ Widget_Data *wd;
+ Elm_Ctxpopup_Item *ctxpopup_it;
+
+ if (part && strcmp(part, "default")) return;
+
+ ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+
+ wd = elm_widget_data_get(WIDGET(ctxpopup_it));
+ if (!wd) return;
+
+ _item_label_set(ctxpopup_it, label);
+ wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+ if (wd->visible)
+ {
+ _scroller_size_reset(wd);
+ _sizing_eval(WIDGET(ctxpopup_it));
+ }
+}
+
+static const char *
+_item_text_get_hook(const Elm_Object_Item *it, const char *part)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ Elm_Ctxpopup_Item *ctxpopup_it;
+ if (part && strcmp(part, "default")) return NULL;
+ ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+ return ctxpopup_it->label;
+}
+
+static void
+_item_content_set_hook(Elm_Object_Item *it,
+ const char *part,
+ Evas_Object *content)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Widget_Data *wd;
+ Elm_Ctxpopup_Item *ctxpopup_it;
+
+ if (part && strcmp(part, "icon")) return;
+
+ ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+
+ wd = elm_widget_data_get(WIDGET(ctxpopup_it));
+ if (!wd) return;
+
+ _item_icon_set(ctxpopup_it, content);
+ wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+ if (wd->visible)
+ {
+ _scroller_size_reset(wd);
+ _sizing_eval(WIDGET(ctxpopup_it));
+ }
+}
+
+static Evas_Object *
+_item_content_get_hook(const Elm_Object_Item *it, const char *part)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ Elm_Ctxpopup_Item *ctxpopup_it;
+ if (part && strcmp(part, "icon")) return NULL;
+ ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+ return ctxpopup_it->icon;
+}
+
+static void
+_item_disable_set_hook(Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+ Widget_Data *wd;
+ Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+
+ wd = elm_widget_data_get(WIDGET(ctxpopup_it));
+ if (!wd) return;
+
+ if (elm_widget_item_disabled_get(it))
+ edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,disabled", "elm");
+ else
+ edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,enabled", "elm");
+}
+
+static void
+_item_signal_emit_hook(Elm_Object_Item *it,
+ const char *emission,
+ const char *source)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+ edje_object_signal_emit(VIEW(ctxpopup_it), emission, source);
+}
+
+static void
_bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__, const char *source __UNUSED__)
{
Elm_Ctxpopup_Item *item = data;
if (!item) return;
- if (item->disabled) return;
+ if (elm_widget_item_disabled_get(item)) return;
if (item->func)
item->func((void*) item->base.data, WIDGET(item), data);
EAPI Evas_Object *
elm_ctxpopup_item_icon_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
- return ctxpopup_it->icon;
+ return _item_content_get_hook(it, "icon");
}
EAPI void
elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
- Widget_Data *wd;
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-
- wd = elm_widget_data_get(WIDGET(ctxpopup_it));
- if (!wd) return;
-
- _item_icon_set(ctxpopup_it, icon);
- wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-
- if (wd->visible)
- {
- _scroller_size_reset(wd);
- _sizing_eval(WIDGET(ctxpopup_it));
- }
+ _item_content_set_hook(it, "icon", icon);
}
EAPI const char *
elm_ctxpopup_item_label_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
- return ctxpopup_it->label;
+ return _item_text_get_hook(it, NULL);
}
EAPI void
elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
- Widget_Data *wd;
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-
- wd = elm_widget_data_get(WIDGET(ctxpopup_it));
- if (!wd) return;
-
- _item_label_set(ctxpopup_it, label);
- wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-
- if (wd->visible)
- {
- _scroller_size_reset(wd);
- _sizing_eval(WIDGET(ctxpopup_it));
- }
+ _item_text_set_hook(it, NULL, label);
}
EAPI void
item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
if (!item) return NULL;
+ elm_widget_item_disable_set_hook_set(item, _item_disable_set_hook);
+ elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
+ elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
+ elm_widget_item_content_set_hook_set(item, _item_content_set_hook);
+ elm_widget_item_content_get_hook_set(item, _item_content_get_hook);
+ elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook);
+
//The first item is appended.
content = elm_object_content_unset(obj);
if (content) evas_object_del(content);
EAPI void
elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
- Widget_Data *wd;
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-
- wd = elm_widget_data_get(WIDGET(ctxpopup_it));
- if (!wd) return;
-
- if (disabled == ctxpopup_it->disabled)
- return;
-
- if (disabled)
- edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,disabled", "elm");
- else
- edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,enabled", "elm");
-
- ctxpopup_it->disabled = !!disabled;
+ elm_object_item_disabled_set(it, disabled);
}
EAPI Eina_Bool
elm_ctxpopup_item_disabled_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
- return ctxpopup_it->disabled;
+ return elm_object_item_disabled_get(it);
}
EAPI void
static void
_item_text_set_hook(Elm_Object_Item *it,
- const char *part __UNUSED__,
+ const char *part,
const char *label)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
if (!label) return;
+ if (part && strcmp(part ,"default")) return;
+
item = (Elm_Flipselector_Item *) it;
wd = elm_widget_data_get(WIDGET(item));
if ((!wd) || (!wd->items)) return;
}
static const char *
-_item_text_get_hook(const Elm_Object_Item *it, const char *part __UNUSED__)
+_item_text_get_hook(const Elm_Object_Item *it, const char *part)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
Widget_Data *wd;
Eina_List *l;
+ if (part && strcmp(part ,"default")) return NULL;
+
item = (Elm_Flipselector_Item *) it;
wd = elm_widget_data_get(WIDGET(item));
if ((!wd) || (!wd->items)) return NULL;