implemented external part param wrapper for C++
SVN revision: 55334
This commit is contained in:
parent
2e91be1d77
commit
a04f586b15
|
@ -17,6 +17,7 @@
|
||||||
#include "ImageStateEdit.h"
|
#include "ImageStateEdit.h"
|
||||||
#include "TextStateEdit.h"
|
#include "TextStateEdit.h"
|
||||||
#include "GradientStateEdit.h"
|
#include "GradientStateEdit.h"
|
||||||
|
#include "ExternalParam.h"
|
||||||
|
|
||||||
#endif // EDJEXX_H
|
#endif // EDJEXX_H
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef EDJEXX_EXTERNAL_PARAM_H
|
||||||
|
#define EDJEXX_EXTERNAL_PARAM_H
|
||||||
|
|
||||||
|
/* STD */
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/* EFL */
|
||||||
|
#include <Edje.h>
|
||||||
|
|
||||||
|
/* local */
|
||||||
|
#include "Part.h"
|
||||||
|
|
||||||
|
namespace Edjexx {
|
||||||
|
|
||||||
|
class ExternalParam
|
||||||
|
{
|
||||||
|
friend class Part;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ExternalParam (const std::string &name, int i);
|
||||||
|
ExternalParam (const std::string &name, bool b);
|
||||||
|
ExternalParam (const std::string &name, double d);
|
||||||
|
ExternalParam (const std::string &name, const char *c);
|
||||||
|
ExternalParam (const std::string &name, const std::string &s);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Edje_External_Param *getRaw ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Edje_External_Param mParam;
|
||||||
|
std::string mName;
|
||||||
|
std::string mStr;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace Edjexx
|
||||||
|
|
||||||
|
#endif // EDJEXX_EXTERNAL_PARAM_H
|
|
@ -10,7 +10,8 @@ libedjexx_HEADERS = \
|
||||||
StateEdit.h \
|
StateEdit.h \
|
||||||
ImageStateEdit.h \
|
ImageStateEdit.h \
|
||||||
TextStateEdit.h \
|
TextStateEdit.h \
|
||||||
GradientStateEdit.h
|
GradientStateEdit.h \
|
||||||
|
ExternalParam.h
|
||||||
|
|
||||||
libedjexxdir = \
|
libedjexxdir = \
|
||||||
$(pkgincludedir)
|
$(pkgincludedir)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
/* EFL++ */
|
/* EFL++ */
|
||||||
#include <eflxx/Common.h>
|
#include <eflxx/Common.h>
|
||||||
#include <eflxx/CountedPtr.h>
|
#include <eflxx/CountedPtr.h>
|
||||||
|
|
||||||
#include <evasxx/Object.h>
|
#include <evasxx/Object.h>
|
||||||
|
|
||||||
/* EFL */
|
/* EFL */
|
||||||
|
@ -17,6 +16,8 @@ using std::string;
|
||||||
|
|
||||||
namespace Edjexx {
|
namespace Edjexx {
|
||||||
|
|
||||||
|
// forward declarations
|
||||||
|
class ExternalParam;
|
||||||
class Object;
|
class Object;
|
||||||
|
|
||||||
class Part
|
class Part
|
||||||
|
@ -42,7 +43,7 @@ public:
|
||||||
Eflxx::CountedPtr <Evasxx::Object> getExternalObject ();
|
Eflxx::CountedPtr <Evasxx::Object> getExternalObject ();
|
||||||
|
|
||||||
// TODO: wrap Param?
|
// TODO: wrap Param?
|
||||||
bool setParam (const Edje_External_Param *param);
|
bool setParam (Edjexx::ExternalParam *param);
|
||||||
|
|
||||||
//const Evasxx::Object* getObject ( const char* name );
|
//const Evasxx::Object* getObject ( const char* name );
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../include/edjexx/ExternalParam.h"
|
||||||
|
|
||||||
|
namespace Edjexx {
|
||||||
|
|
||||||
|
ExternalParam::ExternalParam (const std::string &name, int i) :
|
||||||
|
mName (name)
|
||||||
|
{
|
||||||
|
mParam.name = mName.c_str ();
|
||||||
|
mParam.d = 0.0;
|
||||||
|
mParam.s = NULL;
|
||||||
|
mParam.i = i;
|
||||||
|
mParam.type = EDJE_EXTERNAL_PARAM_TYPE_INT;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExternalParam::ExternalParam (const std::string &name, bool b) :
|
||||||
|
mName (name)
|
||||||
|
{
|
||||||
|
mParam.name = mName.c_str ();
|
||||||
|
mParam.d = 0.0;
|
||||||
|
mParam.s = NULL;
|
||||||
|
mParam.i = b;
|
||||||
|
mParam.type = EDJE_EXTERNAL_PARAM_TYPE_BOOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExternalParam::ExternalParam (const std::string &name, double d) :
|
||||||
|
mName (name)
|
||||||
|
{
|
||||||
|
mParam.name = mName.c_str ();
|
||||||
|
mParam.d = d;
|
||||||
|
mParam.s = NULL;
|
||||||
|
mParam.i = 0;
|
||||||
|
mParam.type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExternalParam::ExternalParam (const std::string &name, const char *c) :
|
||||||
|
mName (name), mStr (c)
|
||||||
|
{
|
||||||
|
mParam.name = mName.c_str ();
|
||||||
|
mParam.d = 0.0;
|
||||||
|
mParam.s = mStr.c_str ();
|
||||||
|
mParam.i = 0;
|
||||||
|
mParam.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExternalParam::ExternalParam (const std::string &name, const std::string &s) :
|
||||||
|
mName (name), mStr (s)
|
||||||
|
{
|
||||||
|
mParam.name = mName.c_str ();
|
||||||
|
mParam.d = 0.0;
|
||||||
|
mParam.s = mStr.c_str ();
|
||||||
|
mParam.i = 0;
|
||||||
|
mParam.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
Edje_External_Param *ExternalParam::getRaw ()
|
||||||
|
{
|
||||||
|
return &mParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace Edjexx
|
|
@ -25,7 +25,8 @@ libedjexx_la_SOURCES = \
|
||||||
StateEdit.cpp \
|
StateEdit.cpp \
|
||||||
ImageStateEdit.cpp \
|
ImageStateEdit.cpp \
|
||||||
TextStateEdit.cpp \
|
TextStateEdit.cpp \
|
||||||
GradientStateEdit.cpp
|
GradientStateEdit.cpp \
|
||||||
|
ExternalParam.cpp
|
||||||
|
|
||||||
libedjexx_la_LIBADD = \
|
libedjexx_la_LIBADD = \
|
||||||
$(EFL_LIBS)
|
$(EFL_LIBS)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "../include/edjexx/Part.h"
|
#include "../include/edjexx/Part.h"
|
||||||
#include "../include/edjexx/Object.h"
|
#include "../include/edjexx/Object.h"
|
||||||
|
#include "../include/edjexx/ExternalParam.h"
|
||||||
|
|
||||||
/* STD */
|
/* STD */
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -71,9 +72,9 @@ Eflxx::CountedPtr <Evasxx::Object> Part::getExternalObject ()
|
||||||
return Eflxx::CountedPtr <Evasxx::Object> (ret_o);
|
return Eflxx::CountedPtr <Evasxx::Object> (ret_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Part::setParam (const Edje_External_Param *param)
|
bool Part::setParam (Edjexx::ExternalParam *param)
|
||||||
{
|
{
|
||||||
return edje_object_part_external_param_set (_parent->obj (), _partname.c_str (), param);
|
return edje_object_part_external_param_set (_parent->obj (), _partname.c_str (), param->getRaw ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*const Evasxx::Object* Part::getObject ( const char* name )
|
/*const Evasxx::Object* Part::getObject ( const char* name )
|
||||||
|
|
|
@ -66,20 +66,12 @@ int main (int argc, char **argv)
|
||||||
|
|
||||||
Eflxx::CountedPtr <Edjexx::Part> part (edje->getPart ("Slider01"));
|
Eflxx::CountedPtr <Edjexx::Part> part (edje->getPart ("Slider01"));
|
||||||
|
|
||||||
Edje_External_Param param;
|
Edjexx::ExternalParam param ("value", 5.0f);
|
||||||
param.type = EDJE_EXTERNAL_PARAM_TYPE_DOUBLE;
|
Edjexx::ExternalParam param2 ("label", "Changed Slider Value");
|
||||||
param.name = "value";
|
|
||||||
param.d = 5;
|
|
||||||
|
|
||||||
Edje_External_Param param2;
|
|
||||||
param2.type = EDJE_EXTERNAL_PARAM_TYPE_STRING;
|
|
||||||
param2.name = "label";
|
|
||||||
param2.s = "Changed Slider Value";
|
|
||||||
|
|
||||||
part->setParam (¶m);
|
part->setParam (¶m);
|
||||||
part->setParam (¶m2);
|
part->setParam (¶m2);
|
||||||
|
|
||||||
|
|
||||||
bg->setWeightHintSize (1.0, 1.0);
|
bg->setWeightHintSize (1.0, 1.0);
|
||||||
elmWin->addObjectResize (*bg);
|
elmWin->addObjectResize (*bg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue