background: wrap image setting
authorJoe Konno <joe.konno@intel.com>
Wed, 20 Jun 2012 17:59:31 +0000 (10:59 -0700)
committerJoe Konno <joe.konno@intel.com>
Wed, 20 Jun 2012 17:59:31 +0000 (10:59 -0700)
Signed-off-by: Joe Konno <joe.konno@intel.com>
src/efl/Makefile.am
src/efl/background.cpp
src/efl/background.h

index b3c3a75..48c3320 100644 (file)
@@ -4,16 +4,21 @@ if BUILD_EFL_TESTS
 TESTS = wayland-efl-test
 TESTS_ENVIRONMENT = $(SHELL) ../test-harness
 
+MEDIA = \"$(PWD)/../../media\"
+
 CXXFLAGS +=                    \
        -std=gnu++0x            \
        $(CAIRO_CFLAGS)         \
        $(WAYLAND_CFLAGS)       \
+       -DMEDIA_PATH=$(MEDIA)   \
        @EFL_CFLAGS@
 
 LDFLAGS +=                     \
        $(CAIRO_LIBS)           \
        $(WAYLAND_LIBS)         \
        @EFL_LIBS@              \
+       -lboost_system          \
+       -lboost_filesystem      \
        -lboost_unit_test_framework
 
 bin_PROGRAMS = $(TESTS)
@@ -29,7 +34,6 @@ wayland_efl_test_SOURCES =    \
        test_window.cpp         \
        test_engine_set.cpp     \
        test_actionslider.cpp   \
-       test_background.cpp     \
        ../testmain.cpp
 
 endif
index 34abf79..471445c 100644 (file)
@@ -14,11 +14,25 @@ void Background::setColor(int red, int green, int blue)
        elm_bg_color_set(*this, red, green, blue);
 }
 
+void Background::setImage(const path& p)
+{
+       (void) elm_bg_file_set(*this, p.c_str(), NULL);
+}
+
 void Background::getColor(int* red, int* green, int* blue)
 {
        elm_bg_color_get(*this, red, green, blue);
 }
 
+void Background::getImage(path& p)
+{
+       char* ret = NULL;
+
+       elm_bg_file_get(*this, const_cast<const char**>(&ret), NULL);
+
+       p = ret;
+}
+
 Background::operator Evas_Object*()
 {
        return EvasObject::obj_;
index aa6682c..d9c4c03 100644 (file)
@@ -1,19 +1,27 @@
 #ifndef __WAYLAND_EFL_BACKGROUND_H__
 #define __WAYLAND_EFL_BACKGROUND_H__
 
-#include <string>
-#include <Elementary.h>
+#ifndef MEDIA_PATH
+#error "The MEDIA_PATH macro must be defined-- pass definition in CXXFLAGS."
+#endif
 
+#define BOOST_FILESYSTEM_VERSION 3
+#include <boost/filesystem.hpp>
+#include <Elementary.h>
 #include "evasobject.h"
 
+using boost::filesystem::path;
+
 class Background : public EvasObject
 {
 public:
        Background(Evas_Object *parent);
 
        void setColor(int, int, int);
+       void setImage(const path&);
 
        void getColor(int*, int*, int*);
+       void getImage(path&);
 
        operator Evas_Object*();