elm_win_standard: Add elm_win_standard class
authorVitor Sousa <vitorsousasilva@gmail.com>
Fri, 17 Apr 2015 22:28:51 +0000 (19:28 -0300)
committerVitor Sousa <vitorsousasilva@gmail.com>
Thu, 7 May 2015 18:59:50 +0000 (15:59 -0300)
This commit adds the Eolian class elm_win_standard.
It is basically a derivation from elm_win that creates a default background.

The intent is to replace the legacy functions elm_win_util_standard_add and
elm_win_util_dialog_add by functions accessible via Eo API functions such as
eo_add and eo_do.

To fully replace an elm_win_util_standard_add call, use:

  eo_add(ELM_WIN_STANDARD_CLASS, NULL,
         elm_obj_win_name_set("example"),
         elm_obj_win_type_set(ELM_WIN_BASIC),
         elm_obj_win_title_set("Example"));

src/lib/Elementary.h.in
src/lib/Makefile.am
src/lib/elm_win_standard.c [new file with mode: 0644]
src/lib/elm_win_standard.eo [new file with mode: 0644]
src/lib/elm_win_standard.h [new file with mode: 0644]

index 3ec8259..cd17bbf 100644 (file)
@@ -261,6 +261,7 @@ EAPI extern Elm_Version *elm_version;
 #include <elm_video.h>
 #include <elm_web.h>
 #include <elm_win.h>
+#include <elm_win_standard.h>
 
 /* include deprecated calls last of all */
 #include <elm_deprecated.h>
index 8c137e8..859b0ef 100644 (file)
@@ -385,6 +385,8 @@ elm_win.h \
 elm_win_common.h \
 elm_win_eo.h \
 elm_win_legacy.h \
+elm_win_standard.h \
+elm_win_standard.eo.h \
 elm_helper.h
 includesubdir = $(includedir)/elementary-@VMAJ@/
 
@@ -502,6 +504,7 @@ elm_video.c \
 elm_web2.c \
 elm_widget.c \
 elm_win.c \
+elm_win_standard.c \
 elm_helper.c \
 els_box.c \
 els_cursor.c \
@@ -619,6 +622,7 @@ elm_video.eo \
 elm_web.eo \
 elm_widget.eo \
 elm_win.eo \
+elm_win_standard.eo \
 elm_widget_item.eo \
 elm_color_item.eo \
 elm_dayselector_item.eo \
@@ -747,6 +751,7 @@ elementaryeolianfiles_DATA = \
             elm_video.eo \
             elm_web.eo \
             elm_win.eo \
+            elm_win_standard.eo \
             elm_widget_item.eo \
             elm_color_item.eo \
             elm_dayselector_item.eo \
diff --git a/src/lib/elm_win_standard.c b/src/lib/elm_win_standard.c
new file mode 100644 (file)
index 0000000..23fddce
--- /dev/null
@@ -0,0 +1,36 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
+#define ELM_WIN_PROTECTED
+
+#include <Elementary.h>
+
+#include "elm_priv.h"
+
+#define MY_CLASS ELM_WIN_STANDARD_CLASS
+
+EOLIAN static Eo *
+_elm_win_standard_eo_base_finalize(Eo *obj, void *pd EINA_UNUSED)
+{
+   eo_do_super(obj, MY_CLASS, obj = eo_finalize());
+   if (!obj)
+     return NULL;
+
+   Evas_Object *bg = eo_add(ELM_BG_CLASS, obj);
+   if (!bg)
+     {
+        ERR("Cannot create background.");
+        evas_object_del(obj);
+        return NULL;
+     }
+   eo_do(bg, evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND));
+   eo_do(obj, elm_obj_win_resize_object_add(bg));
+   eo_do(bg, efl_gfx_visible_set(EINA_TRUE));
+
+   return obj;
+}
+
+#include "elm_win_standard.eo.c"
diff --git a/src/lib/elm_win_standard.eo b/src/lib/elm_win_standard.eo
new file mode 100644 (file)
index 0000000..e33aa43
--- /dev/null
@@ -0,0 +1,7 @@
+class Elm.Win_Standard (Elm.Win)
+{
+   data: null;
+   implements {
+      Eo.Base.finalize;
+   }
+}
diff --git a/src/lib/elm_win_standard.h b/src/lib/elm_win_standard.h
new file mode 100644 (file)
index 0000000..2222bbb
--- /dev/null
@@ -0,0 +1,3 @@
+#ifdef EFL_EO_API_SUPPORT
+#include <elm_win_standard.eo.h>
+#endif