Add Geometry and Position queries to EvasObject class.
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 2 Apr 2013 16:23:44 +0000 (09:23 -0700)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 2 Apr 2013 16:23:44 +0000 (09:23 -0700)
Moved Geometry and Position to common/util.h and added
getGeometry and getPosition to EvasObject.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/common/util.h
src/efl/elmtestharness.cpp
src/efl/elmtestharness.h
src/efl/evasobject.cpp
src/efl/evasobject.h
src/efl/wayland-fits.cpp
src/efl/wayland-fits.h

index 4ac66b7..85a720c 100644 (file)
@@ -11,4 +11,34 @@ boost::lambda::placeholder1_type _1_;
 boost::lambda::placeholder2_type _2_;
 boost::lambda::placeholder3_type _3_;
 
+struct Geometry
+{
+       Geometry()
+               : x(-1)
+               , y(-1)
+               , width(-1)
+               , height(-1)
+       {
+               return;
+       }
+
+       int32_t x;
+       int32_t y;
+       int32_t width;
+       int32_t height;
+};
+
+struct Position
+{
+       Position()
+               : x(-1)
+               , y(-1)
+       {
+               return;
+       }
+
+       int32_t x;
+       int32_t y;
+};
+
 #endif
index 873122f..00384c1 100644 (file)
@@ -56,7 +56,7 @@ void ElmTestHarness::assertCondition(Condition condition, const std::string& mes
        ASSERT_MSG(condition(), message);
 }
 
-ElmTestHarness::Geometry ElmTestHarness::getSurfaceGeometry(wl_surface* surface)
+Geometry ElmTestHarness::getSurfaceGeometry(wl_surface* surface)
 {
        WaylandFits::QueryRequest* request = wfits_.makeGeometryRequest(surface);
 
@@ -73,7 +73,7 @@ ElmTestHarness::Geometry ElmTestHarness::getSurfaceGeometry(wl_surface* surface)
        return result;
 }
 
-ElmTestHarness::Position ElmTestHarness::getGlobalPointerPosition() const
+Position ElmTestHarness::getGlobalPointerPosition() const
 {
        WaylandFits::QueryRequest* request = wfits_.makeGlobalPointerPositionRequest();
 
index 2b18db0..0ff4e18 100644 (file)
@@ -9,8 +9,6 @@
 class ElmTestHarness : public TestHarness
 {
 public:
-       typedef WaylandFits::Geometry Geometry;
-       typedef WaylandFits::Position Position;
        typedef boost::function<bool (void)> Condition;
 
        /**
index 607e2c3..16f0589 100644 (file)
@@ -26,6 +26,11 @@ EvasObject::operator Evas_Object*()
        return obj_;
 }
 
+EvasObject::operator const Evas_Object*() const
+{
+       return obj_;
+}
+
 void EvasObject::setSize(int w, int h)
 {
        evas_object_resize(*this, w, h);
@@ -46,21 +51,35 @@ void EvasObject::hide()
        evas_object_hide(*this);
 }
 
-const int EvasObject::getX()
+Geometry EvasObject::getGeometry() const
+{
+       Geometry g;
+       evas_object_geometry_get(*this, &g.x, &g.y, &g.width, &g.height);
+       return g;
+}
+
+Position EvasObject::getPosition() const
+{
+       Position p;
+       evas_object_geometry_get(*this, &p.x, &p.y, NULL, NULL);
+       return p;
+}
+
+int EvasObject::getX() const
 {
        int x;
        evas_object_geometry_get(*this, &x, NULL, NULL, NULL);
        return x;
 }
 
-const int EvasObject::getY()
+int EvasObject::getY() const
 {
        int y;
        evas_object_geometry_get(*this, NULL, &y, NULL, NULL);
        return y;
 }
 
-const int EvasObject::getWidth()
+int EvasObject::getWidth() const
 {
        int w;
        evas_object_geometry_get(*this, NULL, NULL, &w, NULL);
@@ -68,7 +87,7 @@ const int EvasObject::getWidth()
        return w;
 }
 
-const int EvasObject::getHeight()
+int EvasObject::getHeight() const
 {
        int h;
        evas_object_geometry_get(*this, NULL, NULL, NULL, &h);
@@ -76,7 +95,7 @@ const int EvasObject::getHeight()
        return h;
 }
 
-const Eina_Bool EvasObject::isVisible()
+Eina_Bool EvasObject::isVisible() const
 {
        return evas_object_visible_get(*this);
 }
index 3ea8bdc..b85bb9f 100644 (file)
@@ -2,6 +2,7 @@
 #define __WAYLAND_EFL_EVAS_OBJECT_H__
 
 #include <Evas.h>
+#include "common/util.h"
 
 class EvasObject
 {
@@ -15,15 +16,20 @@ public:
        void show();
        void hide();
 
-       const int getWidth();
-       const int getHeight();
-       const int getX();
-       const int getY();
-       const Eina_Bool isVisible();
+       int getWidth() const;
+       int getHeight() const;
+       int getX() const;
+       int getY() const;
+       Geometry getGeometry() const;
+       Position getPosition() const;
+
+       Eina_Bool isVisible() const;
+
 
 //     operator Evas*();
        
        operator Evas_Object*();
+       operator const Evas_Object*() const;
 
        void checkSize(const int width, const int height);
        void checkPosition(const int x, const int y);
index 689bc8e..d817f61 100644 (file)
@@ -49,22 +49,6 @@ void WaylandFits::ensureBound() const
        ASSERT(wfits_query_ != NULL);
 }
 
-WaylandFits::Geometry::Geometry()
-       : x(-1)
-       , y(-1)
-       , width(-1)
-       , height(-1)
-{
-       return;
-}
-
-WaylandFits::Position::Position()
-       : x(-1)
-       , y(-1)
-{
-       return;
-}
-
 WaylandFits::QueryRequest::QueryRequest()
        : done(false)
        , data(NULL)
@@ -77,7 +61,7 @@ query_result_surface_geometry(void *data, wfits_query_result *result,
        wl_fixed_t x, wl_fixed_t y, int32_t w, int32_t h)
 {
        WaylandFits::QueryRequest* qr = static_cast<WaylandFits::QueryRequest*>(data);
-       WaylandFits::Geometry* g = static_cast<WaylandFits::Geometry*>(qr->data);
+       Geometry* g = static_cast<Geometry*>(qr->data);
        g->x = wl_fixed_to_int(x);
        g->y = wl_fixed_to_int(y);
        g->width = w;
@@ -109,7 +93,7 @@ query_result_global_pointer_position(void *data, wfits_query_result *result,
        wl_fixed_t x, wl_fixed_t y)
 {
        WaylandFits::QueryRequest* qr = static_cast<WaylandFits::QueryRequest*>(data);
-       WaylandFits::Position* g = static_cast<WaylandFits::Position*>(qr->data);
+       Position* g = static_cast<Position*>(qr->data);
        g->x = wl_fixed_to_int(x);
        g->y = wl_fixed_to_int(y);
        qr->done = true;
index ae87882..95a20b7 100644 (file)
@@ -4,6 +4,7 @@
 #include <Ecore.h>
 #include <Ecore_Wayland.h>
 #include "extensions/protocol/wayland-fits-client-protocol.h"
+#include "common/util.h"
 
 class WaylandFits
 {
@@ -12,24 +13,6 @@ public:
 
        virtual ~WaylandFits();
 
-       class Geometry
-       {
-       public:
-               Geometry();
-               int32_t x;
-               int32_t y;
-               int32_t width;
-               int32_t height;
-       };
-
-       class Position
-       {
-       public:
-               Position();
-               int32_t x;
-               int32_t y;
-       };
-
        class QueryRequest
        {
        public: