Elementary: Popup header split.

This commit is contained in:
Daniel Zaoui 2013-04-28 09:16:15 +03:00
parent 04855de17b
commit db80ddcf98
4 changed files with 303 additions and 296 deletions

View File

@ -107,299 +107,10 @@
* @li @ref popup_example_03_c
*/
#define ELM_OBJ_POPUP_CLASS elm_obj_popup_class_get()
const Eo_Class *elm_obj_popup_class_get(void) EINA_CONST;
extern EAPI Eo_Op ELM_OBJ_POPUP_BASE_ID;
enum
{
ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_SET,
ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_GET,
ELM_OBJ_POPUP_SUB_ID_ORIENT_SET,
ELM_OBJ_POPUP_SUB_ID_ORIENT_GET,
ELM_OBJ_POPUP_SUB_ID_TIMEOUT_SET,
ELM_OBJ_POPUP_SUB_ID_TIMEOUT_GET,
ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET,
ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET,
ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND,
ELM_OBJ_POPUP_SUB_ID_LAST
};
#define ELM_OBJ_POPUP_ID(sub_id) (ELM_OBJ_POPUP_BASE_ID + sub_id)
/**
* @def elm_obj_popup_content_text_wrap_type_set
* @since 1.8
*
* @brief Sets the wrapping type of content text packed in content
*
* @param[in] wrap
*
* @see elm_popup_content_text_wrap_type_set
*/
#define elm_obj_popup_content_text_wrap_type_set(wrap) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_SET), EO_TYPECHECK(Elm_Wrap_Type, wrap)
/**
* @def elm_obj_popup_content_text_wrap_type_get
* @since 1.8
*
* @brief Returns the wrapping type of content text packed in content area of
* area of popup object.
*
* @param[out] ret
*
* @see elm_popup_content_text_wrap_type_get
*/
#define elm_obj_popup_content_text_wrap_type_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_GET), EO_TYPECHECK(Elm_Wrap_Type *, ret)
/**
* @def elm_obj_popup_orient_set
* @since 1.8
*
* @brief Sets the orientation of the popup in the parent region
*
* @param[in] orient
*
* @see elm_popup_orient_set
*/
#define elm_obj_popup_orient_set(orient) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ORIENT_SET), EO_TYPECHECK(Elm_Popup_Orient, orient)
/**
* @def elm_obj_popup_orient_get
* @since 1.8
*
* @brief Returns the orientation of Popup
*
* @param[out] ret
*
* @see elm_popup_orient_get
*/
#define elm_obj_popup_orient_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ORIENT_GET), EO_TYPECHECK(Elm_Popup_Orient *, ret)
/**
* @def elm_obj_popup_timeout_set
* @since 1.8
*
* @brief Sets a timeout to hide popup automatically
*
* @param[in] timeout
*
* @see elm_popup_timeout_set
*/
#define elm_obj_popup_timeout_set(timeout) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_SET), EO_TYPECHECK(double, timeout)
/**
* @def elm_obj_popup_timeout_get
* @since 1.8
*
* @brief Returns the timeout value set to the popup (in seconds)
*
* @param[out] ret
*
* @see elm_popup_timeout_get
*/
#define elm_obj_popup_timeout_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_GET), EO_TYPECHECK(double *, ret)
/**
* @def elm_obj_popup_allow_events_set
* @since 1.8
*
* @brief Sets whether events should be passed to by a click outside.
*
* @param[in] allow
*
* @see elm_popup_allow_events_set
*/
#define elm_obj_popup_allow_events_set(allow) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET), EO_TYPECHECK(Eina_Bool, allow)
/**
* @def elm_obj_popup_allow_events_get
* @since 1.8
*
* @brief Returns value indicating whether allow event is enabled or not
*
* @param[out] ret
*
* @see elm_popup_allow_events_get
*/
#define elm_obj_popup_allow_events_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET), EO_TYPECHECK(Eina_Bool *, ret)
/**
* @def elm_obj_popup_item_append
* @since 1.8
*
* @brief Add a new item to a Popup object
*
* @param[in] label
* @param[in] icon
* @param[in] func
* @param[in] data
* @param[out] ret
*
* @see elm_popup_item_append
*/
#define elm_obj_popup_item_append(label, icon, func, data, ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), EO_TYPECHECK(const char *, label), EO_TYPECHECK(Evas_Object *, icon), EO_TYPECHECK(Evas_Smart_Cb, func), EO_TYPECHECK(const void *, data), EO_TYPECHECK(Elm_Object_Item **, ret)
/**
* @brief Possible orient values for popup.
*
* These values should be used in conjunction to elm_popup_orient_set() to
* set the position in which the popup should appear(relative to its parent)
* and in conjunction with elm_popup_orient_get() to know where the popup
* is appearing.
*
* @ingroup Popup
*/
typedef enum
{
ELM_POPUP_ORIENT_TOP = 0, /**< Popup should appear in the top of parent, default */
ELM_POPUP_ORIENT_CENTER, /**< Popup should appear in the center of parent */
ELM_POPUP_ORIENT_BOTTOM, /**< Popup should appear in the bottom of parent */
ELM_POPUP_ORIENT_LEFT, /**< Popup should appear in the left of parent */
ELM_POPUP_ORIENT_RIGHT, /**< Popup should appear in the right of parent */
ELM_POPUP_ORIENT_TOP_LEFT, /**< Popup should appear in the top left of parent */
ELM_POPUP_ORIENT_TOP_RIGHT, /**< Popup should appear in the top right of parent */
ELM_POPUP_ORIENT_BOTTOM_LEFT, /**< Popup should appear in the bottom left of parent */
ELM_POPUP_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */
ELM_POPUP_ORIENT_LAST /**< Sentinel value, @b don't use */
} Elm_Popup_Orient;
/**
* @brief Adds a new Popup to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Popup
*/
EAPI Evas_Object *elm_popup_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
/**
* @brief Add a new item to a Popup object
*
* Both an item list and a content could not be set at the same time!
* once you add an item, the previous content will be removed.
*
* @param obj popup object
* @param icon Icon to be set on new item
* @param label The Label of the new item
* @param func Convenience function called when item selected
* @param data Data passed to @p func above
* @return A handle to the item added or @c NULL, on errors
*
* @ingroup Popup
* @warning When the first item is appended to popup object, any previous content
* of the content area is deleted. At a time, only one of content, content-text
* and item(s) can be there in a popup content area.
*/
EAPI Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
/**
* @brief Sets the wrapping type of content text packed in content
* area of popup object.
*
* @param obj The Popup object
* @param wrap wrapping type of type Elm_Wrap_Type
*
* @ingroup Popup
* @see elm_popup_content_text_wrap_type_get()
*/
EAPI void elm_popup_content_text_wrap_type_set(Evas_Object *obj, Elm_Wrap_Type wrap) EINA_ARG_NONNULL(1);
/**
* @brief Returns the wrapping type of content text packed in content area of
* popup object.
*
* @param obj The Popup object
* @return wrap type of the content text
*
* @ingroup Popup
* @see elm_popup_content_text_wrap_type_set
*/
EAPI Elm_Wrap_Type elm_popup_content_text_wrap_type_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets the orientation of the popup in the parent region
*
* @param obj The popup object
* @param orient the orientation of the popup
*
* Sets the position in which popup will appear in its parent
*
* @ingroup Popup
* @see @ref Elm_Popup_Orient for possible values.
*/
EAPI void elm_popup_orient_set(Evas_Object *obj, Elm_Popup_Orient orient) EINA_ARG_NONNULL(1);
/**
* @brief Returns the orientation of Popup
*
* @param obj The popup object
* @return the orientation of the popup
*
* @ingroup Popup
* @see elm_popup_orient_set()
* @see Elm_Popup_Orient
*/
EAPI Elm_Popup_Orient elm_popup_orient_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets a timeout to hide popup automatically
*
* @param obj The popup object
* @param timeout The timeout in seconds
*
* This function sets a timeout and starts the timer controlling when the
* popup is hidden. Since calling evas_object_show() on a popup restarts
* the timer controlling when it is hidden, setting this before the
* popup is shown will in effect mean starting the timer when the popup is
* shown. Smart signal "timeout" is called afterwards which can be handled
* if needed.
*
* @note Set a value <= 0.0 to disable a running timer.
*
* @note If the value > 0.0 and the popup is previously visible, the
* timer will be started with this value, canceling any running timer.
* @ingroup Popup
*/
EAPI void elm_popup_timeout_set(Evas_Object *obj, double timeout) EINA_ARG_NONNULL(1);
/**
* @brief Returns the timeout value set to the popup (in seconds)
*
* @param obj The popup object
* @return the timeout value
*
* @ingroup Popup
* @see elm_popup_timeout_set()
*/
EAPI double elm_popup_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets whether events should be passed to by a click outside.
*
* @param obj The popup object
* @param allow EINA_TRUE Events are passed to lower objects, else not
*
* Enabling allow event will remove the Blocked event area and events will
* pass to the lower layer objects otherwise they are blocked.
*
* @ingroup Popup
* @see elm_popup_allow_events_get()
* @note The default value is EINA_FALSE.
*/
EAPI void elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow);
/**
* @brief Returns value indicating whether allow event is enabled or not
*
* @param obj The popup object
* @return EINA_FALSE if Blocked event area is present else EINA_TRUE
*
* @ingroup Popup
* @see elm_popup_allow_events_set()
* @note By default the Blocked event area is present
*/
EAPI Eina_Bool elm_popup_allow_events_get(const Evas_Object *obj);
#include "elc_popup_common.h"
#ifdef EFL_EO_API_SUPPORT
#include "elc_popup_eo.h"
#endif
#ifndef EFL_NOLEGACY_API_SUPPORT
#include "elc_popup_legacy.h"
#endif

View File

@ -0,0 +1,24 @@
/**
* @brief Possible orient values for popup.
*
* These values should be used in conjunction to elm_popup_orient_set() to
* set the position in which the popup should appear(relative to its parent)
* and in conjunction with elm_popup_orient_get() to know where the popup
* is appearing.
*
* @ingroup Popup
*/
typedef enum
{
ELM_POPUP_ORIENT_TOP = 0, /**< Popup should appear in the top of parent, default */
ELM_POPUP_ORIENT_CENTER, /**< Popup should appear in the center of parent */
ELM_POPUP_ORIENT_BOTTOM, /**< Popup should appear in the bottom of parent */
ELM_POPUP_ORIENT_LEFT, /**< Popup should appear in the left of parent */
ELM_POPUP_ORIENT_RIGHT, /**< Popup should appear in the right of parent */
ELM_POPUP_ORIENT_TOP_LEFT, /**< Popup should appear in the top left of parent */
ELM_POPUP_ORIENT_TOP_RIGHT, /**< Popup should appear in the top right of parent */
ELM_POPUP_ORIENT_BOTTOM_LEFT, /**< Popup should appear in the bottom left of parent */
ELM_POPUP_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */
ELM_POPUP_ORIENT_LAST /**< Sentinel value, @b don't use */
} Elm_Popup_Orient;

View File

@ -0,0 +1,135 @@
#define ELM_OBJ_POPUP_CLASS elm_obj_popup_class_get()
const Eo_Class *elm_obj_popup_class_get(void) EINA_CONST;
extern EAPI Eo_Op ELM_OBJ_POPUP_BASE_ID;
enum
{
ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_SET,
ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_GET,
ELM_OBJ_POPUP_SUB_ID_ORIENT_SET,
ELM_OBJ_POPUP_SUB_ID_ORIENT_GET,
ELM_OBJ_POPUP_SUB_ID_TIMEOUT_SET,
ELM_OBJ_POPUP_SUB_ID_TIMEOUT_GET,
ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET,
ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET,
ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND,
ELM_OBJ_POPUP_SUB_ID_LAST
};
#define ELM_OBJ_POPUP_ID(sub_id) (ELM_OBJ_POPUP_BASE_ID + sub_id)
/**
* @def elm_obj_popup_content_text_wrap_type_set
* @since 1.8
*
* @brief Sets the wrapping type of content text packed in content
*
* @param[in] wrap
*
* @see elm_popup_content_text_wrap_type_set
*/
#define elm_obj_popup_content_text_wrap_type_set(wrap) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_SET), EO_TYPECHECK(Elm_Wrap_Type, wrap)
/**
* @def elm_obj_popup_content_text_wrap_type_get
* @since 1.8
*
* @brief Returns the wrapping type of content text packed in content area of
* area of popup object.
*
* @param[out] ret
*
* @see elm_popup_content_text_wrap_type_get
*/
#define elm_obj_popup_content_text_wrap_type_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_GET), EO_TYPECHECK(Elm_Wrap_Type *, ret)
/**
* @def elm_obj_popup_orient_set
* @since 1.8
*
* @brief Sets the orientation of the popup in the parent region
*
* @param[in] orient
*
* @see elm_popup_orient_set
*/
#define elm_obj_popup_orient_set(orient) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ORIENT_SET), EO_TYPECHECK(Elm_Popup_Orient, orient)
/**
* @def elm_obj_popup_orient_get
* @since 1.8
*
* @brief Returns the orientation of Popup
*
* @param[out] ret
*
* @see elm_popup_orient_get
*/
#define elm_obj_popup_orient_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ORIENT_GET), EO_TYPECHECK(Elm_Popup_Orient *, ret)
/**
* @def elm_obj_popup_timeout_set
* @since 1.8
*
* @brief Sets a timeout to hide popup automatically
*
* @param[in] timeout
*
* @see elm_popup_timeout_set
*/
#define elm_obj_popup_timeout_set(timeout) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_SET), EO_TYPECHECK(double, timeout)
/**
* @def elm_obj_popup_timeout_get
* @since 1.8
*
* @brief Returns the timeout value set to the popup (in seconds)
*
* @param[out] ret
*
* @see elm_popup_timeout_get
*/
#define elm_obj_popup_timeout_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_GET), EO_TYPECHECK(double *, ret)
/**
* @def elm_obj_popup_allow_events_set
* @since 1.8
*
* @brief Sets whether events should be passed to by a click outside.
*
* @param[in] allow
*
* @see elm_popup_allow_events_set
*/
#define elm_obj_popup_allow_events_set(allow) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET), EO_TYPECHECK(Eina_Bool, allow)
/**
* @def elm_obj_popup_allow_events_get
* @since 1.8
*
* @brief Returns value indicating whether allow event is enabled or not
*
* @param[out] ret
*
* @see elm_popup_allow_events_get
*/
#define elm_obj_popup_allow_events_get(ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET), EO_TYPECHECK(Eina_Bool *, ret)
/**
* @def elm_obj_popup_item_append
* @since 1.8
*
* @brief Add a new item to a Popup object
*
* @param[in] label
* @param[in] icon
* @param[in] func
* @param[in] data
* @param[out] ret
*
* @see elm_popup_item_append
*/
#define elm_obj_popup_item_append(label, icon, func, data, ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), EO_TYPECHECK(const char *, label), EO_TYPECHECK(Evas_Object *, icon), EO_TYPECHECK(Evas_Smart_Cb, func), EO_TYPECHECK(const void *, data), EO_TYPECHECK(Elm_Object_Item **, ret)

View File

@ -0,0 +1,137 @@
/**
* @brief Adds a new Popup to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Popup
*/
EAPI Evas_Object *elm_popup_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
/**
* @brief Sets the wrapping type of content text packed in content
* area of popup object.
*
* @param obj The Popup object
* @param wrap wrapping type of type Elm_Wrap_Type
*
* @ingroup Popup
* @see elm_popup_content_text_wrap_type_get()
*/
EAPI void elm_popup_content_text_wrap_type_set(Evas_Object *obj, Elm_Wrap_Type wrap) EINA_ARG_NONNULL(1);
/**
* @brief Returns the wrapping type of content text packed in content area of
* popup object.
*
* @param obj The Popup object
* @return wrap type of the content text
*
* @ingroup Popup
* @see elm_popup_content_text_wrap_type_set
*/
EAPI Elm_Wrap_Type elm_popup_content_text_wrap_type_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets the orientation of the popup in the parent region
*
* @param obj The popup object
* @param orient the orientation of the popup
*
* Sets the position in which popup will appear in its parent
*
* @ingroup Popup
* @see @ref Elm_Popup_Orient for possible values.
*/
EAPI void elm_popup_orient_set(Evas_Object *obj, Elm_Popup_Orient orient) EINA_ARG_NONNULL(1);
/**
* @brief Returns the orientation of Popup
*
* @param obj The popup object
* @return the orientation of the popup
*
* @ingroup Popup
* @see elm_popup_orient_set()
* @see Elm_Popup_Orient
*/
EAPI Elm_Popup_Orient elm_popup_orient_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets a timeout to hide popup automatically
*
* @param obj The popup object
* @param timeout The timeout in seconds
*
* This function sets a timeout and starts the timer controlling when the
* popup is hidden. Since calling evas_object_show() on a popup restarts
* the timer controlling when it is hidden, setting this before the
* popup is shown will in effect mean starting the timer when the popup is
* shown. Smart signal "timeout" is called afterwards which can be handled
* if needed.
*
* @note Set a value <= 0.0 to disable a running timer.
*
* @note If the value > 0.0 and the popup is previously visible, the
* timer will be started with this value, canceling any running timer.
* @ingroup Popup
*/
EAPI void elm_popup_timeout_set(Evas_Object *obj, double timeout) EINA_ARG_NONNULL(1);
/**
* @brief Returns the timeout value set to the popup (in seconds)
*
* @param obj The popup object
* @return the timeout value
*
* @ingroup Popup
* @see elm_popup_timeout_set()
*/
EAPI double elm_popup_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets whether events should be passed to by a click outside.
*
* @param obj The popup object
* @param allow EINA_TRUE Events are passed to lower objects, else not
*
* Enabling allow event will remove the Blocked event area and events will
* pass to the lower layer objects otherwise they are blocked.
*
* @ingroup Popup
* @see elm_popup_allow_events_get()
* @note The default value is EINA_FALSE.
*/
EAPI void elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow);
/**
* @brief Returns value indicating whether allow event is enabled or not
*
* @param obj The popup object
* @return EINA_FALSE if Blocked event area is present else EINA_TRUE
*
* @ingroup Popup
* @see elm_popup_allow_events_set()
* @note By default the Blocked event area is present
*/
EAPI Eina_Bool elm_popup_allow_events_get(const Evas_Object *obj);
/**
* @brief Add a new item to a Popup object
*
* Both an item list and a content could not be set at the same time!
* once you add an item, the previous content will be removed.
*
* @param obj popup object
* @param icon Icon to be set on new item
* @param label The Label of the new item
* @param func Convenience function called when item selected
* @param data Data passed to @p func above
* @return A handle to the item added or @c NULL, on errors
*
* @ingroup Popup
* @warning When the first item is appended to popup object, any previous content
* of the content area is deleted. At a time, only one of content, content-text
* and item(s) can be there in a popup content area.
*/
EAPI Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);