evas_object_del(data);
}
+char *
+gl_popup_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item # %i", (int)(uintptr_t)data);
+ return strdup(buf);
+}
+
static void
_popup_center_title_list_content_1button_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
evas_object_show(popup);
}
+static void
+_popup_center_title_genlist_content_1button_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *popup, *genlist;
+ Evas_Object *btn;
+ int i;
+
+ popup = elm_popup_add(data);
+ elm_object_part_text_set(popup, "title,text", "Title");
+
+ Elm_Genlist_Item_Class *itc1 = elm_genlist_item_class_new();
+ itc1->item_style = "default";
+ itc1->func.text_get = gl_popup_text_get;
+ itc1->func.content_get = NULL;
+ itc1->func.state_get = NULL;
+ itc1->func.del = NULL;
+
+ // genlist as a popup content
+ genlist = elm_genlist_add(popup);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
+
+ for (i = 0; i < 10; i++)
+ {
+ elm_genlist_item_append(genlist,
+ itc1,
+ (void *)(uintptr_t)i/* item data */,
+ NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE,
+ NULL,
+ NULL);
+ }
+ elm_genlist_item_class_free(itc1);
+ elm_object_content_set(popup, genlist);
+
+ // popup buttons
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, "OK");
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup);
+
+ // popup show should be called after adding all the contents and the buttons
+ // of popup to set the focus into popup's contents correctly.
+ evas_object_show(popup);
+}
+
+
static void
_subpopup_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
elm_list_item_append(list, "popup-center-title + list content + 1 button",
NULL, NULL, _popup_center_title_list_content_1button_cb,
win);
+ elm_list_item_append(list, "popup-center-title + genlist content + 1 button",
+ NULL, NULL, _popup_center_title_genlist_content_1button_cb,
+ win);
elm_list_item_append(list, "subpopup + X button",
NULL, NULL, _subpopup_cb,
win);
minw = vmw;
minh = vmh;
}
- else if (sd->mode == ELM_LIST_LIMIT)
+
+ if (sd->scr_minw)
{
maxw = -1;
minw = vmw + sd->realminw;
}
+ else
+ {
+ minw = vmw;
+ }
+ if (sd->scr_minh)
+ {
+ maxh = -1;
+ minh = vmh + sd->minh;
+ }
else
{
minw = vmw;
minh = vmh;
}
+ if ((maxw > 0) && (minw > maxw))
+ minw = maxw;
+ if ((maxh > 0) && (minh > maxh))
+ minh = maxh;
+
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, maxw, maxh);
}
+static void
+_content_min_limit_cb(Evas_Object *obj,
+ Eina_Bool w,
+ Eina_Bool h)
+{
+ ELM_GENLIST_DATA_GET(obj, sd);
+
+ if ((sd->mode == ELM_LIST_LIMIT) ||
+ (sd->mode == ELM_LIST_EXPAND)) return;
+ sd->scr_minw = !!w;
+ sd->scr_minh = !!h;
+
+ elm_layout_sizing_eval(obj);
+}
+
static void
_item_contract_emit(Elm_Object_Item *eo_it)
{
elm_interface_scrollable_vbar_unpress_cb_set(_vbar_unpress_cb),
elm_interface_scrollable_hbar_drag_cb_set(_hbar_drag_cb),
elm_interface_scrollable_hbar_press_cb_set(_hbar_press_cb),
- elm_interface_scrollable_hbar_unpress_cb_set(_hbar_unpress_cb));
+ elm_interface_scrollable_hbar_unpress_cb_set(_hbar_unpress_cb),
+ elm_interface_scrollable_content_min_limit_cb_set(_content_min_limit_cb));
priv->mode = ELM_LIST_SCROLL;
priv->max_items_per_block = MAX_ITEMS_PER_BLOCK;
{
if (sd->mode == mode) return;
sd->mode = mode;
+
+ if (sd->mode == ELM_LIST_LIMIT)
+ {
+ sd->scr_minw = EINA_TRUE;
+ sd->scr_minh = EINA_FALSE;
+ }
+ else if (sd->mode == ELM_LIST_EXPAND)
+ {
+ sd->scr_minw = EINA_TRUE;
+ sd->scr_minh = EINA_TRUE;
+ }
+ else
+ {
+ sd->scr_minw = EINA_FALSE;
+ sd->scr_minh = EINA_FALSE;
+ }
+
elm_layout_sizing_eval(obj);
}