diff --git a/legacy/elementary/doc/Makefile.am b/legacy/elementary/doc/Makefile.am index f9a208268b..768a0b268e 100644 --- a/legacy/elementary/doc/Makefile.am +++ b/legacy/elementary/doc/Makefile.am @@ -51,7 +51,8 @@ WGT_PREVIEW = \ pager:preview-00.png:widget_preview_pager:100:100 \ separator:preview-00.png:widget_preview_separator:10:80 \ radio:preview-00.png:widget_preview_radio:60:20 \ - toggle:preview-00.png:widget_preview_toggle:150:30 + toggle:preview-00.png:widget_preview_toggle:150:30 \ + panel:preview-00.png:widget_preview_panel:150:50 widget-build: @$(MAKE) -C widgets diff --git a/legacy/elementary/doc/examples.dox b/legacy/elementary/doc/examples.dox index c725f43aa4..eb4dcd266e 100644 --- a/legacy/elementary/doc/examples.dox +++ b/legacy/elementary/doc/examples.dox @@ -3023,6 +3023,43 @@ * @example toggle_example_01.c */ +/** + * @page tutorial_panel Panel example + * @dontinclude panel_example_01.c + * + * In this example will have 3 panels, one for each possible orientation. Two of + * our panels will start out hidden, the third will start out expanded. For each + * of the panels we will use a label as the content, it's however possible to + * have any widget(including containers) as the content of panels. + * + * We start by doing some setup, code you should be familiar with from other + * examples: + * @until show(bx) + * + * And move right to creating our first panel, for this panel we are going to + * choose the orientation as TOP and toggle it(tell it to hide itself): + * @until pack_end + * + * For the second panel we choose the RIGHT orientation and explicitly set the + * state as hidden: + * @until pack_end + * + * For our third and last panel we won't set the orientation(which means it will + * use the default: LEFT): + * @until pack_end + * + * All that is left is running the main loop: + * @until ELM_MAIN + * + * This example will look like this; + * + * @image html screenshots/panel_example_01.png + * @image latex screenshots/panel_example_01.epx width=\textwidth + * @note The buttons with arrow allow the user to hide/show the panels. + * + * @example panel_example_01.c + */ + /** * @page bg_example_01_c bg_example_01.c * @include bg_example_01.c diff --git a/legacy/elementary/doc/index.doxy b/legacy/elementary/doc/index.doxy index 74da13de63..fe73d94944 100644 --- a/legacy/elementary/doc/index.doxy +++ b/legacy/elementary/doc/index.doxy @@ -141,6 +141,9 @@ * @image html img/widget/pager/preview-00.png * @image latex img/widget/pager/preview-00.eps * @li @ref Panel + * + * @image html img/widget/panel/preview-00.png + * @image latex img/widget/panel/preview-00.eps * @li @ref Panes * @li @ref Photo * @li @ref Photocam diff --git a/legacy/elementary/doc/widgets/Makefile.am b/legacy/elementary/doc/widgets/Makefile.am index a725d7f629..c02c5701be 100644 --- a/legacy/elementary/doc/widgets/Makefile.am +++ b/legacy/elementary/doc/widgets/Makefile.am @@ -66,7 +66,8 @@ widget_preview_flip \ widget_preview_pager \ widget_preview_separator \ widget_preview_radio \ -widget_preview_toggle +widget_preview_toggle \ +widget_preview_panel LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@ @@ -115,5 +116,6 @@ EXTRA_DIST = \ widget_preview_separator.c \ widget_preview_radio.c \ widget_preview_toggle.c \ + widget_preview_panel.c \ widget_preview_tmpl_foot.c \ widget_preview_tmpl_head.c diff --git a/legacy/elementary/doc/widgets/widget_preview_panel.c b/legacy/elementary/doc/widgets/widget_preview_panel.c new file mode 100644 index 0000000000..8ae9e24d6a --- /dev/null +++ b/legacy/elementary/doc/widgets/widget_preview_panel.c @@ -0,0 +1,15 @@ +#include "widget_preview_tmpl_head.c" + +Evas_Object *o = elm_panel_add(win); +evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); +elm_win_resize_object_add(win, o); +evas_object_show(o); + +Evas_Object *o2 = elm_label_add(win); +elm_object_text_set(o2, "content"); +evas_object_show(o2); + +elm_panel_content_set(o, o2); + + +#include "widget_preview_tmpl_foot.c" diff --git a/legacy/elementary/src/examples/Makefile.am b/legacy/elementary/src/examples/Makefile.am index 48b9662eb2..a25adec1e9 100644 --- a/legacy/elementary/src/examples/Makefile.am +++ b/legacy/elementary/src/examples/Makefile.am @@ -79,7 +79,8 @@ SRCS = \ ctxpopup_example_01.c \ pager_example_01.c \ separator_example_01.c \ - radio_example_01.c + radio_example_01.c \ + panel_example_01.c pkglib_PROGRAMS = @@ -149,7 +150,8 @@ pkglib_PROGRAMS += \ pager_example_01 \ separator_example_01 \ radio_example_01 \ - toggle_example_01 + toggle_example_01 \ + panel_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: @@ -194,7 +196,8 @@ SCREENSHOTS = \ pager_example_01:pager_example_01.png:0.0 \ separator_example_01:separator_example_01.png:0.0 \ radio_example_01:radio_example_01.png:0.0 \ - toggle_example_01:toggle_example_01.png:0.0 + toggle_example_01:toggle_example_01.png:0.0 \ + panel_example_01:panel_example_01.png:0.0 HTML_SS_DIR=$(top_builddir)/doc/html/screenshots LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots diff --git a/legacy/elementary/src/examples/panel_example_01.c b/legacy/elementary/src/examples/panel_example_01.c new file mode 100644 index 0000000000..c57e03f7b1 --- /dev/null +++ b/legacy/elementary/src/examples/panel_example_01.c @@ -0,0 +1,77 @@ +//Compile with: +//gcc -g `pkg-config --cflags --libs elementary` panel_example_01.c -o panel_example_01 + +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +EAPI int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *panel, *content; + + win = elm_win_add(NULL, "panel", ELM_WIN_BASIC); + elm_win_title_set(win, "Panel"); + 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); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_FALSE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + panel = elm_panel_add(win); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_TOP); + elm_panel_toggle(panel); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panel); + elm_box_pack_end(bx, panel); + + content = elm_label_add(win); + elm_object_text_set(content, "content"); + evas_object_show(content); + evas_object_size_hint_min_set(content, 100, 30); + elm_panel_content_set(panel, content); + + panel = elm_panel_add(win); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_RIGHT); + elm_panel_hidden_set(panel, EINA_TRUE); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panel); + elm_box_pack_end(bx, panel); + + content = elm_label_add(win); + elm_object_text_set(content, "content2"); + evas_object_show(content); + evas_object_size_hint_min_set(content, 100, 30); + elm_panel_content_set(panel, content); + + panel = elm_panel_add(win); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panel); + elm_box_pack_end(bx, panel); + + content = elm_label_add(win); + elm_object_text_set(content, "content2"); + evas_object_show(content); + evas_object_size_hint_min_set(content, 100, 30); + elm_panel_content_set(panel, content); + + + evas_object_show(win); + + elm_run(); + + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 66f2ca661d..998d190279 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -9991,24 +9991,113 @@ extern "C" { EAPI double elm_route_lat_max_get(Evas_Object *obj); - /* panel */ + /** + * @defgroup Panel Panel + * + * @image html img/widget/panel/preview-00.png + * @image latex img/widget/panel/preview-00.eps + * + * @brief A panel is a type of animated container that contains subobjects. + * It can be expanded or contracted by clicking the button on it's edge. + * + * Orientations are as follows: + * @li ELM_PANEL_ORIENT_TOP + * @li ELM_PANEL_ORIENT_LEFT + * @li ELM_PANEL_ORIENT_RIGHT + * + * @ref tutorial_panel shows one way to use this widget. + * @{ + */ typedef enum _Elm_Panel_Orient { - ELM_PANEL_ORIENT_TOP, - ELM_PANEL_ORIENT_BOTTOM, - ELM_PANEL_ORIENT_LEFT, - ELM_PANEL_ORIENT_RIGHT, + ELM_PANEL_ORIENT_TOP, /**< Panel (dis)appears from the top */ + ELM_PANEL_ORIENT_BOTTOM, /**< Not implemented */ + ELM_PANEL_ORIENT_LEFT, /**< Panel (dis)appears from the left */ + ELM_PANEL_ORIENT_RIGHT, /**< Panel (dis)appears from the right */ } Elm_Panel_Orient; - + /** + * @brief Adds a panel object + * + * @param parent The parent object + * + * @return The panel object, or NULL on failure + */ EAPI Evas_Object *elm_panel_add(Evas_Object *parent) EINA_ARG_NONNULL(1); + /** + * @brief Sets the orientation of the panel + * + * @param parent The parent object + * @param orient The panel orientation. Can be one of the following: + * @li ELM_PANEL_ORIENT_TOP + * @li ELM_PANEL_ORIENT_LEFT + * @li ELM_PANEL_ORIENT_RIGHT + * + * Sets from where the panel will (dis)appear. + */ EAPI void elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) EINA_ARG_NONNULL(1); + /** + * @brief Get the orientation of the panel. + * + * @param obj The panel object + * @return The Elm_Panel_Orient, or ELM_PANEL_ORIENT_LEFT on failure. + */ EAPI Elm_Panel_Orient elm_panel_orient_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * @brief Set the content of the panel. + * + * @param obj The panel object + * @param content The panel content + * + * 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_panel_content_unset() function. + */ EAPI void elm_panel_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1); + /** + * @brief Get the content of the panel. + * + * @param obj The panel object + * @return The content that is being used + * + * Return the content object which is set for this widget. + * + * @see elm_panel_content_set() + */ EAPI Evas_Object *elm_panel_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * @brief Unset the content of the panel. + * + * @param obj The panel object + * @return The content that was being used + * + * Unparent and return the content object which was set for this widget. + * + * @see elm_panel_content_set() + */ EAPI Evas_Object *elm_panel_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * @brief Set the state of the panel. + * + * @param obj The panel object + * @param hidden If true, the panel will run the animation to contract + */ EAPI void elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) EINA_ARG_NONNULL(1); + /** + * @brief Get the state of the panel. + * + * @param obj The panel object + * @param hidden If true, the panel is in the "hide" state + */ EAPI Eina_Bool elm_panel_hidden_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * @brief Toggle the hidden state of the panel from code + * + * @param obj The panel object + */ EAPI void elm_panel_toggle(Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * @} + */ /* panes */ /** diff --git a/legacy/elementary/src/lib/elm_panel.c b/legacy/elementary/src/lib/elm_panel.c index 22dc073d7e..6ee23504cc 100644 --- a/legacy/elementary/src/lib/elm_panel.c +++ b/legacy/elementary/src/lib/elm_panel.c @@ -1,22 +1,6 @@ #include #include "elm_priv.h" -/** - * @defgroup Panel Panel - * - * A panel is a type of animated container that contains subobjects. It - * can be expanded or contracted. - * - * Orientations are as follows: - * ELM_PANEL_ORIENT_TOP - * ELM_PANEL_ORIENT_BOTTOM - * ELM_PANEL_ORIENT_LEFT - * ELM_PANEL_ORIENT_RIGHT - * NOTE: Only LEFT and RIGHT orientations are implemented. - * - * THIS WIDGET IS UNDER CONSTRUCTION! - */ - typedef struct _Widget_Data Widget_Data; struct _Widget_Data { @@ -239,15 +223,6 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty return EINA_TRUE; } -/** - * Adds a panel object - * - * @param parent The parent object - * - * @return The panel object, or NULL on failure - * - * @ingroup Panel - */ EAPI Evas_Object * elm_panel_add(Evas_Object *parent) { @@ -300,20 +275,6 @@ elm_panel_add(Evas_Object *parent) return obj; } -/** - * Sets the orientation of the panel - * - * @param parent The parent object - * @param orient The panel orientation. Can be one of the following: - * ELM_PANEL_ORIENT_TOP - * ELM_PANEL_ORIENT_BOTTOM - * ELM_PANEL_ORIENT_LEFT - * ELM_PANEL_ORIENT_RIGHT - * - * NOTE: Only LEFT and RIGHT orientations are implemented. - * - * @ingroup Panel - */ EAPI void elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) { @@ -346,14 +307,6 @@ elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) _sizing_eval(obj); } -/** - * Get the orientation of the panel. - * - * @param obj The panel object - * @return The Elm_Panel_Orient, or ELM_PANEL_ORIENT_LEFT on failure. - * - * @ingroup Panel - */ EAPI Elm_Panel_Orient elm_panel_orient_get(const Evas_Object *obj) { @@ -363,18 +316,6 @@ elm_panel_orient_get(const Evas_Object *obj) return wd->orient; } -/** - * Set the content of the panel. - * - * 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_panel_content_unset() function. - * - * @param obj The panel object - * @param content The panel content - * - * @ingroup Panel - */ EAPI void elm_panel_content_set(Evas_Object *obj, Evas_Object *content) { @@ -393,16 +334,6 @@ elm_panel_content_set(Evas_Object *obj, Evas_Object *content) _sizing_eval(obj); } -/** - * Get the content of the panel. - * - * Return the content object which is set for this widget. - * - * @param obj The panel object - * @return The content that is being used - * - * @ingroup Panel - */ EAPI Evas_Object * elm_panel_content_get(const Evas_Object *obj) { @@ -412,16 +343,6 @@ elm_panel_content_get(const Evas_Object *obj) return wd->content; } -/** - * Unset the content of the panel. - * - * Unparent and return the content object which was set for this widget. - * - * @param obj The panel object - * @return The content that was being used - * - * @ingroup Panel - */ EAPI Evas_Object * elm_panel_content_unset(Evas_Object *obj) { @@ -436,14 +357,6 @@ elm_panel_content_unset(Evas_Object *obj) return content; } -/** - * Set the state of the panel. - * - * @param obj The panel object - * @param hidden If true, the panel will run the edje animation to contract - * - * @ingroup Panel - */ EAPI void elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) { @@ -454,14 +367,6 @@ elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); } -/** - * Get the state of the panel. - * - * @param obj The panel object - * @param hidden If true, the panel is in the "hide" state - * - * @ingroup Panel - */ EAPI Eina_Bool elm_panel_hidden_get(const Evas_Object *obj) { @@ -471,13 +376,6 @@ elm_panel_hidden_get(const Evas_Object *obj) return wd->hidden; } -/** - * Toggle the state of the panel from code - * - * @param obj The panel object - * - * @ingroup Panel - */ EAPI void elm_panel_toggle(Evas_Object *obj) {