Elementary: panes documentation

SVN revision: 61809
This commit is contained in:
Bruno Dilly 2011-07-27 17:06:40 +00:00
parent e51dcb01b5
commit 7da46cfbbe
11 changed files with 4563 additions and 79 deletions

View File

@ -33,6 +33,7 @@ WGT_PREVIEW = \
label:preview-00.png:widget_preview_label:70:30 \
clock:preview-00.png:widget_preview_clock:200:100 \
slider:preview-00.png:widget_preview_slider:200:100 \
panes:preview-00.png:widget_preview_panes:200:100 \
ctxpopup:preview-00.png:widget_preview_ctxpopup:200:130 \
icon:preview-00.png:widget_preview_icon:50:50 \
image:preview-00.png:widget_preview_image:50:50 \

View File

@ -35,6 +35,8 @@
*
* @ref slider_example
*
* @ref panes_example
*
* @ref clock_example
*
* @ref diskselector_example_01
@ -1580,6 +1582,118 @@
* @example slider_example.c
*/
/**
* @page panes_example Panes widget example
*
* This code places two Elementary panes widgets on a window, one of them
* displayed vertically and the other horizontally, to exemplify
* a part of the widget's API. Also, all the signals emitted by this
* widget will be covered.
*
* Let's start adding a panes to our window:
* @dontinclude panes_example.c
* @skipline elm_panes_add
* @until evas_object_show
*
* Now we will set a content (a simple button) to the left side of our
* panes widget:
* @skipline elm_button_add
* @until content_left_set
*
* The content of the right side will be something a bit more elaborated, we'll
* place another panes, displayed vertically (it's displayed horizontally
* by default):
* @skipline elm_panes_add
* @until content_right_set
*
* When populating a panes displayed vertically, remember that left content
* will be placed at top, and right content will place at bottom. Next
* we will add two buttons to exemplify that:
* @skipline elm_button_add
* @until content_right_set
*
* Panes widgets emits 4 different signals, depending on users interaction
* with the draggable bar. We'll add a callback function for each of them.
*
* <tt> "clicked" signal </tt>:
*
* Callback function that just print "Clicked" to stdin:
* @dontinclude panes_example.c
* @skip static void
* @skip }
* @skip static void
* @skip }
* @skip static void
* @skip }
* @skipline static void
* @until }
*
* Also, add callback function to the panes:
* @skipline "clicked"
*
* <tt> "press" signal </tt>:
*
* Callback function that just print "Pressed" to stdin:
* @dontinclude panes_example.c
* @skip static void
* @skip }
* @skipline static void
* @until }
*
* Also, add callback function to the panes:
* @skipline "press"
*
* Now, let's try to make our callback functions a bit more useful:
*
* <tt> "unpress" signal </tt>:
*
* Suppose we want to know the size proportion of left content after
* user drags the bar. We need to listen for @c unpress signal, and
* get this size from our panes widget. It's done on the following
* function:
* @dontinclude panes_example.c
* @skip static void
* @skip }
* @skip static void
* @skip }
* @skipline static void
* @until }
*
* Adding the callback function to the panes:
* @skipline "unpress"
* <tt> "clicked,double" signal </tt>:
*
* Now, a interesting feature that could be addded to panes widget.
* Hide a content when user double click the draggable bar. It's done
* using a variable to store size and content left size getter and setter
* on the following function:
* @dontinclude panes_example.c
* @skipline static double
* @skip static void
* @skip }
* @skip static void
* @skip }
* @skip static void
* @skip }
* @skipline static void
* @until }
* @until }
* @until }
*
* Adding the callback function to the panes:
* @skipline "clicked,double"
* @until panes);
*
* See the full @ref panes_example.c "example", whose window should
* look like this picture:
*
* @image html screenshots/panes_example.png
* @image latex screenshots/panes_example.eps width=\textwidth
*
* @example panes_example.c
*/
/**
* @page clock_example Clock widget example
*

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -148,6 +148,11 @@
* @image html img/widget/panel/preview-00.png
* @image latex img/widget/panel/preview-00.eps
* @li @ref Panes
*
* @image html img/widget/panes/preview-00.png
* @image latex img/widget/panes/preview-00.eps
* @image html img/panes.png
* @image latex img/panes.eps
* @li @ref Photo
* @li @ref Photocam
* @li @ref Progressbar

View File

@ -48,6 +48,7 @@ widget_preview_clock \
widget_preview_label \
widget_preview_frame \
widget_preview_slider \
widget_preview_panes \
widget_preview_ctxpopup \
widget_preview_icon \
widget_preview_image \
@ -101,6 +102,7 @@ EXTRA_DIST = \
widget_preview_colorselector.c \
widget_preview_conformant.c \
widget_preview_slider.c \
widget_preview_panes.c \
widget_preview_ctxpopup.c \
widget_preview_diskselector.c \
widget_preview_entry1.c \

View File

@ -0,0 +1,22 @@
#include "widget_preview_tmpl_head.c"
Evas_Object *panes = elm_panes_add(win);
evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, panes);
evas_object_show(panes);
Evas_Object *bt = elm_button_add(win);
elm_object_text_set(bt, "Left");
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, -1.0, -1.0);
evas_object_show(bt);
elm_panes_content_left_set(panes, bt);
bt = elm_button_add(win);
elm_object_text_set(bt, "Right");
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, -1.0, -1.0);
evas_object_show(bt);
elm_panes_content_right_set(panes, bt);
#include "widget_preview_tmpl_foot.c"

View File

@ -85,6 +85,7 @@ SRCS = \
theme_example.edc \
layout_example.edc \
slider_example.c \
panes_example.c \
ctxpopup_example_01.c \
pager_example_01.c \
separator_example_01.c \
@ -158,6 +159,7 @@ pkglib_PROGRAMS += \
list_example_02 \
list_example_03 \
slider_example \
panes_example \
ctxpopup_example_01 \
flipselector_example \
fileselector_example \
@ -222,6 +224,7 @@ SCREENSHOTS = \
fileselector_example:fileselector_example.png:0.0 \
index_example_02:index_example_03.png:0.3 \
slider_example:slider_example.png:0.0 \
panes_example:panes_example.png:0.0 \
ctxpopup_example_01:ctxpopup_example_01.png:0.0 \
pager_example_01:pager_example_01.png:0.0 \
separator_example_01:separator_example_01.png:0.0 \

View File

@ -0,0 +1,125 @@
/**
* Simple Elementary's <b>panes widget</b> example, illustrating its
* usage and API.
*
* See stdout/stderr for output. Compile with:
*
* @verbatim
* gcc -g `pkg-config --cflags --libs elementary` panes_example.c -o panes_example
* @endverbatim
*/
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define __UNUSED__
#endif
static void
_on_done(void *data __UNUSED__,
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
elm_exit();
}
static double size = 0.0;
static void
_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("Pressed\n");
}
static void
_unpress(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
printf("Unpressed, size : %f\n", elm_panes_content_left_size_get(obj));
}
static void
_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("Clicked\n");
}
static void
_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
if (elm_panes_content_left_size_get(obj) > 0)
{
size = elm_panes_content_left_size_get(obj);
elm_panes_content_left_size_set(obj, 0.0);
printf("Double clicked, hidding.\n");
}
else
{
elm_panes_content_left_size_set(obj, size);
printf("Double clicked, restoring size.\n");
}
}
int
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
{
Evas_Object *win, *bg, *panes, *panes_h, *bt;
win = elm_win_add(NULL, "panes", ELM_WIN_BASIC);
elm_win_title_set(win, "Panes Example");
evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
evas_object_show(bg);
panes = elm_panes_add(win);
elm_win_resize_object_add(win, panes);
evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(panes);
bt = elm_button_add(win);
elm_object_text_set(bt, "Left");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bt);
elm_panes_content_left_set(panes, bt);
panes_h = elm_panes_add(win);
elm_panes_horizontal_set(panes_h, EINA_TRUE);
evas_object_size_hint_weight_set(panes_h, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(panes_h);
elm_panes_content_right_set(panes, panes_h);
bt = elm_button_add(win);
elm_object_text_set(bt, "Up");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bt);
elm_panes_content_left_set(panes_h, bt);
bt = elm_button_add(win);
elm_object_text_set(bt, "Down");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bt);
elm_panes_content_right_set(panes_h, bt);
evas_object_smart_callback_add(panes, "clicked", _clicked, panes);
evas_object_smart_callback_add(panes, "clicked,double", _clicked_double,
panes);
evas_object_smart_callback_add(panes, "press", _press, panes);
evas_object_smart_callback_add(panes, "unpress", _unpress, panes);
evas_object_resize(win, 320, 400);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -11064,7 +11064,7 @@ extern "C" {
/**
* Set the orientation of a given slider widget.
*
* @param obj The slider object>
* @param obj The slider object.
* @param horizontal Use @c EINA_TRUE to make @p obj to be
* @b horizontal, @c EINA_FALSE to make it @b vertical.
*
@ -14413,25 +14413,225 @@ extern "C" {
* @}
*/
/* panes */
/**
* TODO
* @defgroup Panes Panes
* @ingroup Elementary
*
* Update the minimun height of the bar in the theme. No minimun should be set in the vertical theme
* Add events (move, start ...)
* @image html img/widget/panes/preview-00.png
* @image latex img/widget/panes/preview-00.eps width=\textwidth
*
* @image html img/panes.png
* @image latex img/panes.eps width=\textwidth
*
* The panes adds a dragable bar between two contents. When dragged
* this bar will resize contents size.
*
* Panes can be displayed vertically or horizontally, and contents
* size proportion can be customized (homogeneous by default).
*
* Smart callbacks one can listen to:
* - "press" - The panes has been pressed (button wasn't released yet).
* - "unpressed" - The panes was released after being pressed.
* - "clicked" - The panes has been clicked>
* - "clicked,double" - The panes has been double clicked
*
* Available styles for it:
* - @c "default"
*
* Here is an example on its usage:
* @li @ref panes_example
*/
/**
* @addtogroup Panes
* @{
*/
/**
* Add a new panes widget to the given parent Elementary
* (container) object.
*
* @param parent The parent object.
* @return a new panes widget handle or @c NULL, on errors.
*
* This function inserts a new panes widget on the canvas.
*
* @ingroup Panes
*/
EAPI Evas_Object *elm_panes_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
/**
* Set the left content of the panes widget.
*
* @param obj The panes object.
* @param content The new left content object.
*
* 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_panes_content_left_unset() function.
*
* If panes is displayed vertically, left content will be displayed at
* top.
*
* @see elm_panes_content_left_get()
* @see elm_panes_content_right_set() to set content on the other side.
*
* @ingroup Panes
*/
EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
/**
* Set the right content of the panes widget.
*
* @param obj The panes object.
* @param content The new right content object.
*
* 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_panes_content_right_unset() function.
*
* If panes is displayed vertically, left content will be displayed at
* bottom.
*
* @see elm_panes_content_right_get()
* @see elm_panes_content_left_set() to set content on the other side.
*
* @ingroup Panes
*/
EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
/**
* Get the left content of the panes.
*
* @param obj The panes object.
* @return The left content object that is being used.
*
* Return the left content object which is set for this widget.
*
* @see elm_panes_content_left_set() for details.
*
* @ingroup Panes
*/
EAPI Evas_Object *elm_panes_content_left_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Get the right content of the panes.
*
* @param obj The panes object
* @return The right content object that is being used
*
* Return the right content object which is set for this widget.
*
* @see elm_panes_content_right_set() for details.
*
* @ingroup Panes
*/
EAPI Evas_Object *elm_panes_content_right_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Unset the left content used for the panes.
*
* @param obj The panes object.
* @return The left content object that was being used.
*
* Unparent and return the left content object which was set for this widget.
*
* @see elm_panes_content_left_set() for details.
* @see elm_panes_content_left_get().
*
* @ingroup Panes
*/
EAPI Evas_Object *elm_panes_content_left_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Unset the right content used for the panes..
*
* @param obj The panes object.
* @return The right content object that was being used.
*
* Unparent and return the right content object which was set for this
* widget.
*
* @see elm_panes_content_right_set() for details.
* @see elm_panes_content_right_get().
*
* @ingroup Panes
*/
EAPI Evas_Object *elm_panes_content_right_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Get the size proportion of panes widget's left side.
*
* @param obj The panes object.
* @return float value between 0.0 and 1.0 representing size proportion
* of left side.
*
* @see elm_panes_content_left_size_set() for more details.
*
* @ingroup Panes
*/
EAPI double elm_panes_content_left_size_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the size proportion of panes widget's left side.
*
* @param obj The panes object.
* @param size Value between 0.0 and 1.0 representing size proportion
* of left side.
*
* By default it's homogeneous, i.e., both sides have the same size.
*
* If something different is required, it can be set with this function.
* For example, if the left content should be displayed over
* 75% of the panes size, @p size should be passed as @c 0.75.
* This way, right content will be resized to 25% of panes size.
*
* If displayed vertically, left content is displayed at top, and
* right content at bottom.
*
* @note This proportion will change when user drags the panes bar.
*
* @see elm_panes_content_left_size_get()
*
* @ingroup Panes
*/
EAPI void elm_panes_content_left_size_set(Evas_Object *obj, double size) EINA_ARG_NONNULL(1);
/**
* Set the orientation of a given panes widget.
*
* @param obj The panes object.
* @param horizontal Use @c EINA_TRUE to make @p obj to be
* @b horizontal, @c EINA_FALSE to make it @b vertical.
*
* Use this function to change how your panes is to be
* disposed: vertically or horizontally.
*
* By default it's displayed horizontally.
*
* @see elm_panes_horizontal_get()
*
* @ingroup Panes
*/
EAPI void elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) EINA_ARG_NONNULL(1);
/**
* Retrieve the orientation of a given panes widget.
*
* @param obj The panes object.
* @return @c EINA_TRUE, if @p obj is set to be @b horizontal,
* @c EINA_FALSE if it's @b vertical (and on errors).
*
* @see elm_panes_horizontal_set() for more details.
*
* @ingroup Panes
*/
EAPI Eina_Bool elm_panes_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @}
*/
/**
* @defgroup Flip Flip
*

View File

@ -2,8 +2,10 @@
#include "elm_priv.h"
/**
* @defgroup Panes Panes
*
* TODO
* Update the minimun height of the bar in the theme.
* No minimun should be set in the vertical theme
* Add events (move, start ...)
*/
typedef struct _Widget_Data Widget_Data;
@ -209,14 +211,6 @@ _unpress(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED
}
}
/**
* Add a new panes to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Panes
*/
EAPI Evas_Object *
elm_panes_add(Evas_Object *parent)
{
@ -263,18 +257,6 @@ elm_panes_add(Evas_Object *parent)
}
/**
* Set the left content of the panes widget.
*
* 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_panes_content_left_unset() function.
*
* @param obj The panes object
* @param content The new left content object
*
* @ingroup Panes
*/
EAPI void
elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content)
{
@ -293,18 +275,6 @@ elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content)
}
}
/**
* Set the right content of the panes widget.
*
* 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_panes_content_right_unset() function.
*
* @param obj The panes object
* @param content The new right content object
*
* @ingroup Panes
*/
EAPI void
elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content)
{
@ -323,16 +293,6 @@ elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content)
}
}
/**
* Get the left content used for the panes
*
* Return the left content object which is set for this widget.
*
* @param obj The panes object
* @return The left content object that is being used
*
* @ingroup Panes
*/
EAPI Evas_Object *
elm_panes_content_left_get(const Evas_Object *obj)
{
@ -341,16 +301,6 @@ elm_panes_content_left_get(const Evas_Object *obj)
return wd->contents.left;
}
/**
* Get the right content used for the panes
*
* Return the right content object which is set for this widget.
*
* @param obj The panes object
* @return The right content object that is being used
*
* @ingroup Panes
*/
EAPI Evas_Object *
elm_panes_content_right_get(const Evas_Object *obj)
{
@ -359,16 +309,6 @@ elm_panes_content_right_get(const Evas_Object *obj)
return wd->contents.right;
}
/**
* Unset the left content used for the panes
*
* Unparent and return the left content object which was set for this widget.
*
* @param obj The panes object
* @return The left content object that was being used
*
* @ingroup Panes
*/
EAPI Evas_Object *
elm_panes_content_left_unset(Evas_Object *obj)
{
@ -383,16 +323,6 @@ elm_panes_content_left_unset(Evas_Object *obj)
return content;
}
/**
* Unset the right content used for the panes
*
* Unparent and return the right content object which was set for this widget.
*
* @param obj The panes object
* @return The right content object that was being used
*
* @ingroup Panes
*/
EAPI Evas_Object *
elm_panes_content_right_unset(Evas_Object *obj)
{