Elementary: ctxpopup documentation and example.
SVN revision: 61564
This commit is contained in:
parent
d4aa86a38d
commit
9a0617feac
|
@ -46,7 +46,8 @@ widget_preview_layout \
|
|||
widget_preview_index \
|
||||
widget_preview_clock \
|
||||
widget_preview_label \
|
||||
widget_preview_frame
|
||||
widget_preview_frame \
|
||||
widget_preview_ctxpopup
|
||||
|
||||
LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@
|
||||
|
||||
|
@ -69,7 +70,8 @@ WGT_PREVIEW = \
|
|||
index:preview-00.png:widget_preview_index:300:500 \
|
||||
frame:preview-00.png:widget_preview_frame:100:50 \
|
||||
label:preview-00.png:widget_preview_label:70:30 \
|
||||
clock:preview-00.png:widget_preview_clock:200:100
|
||||
clock:preview-00.png:widget_preview_clock:200:100 \
|
||||
ctxpopup:preview-00.png:widget_preview_ctxpopup:200:130
|
||||
|
||||
widget-preview:
|
||||
@for ss in $(WGT_PREVIEW); do \
|
||||
|
|
|
@ -2766,6 +2766,77 @@
|
|||
* @example index_example_02.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page tutorial_ctxpopup Ctxpopup example
|
||||
* @dontinclude ctxpopup_example_01.c
|
||||
*
|
||||
* In this example we have a list with two items, when either item is clicked
|
||||
* a ctxpopup for it will be shown. Our two ctxpopups are quite different, the
|
||||
* one for the first item is a vertical and it's items contain both labels and
|
||||
* icons, the one for the second item is horizontal and it's items have icons
|
||||
* but not labels.
|
||||
*
|
||||
* We will begin examining our example code by looking at the callback we'll use
|
||||
* when items in the ctxpopup are clicked. It's very simple, all it does is
|
||||
* print the label present in the ctxpopup item:
|
||||
* @until }
|
||||
*
|
||||
* Next we examine a function that creates ctxpopup items, it was created to
|
||||
* avoid repeating the same code whenever we needed to add an item to our
|
||||
* ctxpopup. Our function creates an icon from the standard set of icons, and
|
||||
* then creates the item, with the label received as an argument. We also set
|
||||
* the callback to be called when the item is clicked:
|
||||
* @until }
|
||||
*
|
||||
* Finally we have the function that will create the ctxpopup for the first item
|
||||
* in our list. This one is somewhat more complex though, so let's go through it
|
||||
* in parts. First we declare our variable and add the ctxpopup:
|
||||
* @until ctxpopup_add
|
||||
*
|
||||
* Next we create a bunch of items for our ctxpopup, marking two of them as
|
||||
* disabled just so we can see what that will look like:
|
||||
* @until disabled_set
|
||||
* @until disabled_set
|
||||
*
|
||||
* Then we ask evas where the mouse pointer was so that we can have our ctxpopup
|
||||
* appear in the right place, set a maximum size for the ctxpopup, move it and
|
||||
* show it:
|
||||
* @until show
|
||||
*
|
||||
* And last we mark the list item as not selected:
|
||||
* @until }
|
||||
*
|
||||
* Our next function is the callback that will create the ctxpopup for the
|
||||
* second list item, it is very similar to the previous function. A couple of
|
||||
* interesting things to note is that we ask our ctxpopup to be horizontal, and
|
||||
* that we pass NULL as the label for every item:
|
||||
* @until }
|
||||
*
|
||||
* And with all of that in place we can now get to our main function where we
|
||||
* create the window, the list, the list items and run the main loop:
|
||||
* @until ELM_MAIN()
|
||||
*
|
||||
* The example will initially look like this:
|
||||
*
|
||||
* @image html screenshots/ctxpopup_example_01.png
|
||||
* @image latex screenshots/ctxpopup_example_01.eps width=\textwidth
|
||||
*
|
||||
* @note This doesn't show the ctxpopup tough, since it will only appear when
|
||||
* we click one of the list items.
|
||||
*
|
||||
* Here is what our first ctxpopup will look like:
|
||||
*
|
||||
* @image html screenshots/ctxpopup_example_01_a.png
|
||||
* @image latex screenshots/ctxpopup_example_01_a.eps width=\textwidth
|
||||
*
|
||||
* And here the second ctxpopup:
|
||||
*
|
||||
* @image html screenshots/ctxpopup_example_01_b.png
|
||||
* @image latex screenshots/ctxpopup_example_01_b.eps width=\textwidth
|
||||
*
|
||||
* @example ctxpopup_example_01.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page bg_example_01_c bg_example_01.c
|
||||
* @include bg_example_01.c
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
|
@ -56,6 +56,9 @@
|
|||
* @image html img/widget/colorselector/preview-00.png
|
||||
* @image latex img/widget/colorselector/preview-00.eps
|
||||
* @li @ref Ctxpopup
|
||||
*
|
||||
* @image html img/widget/ctxpopup/preview-00.png
|
||||
* @image latex img/widget/ctxpopup/preview-00.eps
|
||||
* @li @ref Diskselector
|
||||
* @li @ref Entry
|
||||
* @li @ref File_Selector_Button
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#include "widget_preview_tmpl_head.c"
|
||||
|
||||
Evas_Object *o = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||
evas_object_resize(o, 200, 130);
|
||||
evas_object_show(o);
|
||||
|
||||
Evas_Object *ctxpopup = elm_ctxpopup_add(o);
|
||||
|
||||
Evas_Object *ic = elm_icon_add(ctxpopup);
|
||||
elm_icon_standard_set(ic, "home");
|
||||
elm_icon_scale_set(ic, EINA_FALSE, EINA_FALSE);
|
||||
elm_ctxpopup_item_append(ctxpopup, "Go to home folder", ic, NULL, NULL);
|
||||
|
||||
ic = elm_icon_add(ctxpopup);
|
||||
elm_icon_standard_set(ic, "delete");
|
||||
elm_icon_scale_set(ic, EINA_FALSE, EINA_FALSE);
|
||||
elm_ctxpopup_item_append(ctxpopup, "Delete file", ic, NULL, NULL);
|
||||
|
||||
ic = elm_icon_add(ctxpopup);
|
||||
elm_icon_standard_set(ic, "folder");
|
||||
elm_icon_scale_set(ic, EINA_FALSE, EINA_FALSE);
|
||||
Elm_Ctxpopup_Item *it = elm_ctxpopup_item_append(ctxpopup, "Navigate to folder", ic, NULL, NULL);
|
||||
elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
|
||||
|
||||
evas_object_size_hint_weight_set(ctxpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_move(ctxpopup, 0, 0);
|
||||
evas_object_show(ctxpopup);
|
||||
|
||||
#include "widget_preview_tmpl_foot.c"
|
|
@ -75,7 +75,8 @@ SRCS = \
|
|||
index_example_01.c \
|
||||
index_example_02.c \
|
||||
theme_example.edc \
|
||||
layout_example.edc
|
||||
layout_example.edc \
|
||||
ctxpopup_example_01.c
|
||||
|
||||
pkglib_PROGRAMS =
|
||||
|
||||
|
@ -135,6 +136,7 @@ pkglib_PROGRAMS += \
|
|||
layout_example_01 \
|
||||
layout_example_02 \
|
||||
layout_example_03 \
|
||||
ctxpopup_example_01 \
|
||||
flipselector_example \
|
||||
fileselector_example \
|
||||
fileselector_button_example \
|
||||
|
@ -178,7 +180,8 @@ SCREENSHOTS = \
|
|||
layout_example_03:layout_example_03.png:0.0 \
|
||||
flipselector_example:flipselector_example.png:0.0 \
|
||||
fileselector_example:fileselector_example.png:0.0 \
|
||||
index_example_02:index_example_03.png:0.3
|
||||
index_example_02:index_example_03.png:0.3 \
|
||||
ctxpopup_example_01:ctxpopup_example_01.png:0.0
|
||||
|
||||
HTML_SS_DIR=$(top_builddir)/doc/html/screenshots
|
||||
LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
//Compile with:
|
||||
//gcc -g `pkg-config --cflags --libs elementary` ctxpopup_example_01.c -o ctxpopup_example_01
|
||||
|
||||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
static void
|
||||
_ctxpopup_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||
{
|
||||
printf("ctxpopup item selected: %s\n", elm_ctxpopup_item_label_get(event_info));
|
||||
}
|
||||
|
||||
Elm_Ctxpopup_Item *item_new(Evas_Object *ctxpopup, const char * label, const char *icon)
|
||||
{
|
||||
Evas_Object *ic = elm_icon_add(ctxpopup);
|
||||
elm_icon_standard_set(ic, icon);
|
||||
elm_icon_scale_set(ic, EINA_FALSE, EINA_FALSE);
|
||||
return elm_ctxpopup_item_append(ctxpopup, label, ic, _ctxpopup_item_cb, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_list_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *ctxpopup;
|
||||
Elm_Ctxpopup_Item *it;
|
||||
Evas_Coord x,y;
|
||||
|
||||
ctxpopup = elm_ctxpopup_add(obj);
|
||||
|
||||
item_new(ctxpopup, "Go to home folder", "home");
|
||||
item_new(ctxpopup, "Save file", "file");
|
||||
item_new(ctxpopup, "Delete file", "delete");
|
||||
it = item_new(ctxpopup, "Navigate to folder", "folder");
|
||||
elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
|
||||
item_new(ctxpopup, "Edit entry", "edit");
|
||||
it = item_new(ctxpopup, "Set date and time", "clock");
|
||||
elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
|
||||
|
||||
evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
|
||||
evas_object_size_hint_max_set(ctxpopup, 240, 240);
|
||||
evas_object_move(ctxpopup, x, y);
|
||||
evas_object_show(ctxpopup);
|
||||
|
||||
elm_list_item_selected_set(event_info, EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_list_item_cb2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *ctxpopup;
|
||||
Elm_Ctxpopup_Item *it;
|
||||
Evas_Coord x,y;
|
||||
|
||||
ctxpopup = elm_ctxpopup_add(obj);
|
||||
elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE);
|
||||
|
||||
item_new(ctxpopup, NULL, "home");
|
||||
item_new(ctxpopup, NULL, "file");
|
||||
item_new(ctxpopup, NULL, "delete");
|
||||
item_new(ctxpopup, NULL, "folder");
|
||||
it = item_new(ctxpopup, NULL, "edit");
|
||||
elm_ctxpopup_item_disabled_set(it, EINA_TRUE);
|
||||
item_new(ctxpopup, NULL, "clock");
|
||||
|
||||
evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
|
||||
evas_object_size_hint_max_set(ctxpopup, 380, 40);
|
||||
evas_object_move(ctxpopup, x, y);
|
||||
evas_object_show(ctxpopup);
|
||||
|
||||
elm_list_item_selected_set(event_info, EINA_FALSE);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
elm_main(int argc, char **argv)
|
||||
{
|
||||
Evas_Object *win, *bg, *list;
|
||||
|
||||
win = elm_win_add(NULL, "Contextual Popup", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Contextual Popup");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_show(bg);
|
||||
|
||||
list = elm_list_add(win);
|
||||
elm_win_resize_object_add(win, list);
|
||||
elm_list_mode_set(list, ELM_LIST_COMPRESS);
|
||||
|
||||
elm_list_item_append(list, "Ctxpopup with icons and labels", NULL, NULL,
|
||||
_list_item_cb, NULL);
|
||||
elm_list_item_append(list, "Ctxpopup with icons only", NULL, NULL,
|
||||
_list_item_cb2, NULL);
|
||||
evas_object_show(list);
|
||||
elm_list_go(list);
|
||||
|
||||
evas_object_resize(win, 400, 400);
|
||||
evas_object_show(win);
|
||||
|
||||
elm_run();
|
||||
}
|
||||
ELM_MAIN()
|
|
@ -11118,37 +11118,235 @@ extern "C" {
|
|||
* @}
|
||||
*/
|
||||
|
||||
/* Contextual Popup */
|
||||
/**
|
||||
* @defgroup Ctxpopup
|
||||
*
|
||||
* @image html img/widget/ctxpopup/preview-00.png
|
||||
* @image latex img/widget/ctxpopup/preview-00.eps
|
||||
*
|
||||
* @brief Context popup widet.
|
||||
*
|
||||
* A ctxpopup is a widget that, when shown, pops up a list of items.
|
||||
* It automatically chooses an area inside its parent object's view
|
||||
* (set via elm_ctxpopup_add() and elm_ctxpopup_hover_parent_set()) to
|
||||
* optimally fit into it. In the default theme, it will also point an
|
||||
* arrow to it's top left position at the time one shows it. Ctxpopup
|
||||
* items have a label and/or an icon. It is intended for a small
|
||||
* number of items (hence the use of list, not genlist).
|
||||
*
|
||||
* @note Ctxpopup is a especialization of @ref Hover.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
* "dismissed" - the ctxpopup was dismissed
|
||||
*
|
||||
* @ref tutorial_ctxpopup shows the usage of a good deal of the API.
|
||||
* @{
|
||||
*/
|
||||
typedef struct _Elm_Ctxpopup_Item Elm_Ctxpopup_Item;
|
||||
|
||||
typedef enum _Elm_Ctxpopup_Direction
|
||||
{
|
||||
ELM_CTXPOPUP_DIRECTION_DOWN,
|
||||
ELM_CTXPOPUP_DIRECTION_RIGHT,
|
||||
ELM_CTXPOPUP_DIRECTION_LEFT,
|
||||
ELM_CTXPOPUP_DIRECTION_UP,
|
||||
ELM_CTXPOPUP_DIRECTION_DOWN, /**< ctxpopup show appear below clicked
|
||||
area */
|
||||
ELM_CTXPOPUP_DIRECTION_RIGHT, /**< ctxpopup show appear to the right of
|
||||
the clicked area */
|
||||
ELM_CTXPOPUP_DIRECTION_LEFT, /**< ctxpopup show appear to the left of
|
||||
the clicked area */
|
||||
ELM_CTXPOPUP_DIRECTION_UP, /**< ctxpopup show appear above the clicked
|
||||
area */
|
||||
} Elm_Ctxpopup_Direction;
|
||||
|
||||
/**
|
||||
* @brief Add a new Ctxpopup object to the parent.
|
||||
*
|
||||
* @param parent Parent object
|
||||
* @return New object or @c NULL, if it cannot be created
|
||||
*/
|
||||
EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
EAPI Evas_Object *elm_ctxpopup_item_icon_get(const Elm_Ctxpopup_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_ctxpopup_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon) EINA_ARG_NONNULL(1);
|
||||
EAPI const char *elm_ctxpopup_item_label_get(const Elm_Ctxpopup_Item *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_ctxpopup_item_label_set(Elm_Ctxpopup_Item *item, const char *label) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the Ctxpopup's parent
|
||||
*
|
||||
* @param obj The ctxpopup object
|
||||
* @param area The parent to use
|
||||
*
|
||||
* Set the parent object.
|
||||
*
|
||||
* @note elm_ctxpopup_add() will automatically call this function
|
||||
* with its @c parent argument.
|
||||
*
|
||||
* @see elm_ctxpopup_add()
|
||||
* @see elm_hover_parent_set()
|
||||
*/
|
||||
EAPI void elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1, 2);
|
||||
/**
|
||||
* @brief Get the Ctxpopup's parent
|
||||
*
|
||||
* @param obj The ctxpopup object
|
||||
*
|
||||
* @see elm_ctxpopup_hover_parent_set() for more information
|
||||
*/
|
||||
EAPI Evas_Object *elm_ctxpopup_hover_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Clear all items in the given ctxpopup object.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
*/
|
||||
EAPI void elm_ctxpopup_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Change the ctxpopup's orientation to horizontal or vertical.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical
|
||||
*/
|
||||
EAPI void elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the value of current ctxpopup object's orientation.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors)
|
||||
*
|
||||
* @see elm_ctxpopup_horizontal_set()
|
||||
*/
|
||||
EAPI Eina_Bool elm_ctxpopup_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Add a new item to a ctxpopup object.
|
||||
*
|
||||
* @param obj Ctxpopup 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
|
||||
* @return A handle to the item added or @c NULL, on errors
|
||||
*
|
||||
* @warning Ctxpopup can't hold both an item list and a content at the same
|
||||
* time. When an item is added, any previous content will be removed.
|
||||
*
|
||||
* @see elm_ctxpopup_content_set()
|
||||
*/
|
||||
Elm_Ctxpopup_Item *elm_ctxpopup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Delete the given item in a ctxpopup object.
|
||||
*
|
||||
* @param item Ctxpopup item to be deleted
|
||||
*
|
||||
* @see elm_ctxpopup_item_append()
|
||||
*/
|
||||
EAPI void elm_ctxpopup_item_del(Elm_Ctxpopup_Item *item) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the ctxpopup item's state as disabled or enabled.
|
||||
*
|
||||
* @param item Ctxpopup item to be enabled/disabled
|
||||
* @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
|
||||
*
|
||||
* When disabled the item is greyed out to indicate it's state.
|
||||
*/
|
||||
EAPI void elm_ctxpopup_item_disabled_set(Elm_Ctxpopup_Item *item, Eina_Bool disabled) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the ctxpopup item's disabled/enabled state.
|
||||
*
|
||||
* @param item Ctxpopup item to be enabled/disabled
|
||||
* @return disabled @c EINA_TRUE, if disabled, @c EINA_FALSE otherwise
|
||||
*
|
||||
* @see elm_ctxpopup_item_disabled_set()
|
||||
*/
|
||||
EAPI Eina_Bool elm_ctxpopup_item_disabled_get(const Elm_Ctxpopup_Item *item) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the icon object for the given ctxpopup item.
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @return icon object or @c NULL, if the item does not have icon or an error
|
||||
* occurred
|
||||
*
|
||||
* @see elm_ctxpopup_item_append()
|
||||
* @see elm_ctxpopup_item_icon_set()
|
||||
*/
|
||||
EAPI Evas_Object *elm_ctxpopup_item_icon_get(const Elm_Ctxpopup_Item *item) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Sets the side icon associated with the ctxpopup item
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @param icon Icon object to be set
|
||||
*
|
||||
* Once the icon object is set, a previously set one will be deleted.
|
||||
* @warning Setting the same icon for two items will cause the icon to
|
||||
* dissapear from the first item.
|
||||
*
|
||||
* @see elm_ctxpopup_item_append()
|
||||
*/
|
||||
EAPI void elm_ctxpopup_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the label for the given ctxpopup item.
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @return label string or @c NULL, if the item does not have label or an
|
||||
* error occured
|
||||
*
|
||||
* @see elm_ctxpopup_item_append()
|
||||
* @see elm_ctxpopup_item_label_set()
|
||||
*/
|
||||
EAPI const char *elm_ctxpopup_item_label_get(const Elm_Ctxpopup_Item *item) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief (Re)set the label on the given ctxpopup item.
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @param label String to set as label
|
||||
*/
|
||||
EAPI void elm_ctxpopup_item_label_set(Elm_Ctxpopup_Item *item, const char *label) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set an elm widget as the content of the ctxpopup.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param content Content to be swallowed
|
||||
*
|
||||
* If the content object is already set, a previous one will bedeleted. If
|
||||
* you want to keep that old content object, use the
|
||||
* elm_ctxpopup_content_unset() function.
|
||||
*
|
||||
* @warning Ctxpopup can't hold both a item list and a content at the same
|
||||
* time. When a content is set, any previous items will be removed.
|
||||
*/
|
||||
EAPI void elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1, 2);
|
||||
/**
|
||||
* @brief Unset the ctxpopup content
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @return The content that was being used
|
||||
*
|
||||
* Unparent and return the content object which was set for this widget.
|
||||
*
|
||||
* @see elm_ctxpopup_content_set()
|
||||
*/
|
||||
EAPI Evas_Object *elm_ctxpopup_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Set the direction priority of a ctxpopup.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param first 1st priority of direction
|
||||
* @param second 2nd priority of direction
|
||||
* @param third 3th priority of direction
|
||||
* @param fourth 4th priority of direction
|
||||
*
|
||||
* This functions gives a chance to user to set the priority of ctxpopup
|
||||
* showing direction. This doesn't guarantee the ctxpopup will appear in the
|
||||
* requested direction.
|
||||
*
|
||||
* @see Elm_Ctxpopup_Direction
|
||||
*/
|
||||
EAPI void elm_ctxpopup_direction_priority_set(Evas_Object *obj, Elm_Ctxpopup_Direction first, Elm_Ctxpopup_Direction second, Elm_Ctxpopup_Direction third, Elm_Ctxpopup_Direction fourth) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get the direction priority of a ctxpopup.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param first 1st priority of direction to be returned
|
||||
* @param second 2nd priority of direction to be returned
|
||||
* @param third 3th priority of direction to be returned
|
||||
* @param fourth 4th priority of direction to be returned
|
||||
*
|
||||
* @see elm_ctxpopup_direction_priority_set() for more information.
|
||||
*/
|
||||
EAPI void elm_ctxpopup_direction_priority_get(Evas_Object *obj, Elm_Ctxpopup_Direction *first, Elm_Ctxpopup_Direction *second, Elm_Ctxpopup_Direction *third, Elm_Ctxpopup_Direction *fourth) EINA_ARG_NONNULL(1);
|
||||
/* smart callbacks called:
|
||||
* "dismissed" - the ctxpopup was dismissed
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* transit */
|
||||
|
|
|
@ -1,22 +1,6 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
/**
|
||||
* @defgroup Ctxpopup
|
||||
*
|
||||
* A ctxpopup is a widget that, when shown, pops up a list of items.
|
||||
* It automatically chooses an area inside its parent object's view
|
||||
* (set via elm_ctxpopup_add() and elm_ctxpopup_hover_parent_set()) to
|
||||
* optimally fit into it. In the default theme, it will also point an
|
||||
* arrow to the cursor position at the time one shows it. Ctxpopup
|
||||
* items have a label and/or an icon. It is intended for a small
|
||||
* number of items (hence the use of list, not genlist).
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* "dismissed" - the ctxpopup was dismissed
|
||||
*/
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
||||
struct _Elm_Ctxpopup_Item
|
||||
|
@ -950,14 +934,6 @@ _remove_items(Widget_Data *wd)
|
|||
wd->items = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Ctxpopup object to the parent.
|
||||
*
|
||||
* @param parent Parent object
|
||||
* @return New object or @c NULL, if it cannot be created
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_ctxpopup_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -1023,14 +999,6 @@ elm_ctxpopup_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon object for the given ctxpopup item.
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @return icon object or @c NULL, if the item does not have icon or an error occurred
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_ctxpopup_item_icon_get(const Elm_Ctxpopup_Item *item)
|
||||
{
|
||||
|
@ -1038,19 +1006,6 @@ elm_ctxpopup_item_icon_get(const Elm_Ctxpopup_Item *item)
|
|||
return item->icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the side icon associated with the ctxpopup item
|
||||
*
|
||||
* Once the icon object is set, a previously set one will be deleted.
|
||||
* You probably don't want, then, to have the <b>same</b> icon object
|
||||
* set for more than one item of the list (when replacing one of its
|
||||
* instances).
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @param icon Icon object to be set
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon)
|
||||
{
|
||||
|
@ -1070,15 +1025,6 @@ elm_ctxpopup_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label object for the given ctxpopup item.
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @return label object or @c NULL, if the item does not have label or an error occured
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_ctxpopup_item_label_get(const Elm_Ctxpopup_Item *item)
|
||||
{
|
||||
|
@ -1086,14 +1032,6 @@ elm_ctxpopup_item_label_get(const Elm_Ctxpopup_Item *item)
|
|||
return item->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)set the label on the given ctxpopup item.
|
||||
*
|
||||
* @param item Ctxpopup item
|
||||
* @param label String to set as label
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_item_label_set(Elm_Ctxpopup_Item *item, const char *label)
|
||||
{
|
||||
|
@ -1113,19 +1051,6 @@ elm_ctxpopup_item_label_set(Elm_Ctxpopup_Item *item, const char *label)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Ctxpopup's parent
|
||||
* Set the parent object (it would much probably be the
|
||||
* window that the ctxpopup is in).
|
||||
*
|
||||
* @param obj The ctxpopup object
|
||||
* @param area The parent to use
|
||||
*
|
||||
* @note elm_ctxpopup_add() will automatically call this function
|
||||
* with its @c parent argument.
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *hover_parent)
|
||||
{
|
||||
|
@ -1151,15 +1076,6 @@ elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *hover_parent)
|
|||
wd->hover_parent = hover_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Ctxpopup's parent
|
||||
*
|
||||
* @param obj The ctxpopup object
|
||||
*
|
||||
* @see elm_ctxpopup_hover_parent_set() for more information
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1173,13 +1089,6 @@ elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
|
|||
return wd->hover_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all items in the given ctxpopup object.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_clear(Evas_Object * obj)
|
||||
{
|
||||
|
@ -1192,14 +1101,6 @@ elm_ctxpopup_clear(Evas_Object * obj)
|
|||
_list_del(wd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the ctxpopup's orientation to horizontal or vertical.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
||||
{
|
||||
|
@ -1230,14 +1131,6 @@ elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of current ctxpopup object's orientation.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors)
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_ctxpopup_horizontal_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1251,21 +1144,6 @@ elm_ctxpopup_horizontal_get(const Evas_Object *obj)
|
|||
return wd->horizontal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new item to a ctxpopup object.
|
||||
*
|
||||
* Both a item list and a content could not be set at the same time!
|
||||
* once you set add a item, the previous content will be removed.
|
||||
*
|
||||
* @param obj Ctxpopup 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 Ctxpopup
|
||||
*/
|
||||
EAPI Elm_Ctxpopup_Item *
|
||||
elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
|
||||
Evas_Object *icon, Evas_Smart_Cb func,
|
||||
|
@ -1313,13 +1191,6 @@ elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
|
|||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given item in a ctxpopup object.
|
||||
*
|
||||
* @param item Ctxpopup item to be deleted
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_item_del(Elm_Ctxpopup_Item *item)
|
||||
{
|
||||
|
@ -1348,14 +1219,6 @@ elm_ctxpopup_item_del(Elm_Ctxpopup_Item *item)
|
|||
free(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ctxpopup item's state as disabled or enabled.
|
||||
*
|
||||
* @param item Ctxpopup item to be enabled/disabled
|
||||
* @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_item_disabled_set(Elm_Ctxpopup_Item *item, Eina_Bool disabled)
|
||||
{
|
||||
|
@ -1377,14 +1240,6 @@ elm_ctxpopup_item_disabled_set(Elm_Ctxpopup_Item *item, Eina_Bool disabled)
|
|||
item->disabled = !!disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ctxpopup item's disabled/enabled state.
|
||||
*
|
||||
* @param item Ctxpopup item to be enabled/disabled
|
||||
* @return disabled @c EINA_TRUE, if disabled, @c EINA_FALSE otherwise
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_ctxpopup_item_disabled_get(const Elm_Ctxpopup_Item *item)
|
||||
{
|
||||
|
@ -1392,19 +1247,6 @@ elm_ctxpopup_item_disabled_get(const Elm_Ctxpopup_Item *item)
|
|||
return item->disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Once the content object is set, a previously set one will be deleted.
|
||||
* If you want to keep that old content object, use the
|
||||
* elm_ctxpopup_content_unset() function
|
||||
*
|
||||
* Both a item list and a content could not be set at the same time!
|
||||
* once you set a content, the previous list items will be removed.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param content Content to be swallowed
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content)
|
||||
{
|
||||
|
@ -1435,16 +1277,6 @@ elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the ctxpopup content
|
||||
*
|
||||
* Unparent and return the content object which was set for this widget
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @return The content that was being used
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_ctxpopup_content_unset(Evas_Object *obj)
|
||||
{
|
||||
|
@ -1469,18 +1301,6 @@ elm_ctxpopup_content_unset(Evas_Object *obj)
|
|||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the direction priority of a ctxpopup.
|
||||
* This functions gives a chance to user to set the priority of ctxpopup showing direction.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param first 1st priority of direction
|
||||
* @param second 2nd priority of direction
|
||||
* @param third 3th priority of direction
|
||||
* @param fourth 4th priority of direction
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_direction_priority_set(Evas_Object *obj,
|
||||
Elm_Ctxpopup_Direction first,
|
||||
|
@ -1503,19 +1323,6 @@ elm_ctxpopup_direction_priority_set(Evas_Object *obj,
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the direction priority of a ctxpopup.
|
||||
*
|
||||
* @param obj Ctxpopup object
|
||||
* @param first 1st priority of direction to be returned
|
||||
* @param second 2nd priority of direction to be returned
|
||||
* @param third 3th priority of direction to be returned
|
||||
* @param fourth 4th priority of direction to be returned
|
||||
*
|
||||
* @see elm_ctxpopup_direction_priority_set for more information.
|
||||
*
|
||||
* @ingroup Ctxpopup
|
||||
*/
|
||||
EAPI void
|
||||
elm_ctxpopup_direction_priority_get(Evas_Object *obj,
|
||||
Elm_Ctxpopup_Direction *first,
|
||||
|
|
Loading…
Reference in New Issue