raw working GenList C++ wrapper implementation, but data isn't yet complete deleted at the end...
SVN revision: 49598
This commit is contained in:
parent
a0784f437d
commit
adc3bd0b3a
|
@ -299,6 +299,7 @@ public:
|
|||
|
||||
/*!
|
||||
* Append item to the end of the genlist
|
||||
* TODO: C++ comment!
|
||||
*
|
||||
* This appends the given item to the end of the list or the end of the
|
||||
* children if the parent is given.
|
||||
|
@ -313,8 +314,35 @@ public:
|
|||
* @return A handle to the item added or NULL if not possible
|
||||
*
|
||||
*/
|
||||
|
||||
GenListItem *append (GenListColumnConstructor *construction, const GenListItem *parent, Elm_Genlist_Item_Flags flags, GenListColumnSelector *selection);
|
||||
|
||||
GenListItem *getItemSelected () const;
|
||||
|
||||
/*!
|
||||
* Get the item that is at the x, y canvas coords
|
||||
* TODO: C++ comment!
|
||||
*
|
||||
* This returns the item at the given coordinates (which are canvas relative
|
||||
* not object-relative). If an item is at that coordinate, that item handle
|
||||
* is returned, and if @p posret is not NULL, the integer pointed to is set
|
||||
* to a value of -1, 0 or 1, depending if the coordinate is on the upper
|
||||
* portion of that item (-1), on the middle section (0) or on the lower part
|
||||
* (1). If NULL is returned as an item (no item found there), then posret
|
||||
* may indicate -1 or 1 based if the coordinate is above or below all items
|
||||
* respectively in the genlist.
|
||||
*
|
||||
* @param it The item
|
||||
* @param x The input x coordinate
|
||||
* @param y The input y coordinate
|
||||
* @param posret The position relative to the item returned here
|
||||
* @return The item at the coordinates or NULL if none
|
||||
*
|
||||
*/
|
||||
GenListItem *getItemAtXY (const Eflxx::Point &pos, int &posret) const;
|
||||
|
||||
GenListItem *getItemFirst () const;
|
||||
|
||||
GenListItem *getItemLast () const;
|
||||
|
||||
// TODO: which type is event_info here instead of void*?
|
||||
sigc::signal <void, GenListColumnSelector&, const Evasxx::Object&, void*> signalSelect;
|
||||
|
@ -341,12 +369,11 @@ private:
|
|||
EAPI Elm_Genlist_Item *elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *before, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
|
||||
EAPI Elm_Genlist_Item *elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *after, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
|
||||
/* operations to retrieve existing items */
|
||||
EAPI Elm_Genlist_Item *elm_genlist_selected_item_get(const Evas_Object *obj);
|
||||
|
||||
|
||||
EAPI const Eina_List *elm_genlist_selected_items_get(const Evas_Object *obj);
|
||||
EAPI Eina_List *elm_genlist_realized_items_get(const Evas_Object *obj);
|
||||
EAPI Elm_Genlist_Item *elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret);
|
||||
EAPI Elm_Genlist_Item *elm_genlist_first_item_get(const Evas_Object *obj);
|
||||
EAPI Elm_Genlist_Item *elm_genlist_last_item_get(const Evas_Object *obj);
|
||||
|
||||
/* available item styles:
|
||||
* default
|
||||
* default_style - The text part is a textblock
|
||||
|
|
|
@ -9,15 +9,19 @@ namespace Elmxx {
|
|||
/* forward declarations */
|
||||
class GenList;
|
||||
class GenListDataModel;
|
||||
class GenListItem;
|
||||
|
||||
class GenListColumnConstructor
|
||||
{
|
||||
public:
|
||||
friend class GenList;
|
||||
friend class GenListDataModel;
|
||||
|
||||
GenListColumnConstructor ();
|
||||
|
||||
private:
|
||||
GenListDataModel *mDataModel;
|
||||
GenListItem *mGenListItem;
|
||||
};
|
||||
|
||||
} // end namespace Elmxx
|
||||
|
|
|
@ -31,8 +31,6 @@ public:
|
|||
|
||||
virtual bool getState (GenListColumnConstructor *construction, Evasxx::Object &obj, const std::string &part) = 0;
|
||||
|
||||
sigc::signal <void, GenListColumnConstructor&, const Evasxx::Object&> signalDel;
|
||||
|
||||
private:
|
||||
static char *gl_label_get (const void *data, Evas_Object *obj, const char *part);
|
||||
static Evas_Object *gl_icon_get (const void *data, Evas_Object *obj, const char *part);
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
void showMiddle ();
|
||||
void bringInMiddle ();
|
||||
void update ();
|
||||
|
||||
|
||||
const Evasxx::Object *getEvasObject ();
|
||||
|
||||
static GenListItem *wrap (Elm_Genlist_Item &item, GenListDataModel &model);
|
||||
|
@ -55,7 +55,8 @@ public:
|
|||
private:
|
||||
GenListItem (Elm_Genlist_Item *item);
|
||||
|
||||
void destroy (GenListColumnConstructor &construction, const Evasxx::Object &obj);
|
||||
const void *getData ();
|
||||
void setData (const void *data);
|
||||
|
||||
Elm_Genlist_Item *mItem;
|
||||
GenListDataModel *mDataModel;
|
||||
|
|
|
@ -179,6 +179,15 @@ GenListItem *GenList::append (GenListColumnConstructor *construction, const GenL
|
|||
GenList::gl_sel/* func */,
|
||||
selection /* func data */);
|
||||
|
||||
GenListItem *item = GenListItem::wrap (*gli, *mModel);
|
||||
|
||||
construction->mGenListItem = item;
|
||||
|
||||
//EAPI const void *
|
||||
//elm_genlist_item_data_get(const Elm_Genlist_Item *it)
|
||||
// -> returns: GenListColumnConstructor *construction
|
||||
// 1. add GenListItem* to construction
|
||||
|
||||
if (internalConstruction)
|
||||
{
|
||||
mInternalConstructList.push_back (construction);
|
||||
|
@ -188,9 +197,46 @@ GenListItem *GenList::append (GenListColumnConstructor *construction, const GenL
|
|||
mInternalSelList.push_back (selection);
|
||||
}
|
||||
|
||||
GenListItem *item = GenListItem::wrap (*gli, *mModel);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GenListItem *GenList::getItemSelected () const
|
||||
{
|
||||
Elm_Genlist_Item *item = elm_genlist_selected_item_get (o);
|
||||
|
||||
const GenListColumnConstructor *construction = static_cast <const GenListColumnConstructor*> (elm_genlist_item_data_get (item));
|
||||
|
||||
return construction->mGenListItem;
|
||||
}
|
||||
|
||||
GenListItem *GenList::getItemAtXY (const Eflxx::Point &pos, int &posret) const
|
||||
{
|
||||
Elm_Genlist_Item *item = elm_genlist_at_xy_item_get (o, pos.x (), pos.y (), &posret);
|
||||
|
||||
if (!item)
|
||||
return NULL;
|
||||
|
||||
const GenListColumnConstructor *construction = static_cast <const GenListColumnConstructor*> (elm_genlist_item_data_get (item));
|
||||
|
||||
return construction->mGenListItem;
|
||||
}
|
||||
|
||||
GenListItem *GenList::getItemFirst () const
|
||||
{
|
||||
Elm_Genlist_Item *item = elm_genlist_first_item_get (o);
|
||||
|
||||
const GenListColumnConstructor *construction = static_cast <const GenListColumnConstructor*> (elm_genlist_item_data_get (item));
|
||||
|
||||
return construction->mGenListItem;
|
||||
}
|
||||
|
||||
GenListItem *GenList::getItemLast () const
|
||||
{
|
||||
Elm_Genlist_Item *item = elm_genlist_last_item_get (o);
|
||||
|
||||
const GenListColumnConstructor *construction = static_cast <const GenListColumnConstructor*> (elm_genlist_item_data_get (item));
|
||||
|
||||
return construction->mGenListItem;
|
||||
}
|
||||
|
||||
} // end namespace Elmxx
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
/* Project */
|
||||
#include "../include/elementaryxx/GenListColumnConstructor.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
namespace Elmxx {
|
||||
|
||||
GenListColumnConstructor::GenListColumnConstructor () :
|
||||
mGenListItem (NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // end namespace Elmxx
|
||||
|
|
|
@ -74,10 +74,7 @@ void GenListDataModel::gl_del(const void *data, Evas_Object *obj)
|
|||
assert (model);
|
||||
assert (objWrap);
|
||||
|
||||
cout << "+del" << endl;
|
||||
// FIXME: for some reason emit isn't working. and never returns and emit() is called infinite??
|
||||
//model->signalDel.emit (*construction, *objWrap);
|
||||
cout << "-del" << endl;
|
||||
// TODO: delete all allocated menuitem/construction data
|
||||
}
|
||||
|
||||
} // end namespace Elmxx
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../include/elementaryxx/GenListDataModel.h"
|
||||
|
||||
/* STD */
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std;
|
||||
|
@ -16,11 +17,12 @@ namespace Elmxx {
|
|||
GenListItem::GenListItem (Elm_Genlist_Item *item) :
|
||||
mItem (item)
|
||||
{
|
||||
//elm_genlist_item_data_set (mItem, this);
|
||||
|
||||
}
|
||||
|
||||
GenListItem::~GenListItem ()
|
||||
{
|
||||
cout << "GenListItem::~GenListItem" << endl;
|
||||
elm_genlist_item_del (mItem);
|
||||
}
|
||||
|
||||
|
@ -114,7 +116,7 @@ GenListItem *GenListItem::wrap (Elm_Genlist_Item &item, GenListDataModel &model)
|
|||
{
|
||||
GenListItem *genItem = new GenListItem (&item);
|
||||
genItem->mDataModel = &model;
|
||||
model.signalDel.connect (sigc::mem_fun (genItem, &GenListItem::destroy));
|
||||
//model.signalDel.connect (sigc::mem_fun (genItem, &GenListItem::destroy));
|
||||
|
||||
return genItem;
|
||||
}
|
||||
|
@ -126,9 +128,14 @@ GenListItem *GenListItem::objectLink (const Elm_Genlist_Item *item)
|
|||
return NULL;//item2;
|
||||
}
|
||||
|
||||
void GenListItem::destroy (GenListColumnConstructor &construction, const Evasxx::Object &obj)
|
||||
const void *GenListItem::getData ()
|
||||
{
|
||||
cout << "destroy" << endl;
|
||||
return elm_genlist_item_data_get (mItem);
|
||||
}
|
||||
|
||||
void GenListItem::setData (const void *data)
|
||||
{
|
||||
elm_genlist_item_data_set (mItem, data);
|
||||
}
|
||||
|
||||
} // end namespace Elmxx
|
||||
|
|
Loading…
Reference in New Issue