clean and delete objects

SVN revision: 37287
This commit is contained in:
Andreas Volz 2008-10-28 22:32:07 +00:00
parent fe658a75d5
commit 637138d77c
7 changed files with 29 additions and 8 deletions

View File

@ -36,8 +36,8 @@ int main( int argc, const char **argv )
EvasEsmartGroup* vbox = new EvasEsmartGroup( 50, 50, 200, 200, evas );
//vbox->resize( 100, 100 );
//vbox->setLayer( 20 );
vbox->add( buttonbackground );
vbox->add( buttontext );
vbox->append( buttonbackground );
vbox->append( buttontext );
vbox->show();
/* Enter the application main loop */

View File

@ -148,7 +148,7 @@ void EvasEsmartContainer::destroy( EvasObject* object )
esmart_container_element_destroy( o, object->obj() );
}
void EvasEsmartContainer::clean()
void EvasEsmartContainer::clear()
{
esmart_container_empty( o );
}

View File

@ -70,7 +70,7 @@ public:
void prepend( EvasObject* object, EvasObject* before = 0 );
void remove( EvasObject* object );
void destroy( EvasObject* object );
void clean();
void clear();
//void sort();
//EvasList* elements() const;

View File

@ -39,20 +39,38 @@ EvasEsmartGroup::EvasEsmartGroup( int x, int y, int width, int height, EvasCanva
EvasEsmartGroup::~EvasEsmartGroup()
{
clear ();
evas_object_del( o );
}
void EvasEsmartGroup::add (EvasObject *object)
void EvasEsmartGroup::append (EvasObject *object)
{
evasObjectList.push_back (object);
printf ("add (%p) -> size: %d\n", this, evasObjectList.size ());
}
void EvasEsmartGroup::prepend (EvasObject *object)
{
evasObjectList.push_front (object);
}
void EvasEsmartGroup::remove (EvasObject* object)
{
evasObjectList.remove (object);
cerr << "EvasEsmartGroup::remove" << endl;
}
void EvasEsmartGroup::clear()
{
for (list<EvasObject*>::iterator eo_it = evasObjectList.begin ();
eo_it != evasObjectList.end ();
++eo_it)
{
delete *eo_it;
}
evasObjectList.clear ();
}
// Handler functions
void EvasEsmartGroup::addHandler()

View File

@ -18,8 +18,10 @@ public:
EvasEsmartGroup( int x, int y, int width, int height, EvasCanvas* canvas, const char* name = 0 );
virtual ~EvasEsmartGroup();
void add (EvasObject* object);
void append (EvasObject* object); // TODO: , EvasObject* after = 0
void prepend (EvasObject* object); // TODO: , EvasObject* before = 0
void remove (EvasObject* object);
void clear();
protected:
// smart object handlers

View File

@ -211,6 +211,7 @@ void EvasObject::init (const char *name)
EvasObject::~EvasObject()
{
Dout( dc::notice, *this << " EvasObject::~EvasObject" );
evas_object_del( o );
}
const char* EvasObject::name() const

View File

@ -113,9 +113,9 @@ class EvasObject
// construction/destruction
EvasObject( EvasCanvas* canvas,
const char* name = "(null)" );
virtual ~EvasObject();
public:
virtual ~EvasObject();
bool operator==(const EvasObject& rhs) { return rhs.o == o; };
/* don't use these */