hoversel:preview-00.png:widget_preview_hoversel:90:170 \
hover:preview-00.png:widget_preview_hover:90:170 \
anchorview:preview-00.png:widget_preview_anchorview:100:30 \
- anchorblock:preview-00.png:widget_preview_anchorblock:100:30
+ anchorblock:preview-00.png:widget_preview_anchorblock:100:30 \
+ pager:preview-00.png:widget_preview_pager:100:100
widget-build:
@$(MAKE) -C widgets
*/
/**
+ * @page tutorial_pager
+ * @dontinclude pager_example_01.c
+ *
+ * In this example we'll have a pager with 3 rectangles on it, one blue, one
+ * green and one blue, we'll also have 1 button for each rectangle. Pressing a
+ * button will bring the associated rectangle to the front of the pager(promote
+ * it).
+ *
+ * We start our example with some run of the mill code that you've seen in other
+ * examples:
+ * @until show
+ *
+ * And then we get right to creating our pager, setting a style and some basic
+ * properties to it:
+ * @until show
+ *
+ * Well a pager without any content is not of much use, so let's create the
+ * first of our rectangles, add it to the pager and create the button for it:
+ * @until smart_callback
+ * @note The only line of above code that directly relates to our pager is the
+ * call to elm_pager_content_push().
+ *
+ * And now we will do the same thing again twice for our next two rectangles:
+ * @until smart_callback
+ * @until smart_callback
+ *
+ * Now that we haver our widgets create we can get to running the main loop:
+ * @until ELM_MAIN
+ *
+ * We also have the callback that is called when any of the buttons is pressed,
+ * this callback is receiving the rectangle in it's @p data argument, so we
+ * check if it's already on top and if not move it there:
+ * @until }
+ *
+ * Our example will look like this:
+ *
+ * @image html screenshots/pager_example_01.png
+ * @image latex screenshots/pager_example_01.eps width=\textwidth
+ * @note Like all examples that involve animations the screenshot doesn't do it
+ * justice, seeing it in action is a must.
+ *
+ * @example pager_example_01.c
+ */
+
+/**
* @page bg_example_01_c bg_example_01.c
* @include bg_example_01.c
* @example bg_example_01.c
* @li @ref Menu
* @li @ref Notify
* @li @ref Pager
+ *
+ * @image html img/widget/pager/preview-00.png
+ * @image latex img/widget/pager/preview-00.eps
* @li @ref Panel
* @li @ref Panes
* @li @ref Photo
--- /dev/null
+unsigned char _func(void *data);
+void *o;
+
+#include "widget_preview_tmpl_head.c"
+
+o = elm_pager_add(win);
+evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, o);
+
+Evas_Object *o2 = elm_label_add(win);
+elm_object_text_set(o2, "back page");
+evas_object_show(o2);
+elm_pager_content_push(o, o2);
+
+ecore_timer_add(0.3, _func, o2);
+
+o2 = elm_label_add(win);
+elm_object_text_set(o2, "front page");
+evas_object_show(o2);
+elm_pager_content_push(o, o2);
+
+evas_object_show(o);
+
+#include "widget_preview_tmpl_foot.c"
+
+unsigned char _func(void *data)
+{
+ elm_pager_content_promote(o, data);
+}
widget_preview_hover \
widget_preview_anchorview \
widget_preview_anchorblock \
-widget_preview_flip
+widget_preview_flip \
+widget_preview_pager
LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@
index_example_02.c \
theme_example.edc \
layout_example.edc \
- ctxpopup_example_01.c
+ ctxpopup_example_01.c \
+ pager_example_01.c
pkglib_PROGRAMS =
fileselector_button_example \
fileselector_entry_example \
index_example_01 \
- index_example_02
+ index_example_02 \
+ pager_example_01
# This variable will hold the list of screenshots that will be made
# by "make screenshots". Each item in the list is of the form:
flipselector_example:flipselector_example.png:0.0 \
fileselector_example:fileselector_example.png:0.0 \
index_example_02:index_example_03.png:0.3 \
- ctxpopup_example_01:ctxpopup_example_01.png:0.0
+ ctxpopup_example_01:ctxpopup_example_01.png:0.0 \
+ pager_example_01:pager_example_01.png:0.0
HTML_SS_DIR=$(top_builddir)/doc/html/screenshots
LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots
--- /dev/null
+//Compile with:
+//gcc -g `pkg-config --cflags --libs elementary` pager_example_01.c -o pager_example_01
+
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+static void _promote(void *data, Evas_Object *obj, void *event_info);
+static Evas_Object *pager;
+
+EAPI int
+elm_main(int argc, char **argv)
+{
+ Evas_Object *win, *bg, *rect, *bt;
+
+ win = elm_win_add(NULL, "pager", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Pager");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+
+ bg = elm_bg_add(win);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ pager = elm_pager_add(win);
+ elm_object_style_set(pager, "fade");
+ evas_object_resize(pager, 180, 160);
+ evas_object_move(pager, 10, 10);
+ evas_object_show(pager);
+
+ rect = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_color_set(rect, 0, 0, 255, 255);
+ evas_object_show(rect);
+ elm_pager_content_push(pager, rect);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "blue");
+ evas_object_resize(bt, 50, 20);
+ evas_object_move(bt, 10, 170);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(bt, "clicked", _promote, rect);
+
+ rect = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_color_set(rect, 0, 255, 0, 255);
+ evas_object_show(rect);
+ elm_pager_content_push(pager, rect);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "green");
+ evas_object_resize(bt, 60, 20);
+ evas_object_move(bt, 70, 170);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(bt, "clicked", _promote, rect);
+
+ rect = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_color_set(rect, 255, 0, 0, 255);
+ evas_object_show(rect);
+ elm_pager_content_push(pager, rect);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "red");
+ evas_object_resize(bt, 50, 20);
+ evas_object_move(bt, 140, 170);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(bt, "clicked", _promote, rect);
+
+ evas_object_resize(win, 200, 200);
+ evas_object_show(win);
+
+ elm_run();
+
+ return 0;
+}
+ELM_MAIN()
+
+static void
+_promote(void *data, Evas_Object *obj, void *event_info)
+{
+ if(elm_pager_content_top_get(pager) != data)
+ elm_pager_content_promote(pager, data);
+}
* "changed" - when the radio status is changed
*/
- /* pager */
+ /**
+ * @defgroup Pager Pager
+ *
+ * @image html img/widget/pager/preview-00.png
+ * @image latex img/widget/pager/preview-00.eps
+ *
+ * @brief Widget that allows flipping between 1 or more “pages” of objects.
+ *
+ * The flipping between “pages” of objects is animated. All content in pager
+ * is kept in a stack, the last content to be added will be on the top of the
+ * stack(be visible).
+ *
+ * Objects can be pushed or popped from the stack or deleted as normal.
+ * Pushes and pops will animate (and a pop will delete the object once the
+ * animation is finished). Any object already in the pager can be promoted to
+ * the top(from its current stacking position) through the use of
+ * elm_pager_content_promote(). Objects are pushed to the top with
+ * elm_pager_content_push() and when the top item is no longer wanted, simply
+ * pop it with elm_pager_content_pop() and it will also be deleted. If an
+ * object is no longer needed and is not the top item, just delete it as
+ * normal. You can query which objects are the top and bottom with
+ * elm_pager_content_bottom_get() and elm_pager_content_top_get().
+ *
+ * Signals that you can add callbacks for are:
+ * "hide,finished" - when the previous page is hided
+ *
+ * This widget has the following styles available:
+ * @li default
+ * @li fade
+ * @li fade_translucide
+ * @li fade_invisible
+ * @note This styles affect only the flipping animations, the appearance when
+ * not animating is unaffected by styles.
+ *
+ * @ref tutorial_pager gives a good overview of the usage of the API.
+ * @{
+ */
+ /**
+ * Add a new pager to the parent
+ *
+ * @param parent The parent object
+ * @return The new object or NULL if it cannot be created
+ *
+ * @ingroup Pager
+ */
EAPI Evas_Object *elm_pager_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Push an object to the top of the pager stack (and show it).
+ *
+ * @param obj The pager object
+ * @param content The object to push
+ *
+ * The object pushed becomes a child of the pager, it will be controlled and
+ * deleted when the pager is deleted.
+ *
+ * @note If the content is already in the stack use
+ * elm_pager_content_promote().
+ * @warning Using this function on @p content already in the stack results in
+ * undefined behavior.
+ */
EAPI void elm_pager_content_push(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Pop the object that is on top of the stack
+ *
+ * @param obj The pager object
+ *
+ * This pops the object that is on the top(visible) of the pager, makes it
+ * disappear, then deletes the object. The object that was underneath it on
+ * the stack will become visible.
+ */
EAPI void elm_pager_content_pop(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Moves an object already in the pager stack to the top of the stack.
+ *
+ * @param obj The pager object
+ * @param content The object to promote
+ *
+ * This will take the @p content and move it to the top of the stack as
+ * if it had been pushed there.
+ *
+ * @note If the content isn't already in the stack use
+ * elm_pager_content_push().
+ * @warning Using this function on @p content not already in the stack
+ * results in undefined behavior.
+ */
EAPI void elm_pager_content_promote(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Return the object at the bottom of the pager stack
+ *
+ * @param obj The pager object
+ * @return The bottom object or NULL if none
+ */
EAPI Evas_Object *elm_pager_content_bottom_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
- EAPI Evas_Object *elm_pager_content_top_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /* available item styles:
- * default
- * fade
- * fade_translucide
- * fade_invisible
+ /**
+ * @brief Return the object at the top of the pager stack
+ *
+ * @param obj The pager object
+ * @return The top object or NULL if none
*/
- /* smart callbacks called:
- * "hide,finished" - when the previous page is hided
+ EAPI Evas_Object *elm_pager_content_top_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ /**
+ * @}
*/
typedef struct _Elm_Slideshow_Item_Class Elm_Slideshow_Item_Class;
#include <Elementary.h>
#include "elm_priv.h"
-/**
- * @defgroup Pager Pager
- *
- * The pager is an object that allows flipping (with animation) between 1 or
- * more “pages” of objects, much like a stack of windows within the window.
- *
- * Objects can be pushed or popped from the stack or deleted as normal.
- * Pushes and pops will animate (and a pop will delete the object once the
- * animation is finished). Any object in the pager can be promoted to the top
- * (from its current stacking position) as well. Objects are pushed to the
- * top with elm_pager_content_push() and when the top item is no longer
- * wanted, simply pop it with elm_pager_content_pop() and it will also be
- * deleted. Any object you wish to promote to the top that is already in the
- * pager, simply use elm_pager_content_promote(). If an object is no longer
- * needed and is not the top item, just delete it as normal. You can query
- * which objects are the top and bottom with elm_pager_content_bottom_get()
- * and elm_pager_content_top_get().
- *
- * Signals that you can add callbacks for are:
- *
- * "hide,finished" - when the previous page is hided
- *
- */
-
typedef struct _Widget_Data Widget_Data;
typedef struct _Item Item;
_sizing_eval(obj2);
}
-/**
- * Add a new pager to the parent
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Pager
- */
EAPI Evas_Object *
elm_pager_add(Evas_Object *parent)
{
return obj;
}
-/**
- * Push an object to the top of the pager stack (and show it)
- *
- * The object pushed becomes a child of the pager and will be controlled
- * it and deleted when the pager is deleted.
- *
- * @param obj The pager object
- * @param content The object to push
- *
- * @ingroup Pager
- * @warning It will be failed if the content exists on the stack already.
- */
EAPI void
elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
{
_sizing_eval(obj);
}
-/**
- * Pop the object that is on top of the stack
- *
- * This pops the object that is on top (visible) in the pager, makes it
- * disappear, then deletes the object. The object that was underneath it
- * on the stack will become visible.
- *
- * @param obj The pager object
- *
- * @ingroup Pager
- */
EAPI void
elm_pager_content_pop(Evas_Object *obj)
{
}
}
-/**
- * Promote an object already in the pager stack to the top of the stack
- *
- * This will take the indicated object and promote it to the top of the stack
- * as if it had been pushed there. The object must already be inside the
- * pager stack to work.
- *
- * @param obj The pager object
- * @param content The object to promote
- *
- * @ingroup Pager
- */
EAPI void
elm_pager_content_promote(Evas_Object *obj, Evas_Object *content)
{
_eval_top(obj);
}
-/**
- * Return the object at the bottom of the pager stack
- *
- * @param obj The pager object
- * @return The bottom object or NULL if none
- *
- * @ingroup Pager
- */
EAPI Evas_Object *
elm_pager_content_bottom_get(const Evas_Object *obj)
{
return it->content;
}
-/**
- * Return the object at the top of the pager stack
- *
- * @param obj The pager object
- * @return The top object or NULL if none
- *
- * @ingroup Pager
- */
EAPI Evas_Object *
elm_pager_content_top_get(const Evas_Object *obj)
{