aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libraries
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-12 03:42:09 +1000
committerDavid Walter Seikel2014-05-12 03:42:09 +1000
commit03ac0f66bb61fb5b27ea997bc1c60730e2b61671 (patch)
tree66a13212e7e6e61387e79f310019ff5d2edc665a /src/libraries
parentA little more clean up of winFang move / resize. (diff)
downloadSledjHamr-03ac0f66bb61fb5b27ea997bc1c60730e2b61671.zip
SledjHamr-03ac0f66bb61fb5b27ea997bc1c60730e2b61671.tar.gz
SledjHamr-03ac0f66bb61fb5b27ea997bc1c60730e2b61671.tar.bz2
SledjHamr-03ac0f66bb61fb5b27ea997bc1c60730e2b61671.tar.xz
Internal and external windows now both use the layout.
Diffstat (limited to 'src/libraries')
-rw-r--r--src/libraries/winFang.c134
-rw-r--r--src/libraries/winFang.edc2
-rw-r--r--src/libraries/winFang.h2
3 files changed, 70 insertions, 68 deletions
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c
index 708f0cd..e2dce45 100644
--- a/src/libraries/winFang.c
+++ b/src/libraries/winFang.c
@@ -184,35 +184,72 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
184 if (result->parent) 184 if (result->parent)
185 { 185 {
186 eina_clist_add_head(&parent->winFangs, &result->node); 186 eina_clist_add_head(&parent->winFangs, &result->node);
187 obj = parent->win;
188 }
189 else
190 {
191 result->win = elm_win_add(NULL, name, ELM_WIN_BASIC);
192 evas_object_move(result->win, result->x, result->y);
193 evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL);
194 elm_win_title_set(result->win, title);
187 195
188 snprintf(buf, sizeof(buf), "%s/winFang.edj", elm_app_data_dir_get()); 196 obj = result->win;
189 result->win = eo_add(ELM_OBJ_LAYOUT_CLASS, parent->win, 197 x = 0; y = 0;
190 evas_obj_size_set(result->w, result->h), 198 }
191 evas_obj_position_set(result->x, result->y), 199
192 evas_obj_name_set(WF_LAYOUT), 200 snprintf(buf, sizeof(buf), "%s/winFang.edj", elm_app_data_dir_get());
193 elm_obj_layout_file_set(buf, WF_LAYOUT), 201 result->layout = eo_add(ELM_OBJ_LAYOUT_CLASS, obj,
194 evas_obj_visibility_set(EINA_TRUE) 202 evas_obj_size_set(result->w, result->h),
195 ); 203 evas_obj_position_set(x, y),
196 result->e = evas_object_evas_get(result->win); 204 evas_obj_name_set(WF_LAYOUT),
205 elm_obj_layout_file_set(buf, WF_LAYOUT),
206 evas_obj_visibility_set(EINA_TRUE)
207 );
208 result->e = evas_object_evas_get(result->layout);
209
210// result->bg = edje_object_part_object_get(elm_layout_edje_get(result->layout), WF_BACKGROUND);
197 211
212 if (result->parent)
213 {
214result->win = result->layout;
198 215
199 // Something to catch clicks on the background, for moving the window. 216 // Something to catch clicks on the background, for moving the window.
200 // Cov Elm is uncooperative with this sort of thing, so we need to stick in a rectangle. 217 // Coz Elm is uncooperative with this sort of thing, so we need to stick in a rectangle.
201 obj = eo_add(EVAS_OBJ_RECTANGLE_CLASS, result->win, 218 obj = eo_add(EVAS_OBJ_RECTANGLE_CLASS, result->layout,
202 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), 219 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
203 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 220 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
204 evas_obj_name_set(WF_UNDERLAY), 221 evas_obj_name_set(WF_UNDERLAY),
205 evas_obj_color_set(0, 0, 0, 0), 222 evas_obj_color_set(0, 0, 0, 0),
206 evas_obj_visibility_set(EINA_TRUE) 223 evas_obj_visibility_set(EINA_TRUE)
207 ); 224 );
208 elm_object_part_content_set(result->win, WF_UNDERLAY, obj); 225 elm_object_part_content_set(result->layout, WF_UNDERLAY, obj);
209 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _onBgClick, result); 226 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _onBgClick, result);
210 eo_unref(obj); 227 eo_unref(obj);
211 228
229 // Create corner handles.
230 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get());
231 for (i = 0; i < 4; i++)
232 {
233 int cx = result->x, cy = result->y;
234
235 if (i == 1) cx += result->w;
236 else if (i == 2) {cx += result->w; cy += result->h;}
237 else if (i == 3) cy += result->h;
238 result->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, result->e,
239 evas_obj_image_filled_set(EINA_TRUE),
240 evas_obj_image_file_set(buf, NULL),
241 evas_obj_size_set(31, 31),
242 evas_obj_position_set(cx - 15, cy - 15),
243 evas_obj_visibility_set(EINA_TRUE)
244 );
245 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, _onHandleMove, result);
246 eo_unref(result->hand[i]);
247 }
248
212 if (title) 249 if (title)
213 elm_object_part_text_set(result->win, WF_TITLE, title); 250 elm_object_part_text_set(result->layout, WF_TITLE, title);
214/* 251/*
215 result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win, 252 result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->layout,
216 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), 253 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0),
217 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), 254 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
218 evas_obj_visibility_set(EINA_TRUE) 255 evas_obj_visibility_set(EINA_TRUE)
@@ -225,7 +262,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
225*/ 262*/
226 263
227/* 264/*
228 obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win, 265 obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->layout,
229 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), 266 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0),
230 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), 267 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
231 elm_obj_separator_horizontal_set(EINA_TRUE), 268 elm_obj_separator_horizontal_set(EINA_TRUE),
@@ -234,57 +271,19 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
234 elm_box_pack_end(result->box, obj1); 271 elm_box_pack_end(result->box, obj1);
235 eo_unref(obj1); 272 eo_unref(obj1);
236*/ 273*/
237
238 result->grid = eo_add(ELM_OBJ_GRID_CLASS, result->win,
239 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
240 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
241 evas_obj_name_set(WF_SWALLOW),
242 // TODO - Actually, this should be minus the size of the title stuff.
243 elm_obj_grid_size_set(result->w, result->h),
244 evas_obj_visibility_set(EINA_TRUE)
245 );
246 elm_object_part_content_set(result->win, WF_SWALLOW, result->grid);
247
248 elm_layout_sizing_eval(result->win);
249
250 // Create corner handles.
251 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get());
252 for (i = 0; i < 4; i++)
253 {
254 int cx = result->x, cy = result->y;
255
256 if (i == 1) cx += result->w;
257 else if (i == 2) {cx += result->w; cy += result->h;}
258 else if (i == 3) cy += result->h;
259 result->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, result->e,
260 evas_obj_image_filled_set(EINA_TRUE),
261 evas_obj_image_file_set(buf, NULL),
262 evas_obj_size_set(31, 31),
263 evas_obj_position_set(cx - 15, cy - 15),
264 evas_obj_visibility_set(EINA_TRUE)
265 );
266 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, _onHandleMove, result);
267 eo_unref(result->hand[i]);
268 }
269 } 274 }
270 else
271 {
272 result->win = elm_win_add(NULL, name, ELM_WIN_BASIC);
273 evas_object_move(result->win, result->x, result->y);
274 evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL);
275 elm_win_title_set(result->win, title);
276 275
277 snprintf(buf, sizeof(buf), "%s/sky_04.jpg", elm_app_data_dir_get()); 276 result->grid = eo_add(ELM_OBJ_GRID_CLASS, result->layout,
278 result->bg = eo_add(ELM_OBJ_IMAGE_CLASS, result->win, 277 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
279 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 278 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
280 elm_obj_image_fill_outside_set(EINA_TRUE), 279 evas_obj_name_set(WF_SWALLOW),
281 elm_obj_image_file_set(buf, NULL), 280 // TODO - Actually, this should be minus the size of the title stuff.
282 evas_obj_color_set(50, 0, 100, 100), 281 elm_obj_grid_size_set(result->w, result->h),
283 evas_obj_visibility_set(EINA_TRUE) 282 evas_obj_visibility_set(EINA_TRUE)
284 ); 283 );
285 elm_win_resize_object_add(result->win, result->bg); 284 elm_object_part_content_set(result->layout, WF_SWALLOW, result->grid);
286 evas_object_resize(result->win, result->w, result->h); 285
287 } 286 elm_layout_sizing_eval(result->layout);
288 287
289 if (result->parent) 288 if (result->parent)
290 { 289 {
@@ -305,6 +304,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
305 304
306 } 305 }
307 306
307 evas_object_resize(result->win, result->w, result->h);
308 evas_object_show(result->win); 308 evas_object_show(result->win);
309 309
310 return result; 310 return result;
@@ -317,8 +317,9 @@ void winFangDel(winFang *win)
317 317
318 if (!win) return; 318 if (!win) return;
319 319
320 if (win->bg) eo_unref(win->bg); 320 if (win->bg) eo_unref(win->bg);
321 if (win->grid) eo_unref(win->grid); 321 if (win->grid) eo_unref(win->grid);
322 if (win->layout) eo_unref(win->layout);
322 EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node) 323 EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node)
323 { 324 {
324 winFangDel(wf); 325 winFangDel(wf);
@@ -331,7 +332,6 @@ void winFangDel(winFang *win)
331 eo_unref(wid->obj); 332 eo_unref(wid->obj);
332 } 333 }
333 if (win->on_del) win->on_del(win, win->win, NULL); 334 if (win->on_del) win->on_del(win, win->win, NULL);
334 if (win->parent) eo_unref(win->win);
335 evas_object_del(win->win); 335 evas_object_del(win->win);
336} 336}
337 337
diff --git a/src/libraries/winFang.edc b/src/libraries/winFang.edc
index 7705a0b..a7a786c 100644
--- a/src/libraries/winFang.edc
+++ b/src/libraries/winFang.edc
@@ -79,7 +79,7 @@ collections {
79 offset: 0 15; 79 offset: 0 15;
80 } 80 }
81 text { 81 text {
82 text: "bla"; 82 text: "";
83 size: 10; 83 size: 10;
84 font: "sans"; 84 font: "sans";
85 min: 0 1; 85 min: 0 1;
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h
index c55a75e..a247375 100644
--- a/src/libraries/winFang.h
+++ b/src/libraries/winFang.h
@@ -16,6 +16,7 @@
16#include <EPhysics.h> 16#include <EPhysics.h>
17 17
18 18
19#define WF_BACKGROUND "winFang/background"
19#define WF_LAYOUT "winFang/layout" 20#define WF_LAYOUT "winFang/layout"
20#define WF_UNDERLAY "winFang/underlay" 21#define WF_UNDERLAY "winFang/underlay"
21#define WF_TITLE "winFang/title" 22#define WF_TITLE "winFang/title"
@@ -28,6 +29,7 @@ typedef struct _winFang
28 Evas *e; 29 Evas *e;
29 struct _winFang *parent; 30 struct _winFang *parent;
30 Evas_Object *win; 31 Evas_Object *win;
32 Evas_Object *layout;
31 Evas_Object *title; 33 Evas_Object *title;
32 Evas_Object *bg; 34 Evas_Object *bg;
33 Evas_Object *grid; 35 Evas_Object *grid;