gustavo's size hint patch.

SVN revision: 34248
This commit is contained in:
Carsten Haitzler 2008-04-11 23:12:20 +00:00
parent a86946850d
commit 27f1963fcb
4 changed files with 285 additions and 1 deletions

View File

@ -51,7 +51,8 @@ typedef enum _Evas_Callback_Type
EVAS_CALLBACK_RESIZE, /**< Resize Event */
EVAS_CALLBACK_RESTACK, /**< Restack Event */
EVAS_CALLBACK_DEL, /**< Object Being Deleted (called before Free) */
EVAS_CALLBACK_HOLD /**< Events go on/off hold */
EVAS_CALLBACK_HOLD, /**< Events go on/off hold */
EVAS_CALLBACK_CHANGED_SIZE_HINTS /**< Size hints changed event */
} Evas_Callback_Type; /**< The type of event to trigger the callback */
typedef enum _Evas_Button_Flags
@ -700,6 +701,13 @@ extern "C" {
EAPI void evas_object_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI void evas_object_geometry_get (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
EAPI void evas_object_size_hint_min_get (const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
EAPI void evas_object_size_hint_min_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI void evas_object_size_hint_max_get (const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
EAPI void evas_object_size_hint_max_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI void evas_object_size_hint_request_get (const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
EAPI void evas_object_size_hint_request_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI void evas_object_show (Evas_Object *obj);
EAPI void evas_object_hide (Evas_Object *obj);
EAPI Evas_Bool evas_object_visible_get (const Evas_Object *obj);

View File

@ -32,3 +32,9 @@ evas_object_inform_call_restack(Evas_Object *obj)
{
evas_object_event_callback_call(obj, EVAS_CALLBACK_RESTACK, NULL);
}
void
evas_object_inform_call_changed_size_hints(Evas_Object *obj)
{
evas_object_event_callback_call(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, NULL);
}

View File

@ -670,6 +670,243 @@ evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, E
if (h) *h = obj->cur.geometry.h;
}
/**
* @defgroup Evas_Object_Size_Hints_Group Generic Object Size Hints Functions
*
* Functions that deals with hints about object size.
*/
/**
* Retrieves the size hint for the minimum size.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* Note that if any of @p w or @p h are @c NULL, the @c NULL
* parameters are ignored.
*
* @param obj The given evas object.
* @param w Pointer to an integer in which to store the minimum width.
* @param h Pointer to an integer in which to store the minimum height.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
if (obj->delete_me)
{
if (w) *w = 0; if (h) *h = 0;
return;
}
if (w) *w = obj->size_hints.min.w;
if (h) *h = obj->size_hints.min.h;
}
/**
* Sets the size hint for the minimum size.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* @param obj The given evas object.
* @param w Integer to use as the minimum width hint.
* @param h Integer to use as the minimum height hint.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
if (obj->delete_me)
return;
obj->size_hints.min.w = w;
obj->size_hints.min.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
/**
* Retrieves the size hint for the maximum size.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* Note that if any of @p w or @p h are @c NULL, the @c NULL
* parameters are ignored.
*
* @param obj The given evas object.
* @param w Pointer to an integer in which to store the maximum width.
* @param h Pointer to an integer in which to store the maximum height.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
if (obj->delete_me)
{
if (w) *w = 0; if (h) *h = 0;
return;
}
if (w) *w = obj->size_hints.max.w;
if (h) *h = obj->size_hints.max.h;
}
/**
* Sets the size hint for the maximum size.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* @param obj The given evas object.
* @param w Integer to use as the maximum width hint.
* @param h Integer to use as the maximum height hint.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
if (obj->delete_me)
return;
obj->size_hints.max.w = w;
obj->size_hints.max.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
/**
* Retrieves the size request hint.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* Note that if any of @p w or @p h are @c NULL, the @c NULL
* parameters are ignored.
*
* @param obj The given evas object.
* @param w Pointer to an integer in which to store the requested width.
* @param h Pointer to an integer in which to store the requested height.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
if (obj->delete_me)
{
if (w) *w = 0; if (h) *h = 0;
return;
}
if (w) *w = obj->size_hints.request.w;
if (h) *h = obj->size_hints.request.h;
}
/**
* Sets the requested size hint.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* @param obj The given evas object.
* @param w Integer to use as the preferred width hint.
* @param h Integer to use as the preferred height hint.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
if (obj->delete_me)
return;
obj->size_hints.request.w = w;
obj->size_hints.request.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
/**
* Retrieves the size aspect control hint.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* Note that if any of @p aspect, @p w or @p h are @c NULL, the @c NULL
* parameters are ignored.
*
* @param obj The given evas object.
* @param aspect Returns the hint on how size should be calculated.
* @param w Pointer to an integer in which to store the aspect width.
* @param h Pointer to an integer in which to store the aspect height.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
if (obj->delete_me)
{
if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
if (w) *w = 0; if (h) *h = 0;
return;
}
if (aspect) *aspect = obj->size_hints.aspect.mode;
if (w) *w = obj->size_hints.aspect.size.w;
if (h) *h = obj->size_hints.aspect.size.h;
}
/**
* Sets the size aspect control hint.
*
* This is not a size enforcement in any way, it's just a hint that should
* be used whenever appropriate.
*
* @param obj The given evas object.
* @param aspect Hint on how to calculate size.
* @param w Integer to use as aspect width hint.
* @param h Integer to use as aspect height hint.
* @ingroup Evas_Object_Size_Hints_Group
*/
EAPI void
evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
{
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
if (obj->delete_me)
return;
obj->size_hints.aspect.mode = aspect;
obj->size_hints.aspect.size.w = w;
obj->size_hints.aspect.size.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
/**
* @defgroup Evas_Object_Visibility_Group Generic Object Visibility Functions
*

View File

@ -81,6 +81,10 @@ struct _Evas_Module_Engine
#define RENDER_METHOD_INVALID 0x00000000
typedef struct _Evas_Layer Evas_Layer;
typedef struct _Evas_Size Evas_Size;
typedef enum _Evas_Aspect_Control Evas_Aspect_Control;
typedef struct _Evas_Aspect Evas_Aspect;
typedef struct _Evas_Size_Hints Evas_Size_Hints;
typedef struct _Evas_Font_Dir Evas_Font_Dir;
typedef struct _Evas_Font Evas_Font;
typedef struct _Evas_Font_Alias Evas_Font_Alias;
@ -368,6 +372,32 @@ struct _Evas_Layer
unsigned char delete_me : 1;
};
struct _Evas_Size
{
Evas_Coord w, h;
};
enum _Evas_Aspect_Control
{
EVAS_ASPECT_CONTROL_NONE = 0,
EVAS_ASPECT_CONTROL_NEITHER = 1,
EVAS_ASPECT_CONTROL_HORIZONTAL = 2,
EVAS_ASPECT_CONTROL_VERTICAL = 3,
EVAS_ASPECT_CONTROL_BOTH = 4
};
struct _Evas_Aspect
{
Evas_Aspect_Control mode;
Evas_Size size;
};
struct _Evas_Size_Hints
{
Evas_Size min, max, request;
Evas_Aspect aspect;
};
struct _Evas_Object
{
Evas_Object_List _list_data;
@ -440,6 +470,8 @@ struct _Evas_Object
unsigned char deletions_waiting : 1;
} smart;
Evas_Size_Hints size_hints;
int last_mouse_down_counter;
int last_mouse_up_counter;
int mouse_grabbed;
@ -727,6 +759,7 @@ void evas_object_inform_call_hide(Evas_Object *obj);
void evas_object_inform_call_move(Evas_Object *obj);
void evas_object_inform_call_resize(Evas_Object *obj);
void evas_object_inform_call_restack(Evas_Object *obj);
void evas_object_inform_call_changed_size_hints(Evas_Object *obj);
void evas_object_intercept_cleanup(Evas_Object *obj);
int evas_object_intercept_call_show(Evas_Object *obj);
int evas_object_intercept_call_hide(Evas_Object *obj);