From f12ec147778db43884b54ce4c5d64627b5c3223d Mon Sep 17 00:00:00 2001 From: Andreas Volz Date: Fri, 2 Jan 2009 21:41:30 +0000 Subject: [PATCH] separated EdjePart and EvasEdje class SVN revision: 38421 --- src/edje/Makefile.am | 8 +- src/edje/eflpp_edje.cpp | 194 ------------------------------------ src/edje/eflpp_edje.h | 166 ++---------------------------- src/edje/eflpp_edjepart.cpp | 70 +++++++++++++ src/edje/eflpp_edjepart.h | 84 ++++++++++++++++ src/edje/eflpp_evasedje.cpp | 151 ++++++++++++++++++++++++++++ src/edje/eflpp_evasedje.h | 104 +++++++++++++++++++ 7 files changed, 424 insertions(+), 353 deletions(-) create mode 100644 src/edje/eflpp_edjepart.cpp create mode 100644 src/edje/eflpp_edjepart.h create mode 100644 src/edje/eflpp_evasedje.cpp create mode 100644 src/edje/eflpp_evasedje.h diff --git a/src/edje/Makefile.am b/src/edje/Makefile.am index ce3a920..2f85468 100644 --- a/src/edje/Makefile.am +++ b/src/edje/Makefile.am @@ -9,11 +9,15 @@ AM_CXXFLAGS = @PACKAGE_CFLAGS@ \ noinst_LTLIBRARIES = libeflpp_edje.la libeflpp_edje_la_SOURCES = \ - eflpp_edje.cpp + eflpp_edje.cpp\ + eflpp_edjepart.cpp\ + eflpp_evasedje.cpp libeflpp_includedir = $(pkgincludedir) libeflpp_include_DATA = \ - eflpp_edje.h + eflpp_edje.h\ + eflpp_edjepart.h\ + eflpp_evasedje.h EXTRA_DIST = $(libeflpp_include_DATA) diff --git a/src/edje/eflpp_edje.cpp b/src/edje/eflpp_edje.cpp index c53189f..5a805b2 100644 --- a/src/edje/eflpp_edje.cpp +++ b/src/edje/eflpp_edje.cpp @@ -9,201 +9,7 @@ using namespace std; namespace efl { - -const char* PartNotExistingException::what () const throw () -{ - static std::string s; - s = "EvasEdje loaded with not existing part '"; - s += txt; - s += "'."; - return static_cast (s.c_str ()); -} -//=============================================================================================== -// EvasEdje -//=============================================================================================== -EvasEdje::EvasEdje( EvasCanvas* canvas, const char* name ) -{ - o = edje_object_add( canvas->obj() ); - init( name ? name : "edje" ); - -#ifdef CWDEBUG - edje_object_message_handler_set( o, &_edje_message_handler_callback, 0 ); - edje_object_signal_callback_add( o, "*", "*", &_edje_signal_handler_callback, 0 ); -#endif -} - -EvasEdje::EvasEdje( const char* filename, const char* groupname, EvasCanvas* canvas, const char* name ) -{ - o = edje_object_add( canvas->obj() ); - init( name ? name : groupname ); - -#ifdef CWDEBUG - edje_object_message_handler_set( o, &_edje_message_handler_callback, 0 ); - edje_object_signal_callback_add( o, "*", "*", &_edje_signal_handler_callback, 0 ); -#endif - setFile( filename, groupname ); -} - -EvasEdje::EvasEdje( int x, int y, const char* filename, const char* groupname, EvasCanvas* canvas, const char* name ) -{ - o = edje_object_add( canvas->obj() ); - init( name ? name : groupname ); - -#ifdef CWDEBUG - edje_object_message_handler_set( o, &_edje_message_handler_callback, 0 ); - edje_object_signal_callback_add( o, "*", "*", &_edje_signal_handler_callback, 0 ); -#endif - setFile( filename, groupname ); - move( x, y ); -} - -EvasEdje::EvasEdje( Evas_Object* object) -{ - o = object; - mManaged = false; -} - -bool EvasEdje::setFile( const char* filename, const char* groupname ) -{ - edje_object_file_set( o, filename, groupname ); - int errorcode = edje_object_load_error_get(o); - Dout( dc::notice, "EvasEdje::file_set" << " path=" << filename << " group=" << groupname << "(" << EVAS_LOAD_ERROR[errorcode] << ")" ); - if ( errorcode ) cerr << "ERROR: EvasEdje::setFile( '" << filename << "|" << groupname << ") = " << EVAS_LOAD_ERROR[errorcode] << endl; - return ( errorcode == 0 ); -} - -Size EvasEdje::minimalSize() const -{ - int w, h; - edje_object_size_min_get( o, &w, &h ); - Dout( dc::notice, "size min get seems to be " << w << " x " << h ); - return Size( w, h ); -} - -Size EvasEdje::maximumSize() const -{ - int w, h; - edje_object_size_max_get( o, &w, &h ); - Dout( dc::notice, "size max get seems to be " << w << " x " << h ); - return Size( w, h ); -} - -EvasEdje::~EvasEdje() -{ - //FIXME: Remove callbacks? -} - -bool EvasEdje::hasPart( const char* partname ) const -{ - return edje_object_part_exists( o, partname ); -} - -CountedPtr EvasEdje::operator[]( const char* partname ) -{ - return part( partname ); -} - -CountedPtr EvasEdje::part( const char* partname ) -{ - if ( hasPart( partname ) ) - { - EdjePart* ep = new EdjePart( this, partname ); - return CountedPtr (ep); - } - throw PartNotExistingException (partname); -} - -void EvasEdje::connect( const char* emission, const char* source, const EdjeSignalSlot& slot ) -{ - EdjeSignalSignal* signal = new EdjeSignalSignal(); - AllocTag( signal, emission ); - signal->connect( slot ); - edje_object_signal_callback_add( o, emission, source, &_edje_signal_handler_callback, static_cast( signal ) ); -} - -void EvasEdje::emit( const char* emission, const char* source ) -{ - edje_object_signal_emit( o, emission, source ); -} - -void EvasEdje::_edje_message_handler_callback( void* data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg ) -{ - Dout( dc::notice, "EvasEdje::_edje_message_handler_callback()" ); - //EvasEdje* instance = reinterpret_cast( data ); -} - -void EvasEdje::_edje_signal_handler_callback( void *data, Evas_Object *obj, const char *emission, const char *source ) -{ - Dout( dc::notice, "EvasEdje::_edje_signal_handler_callback( " << (emission ? emission:"") << ", " << (source ? source:"") << " ) " ); - EdjeSignalSignal* signal = reinterpret_cast( data ); - if ( signal ) signal->emit( emission, source ); - else Dout( dc::warning, "EvasEdje::_edje_signal_handler_callback() - got callback without valid signal" ); -} - -EvasEdje* EvasEdje::wrap( Evas_Object* o ) -{ - return new EvasEdje( o ); -} - -//=============================================================================================== -// EdjePart -//=============================================================================================== - -EdjePart::EdjePart( EvasEdje* parent, const char* partname ) - :_parent( parent), _partname( partname ) -{ - Dout( dc::notice, " EdjePart::EdjePart( '" << _partname << "' ) constructing..." ); -} - -EdjePart::~EdjePart() -{ - Dout( dc::notice, "~EdjePart::EdjePart( '" << _partname << "' ) destructing..." ); -} - -Rect EdjePart::geometry() const -{ - int x; int y; int w; int h; - edje_object_part_geometry_get( _parent->obj(), _partname, &x, &y, &w, &h ); - return Rect( x, y, w, h ); -} - - -void EdjePart::setText( const char* text ) -{ - edje_object_part_text_set( _parent->obj(), _partname, text ); -} - -const char* EdjePart::text() const -{ - return edje_object_part_text_get( _parent->obj(), _partname ); -} - - -void EdjePart::swallow( EvasObject* object ) -{ - edje_object_part_swallow( _parent->obj(), _partname, object->obj() ); -} - -void EdjePart::unswallow( EvasObject* object ) -{ - edje_object_part_unswallow( _parent->obj(), object->obj() ); -} - -CountedPtr EdjePart::swallow() -{ - Evas_Object *eo = edje_object_part_swallow_get( _parent->obj(), _partname ); - - EvasObject *ret_o = EvasObject::wrap (eo); - - return CountedPtr (ret_o); -} - -/*const EvasObject* EdjePart::getObject ( const char* name ) -{ - return EvasObject::objectLink( edje_object_part_object_get( static_cast (_parent->obj()), name ) ); -}*/ - } // end namespace efl diff --git a/src/edje/eflpp_edje.h b/src/edje/eflpp_edje.h index 3dc302b..f8d7b26 100644 --- a/src/edje/eflpp_edje.h +++ b/src/edje/eflpp_edje.h @@ -1,5 +1,5 @@ -#ifndef EDJE_BASE -#define EDJE_BASE +#ifndef EFLPP_EDJE_H +#define EFLPP_EDJE_H #ifdef HAVE_CONFIG_H #include @@ -11,13 +11,12 @@ #include #include #include +#include "eflpp_edjepart.h" +#include "eflpp_evasedje.h" /* EFL */ #include -/* STD */ -#include - /** * C++ Wrapper for the Enlightenment Edje Library (EDJE) * @@ -26,27 +25,14 @@ namespace efl { -class EdjePart; -class EvasEdje; - -typedef std::map EdjePartMap; - -typedef sigc::signal EdjeSignalSignal; -typedef sigc::slot2 EdjeSignalSlot; - -class PartNotExistingException : public std::exception -{ -public: - PartNotExistingException (const char *partname) : txt (partname) {} - const char* what () const throw (); - -private: - const char *txt; -}; +//typedef std::map EdjePartMap; //=============================================================================================== // Edje //=============================================================================================== + +// TODO: why is the implementation empty? + class Edje { public: @@ -88,140 +74,6 @@ class Edje ~Edje(); }; -//=============================================================================================== -// EdjePart -//=============================================================================================== -class EdjePart -{ - friend class EvasEdje; - - private: - EdjePart( EvasEdje* parent, const char* partname ); - - public: - ~EdjePart(); - - Rect geometry() const; - - void setText( const char* text ); - const char* text() const; - - void swallow( EvasObject* ); - void unswallow( EvasObject* ); - - CountedPtr swallow(); - - //const EvasObject* getObject ( const char* name ); - - private: - EvasEdje* _parent; - const char* _partname; - - /* State? - EAPI const char *edje_object_part_state_get (Evas_Object *obj, const char *part, double *val_ret); - */ - - /* Directions? - EAPI int edje_object_part_drag_dir_get (Evas_Object *obj, const char *part); - */ - - /* Drag? - EAPI void edje_object_part_drag_value_set (Evas_Object *obj, const char *part, double dx, double dy); - EAPI void edje_object_part_drag_value_get (Evas_Object *obj, const char *part, double *dx, double *dy); - EAPI void edje_object_part_drag_size_set (Evas_Object *obj, const char *part, double dw, double dh); - EAPI void edje_object_part_drag_size_get (Evas_Object *obj, const char *part, double *dw, double *dh); - EAPI void edje_object_part_drag_step_set (Evas_Object *obj, const char *part, double dx, double dy); - EAPI void edje_object_part_drag_step_get (Evas_Object *obj, const char *part, double *dx, double *dy); - EAPI void edje_object_part_drag_page_set (Evas_Object *obj, const char *part, double dx, double dy); - EAPI void edje_object_part_drag_page_get (Evas_Object *obj, const char *part, double *dx, double *dy); - EAPI void edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy); - EAPI void edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy); - */ - private: - EdjePart(); - EdjePart( const EdjePart& ); - bool operator=( const EdjePart& ); - bool operator==( const EdjePart& ); -}; - -//=============================================================================================== -// EvasEdje -//=============================================================================================== -class EvasEdje : public EvasObject -{ - public: - EvasEdje( EvasCanvas* canvas, const char* name = 0 ); - EvasEdje( const char* filename, const char* groupname, EvasCanvas* canvas, const char* name = 0 ); - EvasEdje( int x, int y, const char* filename, const char* groupname, EvasCanvas* canvas, const char* name = 0 ); - - ~EvasEdje(); - - /* - EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *obj, const char *emission, const char *source), void *data); - - EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *obj, const char *emission, const char *source)); - - EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source); - - EAPI void edje_object_text_change_cb_set (Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, const char *part), void *data); - - EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); - - EAPI void edje_object_message_handler_set (Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data); - - EAPI void edje_object_message_signal_process (Evas_Object *obj); - - EAPI void edje_message_signal_process (void); - */ - - bool setFile( const char* filename, const char* partname ); - - void setPlaying( bool b ); - bool isPlaying() const; - void setAnimated( bool b ); - bool isAnimated() const; - - int freeze(); - int thaw(); - - void setColorClass( const char* colorclass, const Color& object, const Color& outline, const Color& shadow ); - void setTextClass( const char* textclass, const char* fontname, int size ); - - void setMinimumSize( const Size& size ); - void setMaximumSize( const Size& size ); - Size minimalSize() const; - Size maximumSize() const; - - void recalculateLayout(); - - bool hasPart( const char* partname ) const; - CountedPtr operator[]( const char* partname ); - - /*! - * @param partname Access a EdjePart in the EvasEdje. - * @throw PartNotExistingException - */ - CountedPtr part( const char* partname ); - - /* signals and slots */ - void connect( const char* emission, const char* source, const EdjeSignalSlot& slot ); - void emit( const char* emission, const char* source ); - - static EvasEdje *wrap( Evas_Object* o ); - - private: - static void _edje_message_handler_callback( void* data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg ); - static void _edje_signal_handler_callback( void *data, Evas_Object *obj, const char *emission, const char *source ); - - EvasEdje(); - EvasEdje( const EvasEdje& ); - - EvasEdje( Evas_Object* object ); - - bool operator=( const EvasEdje& ); - bool operator==( const EvasEdje& ); -}; - } -#endif +#endif // EFLPP_EDJE_H diff --git a/src/edje/eflpp_edjepart.cpp b/src/edje/eflpp_edjepart.cpp new file mode 100644 index 0000000..56d199c --- /dev/null +++ b/src/edje/eflpp_edjepart.cpp @@ -0,0 +1,70 @@ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include "eflpp_edjepart.h" +#include "eflpp_evasedje.h" + +/* EFL */ +#include + +/* STD */ +#include + +namespace efl { + +EdjePart::EdjePart( EvasEdje* parent, const char* partname ) + :_parent( parent), _partname( partname ) +{ + Dout( dc::notice, " EdjePart::EdjePart( '" << _partname << "' ) constructing..." ); +} + +EdjePart::~EdjePart() +{ + Dout( dc::notice, "~EdjePart::EdjePart( '" << _partname << "' ) destructing..." ); +} + +Rect EdjePart::geometry() const +{ + int x; int y; int w; int h; + edje_object_part_geometry_get( _parent->obj(), _partname, &x, &y, &w, &h ); + return Rect( x, y, w, h ); +} + + +void EdjePart::setText( const char* text ) +{ + edje_object_part_text_set( _parent->obj(), _partname, text ); +} + +const char* EdjePart::text() const +{ + return edje_object_part_text_get( _parent->obj(), _partname ); +} + + +void EdjePart::swallow( EvasObject* object ) +{ + edje_object_part_swallow( _parent->obj(), _partname, object->obj() ); +} + +void EdjePart::unswallow( EvasObject* object ) +{ + edje_object_part_unswallow( _parent->obj(), object->obj() ); +} + +CountedPtr EdjePart::swallow() +{ + Evas_Object *eo = edje_object_part_swallow_get( _parent->obj(), _partname ); + + EvasObject *ret_o = EvasObject::wrap (eo); + + return CountedPtr (ret_o); +} + +/*const EvasObject* EdjePart::getObject ( const char* name ) +{ + return EvasObject::objectLink( edje_object_part_object_get( static_cast (_parent->obj()), name ) ); +}*/ + +} // end namespace efl diff --git a/src/edje/eflpp_edjepart.h b/src/edje/eflpp_edjepart.h new file mode 100644 index 0000000..49994d1 --- /dev/null +++ b/src/edje/eflpp_edjepart.h @@ -0,0 +1,84 @@ +#ifndef EFLPP_EDJEPART_H +#define EFLPP_EDJEPART_H + +/* STL */ +#include + +/* EFL++ */ +#include +#include + +#include "eflpp_evasobject.h" + +using std::string; + +namespace efl { + +class EvasEdje; + +class PartNotExistingException : public std::exception +{ +public: + PartNotExistingException (const char *partname) : txt (partname) {} + const char* what () const throw (); + +private: + const char *txt; +}; + +class EdjePart +{ + friend class EvasEdje; + + private: + EdjePart( EvasEdje* parent, const char* partname ); + + public: + ~EdjePart(); + + Rect geometry() const; + + void setText( const char* text ); + const char* text() const; + + void swallow( EvasObject* ); + void unswallow( EvasObject* ); + + CountedPtr swallow(); + + //const EvasObject* getObject ( const char* name ); + + private: + EvasEdje* _parent; + const char* _partname; + + /* State? + EAPI const char *edje_object_part_state_get (Evas_Object *obj, const char *part, double *val_ret); + */ + + /* Directions? + EAPI int edje_object_part_drag_dir_get (Evas_Object *obj, const char *part); + */ + + /* Drag? + EAPI void edje_object_part_drag_value_set (Evas_Object *obj, const char *part, double dx, double dy); + EAPI void edje_object_part_drag_value_get (Evas_Object *obj, const char *part, double *dx, double *dy); + EAPI void edje_object_part_drag_size_set (Evas_Object *obj, const char *part, double dw, double dh); + EAPI void edje_object_part_drag_size_get (Evas_Object *obj, const char *part, double *dw, double *dh); + EAPI void edje_object_part_drag_step_set (Evas_Object *obj, const char *part, double dx, double dy); + EAPI void edje_object_part_drag_step_get (Evas_Object *obj, const char *part, double *dx, double *dy); + EAPI void edje_object_part_drag_page_set (Evas_Object *obj, const char *part, double dx, double dy); + EAPI void edje_object_part_drag_page_get (Evas_Object *obj, const char *part, double *dx, double *dy); + EAPI void edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy); + EAPI void edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy); + */ + private: + EdjePart(); + EdjePart( const EdjePart& ); + bool operator=( const EdjePart& ); + bool operator==( const EdjePart& ); +}; + +} // end namespace efl + +#endif // EFLPP_EDJEPART_H diff --git a/src/edje/eflpp_evasedje.cpp b/src/edje/eflpp_evasedje.cpp new file mode 100644 index 0000000..98574af --- /dev/null +++ b/src/edje/eflpp_evasedje.cpp @@ -0,0 +1,151 @@ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include "eflpp_evasedje.h" +#include "eflpp_edjepart.h" + +/* EFL */ +#include + +using namespace std; + +namespace efl { + +const char* PartNotExistingException::what () const throw () +{ + static std::string s; + s = "EvasEdje loaded with not existing part '"; + s += txt; + s += "'."; + return static_cast (s.c_str ()); +} + +EvasEdje::EvasEdje( EvasCanvas* canvas, const char* name ) +{ + o = edje_object_add( canvas->obj() ); + init( name ? name : "edje" ); + +#ifdef CWDEBUG + edje_object_message_handler_set( o, &_edje_message_handler_callback, 0 ); + edje_object_signal_callback_add( o, "*", "*", &_edje_signal_handler_callback, 0 ); +#endif +} + +EvasEdje::EvasEdje( const char* filename, const char* groupname, EvasCanvas* canvas, const char* name ) +{ + o = edje_object_add( canvas->obj() ); + init( name ? name : groupname ); + +#ifdef CWDEBUG + edje_object_message_handler_set( o, &_edje_message_handler_callback, 0 ); + edje_object_signal_callback_add( o, "*", "*", &_edje_signal_handler_callback, 0 ); +#endif + setFile( filename, groupname ); +} + +EvasEdje::EvasEdje( int x, int y, const char* filename, const char* groupname, EvasCanvas* canvas, const char* name ) +{ + o = edje_object_add( canvas->obj() ); + init( name ? name : groupname ); + +#ifdef CWDEBUG + edje_object_message_handler_set( o, &_edje_message_handler_callback, 0 ); + edje_object_signal_callback_add( o, "*", "*", &_edje_signal_handler_callback, 0 ); +#endif + setFile( filename, groupname ); + move( x, y ); +} + +EvasEdje::EvasEdje( Evas_Object* object) +{ + o = object; + mManaged = false; +} + +bool EvasEdje::setFile( const char* filename, const char* groupname ) +{ + edje_object_file_set( o, filename, groupname ); + int errorcode = edje_object_load_error_get(o); + + // TODO: Exception handling? + + //Dout( dc::notice, "EvasEdje::file_set" << " path=" << filename << " group=" << groupname << "(" << EVAS_LOAD_ERROR[errorcode] << ")" ); + //if ( errorcode ) cerr << "ERROR: EvasEdje::setFile( '" << filename << "|" << groupname << ") = " << EVAS_LOAD_ERROR[errorcode] << endl; + return ( errorcode == 0 ); +} + +Size EvasEdje::minimalSize() const +{ + int w, h; + edje_object_size_min_get( o, &w, &h ); + Dout( dc::notice, "size min get seems to be " << w << " x " << h ); + return Size( w, h ); +} + +Size EvasEdje::maximumSize() const +{ + int w, h; + edje_object_size_max_get( o, &w, &h ); + Dout( dc::notice, "size max get seems to be " << w << " x " << h ); + return Size( w, h ); +} + +EvasEdje::~EvasEdje() +{ + //FIXME: Remove callbacks? +} + +bool EvasEdje::hasPart( const char* partname ) const +{ + return edje_object_part_exists( o, partname ); +} + +CountedPtr EvasEdje::operator[]( const char* partname ) +{ + return part( partname ); +} + +CountedPtr EvasEdje::part( const char* partname ) +{ + if ( hasPart( partname ) ) + { + EdjePart* ep = new EdjePart( this, partname ); + return CountedPtr (ep); + } + throw PartNotExistingException (partname); +} + +void EvasEdje::connect( const char* emission, const char* source, const EdjeSignalSlot& slot ) +{ + EdjeSignalSignal* signal = new EdjeSignalSignal(); + AllocTag( signal, emission ); + signal->connect( slot ); + edje_object_signal_callback_add( o, emission, source, &_edje_signal_handler_callback, static_cast( signal ) ); +} + +void EvasEdje::emit( const char* emission, const char* source ) +{ + edje_object_signal_emit( o, emission, source ); +} + +void EvasEdje::_edje_message_handler_callback( void* data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg ) +{ + Dout( dc::notice, "EvasEdje::_edje_message_handler_callback()" ); + //EvasEdje* instance = reinterpret_cast( data ); +} + +void EvasEdje::_edje_signal_handler_callback( void *data, Evas_Object *obj, const char *emission, const char *source ) +{ + Dout( dc::notice, "EvasEdje::_edje_signal_handler_callback( " << (emission ? emission:"") << ", " << (source ? source:"") << " ) " ); + EdjeSignalSignal* signal = reinterpret_cast( data ); + if ( signal ) signal->emit( emission, source ); + else Dout( dc::warning, "EvasEdje::_edje_signal_handler_callback() - got callback without valid signal" ); +} + +EvasEdje* EvasEdje::wrap( Evas_Object* o ) +{ + return new EvasEdje( o ); +} + +} // end namespace efl diff --git a/src/edje/eflpp_evasedje.h b/src/edje/eflpp_evasedje.h new file mode 100644 index 0000000..6777e94 --- /dev/null +++ b/src/edje/eflpp_evasedje.h @@ -0,0 +1,104 @@ +#ifndef EFLPP_EVASEDJE_H +#define EFLPP_EVASEDJE_H + +/* STL */ +#include + +/* EFL++ */ +#include +#include + +#include "eflpp_evasobject.h" +#include "eflpp_edjepart.h" +#include "eflpp_evascanvas.h" + +/* EFL */ +#include + +using std::string; + +namespace efl { + +typedef sigc::signal EdjeSignalSignal; +typedef sigc::slot2 EdjeSignalSlot; + +class EvasEdje : public EvasObject +{ + public: + EvasEdje( EvasCanvas* canvas, const char* name = 0 ); + EvasEdje( const char* filename, const char* groupname, EvasCanvas* canvas, const char* name = 0 ); + EvasEdje( int x, int y, const char* filename, const char* groupname, EvasCanvas* canvas, const char* name = 0 ); + + ~EvasEdje(); + + /* + EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *obj, const char *emission, const char *source), void *data); + + EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *obj, const char *emission, const char *source)); + + EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source); + + EAPI void edje_object_text_change_cb_set (Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, const char *part), void *data); + + EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); + + EAPI void edje_object_message_handler_set (Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data); + + EAPI void edje_object_message_signal_process (Evas_Object *obj); + + EAPI void edje_message_signal_process (void); + */ + + bool setFile( const char* filename, const char* partname ); + + void setPlaying( bool b ); + bool isPlaying() const; + void setAnimated( bool b ); + bool isAnimated() const; + + int freeze(); + int thaw(); + + void setColorClass( const char* colorclass, const Color& object, const Color& outline, const Color& shadow ); + void setTextClass( const char* textclass, const char* fontname, int size ); + + void setMinimumSize( const Size& size ); + void setMaximumSize( const Size& size ); + Size minimalSize() const; + Size maximumSize() const; + + void recalculateLayout(); + + bool hasPart( const char* partname ) const; + CountedPtr operator[]( const char* partname ); + + /*! + * @param partname Access a EdjePart in the EvasEdje. + * @throw PartNotExistingException + */ + CountedPtr part( const char* partname ); + + /* signals and slots */ + void connect( const char* emission, const char* source, const EdjeSignalSlot& slot ); + void emit( const char* emission, const char* source ); + + static EvasEdje *wrap( Evas_Object* o ); + + private: + // TODO: wrap Edje_Message_Type to avoid include of C header + static void _edje_message_handler_callback( void* data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg ); + static void _edje_signal_handler_callback( void *data, Evas_Object *obj, const char *emission, const char *source ); + + EvasEdje(); + EvasEdje( const EvasEdje& ); + + EvasEdje( Evas_Object* object ); + + bool operator=( const EvasEdje& ); + bool operator==( const EvasEdje& ); +}; + + +} // end namespace efl + +#endif // EFLPP_EVASEDJE_H