Commits

Anonymous committed e4a40a3

Begin to work on EvasObject wrapper

  • Participants
  • Parent commits 0f53d3c

Comments (0)

Files changed (5)

File essential/examples/01-hello/hello.cpp

     Reactor reactor;
 
     //Register any gadget you want to
+    Evas_Object *main_win;
+    registerObject("main_window", main_win);
+
+    //Run the reactor
     reactor.run();
 
     //Shutdown is implicit

File essential/include/EvasObject.hpp

+/*
+ * Copyright (c) 2012, Alfredo Di Napoli
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the authors nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ALFREDO DI NAPOLI ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL ALFREDO DI NAPOLI BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EvasObject_hpp
+#define EvasObject_hpp
+
+#include <Elementary.h>
+
+namespace Essential
+{
+    class EvasObject
+    {
+        public:
+            EvasObject(Evas_Object *ob);
+            virtual ~EvasObject();
+            void show();
+            void hide();
+
+        private:
+            Evas_Object* obj_;
+    };
+}
+
+#endif

File essential/include/Reactor.hpp

              * main loop
              */
             void run();
-            void registerWidget(Evas_Object*);
+            void registerObject(Evas_Object*);
 
         private:
             std::vector<Evas_Object*> widgets_;

File essential/src/EvasObject.cpp

+/*
+ * Copyright (c) 2012, Alfredo Di Napoli
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the authors nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ALFREDO DI NAPOLI ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL ALFREDO DI NAPOLI BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "EvasObject.hpp"
+
+namespace Essential
+{
+    EvasObject::EvasObject(EvasObject *obj):
+        obj_(obj)
+    {
+        //NO-OP
+    }
+
+    EvasObject::~EvasObject()
+    {
+        //NO-OP
+    }
+
+    void EvasObject::show()
+    {
+        if(obj_ != nullptr)
+            evas_object_show(obj_);
+        //TODO
+    }
+
+    void EvasObject::hide()
+    {
+        //TODO, how to hide?
+    }
+}

File essential/src/Reactor.cpp

         elm_shutdown();
     }
 
+    void registerObject(const std::string& name, Evas_Object* obj)
+    {
+
+        //By default, set the obj visible
+    }
+
     void Reactor::run()
     {
         elm_run();