2010-05-08 13:53:44 -07:00
|
|
|
/* Project */
|
|
|
|
#include "../include/elementaryxx/GenListDataModel.h"
|
2010-05-26 14:01:36 -07:00
|
|
|
#include "../include/elementaryxx/Icon.h"
|
|
|
|
#include "../include/elementaryxx/Window.h"
|
|
|
|
#include "../include/elementaryxx/GenListColumnConstructor.h"
|
2010-05-08 13:53:44 -07:00
|
|
|
|
|
|
|
/* STD */
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace Elmxx {
|
|
|
|
|
|
|
|
GenListDataModel::GenListDataModel ()
|
|
|
|
{
|
|
|
|
mGLIC.item_style = "default";
|
|
|
|
mGLIC.func.label_get = GenListDataModel::gl_label_get;
|
|
|
|
mGLIC.func.icon_get = GenListDataModel::gl_icon_get;
|
|
|
|
mGLIC.func.state_get = GenListDataModel::gl_state_get;
|
|
|
|
mGLIC.func.del = GenListDataModel::gl_del;
|
|
|
|
}
|
|
|
|
|
2010-05-26 14:01:36 -07:00
|
|
|
std::string GenListDataModel::getLabel (GenListColumnConstructor *construction, Evasxx::Object &obj, const std::string &part) const
|
2010-05-08 13:53:44 -07:00
|
|
|
{
|
|
|
|
cout << "GenListDataModel::getLabel" << endl;
|
|
|
|
|
|
|
|
return "Item";
|
|
|
|
}
|
|
|
|
|
2010-05-26 14:01:36 -07:00
|
|
|
Elmxx::Object *GenListDataModel::getIcon (GenListColumnConstructor *construction, Evasxx::Object &obj, const std::string &part)
|
|
|
|
{
|
|
|
|
Window *win = static_cast <Window*> (&obj);
|
|
|
|
Icon *ic = Icon::factory (*win);
|
|
|
|
ic->setFile ("/home/andreas/Bilder/e_penguin/penguin.png");
|
|
|
|
ic->setAspectHintSize (EVAS_ASPECT_CONTROL_VERTICAL, Eflxx::Size (1, 1));
|
|
|
|
|
|
|
|
//part: elm.swallow.icon
|
|
|
|
//part: elm.swallow.end
|
|
|
|
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GenListDataModel::getState (GenListColumnConstructor *construction, Evasxx::Object &obj, const std::string &part)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GenListDataModel::del (GenListColumnConstructor *construction, Evasxx::Object &obj)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-05-08 13:53:44 -07:00
|
|
|
/* wrappers */
|
|
|
|
|
|
|
|
char *GenListDataModel::gl_label_get (const void *data, Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
cout << "gl_label_get" << endl;
|
2010-05-26 14:01:36 -07:00
|
|
|
|
|
|
|
GenListColumnConstructor *construction = (GenListColumnConstructor*) data;
|
|
|
|
GenListDataModel *model = construction->mDataModel;
|
|
|
|
Evasxx::Object *objWrap = Evasxx::Object::objectLink (obj);
|
|
|
|
|
|
|
|
const std::string &label = model->getLabel (construction, *objWrap, part);
|
|
|
|
|
|
|
|
return (!label.empty ()) ? strdup (label.c_str ()) : NULL;
|
2010-05-08 13:53:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *GenListDataModel::gl_icon_get (const void *data, Evas_Object *obj, const char *part)
|
|
|
|
{
|
2010-05-26 14:01:36 -07:00
|
|
|
GenListColumnConstructor *construction = (GenListColumnConstructor*) data;
|
|
|
|
GenListDataModel *model = construction->mDataModel;
|
|
|
|
Evasxx::Object *objWrap = Evasxx::Object::objectLink (obj);
|
|
|
|
|
|
|
|
Object *objxx = model->getIcon (construction, *objWrap, part);
|
|
|
|
|
|
|
|
return objxx ? objxx->obj () : NULL;
|
2010-05-08 13:53:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool GenListDataModel::gl_state_get (const void *data, Evas_Object *obj, const char *part)
|
|
|
|
{
|
2010-05-26 14:01:36 -07:00
|
|
|
GenListColumnConstructor *construction = (GenListColumnConstructor*) data;
|
|
|
|
GenListDataModel *model = construction->mDataModel;
|
|
|
|
Evasxx::Object *objWrap = Evasxx::Object::objectLink (obj);
|
|
|
|
|
|
|
|
return model->getState (construction, *objWrap, part);
|
2010-05-08 13:53:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void GenListDataModel::gl_del(const void *data, Evas_Object *obj)
|
|
|
|
{
|
2010-05-26 14:01:36 -07:00
|
|
|
GenListColumnConstructor *construction = (GenListColumnConstructor*) data;
|
|
|
|
GenListDataModel *model = construction->mDataModel;
|
|
|
|
Evasxx::Object *objWrap = Evasxx::Object::objectLink (obj);
|
|
|
|
|
|
|
|
return model->del (construction, *objWrap);
|
2010-05-08 13:53:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace Elmxx
|