- added somehow missing implementation of Edje class

- changed setters and getters in Color class

SVN revision: 38440
This commit is contained in:
Andreas Volz 2009-01-03 13:02:02 +00:00
parent f12ec14777
commit a254d0fee1
6 changed files with 191 additions and 29 deletions

1
TODO
View File

@ -7,3 +7,4 @@
* create a wrap() function for all classes
* use PImpl implementation to avoid include of EFL headers direct in applications
* one header and cpp file for each class
* data lookup function to let examples also run without installing

View File

@ -407,7 +407,7 @@ bool CalibrationAnimator::tick()
if ( c.alpha() == _x ) return false;
if ( newx > _x ) newx--;
if ( newx < _x ) newx++;
_o->setColor( c.r(), c.g(), c.b(), newx );
_o->setColor( c.red(), c.green(), c.blue(), newx );
return true;
}

View File

@ -83,23 +83,31 @@ class Rect
class Color
{
public:
Color( int r = 255, int g = 255, int b = 255, int alpha = 255 ) : _r(r), _g(g), _b(b), _alpha(alpha) {};
Color( int r = 255, int g = 255, int b = 255, int a = 255 ) : _r(r), _g(g), _b(b), _a(a) {};
~Color() {};
void set( int r, int g, int b, int alpha = 255 ) { _r = r; _g = g; _b = b; _alpha = alpha; };
int r() const { return _r; };
int g() const { return _g; };
int b() const { return _b; };
int alpha() const { return _alpha; };
void set( int r, int g, int b, int a = 255 ) { _r = r; _g = g; _b = b; _a = a; };
void red ( int r ) { _r = r; }
void green ( int g ) { _g = g; }
void blue ( int b ) { _b = b; }
void alpha ( int a ) { _a = a; }
int red() const { return _r; };
int green() const { return _g; };
int blue() const { return _b; };
int alpha() const { return _a; };
private:
int _r;
int _g;
int _b;
int _alpha;
int _a;
};
inline ostream& operator<<( ostream& s, const Color& color )
{
return s << "(RGBA " << color.r() << "," << color.g() << "," << color.b() << "," << color.alpha() << ")";
return s << "(RGBA " << color.red() << "," << color.green() << "," << color.blue() << "," << color.alpha() << ")";
}
inline ostream& operator<<( ostream& s, const Point& point )
{

View File

@ -9,7 +9,145 @@
using namespace std;
namespace efl {
int Edje::init()
{
return edje_init ();
}
int Edje::shutdown()
{
return edje_shutdown ();
}
double Edje::frametime()
{
return edje_frametime_get ();
}
void Edje::setFrametime( double t )
{
edje_frametime_set (t);
}
void Edje::freeze()
{
edje_freeze ();
}
void Edje::thaw()
{
edje_thaw ();
}
const string Edje::fontset()
{
return edje_fontset_append_get ();
}
void Edje::setFontSet( const string &fonts )
{
edje_fontset_append_set (fonts.c_str ());
}
double scale ()
{
return edje_scale_get ();
}
void setScale (double scale)
{
edje_scale_set (scale);
}
Eina_List *Edje::collection( const string &file )
{
return edje_file_collection_list (file.c_str ());
}
void Edje::freeCollection( Eina_List *lst )
{
edje_file_collection_list_free (lst);
}
bool Edje::exitsFileGroup (const string &file, const string &glob)
{
return edje_file_group_exists (file.c_str (), glob.c_str ());
}
const string Edje::data( const string &file, const string &key )
{
return edje_file_data_get (file.c_str (), key.c_str ());
}
void Edje::setFileCache( int count )
{
edje_file_cache_set (count);
}
int Edje::fileCache()
{
return edje_file_cache_get ();
}
void Edje::flushFileCache()
{
edje_file_cache_flush ();
}
void Edje::setCollectionCache( int count )
{
edje_collection_cache_set (count);
}
int Edje::collectionCache()
{
return edje_file_cache_get ();
}
void Edje::flushCollectionCache()
{
edje_file_cache_flush ();
}
void Edje::setColorClass( const string &colorclass, const Color& object, const Color& outline, const Color& shadow )
{
edje_color_class_set (colorclass.c_str (),
object.red (), object.green (), object.blue (), object.alpha (),
outline.red (), outline.green (), outline.blue (), outline.alpha (),
shadow.red (), shadow.green (), shadow.blue (), shadow.alpha ()
);
}
void Edje::delColorClass( const string &colorclass )
{
edje_color_class_del (colorclass.c_str ());
}
Eina_List *Edje::listColorclass( )
{
return edje_color_class_list();
}
void Edje::setTextClass( const string &textclass, const string &font, Evas_Font_Size size )
{
edje_text_class_set (textclass.c_str (), font.c_str (), size);
}
void Edje::delTextClass (const string &textclass)
{
edje_text_class_del (textclass.c_str ());
}
Eina_List *Edje::listTextClass ()
{
return edje_text_class_list ();
}
void Edje::processSignalMessage ()
{
edje_message_signal_process ();
}
} // end namespace efl

View File

@ -14,9 +14,14 @@
#include "eflpp_edjepart.h"
#include "eflpp_evasedje.h"
/* STD */
#include <string>
/* EFL */
#include <Edje.h>
using std::string;
/**
* C++ Wrapper for the Enlightenment Edje Library (EDJE)
*
@ -25,14 +30,6 @@
namespace efl {
//typedef std::map<const char*, EdjePart*> EdjePartMap;
//===============================================================================================
// Edje
//===============================================================================================
// TODO: why is the implementation empty?
class Edje
{
public:
@ -40,34 +37,52 @@ class Edje
static int shutdown();
static double frametime();
static void setFrametime( double );
static void setFrametime( double t );
static void freeze();
static void thaw();
static const char* fontset();
static void setFontSet( const char* fonts );
static const string fontset();
static void setFontSet( const string &fonts );
static double scale ();
static void setScale (double scale);
static Eina_List *collection( const string &file ); // TODO: wrap Eina_List
static void freeCollection( Eina_List *lst ); // TODO: wrap Eina_List
static bool exitsFileGroup (const string &file, const string &glob);
static EvasList<const char>* collection( const char* filename );
static void freeCollection( EvasList<const char>* );
static const string data( const string &file, const string &key );
static const char* data( const char* filename, const char* key );
static void setFileCache( int size );
static void setFileCache( int count );
static int fileCache();
static void flushFileCache();
static void setCollectionCache( int size );
static void setCollectionCache( int count );
static int collectionCache();
static void flushCollectionCache();
static void setColorClass( const char* classname, const Color& object, const Color& outline, const Color& shadow );
static void setTextClass( const char* classname, const char* fontname, int size );
static void setColorClass( const string &colorclass, const Color& object, const Color& outline, const Color& shadow );
static void delColorClass( const string &colorclass );
static Eina_List *listColorclass( ); // TODO: wrap Eina_List
static void setTextClass( const string &textclass, const string &font, int size );
static void delTextClass (const string &textclass);
static Eina_List *listTextClass (); // TODO: wrap Eina_List
/*
TODO: what do do with this functions?; what are their usage?
EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh);
EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh);
EAPI void edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah);
EAPI void edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data);
*/
static void processSignalMessage ();
private:
Edje();
Edje( const Edje& );

View File

@ -146,7 +146,7 @@ void EvasObject::setColor( int r, int g, int b, int alpha )
void EvasObject::setColor( const Color& c )
{
setColor( c.r(), c.g(), c.b(), c.alpha() );
setColor( c.red(), c.green(), c.blue(), c.alpha() );
}
int EvasObject::colorInterpolation() const