aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'src/libraries')
-rw-r--r--src/libraries/winFang.c69
-rw-r--r--src/libraries/winFang.edc121
-rw-r--r--src/libraries/winFang.h8
3 files changed, 126 insertions, 72 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
347void winFangDel(winFang *win) 387void 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
529Evas_Object *makeMainMenu(winFang *win) 569Evas_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)
577void makeMainMenuFinish(winFang *win, Evas_Object *tb) 617void 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.
diff --git a/src/libraries/winFang.edc b/src/libraries/winFang.edc
index 6942aef..2b409ef 100644
--- a/src/libraries/winFang.edc
+++ b/src/libraries/winFang.edc
@@ -19,20 +19,13 @@ collections
19 { 19 {
20 part 20 part
21 { name: "winFang/background"; 21 { name: "winFang/background";
22 type: IMAGE; 22 type: SWALLOW;
23 // Ignore mouse events. 23 mouse_events: 1;
24 mouse_events: 0; 24
25 // Each part has one or more descriptions, or states.
26 // They all have to have at least this default state.
27 description 25 description
28 { state: "default" 0.0; 26 { state: "default" 0.0;
29 // RGBA, so this is purple, and semi transparent.
30// color: 50 0 100 100; // pre multiplied R = (r * a) / 255
31 color: 126 0 255 100; // r = (R * 255) / a
32 aspect_preference: HORIZONTAL;
33 image{normal: "sky_04.jpg";}
34 } 27 }
35 } 28 } // winFang/background
36 29
37 part 30 part
38 { name: "winFang/underlay"; 31 { name: "winFang/underlay";
@@ -41,16 +34,6 @@ collections
41 34
42 description 35 description
43 { state: "default" 0.0; 36 { state: "default" 0.0;
44 rel1
45 {
46 relative: 0.0 0.0;
47 to: "winFang/background";
48 }
49 rel2
50 {
51 relative: 1.0 1.0;
52 to: "winFang/background";
53 }
54 } 37 }
55 } // winFang/underlay 38 } // winFang/underlay
56 39
@@ -61,14 +44,7 @@ collections
61 44
62 description 45 description
63 { state: "default" 0.0; 46 { state: "default" 0.0;
64 fixed: 0 1; 47 fixed: 1 0;
65 visible: 0;
66 }
67
68 description
69 { state: "internal" 0.0;
70 inherit: "default" 0;
71 visible: 1;
72 rel1 48 rel1
73 { 49 {
74 relative: 0.0 0.0; 50 relative: 0.0 0.0;
@@ -77,59 +53,87 @@ collections
77 rel2 53 rel2
78 { 54 {
79 relative: 1.0 0.0; 55 relative: 1.0 0.0;
56 offset: 0 20;
57 to: "winFang/background";
58 }
59 }
60 description
61 { state: "main" 0.0;
62 inherit: "default";
63 visible: 0;
64 rel2
65 {
66 relative: 1.0 0.0;
67 offset: 0 0;
80 to: "winFang/background"; 68 to: "winFang/background";
81 offset: 0 15;
82 } 69 }
83 } 70 }
84 } 71 }
85 72
86 part 73 part
87 { name: "winFang/box"; 74 { name: "winFang/toolbar";
88 type: BOX; 75 type: SWALLOW;
89 mouse_events: 1; 76 mouse_events: 1;
90 77
91 description 78 description
92 { 79 { state: "default" 0.0;
93 state: "default" 0.0; 80 fixed: 1 0;
94 fixed: 0 0; 81 visible: 0;
95 box{layout: "vertical";}
96 rel1 82 rel1
97 { 83 {
98 relative: 0.0 0.0; 84 relative: 0.0 1.0;
99 to: "winFang/background"; 85 to: "winFang/title";
100 } 86 }
101 rel2 87 rel2
102 { 88 {
103 relative: 1.0 1.0; 89 relative: 1.0 1.0;
104 to: "winFang/background"; 90 offset: 0 0;
91 to: "winFang/title";
92 }
93 }
94 description
95 { state: "toolbar" 0.0;
96 inherit: "default";
97 visible: 1;
98 rel2
99 {
100 relative: 1.0 1.0;
101 offset: 0 50;
102 to: "winFang/title";
105 } 103 }
106 } 104 }
105 }
106
107 part
108 { name: "winFang/box";
109 type: SWALLOW;
110 mouse_events: 1;
107 111
108 description 112 description
109 { state: "internal" 0.0; 113 {
110 inherit: "default" 0; 114 state: "default" 0.0;
115 fixed: 0 1;
111 rel1 116 rel1
112 { 117 {
113 relative: 0.0 0.0; 118 relative: 0.0 1.0;
114 to: "winFang/title"; 119 to: "winFang/toolbar";
115 offset: 0 15;
116 } 120 }
117 rel2 121 rel2
118 { 122 {
119 relative: 1.0 1.0; 123 relative: 1.0 1.0;
120 to: "winFang/background"; 124 to: "winFang/background";
121 } 125 }
122 } 126 }
123 } // winFang/box 127 } // winFang/box
124 128
125 part 129 part
126 { name: "winFang/content"; 130 { name: "winFang/grid";
127 type: SWALLOW; 131 type: SWALLOW;
128 mouse_events: 1; 132 mouse_events: 1;
129 133
130 description 134 description
131 { state: "default" 0.0; 135 { state: "default" 0.0;
132 fixed: 0 0; 136 fixed: 0 1;
133 rel1 137 rel1
134 { 138 {
135 relative: 0.0 0.0; 139 relative: 0.0 0.0;
@@ -141,20 +145,27 @@ collections
141 to: "winFang/box"; 145 to: "winFang/box";
142 } 146 }
143 } 147 }
144 } // winFang/content 148 } // winFang/grid
145 149
146 programs 150 programs
147 { 151 {
148 program 152 program
149 { name: "isInternal"; 153 { name: "isToolbar";
150 signal: "isInternal"; 154 signal: "isToolbar";
151 source: "isInternal"; 155 source: "isToolbar";
152 action: STATE_SET "internal" 0.0; 156 action: STATE_SET "toolbar" 0.0;
157 target: "winFang/toolbar";
158 }
159
160 program
161 { name: "isMain";
162 signal: "isMain";
163 source: "isMain";
164 action: STATE_SET "main" 0.0;
153 target: "winFang/title"; 165 target: "winFang/title";
154 target: "winFang/box"; 166 }
155 }
156 } 167 }
157
158 } 168 }
159 } 169 }
160} 170}
171
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h
index 1885ca1..4a83bc6 100644
--- a/src/libraries/winFang.h
+++ b/src/libraries/winFang.h
@@ -6,12 +6,13 @@
6#include <EPhysics.h> 6#include <EPhysics.h>
7 7
8 8
9#define WF_BACKGROUND "winFang/background"
10#define WF_LAYOUT "winFang/layout" 9#define WF_LAYOUT "winFang/layout"
10#define WF_BACKGROUND "winFang/background"
11#define WF_UNDERLAY "winFang/underlay" 11#define WF_UNDERLAY "winFang/underlay"
12#define WF_TITLE "winFang/title" 12#define WF_TITLE "winFang/title"
13#define WF_TOOLBAR "winFang/toolbar"
13#define WF_BOX "winFang/box" 14#define WF_BOX "winFang/box"
14#define WF_SWALLOW "winFang/content" 15#define WF_GRID "winFang/grid"
15 16
16// Evil hack around ELM's problem with lack of toolbar item icons. 17// Evil hack around ELM's problem with lack of toolbar item icons.
17char NoIcon[PATH_MAX]; 18char NoIcon[PATH_MAX];
@@ -44,9 +45,10 @@ typedef struct _winFang
44 Evas *e; 45 Evas *e;
45 struct _winFang *parent; 46 struct _winFang *parent;
46 Evas_Object *win; 47 Evas_Object *win;
48 Evas_Object *bg;
47 Evas_Object *layout; 49 Evas_Object *layout;
48 Evas_Object *title; 50 Evas_Object *title;
49 Evas_Object *bg; 51 Evas_Object *box;
50 Evas_Object *grid; 52 Evas_Object *grid;
51 EPhysics_Body *body; 53 EPhysics_Body *body;
52 Eina_Clist widgets; 54 Eina_Clist widgets;