diff options
Diffstat (limited to '')
-rw-r--r-- | src/libraries/winFang.c | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index 7c18919..718e710 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -202,6 +202,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
202 | } | 202 | } |
203 | else | 203 | else |
204 | { | 204 | { |
205 | // This is our main window, so create it. | ||
205 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); | 206 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); |
206 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); | 207 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); |
207 | evas_object_resize(result->win, result->w, result->h); | 208 | evas_object_resize(result->win, result->w, result->h); |
@@ -213,6 +214,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
213 | x = 0; y = 0; | 214 | x = 0; y = 0; |
214 | } | 215 | } |
215 | 216 | ||
217 | // Create the layout, and add the Edje to it. | ||
216 | snprintf(buf, sizeof(buf), "%s/winFang.edj", prefix_data_get()); | 218 | snprintf(buf, sizeof(buf), "%s/winFang.edj", prefix_data_get()); |
217 | result->layout = eo_add(ELM_LAYOUT_CLASS, obj, | 219 | result->layout = eo_add(ELM_LAYOUT_CLASS, obj, |
218 | efl_gfx_size_set(w, h), | 220 | efl_gfx_size_set(w, h), |
@@ -223,8 +225,30 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
223 | ); | 225 | ); |
224 | result->e = evas_object_evas_get(result->layout); | 226 | result->e = evas_object_evas_get(result->layout); |
225 | 227 | ||
226 | // result->bg = edje_object_part_object_get(elm_layout_edje_get(result->layout), WF_BACKGROUND); | 228 | // Sort out the background. |
229 | if (result->parent) | ||
230 | snprintf(buf, sizeof(buf), "%s/sky_04.jpg", prefix_data_get()); | ||
231 | else | ||
232 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get()); | ||
233 | result->bg = eo_add(ELM_BG_CLASS, obj, | ||
234 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
235 | efl_file_set(buf, NULL), | ||
236 | efl_gfx_visible_set(EINA_TRUE) | ||
237 | ); | ||
238 | elm_win_resize_object_add(result->win, result->bg); | ||
239 | |||
240 | if (result->parent) | ||
241 | { | ||
242 | // // RGBA, so this is purple, and semi transparent. | ||
243 | // color: 50 0 100 100; // pre multiplied R = (r * a) / 255 | ||
244 | // color: 126 0 255 100; // r = (R * 255) / a | ||
245 | eo_do(result->bg, efl_gfx_color_set(50, 0, 100, 100)); | ||
246 | // This is how fragile things are, internal windows wont show background unless swallowed into the layout, | ||
247 | // but Evas_3D is fussy about it's background image, and wont work with a layout swallowed one. | ||
248 | elm_object_part_content_set(result->layout, WF_BACKGROUND, result->bg); | ||
249 | } | ||
227 | 250 | ||
251 | // Evil hacks for no icons, until toolbars get fixed. | ||
228 | if (0 == NoIcon[0]) | 252 | if (0 == NoIcon[0]) |
229 | snprintf(NoIcon, sizeof(NoIcon), "%s/spacer.png", prefix_data_get()); | 253 | snprintf(NoIcon, sizeof(NoIcon), "%s/spacer.png", prefix_data_get()); |
230 | /* This aint doing shit. B-( | 254 | /* This aint doing shit. B-( |
@@ -234,10 +258,18 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
234 | elm_image_file_set(obj, NoIcon, NULL); | 258 | elm_image_file_set(obj, NoIcon, NULL); |
235 | */ | 259 | */ |
236 | 260 | ||
261 | // Create our box, the default for where content goes. | ||
262 | result->box = eo_add(ELM_BOX_CLASS, result->layout, | ||
263 | elm_obj_box_homogeneous_set(EINA_FALSE), | ||
264 | elm_obj_box_horizontal_set(EINA_FALSE), | ||
265 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | ||
266 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) | ||
267 | ); | ||
268 | elm_object_part_content_set(result->layout, WF_BOX, result->box); | ||
269 | |||
237 | if (result->parent) | 270 | if (result->parent) |
238 | { | 271 | { |
239 | result->win = result->layout; | 272 | result->win = result->layout; |
240 | elm_layout_signal_emit(result->layout, "isInternal", "isInternal"); | ||
241 | 273 | ||
242 | // Something to catch clicks on the background, for moving the window. | 274 | // Something to catch clicks on the background, for moving the window. |
243 | // Coz Elm is uncooperative with this sort of thing, so we need to stick in a rectangle. | 275 | // Coz Elm is uncooperative with this sort of thing, so we need to stick in a rectangle. |
@@ -250,7 +282,6 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
250 | ); | 282 | ); |
251 | elm_object_part_content_set(result->layout, WF_UNDERLAY, obj); | 283 | elm_object_part_content_set(result->layout, WF_UNDERLAY, obj); |
252 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _onBgClick, result); | 284 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _onBgClick, result); |
253 | // eo_unref(obj); | ||
254 | 285 | ||
255 | // Create corner handles. | 286 | // Create corner handles. |
256 | snprintf(buf, sizeof(buf), "%s/pt.png", prefix_data_get()); | 287 | snprintf(buf, sizeof(buf), "%s/pt.png", prefix_data_get()); |
@@ -269,29 +300,37 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
269 | efl_gfx_visible_set(EINA_TRUE) | 300 | efl_gfx_visible_set(EINA_TRUE) |
270 | ); | 301 | ); |
271 | evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, _onHandleMove, result); | 302 | evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, _onHandleMove, result); |
272 | // eo_unref(result->hand[i]); | ||
273 | } | 303 | } |
274 | 304 | ||
305 | // Create our window title. | ||
275 | result->title = eo_add(ELM_LABEL_CLASS, result->layout, | 306 | result->title = eo_add(ELM_LABEL_CLASS, result->layout, |
276 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 307 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
277 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 308 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), |
278 | efl_gfx_visible_set(EINA_TRUE) | 309 | efl_gfx_visible_set(EINA_TRUE) |
279 | ); | 310 | ); |
280 | elm_object_style_set(result->title, "marker"); | 311 | elm_object_style_set(result->title, "marker"); |
281 | elm_object_text_set(result->title, title); | 312 | elm_object_text_set(result->title, title); |
282 | elm_object_part_content_set(result->layout, WF_TITLE, result->title); | 313 | elm_object_part_content_set(result->layout, WF_TITLE, result->title); |
283 | // eo_unref(result->title); | 314 | } |
315 | else | ||
316 | { | ||
317 | // Hide the window title. | ||
318 | elm_layout_signal_emit(result->layout, "isMain", "isMain"); | ||
284 | } | 319 | } |
285 | 320 | ||
321 | // Create our grid, where things go if you supply coords. | ||
286 | result->grid = eo_add(ELM_GRID_CLASS, result->layout, | 322 | result->grid = eo_add(ELM_GRID_CLASS, result->layout, |
287 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 323 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
288 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 324 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
289 | evas_obj_name_set(WF_SWALLOW), | 325 | evas_obj_name_set(WF_GRID), |
290 | // TODO - Actually, this should be minus the size of the title stuff. | ||
291 | elm_obj_grid_size_set(result->w, result->h), | 326 | elm_obj_grid_size_set(result->w, result->h), |
292 | efl_gfx_visible_set(EINA_TRUE) | 327 | efl_gfx_visible_set(EINA_TRUE) |
293 | ); | 328 | ); |
294 | elm_object_part_content_set(result->layout, WF_SWALLOW, result->grid); | 329 | |
330 | // This could live inside the box, but then we have to keep track of the size of it's contents. | ||
331 | // For now we simply track the position and size of the box. | ||
332 | // elm_layout_box_append(result->layout, WF_BOX, result->grid); | ||
333 | elm_object_part_content_set(result->layout, WF_GRID, result->grid); | ||
295 | 334 | ||
296 | elm_layout_sizing_eval(result->layout); | 335 | elm_layout_sizing_eval(result->layout); |
297 | 336 | ||
@@ -332,7 +371,7 @@ void winFangCalcMinSize(winFang *win) | |||
332 | if (w > win->mw) win->mw = w; | 371 | if (w > win->mw) win->mw = w; |
333 | if (h > win->mh) win->mh = h; | 372 | if (h > win->mh) win->mh = h; |
334 | // SWALLOW just returns 0. | 373 | // SWALLOW just returns 0. |
335 | evas_object_size_hint_min_get(edje_object_part_object_get(edje, WF_SWALLOW), &w, &h); | 374 | evas_object_size_hint_min_get(edje_object_part_object_get(edje, WF_GRID), &w, &h); |
336 | if (w > win->mw) win->mw = w; | 375 | if (w > win->mw) win->mw = w; |
337 | if (h > win->mh) win->mh = h; | 376 | if (h > win->mh) win->mh = h; |
338 | if (win->title) | 377 | if (win->title) |
@@ -342,6 +381,7 @@ void winFangCalcMinSize(winFang *win) | |||
342 | if (w > win->mw) win->mw = w; | 381 | if (w > win->mw) win->mw = w; |
343 | win->mh += h; | 382 | win->mh += h; |
344 | } | 383 | } |
384 | // TODO - should peek and poke at the Edje sizes as well. | ||
345 | } | 385 | } |
346 | 386 | ||
347 | void winFangDel(winFang *win) | 387 | void winFangDel(winFang *win) |
@@ -441,9 +481,9 @@ Widget *widgetAdd(winFang *win, char *type , char *title, int x, int y, int w, i | |||
441 | } | 481 | } |
442 | 482 | ||
443 | if (x < 0) | 483 | if (x < 0) |
444 | elm_layout_box_append(win->layout, WF_BOX, result->obj); | 484 | elm_box_pack_end(win->box, result->obj); // WF_BOX |
445 | else | 485 | else |
446 | elm_grid_pack(win->grid, result->obj, x, y, w, h); | 486 | elm_grid_pack(win->grid, result->obj, x, y, w, h); // WF_GRID |
447 | 487 | ||
448 | if (title) | 488 | if (title) |
449 | { | 489 | { |
@@ -529,7 +569,7 @@ elm_cnp.h seems to be the only docs, not actually linked to the rest of Elm docs | |||
529 | Evas_Object *makeMainMenu(winFang *win) | 569 | Evas_Object *makeMainMenu(winFang *win) |
530 | { | 570 | { |
531 | // A toolbar thingy. | 571 | // A toolbar thingy. |
532 | return eo_add(ELM_TOOLBAR_CLASS, win->win, | 572 | return eo_add(ELM_TOOLBAR_CLASS, win->layout, |
533 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), | 573 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), |
534 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 574 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
535 | elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), | 575 | elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), |
@@ -577,7 +617,8 @@ Evas_Object *menuAdd(winFang *win, Evas_Object *tb, char *label) | |||
577 | void makeMainMenuFinish(winFang *win, Evas_Object *tb) | 617 | void makeMainMenuFinish(winFang *win, Evas_Object *tb) |
578 | { | 618 | { |
579 | // The toolbar needs to be packed into the box AFTER the menus are added. | 619 | // The toolbar needs to be packed into the box AFTER the menus are added. |
580 | elm_layout_box_append(win->win, WF_BOX, tb); | 620 | elm_object_part_content_set(win->layout, WF_TOOLBAR, tb); |
621 | elm_layout_signal_emit(win->layout, "isToolbar", "isToolbar"); | ||
581 | evas_object_show(tb); | 622 | evas_object_show(tb); |
582 | 623 | ||
583 | // Bump the menu above the windows. | 624 | // Bump the menu above the windows. |