From cce8cb543357c855cd59cf0028b0a340b8a29cd3 Mon Sep 17 00:00:00 2001 From: Andreas Volz Date: Fri, 9 Jul 2010 20:23:12 +0000 Subject: [PATCH] wrapped append,prepend,.. SVN revision: 50164 --- .../include/elementaryxx/Application.h | 9 ++- elementaryxx/include/elementaryxx/GenList.h | 18 +++++ elementaryxx/src/Application.cpp | 5 ++ elementaryxx/src/GenList.cpp | 69 +++++++++++++++++-- 4 files changed, 93 insertions(+), 8 deletions(-) diff --git a/elementaryxx/include/elementaryxx/Application.h b/elementaryxx/include/elementaryxx/Application.h index 4beb7c7..9cad094 100644 --- a/elementaryxx/include/elementaryxx/Application.h +++ b/elementaryxx/include/elementaryxx/Application.h @@ -20,11 +20,16 @@ public: // EAPI void elm_need_efreet(void); // EAPI void elm_need_e_dbus(void); - double getScale (); - void setScale (double scale); + static double getScale (); + static void setScale (double scale); // EAPI Evas_Coord elm_finger_size_get(void); // EAPI void elm_finger_size_set(Evas_Coord size); + + /*! + * Flush all caches & dump all data that can be to lean down to use less memory + */ + static void flushAll (); }; } // end namespace Elmxx diff --git a/elementaryxx/include/elementaryxx/GenList.h b/elementaryxx/include/elementaryxx/GenList.h index 347c8bf..779a297 100644 --- a/elementaryxx/include/elementaryxx/GenList.h +++ b/elementaryxx/include/elementaryxx/GenList.h @@ -316,6 +316,14 @@ public: */ GenListItem *append (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection); + GenListItem *prepend (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection); + + GenListItem *insertBefore (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection); + + GenListItem *insertAfter (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection); + + void del (GenListItem &item); + GenListItem *getItemSelected () const; /*! @@ -352,6 +360,16 @@ private: GenList (const GenList&); // forbid copy constructor GenList (Evasxx::Object &parent); // private construction -> use factory () ~GenList (); // forbid direct delete -> use Object::destroy() + + enum InsertOperation + { + Append, + Prepend, + InsertAfter, + InsertBefore + }; + + GenListItem *insertInternal (GenListColumnConstructor *construction, GenList::InsertOperation op, const GenListItem *opItem, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection); static void gl_sel (void *data, Evas_Object *obj, void *event_info); diff --git a/elementaryxx/src/Application.cpp b/elementaryxx/src/Application.cpp index 542672b..70f41be 100644 --- a/elementaryxx/src/Application.cpp +++ b/elementaryxx/src/Application.cpp @@ -40,5 +40,10 @@ void Application::setScale (double scale) { elm_scale_set (scale); } + +void Application::flushAll () +{ + elm_all_flush (); +} } // end namespace Elmxx diff --git a/elementaryxx/src/GenList.cpp b/elementaryxx/src/GenList.cpp index 991862f..9e1ca7b 100644 --- a/elementaryxx/src/GenList.cpp +++ b/elementaryxx/src/GenList.cpp @@ -146,6 +146,26 @@ void GenList::glSelected (GenListColumnSelector &selection, const Evasxx::Object /* operations to add items */ GenListItem *GenList::append (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection) +{ + insertInternal (construction, GenList::Append, parent, flags, selection); +} + +GenListItem *GenList::prepend (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection) +{ + insertInternal (construction, GenList::Prepend, parent, flags, selection); +} + +GenListItem *GenList::insertBefore (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection) +{ + insertInternal (construction, GenList::InsertBefore, parent, flags, selection); +} + +GenListItem *GenList::insertAfter (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection) +{ + insertInternal (construction, GenList::InsertAfter, parent, flags, selection); +} + +GenListItem *GenList::insertInternal (GenListColumnConstructor *construction, GenList::InsertOperation op, const GenListItem *opItem, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection) { assert (mModel); @@ -172,12 +192,44 @@ GenListItem *GenList::append (GenListColumnConstructor *construction, const GenL construction->mDataModel = mModel; selection->mGenList = this; - gli = elm_genlist_item_append (o, &mModel->mGLIC, - construction /* item data */, - parent ? parent->mItem : NULL /* parent */, - flags, - GenList::gl_sel/* func */, - selection /* func data */); + switch (op) + { + case Append: + gli = elm_genlist_item_append (o, &mModel->mGLIC, + construction /* item data */, + opItem ? opItem->mItem : NULL /* parent */, + flags, + GenList::gl_sel/* func */, + selection /* func data */); + break; + + case Prepend: + gli = elm_genlist_item_prepend (o, &mModel->mGLIC, + construction /* item data */, + opItem ? opItem->mItem : NULL /* parent */, + flags, + GenList::gl_sel/* func */, + selection /* func data */); + break; + + case InsertBefore: + gli = elm_genlist_item_insert_before (o, &mModel->mGLIC, + construction /* item data */, + opItem ? opItem->mItem : NULL /* parent */, + flags, + GenList::gl_sel/* func */, + selection /* func data */); + break; + + case InsertAfter: + gli = elm_genlist_item_insert_after (o, &mModel->mGLIC, + construction /* item data */, + opItem ? opItem->mItem : NULL /* parent */, + flags, + GenList::gl_sel/* func */, + selection /* func data */); + break; + } GenListItem *item = GenListItem::wrap (*gli, *mModel); @@ -200,6 +252,11 @@ GenListItem *GenList::append (GenListColumnConstructor *construction, const GenL return item; } +void GenList::del (GenListItem &item) +{ + elm_genlist_item_del (item.mItem); +} + GenListItem *GenList::getItemSelected () const { Elm_Genlist_Item *item = elm_genlist_selected_item_get (o);