diff options
author | David Walter Seikel | 2014-05-12 06:39:49 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-12 06:39:49 +1000 |
commit | c169cd5547a9f90f2c9607f1fd9b0a77eac46043 (patch) | |
tree | 4ea11e6618c80479b5595745814015e6168f28d5 | |
parent | GuiLua uses box for widgets if there's no x supplied. (diff) | |
download | SledjHamr-c169cd5547a9f90f2c9607f1fd9b0a77eac46043.zip SledjHamr-c169cd5547a9f90f2c9607f1fd9b0a77eac46043.tar.gz SledjHamr-c169cd5547a9f90f2c9607f1fd9b0a77eac46043.tar.bz2 SledjHamr-c169cd5547a9f90f2c9607f1fd9b0a77eac46043.tar.xz |
widgetAdd now does the box / grid decision, and some oter things moved into it.
-rw-r--r-- | src/GuiLua/GuiLua.c | 16 | ||||
-rw-r--r-- | src/extantz/files.c | 3 | ||||
-rw-r--r-- | src/libraries/winFang.c | 31 | ||||
-rw-r--r-- | src/libraries/winFang.h | 2 | ||||
-rw-r--r-- | src/purkle/purkle.c | 4 |
5 files changed, 25 insertions, 31 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index bfba073..06bc516 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -185,20 +185,10 @@ static int widget(lua_State *L) | |||
185 | { | 185 | { |
186 | Widget *wid; | 186 | Widget *wid; |
187 | 187 | ||
188 | // This two lines is likely the only one that will be different for the different sorts of widgets. | 188 | // These two lines are likely the only ones that will be different for the different sorts of widgets. |
189 | wid = widgetAdd(win, ELM_OBJ_BUTTON_CLASS, win->win, title); | 189 | wid = widgetAdd(win, ELM_OBJ_BUTTON_CLASS, title, x, y, w, h); |
190 | wid->data = L; | ||
191 | eo_do(wid->obj, | ||
192 | evas_obj_visibility_set(EINA_TRUE), | ||
193 | eo_key_data_set("Widget", wid, NULL) | ||
194 | ); | ||
195 | |||
196 | if (x < 0) | ||
197 | elm_layout_box_append(win->win, WF_BOX, wid->obj); | ||
198 | else | ||
199 | elm_grid_pack(win->grid, wid->obj, x, y, w, h); | ||
200 | winFangCalcMinSize(win); | ||
201 | evas_object_smart_callback_add(wid->obj, "clicked", _on_click, wid); | 190 | evas_object_smart_callback_add(wid->obj, "clicked", _on_click, wid); |
191 | wid->data = L; | ||
202 | 192 | ||
203 | lua_pushlightuserdata(L, (void *) wid); | 193 | lua_pushlightuserdata(L, (void *) wid); |
204 | return 1; | 194 | return 1; |
diff --git a/src/extantz/files.c b/src/extantz/files.c index 036cd4f..9678e3e 100644 --- a/src/extantz/files.c +++ b/src/extantz/files.c | |||
@@ -148,7 +148,7 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
148 | 148 | ||
149 | me = winFangAdd(ourGlobals->mainWindow, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 300, 500, "file selector", "files", ourGlobals->world); | 149 | me = winFangAdd(ourGlobals->mainWindow, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 300, 500, "file selector", "files", ourGlobals->world); |
150 | 150 | ||
151 | wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, me->win, NULL); | 151 | wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, NULL, -1, -1, -1, -1); |
152 | fs = wid->obj; | 152 | fs = wid->obj; |
153 | wid->data = ourGlobals; | 153 | wid->data = ourGlobals; |
154 | wid->on_del = _on_fs_del; | 154 | wid->on_del = _on_fs_del; |
@@ -158,7 +158,6 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
158 | elm_interface_fileselector_expandable_set(EINA_TRUE), | 158 | elm_interface_fileselector_expandable_set(EINA_TRUE), |
159 | elm_interface_fileselector_folder_only_set(EINA_FALSE) | 159 | elm_interface_fileselector_folder_only_set(EINA_FALSE) |
160 | ); | 160 | ); |
161 | elm_layout_box_append(me->win, WF_BOX, fs); | ||
162 | 161 | ||
163 | elm_fileselector_path_set(fs, path); | 162 | elm_fileselector_path_set(fs, path); |
164 | elm_fileselector_is_save_set(fs, save); | 163 | elm_fileselector_is_save_set(fs, save); |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index c1f448d..4eb4a7b 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -347,7 +347,7 @@ void winFangDel(winFang *win) | |||
347 | evas_object_del(win->win); | 347 | evas_object_del(win->win); |
348 | } | 348 | } |
349 | 349 | ||
350 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char *title) | 350 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, char *title, int x, int y, int w, int h) |
351 | { | 351 | { |
352 | Widget *result; | 352 | Widget *result; |
353 | 353 | ||
@@ -355,19 +355,24 @@ Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char | |||
355 | strcpy(result->magic, "Widget"); | 355 | strcpy(result->magic, "Widget"); |
356 | eina_clist_add_head(&win->widgets, &result->node); | 356 | eina_clist_add_head(&win->widgets, &result->node); |
357 | 357 | ||
358 | if (parent) | 358 | result->obj = eo_add(klass, win->win, |
359 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
360 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | ||
361 | evas_obj_visibility_set(EINA_TRUE), | ||
362 | eo_key_data_set("Widget", result, NULL) | ||
363 | ); | ||
364 | |||
365 | if (x < 0) | ||
366 | elm_layout_box_append(win->win, WF_BOX, result->obj); | ||
367 | else | ||
368 | elm_grid_pack(win->grid, result->obj, x, y, w, h); | ||
369 | winFangCalcMinSize(win); | ||
370 | |||
371 | if (title) | ||
359 | { | 372 | { |
360 | result->obj = eo_add(klass, parent, | 373 | result->label = strdup(title); |
361 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 374 | elm_object_text_set(result->obj, result->label); |
362 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 375 | evas_object_name_set(result->obj, title); |
363 | evas_obj_visibility_set(EINA_TRUE) | ||
364 | ); | ||
365 | if (title) | ||
366 | { | ||
367 | result->label = strdup(title); | ||
368 | elm_object_text_set(result->obj, result->label); | ||
369 | evas_object_name_set(result->obj, title); | ||
370 | } | ||
371 | } | 376 | } |
372 | 377 | ||
373 | return result; | 378 | return result; |
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index c8b355b..1bdef20 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -67,6 +67,6 @@ void winFangShow(winFang *win); | |||
67 | void winFangCalcMinSize(winFang *win); | 67 | void winFangCalcMinSize(winFang *win); |
68 | void winFangDel(winFang *win); | 68 | void winFangDel(winFang *win); |
69 | 69 | ||
70 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char *title); | 70 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, char *title, int x, int y, int w, int h); |
71 | 71 | ||
72 | #endif | 72 | #endif |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 8c72afd..7bd47e7 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -32,13 +32,13 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
32 | elm_layout_box_append(me->win, WF_BOX, en); | 32 | elm_layout_box_append(me->win, WF_BOX, en); |
33 | eo_unref(en); | 33 | eo_unref(en); |
34 | 34 | ||
35 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); | 35 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, "", -1, -1, -1, -1); |
36 | wid->on_del = _on_entry_del; | 36 | wid->on_del = _on_entry_del; |
37 | eo_do(wid->obj, | 37 | eo_do(wid->obj, |
38 | elm_obj_entry_scrollable_set(EINA_TRUE), | 38 | elm_obj_entry_scrollable_set(EINA_TRUE), |
39 | elm_obj_entry_editable_set(EINA_TRUE) | 39 | elm_obj_entry_editable_set(EINA_TRUE) |
40 | ); | 40 | ); |
41 | elm_layout_box_append(me->win, WF_BOX, wid->obj); | 41 | |
42 | winFangCalcMinSize(me); | 42 | winFangCalcMinSize(me); |
43 | 43 | ||
44 | return me; | 44 | return me; |