new emotionxx API

SVN revision: 44073
This commit is contained in:
Andreas Volz 2009-11-30 22:07:43 +00:00
parent bad07b7aa9
commit c97f9972df
7 changed files with 138 additions and 129 deletions

View File

@ -0,0 +1,13 @@
#ifndef EMOTIONXX_H
#define EMOTIONXX_H
/* This is the main include header for Emotionxx. You should include it in your
* application. you could also use a combination of some headers and forward
* declarations to speed up compiling. But the default way is to simply
* #include "Emotionxx.h".
*/
#include "Object.h"
#endif // EMOTIONXX_H

View File

@ -1,45 +0,0 @@
#ifndef EVAS_EMOTION_H
#define EVAS_EMOTION_H
/* EFL++ */
#include <eflxx/eflpp_common.h>
#include <evasxx/EvasCanvas.h>
#include <evasxx/EvasObject.h>
/* STD */
#include <iostream>
using namespace std;
/**
* C++ Wrapper for the Enlightenment Emotion Library (EMOTION)
*
* @author Michael 'Mickey' Lauer <mickey@Vanille.de>
*/
namespace efl {
class EvasEmotion : public EvasObject
{
public:
EvasEmotion( EvasCanvas &canvas, const std::string &module_filename );
EvasEmotion( EvasCanvas &canvas, const std::string &filename, const std::string &module_filename );
EvasEmotion( EvasCanvas &canvas, const Point &pos, const std::string &filename, const std::string &module_filename );
EvasEmotion( EvasCanvas &canvas, const Rect &rect, const std::string &filename, const std::string &module_filename );
~EvasEmotion();
/**
* Initialize video engine to either use xine or gstreamer
*
* @param module_filename name of viedo engine to be used
*/
void engineInit(const std::string &module_filename);
void setFile( const std::string &filename );
void setPlay( bool b );
void setSmoothScale( bool b );
};
}
#endif // EVAS_EMOTION_H

View File

@ -1,6 +1,6 @@
libemotionxx_HEADERS = \
EvasEmotion.h
Object.h
libemotionxxdir = \
$(pkgincludedir)

View File

@ -0,0 +1,45 @@
#ifndef EMOTIONXX_OBJECT_H
#define EMOTIONXX_OBJECT_H
/* EFL++ */
#include <eflxx/Common.h>
#include <evasxx/Canvas.h>
#include <evasxx/Object.h>
/* STD */
#include <iostream>
using namespace std;
/**
* C++ Wrapper for the Enlightenment Emotion Library (EMOTION)
*
* @author Michael 'Mickey' Lauer <mickey@Vanille.de>
*/
namespace Emotionxx {
class Object : public Evasxx::Object
{
public:
Object( Evasxx::Canvas &canvas, const std::string &module_filename );
Object( Evasxx::Canvas &canvas, const std::string &filename, const std::string &module_filename );
Object( Evasxx::Canvas &canvas, const Eflxx::Point &pos, const std::string &filename, const std::string &module_filename );
Object( Evasxx::Canvas &canvas, const Eflxx::Rect &rect, const std::string &filename, const std::string &module_filename );
~Object();
/**
* Initialize video engine to either use xine or gstreamer
*
* @param module_filename name of viedo engine to be used
*/
void engineInit(const std::string &module_filename);
void setFile( const std::string &filename );
void setPlay( bool b );
void setSmoothScale( bool b );
};
} // end namespace Emotionxx
#endif // EMOTIONXX_OBJECT_H

View File

@ -1,82 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "../include/emotionxx/EvasEmotion.h"
extern "C" {
#include <Emotion.h>
}
#include <iostream>
#include <assert.h>
using namespace std;
namespace efl {
//===============================================================================================
// EvasEmotion
//===============================================================================================
EvasEmotion::EvasEmotion( EvasCanvas &canvas, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init();
engineInit(module_filename);
}
EvasEmotion::EvasEmotion( EvasCanvas &canvas, const std::string &filename, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init();
engineInit(module_filename);
setFile( filename );
}
EvasEmotion::EvasEmotion( EvasCanvas &canvas, const Point &pos, const std::string &filename, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init( );
engineInit(module_filename);
setFile( filename );
move( pos );
}
EvasEmotion::EvasEmotion( EvasCanvas &canvas, const Rect &rect, const std::string &filename, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init( );
engineInit(module_filename);
setFile( filename );
setGeometry (rect);
}
void EvasEmotion::engineInit(const std::string &module_filename)
{
if (!emotion_object_init(o, module_filename.c_str ()))
return; // FIXME: why a return here?
}
void EvasEmotion::setFile( const std::string &filename )
{
emotion_object_file_set( o, filename.c_str () );
}
void EvasEmotion::setPlay( bool b )
{
emotion_object_play_set( o, b );
}
void EvasEmotion::setSmoothScale( bool b )
{
emotion_object_smooth_scale_set( o, b );
}
EvasEmotion::~EvasEmotion()
{
}
}

View File

@ -16,7 +16,7 @@ lib_LTLIBRARIES = \
libemotionxx.la
libemotionxx_la_SOURCES = \
EvasEmotion.cpp
Object.cpp
libemotionxx_la_LIBADD = \
$(EFL_LIBS)

78
emotionxx/src/Object.cpp Normal file
View File

@ -0,0 +1,78 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "../include/emotionxx/Object.h"
extern "C" {
#include <Emotion.h>
}
#include <iostream>
#include <assert.h>
using namespace std;
namespace Emotionxx {
Object::Object( Evasxx::Canvas &canvas, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init();
engineInit(module_filename);
}
Object::Object( Evasxx::Canvas &canvas, const std::string &filename, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init();
engineInit(module_filename);
setFile( filename );
}
Object::Object( Evasxx::Canvas &canvas, const Eflxx::Point &pos, const std::string &filename, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init( );
engineInit(module_filename);
setFile( filename );
move( pos );
}
Object::Object( Evasxx::Canvas &canvas, const Eflxx::Rect &rect, const std::string &filename, const std::string &module_filename )
{
o = emotion_object_add( canvas.obj() );
init( );
engineInit(module_filename);
setFile( filename );
setGeometry (rect);
}
Object::~Object()
{
}
void Object::engineInit(const std::string &module_filename)
{
if (!emotion_object_init(o, module_filename.c_str ()))
return; // FIXME: why a return here?
}
void Object::setFile( const std::string &filename )
{
emotion_object_file_set( o, filename.c_str () );
}
void Object::setPlay( bool b )
{
emotion_object_play_set( o, b );
}
void Object::setSmoothScale( bool b )
{
emotion_object_smooth_scale_set( o, b );
}
} // end namespace Emotionxx