* Track window states as a total count and be able to self-throttle
or suspend rendering as a result.
+2012-08-29 Shinwoo Kim (kimcinoo)
+
+ * Patch for selection of middle item in diskselector required adding
+ API elm_diskselector_autoselect_set/get()
+
text.align: 0.8 0.5;
}
}
+ part { name: "auto_select";
+ type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ }
+ description {
+ state: "disable" 0.0;
+ }
+ }
}
programs {
action: STATE_SET "icon_only" 0.0;
target: "elm.swallow.icon";
}
+ program { name: "auto_select";
+ signal: "elm,state,autoselect,default";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "auto_select";
+ }
+ program { name: "auto_select_disable";
+ signal: "elm,state,autoselect,disable";
+ source: "elm";
+ action: STATE_SET "disable" 0.0;
+ target: "auto_select";
+ }
+ program { name: "item_click";
+ signal: "mouse,clicked,1";
+ source: "auto_select";
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:"auto_select", st, 30, vl);
+ if (!strcmp(st, "disable"))
+ emit("elm,action,click", "");
+ }
+ }
}
}
text.align: 0.8 0.5;
}
}
- part { name: "over1";
+ part { name: "auto_select";
type: RECT;
mouse_events: 1;
repeat_events: 1;
ignore_flags: ON_HOLD;
- description {
- state: "default" 0.0;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description { state: "disable" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
}
}
}
update_state();
}
}
+ program { name: "auto_select";
+ signal: "elm,state,autoselect,default";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "auto_select";
+ }
+ program { name: "auto_select_disable";
+ signal: "elm,state,autoselect,disable";
+ source: "elm";
+ action: STATE_SET "disable" 0.0;
+ target: "auto_select";
+ }
program { name: "field_click";
signal: "mouse,clicked,1";
- source: "over1";
- action: SIGNAL_EMIT "elm,action,click" "";
+ source: "auto_select";
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:"auto_select", st, 30, vl);
+ if (!strcmp(st, "disable"))
+ emit("elm,action,click", "");
+ }
}
}
}
}
if (it->func) it->func((void *)it->base.data, WIDGET(it), it);
+ evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
}
static char *
_item_content_set_hook((Elm_Object_Item *)it, "icon", icon);
}
+ ELM_DISKSELECTOR_DATA_GET(obj, sd);
+ if (!sd->auto_select)
+ edje_object_signal_emit(VIEW(it), "elm,state,autoselect,disable", "elm");
+
//XXX: ACCESS
_elm_access_widget_item_register((Elm_Widget_Item *)it);
if (sd->idler) return;
+ if (!sd->auto_select) return;
+
if (!sd->round)
list = sd->items;
else
priv->init = EINA_FALSE;
priv->len_side = 3;
priv->display_item_num_by_api = EINA_FALSE;
+ priv->auto_select = EINA_TRUE;
_elm_diskselector_smart_theme(obj);
priv->s_iface->policy_set
return sd->display_item_num;
}
+
+EAPI void
+elm_diskselector_autoselect_set(Evas_Object *obj, Eina_Bool enable)
+{
+ Elm_Diskselector_Item *it;
+ Eina_List *l, *list;
+
+ ELM_DISKSELECTOR_CHECK(obj);
+ ELM_DISKSELECTOR_DATA_GET(obj, sd);
+
+ enable = !!enable;
+ if (sd->auto_select == enable) return;
+ sd->auto_select = enable;
+
+ if (!sd->round)
+ list = sd->items;
+ else
+ list = sd->r_items;
+
+ EINA_LIST_FOREACH (list, l, it)
+ {
+ if (!sd->auto_select)
+ edje_object_signal_emit(VIEW(it), "elm,state,autoselect,disable", "elm");
+ else
+ edje_object_signal_emit(VIEW(it), "elm,state,autoselect,default", "elm");
+ }
+}
+
+EAPI Eina_Bool
+elm_diskselector_autoselect_get(const Evas_Object *obj)
+{
+ ELM_DISKSELECTOR_CHECK(obj) EINA_TRUE;
+ ELM_DISKSELECTOR_DATA_GET(obj, sd);
+
+ return sd->auto_select;
+}
EAPI int elm_diskselector_display_item_num_get(const Evas_Object *obj);
/**
+ * Set the auto select of the diskselector
+ *
+ * After scroll diskselector, an item which is right in the center of diskselector
+ * is selected automatically. This is default behavior of diskselector.
+ * If @p enable is @c EINA_FALSE, the automatic selection is disabled and
+ * even though item is not right in the center user can select item by clicking.
+ *
+ * @param obj The diskselector object.
+ * @param enable EINA_TRUE to enable auto select, EINA_FALSE to disable auto select.
+ * default is EINA_TRUE.
+ *
+ * @ingroup Diskselector
+ * @since 1.8
+ */
+EAPI void elm_diskselector_autoselect_set(Evas_Object *obj, Eina_Bool enable);
+
+/**
+ * Get the auto select of the diskselector object.
+ *
+ * @param obj The diskselector object.
+ * @return The auto select set (EINA_TRUE by default)
+ *
+ * @ingroup Diskselector
+ * @since 1.8
+ */
+EAPI Eina_Bool elm_diskselector_autoselect_get(const Evas_Object *obj);
+
+/**
* Set bouncing behaviour when the scrolled content reaches an edge.
*
* Tell the internal scroller object whether it should bounce or not
Eina_Bool init : 1;
Eina_Bool round : 1;
Eina_Bool display_item_num_by_api : 1;
+ Eina_Bool auto_select : 1;
};
struct _Elm_Diskselector_Item
evas_object_geometry_get(obj, &x, &y, &w, &h);
evas_object_geometry_get(elm_widget_top_get(ctx_mod->mod_data.base), NULL, NULL, &width, NULL);
evas_object_size_hint_min_set(ctx_mod->ctxpopup, width, -1);
- display_item_num = width / (w + elm_config_finger_size_get());
- // always display even number of items to avoid autoselection
- if (display_item_num % 2) display_item_num -= 1;
+ display_item_num = w + elm_config_finger_size_get();
+
+ elm_diskselector_autoselect_set(diskselector, EINA_FALSE);
if (display_item_num < DISKSELECTOR_MIN_ITEMS)
display_item_num = DISKSELECTOR_MIN_ITEMS;
elm_diskselector_display_item_num_set(diskselector, display_item_num);