parent
ea26d31e32
commit
2c624877db
|
@ -5,12 +5,15 @@
|
|||
#include <string>
|
||||
|
||||
/* EFLxx */
|
||||
#include "Object.h"
|
||||
#include <eflxx/Eflxx.h>
|
||||
|
||||
/* EFL */
|
||||
#include <Evas.h>
|
||||
#include <Eina.h>
|
||||
|
||||
/* forward declaration */
|
||||
class Object;
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace Evasxx {
|
||||
|
@ -18,11 +21,10 @@ namespace Evasxx {
|
|||
/**
|
||||
* An Evas Canvas Wrapper
|
||||
*/
|
||||
class Canvas : public Eflxx:: Trackable
|
||||
class Canvas : public Eflxx::Trackable
|
||||
{
|
||||
public:
|
||||
Canvas( const Eflxx::Size &size );
|
||||
Canvas( Evas* evas ); // TODO: wrap?
|
||||
Canvas();
|
||||
~Canvas();
|
||||
|
||||
|
@ -66,9 +68,24 @@ public:
|
|||
Object* focusedObject() const;
|
||||
Object* objectAtTop() const;
|
||||
Object* objectAtBottom() const;
|
||||
|
||||
/*!
|
||||
* @brief C object wrapper factory method.
|
||||
*
|
||||
* For internal usage only! This return a new allocated Object that holds
|
||||
* the wrapped Evas_Object variable. With a delete on this object the wrapped
|
||||
* C type won't be freed.
|
||||
*
|
||||
* @param o The C to to be wrapped.
|
||||
* @return The wrapped C++ type.
|
||||
*/
|
||||
static Canvas *wrap (Evas_Object* o);
|
||||
|
||||
private:
|
||||
Canvas( Evas* evas );
|
||||
|
||||
Evas* o;
|
||||
bool mFree;
|
||||
};
|
||||
|
||||
inline ostream& operator<<( ostream& s, const Canvas& canvas )
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#include <string>
|
||||
|
||||
/* EFLxx */
|
||||
#include <eflxx/Common.h>
|
||||
#include <eflxx/Eflxx.h>
|
||||
//#include "Canvas.h"
|
||||
|
||||
/* EFL */
|
||||
#include <Evas.h>
|
||||
|
@ -18,6 +19,7 @@ namespace Evasxx {
|
|||
|
||||
/* forward declarations */
|
||||
class Smart;
|
||||
class Canvas;
|
||||
|
||||
/*!
|
||||
* An Evas Object wrapper
|
||||
|
@ -26,7 +28,7 @@ class Smart;
|
|||
*/
|
||||
class Object
|
||||
{
|
||||
friend class Canvas; // needed?
|
||||
//friend class Canvas; // needed?
|
||||
friend class EdjePart; // needed?
|
||||
|
||||
protected:
|
||||
|
@ -205,6 +207,13 @@ public:
|
|||
* @@see objectLink but with const variables
|
||||
*/
|
||||
static const Object* objectLink( const Evas_Object* evas_object = 0 );
|
||||
|
||||
/*!
|
||||
* Retrieves the Canvas that the current object is on.
|
||||
*
|
||||
* @return The Canvas that the object is on.
|
||||
*/
|
||||
Eflxx::CountedPtr <Canvas> getEvas ();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
/* EFLxx */
|
||||
#include <eflxx/CountedPtr.h>
|
||||
#include "Canvas.h"
|
||||
#include "Object.h"
|
||||
|
||||
/**
|
||||
* C++ Wrapper for the Enlightenment Smart Object Library (ESMART)
|
||||
|
@ -14,6 +15,9 @@
|
|||
*/
|
||||
|
||||
namespace Evasxx {
|
||||
|
||||
/* forward declarations */
|
||||
class Smart;
|
||||
|
||||
struct CustomEventWrap
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "../include/evasxx/Object.h"
|
||||
#include "../include/evasxx/Canvas.h"
|
||||
#include <eflxx/Common.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eflxx;
|
||||
|
@ -11,23 +11,26 @@ using namespace Eflxx;
|
|||
namespace Evasxx {
|
||||
|
||||
Canvas::Canvas()
|
||||
:Eflxx::Trackable( "Canvas" )
|
||||
:Eflxx::Trackable( "Canvas" ),
|
||||
mFree (true)
|
||||
{
|
||||
AllocTag( this, "Canvas" );
|
||||
Dout( dc::notice, "Canvas::Canvas - creating new Evas" );
|
||||
o = evas_new();
|
||||
}
|
||||
|
||||
Canvas::Canvas( Evas* evas )
|
||||
:Eflxx::Trackable( "Canvas" )
|
||||
Canvas::Canvas( Evas* evas ) :
|
||||
Eflxx::Trackable( "Canvas" ),
|
||||
mFree (false)
|
||||
{
|
||||
AllocTag( this, "Canvas" );
|
||||
Dout( dc::notice, "Canvas::Canvas - attaching to Evas" );
|
||||
o = evas;
|
||||
}
|
||||
|
||||
Canvas::Canvas( const Eflxx::Size &size )
|
||||
:Eflxx::Trackable( "Canvas" )
|
||||
Canvas::Canvas( const Eflxx::Size &size ) :
|
||||
Eflxx::Trackable( "Canvas" ),
|
||||
mFree (true)
|
||||
{
|
||||
AllocTag( this, "Canvas" );
|
||||
Dout( dc::notice, "Canvas::Canvas - creating new Evas" );
|
||||
|
@ -38,8 +41,11 @@ Canvas::Canvas( const Eflxx::Size &size )
|
|||
|
||||
Canvas::~Canvas()
|
||||
{
|
||||
Dout( dc::notice, "Canvas::~Canvas - freeing Evas" );
|
||||
evas_free( o );
|
||||
if (mFree)
|
||||
{
|
||||
Dout( dc::notice, "Canvas::~Canvas - freeing Evas" );
|
||||
evas_free (o);
|
||||
}
|
||||
}
|
||||
|
||||
int Canvas::lookupRenderMethod( const std::string &method )
|
||||
|
@ -164,5 +170,10 @@ Object* Canvas::objectAtBottom() const
|
|||
return Object::objectLink( evas_object_bottom_get( o ) );
|
||||
}
|
||||
|
||||
Canvas *Canvas::wrap (Evas_Object* o)
|
||||
{
|
||||
return new Canvas (evas_object_evas_get (o));
|
||||
}
|
||||
|
||||
} // end namespace Evasxx
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#endif
|
||||
|
||||
#include "../include/evasxx/Object.h"
|
||||
#include "../include/evasxx/Canvas.h"
|
||||
#include "Evas.h"
|
||||
|
||||
#include <cassert>
|
||||
|
@ -319,6 +320,7 @@ bool Object::hasFocus() const
|
|||
Object *Object::getParent (const Object &obj)
|
||||
{
|
||||
Evas_Object *eo = evas_object_smart_parent_get (o);
|
||||
// TODO: try if this works also with objectLink() logic...
|
||||
|
||||
return Object::wrap (eo);
|
||||
}
|
||||
|
@ -344,6 +346,11 @@ const Object* Object::objectLink( const Evas_Object *evas_object )
|
|||
return static_cast<const Object*>( v );
|
||||
}
|
||||
|
||||
Eflxx::CountedPtr <Canvas> Object::getEvas ()
|
||||
{
|
||||
return Eflxx::CountedPtr <Canvas> (Canvas::wrap (o));
|
||||
}
|
||||
|
||||
// PRIVATE
|
||||
void Object::registerCallbacks()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue