[Pkg-e-commits] [SCM] Enlightenment DR17 toolkit based (based on the EFL) branch, upstream-vcs, updated. 447de88121d145a078f1754a0cfebb704d363821

titan titan at alioth.debian.org
Sat Jun 7 18:34:46 UTC 2008


The following commit has been merged in the upstream-vcs branch:
commit 447de88121d145a078f1754a0cfebb704d363821
Author: titan <titan>
Date:   Mon May 19 22:11:09 2008 +0000

    Add ewl_freebox_mvc which is a mvc frontend for ewl_freebox.

diff --git a/configure.in b/configure.in
index aa1f694..4f59d66 100644
--- a/configure.in
+++ b/configure.in
@@ -286,6 +286,7 @@ src/bin/tests/filedialog/Makefile
 src/bin/tests/filepicker/Makefile
 src/bin/tests/floater/Makefile
 src/bin/tests/freebox/Makefile
+src/bin/tests/freebox_mvc/Makefile
 src/bin/tests/fullscreen/Makefile
 src/bin/tests/grid/Makefile
 src/bin/tests/histogram/Makefile
diff --git a/src/bin/tests/Makefile.am b/src/bin/tests/Makefile.am
index bc15ae2..4179b6c 100644
--- a/src/bin/tests/Makefile.am
+++ b/src/bin/tests/Makefile.am
@@ -21,6 +21,7 @@ SUBDIRS				= \
 	filepicker \
 	floater \
 	freebox \
+	freebox_mvc \
 	fullscreen \
 	grid \
 	histogram \
diff --git a/src/bin/tests/freebox/Makefile.am b/src/bin/tests/freebox_mvc/Makefile.am
similarity index 57%
copy from src/bin/tests/freebox/Makefile.am
copy to src/bin/tests/freebox_mvc/Makefile.am
index 62b07ae..bafac32 100644
--- a/src/bin/tests/freebox/Makefile.am
+++ b/src/bin/tests/freebox_mvc/Makefile.am
@@ -16,13 +16,13 @@ if EWL_TESTS_BUILD
 
 pkgdir = $(libdir)/ewl/tests
 
-pkg_LTLIBRARIES = ewl_freebox_test.la
+pkg_LTLIBRARIES = ewl_freebox_mvc_test.la
 
-ewl_freebox_test_la_SOURCES = ewl_freebox_test.c
-ewl_freebox_test_la_LIBADD = $(top_builddir)/src/lib/libewl.la
-ewl_freebox_test_la_LDFLAGS = -module @create_shared_lib@ -avoid-version
+ewl_freebox_mvc_test_la_SOURCES = ewl_freebox_mvc_test.c
+ewl_freebox_mvc_test_la_LIBADD = $(top_builddir)/src/lib/libewl.la
+ewl_freebox_mvc_test_la_LDFLAGS = -module @create_shared_lib@ -avoid-version
 
-FILES = $(ewl_freebox_test_la_SOURCES)
+FILES = $(ewl_freebox_mvc_test_la_SOURCES)
 
 exampledir = $(pkgdatadir)/examples/
 example_DATA = $(FILES)
diff --git a/src/bin/tests/freebox_mvc/ewl_freebox_mvc_test.c b/src/bin/tests/freebox_mvc/ewl_freebox_mvc_test.c
new file mode 100644
index 0000000..f3f8144
--- /dev/null
+++ b/src/bin/tests/freebox_mvc/ewl_freebox_mvc_test.c
@@ -0,0 +1,226 @@
+/* vim: set sw=8 ts=8 sts=8 noexpandtab: */
+#include "Ewl_Test.h"
+#include "ewl_test_private.h"
+#include "ewl_button.h"
+#include "ewl_freebox.h"
+#include "ewl_freebox_mvc.h"
+#include "ewl_icon.h"
+#include "ewl_scrollpane.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct Freebox_MVC_Test_Row_Data Freebox_MVC_Test_Row_Data;
+struct Freebox_MVC_Test_Row_Data
+{
+        char *image;
+        char *text;
+};
+
+static int create_test(Ewl_Container *box);
+static void ewl_freebox_mvc_test_cb_add(Ewl_Widget *w, void *ev, void *data);
+static void ewl_freebox_mvc_test_cb_clear(Ewl_Widget *w, void *ev, void *data);
+static void ewl_freebox_mvc_test_data_append(Ecore_List *d);
+
+static void                 *ewl_freebox_mvc_test_data_setup();
+static Ewl_Widget           *ewl_freebox_mvc_test_widget_fetch(void *data, 
+                                                               unsigned int row, 
+                                                               unsigned int col);
+static void                 *ewl_freebox_mvc_test_data_fetch(void *data, 
+                                                             unsigned int row, 
+                                                             unsigned int column);
+static unsigned int          ewl_freebox_mvc_test_data_count_get(void *data);
+
+void
+test_info(Ewl_Test *test)
+{
+        test->name = "Freebox MVC";
+        test->tip = "Defines a widget for laying out other\n"
+                    "widgets in a free like manner using MVC.";
+        test->filename = __FILE__;
+        test->func = create_test;
+        test->type = EWL_TEST_TYPE_CONTAINER;
+}
+
+static int
+create_test(Ewl_Container *box)
+{
+        Ewl_Widget *fb_mvc, *hbox, *pane, *o, *vbox;
+        Ewl_Model *model;
+        Ewl_View *view;
+        
+        void *data;
+
+        ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_ALL);
+
+        vbox = ewl_vbox_new();
+        ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
+        ewl_container_child_append(EWL_CONTAINER(box), vbox);
+        ewl_widget_show(vbox);
+
+        pane = ewl_scrollpane_new();
+        ewl_container_child_append(EWL_CONTAINER(vbox), pane);
+        ewl_widget_show(pane);
+
+        model = ewl_model_new();
+        ewl_model_data_fetch_set(model, ewl_freebox_mvc_test_data_fetch);
+        ewl_model_data_count_set(model, ewl_freebox_mvc_test_data_count_get);
+
+        view = ewl_view_new();
+        ewl_view_widget_fetch_set(view, ewl_freebox_mvc_test_widget_fetch);
+        ewl_view_header_fetch_set(view, NULL);
+
+        data = ewl_freebox_mvc_test_data_setup();
+
+        fb_mvc = ewl_freebox_mvc_new();
+        ewl_mvc_model_set(EWL_MVC(fb_mvc), model);
+        ewl_mvc_view_set(EWL_MVC(fb_mvc), view);
+        ewl_mvc_data_set(EWL_MVC(fb_mvc), data);
+        ewl_mvc_selection_mode_set(EWL_MVC(fb_mvc), EWL_SELECTION_MODE_MULTI);
+        ewl_container_child_append(EWL_CONTAINER(pane), fb_mvc);
+        ewl_widget_show(fb_mvc);
+
+        hbox = ewl_hbox_new();
+        ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE);
+        ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
+        ewl_widget_show(hbox);
+
+        o = ewl_button_new();
+        ewl_button_label_set(EWL_BUTTON(o), "Add items");
+        ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+        ewl_container_child_append(EWL_CONTAINER(hbox), o);
+        ewl_callback_append(o, EWL_CALLBACK_CLICKED, 
+                               ewl_freebox_mvc_test_cb_add, fb_mvc);
+        ewl_widget_show(o);
+
+        o = ewl_button_new();
+        ewl_button_label_set(EWL_BUTTON(o), "Clear items");
+        ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+        ewl_container_child_append(EWL_CONTAINER(hbox), o);
+        ewl_callback_append(o, EWL_CALLBACK_CLICKED, 
+                               ewl_freebox_mvc_test_cb_clear, fb_mvc);
+        ewl_widget_show(o);
+
+        return 1;
+}
+
+static void *
+ewl_freebox_mvc_test_data_setup(void)
+{
+        Ecore_List *d;
+
+        d = ecore_list_new();
+
+        ewl_freebox_mvc_test_data_append(d);
+        
+        return d;
+}
+
+static Ewl_Widget *
+ewl_freebox_mvc_test_widget_fetch(void *data, unsigned int row __UNUSED__,
+                                              unsigned int col __UNUSED__)
+{
+        Ewl_Widget *w;
+        Freebox_MVC_Test_Row_Data *d;
+
+        d = data;
+
+        w = ewl_icon_simple_new();
+        ewl_icon_image_set(EWL_ICON(w), d->image, NULL);
+        ewl_icon_label_set(EWL_ICON(w), d->text);
+        ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+        ewl_object_minimum_size_set(EWL_OBJECT(w), 32, 32);
+        ewl_widget_show(w);
+
+        return w;
+};
+
+static void *
+ewl_freebox_mvc_test_data_fetch(void *data, unsigned int row, 
+                                            unsigned int column)
+{
+        Ecore_List *d;
+
+        d = data;
+
+        if (row >= ecore_list_count(d))
+        {
+                printf("Asking for too many items\n");
+                return NULL;
+        }
+
+        return ecore_list_index_goto(d, row);
+}
+
+static unsigned int
+ewl_freebox_mvc_test_data_count_get(void *data)
+{
+        Ecore_List *d;
+
+        d = data;
+
+        return ecore_list_count(d);
+}
+
+static void 
+ewl_freebox_mvc_test_cb_add(Ewl_Widget *w, void *ev, void *data)
+{
+        Ecore_List *d;
+
+        d = ewl_mvc_data_get(EWL_MVC(data));
+        if (!d)
+                d = ecore_list_new();
+        ewl_freebox_mvc_test_data_append(d);
+        ewl_mvc_data_set(EWL_MVC(data), d);
+        ewl_mvc_dirty_set(EWL_MVC(data), TRUE);
+}
+
+static void
+ewl_freebox_mvc_test_cb_clear(Ewl_Widget *w, void *ev, void *data)
+{
+        Ecore_List *d;
+
+        d = ewl_mvc_data_get(EWL_MVC(data));
+        d = NULL;
+        ewl_mvc_data_set(EWL_MVC(data), d);
+        ewl_mvc_dirty_set(EWL_MVC(data), TRUE);
+        ewl_container_reset(EWL_CONTAINER(data));
+}
+
+static void 
+ewl_freebox_mvc_test_data_append(Ecore_List *d)
+{
+        Freebox_MVC_Test_Row_Data *data;
+
+        data = calloc(1, sizeof(Freebox_MVC_Test_Row_Data));
+        data->image = strdup(PACKAGE_DATA_DIR "/ewl/images/Draw.png");
+        data->text = strdup("Draw");
+        ecore_list_append(d, data);
+
+        data = calloc(1, sizeof(Freebox_MVC_Test_Row_Data));
+        data->image = strdup(PACKAGE_DATA_DIR "/ewl/images/End.png");
+        data->text = strdup("End");
+        ecore_list_append(d, data);
+
+        data = calloc(1, sizeof(Freebox_MVC_Test_Row_Data));
+        data->image = strdup(PACKAGE_DATA_DIR "/ewl/images/NewBCard.png");
+        data->text = strdup("Card");
+        ecore_list_append(d, data);
+
+        data = calloc(1, sizeof(Freebox_MVC_Test_Row_Data));
+        data->image = strdup(PACKAGE_DATA_DIR "/ewl/images/Open.png");
+        data->text = strdup("Open");
+        ecore_list_append(d, data);
+
+        data = calloc(1, sizeof(Freebox_MVC_Test_Row_Data));
+        data->image = strdup(PACKAGE_DATA_DIR "/ewl/images/Package.png");
+        data->text = strdup("Package");
+        ecore_list_append(d, data);
+
+        data = calloc(1, sizeof(Freebox_MVC_Test_Row_Data));
+        data->image = strdup(PACKAGE_DATA_DIR "/ewl/images/World.png");
+        data->text = strdup("World");
+        ecore_list_append(d, data);
+}
+
diff --git a/src/lib/Ewl.h b/src/lib/Ewl.h
index 1b273cf..f22f0e9 100644
--- a/src/lib/Ewl.h
+++ b/src/lib/Ewl.h
@@ -89,6 +89,7 @@ extern"C" {
 #include <ewl_list.h>
 
 #include <ewl_freebox.h>
+#include <ewl_freebox_mvc.h>
 
 #include <ewl_filelist.h>
 #include <ewl_filelist_model.h>
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index adeb199..88b883f 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -50,6 +50,7 @@ EWLHEADERS = \
 	ewl_filepicker.h \
 	ewl_filedialog.h \
 	ewl_freebox.h \
+	ewl_freebox_mvc.h \
 	ewl_grid.h \
 	ewl_histogram.h \
 	ewl_icon.h \
@@ -133,6 +134,7 @@ EWLSOURCES= \
 	ewl_filepicker.c \
 	ewl_filedialog.c \
 	ewl_freebox.c \
+	ewl_freebox_mvc.c \
 	ewl_grid.c \
 	ewl_histogram.c \
 	ewl_icon.c \
diff --git a/src/lib/ewl_freebox_mvc.c b/src/lib/ewl_freebox_mvc.c
new file mode 100644
index 0000000..960f5bf
--- /dev/null
+++ b/src/lib/ewl_freebox_mvc.c
@@ -0,0 +1,263 @@
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
+#include "ewl_base.h"
+#include "ewl_freebox.h"
+#include "ewl_freebox_mvc.h"
+#include "ewl_macros.h"
+#include "ewl_private.h"
+#include "ewl_debug.h"
+
+static Ewl_Widget *ewl_freebox_mvc_widget_at(Ewl_MVC *mvc, void *data,
+                                                           unsigned int row,
+                                                           unsigned int column);
+
+/**
+ * @return Returns a new horizontal Ewl_Freebox_MVC widget or NULL on failure
+ * @brief creates and initializes a new horizontal freebox mvc widget
+ */
+Ewl_Widget *
+ewl_hfreebox_mvc_new(void)
+{
+        DENTER_FUNCTION(DLEVEL_STABLE);
+
+        DRETURN_PTR(ewl_freebox_mvc_new(), DLEVEL_STABLE);
+}
+
+/**
+ * @return Returns a new vertical Ewl_Freebox_MVC widget or NULL on failure
+ * @brief creates and initializes a new vertical freebox mvc widget
+ */
+Ewl_Widget *
+ewl_vfreebox_mvc_new(void)
+{
+        Ewl_Widget *fb_mvc;
+
+        DENTER_FUNCTION(DLEVEL_STABLE);
+
+        fb_mvc = ewl_freebox_mvc_new();
+        ewl_freebox_orientation_set(EWL_FREEBOX(EWL_FREEBOX_MVC(fb_mvc)->freebox),
+                                    EWL_ORIENTATION_VERTICAL);
+        DRETURN_PTR(fb_mvc, DLEVEL_STABLE);
+}
+
+/**
+ * @return Returns a new Ewl_Widget on success or NULL on failure
+ * @brief Creates and initializes an Ewl_Freebox_MVC widget
+ */
+Ewl_Widget *
+ewl_freebox_mvc_new(void)
+{
+        Ewl_Widget *fb_mvc = NULL;
+
+        DENTER_FUNCTION(DLEVEL_STABLE);
+
+        fb_mvc = NEW(Ewl_Freebox_MVC, 1);
+        if (!fb_mvc)
+                DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+        if (!ewl_freebox_mvc_init(EWL_FREEBOX_MVC(fb_mvc)))
+        {
+                ewl_widget_destroy(fb_mvc);
+                fb_mvc = NULL;
+        }
+
+        DRETURN_PTR(fb_mvc, DLEVEL_STABLE);
+}
+
+/**
+ * @param fb_mvc: The fb_mvc to initialize
+ * @return Returns TRUE on success or FALSE on failure
+ * @brief Initializes an Ewl_Freebox_MVC widget to default values
+ */
+int
+ewl_freebox_mvc_init(Ewl_Freebox_MVC *fb_mvc)
+{
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR_RET(fb_mvc, FALSE);
+
+        if (!ewl_mvc_init(EWL_MVC(fb_mvc)))
+                DRETURN_INT(FALSE, DLEVEL_STABLE);
+        
+        ewl_widget_appearance_set(EWL_WIDGET(fb_mvc), EWL_FREEBOX_MVC_TYPE);
+        ewl_widget_inherit(EWL_WIDGET(fb_mvc), EWL_FREEBOX_MVC_TYPE);
+
+        fb_mvc->freebox = ewl_hfreebox_new();
+        ewl_container_child_append(EWL_CONTAINER(fb_mvc), 
+                                   fb_mvc->freebox);
+        ewl_container_redirect_set(EWL_CONTAINER(fb_mvc), 
+                                   EWL_CONTAINER(fb_mvc->freebox));
+        ewl_widget_show(fb_mvc->freebox);
+
+        ewl_mvc_selected_change_cb_set(EWL_MVC(fb_mvc), 
+                                       ewl_freebox_mvc_cb_selected_change);
+        ewl_callback_append(EWL_WIDGET(fb_mvc), EWL_CALLBACK_CONFIGURE,
+                            ewl_freebox_mvc_cb_configure, NULL);
+        DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
+/**
+ * @param fb_mvc: The freebox mvc to use
+ * @param orientation: The orientation to set
+ * @return Returns no value
+ * @brief Sets the orientation of the freebox mvc
+ */
+void
+ewl_freebox_mvc_orientation_set(Ewl_Freebox_MVC *fb_mvc, 
+                                Ewl_Orientation orientation)
+{
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR(fb_mvc);
+        DCHECK_TYPE(fb_mvc, EWL_FREEBOX_MVC_TYPE);
+
+        ewl_freebox_orientation_set(EWL_FREEBOX(fb_mvc->freebox),
+                                    orientation);
+        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param fb_mvc: The freebox mvc to use
+ * @return Returns the orientation of the freebox mvc
+ * brief Retrieve the current orientation of the freebox mvc
+ */
+Ewl_Orientation
+ewl_freebox_mvc_orientation_get(Ewl_Freebox_MVC *fb_mvc)
+{
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR_RET(fb_mvc, EWL_ORIENTATION_HORIZONTAL);
+        DCHECK_TYPE_RET(fb_mvc, EWL_FREEBOX_MVC_TYPE, 
+                                EWL_ORIENTATION_HORIZONTAL);
+
+        DRETURN_INT(ewl_freebox_orientation_get(EWL_FREEBOX(fb_mvc->freebox)),
+                    DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The fb_mvc to be configured
+ * @param ev: UNUSED
+ * @param data: UNUSED
+ * @return Returns no value
+ * @brief Configures the given list
+ */
+void
+ewl_freebox_mvc_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
+                                            void *data __UNUSED__)
+{
+        Ewl_Freebox_MVC *fb_mvc;
+        const Ewl_Model *model;
+        const Ewl_View *view;
+        void *mvc_data;
+        unsigned int i, count;
+
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR(w);
+        DCHECK_TYPE(w, EWL_FREEBOX_MVC_TYPE);
+
+        fb_mvc = EWL_FREEBOX_MVC(w);
+
+        model = ewl_mvc_model_get(EWL_MVC(fb_mvc));
+        view = ewl_mvc_view_get(EWL_MVC(fb_mvc));
+        mvc_data = ewl_mvc_data_get(EWL_MVC(fb_mvc));
+
+        if ((!ewl_mvc_dirty_get(EWL_MVC(fb_mvc))) 
+                        || !model || !view || !mvc_data)
+                DRETURN(DLEVEL_STABLE);
+        
+        ewl_container_reset(EWL_CONTAINER(fb_mvc));
+	 count = (unsigned int)model->count(mvc_data);
+	 for (i = 0; i < count; i++)
+        {
+                Ewl_Widget *o, *cell;
+
+                cell = ewl_cell_new();
+                ewl_cell_state_change_cb_add(EWL_CELL(cell));
+                ewl_container_child_append(EWL_CONTAINER(fb_mvc), cell);
+                ewl_callback_append(cell, EWL_CALLBACK_CLICKED, 
+                                    ewl_freebox_mvc_cb_item_clicked, fb_mvc);
+                ewl_widget_show(cell);
+
+                o = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
+                ewl_widget_show(o);
+
+                ewl_container_child_append(EWL_CONTAINER(cell), o);
+        }
+
+        ewl_freebox_mvc_cb_selected_change(EWL_MVC(fb_mvc));
+        ewl_mvc_dirty_set(EWL_MVC(fb_mvc), FALSE);
+
+        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The widget that was clicked
+ * @param ev: The event data
+ * @param data: The fb_mvc widget
+ * @return Returns no value
+ * @brief Sets the clicked widget as selected
+ */
+void
+ewl_freebox_mvc_cb_item_clicked(Ewl_Widget *w, void *ev __UNUSED__, void *data)
+{
+        const Ewl_Model *model;
+        void *mvc_data;
+        int row;
+
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR(w);
+        DCHECK_PARAM_PTR(data);
+        DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+        DCHECK_TYPE(data, EWL_FREEBOX_MVC_TYPE);
+
+        if (ewl_mvc_selection_mode_get(EWL_MVC(data)) == 
+                                       EWL_SELECTION_MODE_NONE)
+                DRETURN(DLEVEL_STABLE);
+
+        model = ewl_mvc_model_get(EWL_MVC(data));
+        mvc_data = ewl_mvc_data_get(EWL_MVC(data));
+        row = ewl_container_child_index_get(EWL_CONTAINER(data), w);
+        if (row < 0) DRETURN(DLEVEL_STABLE);
+
+        if ((unsigned int)row > model->count(mvc_data))
+        {
+                DWARNING("Don't use container functions on MVC widgets!.");
+                DRETURN(DLEVEL_STABLE);
+        }
+
+        ewl_mvc_handle_click(EWL_MVC(data), NULL, mvc_data, row, 0);
+
+        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param mvc: The MVC to work with
+ * @return Returns no value
+ * @brief Called when the selected widget changes
+ */
+void
+ewl_freebox_mvc_cb_selected_change(Ewl_MVC *mvc)
+{
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR(mvc);
+        DCHECK_TYPE(mvc, EWL_FREEBOX_MVC_TYPE);
+
+        ewl_mvc_highlight(mvc, EWL_CONTAINER(mvc), ewl_freebox_mvc_widget_at);
+        
+        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_freebox_mvc_widget_at(Ewl_MVC *mvc, void *data __UNUSED__, unsigned int row,
+                                        unsigned int column __UNUSED__)
+{
+        Ewl_Widget *w;
+
+        DENTER_FUNCTION(DLEVEL_STABLE);
+        DCHECK_PARAM_PTR_RET(mvc, NULL);
+        DCHECK_TYPE_RET(mvc, EWL_MVC_TYPE, NULL);
+
+        w = ewl_container_child_get(EWL_CONTAINER(mvc), row);
+
+        DRETURN_PTR(w, DLEVEL_STABLE);
+}
+
diff --git a/src/lib/ewl_freebox_mvc.h b/src/lib/ewl_freebox_mvc.h
new file mode 100644
index 0000000..c4ef5d4
--- /dev/null
+++ b/src/lib/ewl_freebox_mvc.h
@@ -0,0 +1,69 @@
+/* vim: set sw=8 ts=8 sts=8 expandtab: */
+#ifndef EWL_FREEBOX_MVC_H
+#define EWL_FREEBOX_MVC_H
+
+#include "ewl_mvc.h"
+
+/**
+ * @addtogroup Ewl_Freebox_MVC Ewl_Freebox_MVC: A free layout widget
+ * @brief Defines a class to layout data in a free form
+ *
+ * @remarks Inherits from Ewl_MVC.
+ * 
+ * @{
+ */
+
+/**
+ * @def EWL_FREEBOX_MVC_TYPE
+ * The type name of the Ewl_Freebox_MVC widget
+ */
+#define EWL_FREEBOX_MVC_TYPE "freebox_mvc"
+
+/**
+ * @def EWL_FREEBOX_MVC_IS(w)
+ * Returns TRUE if the widget is an Ewl_Freebox_MVC, otherwise FALSE
+ */
+#define EWL_FREEBOX_MVC_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_FREEBOX_MVC_TYPE))
+
+/**
+ * @def EWL_FREEBOX_MVC(freebox_mvc)
+ * Typecasts a pointer to an Ewl_Freebox_MVC pointer
+ */
+#define EWL_FREEBOX_MVC(box) ((Ewl_Freebox_MVC *)box)
+
+/**
+ * The freebox_mvc structure
+ */
+typedef struct Ewl_Freebox_MVC Ewl_Freebox_MVC;
+
+/**
+ * @breif Inherits from EWL_MVC and extends to provide a free layout widget
+ */
+struct Ewl_Freebox_MVC
+{
+        Ewl_MVC mvc;                /**< The mvc parent */
+
+        Ewl_Widget *freebox;        /**< The freebox for the children */
+};
+
+Ewl_Widget                *ewl_freebox_mvc_new(void);
+Ewl_Widget                *ewl_hfreebox_mvc_new(void);
+Ewl_Widget                *ewl_vfreebox_mvc_new(void);
+int                        ewl_freebox_mvc_init(Ewl_Freebox_MVC *fb_mvc);        
+
+void                       ewl_freebox_mvc_orientation_set(Ewl_Freebox_MVC *fb_mvc,
+                                                Ewl_Orientation orientation);
+Ewl_Orientation            ewl_freebox_mvc_orientation_get(Ewl_Freebox_MVC *fb_mvc);
+
+/*
+ * Internal stuff.
+ */
+void ewl_freebox_mvc_cb_configure(Ewl_Widget *w, void *ev, void *data);
+void ewl_freebox_mvc_cb_item_clicked(Ewl_Widget *w, void *ev, void *data);
+void ewl_freebox_mvc_cb_selected_change(Ewl_MVC *mvc);
+
+/**
+ * @}
+ */
+
+#endif

-- 
Enlightenment DR17 toolkit based (based on the EFL)



More information about the Pkg-e-commits mailing list