diff options
author | David Walter Seikel | 2014-05-11 13:34:49 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-11 13:34:49 +1000 |
commit | 041d246dfc219a0bb2e10345090a4ff9613b5920 (patch) | |
tree | 16530dbff036c15964e26ef28f68f76e66d3f501 /src | |
parent | Resize instead of mapping windows. Got the basics of a window manager in a f... (diff) | |
download | SledjHamr-041d246dfc219a0bb2e10345090a4ff9613b5920.zip SledjHamr-041d246dfc219a0bb2e10345090a4ff9613b5920.tar.gz SledjHamr-041d246dfc219a0bb2e10345090a4ff9613b5920.tar.bz2 SledjHamr-041d246dfc219a0bb2e10345090a4ff9613b5920.tar.xz |
Change internal windows from Elm win to Elm layout.
Diffstat (limited to 'src')
-rw-r--r-- | src/GuiLua/GuiLua.c | 19 | ||||
-rw-r--r-- | src/extantz/extantz.c | 1 | ||||
-rw-r--r-- | src/extantz/files.c | 8 | ||||
-rw-r--r-- | src/extantz/woMan.c | 8 | ||||
-rwxr-xr-x | src/libraries/build.lua | 3 | ||||
-rw-r--r-- | src/libraries/winFang.c | 121 | ||||
-rw-r--r-- | src/libraries/winFang.edc | 115 | ||||
-rw-r--r-- | src/libraries/winFang.h | 9 | ||||
-rw-r--r-- | src/purkle/purkle.c | 7 |
9 files changed, 191 insertions, 100 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 2e16927..b25c60f 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -175,13 +175,10 @@ static int widget(lua_State *L) | |||
175 | winFang *win = NULL; | 175 | winFang *win = NULL; |
176 | char *type = "button"; | 176 | char *type = "button"; |
177 | char *title = ":"; | 177 | char *title = ":"; |
178 | int x = 1, y = 1, w = WIDTH/3, h = HEIGHT/3, cy; | 178 | int x = 1, y = 1, w = WIDTH/3, h = HEIGHT/3; |
179 | 179 | ||
180 | pull_lua(L, 1, "*window $type $title %x %y %w %h", &win, &type, &title, &x, &y, &w, &h); | 180 | pull_lua(L, 1, "*window $type $title %x %y %w %h", &win, &type, &title, &x, &y, &w, &h); |
181 | 181 | ||
182 | evas_object_geometry_get(win->content, NULL, &cy, NULL, NULL); | ||
183 | y += cy; | ||
184 | |||
185 | // Poor mans introspection, until I write real introspection into EFL. | 182 | // Poor mans introspection, until I write real introspection into EFL. |
186 | // TODO - The alternative is to just lookup the ELM_*_CLASS in a hash table? | 183 | // TODO - The alternative is to just lookup the ELM_*_CLASS in a hash table? |
187 | if (strcmp(type, "button") == 0) | 184 | if (strcmp(type, "button") == 0) |
@@ -192,14 +189,20 @@ static int widget(lua_State *L) | |||
192 | wid = widgetAdd(win, ELM_OBJ_BUTTON_CLASS, win->win, title); | 189 | wid = widgetAdd(win, ELM_OBJ_BUTTON_CLASS, win->win, title); |
193 | wid->data = L; | 190 | wid->data = L; |
194 | eo_do(wid->obj, | 191 | eo_do(wid->obj, |
195 | evas_obj_size_set(w, h), | ||
196 | evas_obj_position_set(x, y), | ||
197 | evas_obj_visibility_set(EINA_TRUE), | 192 | evas_obj_visibility_set(EINA_TRUE), |
198 | eo_key_data_set("Widget", wid, NULL) | 193 | eo_key_data_set("Widget", wid, NULL) |
199 | ); | 194 | ); |
200 | evas_object_smart_callback_add(wid->obj, "clicked", _on_click, wid); | ||
201 | 195 | ||
202 | evas_object_show(win->box); | 196 | if (win->grid) |
197 | elm_grid_pack(win->grid, wid->obj, x, y, w, h); | ||
198 | else | ||
199 | { | ||
200 | eo_do(wid->obj, | ||
201 | evas_obj_size_set(w, h), | ||
202 | evas_obj_position_set(x, y) | ||
203 | ); | ||
204 | } | ||
205 | evas_object_smart_callback_add(wid->obj, "clicked", _on_click, wid); | ||
203 | 206 | ||
204 | lua_pushlightuserdata(L, (void *) wid); | 207 | lua_pushlightuserdata(L, (void *) wid); |
205 | return 1; | 208 | return 1; |
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 03979ab..fe6a3c2 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -524,7 +524,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
524 | // Bump the top toolbar above the windows. | 524 | // Bump the top toolbar above the windows. |
525 | evas_object_raise(ourGlobals.tb); | 525 | evas_object_raise(ourGlobals.tb); |
526 | 526 | ||
527 | evas_object_show(ourGlobals.mainWindow->box); | ||
528 | _on_resize(&ourGlobals, NULL, NULL, NULL); | 527 | _on_resize(&ourGlobals, NULL, NULL, NULL); |
529 | 528 | ||
530 | elm_run(); | 529 | elm_run(); |
diff --git a/src/extantz/files.c b/src/extantz/files.c index 6ac151d..12dcc8d 100644 --- a/src/extantz/files.c +++ b/src/extantz/files.c | |||
@@ -147,9 +147,8 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
147 | Evas_Object *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; | 147 | Evas_Object *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; |
148 | 148 | ||
149 | me = winFangAdd(ourGlobals->mainWindow, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500, "file selector", "files", ourGlobals->world); | 149 | me = winFangAdd(ourGlobals->mainWindow, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500, "file selector", "files", ourGlobals->world); |
150 | useBox(me); | ||
151 | 150 | ||
152 | wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, me->box, NULL); | 151 | wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, me->win, NULL); |
153 | fs = wid->obj; | 152 | fs = wid->obj; |
154 | wid->data = ourGlobals; | 153 | wid->data = ourGlobals; |
155 | wid->on_del = _on_fs_del; | 154 | wid->on_del = _on_fs_del; |
@@ -159,7 +158,7 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
159 | elm_interface_fileselector_expandable_set(EINA_TRUE), | 158 | elm_interface_fileselector_expandable_set(EINA_TRUE), |
160 | elm_interface_fileselector_folder_only_set(EINA_FALSE) | 159 | elm_interface_fileselector_folder_only_set(EINA_FALSE) |
161 | ); | 160 | ); |
162 | elm_box_pack_end(me->box, fs); | 161 | elm_layout_box_append(me->win, BOX, fs); |
163 | 162 | ||
164 | elm_fileselector_path_set(fs, path); | 163 | elm_fileselector_path_set(fs, path); |
165 | elm_fileselector_is_save_set(fs, save); | 164 | elm_fileselector_is_save_set(fs, save); |
@@ -265,9 +264,8 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
265 | elm_box_pack_end(vbox, bt); | 264 | elm_box_pack_end(vbox, bt); |
266 | eo_unref(bt); | 265 | eo_unref(bt); |
267 | 266 | ||
268 | elm_box_pack_end(me->box, vbox); | 267 | elm_layout_box_append(me->win, BOX, vbox); |
269 | evas_object_show(vbox); | 268 | evas_object_show(vbox); |
270 | evas_object_show(me->box); | ||
271 | eo_unref(vbox); | 269 | eo_unref(vbox); |
272 | 270 | ||
273 | winFangHide(me); | 271 | winFangHide(me); |
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c index 6167cb1..7e476ea 100644 --- a/src/extantz/woMan.c +++ b/src/extantz/woMan.c | |||
@@ -160,7 +160,6 @@ winFang *woMan_add(globals *ourGlobals) | |||
160 | int i; | 160 | int i; |
161 | 161 | ||
162 | me = winFangAdd(ourGlobals->mainWindow, 30, 200, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world); | 162 | me = winFangAdd(ourGlobals->mainWindow, 30, 200, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world); |
163 | useBox(me); | ||
164 | 163 | ||
165 | // A tab thingy. | 164 | // A tab thingy. |
166 | tb = elm_toolbar_add(me->win); | 165 | tb = elm_toolbar_add(me->win); |
@@ -185,7 +184,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
185 | elm_menu_item_add(menu, menu_it, NULL, "debug settings", NULL, NULL); | 184 | elm_menu_item_add(menu, menu_it, NULL, "debug settings", NULL, NULL); |
186 | 185 | ||
187 | // The toolbar needs to be packed into the box AFTER the menus are added. | 186 | // The toolbar needs to be packed into the box AFTER the menus are added. |
188 | elm_box_pack_end(me->box, tb); | 187 | elm_layout_box_append(me->win, BOX, tb); |
189 | evas_object_show(tb); | 188 | evas_object_show(tb); |
190 | 189 | ||
191 | gridList = elm_genlist_add(me->win); | 190 | gridList = elm_genlist_add(me->win); |
@@ -268,7 +267,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
268 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); | 267 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); |
269 | tab = _content_image_new(me->win, strdup(buf)); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); | 268 | tab = _content_image_new(me->win, strdup(buf)); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); |
270 | tab = gridList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it); | 269 | tab = gridList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it); |
271 | elm_box_pack_end(me->box, nf); | 270 | elm_layout_box_append(me->win, BOX, nf); |
272 | 271 | ||
273 | bt = eo_add(ELM_OBJ_BUTTON_CLASS, me->win, | 272 | bt = eo_add(ELM_OBJ_BUTTON_CLASS, me->win, |
274 | // evas_obj_text_set("Login"), | 273 | // evas_obj_text_set("Login"), |
@@ -278,9 +277,8 @@ winFang *woMan_add(globals *ourGlobals) | |||
278 | ); | 277 | ); |
279 | elm_object_text_set(bt, "Login"); // No eo interface for this that I can find. | 278 | elm_object_text_set(bt, "Login"); // No eo interface for this that I can find. |
280 | // evas_object_smart_callback_add(bt, "clicked", NULL, NULL); | 279 | // evas_object_smart_callback_add(bt, "clicked", NULL, NULL); |
281 | elm_box_pack_end(me->box, bt); | 280 | elm_layout_box_append(me->win, BOX, bt); |
282 | eo_unref(bt); | 281 | eo_unref(bt); |
283 | evas_object_show(me->box); | ||
284 | 282 | ||
285 | return me; | 283 | return me; |
286 | } | 284 | } |
diff --git a/src/libraries/build.lua b/src/libraries/build.lua index 4e277e1..45c436d 100755 --- a/src/libraries/build.lua +++ b/src/libraries/build.lua | |||
@@ -15,7 +15,7 @@ end | |||
15 | 15 | ||
16 | LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS | 16 | LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS |
17 | 17 | ||
18 | removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so', 'winFang.o', lib_d .. '/libwinFang.so'}) | 18 | removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so', '../../media/winFang.edj', 'winFang.o', lib_d .. '/libwinFang.so'}) |
19 | 19 | ||
20 | runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c LumbrJack.c') | 20 | runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c LumbrJack.c') |
21 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libLumbrJack.so -o ' .. lib_d .. '/libLumbrJack.so LumbrJack.o') | 21 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libLumbrJack.so -o ' .. lib_d .. '/libLumbrJack.so LumbrJack.o') |
@@ -32,5 +32,6 @@ CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"' | |||
32 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c') | 32 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c') |
33 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o') | 33 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o') |
34 | 34 | ||
35 | runCommand(nil, dir, 'edje_cc ' .. EDJE_FLAGS .. ' winFang.edc ../../media/winFang.edj') | ||
35 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c winFang.c') | 36 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c winFang.c') |
36 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libwinFang.so -o ' .. lib_d .. '/libwinFang.so winFang.o') | 37 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libwinFang.so -o ' .. lib_d .. '/libwinFang.so winFang.o') |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index 6b15a6d..2cbd04d 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -21,7 +21,7 @@ printf("%s %s\n", evas_object_type_get(objs), evas_object_name_get(objs)); | |||
21 | 21 | ||
22 | static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) | 22 | static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) |
23 | { | 23 | { |
24 | Evas_Object *img = elm_win_inlined_image_object_get(win->win), *test; | 24 | Evas_Object *img = win->win, *test; |
25 | Eina_List *objs, *this; | 25 | Eina_List *objs, *this; |
26 | Evas_Coord mw, mh; | 26 | Evas_Coord mw, mh; |
27 | int padding = 1, i = 0, overs[4][2]; | 27 | int padding = 1, i = 0, overs[4][2]; |
@@ -80,7 +80,7 @@ static void cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_ | |||
80 | Evas_Event_Mouse_Move *ev = event_info; | 80 | Evas_Event_Mouse_Move *ev = event_info; |
81 | winFang *win = data; | 81 | winFang *win = data; |
82 | Evas_Coord x, y, w, h, dx = 0, dy = 0, dw = 0, dh = 0, mx, my; | 82 | Evas_Coord x, y, w, h, dx = 0, dy = 0, dw = 0, dh = 0, mx, my; |
83 | Evas_Object *img = elm_win_inlined_image_object_get(win->win); | 83 | Evas_Object *img = win->win; |
84 | int i; | 84 | int i; |
85 | 85 | ||
86 | if (!ev->buttons) return; | 86 | if (!ev->buttons) return; |
@@ -126,7 +126,7 @@ static void _onBgMove(void *data, Evas *evas, Evas_Object *obj, void *event_info | |||
126 | { | 126 | { |
127 | Evas_Event_Mouse_Move *ev = event_info; | 127 | Evas_Event_Mouse_Move *ev = event_info; |
128 | winFang *win = data; | 128 | winFang *win = data; |
129 | Evas_Object *img = elm_win_inlined_image_object_get(win->win); | 129 | Evas_Object *img = win->win; |
130 | Evas_Coord x, y, w, h; | 130 | Evas_Coord x, y, w, h; |
131 | 131 | ||
132 | if (1 != ev->buttons) return; | 132 | if (1 != ev->buttons) return; |
@@ -165,8 +165,6 @@ void winFangShow(winFang *win) | |||
165 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) | 165 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) |
166 | { | 166 | { |
167 | winFang *result; | 167 | winFang *result; |
168 | Evas_Object *obj, *obj1; | ||
169 | Evas *obj2; | ||
170 | char buf[PATH_MAX]; | 168 | char buf[PATH_MAX]; |
171 | int i; | 169 | int i; |
172 | 170 | ||
@@ -182,84 +180,81 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
182 | result->w = w; | 180 | result->w = w; |
183 | result->h = h; | 181 | result->h = h; |
184 | 182 | ||
185 | // In theory this should create an EWS window, in practice, I'm not seeing any difference. | ||
186 | // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words. | ||
187 | // elm_config_engine_set("ews"); | ||
188 | if (result->internal) | 183 | if (result->internal) |
189 | { | 184 | { |
190 | result->win = elm_win_add(parent->win, name, ELM_WIN_INLINED_IMAGE); | ||
191 | eina_clist_add_head(&parent->winFangs, &result->node); | 185 | eina_clist_add_head(&parent->winFangs, &result->node); |
192 | obj = elm_win_inlined_image_object_get(result->win); | 186 | |
193 | evas_object_name_set(obj, "winFang"); | 187 | result->win = elm_layout_add(parent->win); |
188 | evas_object_name_set(result->win, "winFang"); | ||
189 | evas_object_size_hint_weight_set(result->win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
190 | snprintf(buf, sizeof(buf), "%s/winFang.edj", elm_app_data_dir_get()); | ||
191 | elm_layout_file_set(result->win, buf, "winFang/layout"); | ||
192 | if (title) | ||
193 | elm_object_part_text_set(result->win, TITLE, title); | ||
194 | |||
195 | result->grid = elm_grid_add(parent->win); | ||
196 | elm_grid_size_set(result->grid, result->w, result->h); | ||
197 | evas_object_size_hint_weight_set(result->grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
198 | evas_object_size_hint_align_set(result->grid, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
199 | elm_object_part_content_set(result->win, SWALLOW, result->grid); | ||
200 | evas_object_show(result->grid); | ||
201 | |||
202 | evas_object_resize(result->win, result->w, result->h); | ||
203 | evas_object_move(result->win, result->x, result->y); | ||
204 | elm_layout_sizing_eval(result->win); | ||
205 | evas_object_show(result->win); | ||
206 | |||
194 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. | 207 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. |
195 | // According to the Elm inlined image window example, this is what's needed to. | 208 | // According to the Elm inlined image window example, this is what's needed to. |
196 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, result); | 209 | evas_object_event_callback_add(result->win, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, result); |
197 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, result); | 210 | evas_object_event_callback_add(result->win, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, result); |
198 | elm_win_alpha_set(result->win, EINA_TRUE); | 211 | |
199 | 212 | result->e = evas_object_evas_get(result->win); | |
200 | // image object for win is unlinked to its pos/size - so manual control | ||
201 | // this allows also for using map and other things with it. | ||
202 | evas_object_move(obj, result->x, result->y); | ||
203 | // Odd, it needs to be resized twice. WTF? | ||
204 | evas_object_resize(obj, result->w, result->h); | ||
205 | |||
206 | obj2 = evas_object_evas_get(obj); | ||
207 | result->e = obj2; | ||
208 | // Create corner handles. | 213 | // Create corner handles. |
209 | snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); | 214 | snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); |
210 | for (i = 0; i < 4; i++) | 215 | for (i = 0; i < 4; i++) |
211 | { | 216 | { |
212 | char key[32]; | ||
213 | int cx = result->x, cy = result->y; | 217 | int cx = result->x, cy = result->y; |
214 | 218 | ||
215 | if (i == 1) cx += result->w; | 219 | if (i == 1) cx += result->w; |
216 | else if (i == 2) {cx += result->w; cy += result->h;} | 220 | else if (i == 2) {cx += result->w; cy += result->h;} |
217 | else if (i == 3) cy += result->h; | 221 | else if (i == 3) cy += result->h; |
218 | snprintf(key, sizeof(key), "h-%i\n", i); | 222 | result->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, result->e, |
219 | result->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, obj2, | ||
220 | evas_obj_image_filled_set(EINA_TRUE), | 223 | evas_obj_image_filled_set(EINA_TRUE), |
221 | evas_obj_image_file_set(buf, NULL), | 224 | evas_obj_image_file_set(buf, NULL), |
222 | evas_obj_size_set(31, 31), | 225 | evas_obj_size_set(31, 31), |
223 | evas_obj_position_set(cx - 15, cy - 15), | 226 | evas_obj_position_set(cx - 15, cy - 15), |
224 | eo_key_data_set(key, result->hand[i], NULL), | ||
225 | evas_obj_visibility_set(EINA_TRUE) | 227 | evas_obj_visibility_set(EINA_TRUE) |
226 | ); | 228 | ); |
227 | evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, result); | 229 | evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, result); |
228 | eo_unref(result->hand[i]); | 230 | eo_unref(result->hand[i]); |
229 | } | 231 | } |
232 | |||
230 | } | 233 | } |
231 | else | 234 | else |
232 | { | 235 | { |
233 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); | 236 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); |
234 | evas_object_move(result->win, result->x, result->y); | 237 | evas_object_move(result->win, result->x, result->y); |
235 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); | 238 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); |
236 | } | 239 | elm_win_title_set(result->win, title); |
237 | 240 | ||
238 | elm_win_title_set(result->win, title); | 241 | snprintf(buf, sizeof(buf), "%s/sky_04.jpg", elm_app_data_dir_get()); |
239 | 242 | result->bg = eo_add(ELM_OBJ_IMAGE_CLASS, result->win, | |
240 | snprintf(buf, sizeof(buf), "%s/sky_04.jpg", elm_app_data_dir_get()); | 243 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
241 | result->bg = eo_add(ELM_OBJ_IMAGE_CLASS, result->win, | 244 | elm_obj_image_fill_outside_set(EINA_TRUE), |
242 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 245 | elm_obj_image_file_set(buf, NULL), |
243 | elm_obj_image_fill_outside_set(EINA_TRUE), | 246 | evas_obj_color_set(50, 0, 100, 100), |
244 | elm_obj_image_file_set(buf, NULL), | 247 | evas_obj_visibility_set(EINA_TRUE) |
245 | evas_obj_color_set(50, 0, 100, 100), | 248 | ); |
246 | evas_obj_visibility_set(EINA_TRUE) | 249 | elm_win_resize_object_add(result->win, result->bg); |
247 | ); | 250 | evas_object_resize(result->win, result->w, result->h); |
248 | elm_win_resize_object_add(result->win, result->bg); | 251 | } |
249 | |||
250 | // Every window gets a free vertical box. | ||
251 | // TODO - Any widgets created without positon and size get packed to the end. | ||
252 | result->box = eo_add(ELM_OBJ_BOX_CLASS, result->win, | ||
253 | elm_obj_box_homogeneous_set(EINA_FALSE), | ||
254 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
255 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL) | ||
256 | ); | ||
257 | elm_win_resize_object_add(result->win, result->box); | ||
258 | 252 | ||
259 | if (result->internal) | 253 | if (result->internal) |
260 | { | 254 | { |
255 | /* | ||
261 | result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win, | 256 | result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win, |
262 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 257 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), |
263 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), | 258 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), |
264 | evas_obj_visibility_set(EINA_TRUE) | 259 | evas_obj_visibility_set(EINA_TRUE) |
265 | ); | 260 | ); |
@@ -268,7 +263,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
268 | elm_object_text_set(result->title, buf); | 263 | elm_object_text_set(result->title, buf); |
269 | elm_box_pack_end(result->box, result->title); | 264 | elm_box_pack_end(result->box, result->title); |
270 | eo_unref(result->title); | 265 | eo_unref(result->title); |
271 | 266 | */ | |
272 | #if 0 | 267 | #if 0 |
273 | // EPysics enable the window. | 268 | // EPysics enable the window. |
274 | if (world) | 269 | if (world) |
@@ -284,25 +279,18 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
284 | } | 279 | } |
285 | #endif | 280 | #endif |
286 | 281 | ||
282 | /* | ||
287 | obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win, | 283 | obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win, |
288 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 284 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), |
289 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), | 285 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), |
290 | elm_obj_separator_horizontal_set(EINA_TRUE), | 286 | elm_obj_separator_horizontal_set(EINA_TRUE), |
291 | evas_obj_visibility_set(EINA_TRUE) | 287 | evas_obj_visibility_set(EINA_TRUE) |
292 | ); | 288 | ); |
293 | elm_box_pack_end(result->box, obj1); | 289 | elm_box_pack_end(result->box, obj1); |
294 | eo_unref(obj1); | 290 | eo_unref(obj1); |
295 | 291 | */ | |
296 | result->content = eo_add(EVAS_OBJ_RECTANGLE_CLASS, result->win, | ||
297 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | ||
298 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
299 | evas_obj_color_set(0, 0, 0, 0), | ||
300 | evas_obj_visibility_set(EINA_TRUE) | ||
301 | ); | ||
302 | elm_box_pack_end(result->box, result->content); | ||
303 | } | 292 | } |
304 | 293 | ||
305 | evas_object_resize(result->win, result->w, result->h); | ||
306 | evas_object_show(result->win); | 294 | evas_object_show(result->win); |
307 | 295 | ||
308 | return result; | 296 | return result; |
@@ -315,9 +303,7 @@ void winFangDel(winFang *win) | |||
315 | 303 | ||
316 | if (!win) return; | 304 | if (!win) return; |
317 | 305 | ||
318 | eo_unref(win->content); | 306 | if (win->bg) eo_unref(win->bg); |
319 | eo_unref(win->box); | ||
320 | eo_unref(win->bg); | ||
321 | EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node) | 307 | EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node) |
322 | { | 308 | { |
323 | winFangDel(wf); | 309 | winFangDel(wf); |
@@ -333,15 +319,6 @@ void winFangDel(winFang *win) | |||
333 | evas_object_del(win->win); | 319 | evas_object_del(win->win); |
334 | } | 320 | } |
335 | 321 | ||
336 | void useBox(winFang *win) | ||
337 | { | ||
338 | eo_do(win->content, | ||
339 | evas_obj_visibility_set(EINA_FALSE), | ||
340 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), | ||
341 | evas_obj_size_set(0, 0) | ||
342 | ); | ||
343 | } | ||
344 | |||
345 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char *title) | 322 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char *title) |
346 | { | 323 | { |
347 | Widget *result; | 324 | Widget *result; |
diff --git a/src/libraries/winFang.edc b/src/libraries/winFang.edc new file mode 100644 index 0000000..0fca7a9 --- /dev/null +++ b/src/libraries/winFang.edc | |||
@@ -0,0 +1,115 @@ | |||
1 | // The images we use. | ||
2 | images | ||
3 | { | ||
4 | image: "bubble.png" COMP; // COMP means to use lossless compression. | ||
5 | image: "bubble_sh.png" COMP; | ||
6 | image: "logo.png" COMP; | ||
7 | image: "pt.png" COMP; | ||
8 | image: "sky_01.jpg" COMP; | ||
9 | image: "sky_02.jpg" COMP; | ||
10 | image: "sky_03.jpg" COMP; | ||
11 | image: "sky_04.jpg" COMP; | ||
12 | } | ||
13 | |||
14 | collections { | ||
15 | |||
16 | group { | ||
17 | name: "winFang/layout"; | ||
18 | |||
19 | data { | ||
20 | item: "title" "<b>Layout based internal window</b>"; | ||
21 | } | ||
22 | |||
23 | parts { | ||
24 | |||
25 | // The first part, the black background RECTangle of the screens. | ||
26 | part | ||
27 | { name: "winFang/background"; | ||
28 | type: IMAGE; | ||
29 | // Ignore mouse events. | ||
30 | mouse_events: 0; | ||
31 | // Each part has one or more descriptions, or states. | ||
32 | // They all have to have at least this default state. | ||
33 | description | ||
34 | { state: "default" 0.0; | ||
35 | // RGBA, so this is purple, and semi transparent. | ||
36 | // color: 50 0 100 100; // pre multiplied R = (r * a) / 255 | ||
37 | color: 126 0 255 100; // r = (R * 255) / a | ||
38 | aspect_preference: HORIZONTAL; | ||
39 | image { | ||
40 | normal: "sky_04.jpg"; | ||
41 | } | ||
42 | } | ||
43 | } | ||
44 | |||
45 | part { | ||
46 | name: "winFang/title"; | ||
47 | type: TEXT; | ||
48 | |||
49 | description { | ||
50 | state: "default" 0.0; | ||
51 | color: 255 255 255 255; | ||
52 | rel1 { | ||
53 | relative: 0.0 0.0; | ||
54 | to: "winFang/background"; | ||
55 | } | ||
56 | rel2 { | ||
57 | relative: 1.0 0.0; | ||
58 | to: "winFang/background"; | ||
59 | offset: 0 15; | ||
60 | } | ||
61 | text { | ||
62 | text: "bla"; | ||
63 | size: 10; | ||
64 | font: "sans"; | ||
65 | min: 0 1; | ||
66 | max: 0 1; | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | |||
71 | part { | ||
72 | name: "winFang/box"; | ||
73 | type: BOX; | ||
74 | |||
75 | description { | ||
76 | state: "default" 0.0; | ||
77 | |||
78 | box { | ||
79 | layout: "vertical"; | ||
80 | } | ||
81 | rel1 { | ||
82 | relative: 0.0 0.0; | ||
83 | to: "winFang/title"; | ||
84 | offset: 0 15; | ||
85 | } | ||
86 | rel2 { | ||
87 | relative: 1.0 1.0; | ||
88 | to: "winFang/background"; | ||
89 | } | ||
90 | } | ||
91 | } // winFang/box | ||
92 | |||
93 | part { | ||
94 | name: "winFang/content"; | ||
95 | type: SWALLOW; | ||
96 | |||
97 | description { | ||
98 | state: "default" 0.0; | ||
99 | fixed: 1 1; | ||
100 | |||
101 | rel1 { | ||
102 | relative: 0.0 0.0; | ||
103 | to: "winFang/title"; | ||
104 | offset: 0 15; | ||
105 | } | ||
106 | rel2 { | ||
107 | relative: 1.0 1.0; | ||
108 | to: "winFang/background"; | ||
109 | } | ||
110 | } | ||
111 | } // winFang/content | ||
112 | |||
113 | } | ||
114 | } | ||
115 | } | ||
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index 17cf942..c614b04 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -16,6 +16,11 @@ | |||
16 | #include <EPhysics.h> | 16 | #include <EPhysics.h> |
17 | 17 | ||
18 | 18 | ||
19 | #define BOX "winFang/box" | ||
20 | #define TITLE "winFang/title" | ||
21 | #define SWALLOW "winFang/content" | ||
22 | |||
23 | |||
19 | typedef struct _winFang | 24 | typedef struct _winFang |
20 | { | 25 | { |
21 | Evas *e; | 26 | Evas *e; |
@@ -23,8 +28,7 @@ typedef struct _winFang | |||
23 | Evas_Object *win; | 28 | Evas_Object *win; |
24 | Evas_Object *title; | 29 | Evas_Object *title; |
25 | Evas_Object *bg; | 30 | Evas_Object *bg; |
26 | Evas_Object *box; | 31 | Evas_Object *grid; |
27 | Evas_Object *content; | ||
28 | EPhysics_Body *body; | 32 | EPhysics_Body *body; |
29 | Eina_Clist widgets; | 33 | Eina_Clist widgets; |
30 | Eina_Clist winFangs; | 34 | Eina_Clist winFangs; |
@@ -59,7 +63,6 @@ void winFangHide(winFang *win); | |||
59 | void winFangShow(winFang *win); | 63 | void winFangShow(winFang *win); |
60 | void winFangDel(winFang *win); | 64 | void winFangDel(winFang *win); |
61 | 65 | ||
62 | void useBox(winFang *win); | ||
63 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char *title); | 66 | Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char *title); |
64 | 67 | ||
65 | #endif | 68 | #endif |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 6538096..b1a45e1 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -20,7 +20,6 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
20 | Evas_Object *en; | 20 | Evas_Object *en; |
21 | 21 | ||
22 | me = winFangAdd(parent, 30, 590, w, h, "chatter box", "purkle", world); | 22 | me = winFangAdd(parent, 30, 590, w, h, "chatter box", "purkle", world); |
23 | useBox(me); | ||
24 | 23 | ||
25 | en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, | 24 | en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, |
26 | elm_obj_entry_scrollable_set(EINA_TRUE), | 25 | elm_obj_entry_scrollable_set(EINA_TRUE), |
@@ -30,7 +29,7 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
30 | evas_obj_visibility_set(EINA_TRUE) | 29 | evas_obj_visibility_set(EINA_TRUE) |
31 | ); | 30 | ); |
32 | elm_object_text_set(en, "History is shown here"); | 31 | elm_object_text_set(en, "History is shown here"); |
33 | elm_box_pack_end(me->box, en); | 32 | elm_layout_box_append(me->win, BOX, en); |
34 | eo_unref(en); | 33 | eo_unref(en); |
35 | 34 | ||
36 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); | 35 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); |
@@ -39,9 +38,7 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
39 | elm_obj_entry_scrollable_set(EINA_TRUE), | 38 | elm_obj_entry_scrollable_set(EINA_TRUE), |
40 | elm_obj_entry_editable_set(EINA_TRUE) | 39 | elm_obj_entry_editable_set(EINA_TRUE) |
41 | ); | 40 | ); |
42 | elm_box_pack_end(me->box, wid->obj); | 41 | elm_layout_box_append(me->win, BOX, wid->obj); |
43 | |||
44 | evas_object_show(me->box); | ||
45 | 42 | ||
46 | return me; | 43 | return me; |
47 | } | 44 | } |