aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/GuiLua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-02 05:22:48 +1000
committerDavid Walter Seikel2014-05-02 05:22:48 +1000
commit4fb8f83c41e082426e1385271019733da56bd5d0 (patch)
tree741557b5fd0d334f2ee233ff8b795eb096f7c8c0 /src/GuiLua
parentWhitespace cleanup. (diff)
downloadSledjHamr-4fb8f83c41e082426e1385271019733da56bd5d0.zip
SledjHamr-4fb8f83c41e082426e1385271019733da56bd5d0.tar.gz
SledjHamr-4fb8f83c41e082426e1385271019733da56bd5d0.tar.bz2
SledjHamr-4fb8f83c41e082426e1385271019733da56bd5d0.tar.xz
Use Elm resizing, which removes a bunch of stuff.
Diffstat (limited to 'src/GuiLua')
-rw-r--r--src/GuiLua/GuiLua.c42
-rw-r--r--src/GuiLua/GuiLua.h6
2 files changed, 12 insertions, 36 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index 6b156b6..239a1b7 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -763,15 +763,6 @@ struct _Widget
763 763
764// TODO - These functions should be able to deal with multiple windows. 764// TODO - These functions should be able to deal with multiple windows.
765// TODO - Should be able to open external and internal windows, and even switch between them on the fly. 765// TODO - Should be able to open external and internal windows, and even switch between them on the fly.
766static void _on_canvas_resize(Ecore_Evas *ee)
767{
768 int w, h;
769
770 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
771 eo_do(ourGlobals.background, evas_obj_size_set(w, h));
772 eo_do(ourGlobals.image, evas_obj_size_set(w, h));
773}
774
775static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 766static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
776{ 767{
777 globals *ourGlobals; 768 globals *ourGlobals;
@@ -922,8 +913,7 @@ static int window(lua_State *L)
922 globals *ourGlobals; 913 globals *ourGlobals;
923 char *name = "GuiLua"; 914 char *name = "GuiLua";
924 char *title = "GuiLua test harness"; 915 char *title = "GuiLua test harness";
925 struct _Widget *wid; 916 Evas_Object *obj, *temp;
926 Evas_Object *temp;
927 int result = 0; 917 int result = 0;
928 int w = WIDTH, h = HEIGHT; 918 int w = WIDTH, h = HEIGHT;
929 919
@@ -946,39 +936,27 @@ static int window(lua_State *L)
946 936
947 // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas. 937 // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas.
948 ourGlobals->evas = evas_object_evas_get(ourGlobals->win); 938 ourGlobals->evas = evas_object_evas_get(ourGlobals->win);
949 // An Ecore_Evas holds an Evas.
950 // Get the Ecore_Evas that wraps an Evas.
951 ourGlobals->ee = ecore_evas_ecore_evas_get(ourGlobals->evas); // Only use this on Evas that was created with Ecore_Evas.
952 ecore_evas_callback_resize_set(ourGlobals->ee, _on_canvas_resize);
953 939
954 _scene_setup(ourGlobals, &ourScene); 940 _scene_setup(ourGlobals, &ourScene);
955 941
956 // Add a background image object. 942 // Add a background image object.
957 wid = calloc(1, sizeof(struct _Widget)); 943 obj = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win);
958 strcpy(wid->magic, "Widget"); 944 eo_do(obj,
959 eina_clist_add_head(&ourGlobals->widgets, &wid->node); 945 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
960
961 wid->obj = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win);
962 ourGlobals->background = (wid->obj);
963 eo_do(wid->obj,
964 elm_obj_image_fill_outside_set(EINA_TRUE), 946 elm_obj_image_fill_outside_set(EINA_TRUE),
965 elm_obj_image_file_set("../../media/sky_01.jpg", NULL), 947 elm_obj_image_file_set("../../media/sky_01.jpg", NULL),
966 evas_obj_position_set(0, 0), 948 evas_obj_position_set(0, 0),
967 evas_obj_size_set(w, h),
968 evas_obj_visibility_set(EINA_TRUE) 949 evas_obj_visibility_set(EINA_TRUE)
969 ); 950 );
951 elm_win_resize_object_add(ourGlobals->win, obj);
952 eo_unref(obj);
970 953
971 // Add an image object for 3D scene rendering. 954 // Add an image object for 3D scene rendering.
972 wid = calloc(1, sizeof(struct _Widget)); 955 obj = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win);
973 strcpy(wid->magic, "Widget"); 956 eo_do(obj,
974 eina_clist_add_head(&ourGlobals->widgets, &wid->node); 957 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
975
976 wid->obj = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win);
977 ourGlobals->image = (wid->obj);
978 eo_do(wid->obj,
979 elm_obj_image_fill_outside_set(EINA_TRUE), 958 elm_obj_image_fill_outside_set(EINA_TRUE),
980 evas_obj_position_set(0, 0), 959 evas_obj_position_set(0, 0),
981 evas_obj_size_set(w, h),
982 evas_obj_visibility_set(EINA_TRUE), 960 evas_obj_visibility_set(EINA_TRUE),
983 temp = elm_obj_image_object_get() 961 temp = elm_obj_image_object_get()
984 ); 962 );
@@ -986,6 +964,8 @@ static int window(lua_State *L)
986 evas_obj_image_scene_set(ourScene.scene) 964 evas_obj_image_scene_set(ourScene.scene)
987 ); 965 );
988 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourGlobals); 966 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourGlobals);
967 elm_win_resize_object_add(ourGlobals->win, obj);
968 eo_unref(obj);
989 969
990 // Add animation timer callback. 970 // Add animation timer callback.
991 ecore_timer_add(0.016, _animate_scene, &ourScene); 971 ecore_timer_add(0.016, _animate_scene, &ourScene);
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h
index 388e343..2e2a616 100644
--- a/src/GuiLua/GuiLua.h
+++ b/src/GuiLua/GuiLua.h
@@ -17,14 +17,10 @@ typedef struct _globals globals;
17 17
18struct _globals 18struct _globals
19{ 19{
20 Evas *evas;
20 Evas_Object *win; // Our Elm window. 21 Evas_Object *win; // Our Elm window.
21 Eina_Clist widgets; // Our windows widgets. 22 Eina_Clist widgets; // Our windows widgets.
22 int logDom; // Our logging domain. 23 int logDom; // Our logging domain.
23
24Ecore_Evas *ee;
25Evas *evas;
26Evas_Object *background;
27Evas_Object *image;
28}; 24};
29 25
30 26