2008-10-26 19:22:41 -07:00
# include "evas_common.h"
2012-10-08 18:58:41 -07:00
# include "evas_private.h"
2008-10-26 19:22:41 -07:00
2011-02-24 11:24:39 -08:00
# ifdef _WIN32_WCE
# undef remove
# endif
2012-10-08 18:58:41 -07:00
# include <Eo.h>
EAPI Eo_Op EVAS_OBJ_BOX_BASE_ID = EO_NOOP ;
2013-02-09 23:52:17 -08:00
# define MY_CLASS_NAME "Evas_Object_Box"
2012-10-08 18:58:41 -07:00
# define MY_CLASS EVAS_OBJ_BOX_CLASS
2008-12-17 18:39:09 -08:00
typedef struct _Evas_Object_Box_Iterator Evas_Object_Box_Iterator ;
typedef struct _Evas_Object_Box_Accessor Evas_Object_Box_Accessor ;
struct _Evas_Object_Box_Iterator
{
Eina_Iterator iterator ;
Eina_Iterator * real_iterator ;
const Evas_Object * box ;
} ;
struct _Evas_Object_Box_Accessor
{
Eina_Accessor accessor ;
Eina_Accessor * real_accessor ;
const Evas_Object * box ;
} ;
2010-10-03 23:03:48 -07:00
# define SIG_CHILD_ADDED "child,added"
# define SIG_CHILD_REMOVED "child,removed"
2012-05-01 19:47:12 -07:00
static const Evas_Smart_Cb_Description _signals [ ] =
2010-10-03 23:03:48 -07:00
{
2010-09-21 07:04:28 -07:00
{ SIG_CHILD_ADDED , " " } ,
{ SIG_CHILD_REMOVED , " " } ,
{ NULL , NULL }
} ;
2010-03-22 18:22:20 -07:00
2010-07-09 04:17:35 -07:00
static void _sizing_eval ( Evas_Object * obj ) ;
2012-05-01 19:47:12 -07:00
# define EVAS_OBJECT_BOX_DATA_GET(o, ptr) \
2013-05-02 00:47:16 -07:00
Evas_Object_Box_Data * ptr = eo_data_scope_get ( o , MY_CLASS )
2012-05-01 19:47:12 -07:00
# define EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, ptr) \
EVAS_OBJECT_BOX_DATA_GET ( o , ptr ) ; \
if ( ! ptr ) \
{ \
CRIT ( " no widget data for object %p (%s) " , \
o , evas_object_type_get ( o ) ) ; \
fflush ( stderr ) ; \
return ; \
2008-10-26 19:22:41 -07:00
}
2012-05-01 19:47:12 -07:00
# define EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
EVAS_OBJECT_BOX_DATA_GET ( o , ptr ) ; \
if ( ! ptr ) \
{ \
CRIT ( " no widget data for object %p (%s) " , \
o , evas_object_type_get ( o ) ) ; \
fflush ( stderr ) ; \
return val ; \
}
2008-10-26 19:22:41 -07:00
2008-12-17 18:39:09 -08:00
static Eina_Bool
_evas_object_box_iterator_next ( Evas_Object_Box_Iterator * it , void * * data )
{
Evas_Object_Box_Option * opt ;
2009-02-27 08:35:32 -08:00
if ( ! eina_iterator_next ( it - > real_iterator , ( void * * ) & opt ) )
2008-12-17 18:39:09 -08:00
return EINA_FALSE ;
if ( data ) * data = opt - > obj ;
return EINA_TRUE ;
}
static Evas_Object *
_evas_object_box_iterator_get_container ( Evas_Object_Box_Iterator * it )
{
return ( Evas_Object * ) it - > box ;
}
static void
_evas_object_box_iterator_free ( Evas_Object_Box_Iterator * it )
{
eina_iterator_free ( it - > real_iterator ) ;
free ( it ) ;
}
static Eina_Bool
2011-05-26 18:13:41 -07:00
_evas_object_box_accessor_get_at ( Evas_Object_Box_Accessor * it , unsigned int idx , void * * data )
2008-12-17 18:39:09 -08:00
{
2009-12-21 07:52:12 -08:00
Evas_Object_Box_Option * opt = NULL ;
2008-12-17 18:39:09 -08:00
2011-05-26 18:13:41 -07:00
if ( ! eina_accessor_data_get ( it - > real_accessor , idx , ( void * ) & opt ) )
2008-12-17 18:39:09 -08:00
return EINA_FALSE ;
if ( data ) * data = opt - > obj ;
return EINA_TRUE ;
}
static Evas_Object *
_evas_object_box_accessor_get_container ( Evas_Object_Box_Accessor * it )
{
return ( Evas_Object * ) it - > box ;
}
static void
_evas_object_box_accessor_free ( Evas_Object_Box_Accessor * it )
{
eina_accessor_free ( it - > real_accessor ) ;
free ( it ) ;
}
2013-06-17 19:34:31 -07:00
static Eina_Bool
_on_child_resize ( void * data , Eo * o EINA_UNUSED , const Eo_Event_Description * desc EINA_UNUSED , void * einfo EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
Evas_Object * box = data ;
2009-11-16 16:19:24 -08:00
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN ( box , priv ) ;
if ( ! priv - > layouting ) evas_object_smart_changed ( box ) ;
2013-06-17 19:34:31 -07:00
return EO_CALLBACK_CONTINUE ;
2008-10-26 19:22:41 -07:00
}
2013-06-17 19:34:31 -07:00
static Eina_Bool
_on_child_del ( void * data , Eo * o , const Eo_Event_Description * desc EINA_UNUSED , void * einfo EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
Evas_Object * box = data ;
2012-10-08 18:58:41 -07:00
Evas_Object * ret = NULL ;
eo_do ( box , evas_obj_box_internal_remove ( o , & ret ) ) ;
if ( ! ret )
2010-10-07 16:46:42 -07:00
ERR ( " child removal failed " ) ;
2009-04-26 19:41:27 -07:00
evas_object_smart_changed ( box ) ;
2013-06-17 19:34:31 -07:00
return EO_CALLBACK_CONTINUE ;
2008-10-26 19:22:41 -07:00
}
2013-06-17 19:34:31 -07:00
static Eina_Bool
_on_child_hints_changed ( void * data , Eo * o EINA_UNUSED , const Eo_Event_Description * desc EINA_UNUSED , void * einfo EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
Evas_Object * box = data ;
2009-11-16 16:19:24 -08:00
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN ( box , priv ) ;
2012-07-17 23:57:10 -07:00
// XXX: this breaks box repacking in elementary. widgets DEPEND on being able
// to change their hints evenr WHILE being laid out. so comment this out.
// if (!priv->layouting)
evas_object_smart_changed ( box ) ;
2013-06-17 19:34:31 -07:00
return EO_CALLBACK_CONTINUE ;
2008-10-26 19:22:41 -07:00
}
2010-07-09 04:17:35 -07:00
static void
2012-11-04 03:51:42 -08:00
_on_hints_changed ( void * data EINA_UNUSED , Evas * evas EINA_UNUSED , Evas_Object * o , void * einfo EINA_UNUSED )
2010-07-09 04:17:35 -07:00
{
_sizing_eval ( o ) ;
}
2008-10-26 19:22:41 -07:00
static Evas_Object_Box_Option *
2012-10-08 18:58:41 -07:00
_evas_object_box_option_new ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , Evas_Object * child )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * opt = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_option_new ( child , & opt ) ) ;
2008-10-26 19:22:41 -07:00
if ( ! opt )
{
2012-05-01 19:47:12 -07:00
ERR ( " option_new failed " ) ;
return NULL ;
2008-10-26 19:22:41 -07:00
}
return opt ;
}
2013-06-17 19:34:31 -07:00
static const Eo_Callback_Array_Item evas_object_box_callbacks [ ] = {
{ EVAS_OBJECT_EVENT_RESIZE , _on_child_resize } ,
{ EVAS_OBJECT_EVENT_FREE , _on_child_del } ,
{ EVAS_OBJECT_EVENT_CHANGED_SIZE_HINTS , _on_child_hints_changed } ,
{ NULL , NULL }
} ;
2008-10-26 19:22:41 -07:00
static void
2013-06-17 19:34:31 -07:00
_evas_object_box_child_callbacks_unregister ( Evas_Object * obj , Evas_Object * parent )
2008-10-26 19:22:41 -07:00
{
2013-06-17 19:34:31 -07:00
eo_do ( obj , eo_event_callback_array_del ( evas_object_box_callbacks , parent ) ) ;
2008-10-26 19:22:41 -07:00
}
static Evas_Object_Box_Option *
2012-10-08 18:58:41 -07:00
_evas_object_box_option_callbacks_register ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , Evas_Object_Box_Option * opt )
2008-10-26 19:22:41 -07:00
{
Evas_Object * obj = opt - > obj ;
2013-06-17 19:34:31 -07:00
eo_do ( obj , eo_event_callback_array_add ( evas_object_box_callbacks , o ) ) ;
2008-10-26 19:22:41 -07:00
return opt ;
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_option_new_default ( Eo * o EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Evas_Object_Box_Option * * ret = va_arg ( * list , Evas_Object_Box_Option * * ) ;
* ret = NULL ;
2008-10-26 19:22:41 -07:00
Evas_Object_Box_Option * opt ;
2008-12-03 09:58:26 -08:00
opt = ( Evas_Object_Box_Option * ) malloc ( sizeof ( * opt ) ) ;
2008-10-26 19:22:41 -07:00
if ( ! opt )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
opt - > obj = child ;
2012-10-08 18:58:41 -07:00
* ret = opt ;
2008-10-26 19:22:41 -07:00
}
static void
2012-10-08 18:58:41 -07:00
_evas_object_box_option_free_default ( Eo * o EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * opt = va_arg ( * list , Evas_Object_Box_Option * ) ;
2008-10-26 19:22:41 -07:00
free ( opt ) ;
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_append_default ( Eo * o , void * _pd , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Evas_Object_Box_Option * * ret = va_arg ( * list , Evas_Object_Box_Option * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
Evas_Object_Box_Option * opt ;
opt = _evas_object_box_option_new ( o , priv , child ) ;
if ( ! opt )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
priv - > children = eina_list_append ( priv - > children , opt ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_ADDED , opt ) ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
* ret = opt ;
2008-10-26 19:22:41 -07:00
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_prepend_default ( Eo * o , void * _pd , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Evas_Object_Box_Option * * ret = va_arg ( * list , Evas_Object_Box_Option * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
Evas_Object_Box_Option * opt ;
opt = _evas_object_box_option_new ( o , priv , child ) ;
if ( ! opt )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
priv - > children = eina_list_prepend ( priv - > children , opt ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_ADDED , opt ) ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
* ret = opt ;
2008-10-26 19:22:41 -07:00
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_insert_before_default ( Eo * o , void * _pd , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
const Evas_Object * reference = va_arg ( * list , const Evas_Object * ) ;
Evas_Object_Box_Option * * ret = va_arg ( * list , Evas_Object_Box_Option * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
Eina_List * l ;
Evas_Object_Box_Option * opt ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
if ( opt - > obj = = reference )
2012-05-01 19:47:12 -07:00
{
Evas_Object_Box_Option * new_opt ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
new_opt = _evas_object_box_option_new ( o , priv , child ) ;
if ( ! new_opt )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
priv - > children = eina_list_prepend_relative
( priv - > children , new_opt , opt ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_ADDED , new_opt ) ;
2012-10-08 18:58:41 -07:00
* ret = new_opt ;
return ;
2012-05-01 19:47:12 -07:00
}
2008-10-26 19:22:41 -07:00
}
2012-10-08 18:58:41 -07:00
* ret = opt ;
2008-10-26 19:22:41 -07:00
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_insert_after_default ( Eo * o , void * _pd , va_list * list )
2009-10-02 12:06:12 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
const Evas_Object * reference = va_arg ( * list , const Evas_Object * ) ;
Evas_Object_Box_Option * * ret = va_arg ( * list , Evas_Object_Box_Option * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2009-10-02 12:06:12 -07:00
Eina_List * l ;
Evas_Object_Box_Option * opt ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
2012-05-01 19:47:12 -07:00
if ( opt - > obj = = reference )
{
Evas_Object_Box_Option * new_opt ;
2009-10-02 12:06:12 -07:00
2012-05-01 19:47:12 -07:00
new_opt = _evas_object_box_option_new ( o , priv , child ) ;
if ( ! new_opt )
2012-10-08 18:58:41 -07:00
return ;
2009-10-02 12:06:12 -07:00
2012-05-01 19:47:12 -07:00
priv - > children = eina_list_append_relative
( priv - > children , new_opt , opt ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_ADDED , new_opt ) ;
2012-10-08 18:58:41 -07:00
* ret = new_opt ;
return ;
2012-05-01 19:47:12 -07:00
}
2009-10-02 12:06:12 -07:00
}
2012-10-08 18:58:41 -07:00
* ret = opt ;
2009-10-02 12:06:12 -07:00
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_insert_at_default ( Eo * o , void * _pd , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
unsigned int pos = va_arg ( * list , unsigned int ) ;
Evas_Object_Box_Option * * ret = va_arg ( * list , Evas_Object_Box_Option * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
Eina_List * l ;
2009-02-27 08:35:32 -08:00
unsigned int i ;
2008-10-26 19:22:41 -07:00
if ( ( pos = = 0 ) & & ( eina_list_count ( priv - > children ) = = 0 ) )
{
Evas_Object_Box_Option * new_opt ;
new_opt = _evas_object_box_option_new ( o , priv , child ) ;
if ( ! new_opt )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
priv - > children = eina_list_prepend ( priv - > children , new_opt ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_ADDED , new_opt ) ;
2012-10-08 18:58:41 -07:00
* ret = new_opt ;
return ;
2008-10-26 19:22:41 -07:00
}
2010-08-21 06:52:25 -07:00
for ( l = priv - > children , i = 0 ; l ; l = l - > next , i + + )
2008-10-26 19:22:41 -07:00
{
2012-05-01 19:47:12 -07:00
Evas_Object_Box_Option * opt = l - > data ;
2008-10-26 19:22:41 -07:00
if ( i = = pos )
2012-05-01 19:47:12 -07:00
{
Evas_Object_Box_Option * new_opt ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
new_opt = _evas_object_box_option_new ( o , priv , child ) ;
if ( ! new_opt )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
priv - > children = eina_list_prepend_relative
( priv - > children , new_opt , opt ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_ADDED , new_opt ) ;
2012-10-08 18:58:41 -07:00
* ret = new_opt ;
return ;
2012-05-01 19:47:12 -07:00
}
2008-10-26 19:22:41 -07:00
}
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_remove_default ( Eo * o , void * _pd , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Evas_Object * * ret = va_arg ( * list , Evas_Object * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
Evas_Object_Box_Option * opt ;
Eina_List * l ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
Evas_Object * obj = opt - > obj ;
if ( obj = = child )
2012-05-01 19:47:12 -07:00
{
priv - > children = eina_list_remove ( priv - > children , opt ) ;
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_option_free ( opt ) ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_REMOVED , obj ) ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
* ret = obj ;
return ;
2012-05-01 19:47:12 -07:00
}
2008-10-26 19:22:41 -07:00
}
}
2012-10-08 18:58:41 -07:00
static void
_evas_object_box_remove_at_default ( Eo * o , void * _pd , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
unsigned int pos = va_arg ( * list , unsigned int ) ;
Evas_Object * * ret = va_arg ( * list , Evas_Object * * ) ;
* ret = NULL ;
Evas_Object_Box_Data * priv = _pd ;
2008-11-17 06:20:08 -08:00
Eina_List * node ;
2009-09-23 10:15:18 -07:00
Evas_Object_Box_Option * opt ;
Evas_Object * obj ;
2008-10-26 19:22:41 -07:00
2008-11-17 06:20:08 -08:00
node = eina_list_nth_list ( priv - > children , pos ) ;
if ( ! node )
2008-10-26 19:22:41 -07:00
{
2012-05-01 19:47:12 -07:00
ERR ( " No item to be removed at position %d " , pos ) ;
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
}
2009-09-23 10:15:18 -07:00
opt = node - > data ;
obj = opt - > obj ;
2008-11-17 06:20:08 -08:00
priv - > children = eina_list_remove_list ( priv - > children , node ) ;
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_option_free ( opt ) ) ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_TRUE ;
evas_object_smart_callback_call ( o , SIG_CHILD_REMOVED , obj ) ;
2012-10-08 18:58:41 -07:00
* ret = obj ;
2008-10-26 19:22:41 -07:00
}
static void
2012-10-08 18:58:41 -07:00
_smart_add ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2013-03-18 08:33:54 -07:00
eo_do_super ( o , MY_CLASS , evas_obj_smart_add ( ) ) ;
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
2010-07-09 04:17:35 -07:00
evas_object_event_callback_add
( o , EVAS_CALLBACK_CHANGED_SIZE_HINTS , _on_hints_changed , o ) ;
2008-10-26 19:22:41 -07:00
priv - > children = NULL ;
2008-10-31 10:42:47 -07:00
priv - > align . h = 0.5 ;
priv - > align . v = 0.5 ;
priv - > pad . h = 0 ;
priv - > pad . v = 0 ;
make it easy to write bindings for box.
giving an extra void *user_data to layout function is now easy to
write bindings, just give the callback to be a generic function that
will call the language/binding specific function handled as user_data.
Example, for python we can use:
void _layout_dispatcher(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) {
PyObject *pyobj = data, *args;
args = PyTyple_New(1);
PyTuple_SET_ITEM(args, 0, Evas_object_from_instance(o));
PyObject_Call(pyobj, args, NULL);
Py_DECREF(args);
}
evas_object_box_layout_set(o, _layout_dispatcher, pyobj, Py_DecRef);
SVN revision: 37640
2008-11-14 15:10:29 -08:00
priv - > layout . cb = evas_object_box_layout_horizontal ;
priv - > layout . data = NULL ;
priv - > layout . free_data = NULL ;
2008-10-26 19:22:41 -07:00
}
static void
2012-10-08 18:58:41 -07:00
_smart_del ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
Eina_List * l ;
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
l = priv - > children ;
while ( l )
{
2012-05-01 19:47:12 -07:00
Evas_Object_Box_Option * opt = l - > data ;
2008-10-26 19:22:41 -07:00
2013-06-17 19:34:31 -07:00
_evas_object_box_child_callbacks_unregister ( opt - > obj , o ) ;
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_option_free ( opt ) ) ;
2012-05-01 19:47:12 -07:00
l = eina_list_remove_list ( l , l ) ;
2008-10-26 19:22:41 -07:00
}
make it easy to write bindings for box.
giving an extra void *user_data to layout function is now easy to
write bindings, just give the callback to be a generic function that
will call the language/binding specific function handled as user_data.
Example, for python we can use:
void _layout_dispatcher(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) {
PyObject *pyobj = data, *args;
args = PyTyple_New(1);
PyTuple_SET_ITEM(args, 0, Evas_object_from_instance(o));
PyObject_Call(pyobj, args, NULL);
Py_DECREF(args);
}
evas_object_box_layout_set(o, _layout_dispatcher, pyobj, Py_DecRef);
SVN revision: 37640
2008-11-14 15:10:29 -08:00
if ( priv - > layout . data & & priv - > layout . free_data )
priv - > layout . free_data ( priv - > layout . data ) ;
2013-03-18 08:33:54 -07:00
eo_do_super ( o , MY_CLASS , evas_obj_smart_del ( ) ) ;
2008-10-26 19:22:41 -07:00
}
static void
2012-10-08 18:58:41 -07:00
_smart_resize ( Eo * o , void * _pd EINA_UNUSED , va_list * list )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Coord w = va_arg ( * list , Evas_Coord ) ;
Evas_Coord h = va_arg ( * list , Evas_Coord ) ;
2009-02-05 04:38:04 -08:00
Evas_Coord ow , oh ;
evas_object_geometry_get ( o , NULL , NULL , & ow , & oh ) ;
if ( ( ow = = w ) & & ( oh = = h ) ) return ;
2008-10-26 19:22:41 -07:00
evas_object_smart_changed ( o ) ;
}
static void
2012-10-08 18:58:41 -07:00
_smart_calculate ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
make it easy to write bindings for box.
giving an extra void *user_data to layout function is now easy to
write bindings, just give the callback to be a generic function that
will call the language/binding specific function handled as user_data.
Example, for python we can use:
void _layout_dispatcher(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) {
PyObject *pyobj = data, *args;
args = PyTyple_New(1);
PyTuple_SET_ITEM(args, 0, Evas_object_from_instance(o));
PyObject_Call(pyobj, args, NULL);
Py_DECREF(args);
}
evas_object_box_layout_set(o, _layout_dispatcher, pyobj, Py_DecRef);
SVN revision: 37640
2008-11-14 15:10:29 -08:00
if ( priv - > layout . cb )
2009-11-16 16:19:24 -08:00
{
priv - > layouting = 1 ;
priv - > layout . cb ( o , priv , priv - > layout . data ) ;
priv - > layouting = 0 ;
2010-09-21 07:04:28 -07:00
priv - > children_changed = EINA_FALSE ;
2009-11-16 16:19:24 -08:00
}
2008-10-26 19:22:41 -07:00
else
2009-10-22 08:22:22 -07:00
ERR ( " No layout function set for %p box. " , o ) ;
2008-10-26 19:22:41 -07:00
}
2012-10-08 18:58:41 -07:00
EAPI Evas_Object *
evas_object_box_add ( Evas * evas )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object * obj = eo_add ( MY_CLASS , evas ) ;
eo_unref ( obj ) ;
return obj ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_constructor ( Eo * obj , void * class_data EINA_UNUSED , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2013-03-18 08:33:54 -07:00
eo_do_super ( obj , MY_CLASS , eo_constructor ( ) ) ;
2012-10-08 18:58:41 -07:00
eo_do ( obj ,
evas_obj_smart_callbacks_descriptions_set ( _signals , NULL ) ,
2013-02-09 23:52:17 -08:00
evas_obj_type_set ( MY_CLASS_NAME ) ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI Evas_Object *
2008-10-26 19:22:41 -07:00
evas_object_box_add_to ( Evas_Object * parent )
2012-10-08 18:58:41 -07:00
{
Evas_Object * o = NULL ;
eo_do ( parent , evas_obj_box_add_to ( & o ) ) ;
return o ;
}
static void
_box_add_to ( Eo * parent , void * _pd EINA_UNUSED , va_list * list )
2008-10-26 19:22:41 -07:00
{
Evas * evas ;
2012-10-08 18:58:41 -07:00
Evas_Object * * o = va_arg ( * list , Evas_Object * * ) ;
2008-10-26 19:22:41 -07:00
evas = evas_object_evas_get ( parent ) ;
2012-10-08 18:58:41 -07:00
* o = evas_object_box_add ( evas ) ;
evas_object_smart_member_add ( * o , parent ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_smart_set ( Evas_Object_Box_Api * api EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
}
2010-03-22 18:22:20 -07:00
EAPI const Evas_Object_Box_Api *
evas_object_box_smart_class_get ( void )
{
2012-10-08 18:58:41 -07:00
return NULL ;
2010-03-22 18:22:20 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
make it easy to write bindings for box.
giving an extra void *user_data to layout function is now easy to
write bindings, just give the callback to be a generic function that
will call the language/binding specific function handled as user_data.
Example, for python we can use:
void _layout_dispatcher(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) {
PyObject *pyobj = data, *args;
args = PyTyple_New(1);
PyTuple_SET_ITEM(args, 0, Evas_object_from_instance(o));
PyObject_Call(pyobj, args, NULL);
Py_DECREF(args);
}
evas_object_box_layout_set(o, _layout_dispatcher, pyobj, Py_DecRef);
SVN revision: 37640
2008-11-14 15:10:29 -08:00
evas_object_box_layout_set ( Evas_Object * o , Evas_Object_Box_Layout cb , const void * data , void ( * free_data ) ( void * data ) )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_layout_set ( cb , data , free_data ) ) ;
}
static void
_box_layout_set ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Data * priv = _pd ;
Evas_Object_Box_Layout cb = va_arg ( * list , Evas_Object_Box_Layout ) ;
const void * data = va_arg ( * list , const void * ) ;
void ( * free_data ) ( void * data ) = va_arg ( * list , void ( * ) ( void * data ) ) ;
make it easy to write bindings for box.
giving an extra void *user_data to layout function is now easy to
write bindings, just give the callback to be a generic function that
will call the language/binding specific function handled as user_data.
Example, for python we can use:
void _layout_dispatcher(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) {
PyObject *pyobj = data, *args;
args = PyTyple_New(1);
PyTuple_SET_ITEM(args, 0, Evas_object_from_instance(o));
PyObject_Call(pyobj, args, NULL);
Py_DECREF(args);
}
evas_object_box_layout_set(o, _layout_dispatcher, pyobj, Py_DecRef);
SVN revision: 37640
2008-11-14 15:10:29 -08:00
2012-05-01 19:47:12 -07:00
if ( ( priv - > layout . cb = = cb ) & & ( priv - > layout . data = = data ) & &
2010-10-03 23:03:48 -07:00
( priv - > layout . free_data = = free_data ) )
2009-02-28 12:04:55 -08:00
return ;
make it easy to write bindings for box.
giving an extra void *user_data to layout function is now easy to
write bindings, just give the callback to be a generic function that
will call the language/binding specific function handled as user_data.
Example, for python we can use:
void _layout_dispatcher(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) {
PyObject *pyobj = data, *args;
args = PyTyple_New(1);
PyTuple_SET_ITEM(args, 0, Evas_object_from_instance(o));
PyObject_Call(pyobj, args, NULL);
Py_DECREF(args);
}
evas_object_box_layout_set(o, _layout_dispatcher, pyobj, Py_DecRef);
SVN revision: 37640
2008-11-14 15:10:29 -08:00
if ( priv - > layout . data & & priv - > layout . free_data )
priv - > layout . free_data ( priv - > layout . data ) ;
priv - > layout . cb = cb ;
priv - > layout . data = ( void * ) data ;
priv - > layout . free_data = free_data ;
2008-10-26 19:22:41 -07:00
evas_object_smart_changed ( o ) ;
}
static void
_fixed_point_divide_and_decompose_integer ( int dividend , int divisor , int * int_part , int * frac_part )
{
int quotient = ( long long ) ( dividend < < 16 ) / divisor ;
* frac_part = quotient & 0xffff ;
* int_part = quotient > > 16 ;
}
static void
_layout_dimension_change_min_max_cell_bound ( int dim , int * new_dim , int min_d , int max_d , int cell_sz )
{
if ( dim > cell_sz )
{
2012-05-01 19:47:12 -07:00
if ( ( min_d ! = 0 ) & & ( cell_sz < min_d ) )
* new_dim = min_d ;
else
* new_dim = cell_sz ;
2008-10-26 19:22:41 -07:00
}
else
{
2012-05-01 19:47:12 -07:00
if ( ( max_d ! = - 1 ) & & ( cell_sz > max_d ) )
* new_dim = max_d ;
else
* new_dim = cell_sz ;
2008-10-26 19:22:41 -07:00
}
}
static void
_layout_set_offset_and_expand_dimension_space_max_bounded ( int dim , int * new_dim , int space_sz , int max_dim , int * offset , double align , int pad_before , int pad_after )
{
if ( align > = 0.0 )
{
2012-05-01 19:47:12 -07:00
* new_dim = dim ;
* offset = ( space_sz - ( dim + pad_before + pad_after ) ) * align
+ pad_before ;
2008-10-26 19:22:41 -07:00
}
else
{
2012-05-01 19:47:12 -07:00
if ( ( max_dim ! = - 1 ) & & ( space_sz > max_dim ) )
{
* new_dim = max_dim ;
* offset = ( space_sz - ( max_dim + pad_before + pad_after ) ) * 0.5
+ pad_before ;
}
else
{
* new_dim = space_sz ;
* offset = 0 ;
}
2008-10-26 19:22:41 -07:00
}
}
static void
_layout_set_offset_and_change_dimension_min_max_cell_bounded ( int dim , int * new_dim , int min_dim , int max_dim , int cell_sz , int * offset , double align , int pad_before , int pad_after )
{
if ( align > = 0.0 )
2009-11-16 16:19:24 -08:00
{
2012-05-01 19:47:12 -07:00
* new_dim = dim ;
* offset =
( cell_sz - ( dim + pad_before + pad_after ) ) * align + pad_before ;
2009-11-16 16:19:24 -08:00
}
2008-10-26 19:22:41 -07:00
else
{
* offset = pad_before ;
2009-11-16 16:19:24 -08:00
_layout_dimension_change_min_max_cell_bound
2012-05-01 19:47:12 -07:00
( dim , new_dim , min_dim , max_dim , cell_sz - pad_before - pad_after ) ;
2008-10-26 19:22:41 -07:00
}
}
2009-11-16 16:19:24 -08:00
static void
_sizing_eval ( Evas_Object * obj )
{
Evas_Coord minw , minh , maxw , maxh ;
Evas_Coord w , h ;
evas_object_size_hint_min_get ( obj , & minw , & minh ) ;
evas_object_size_hint_max_get ( obj , & maxw , & maxh ) ;
evas_object_geometry_get ( obj , NULL , NULL , & w , & h ) ;
if ( w < minw ) w = minw ;
if ( h < minh ) h = minh ;
if ( ( maxw > = 0 ) & & ( w > maxw ) ) w = maxw ;
if ( ( maxh > = 0 ) & & ( h > maxh ) ) h = maxh ;
evas_object_resize ( obj , w , h ) ;
}
2008-10-26 19:22:41 -07:00
static int
2012-04-03 10:03:47 -07:00
_evas_object_box_layout_horizontal_weight_apply ( Evas_Object_Box_Data * priv , Evas_Object_Box_Option * * objects , int n_objects , int remaining , double weight_total )
2008-10-26 19:22:41 -07:00
{
int rem_diff = 0 ;
int i ;
for ( i = 0 ; i < n_objects ; i + + )
{
Evas_Object_Box_Option * opt = objects [ i ] ;
Evas_Object * o = opt - > obj ;
int h ;
evas_object_geometry_get ( o , NULL , NULL , NULL , & h ) ;
2009-11-16 16:19:24 -08:00
if ( remaining < = 0 )
2012-05-01 19:47:12 -07:00
{
int min_w ;
evas_object_size_hint_min_get ( o , & min_w , NULL ) ;
evas_object_resize ( o , min_w , h ) ;
}
else
{
double normal_weight , weight_x ;
int target_size ;
int max_w ;
evas_object_size_hint_weight_get ( o , & weight_x , NULL ) ;
normal_weight = weight_x / weight_total ;
target_size = ( int ) ( ( double ) remaining * normal_weight ) ;
evas_object_size_hint_max_get ( o , & max_w , NULL ) ;
if ( ( max_w ! = - 1 ) & & ( target_size > max_w ) )
{
evas_object_resize ( o , max_w , h ) ;
rem_diff + = max_w ;
objects [ i ] = objects [ n_objects - 1 ] ;
weight_total - = weight_x ;
n_objects - - ;
return _evas_object_box_layout_horizontal_weight_apply
( priv , objects , n_objects , remaining - rem_diff ,
weight_total ) ;
}
else
{
evas_object_resize ( o , target_size , h ) ;
rem_diff + = target_size ;
}
}
2008-10-26 19:22:41 -07:00
}
return remaining - rem_diff ;
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_horizontal ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_layout_horizontal ( ) ) ;
}
static void
_box_layout_horizontal ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
{
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
int pad_inc = 0 , sub_pixel = 0 ;
2008-11-22 18:01:38 -08:00
int req_w , global_pad , remaining , top_h = 0 ;
2008-10-26 19:22:41 -07:00
double weight_total = 0.0 ;
int weight_use = 0 ;
int x , y , w , h ;
int n_children ;
Evas_Object_Box_Option * opt ;
2009-09-23 10:15:18 -07:00
Evas_Object_Box_Option * * objects ;
2008-10-26 19:22:41 -07:00
Eina_List * l ;
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
2009-09-23 10:15:18 -07:00
objects = ( Evas_Object_Box_Option * * ) alloca ( sizeof ( Evas_Object_Box_Option * ) * n_children ) ;
if ( ! objects )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
2008-10-31 10:42:47 -07:00
global_pad = priv - > pad . h ;
2008-10-26 19:22:41 -07:00
req_w = global_pad * ( n_children - 1 ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int padding_l , padding_r ;
double weight_x ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_weight_get ( opt - > obj , & weight_x , NULL ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , NULL , NULL ) ;
2008-10-26 19:22:41 -07:00
req_w + = padding_l + padding_r ;
if ( ! weight_x )
2012-05-01 19:47:12 -07:00
{
int child_w ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , NULL ) ;
req_w + = child_w ;
}
else
{
objects [ weight_use ] = opt ;
weight_use + + ;
weight_total + = weight_x ;
}
2008-10-26 19:22:41 -07:00
}
remaining = w - req_w ;
if ( weight_use )
remaining = _evas_object_box_layout_horizontal_weight_apply
( priv , objects , weight_use , remaining , weight_total ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . h > = 0.0 )
x + = remaining * priv - > align . h ;
2008-10-26 19:22:41 -07:00
else if ( n_children = = 1 )
x + = remaining / 2 ;
2009-02-28 10:06:37 -08:00
else
2008-10-26 19:22:41 -07:00
{ /* justified */
_fixed_point_divide_and_decompose_integer
2009-02-28 09:50:15 -08:00
( remaining , n_children - 1 , & global_pad , & pad_inc ) ;
2008-10-31 10:42:47 -07:00
global_pad + = priv - > pad . h ;
2008-10-26 19:22:41 -07:00
}
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , child_h , max_h , new_h , off_x , off_y ;
int padding_l , padding_r , padding_t , padding_b ;
double align_y ;
evas_object_size_hint_align_get ( opt - > obj , NULL , & align_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( opt - > obj , NULL , & max_h ) ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
off_x = padding_l ;
new_h = child_h ;
2008-11-22 18:01:38 -08:00
if ( new_h > top_h ) top_h = new_h ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_expand_dimension_space_max_bounded
2012-05-01 19:47:12 -07:00
( child_h , & new_h , h , max_h , & off_y , align_y , padding_t , padding_b ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
if ( new_h ! = child_h )
evas_object_resize ( opt - > obj , child_w , new_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
x + = child_w + padding_l + padding_r + global_pad ;
sub_pixel + = pad_inc ;
if ( sub_pixel > = 1 < < 16 )
2012-05-01 19:47:12 -07:00
{
x + + ;
sub_pixel - = 1 < < 16 ;
}
2008-10-26 19:22:41 -07:00
}
2009-11-16 16:19:24 -08:00
2008-12-08 16:02:48 -08:00
evas_object_size_hint_min_set ( o , req_w , top_h ) ;
2008-10-26 19:22:41 -07:00
}
static int
2012-04-03 10:03:47 -07:00
_evas_object_box_layout_vertical_weight_apply ( Evas_Object_Box_Data * priv , Evas_Object_Box_Option * * objects , int n_objects , int remaining , double weight_total )
2008-10-26 19:22:41 -07:00
{
int rem_diff = 0 ;
int i ;
for ( i = 0 ; i < n_objects ; i + + )
{
Evas_Object_Box_Option * opt = objects [ i ] ;
Evas_Object * o = opt - > obj ;
int w ;
evas_object_geometry_get ( o , NULL , NULL , & w , NULL ) ;
2009-11-16 16:19:24 -08:00
if ( remaining < = 0 )
2012-05-01 19:47:12 -07:00
{
int min_h ;
evas_object_size_hint_min_get ( o , NULL , & min_h ) ;
evas_object_resize ( o , w , min_h ) ;
}
else
{
double normal_weight , weight_y ;
int target_size ;
int max_h ;
evas_object_size_hint_weight_get ( o , NULL , & weight_y ) ;
normal_weight = weight_y / weight_total ;
target_size = ( int ) ( ( double ) remaining * normal_weight ) ;
evas_object_size_hint_max_get ( o , NULL , & max_h ) ;
if ( ( max_h ! = - 1 ) & & ( target_size > max_h ) )
{
evas_object_resize ( o , w , max_h ) ;
rem_diff + = max_h ;
objects [ i ] = objects [ n_objects - 1 ] ;
weight_total - = weight_y ;
n_objects - - ;
return _evas_object_box_layout_vertical_weight_apply
( priv , objects , n_objects , remaining - rem_diff ,
weight_total ) ;
}
else
{
evas_object_resize ( o , w , target_size ) ;
rem_diff + = target_size ;
}
}
2008-10-26 19:22:41 -07:00
}
return remaining - rem_diff ;
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_vertical ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_layout_vertical ( ) ) ;
}
static void
_box_layout_vertical ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
{
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
int pad_inc = 0 , sub_pixel = 0 ;
2008-11-22 18:01:38 -08:00
int req_h , global_pad , remaining , top_w = 0 ;
2008-10-26 19:22:41 -07:00
double weight_total = 0.0 ;
int weight_use = 0 ;
int x , y , w , h ;
int n_children ;
Evas_Object_Box_Option * opt ;
2009-09-23 10:15:18 -07:00
Evas_Object_Box_Option * * objects ;
2008-10-26 19:22:41 -07:00
Eina_List * l ;
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
2009-09-23 10:15:18 -07:00
objects = ( Evas_Object_Box_Option * * ) alloca ( sizeof ( Evas_Object_Box_Option * ) * n_children ) ;
if ( ! objects )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
2008-10-31 10:42:47 -07:00
global_pad = priv - > pad . v ;
2008-10-26 19:22:41 -07:00
req_h = global_pad * ( n_children - 1 ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int padding_t , padding_b ;
double weight_y ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_weight_get ( opt - > obj , NULL , & weight_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , NULL , NULL , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
req_h + = padding_t + padding_b ;
if ( ! weight_y )
2012-05-01 19:47:12 -07:00
{
int child_h ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , NULL , & child_h ) ;
req_h + = child_h ;
}
else
{
objects [ weight_use ] = opt ;
weight_use + + ;
weight_total + = weight_y ;
}
2008-10-26 19:22:41 -07:00
}
remaining = h - req_h ;
if ( weight_use )
remaining = _evas_object_box_layout_vertical_weight_apply
( priv , objects , weight_use , remaining , weight_total ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . v > = 0.0 )
y + = remaining * priv - > align . v ;
2008-10-26 19:22:41 -07:00
else if ( n_children = = 1 )
y + = remaining / 2 ;
2009-02-28 10:06:37 -08:00
else
2008-10-26 19:22:41 -07:00
{ /* justified */
2012-05-01 19:47:12 -07:00
_fixed_point_divide_and_decompose_integer
( remaining , n_children - 1 , & global_pad , & pad_inc ) ;
global_pad + = priv - > pad . v ;
2008-10-26 19:22:41 -07:00
}
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , child_h , max_w , new_w , off_x , off_y ;
int padding_l , padding_r , padding_t , padding_b ;
double align_x ;
evas_object_size_hint_align_get ( opt - > obj , & align_x , NULL ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( opt - > obj , & max_w , NULL ) ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
off_y = padding_t ;
new_w = child_w ;
_layout_set_offset_and_expand_dimension_space_max_bounded
2012-05-01 19:47:12 -07:00
( child_w , & new_w , w , max_w , & off_x , align_x , padding_l , padding_r ) ;
2008-10-26 19:22:41 -07:00
2010-10-07 07:09:17 -07:00
if ( new_w > top_w ) top_w = new_w ;
2012-05-01 19:47:12 -07:00
if ( new_w ! = child_w )
evas_object_resize ( opt - > obj , new_w , child_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
y + = child_h + padding_t + padding_b + global_pad ;
sub_pixel + = pad_inc ;
if ( sub_pixel > = 1 < < 16 )
2012-05-01 19:47:12 -07:00
{
y + + ;
sub_pixel - = 1 < < 16 ;
}
2008-10-26 19:22:41 -07:00
}
2009-11-16 16:19:24 -08:00
2008-12-08 16:02:48 -08:00
evas_object_size_hint_min_set ( o , top_w , req_h ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_homogeneous_horizontal ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
{
eo_do ( o , evas_obj_box_layout_homogeneous_horizontal ( ) ) ;
}
static void
_box_layout_homogeneous_horizontal ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
int cell_sz , share , inc ;
int sub_pixel = 0 ;
int x , y , w , h ;
int n_children ;
Evas_Object_Box_Option * opt ;
Eina_List * l ;
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
2008-10-31 10:42:47 -07:00
share = w - priv - > pad . h * ( n_children - 1 ) ;
2008-10-26 19:22:41 -07:00
_fixed_point_divide_and_decompose_integer
( share , n_children , & cell_sz , & inc ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , child_h , max_h , min_w , max_w , new_w , new_h , off_x , off_y ;
int padding_l , padding_r , padding_t , padding_b ;
double align_x , align_y ;
evas_object_size_hint_align_get ( opt - > obj , & align_x , & align_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( opt - > obj , & max_w , & max_h ) ;
evas_object_size_hint_min_get ( opt - > obj , & min_w , NULL ) ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
new_w = child_w ;
new_h = child_h ;
_layout_set_offset_and_expand_dimension_space_max_bounded
2012-05-01 19:47:12 -07:00
( child_h , & new_h , h , max_h , & off_y , align_y , padding_t , padding_b ) ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_change_dimension_min_max_cell_bounded
2012-05-01 19:47:12 -07:00
( child_w , & new_w , min_w , max_w , cell_sz , & off_x , align_x ,
padding_l , padding_r ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
if ( ( new_w ! = child_w ) | | ( new_h ! = child_h ) )
evas_object_resize ( opt - > obj , new_w , new_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
2008-10-31 10:42:47 -07:00
x + = cell_sz + priv - > pad . h ;
2008-10-26 19:22:41 -07:00
sub_pixel + = inc ;
if ( sub_pixel > = 1 < < 16 )
2012-05-01 19:47:12 -07:00
{
x + + ;
sub_pixel - = 1 < < 16 ;
}
2008-10-26 19:22:41 -07:00
}
2009-11-16 16:19:24 -08:00
2008-11-22 18:01:38 -08:00
evas_object_size_hint_min_set ( o , w , h ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_homogeneous_vertical ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_layout_homogeneous_vertical ( ) ) ;
}
static void
_box_layout_homogeneous_vertical ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
{
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
int cell_sz , share , inc ;
int sub_pixel = 0 ;
int x , y , w , h ;
int n_children ;
Evas_Object_Box_Option * opt ;
Eina_List * l ;
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
2008-10-31 10:42:47 -07:00
share = h - priv - > pad . v * ( n_children - 1 ) ;
2008-10-26 19:22:41 -07:00
_fixed_point_divide_and_decompose_integer
( share , n_children , & cell_sz , & inc ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , child_h , max_w , min_h , max_h , new_w , new_h , off_x , off_y ;
int padding_l , padding_r , padding_t , padding_b ;
double align_x , align_y ;
evas_object_size_hint_align_get ( opt - > obj , & align_x , & align_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( opt - > obj , & max_w , & max_h ) ;
evas_object_size_hint_min_get ( opt - > obj , NULL , & min_h ) ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
new_w = child_w ;
new_h = child_h ;
_layout_set_offset_and_expand_dimension_space_max_bounded
2012-05-01 19:47:12 -07:00
( child_w , & new_w , w , max_w , & off_x , align_x , padding_l , padding_r ) ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_change_dimension_min_max_cell_bounded
2012-05-01 19:47:12 -07:00
( child_h , & new_h , min_h , max_h , cell_sz , & off_y , align_y ,
padding_t , padding_b ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
if ( ( new_w ! = child_w ) | | ( new_h ! = child_h ) )
evas_object_resize ( opt - > obj , new_w , new_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
2008-10-31 10:42:47 -07:00
y + = cell_sz + priv - > pad . v ;
2008-10-26 19:22:41 -07:00
sub_pixel + = inc ;
if ( sub_pixel > = 1 < < 16 )
2012-05-01 19:47:12 -07:00
{
y + + ;
sub_pixel - = 1 < < 16 ;
}
2008-10-26 19:22:41 -07:00
}
2009-11-16 16:19:24 -08:00
2008-11-22 18:01:38 -08:00
evas_object_size_hint_min_set ( o , w , h ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_homogeneous_max_size_horizontal ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_layout_homogeneous_max_size_horizontal ( ) ) ;
}
static void
_box_layout_homogeneous_max_size_horizontal ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
{
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
int remaining , global_pad , pad_inc = 0 , sub_pixel = 0 ;
int cell_sz = 0 ;
int x , y , w , h ;
2008-11-22 18:01:38 -08:00
int top_h = 0 ;
2008-10-26 19:22:41 -07:00
int n_children ;
Evas_Object_Box_Option * opt ;
Eina_List * l ;
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , padding_l , padding_r ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , NULL , NULL ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , NULL ) ;
if ( child_w + padding_l + padding_r > cell_sz )
2012-05-01 19:47:12 -07:00
cell_sz = child_w + padding_l + padding_r ;
2008-10-26 19:22:41 -07:00
}
2008-10-31 10:42:47 -07:00
global_pad = priv - > pad . h ;
2008-10-26 19:22:41 -07:00
remaining = w - n_children * cell_sz - global_pad * ( n_children - 1 ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . h > = 0.0 )
x + = remaining * priv - > align . h ;
2008-10-26 19:22:41 -07:00
else if ( n_children = = 1 )
x + = remaining / 2 ;
else
{ /* justified */
_fixed_point_divide_and_decompose_integer
2012-05-01 19:47:12 -07:00
( remaining , n_children - 1 , & global_pad , & pad_inc ) ;
2008-10-31 10:42:47 -07:00
global_pad + = priv - > pad . h ;
2008-10-26 19:22:41 -07:00
}
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , child_h , min_w , max_w , max_h , new_w , new_h , off_x , off_y ;
int padding_l , padding_r , padding_t , padding_b ;
double align_x , align_y ;
evas_object_size_hint_align_get ( opt - > obj , & align_x , & align_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( opt - > obj , & max_w , & max_h ) ;
evas_object_size_hint_min_get ( opt - > obj , & min_w , NULL ) ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
new_w = child_w ;
new_h = child_h ;
2008-11-22 18:01:38 -08:00
if ( new_h > top_h ) top_h = new_h ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_expand_dimension_space_max_bounded
2012-05-01 19:47:12 -07:00
( child_h , & new_h , h , max_h , & off_y , align_y , padding_t , padding_b ) ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_change_dimension_min_max_cell_bounded
2012-05-01 19:47:12 -07:00
( child_w , & new_w , min_w , max_w , cell_sz , & off_x , align_x ,
padding_l , padding_r ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
if ( ( new_w ! = child_w ) | | ( new_h ! = child_h ) )
evas_object_resize ( opt - > obj , new_w , new_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
x + = cell_sz + global_pad ;
sub_pixel + = pad_inc ;
if ( sub_pixel > = 1 < < 16 )
2012-05-01 19:47:12 -07:00
{
x + + ;
sub_pixel - = 1 < < 16 ;
}
2008-10-26 19:22:41 -07:00
}
2009-11-16 16:19:24 -08:00
2008-11-22 18:01:38 -08:00
evas_object_size_hint_min_set ( o , x , top_h ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_homogeneous_max_size_vertical ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_layout_homogeneous_max_size_vertical ( ) ) ;
}
static void
_box_layout_homogeneous_max_size_vertical ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
{
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
int remaining , global_pad , pad_inc = 0 , sub_pixel = 0 ;
int cell_sz = 0 ;
int x , y , w , h ;
2008-11-22 18:01:38 -08:00
int top_w = 0 ;
2008-10-26 19:22:41 -07:00
int n_children ;
Evas_Object_Box_Option * opt ;
Eina_List * l ;
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_h , padding_t , padding_b ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , NULL , NULL , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( opt - > obj , NULL , NULL , NULL , & child_h ) ;
if ( child_h + padding_t + padding_b > cell_sz )
2012-05-01 19:47:12 -07:00
cell_sz = child_h + padding_t + padding_b ;
2008-10-26 19:22:41 -07:00
}
2008-10-31 10:42:47 -07:00
global_pad = priv - > pad . v ;
2008-10-26 19:22:41 -07:00
remaining = h - n_children * cell_sz - global_pad * ( n_children - 1 ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . v > = 0.0 )
y + = remaining * priv - > align . v ;
2008-10-26 19:22:41 -07:00
else if ( n_children = = 1 )
y + = remaining / 2 ;
else
{ /* justified */
2012-05-01 19:47:12 -07:00
_fixed_point_divide_and_decompose_integer
( remaining , n_children - 1 , & global_pad , & pad_inc ) ;
global_pad + = priv - > pad . v ;
2008-10-26 19:22:41 -07:00
}
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
int child_w , child_h , max_h , min_h , max_w , new_w , new_h , off_x , off_y ;
int padding_l , padding_r , padding_t , padding_b ;
double align_x , align_y ;
evas_object_size_hint_align_get ( opt - > obj , & align_x , & align_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( opt - > obj , & max_w , & max_h ) ;
evas_object_size_hint_min_get ( opt - > obj , NULL , & min_h ) ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
new_w = child_w ;
new_h = child_h ;
2008-11-22 18:01:38 -08:00
if ( new_w > top_w ) top_w = new_w ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_expand_dimension_space_max_bounded
2012-05-01 19:47:12 -07:00
( child_w , & new_w , w , max_w , & off_x , align_x , padding_l , padding_r ) ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_change_dimension_min_max_cell_bounded
2012-05-01 19:47:12 -07:00
( child_h , & new_h , min_h , max_h , cell_sz , & off_y , align_y ,
padding_t , padding_b ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
if ( ( new_w ! = child_w ) | | ( new_h ! = child_h ) )
evas_object_resize ( opt - > obj , new_w , new_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
y + = cell_sz + global_pad ;
sub_pixel + = pad_inc ;
if ( sub_pixel > = 1 < < 16 )
2012-05-01 19:47:12 -07:00
{
y + + ;
sub_pixel - = 1 < < 16 ;
}
2008-10-26 19:22:41 -07:00
}
2009-11-16 16:19:24 -08:00
2008-11-22 18:01:38 -08:00
evas_object_size_hint_min_set ( o , top_w , y ) ;
2008-10-26 19:22:41 -07:00
}
static void
2009-02-28 09:07:10 -08:00
_evas_object_box_layout_flow_horizontal_row_info_collect ( Evas_Object_Box_Data * priv , int box_w , int * row_count , int * row_max_h , int * row_break , int * row_width , int * off_y_ret , int * max_h_ret )
2008-10-26 19:22:41 -07:00
{
int i , remain_w = box_w , start_i = 0 ;
int off_y = 0 , max_h = 0 , n_rows = 0 ;
Eina_List * l ;
2010-08-21 06:52:25 -07:00
for ( i = 0 , l = priv - > children ; l ; i + + , l = l - > next )
2008-10-26 19:22:41 -07:00
{
Evas_Object_Box_Option * opt = l - > data ;
int padding_l , padding_r , padding_t , padding_b ;
int child_w , child_h , off_x = 0 ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
2008-10-26 19:22:41 -07:00
2008-10-31 10:42:47 -07:00
child_w + = padding_l + padding_r + priv - > pad . h ;
2008-10-26 19:22:41 -07:00
child_h + = padding_t + padding_b ;
remain_w - = child_w ;
2009-08-13 08:01:49 -07:00
if ( remain_w + priv - > pad . h > = 0 )
2012-05-01 19:47:12 -07:00
{ /* continue "line" */
if ( child_h > max_h )
max_h = child_h ;
off_x + = child_w ;
row_width [ n_rows ] + = child_w ;
}
else
{ /* break line */
if ( i = = start_i )
{ /* obj goes to actual line */
max_h = child_h ;
row_width [ n_rows ] = child_w ;
}
else
{ /* obj goes to next line */
row_max_h [ n_rows ] = max_h ;
row_break [ n_rows ] = i - 1 ;
n_rows + + ;
off_x = child_w ;
off_y + = max_h ;
max_h = child_h ;
row_width [ n_rows ] = child_w ;
start_i = i ;
remain_w = box_w - off_x ;
}
}
2008-10-26 19:22:41 -07:00
}
row_break [ n_rows ] = i - 1 ;
row_max_h [ n_rows ] = max_h ;
* row_count = n_rows ;
* off_y_ret = off_y ;
* max_h_ret = max_h ;
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_flow_horizontal ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
{
eo_do ( o , evas_obj_box_layout_flow_horizontal ( ) ) ;
}
static void
_box_layout_flow_horizontal ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
2012-01-18 15:33:33 -08:00
int n_children ;
2008-10-26 19:22:41 -07:00
int r , row_count = 0 ;
2009-02-28 11:33:30 -08:00
int min_w = 0 , min_h = 0 ;
2008-10-26 19:22:41 -07:00
int max_h , inc_y ;
int remain_y , i ;
int x , y , w , h ;
Eina_List * l ;
2009-09-23 10:15:18 -07:00
int * row_max_h ;
int * row_break ;
int * row_width ;
2011-05-18 07:12:10 -07:00
int offset_y ;
2008-10-26 19:22:41 -07:00
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
/* *per row* arrays */
2009-09-23 10:15:18 -07:00
row_max_h = ( int * ) alloca ( sizeof ( int ) * n_children ) ;
row_break = ( int * ) alloca ( sizeof ( int ) * n_children ) ;
row_width = ( int * ) alloca ( sizeof ( int ) * n_children ) ;
2008-10-26 19:22:41 -07:00
2012-11-09 13:22:04 -08:00
memset ( row_width , 0 , sizeof ( int ) * n_children ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
_evas_object_box_layout_flow_horizontal_row_info_collect
2011-05-18 07:12:10 -07:00
( priv , w , & row_count , row_max_h , row_break , row_width , & offset_y , & max_h ) ;
2008-10-26 19:22:41 -07:00
inc_y = 0 ;
2011-05-18 07:12:10 -07:00
remain_y = h - ( offset_y + max_h ) ;
2008-10-26 19:22:41 -07:00
2009-02-28 09:10:03 -08:00
if ( remain_y > 0 )
{
2012-05-01 19:47:12 -07:00
if ( priv - > align . v > = 0.0 )
inc_y = priv - > align . v * remain_y ;
else if ( row_count = = 0 )
y + = remain_y / 2 ;
else /* y-justified */
inc_y = remain_y / row_count ;
2009-02-28 09:10:03 -08:00
}
2008-10-26 19:22:41 -07:00
2009-08-13 08:01:49 -07:00
inc_y + = priv - > pad . v ;
2008-10-26 19:22:41 -07:00
for ( i = 0 , r = 0 , l = priv - > children ; r < = row_count ; r + + )
{
2009-03-01 08:27:03 -08:00
int row_justify = 0 , just_inc = 0 , sub_pixel = 0 ;
2008-10-26 19:22:41 -07:00
int row_size , remain_x ;
row_size = row_break [ r ] - i ;
remain_x = ( w - row_width [ r ] ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . h < 0.0 )
2012-05-01 19:47:12 -07:00
{
if ( row_size = = 0 )
x + = remain_x / 2 ;
else
_fixed_point_divide_and_decompose_integer
( remain_x , row_size , & row_justify , & just_inc ) ;
}
2008-10-26 19:22:41 -07:00
2009-08-13 08:01:49 -07:00
row_justify + = priv - > pad . h ;
2008-10-26 19:22:41 -07:00
for ( ; i < = row_break [ r ] ; i + + , l = l - > next )
2012-05-01 19:47:12 -07:00
{
Evas_Object_Box_Option * opt = l - > data ;
int off_x , off_y , y_remain ;
int padding_l , padding_r ;
int child_w , child_h ;
double align_y ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
evas_object_size_hint_align_get ( opt - > obj , NULL , & align_y ) ;
evas_object_size_hint_padding_get
( opt - > obj , & padding_l , & padding_r , NULL , NULL ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
evas_object_geometry_get
( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
y_remain = row_max_h [ r ] - child_h ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
off_x = padding_l ;
if ( priv - > align . h > = 0.0 )
off_x + = remain_x * priv - > align . h ;
off_y = y_remain * align_y ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
x + = child_w + padding_l + padding_r + row_justify ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
sub_pixel + = just_inc ;
if ( sub_pixel > = 1 < < 16 )
{
x + + ;
sub_pixel - = 1 < < 16 ;
}
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , NULL , NULL , NULL ) ;
2009-03-02 05:47:50 -08:00
if ( min_w < row_width [ r ] )
min_w = row_width [ r ] ;
2009-02-28 11:33:30 -08:00
min_h + = row_max_h [ r ] ;
2008-10-26 19:22:41 -07:00
y + = row_max_h [ r ] + inc_y ;
}
2008-11-22 18:01:38 -08:00
2009-02-28 11:33:30 -08:00
evas_object_size_hint_min_set ( o , min_w , min_h ) ;
2008-10-26 19:22:41 -07:00
}
static void
2009-02-28 09:07:10 -08:00
_evas_object_box_layout_flow_vertical_col_info_collect ( Evas_Object_Box_Data * priv , int box_h , int * col_count , int * col_max_w , int * col_break , int * col_height , int * off_x_ret , int * max_w_ret )
2008-10-26 19:22:41 -07:00
{
int i , remain_h = box_h , start_i = 0 ;
int off_x = 0 , max_w = 0 , n_cols = 0 ;
Eina_List * l ;
2010-08-21 06:52:25 -07:00
for ( i = 0 , l = priv - > children ; l ; i + + , l = l - > next )
2008-10-26 19:22:41 -07:00
{
Evas_Object_Box_Option * opt = l - > data ;
int padding_l , padding_r , padding_t , padding_b ;
int child_w , child_h , off_y = 0 ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( opt - > obj , & padding_l , & padding_r , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
child_w + = padding_l + padding_r ;
2008-10-31 10:42:47 -07:00
child_h + = padding_t + padding_b + priv - > pad . v ;
2008-10-26 19:22:41 -07:00
remain_h - = child_h ;
2009-08-13 08:01:49 -07:00
if ( remain_h + priv - > pad . v > = 0 )
2012-05-01 19:47:12 -07:00
{ /* continue "col" */
if ( child_w > max_w )
max_w = child_w ;
off_y + = child_h ;
col_height [ n_cols ] + = child_h ;
}
else
{
/* break col */
if ( i = = start_i )
{ /* obj goes to actual col */
max_w = child_w ;
col_height [ n_cols ] = child_h ;
}
else
{ /* obj goes to next col */
col_max_w [ n_cols ] = max_w ;
col_break [ n_cols ] = i - 1 ;
n_cols + + ;
off_x + = max_w ;
off_y = child_h ;
max_w = child_w ;
col_height [ n_cols ] = child_h ;
start_i = i ;
remain_h = box_h - off_y ;
}
}
2008-10-26 19:22:41 -07:00
}
col_break [ n_cols ] = i - 1 ;
col_max_w [ n_cols ] = max_w ;
* col_count = n_cols ;
* off_x_ret = off_x ;
* max_w_ret = max_w ;
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_flow_vertical ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
{
eo_do ( o , evas_obj_box_layout_flow_vertical ( ) ) ;
}
static void
_box_layout_flow_vertical ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
2009-06-14 13:48:37 -07:00
int n_children ;
2008-10-26 19:22:41 -07:00
int c , col_count ;
2009-02-28 11:33:30 -08:00
int min_w = 0 , min_h = 0 ;
2008-10-26 19:22:41 -07:00
int max_w , inc_x ;
int remain_x , i ;
int x , y , w , h ;
Eina_List * l ;
2009-09-23 10:15:18 -07:00
int * col_max_w ;
int * col_break ;
int * col_height ;
2011-05-18 07:12:10 -07:00
int offset_x ;
2008-10-26 19:22:41 -07:00
n_children = eina_list_count ( priv - > children ) ;
if ( ! n_children )
2012-11-30 12:59:30 -08:00
{
evas_object_size_hint_min_set ( o , 0 , 0 ) ;
return ;
}
2008-10-26 19:22:41 -07:00
/* *per col* arrays */
2009-09-23 10:15:18 -07:00
col_max_w = ( int * ) alloca ( sizeof ( int ) * n_children ) ;
col_break = ( int * ) alloca ( sizeof ( int ) * n_children ) ;
col_height = ( int * ) alloca ( sizeof ( int ) * n_children ) ;
2008-10-26 19:22:41 -07:00
2012-11-09 13:22:04 -08:00
memset ( col_height , 0 , sizeof ( int ) * n_children ) ;
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , & x , & y , & w , & h ) ;
_evas_object_box_layout_flow_vertical_col_info_collect
2011-05-18 07:12:10 -07:00
( priv , h , & col_count , col_max_w , col_break , col_height , & offset_x , & max_w ) ;
2008-10-26 19:22:41 -07:00
inc_x = 0 ;
2011-05-18 07:12:10 -07:00
remain_x = w - ( offset_x + max_w ) ;
2008-10-26 19:22:41 -07:00
2009-02-28 09:10:03 -08:00
if ( remain_x > 0 )
{
2012-05-01 19:47:12 -07:00
if ( priv - > align . h > = 0 )
inc_x = priv - > align . h * remain_x ;
else if ( col_count = = 0 )
x + = remain_x / 2 ;
else /* x-justified */
inc_x = remain_x / col_count ;
2009-02-28 09:10:03 -08:00
}
2008-10-26 19:22:41 -07:00
2009-08-13 08:01:49 -07:00
inc_x + = priv - > pad . h ;
2008-10-26 19:22:41 -07:00
for ( i = 0 , c = 0 , l = priv - > children ; c < = col_count ; c + + )
{
2009-03-01 08:27:03 -08:00
int col_justify = 0 , just_inc = 0 , sub_pixel = 0 ;
2008-10-26 19:22:41 -07:00
int col_size , remain_y ;
col_size = col_break [ c ] - i ;
remain_y = ( h - col_height [ c ] ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . v < 0.0 )
2012-05-01 19:47:12 -07:00
{
if ( col_size = = 0 )
y + = remain_y / 2 ;
else
_fixed_point_divide_and_decompose_integer
( remain_y , col_size , & col_justify , & just_inc ) ;
}
2008-10-26 19:22:41 -07:00
2009-08-13 08:01:49 -07:00
col_justify + = priv - > pad . v ;
2008-10-26 19:22:41 -07:00
for ( ; i < = col_break [ c ] ; i + + , l = l - > next )
2012-05-01 19:47:12 -07:00
{
Evas_Object_Box_Option * opt = l - > data ;
int off_x , off_y , x_remain ;
int padding_t , padding_b ;
int child_w , child_h ;
double align_x ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
evas_object_size_hint_align_get ( opt - > obj , & align_x , NULL ) ;
evas_object_size_hint_padding_get
( opt - > obj , NULL , NULL , & padding_t , & padding_b ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
evas_object_geometry_get
( opt - > obj , NULL , NULL , & child_w , & child_h ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
x_remain = col_max_w [ c ] - child_w ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
off_x = x_remain * align_x ;
off_y = padding_t ;
if ( priv - > align . v > = 0.0 )
off_y + = remain_y * priv - > align . v ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
evas_object_move ( opt - > obj , x + off_x , y + off_y ) ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
y + = child_h + padding_t + padding_b + col_justify ;
2008-10-26 19:22:41 -07:00
2012-05-01 19:47:12 -07:00
sub_pixel + = just_inc ;
if ( sub_pixel > = 1 < < 16 )
{
y + + ;
sub_pixel - = 1 < < 16 ;
}
}
2008-10-26 19:22:41 -07:00
evas_object_geometry_get ( o , NULL , & y , NULL , NULL ) ;
2009-02-28 11:33:30 -08:00
min_w + = col_max_w [ c ] ;
2009-03-02 05:47:50 -08:00
if ( min_h < col_height [ c ] )
min_h = col_height [ c ] ;
2008-10-26 19:22:41 -07:00
x + = col_max_w [ c ] + inc_x ;
}
2008-11-22 18:01:38 -08:00
2009-02-28 11:33:30 -08:00
evas_object_size_hint_min_set ( o , min_w , min_h ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2012-10-08 18:58:41 -07:00
evas_object_box_layout_stack ( Evas_Object * o , Evas_Object_Box_Data * priv EINA_UNUSED , void * data EINA_UNUSED )
{
eo_do ( o , evas_obj_box_layout_stack ( ) ) ;
}
static void
_box_layout_stack ( Eo * o , void * _pd , va_list * list EINA_UNUSED )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
2008-10-26 19:22:41 -07:00
Eina_List * l ;
Evas_Coord ox , oy , ow , oh ;
2008-11-22 18:01:38 -08:00
Evas_Coord top_w = 0 , top_h = 0 ;
2008-10-26 19:22:41 -07:00
Evas_Object_Box_Option * opt ;
Evas_Object * old_child = NULL ;
evas_object_geometry_get ( o , & ox , & oy , & ow , & oh ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
{
Evas_Object * child = opt - > obj ;
Evas_Coord max_w , max_h , min_w , min_h , pad_l , pad_r , pad_t , pad_b ,
2012-05-01 19:47:12 -07:00
child_w , child_h , new_w , new_h , off_x , off_y ;
2008-10-26 19:22:41 -07:00
double align_x , align_y ;
evas_object_size_hint_align_get ( child , & align_x , & align_y ) ;
evas_object_size_hint_padding_get
2012-05-01 19:47:12 -07:00
( child , & pad_l , & pad_r , & pad_t , & pad_b ) ;
2008-10-26 19:22:41 -07:00
evas_object_size_hint_max_get ( child , & max_w , & max_h ) ;
evas_object_size_hint_min_get ( child , & min_w , & min_h ) ;
2012-05-01 19:47:12 -07:00
_sizing_eval ( opt - > obj ) ;
evas_object_geometry_get ( child , NULL , NULL , & child_w , & child_h ) ;
2008-10-26 19:22:41 -07:00
new_w = child_w ;
new_h = child_h ;
2009-09-03 22:13:19 -07:00
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_change_dimension_min_max_cell_bounded
2012-05-01 19:47:12 -07:00
( child_w , & new_w , min_w , max_w , ow , & off_x , align_x , pad_l , pad_r ) ;
2008-10-26 19:22:41 -07:00
_layout_set_offset_and_change_dimension_min_max_cell_bounded
2012-05-01 19:47:12 -07:00
( child_h , & new_h , min_h , max_h , oh , & off_y , align_y , pad_t , pad_b ) ;
2008-10-26 19:22:41 -07:00
2013-01-11 08:54:48 -08:00
if ( new_w > top_w ) top_w = new_w ;
if ( new_h > top_h ) top_h = new_h ;
2012-05-01 19:47:12 -07:00
if ( ( new_w ! = child_w ) | | ( new_h ! = child_h ) )
evas_object_resize ( child , new_w , new_h ) ;
2008-10-26 19:22:41 -07:00
evas_object_move ( child , ox + off_x , oy + off_y ) ;
if ( old_child )
2012-05-01 19:47:12 -07:00
evas_object_stack_above ( child , old_child ) ;
2008-10-26 19:22:41 -07:00
old_child = child ;
}
2009-11-16 16:19:24 -08:00
2008-11-22 18:01:38 -08:00
evas_object_size_hint_min_set ( o , top_w , top_h ) ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2008-10-31 10:42:47 -07:00
evas_object_box_align_set ( Evas_Object * o , double horizontal , double vertical )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_align_set ( horizontal , vertical ) ) ;
}
static void
_box_align_set ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Data * priv = _pd ;
double horizontal = va_arg ( * list , double ) ;
double vertical = va_arg ( * list , double ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > align . h = = horizontal & & priv - > align . v = = vertical )
return ;
priv - > align . h = horizontal ;
priv - > align . v = vertical ;
2008-10-26 19:22:41 -07:00
evas_object_smart_changed ( o ) ;
}
2010-01-11 06:24:41 -08:00
EAPI void
2008-10-31 10:42:47 -07:00
evas_object_box_align_get ( const Evas_Object * o , double * horizontal , double * vertical )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( ( Eo * ) o , evas_obj_box_align_get ( horizontal , vertical ) ) ;
}
static void
_box_align_get ( Eo * o EINA_UNUSED , void * _pd , va_list * list )
{
const Evas_Object_Box_Data * priv = _pd ;
double * horizontal = va_arg ( * list , double * ) ;
double * vertical = va_arg ( * list , double * ) ;
2008-10-31 10:42:47 -07:00
if ( priv )
{
2012-05-01 19:47:12 -07:00
if ( horizontal ) * horizontal = priv - > align . h ;
if ( vertical ) * vertical = priv - > align . v ;
2008-10-31 10:42:47 -07:00
}
else
{
2012-05-01 19:47:12 -07:00
if ( horizontal ) * horizontal = 0.5 ;
if ( vertical ) * vertical = 0.5 ;
2008-10-31 10:42:47 -07:00
}
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI void
2008-10-31 10:42:47 -07:00
evas_object_box_padding_set ( Evas_Object * o , Evas_Coord horizontal , Evas_Coord vertical )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_padding_set ( horizontal , vertical ) ) ;
}
static void
_box_padding_set ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Data * priv = _pd ;
Evas_Coord horizontal = va_arg ( * list , Evas_Coord ) ;
Evas_Coord vertical = va_arg ( * list , Evas_Coord ) ;
2008-10-31 10:42:47 -07:00
if ( priv - > pad . h = = horizontal & & priv - > pad . v = = vertical )
return ;
priv - > pad . h = horizontal ;
priv - > pad . v = vertical ;
2008-10-26 19:22:41 -07:00
evas_object_smart_changed ( o ) ;
}
2010-01-11 06:24:41 -08:00
EAPI void
2008-10-31 10:42:47 -07:00
evas_object_box_padding_get ( const Evas_Object * o , Evas_Coord * horizontal , Evas_Coord * vertical )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
eo_do ( ( Eo * ) o , evas_obj_box_padding_get ( horizontal , vertical ) ) ;
}
static void
_box_padding_get ( Eo * o EINA_UNUSED , void * _pd , va_list * list )
{
const Evas_Object_Box_Data * priv = _pd ;
Evas_Coord * horizontal = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * vertical = va_arg ( * list , Evas_Coord * ) ;
2008-10-31 10:42:47 -07:00
if ( priv )
{
2012-05-01 19:47:12 -07:00
if ( horizontal ) * horizontal = priv - > pad . h ;
if ( vertical ) * vertical = priv - > pad . v ;
2008-10-31 10:42:47 -07:00
}
else
{
2012-05-01 19:47:12 -07:00
if ( horizontal ) * horizontal = 0 ;
if ( vertical ) * vertical = 0 ;
2008-10-31 10:42:47 -07:00
}
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI Evas_Object_Box_Option *
2008-10-26 19:22:41 -07:00
evas_object_box_append ( Evas_Object * o , Evas_Object * child )
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * option = NULL ;
eo_do ( o , evas_obj_box_append ( child , & option ) ) ;
return option ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_append ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Option * opt = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Evas_Object_Box_Option * * option = va_arg ( * list , Evas_Object_Box_Option * * ) ;
if ( option ) * option = NULL ;
if ( ! child )
return ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_append ( child , & opt ) ) ;
2008-10-26 19:22:41 -07:00
if ( opt )
{
evas_object_smart_member_add ( child , o ) ;
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( option ) * option = _evas_object_box_option_callbacks_register ( o , priv , opt ) ;
return ;
2008-10-26 19:22:41 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Evas_Object_Box_Option *
2008-10-26 19:22:41 -07:00
evas_object_box_prepend ( Evas_Object * o , Evas_Object * child )
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * option = NULL ;
eo_do ( o , evas_obj_box_prepend ( child , & option ) ) ;
return option ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_prepend ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Option * opt = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Evas_Object_Box_Option * * option = va_arg ( * list , Evas_Object_Box_Option * * ) ;
if ( option ) * option = NULL ;
if ( ! child )
return ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_prepend ( child , & opt ) ) ;
2008-10-26 19:22:41 -07:00
if ( opt )
{
evas_object_smart_member_add ( child , o ) ;
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( option ) * option = _evas_object_box_option_callbacks_register ( o , priv , opt ) ;
return ;
2008-10-26 19:22:41 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Evas_Object_Box_Option *
2008-10-26 19:22:41 -07:00
evas_object_box_insert_before ( Evas_Object * o , Evas_Object * child , const Evas_Object * reference )
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * option = NULL ;
eo_do ( o , evas_obj_box_insert_before ( child , reference , & option ) ) ;
return option ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_insert_before ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Option * opt = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
const Evas_Object * reference = va_arg ( * list , const Evas_Object * ) ;
Evas_Object_Box_Option * * option = va_arg ( * list , Evas_Object_Box_Option * * ) ;
if ( option ) * option = NULL ;
if ( ! child )
return ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_insert_before ( child , reference , & opt ) ) ;
2008-10-26 19:22:41 -07:00
if ( opt )
{
evas_object_smart_member_add ( child , o ) ;
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( option ) * option = _evas_object_box_option_callbacks_register ( o , priv , opt ) ;
return ;
2008-10-26 19:22:41 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Evas_Object_Box_Option *
2009-10-02 12:06:12 -07:00
evas_object_box_insert_after ( Evas_Object * o , Evas_Object * child , const Evas_Object * reference )
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * option = NULL ;
eo_do ( o , evas_obj_box_insert_after ( child , reference , & option ) ) ;
return option ;
}
2009-10-02 12:06:12 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_insert_after ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Option * opt = NULL ;
2009-10-02 12:06:12 -07:00
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
const Evas_Object * reference = va_arg ( * list , const Evas_Object * ) ;
Evas_Object_Box_Option * * option = va_arg ( * list , Evas_Object_Box_Option * * ) ;
if ( option ) * option = NULL ;
if ( ! child )
return ;
2009-10-02 12:06:12 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_insert_after ( child , reference , & opt ) ) ;
2009-10-02 12:06:12 -07:00
if ( opt )
{
2012-05-01 19:47:12 -07:00
evas_object_smart_member_add ( child , o ) ;
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( option ) * option = _evas_object_box_option_callbacks_register ( o , priv , opt ) ;
return ;
2009-10-02 12:06:12 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Evas_Object_Box_Option *
2008-10-26 19:22:41 -07:00
evas_object_box_insert_at ( Evas_Object * o , Evas_Object * child , unsigned int pos )
{
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Option * option = NULL ;
eo_do ( o , evas_obj_box_insert_at ( child , pos , & option ) ) ;
return option ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_insert_at ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Option * opt = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
Evas_Object_Box_Data * priv = _pd ;
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
unsigned int pos = va_arg ( * list , unsigned int ) ;
Evas_Object_Box_Option * * option = va_arg ( * list , Evas_Object_Box_Option * * ) ;
if ( option ) * option = NULL ;
if ( ! child )
return ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_insert_at ( child , pos , & opt ) ) ;
2008-10-26 19:22:41 -07:00
if ( opt )
{
evas_object_smart_member_add ( child , o ) ;
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( option ) * option = _evas_object_box_option_callbacks_register ( o , priv , opt ) ;
return ;
2008-10-26 19:22:41 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2008-10-26 19:22:41 -07:00
evas_object_box_remove ( Evas_Object * o , Evas_Object * child )
{
2012-10-08 18:58:41 -07:00
Eina_Bool result = EINA_FALSE ;
eo_do ( o , evas_obj_box_remove ( child , & result ) ) ;
return result ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_remove ( Eo * o , void * _pd EINA_UNUSED , va_list * list )
{
Evas_Object * child = va_arg ( * list , Evas_Object * ) ;
Eina_Bool * result = va_arg ( * list , Eina_Bool * ) ;
if ( result ) * result = EINA_FALSE ;
Evas_Object * obj = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_remove ( child , & obj ) ) ;
2008-10-26 19:22:41 -07:00
if ( obj )
{
2013-06-17 19:34:31 -07:00
_evas_object_box_child_callbacks_unregister ( obj , o ) ;
2008-10-26 19:22:41 -07:00
evas_object_smart_member_del ( obj ) ;
2008-11-19 04:20:20 -08:00
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( result ) * result = EINA_TRUE ;
return ;
2008-10-26 19:22:41 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2008-10-26 19:22:41 -07:00
evas_object_box_remove_at ( Evas_Object * o , unsigned int pos )
{
2012-10-08 18:58:41 -07:00
Eina_Bool result = EINA_FALSE ;
eo_do ( o , evas_obj_box_remove_at ( pos , & result ) ) ;
return result ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_remove_at ( Eo * o , void * _pd EINA_UNUSED , va_list * list )
{
unsigned int pos = va_arg ( * list , unsigned int ) ;
Eina_Bool * result = va_arg ( * list , Eina_Bool * ) ;
if ( result ) * result = EINA_FALSE ;
Evas_Object * obj = NULL ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_remove_at ( pos , & obj ) ) ;
2008-10-26 19:22:41 -07:00
if ( obj )
{
2013-06-17 19:34:31 -07:00
_evas_object_box_child_callbacks_unregister ( obj , o ) ;
2008-10-26 19:22:41 -07:00
evas_object_smart_member_del ( obj ) ;
2008-11-19 04:20:20 -08:00
evas_object_smart_changed ( o ) ;
2012-10-08 18:58:41 -07:00
if ( result ) * result = EINA_TRUE ;
return ;
2008-10-26 19:22:41 -07:00
}
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2009-06-17 03:01:52 -07:00
evas_object_box_remove_all ( Evas_Object * o , Eina_Bool clear )
2008-11-22 18:01:38 -08:00
{
2012-10-08 18:58:41 -07:00
Eina_Bool result = EINA_FALSE ;
eo_do ( o , evas_obj_box_remove_all ( clear , & result ) ) ;
return result ;
}
2008-11-22 18:01:38 -08:00
2012-10-08 18:58:41 -07:00
static void
_box_remove_all ( Eo * o , void * _pd , va_list * list )
{
Evas_Object_Box_Data * priv = _pd ;
Eina_Bool clear = va_arg ( * list , int ) ;
Eina_Bool * result = va_arg ( * list , Eina_Bool * ) ;
if ( result ) * result = EINA_FALSE ;
2008-11-22 18:01:38 -08:00
2009-04-26 19:41:27 -07:00
evas_object_smart_changed ( o ) ;
2008-11-22 18:01:38 -08:00
while ( priv - > children )
{
Evas_Object_Box_Option * opt = priv - > children - > data ;
2012-10-08 18:58:41 -07:00
Evas_Object * obj = NULL ;
2008-11-22 18:01:38 -08:00
2012-10-08 18:58:41 -07:00
eo_do ( o , evas_obj_box_internal_remove ( opt - > obj , & obj ) ) ;
2008-11-22 18:01:38 -08:00
if ( obj )
{
2013-06-17 19:34:31 -07:00
_evas_object_box_child_callbacks_unregister ( obj , o ) ;
2008-11-22 18:01:38 -08:00
evas_object_smart_member_del ( obj ) ;
if ( clear )
evas_object_del ( obj ) ;
}
2012-10-08 18:58:41 -07:00
else return ;
2008-11-22 18:01:38 -08:00
}
2012-10-08 18:58:41 -07:00
if ( result ) * result = EINA_TRUE ;
2008-11-22 18:01:38 -08:00
}
2008-12-17 18:39:09 -08:00
2010-01-11 06:24:41 -08:00
EAPI Eina_Iterator *
2008-12-17 18:39:09 -08:00
evas_object_box_iterator_new ( const Evas_Object * o )
{
2012-10-08 18:58:41 -07:00
Eina_Iterator * itr = NULL ;
eo_do ( ( Eo * ) o , evas_obj_box_iterator_new ( & itr ) ) ;
return itr ;
}
2008-12-17 18:39:09 -08:00
2012-10-08 18:58:41 -07:00
static void
_box_iterator_new ( Eo * o , void * _pd , va_list * list )
{
const Evas_Object_Box_Data * priv = _pd ;
Eina_Iterator * * itr_ret = va_arg ( * list , Eina_Iterator * * ) ;
Evas_Object_Box_Iterator * it ;
* itr_ret = NULL ;
2008-12-17 18:39:09 -08:00
2012-10-08 18:58:41 -07:00
if ( ! priv - > children ) return ;
2008-12-17 18:39:09 -08:00
it = calloc ( 1 , sizeof ( Evas_Object_Box_Iterator ) ) ;
2012-10-08 18:58:41 -07:00
if ( ! it ) return ;
2008-12-17 18:39:09 -08:00
EINA_MAGIC_SET ( & it - > iterator , EINA_MAGIC_ITERATOR ) ;
it - > real_iterator = eina_list_iterator_new ( priv - > children ) ;
it - > box = o ;
it - > iterator . next = FUNC_ITERATOR_NEXT ( _evas_object_box_iterator_next ) ;
it - > iterator . get_container = FUNC_ITERATOR_GET_CONTAINER ( _evas_object_box_iterator_get_container ) ;
it - > iterator . free = FUNC_ITERATOR_FREE ( _evas_object_box_iterator_free ) ;
2012-10-08 18:58:41 -07:00
* itr_ret = & it - > iterator ;
2008-12-17 18:39:09 -08:00
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Accessor *
2008-12-17 18:39:09 -08:00
evas_object_box_accessor_new ( const Evas_Object * o )
{
2012-10-08 18:58:41 -07:00
Eina_Accessor * accessor = NULL ;
eo_do ( ( Eo * ) o , evas_obj_box_accessor_new ( & accessor ) ) ;
return accessor ;
}
2008-12-17 18:39:09 -08:00
2012-10-08 18:58:41 -07:00
static void
_box_accessor_new ( Eo * o , void * _pd , va_list * list )
{
const Evas_Object_Box_Data * priv = _pd ;
2008-12-17 18:39:09 -08:00
2012-10-08 18:58:41 -07:00
Eina_Accessor * * accessor = va_arg ( * list , Eina_Accessor * * ) ;
* accessor = NULL ;
Evas_Object_Box_Accessor * it ;
2008-12-17 18:39:09 -08:00
2012-10-08 18:58:41 -07:00
if ( ! priv - > children ) return ;
2008-12-17 18:39:09 -08:00
it = calloc ( 1 , sizeof ( Evas_Object_Box_Accessor ) ) ;
2012-10-08 18:58:41 -07:00
if ( ! it ) return ;
2008-12-17 18:39:09 -08:00
EINA_MAGIC_SET ( & it - > accessor , EINA_MAGIC_ACCESSOR ) ;
it - > real_accessor = eina_list_accessor_new ( priv - > children ) ;
it - > box = o ;
it - > accessor . get_at = FUNC_ACCESSOR_GET_AT ( _evas_object_box_accessor_get_at ) ;
it - > accessor . get_container = FUNC_ACCESSOR_GET_CONTAINER ( _evas_object_box_accessor_get_container ) ;
it - > accessor . free = FUNC_ACCESSOR_FREE ( _evas_object_box_accessor_free ) ;
2012-10-08 18:58:41 -07:00
* accessor = & it - > accessor ;
2008-12-17 18:39:09 -08:00
}
2010-01-11 06:24:41 -08:00
EAPI Eina_List *
2008-12-17 18:39:09 -08:00
evas_object_box_children_get ( const Evas_Object * o )
{
Eina_List * new_list = NULL , * l ;
Evas_Object_Box_Option * opt ;
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL ( o , priv , NULL ) ;
EINA_LIST_FOREACH ( priv - > children , l , opt )
new_list = eina_list_append ( new_list , opt - > obj ) ;
return new_list ;
}
2010-01-11 06:24:41 -08:00
EAPI const char *
2012-05-22 01:48:03 -07:00
evas_object_box_option_property_name_get ( const Evas_Object * o , int property )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
const char * name = NULL ;
eo_do ( ( Eo * ) o , evas_obj_box_option_property_name_get ( property , & name ) ) ;
return name ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_option_property_name_get ( Eo * o EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
{
va_arg ( * list , int ) ;
const char * * name = va_arg ( * list , const char * * ) ;
* name = NULL ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI int
2012-05-22 01:48:03 -07:00
evas_object_box_option_property_id_get ( const Evas_Object * o , const char * name )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
int id = 0 ;
eo_do ( ( Eo * ) o , evas_obj_box_option_property_id_get ( name , & id ) ) ;
return id ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_box_option_property_id_get ( Eo * o EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
{
const char * name = va_arg ( * list , const char * ) ;
int * id = va_arg ( * list , int * ) ;
* id = - 1 ;
2009-09-23 10:15:18 -07:00
2008-10-26 19:22:41 -07:00
if ( ! name )
2012-10-08 18:58:41 -07:00
return ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2008-10-26 19:22:41 -07:00
evas_object_box_option_property_set ( Evas_Object * o , Evas_Object_Box_Option * opt , int property , . . . )
{
2009-06-17 03:01:52 -07:00
Eina_Bool ret ;
2008-10-26 19:22:41 -07:00
va_list args ;
va_start ( args , property ) ;
ret = evas_object_box_option_property_vset ( o , opt , property , args ) ;
va_end ( args ) ;
return ret ;
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2008-10-26 19:22:41 -07:00
evas_object_box_option_property_vset ( Evas_Object * o , Evas_Object_Box_Option * opt , int property , va_list args )
{
2012-10-08 18:58:41 -07:00
Eina_Bool ret = EINA_FALSE ;
2013-01-15 09:15:10 -08:00
eo_do ( o , evas_obj_box_option_property_vset ( opt , property , ( va_list * ) & args , & ret ) ) ;
2012-10-08 18:58:41 -07:00
return ret ;
}
2008-11-19 04:20:20 -08:00
2012-10-08 18:58:41 -07:00
static void
_box_option_property_vset ( Eo * o EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
{
va_arg ( * list , Evas_Object_Box_Option * ) ;
va_arg ( * list , int ) ;
2012-10-08 23:34:49 -07:00
va_arg ( * list , va_list * ) ;
2012-10-08 18:58:41 -07:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
if ( ret ) * ret = EINA_FALSE ;
2008-10-26 19:22:41 -07:00
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2012-05-22 01:48:03 -07:00
evas_object_box_option_property_get ( const Evas_Object * o , Evas_Object_Box_Option * opt , int property , . . . )
2008-10-26 19:22:41 -07:00
{
2009-06-17 03:01:52 -07:00
Eina_Bool ret ;
2008-10-26 19:22:41 -07:00
va_list args ;
va_start ( args , property ) ;
ret = evas_object_box_option_property_vget ( o , opt , property , args ) ;
va_end ( args ) ;
return ret ;
}
2010-01-11 06:24:41 -08:00
EAPI Eina_Bool
2012-05-22 01:48:03 -07:00
evas_object_box_option_property_vget ( const Evas_Object * o , Evas_Object_Box_Option * opt , int property , va_list args )
2008-10-26 19:22:41 -07:00
{
2012-10-08 18:58:41 -07:00
Eina_Bool ret = EINA_FALSE ;
2013-01-15 09:15:10 -08:00
eo_do ( ( Eo * ) o , evas_obj_box_option_property_vget ( opt , property , ( va_list * ) & args , & ret ) ) ;
2012-10-08 18:58:41 -07:00
return ret ;
}
static void
_box_option_property_vget ( Eo * o EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
{
va_arg ( * list , Evas_Object_Box_Option * ) ;
va_arg ( * list , int ) ;
2012-10-08 23:34:49 -07:00
va_arg ( * list , va_list * ) ;
2012-10-08 18:58:41 -07:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
* ret = EINA_FALSE ;
}
static void
_smart_data_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
void * * data = va_arg ( * list , void * * ) ;
* data = ( void * ) _pd ;
}
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
static void
_class_constructor ( Eo_Class * klass )
{
const Eo_Op_Func_Description func_desc [ ] = {
EO_OP_FUNC ( EO_BASE_ID ( EO_BASE_SUB_ID_CONSTRUCTOR ) , _constructor ) ,
EO_OP_FUNC ( EVAS_OBJ_ID ( EVAS_OBJ_SUB_ID_SMART_DATA_GET ) , _smart_data_get ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_ADD ) , _smart_add ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_DEL ) , _smart_del ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_RESIZE ) , _smart_resize ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_CALCULATE ) , _smart_calculate ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_APPEND ) , _evas_object_box_append_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_PREPEND ) , _evas_object_box_prepend_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_INSERT_BEFORE ) , _evas_object_box_insert_before_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_INSERT_AFTER ) , _evas_object_box_insert_after_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_INSERT_AT ) , _evas_object_box_insert_at_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_REMOVE ) , _evas_object_box_remove_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_REMOVE_AT ) , _evas_object_box_remove_at_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_OPTION_NEW ) , _evas_object_box_option_new_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_OPTION_FREE ) , _evas_object_box_option_free_default ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_ADD_TO ) , _box_add_to ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_SET ) , _box_layout_set ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HORIZONTAL ) , _box_layout_horizontal ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_VERTICAL ) , _box_layout_vertical ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_HORIZONTAL ) , _box_layout_homogeneous_horizontal ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_VERTICAL ) , _box_layout_homogeneous_vertical ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_MAX_SIZE_HORIZONTAL ) , _box_layout_homogeneous_max_size_horizontal ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_MAX_SIZE_VERTICAL ) , _box_layout_homogeneous_max_size_vertical ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_FLOW_HORIZONTAL ) , _box_layout_flow_horizontal ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_FLOW_VERTICAL ) , _box_layout_flow_vertical ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_STACK ) , _box_layout_stack ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_ALIGN_SET ) , _box_align_set ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_ALIGN_GET ) , _box_align_get ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_PADDING_SET ) , _box_padding_set ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_PADDING_GET ) , _box_padding_get ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_APPEND ) , _box_append ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_PREPEND ) , _box_prepend ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INSERT_BEFORE ) , _box_insert_before ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INSERT_AFTER ) , _box_insert_after ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_INSERT_AT ) , _box_insert_at ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_REMOVE ) , _box_remove ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_REMOVE_AT ) , _box_remove_at ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_REMOVE_ALL ) , _box_remove_all ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_ITERATOR_NEW ) , _box_iterator_new ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_ACCESSOR_NEW ) , _box_accessor_new ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_NAME_GET ) , _box_option_property_name_get ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_ID_GET ) , _box_option_property_id_get ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_VSET ) , _box_option_property_vset ) ,
EO_OP_FUNC ( EVAS_OBJ_BOX_ID ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_VGET ) , _box_option_property_vget ) ,
EO_OP_FUNC_SENTINEL
} ;
eo_class_funcs_set ( klass , func_desc ) ;
2013-02-09 23:52:17 -08:00
evas_smart_legacy_type_register ( MY_CLASS_NAME , klass ) ;
2012-10-08 18:58:41 -07:00
}
static const Eo_Op_Description op_desc [ ] = {
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_APPEND , " Append a new child object to the given box object. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_PREPEND , " Prepend a new child object to the given box object. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_INSERT_BEFORE , " Insert a new child object before another existing one Can be overrided.. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_INSERT_AFTER , " Insert a new child object after another existing one. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_INSERT_AT , " Insert a new child object at a given position. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_REMOVE , " Remove a given object from a box object, unparenting it again. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_REMOVE_AT , " Remove an object, bound to a given position in a box object. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_OPTION_NEW , " Create a new box option. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INTERNAL_OPTION_FREE , " Free a box option. Can be overrided. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_ADD_TO , " Add a new box as a child of a given smart object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_SET , " Set a new layouting function to a given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HORIZONTAL , " Layout function which sets the box to a (basic) horizontal box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_VERTICAL , " Layout function which sets the box to a (basic) vertical box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_HORIZONTAL , " Layout function which sets the box to a homogeneous horizontal box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_VERTICAL , " Layout function which sets the box to a homogeneous vertical box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_MAX_SIZE_HORIZONTAL , " Layout function which sets the box to a maximum size, homogeneous horizontal box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_HOMOGENEOUS_MAX_SIZE_VERTICAL , " Layout function which sets the box to a maximum size, homogeneous vertical box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_FLOW_HORIZONTAL , " Layout function which sets the box to a flow horizontal box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_FLOW_VERTICAL , " Layout function which sets the box to a flow vertical box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_LAYOUT_STACK , " Layout function which sets the box to a stacking box. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_ALIGN_SET , " Set the alignment of the whole bounding box of contents. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_ALIGN_GET , " Get the alignment of the whole bounding box of contents. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_PADDING_SET , " Set the (space) padding between cells set for a given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_PADDING_GET , " Get the (space) padding between cells set for a given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_APPEND , " Append a new child object to the given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_PREPEND , " Prepend a new child object to the given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INSERT_BEFORE , " Insert a new child object before another existing one. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INSERT_AFTER , " Insert a new child object after another existing one. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_INSERT_AT , " Insert a new child object at a given position. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_REMOVE , " Remove a given object from a box object, unparenting it again. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_REMOVE_AT , " Remove an object, bound to a given position in a box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_REMOVE_ALL , " Remove all child objects from a box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_ITERATOR_NEW , " Get an iterator to walk the list of children of a given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_ACCESSOR_NEW , " Get an accessor (a structure providing random items access) to the list of children of a given box object. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_NAME_GET , " Get the name of the property of the child elements of the box with specific id. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_ID_GET , " Get the numerical identifier of the property of the child elements of the box which have a specific name. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_VSET , " Set a property value (by its given numerical identifier), on a given box child element. " ) ,
EO_OP_DESCRIPTION ( EVAS_OBJ_BOX_SUB_ID_OPTION_PROPERTY_VGET , " Get a property's value (by its given numerical identifier), on a given box child element. " ) ,
EO_OP_DESCRIPTION_SENTINEL
} ;
2009-09-23 10:15:18 -07:00
2012-10-08 18:58:41 -07:00
static const Eo_Class_Description class_desc = {
EO_VERSION ,
2013-02-09 23:52:17 -08:00
MY_CLASS_NAME ,
2012-10-08 18:58:41 -07:00
EO_CLASS_TYPE_REGULAR ,
EO_CLASS_DESCRIPTION_OPS ( & EVAS_OBJ_BOX_BASE_ID , op_desc , EVAS_OBJ_BOX_SUB_ID_LAST ) ,
NULL ,
sizeof ( Evas_Object_Box_Data ) ,
_class_constructor ,
NULL
} ;
2008-10-26 19:22:41 -07:00
2012-10-08 18:58:41 -07:00
EO_DEFINE_CLASS ( evas_object_box_class_get , & class_desc , EVAS_OBJ_SMART_CLIPPED_CLASS , NULL ) ;
2008-10-26 19:22:41 -07:00