#include <Elementary.h>
#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!
- */
+#include "els_scroller.h"
+#include "els_box.h"
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
}
static void
-_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
+_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
}
static void
-_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
+_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
{
Widget_Data *wd = elm_widget_data_get(obj);
edje_object_signal_callback_del_full(
return EINA_TRUE;
}
-/**
- * Adds a panel object
- *
- * @param parent The parent object
- *
- * @return The panel object, or NULL on failure
- *
- * @ingroup Panel
- */
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd;
+
+ if (part && strcmp(part, "default")) return;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->content == content) return;
+ if (wd->content)
+ evas_object_box_remove_all(wd->bx, EINA_TRUE);
+ wd->content = content;
+ if (content)
+ {
+ evas_object_box_append(wd->bx, wd->content);
+ evas_object_show(wd->content);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd;
+
+ if (part && strcmp(part, "default")) return NULL;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->content;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd;
+ Evas_Object *content;
+ if (part && strcmp(part, "default")) return NULL;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (!wd->content) return NULL;
+ content = wd->content;
+ evas_object_box_remove_all(wd->bx, EINA_FALSE);
+ wd->content = NULL;
+ return content;
+}
+
EAPI Evas_Object *
elm_panel_add(Evas_Object *parent)
{
elm_widget_focus_next_hook_set(obj, _elm_panel_focus_next_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_event_hook_set(obj, _event_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);
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)
{
_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)
{
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)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->content == content) return;
- if (wd->content)
- evas_object_box_remove_all(wd->bx, EINA_TRUE);
- wd->content = content;
- if (content)
- {
- evas_object_box_append(wd->bx, wd->content);
- evas_object_show(wd->content);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, NULL, content);
}
-/**
- * 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)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->content;
+ return _content_get_hook(obj, NULL);
}
-/**
- * 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)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *content;
- if (!wd) return NULL;
- if (!wd->content) return NULL;
- content = wd->content;
- evas_object_box_remove_all(wd->bx, EINA_FALSE);
- wd->content = NULL;
- return content;
+ return _content_unset_hook(obj, NULL);
}
-/**
- * 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)
{
_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)
{
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)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->hidden = !(wd->hidden);
_toggle_panel(obj, NULL, "elm,action,panel,toggle", "*");
}