Add the toolbar API which expand the transverse length

SVN revision: 77107
This commit is contained in:
Jaehwan Kim 2012-09-27 03:05:50 +00:00
parent 33b0007e16
commit 052588f9d7
6 changed files with 93 additions and 16 deletions

View File

@ -537,4 +537,8 @@
2012-09-25 Cedric Bail
* Escape theme filename correctly.
* Escape theme filename correctly.
2012-09-27 Jaehwan Kim
* Add the toolbar API which expand the transverse length

View File

@ -7,6 +7,7 @@ Additions:
* Add elementary_codegen
* Add window floating mode api's
* Add reorder mode set/get API in Toolbar.
* Add the toolbar API which expand the transverse length.
Improvements:

View File

@ -831,6 +831,7 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
tb = elm_toolbar_add(win);
elm_toolbar_homogeneous_set(tb, EINA_FALSE);
elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND);
elm_toolbar_transverse_expanded_set(tb, EINA_TRUE);
elm_toolbar_standard_priority_set(tb, 0);
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);

View File

@ -236,12 +236,12 @@ _resize_job(void *data)
if (sd->vertical)
{
evas_object_resize(sd->bx, w, vh);
h = vh;
_items_visibility_fix(sd, &ih, vh, &more);
}
else
{
evas_object_resize(sd->bx, vw, h);
w = vw;
_items_visibility_fix(sd, &iw, vw, &more);
}
evas_object_geometry_get
@ -316,12 +316,12 @@ _resize_job(void *data)
if (sd->vertical)
{
evas_object_resize(sd->bx, w, vh);
h = vh;
_items_visibility_fix(sd, &ih, vh, &more);
}
else
{
evas_object_resize(sd->bx, vw, h);
w = vw;
_items_visibility_fix(sd, &iw, vw, &more);
}
evas_object_box_remove_all(sd->bx, EINA_FALSE);
@ -353,12 +353,10 @@ _resize_job(void *data)
{
Evas_Coord iw = 0, ih = 0;
if ((vw >= mw) && (vh >= mh))
evas_object_resize(sd->bx, vw, vh);
else if (vw < mw)
evas_object_resize(sd->bx, mw, vh);
else if (vh < mh)
evas_object_resize(sd->bx, vw, mh);
if (sd->vertical)
h = (vh >= mh) ? vh : mh;
else
w = (vw >= mw) ? vw : mw;
if (sd->vertical)
_items_visibility_fix(sd, &ih, vh, &more);
@ -389,11 +387,11 @@ _resize_job(void *data)
{
if (sd->vertical)
{
if ((vh >= mh) && (h != vh)) evas_object_resize(sd->bx, w, vh);
if ((vh >= mh) && (h != vh)) h = vh;
}
else
{
if ((vw >= mw) && (w != vw)) evas_object_resize(sd->bx, vw, h);
if ((vw >= mw) && (w != vw)) w = vw;
}
EINA_INLIST_FOREACH(sd->items, it)
{
@ -405,6 +403,16 @@ _resize_job(void *data)
}
}
if (sd->transverse_expanded)
{
if (sd->vertical)
w = vw;
else
h = vh;
}
evas_object_resize(sd->bx, w, h);
// Remove the first or last separator since it is not neccessary
list = evas_object_box_children_get(sd->bx_more);
EINA_INLIST_FOREACH(sd->items, it)
@ -840,8 +848,14 @@ _sizing_eval(Evas_Object *obj)
{
minw = minw_bx + (w - vw);
minh = minh_bx + (h - vh);
if (minw_bx < vw) minw_bx = vw;
if (minh_bx < vh) minh_bx = vh;
if (sd->vertical)
{
if (minh_bx < vh) minh_bx = vh;
}
else
{
if (minw_bx < vw) minw_bx = vw;
}
}
else
{
@ -857,8 +871,16 @@ _sizing_eval(Evas_Object *obj)
}
}
if (sd->transverse_expanded)
{
if (sd->vertical)
minw_bx = vw;
else
minh_bx = vh;
}
evas_object_resize(sd->bx, minw_bx, minh_bx);
evas_object_resize(sd->more, w, h);
evas_object_resize(sd->more, minw_bx, minh_bx);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
@ -2647,6 +2669,27 @@ elm_toolbar_shrink_mode_get(const Evas_Object *obj)
return sd->shrink_mode;
}
EAPI void
elm_toolbar_transverse_expanded_set(Evas_Object *obj, Eina_Bool transverse_expanded)
{
ELM_TOOLBAR_CHECK(obj);
ELM_TOOLBAR_DATA_GET(obj, sd);
if (sd->transverse_expanded == transverse_expanded) return;
sd->transverse_expanded = transverse_expanded;
_sizing_eval(obj);
}
EAPI Eina_Bool
elm_toolbar_transverse_expanded_get(const Evas_Object *obj)
{
ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
ELM_TOOLBAR_DATA_GET(obj, sd);
return sd->transverse_expanded;
}
EAPI void
elm_toolbar_homogeneous_set(Evas_Object *obj,
Eina_Bool homogeneous)

View File

@ -609,6 +609,33 @@ EAPI void elm_toolbar_shrink_mode_set(Evas_Object *obj,
*/
EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_shrink_mode_get(const Evas_Object *obj);
/**
* Set the item's transverse expansion of a given toolbar widget @p obj.
*
* @param obj The toolbar object.
* @param transverse_expanded The transverse expansion of the item.
* (EINA_TRUE = on, EINA_FALSE = off, default = EINA_FALSE)
*
* This will expand the transverse length of the item according the transverse length of the toolbar.
* The default is what the transverse length of the item is set according its min value.
*
* @ingroup Toolbar
*/
EAPI void elm_toolbar_transverse_expanded_set(Evas_Object *obj, Eina_Bool transverse_expanded);
/**
* Get the transverse expansion of toolbar @p obj.
*
* @param obj The toolbar object.
* @return The transverse expansion of the item.
* (EINA_TRUE = on, EINA_FALSE = off, default = EINA_FALSE)
*
* @see elm_toolbar_transverse_expand_set() for details.
*
* @ingroup Toolbar
*/
EAPI Eina_Bool elm_toolbar_transverse_expanded_get(const Evas_Object *obj);
/**
* Enable/disable homogeneous mode.
*

View File

@ -151,6 +151,7 @@ struct _Elm_Toolbar_Smart_Data
Eina_Bool homogeneous : 1;
Eina_Bool on_deletion : 1;
Eina_Bool reorder_mode : 1;
Eina_Bool transverse_expanded : 1;
};
struct _Elm_Toolbar_Item