more container notes/skellies and allow aspect prefernce of BOTH (both axes

control so the aspect wiill exceed wanted size and go over the boundaries...)


SVN revision: 10789
This commit is contained in:
Carsten Haitzler 2004-07-12 06:14:59 +00:00
parent 50476cba0c
commit d5c73557c9
5 changed files with 193 additions and 22 deletions

View File

@ -137,8 +137,8 @@ collections
// max: 0 0;
// step: 1 1;
// aspect: 0.0 999999.0;
// can be NONE VERTICAL and HORIZONTAL - depending which axis (if any) is used
// as a master control on aspect calculations
// can be NONE VERTICAL HORIZONTAL and BOTH - depending which axis (if any)
// is used as a master control on aspect calculations
// aspect_preference: NONE;
rel1
{

View File

@ -733,6 +733,7 @@ st_collections_group_parts_part_description_aspect_preference(void)
"NONE", EDJE_ASPECT_PREFER_NONE,
"VERTICAL", EDJE_ASPECT_PREFER_VERTICAL,
"HORIZONTAL", EDJE_ASPECT_PREFER_HORIZONTAL,
"BOTH", EDJE_ASPECT_PREFER_BOTH,
NULL);
}

View File

@ -133,6 +133,7 @@ Edje_Edit_Image *edje_edit_iamge_get_by_id(int id);
#define EDJE_ASPECT_PREFER_NONE 0
#define EDJE_ASPECT_PREFER_VERTICAL 1
#define EDJE_ASPECT_PREFER_HORIZONTAL 2
#define EDJE_ASPECT_PREFER_BOTH 3
#define EDJE_VAR_MAGIC_BASE 0x12fe84ba

View File

@ -413,24 +413,51 @@ _edje_part_recalc_single(Edje *ed,
if ((desc->aspect.min > 0.0) && (aspect < desc->aspect.min))
new_h = (params->w / desc->aspect.min);
}
/* do real adjustment */
if ((params->h - new_h) > (params->w - new_w))
else if (desc->aspect.prefer == EDJE_ASPECT_PREFER_BOTH) /* keep both dimensions in check */
{
if (params->h < new_h)
params->h = new_h;
else if (params->h > new_h)
params->h = new_h;
if (desc->aspect.prefer == EDJE_ASPECT_PREFER_VERTICAL)
/* adjust for max aspect (width / height) */
if ((desc->aspect.max > 0.0) && (aspect > desc->aspect.max))
{
new_w = (params->h * desc->aspect.max);
new_h = (params->w / desc->aspect.max);
}
/* adjust for min aspect (width / height) */
if ((desc->aspect.min > 0.0) && (aspect < desc->aspect.min))
{
new_w = (params->h * desc->aspect.min);
new_h = (params->w / desc->aspect.min);
}
}
/* do real adjustment */
if (desc->aspect.prefer == EDJE_ASPECT_PREFER_BOTH)
{
/* fix h and vary w */
if (new_w > params->w)
params->w = new_w;
/* fix w and vary h */
else
params->h = new_h;
}
else
{
if (params->w < new_w)
params->w = new_w;
else if (params->w > new_w)
params->w = new_w;
if (desc->aspect.prefer == EDJE_ASPECT_PREFER_HORIZONTAL)
params->h = new_h;
if ((params->h - new_h) > (params->w - new_w))
{
if (params->h < new_h)
params->h = new_h;
else if (params->h > new_h)
params->h = new_h;
if (desc->aspect.prefer == EDJE_ASPECT_PREFER_VERTICAL)
params->w = new_w;
}
else
{
if (params->w < new_w)
params->w = new_w;
else if (params->w > new_w)
params->w = new_w;
if (desc->aspect.prefer == EDJE_ASPECT_PREFER_HORIZONTAL)
params->h = new_h;
}
}
params->x = want_x + ((want_w - params->w) * desc->align.x);
params->y = want_y + ((want_h - params->h) * desc->align.y);

View File

@ -1,6 +1,145 @@
#include "Edje.h"
#include "edje_private.h"
/* All items are virtual constructs that provide Evas_Objects at some point.
* Edje may move, resize, show, hide, clip, unclip, raise, lower etc. this
* item AFTER it calls the item's add() method and before it calls the del()
* method. Edje may call add() and del() at any time as often items may not
* be visible and so may not need to exist at all - they are merely information
* used for layout, and nothing more. this helps save cpu and memory keeping
* things responsive for BIG lists of items. you create an item from an item
* class then ask that item to be appended/prepended etc. to the container.
*/
typedef struct _Edje_Item Edje_Item;
typedef struct _Edje_Item_Class Edje_Item_Class;
struct _Edje_Item_Class
{
Evas_Object *(*add) (Edje_Item *ei);
void (*del) (Edje_Item *ei);
void (*select) (Edje_Item *ei);
void (*deselect) (Edje_Item *ei);
void (*focus) (Edje_Item *ei);
void (*unfocus) (Edje_Item *ei);
};
/* private */
struct _Edje_Item
{
Edje_Item_Class *class;
void *class_data;
unsigned char accessible : 1;
};
/* create and destroy virtual items */
Edje_Item *
edje_item_add(Edje_Item_Class *cl, void *data)
{
}
void
edje_item_del(Edje_Item *ei)
{
}
/* an arbitary data pointer to use to track other data */
void
edje_item_data_wet(Edje_Item *ei, void *data)
{
}
void *
edje_item_data_get(Edje_Item *ei)
{
}
/* this object covers the entire item */
void
edje_item_object_set(Edje_Item *ei, Evas_Object *obj)
{
}
Evas_Object *
edje_item_object_get(Edje_Item *ei)
{
}
/* optionally you can manage each column's object yourself OR let edje do it */
void
edje_item_object_column_set(Edje_Item *ei, int col, Evas_Object *obj)
{
}
Evas_Object *
edje_item_object_column_get(Edje_Item *ei, int col)
{
}
/* query the item for the items preferred co-ords */
void
edje_tiem_geometry_get(Edje_Item *ei, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
}
/* freeze and thaw items if u are about to do a bunch of changes */
int
edje_item_freeze(Edje_Item *ei)
{
}
int
edje_item_thaw(Edje_Item *ei)
{
}
/* column info */
void
edje_item_columns_set(Edje_Item *ei, int cols)
{
}
void
edje_item_column_size_set(Edje_Item *ei, int col, Evas_Coord minw, Evas_Coord maxw, Evas_Coord minh, Evas_Coord maxh)
{
}
/* selection stuff */
void
edje_item_select(Edje_Item *ei)
{
}
void
edje_item_unselect(Edje_Item *ei)
{
}
/* focus stuff - only 1 can be focuesd */
void
edje_item_focus(Edje_Item *ei)
{
}
void
edje_item_unfocus(Edje_Item *ei)
{
}
/* disable/enable stuff - stops focus and selection working on these items */
void
edje_item_enable(Edje_Item *ei)
{
}
void
edje_item_disable(Edje_Item *ei)
{
}
#define E_SMART_OBJ_GET(smart, o, type) \
{ \
char *_e_smart_str; \
@ -66,26 +205,29 @@ struct _Smart_Column
* are added column widths may be adjusted and all items told of this
* adjustment
*/
#define EDJE_LAYOUT_VLIST 2
#define EDJE_LAYOUT_HLIST 1
#define EDJE_LAYOUT_VLIST 1
#define EDJE_LAYOUT_HLIST 2
/* H & V BOX pack items and may or may not expand an item in any direction and
* may align an item smaller than its allocated space in a certain way. they
* dont know about columns etc. like lists.
*/
#define EDJE_LAYOUT_VBOX 4
#define EDJE_LAYOUT_HBOX 3
#define EDJE_LAYOUT_VBOX 3
#define EDJE_LAYOUT_HBOX 4
/* H & V flow are like "file manager" views you see in explorer etc. wehere
* items "line wrap" as they go along horizontally (or vertizally) as needed
*/
#define EDJE_LAYOUT_VFLOW 6
#define EDJE_LAYOUT_HFLOW 5
#define EDJE_LAYOUT_VFLOW 5
#define EDJE_LAYOUT_HFLOW 6
/* the following are "2 dimensional" layout systems */
/* tables are full 2-dimensional layouts which dont really have append and
* prepend semantics... this will need working on later for 2d layouts
* prepend semantics... this will need working on later for 2d layouts. dont
* worry about these yet - but keep this as a marker for things to do later
*/
#define EDJE_LAYOUT_TABLE 7
/* count
*/
#define EDJE_LAYOUT_COUNT 8
static void _smart_init(void);