tasn pushed a commit to branch master.

http://git.enlightenment.org/bindings/cxx/eflxx.git/commit/?id=51245f4cda60993b89d9750931b7db8158bf85c8

commit 51245f4cda60993b89d9750931b7db8158bf85c8
Author: Andreas Volz <li...@brachttal.net>
Date:   Sun Feb 5 21:00:31 2012 +0000

    wrap some more of elementary API to C++ wrapper
    
    
    SVN revision: 67704
---
 eflxx_examples/src/elementaryxx/external/main.cpp |   2 +-
 eflxx_examples/src/elementaryxx/full/main.cpp     |   2 +-
 eflxx_examples/src/elementaryxx/simple/main.cpp   |   2 +-
 elementaryxx/include/elementaryxx/Application.h   |   2 +-
 elementaryxx/include/elementaryxx/Background.h    | 102 +++++++++++++++++++++-
 elementaryxx/src/Application.cpp                  |   8 +-
 elementaryxx/src/Background.cpp                   |  32 ++++++-
 elementaryxx/src/Object.cpp                       |   1 +
 8 files changed, 139 insertions(+), 12 deletions(-)

diff --git a/eflxx_examples/src/elementaryxx/external/main.cpp 
b/eflxx_examples/src/elementaryxx/external/main.cpp
index 91dd3ce..8680bfd 100644
--- a/eflxx_examples/src/elementaryxx/external/main.cpp
+++ b/eflxx_examples/src/elementaryxx/external/main.cpp
@@ -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);
 
diff --git a/eflxx_examples/src/elementaryxx/full/main.cpp 
b/eflxx_examples/src/elementaryxx/full/main.cpp
index 7b0bff4..9832b5d 100644
--- a/eflxx_examples/src/elementaryxx/full/main.cpp
+++ b/eflxx_examples/src/elementaryxx/full/main.cpp
@@ -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);
 
diff --git a/eflxx_examples/src/elementaryxx/simple/main.cpp 
b/eflxx_examples/src/elementaryxx/simple/main.cpp
index 3a9e7e2..1cd6a6a 100644
--- a/eflxx_examples/src/elementaryxx/simple/main.cpp
+++ b/eflxx_examples/src/elementaryxx/simple/main.cpp
@@ -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);
 
diff --git a/elementaryxx/include/elementaryxx/Application.h 
b/elementaryxx/include/elementaryxx/Application.h
index 6617407..9cad094 100644
--- a/elementaryxx/include/elementaryxx/Application.h
+++ b/elementaryxx/include/elementaryxx/Application.h
@@ -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 ();
diff --git a/elementaryxx/include/elementaryxx/Background.h 
b/elementaryxx/include/elementaryxx/Background.h
index 7b00cea..1f72f08 100644
--- a/elementaryxx/include/elementaryxx/Background.h
+++ b/elementaryxx/include/elementaryxx/Background.h
@@ -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
diff --git a/elementaryxx/src/Application.cpp b/elementaryxx/src/Application.cpp
index 58e855d..bdea55f 100644
--- a/elementaryxx/src/Application.cpp
+++ b/elementaryxx/src/Application.cpp
@@ -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 ()
diff --git a/elementaryxx/src/Background.cpp b/elementaryxx/src/Background.cpp
index b9a4001..057ceaf 100644
--- a/elementaryxx/src/Background.cpp
+++ b/elementaryxx/src/Background.cpp
@@ -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
diff --git a/elementaryxx/src/Object.cpp b/elementaryxx/src/Object.cpp
index a8c9292..8dfafdf 100644
--- a/elementaryxx/src/Object.cpp
+++ b/elementaryxx/src/Object.cpp
@@ -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 :-(

-- 


Reply via email to