--- /dev/null
+#include <Elementary.h>
+
+static Elm_Genlist_Item_Class itci;
+char *gli_label_get(const void *data, Evas_Object *obj, const char *part)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item # %i", (int)data);
+ return strdup(buf);
+}
+void gli_del(const void *data, Evas_Object *obj)
+{
+}
+
+void
+test_index(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg, *gl, *id;
+ Elm_Genlist_Item *it;
+ int i;
+
+ win = elm_win_add(NULL, "index", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Index");
+ elm_win_autodel_set(win, 1);
+
+ bg = elm_bg_add(win);
+ elm_win_resize_object_add(win, bg);
+ evas_object_size_hint_weight_set(bg, 1.0, 1.0);
+ evas_object_show(bg);
+
+ gl = elm_genlist_add(win);
+ evas_object_size_hint_weight_set(gl, 1.0, 1.0);
+ elm_win_resize_object_add(win, gl);
+ evas_object_show(gl);
+
+ id = elm_index_add(win);
+ evas_object_size_hint_weight_set(id, 1.0, 1.0);
+ elm_win_resize_object_add(win, id);
+ evas_object_show(id);
+
+ itci.item_style = "default";
+ itci.func.label_get = gli_label_get;
+ itci.func.icon_get = NULL;
+ itci.func.state_get = NULL;
+ itci.func.del = gli_del;
+
+ for (i = 0; i < 100; i++)
+ {
+ // FIXME: add to index too
+ it = elm_genlist_item_append(gl, &itci,
+ i/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, NULL/* func */,
+ NULL/* func data */);
+ }
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
--- /dev/null
+#include <Elementary.h>
+#include "elm_priv.h"
+
+/**
+ * @defgroup Index Index
+ *
+ * XXX
+ *
+ * Signals that you can add callbacks for are:
+ *
+ * xxx - XXX.
+ *
+ * xxx - XXX.
+ */
+
+typedef struct _Widget_Data Widget_Data;
+
+struct _Widget_Data
+{
+ Evas_Object *base;
+ Evas_Object *event;
+ Evas_Object *bx[2];
+ const char *label;
+ Eina_Bool horizontal : 1;
+};
+
+static void _del_hook(Evas_Object *obj);
+static void _theme_hook(Evas_Object *obj);
+static void _sizing_eval(Evas_Object *obj);
+
+static void
+_del_hook(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->label) eina_stringshare_del(wd->label);
+ free(wd);
+}
+
+static void
+_theme_hook(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->horizontal)
+ _elm_theme_set(wd->base, "index", "horizontal", elm_widget_style_get(obj));
+ else
+ _elm_theme_set(wd->base, "index", "vertical", elm_widget_style_get(obj));
+ edje_object_part_swallow(wd->base, "elm.swallow.event", wd->event);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->bx[0]);
+ if (edje_object_part_exists(wd->base, "elm.swallow.content.sub"))
+ {
+ if (!wd->bx[1])
+ {
+ wd->bx[1] = _els_smart_box_add(evas_object_evas_get(wd->base));
+ _els_smart_box_orientation_set(wd->bx[1], 0);
+ _els_smart_box_homogenous_set(wd->bx[1], 1);
+ elm_widget_sub_object_add(obj, wd->bx[1]);
+ }
+ edje_object_part_swallow(wd->base, "elm.swallow.content.sub", wd->bx[1]);
+ evas_object_show(wd->bx[1]);
+ }
+ else if (wd->bx[1])
+ {
+ evas_object_del(wd->bx[1]);
+ wd->bx[1] = NULL;
+ }
+ edje_object_message_signal_process(wd->base);
+ edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
+ // FIXME: content and sub lists - eval
+ _sizing_eval(obj);
+}
+
+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;
+
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ evas_object_size_hint_min_set(obj, minw, minh);
+ evas_object_size_hint_max_set(obj, maxw, maxh);
+}
+
+static void
+_wheel(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ Evas_Event_Mouse_Wheel *ev = event_info;
+ Evas_Object *obj = o;
+}
+
+static void
+_mouse_down(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ Evas_Object *obj = o;
+}
+
+static void
+_mouse_up(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ Evas_Object *obj = o;
+}
+
+static void
+_mouse_move(void *data, Evas *e, Evas_Object *o, void *event_info)
+{
+ Evas_Event_Mouse_Move *ev = event_info;
+ Evas_Object *obj = o;
+}
+
+/**
+ * Add a new index to the parent
+ *
+ * @param parent The parent object
+ * @return The new object or NULL if it cannot be created
+ *
+ * @ingroup Index
+ */
+EAPI Evas_Object *
+elm_index_add(Evas_Object *parent)
+{
+ Evas_Object *obj;
+ Evas_Object *o;
+ Evas *e;
+ Widget_Data *wd;
+
+ wd = ELM_NEW(Widget_Data);
+ e = evas_object_evas_get(parent);
+ obj = elm_widget_add(e);
+ elm_widget_type_set(obj, "index");
+ elm_widget_sub_object_add(parent, obj);
+ elm_widget_data_set(obj, wd);
+ elm_widget_del_hook_set(obj, _del_hook);
+ elm_widget_theme_hook_set(obj, _theme_hook);
+
+ wd->horizontal = EINA_FALSE;
+
+ wd->base = edje_object_add(e);
+ _elm_theme_set(wd->base, "index", "vertical", "default");
+ elm_widget_resize_object_set(obj, wd->base);
+
+ o = evas_object_rectangle_add(e);
+ wd->event = o;
+ evas_object_color_set(o, 0, 0, 0, 0);
+ edje_object_part_swallow(wd->base, "elm.swallow.event", o);
+ elm_widget_sub_object_add(obj, o);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _wheel, obj);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, obj);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _mouse_up, obj);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, obj);
+ evas_object_show(o);
+
+ wd->bx[0] = _els_smart_box_add(e);
+ _els_smart_box_orientation_set(wd->bx[0], 0);
+ _els_smart_box_homogenous_set(wd->bx[0], 1);
+ elm_widget_sub_object_add(obj, wd->bx[0]);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->bx[0]);
+ evas_object_show(wd->bx[0]);
+
+ if (edje_object_part_exists(wd->base, "elm.swallow.content.sub"))
+ {
+ wd->bx[1] = _els_smart_box_add(e);
+ _els_smart_box_orientation_set(wd->bx[1], 0);
+ _els_smart_box_homogenous_set(wd->bx[1], 1);
+ elm_widget_sub_object_add(obj, wd->bx[1]);
+ edje_object_part_swallow(wd->base, "elm.swallow.content.sub", wd->bx[1]);
+ evas_object_show(wd->bx[1]);
+ }
+
+ _sizing_eval(obj);
+ return obj;
+}
+
+#if 0
+/**
+ * Set the label of the index
+ *
+ * @param obj The index object
+ * @param label The text label string in UTF-8
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_label_set(Evas_Object *obj, const char *label)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->label) eina_stringshare_del(wd->label);
+ if (label)
+ {
+ wd->label = eina_stringshare_add(label);
+ edje_object_signal_emit(wd->base, "elm,state,text,visible", "elm");
+ edje_object_message_signal_process(wd->base);
+ }
+ else
+ {
+ wd->label = NULL;
+ edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
+ edje_object_message_signal_process(wd->base);
+ }
+ edje_object_part_text_set(wd->base, "elm.text", label);
+ _sizing_eval(obj);
+}
+
+/**
+ * Get the label of the index
+ *
+ * @param obj The index object
+ * @return The text label string in UTF-8
+ *
+ * @ingroup Index
+ */
+EAPI const char *
+elm_index_label_get(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+
+ return wd->label;
+}
+#endif
+
+/**
+ * XXX
+ *
+ * @param obj The index object
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_item_append(Evas_Object *obj, const char *letter, const void *item)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+}
+
+/**
+ * XXX
+ *
+ * @param obj The index object
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+}
+
+/**
+ * XXX
+ *
+ * @param obj The index object
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (!relative) elm_index_item_append(obj, letter, item);
+}
+
+/**
+ * XXX
+ *
+ * @param obj The index object
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (!relative) elm_index_item_prepend(obj, letter, item);
+}
+
Evas_Object *content;
Eina_Bool min_w : 1;
Eina_Bool min_h : 1;
- Eina_Bool index_h : 1;
- Eina_Bool index_v : 1;
double pagerel_h, pagerel_v;
Evas_Coord pagesize_h, pagesize_v;
};
}
/**
- * Enable quick-index jump on each axis
- *
- * This enabled a quick jump list along a specific axis. This is, for example
- * "A, B, C, D ... X, Y, Z" along an axis that will jump to the item beginning
- * with that letter as a quick way to jump to the position desired.
- *
- * @param obj The scroller object
- * @param h_index Will the index be available horizontally
- * @param v_index Will the index be available vertically
- *
- * @ingroup Scroller
- */
-EAPI void
-elm_scroller_index_set(Evas_Object *obj, Eina_Bool h_index, Eina_Bool v_index)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- wd->index_h = h_index;
- wd->index_v = v_index;
- // XXX eval index and show/hide
-}
-
-/**
- * Clear specific indexes for the scroller
- *
- * This clears the horizontal and/or vertical indexes for the scroller. After
- * this the indicated index(es) will be empty.
- *
- * @param obj The scroller object
- * @param h_index Clear the horizontal index (or not)
- * @param v_index Clear the vertical index (or not)
- *
- * @ingroup Scroller
- */
-EAPI void
-elm_scroller_index_clear(Evas_Object *obj, Eina_Bool h_index, Eina_Bool v_index)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- // XXX eval index and show/hide
-}
-
-/**
- * Add a scroller index member
- *
- * This adds an item in the scroller index, giving it a position in the
- * virtual content region along a specific axis and a size (the area that
- * index item consumes). This is used to determine how to display the
- * index item, if at all, and where it will "jump to". If an icon is used,
- * the icon object becomes owned by the scroller and will be deleted if the
- * scroller is deleted or the index cleared. The index level can indicate
- * to use the main index (0) or sub-indexes for more accurate positioning.
- * These are optional and may not function if not supported. Icons used for
- * non-functioning index levels will be deleted.
- *
- * @param obj The scroller object
- * @param axis The axis this item is to be asigned to
- * @param label A string label for this index item
- * @param icon An icon to display on the index item
- * @param position The virtual position of the item
- * @param size The virtual size of the item
- * @param level Index level. 0 is the main. Others (1, 2, etc.) are optional.
- *
- * @ingroup Scroller
- */
-EAPI void
-elm_scroller_index_add(Evas_Object *obj, Elm_Scroller_Axis axis, const char *label, Evas_Object *icon, Evas_Coord position, Evas_Coord size, int level)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- // XXX eval index and show/hide
-}
-
-/**
* Set scroll page size relative to viewport size
*
* The scroller is sapale of limiting scrolling by the user to "pages". That