wrap some more of elementary API to C++ wrapper

SVN revision: 67704
This commit is contained in:
Andreas Volz 2012-02-05 21:00:31 +00:00
parent 460b35fe6f
commit 51245f4cda
8 changed files with 139 additions and 12 deletions

View File

@ -26,7 +26,7 @@ static void testFunc (Evasxx::Object &obj, void *event_info)
cout << "sub-object-del" << endl;
}
int main (int argc, const char **argv)
int main (int argc, char **argv)
{
Application elmApp (argc, argv);

View File

@ -77,7 +77,7 @@ my_win_del (Evasxx::Object &obj, void *event_info)
#endif // ELM_LIB_QUICKLAUNCH
int main (int argc, const char **argv)
int main (int argc, char **argv)
{
elmApp = new Application (argc, argv);

View File

@ -22,7 +22,7 @@ static void testFunc (Evasxx::Object &obj, void *event_info)
cout << "sub-object-del" << endl;
}
int main (int argc, const char **argv)
int main (int argc, char **argv)
{
Application elmApp (argc, argv);

View File

@ -11,7 +11,7 @@ namespace Elmxx {
class Application
{
public:
Application (int argc, const char **argv);
Application (int argc, char **argv);
virtual ~Application ();
static void run ();

View File

@ -13,14 +13,108 @@ class Background : public Object
{
public:
static Background *factory (Evasxx::Object &parent);
/**
* Set the image file used for the background
*
* This sets the image file used in the background object. The image
* will be stretched (retaining aspect if its an image file) to completely fill
* the bg object. This may mean some parts are not visible.
*
* @note Once the image of @p obj is set, a previously set one will be deleted,
* even if @p file is empty.
*
* @ingroup Background
*/
void setFile (const std::string &file);
/*!
* FIXME: do bool return here?
* @see Image::setFile
/**
* Set the edje file/group used for the background
*
* This sets the image file used in the background object. The edje
* will be stretched (retaining aspect if its an image file) to completely fill
* the bg object. This may mean some parts are not visible.
*
* @note Once the image of @p obj is set, a previously set one will be deleted,
* even if @p file is empty.
*
* @ingroup Background
*/
void setFile (const std::string &file, const std::string &group);
#if 0
/** // TODO
* Get the file (image or edje) used for the background
*
* @param obj The bg object
* @param file The file path
* @param group Optional key (group in Edje) within the file
*
* @ingroup @ingroup Background
*/
EAPI void elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group);
#endif
/**
* Set the option used for the background image
*
* @param option The desired background option (TILE, SCALE)
*
* This sets the option used for manipulating the display of the background
* image. The image can be tiled or scaled.
*
* @ingroup Background
*/
void setOption(Elm_Bg_Option option);
/**
* Get the option used for the background image
*
* @return The desired background option (CENTER, SCALE, STRETCH or TILE)
*
* @ingroup Background
*/
Elm_Bg_Option getOption();
/**
* Set the option used for the background color
*
* @param rgb
*
* This sets the RGB color used for the background rectangle. Its range goes
* from 0 to 255. The alpha component is ignored by this function.
*
* @ingroup Background
*/
void setColor(const Eflxx::Color rgb);
/**
* Get the option used for the background color
*
* @return The RGB color. The alpha component is ignored by this function.
*
* @ingroup Background
*/
Eflxx::Color getColor();
/**
* Set the size of the pixmap representation of the image.
*
* This option just makes sense if an image is going to be set in the bg.
*
* @param s The new size of the image pixmap representation.
*
* This function sets a new size for pixmap representation of the given bg
* image. It allows the image to be loaded already in the specified size,
* reducing the memory usage and load time when loading a big image with load
* size set to a smaller size.
*
* NOTE: this is just a hint, the real size of the pixmap may differ
* depending on the type of image being loaded, being bigger than requested.
*
* @ingroup Background
*/
void setLoadSize (Eflxx::Size s);
private:
Background (); // forbid standard constructor

View File

@ -7,13 +7,17 @@
/* EFL */
#include <Elementary.h>
/* STD */
#include <cassert>
#include <iostream>
using namespace std;
namespace Elmxx {
Application::Application (int argc, const char **argv)
Application::Application (int argc, char **argv)
{
elm_init (argc, const_cast <char**> (argv));
elm_init (argc, argv);
}
Application::~Application ()

View File

@ -24,12 +24,40 @@ Background *Background::factory (Evasxx::Object &parent)
void Background::setFile (const std::string &file)
{
elm_bg_file_set (o, file.c_str (), NULL);
elm_bg_file_set (o, file.empty() ? NULL : file.c_str (), NULL);
}
void Background::setFile (const std::string &file, const std::string &group)
{
elm_bg_file_set (o, file.c_str (), group.c_str ());
elm_bg_file_set (o, file.empty() ? NULL : file.c_str (), group.empty() ? NULL : group.c_str ());
}
void Background::setOption(Elm_Bg_Option option)
{
elm_bg_option_set(o, option);
}
Elm_Bg_Option Background::getOption()
{
return elm_bg_option_get(o);
}
void Background::setColor(const Eflxx::Color c)
{
elm_bg_color_set(o, c.red(), c.green(), c.blue());
}
Eflxx::Color Background::getColor()
{
int r,g,b;
elm_bg_color_get(o, &r, &g, &b);
Eflxx::Color rgb (r,g,b);
return rgb;
}
void Background::setLoadSize (Eflxx::Size s)
{
elm_bg_load_size_set(o, s.width(), s.height());
}
} // end namespace Elmxx

View File

@ -28,6 +28,7 @@ void Object::elmInit ()
void Object::destroy ()
{
evas_object_del (o);
cout << "Object::destroy ()" << endl;
// do a suicide as the delete operator isn't public available
// the reason is that the C design below is a suicide design :-(