aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-11 23:33:06 +1000
committerDavid Walter Seikel2014-05-11 23:33:06 +1000
commitd1aa9c0a08786d47decd0b02d1246fc1974ebbf1 (patch)
tree2006a0cf3c2ec661ee924de49fc9444b768173a1
parentChange internal windows from Elm win to Elm layout. (diff)
downloadSledjHamr-d1aa9c0a08786d47decd0b02d1246fc1974ebbf1.zip
SledjHamr-d1aa9c0a08786d47decd0b02d1246fc1974ebbf1.tar.gz
SledjHamr-d1aa9c0a08786d47decd0b02d1246fc1974ebbf1.tar.bz2
SledjHamr-d1aa9c0a08786d47decd0b02d1246fc1974ebbf1.tar.xz
Clean up the winFang layout stuff.
-rw-r--r--src/libraries/winFang.c95
-rw-r--r--src/libraries/winFang.h1
2 files changed, 49 insertions, 47 deletions
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c
index 2cbd04d..7b576e9 100644
--- a/src/libraries/winFang.c
+++ b/src/libraries/winFang.c
@@ -172,44 +172,68 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
172 eina_clist_init(&result->widgets); 172 eina_clist_init(&result->widgets);
173 eina_clist_init(&result->winFangs); 173 eina_clist_init(&result->winFangs);
174 174
175 if (parent) result->internal = EINA_TRUE;
176 result->parent = parent; 175 result->parent = parent;
177
178 result->x = x; 176 result->x = x;
179 result->y = y; 177 result->y = y;
180 result->w = w; 178 result->w = w;
181 result->h = h; 179 result->h = h;
182 180
183 if (result->internal) 181 if (result->parent)
184 { 182 {
185 eina_clist_add_head(&parent->winFangs, &result->node); 183 eina_clist_add_head(&parent->winFangs, &result->node);
186 184
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()); 185 snprintf(buf, sizeof(buf), "%s/winFang.edj", elm_app_data_dir_get());
191 elm_layout_file_set(result->win, buf, "winFang/layout"); 186 result->win = eo_add(ELM_OBJ_LAYOUT_CLASS, parent->win,
187 evas_obj_size_set(result->w, result->h),
188 evas_obj_position_set(result->x, result->y),
189 evas_obj_name_set("winFang"),
190 elm_obj_layout_file_set(buf, "winFang/layout"),
191 evas_obj_visibility_set(EINA_TRUE)
192 );
193 result->e = evas_object_evas_get(result->win);
194
195 // 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.
196 // According to the Elm inlined image window example, this is what's needed to.
197 evas_object_event_callback_add(result->win, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, result);
198 evas_object_event_callback_add(result->win, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, result);
199
200/*
201 result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win,
202 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0),
203 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
204 evas_obj_visibility_set(EINA_TRUE)
205 );
206 elm_object_style_set(result->title, "slide_bounce");
207 snprintf(buf, PATH_MAX, "<b>%s</b>", title);
208 elm_object_text_set(result->title, buf);
209 elm_box_pack_end(result->box, result->title);
210 eo_unref(result->title);
211*/
212/*
213 obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win,
214 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0),
215 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
216 elm_obj_separator_horizontal_set(EINA_TRUE),
217 evas_obj_visibility_set(EINA_TRUE)
218 );
219 elm_box_pack_end(result->box, obj1);
220 eo_unref(obj1);
221*/
222
192 if (title) 223 if (title)
193 elm_object_part_text_set(result->win, TITLE, title); 224 elm_object_part_text_set(result->win, TITLE, title);
194 225
195 result->grid = elm_grid_add(parent->win); 226 result->grid = eo_add(ELM_OBJ_GRID_CLASS, result->win,
196 elm_grid_size_set(result->grid, result->w, result->h); 227 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
197 evas_object_size_hint_weight_set(result->grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 228 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
198 evas_object_size_hint_align_set(result->grid, EVAS_HINT_FILL, EVAS_HINT_FILL); 229 // TODO - Actually, this should be minus the size of the title stuff.
230 elm_obj_grid_size_set(result->w, result->h),
231 evas_obj_visibility_set(EINA_TRUE)
232 );
199 elm_object_part_content_set(result->win, SWALLOW, result->grid); 233 elm_object_part_content_set(result->win, SWALLOW, result->grid);
200 evas_object_show(result->grid);
201 234
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); 235 elm_layout_sizing_eval(result->win);
205 evas_object_show(result->win);
206
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.
208 // According to the Elm inlined image window example, this is what's needed to.
209 evas_object_event_callback_add(result->win, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, result);
210 evas_object_event_callback_add(result->win, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, result);
211 236
212 result->e = evas_object_evas_get(result->win);
213 // Create corner handles. 237 // Create corner handles.
214 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); 238 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get());
215 for (i = 0; i < 4; i++) 239 for (i = 0; i < 4; i++)
@@ -229,7 +253,6 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
229 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, result); 253 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, result);
230 eo_unref(result->hand[i]); 254 eo_unref(result->hand[i]);
231 } 255 }
232
233 } 256 }
234 else 257 else
235 { 258 {
@@ -250,20 +273,8 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
250 evas_object_resize(result->win, result->w, result->h); 273 evas_object_resize(result->win, result->w, result->h);
251 } 274 }
252 275
253 if (result->internal) 276 if (result->parent)
254 { 277 {
255/*
256 result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win,
257 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0),
258 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
259 evas_obj_visibility_set(EINA_TRUE)
260 );
261 elm_object_style_set(result->title, "slide_bounce");
262 snprintf(buf, PATH_MAX, "<b>%s</b>", title);
263 elm_object_text_set(result->title, buf);
264 elm_box_pack_end(result->box, result->title);
265 eo_unref(result->title);
266*/
267#if 0 278#if 0
268 // EPysics enable the window. 279 // EPysics enable the window.
269 if (world) 280 if (world)
@@ -279,16 +290,6 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
279 } 290 }
280#endif 291#endif
281 292
282/*
283 obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win,
284 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0),
285 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
286 elm_obj_separator_horizontal_set(EINA_TRUE),
287 evas_obj_visibility_set(EINA_TRUE)
288 );
289 elm_box_pack_end(result->box, obj1);
290 eo_unref(obj1);
291*/
292 } 293 }
293 294
294 evas_object_show(result->win); 295 evas_object_show(result->win);
@@ -303,7 +304,8 @@ void winFangDel(winFang *win)
303 304
304 if (!win) return; 305 if (!win) return;
305 306
306 if (win->bg) eo_unref(win->bg); 307 if (win->bg) eo_unref(win->bg);
308 if (win->grid) eo_unref(win->grid);
307 EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node) 309 EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node)
308 { 310 {
309 winFangDel(wf); 311 winFangDel(wf);
@@ -316,6 +318,7 @@ void winFangDel(winFang *win)
316 eo_unref(wid->obj); 318 eo_unref(wid->obj);
317 } 319 }
318 if (win->on_del) win->on_del(win, win->win, NULL); 320 if (win->on_del) win->on_del(win, win->win, NULL);
321 if (win->parent) eo_unref(win->win);
319 evas_object_del(win->win); 322 evas_object_del(win->win);
320} 323}
321 324
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h
index c614b04..d2e03cf 100644
--- a/src/libraries/winFang.h
+++ b/src/libraries/winFang.h
@@ -33,7 +33,6 @@ typedef struct _winFang
33 Eina_Clist widgets; 33 Eina_Clist widgets;
34 Eina_Clist winFangs; 34 Eina_Clist winFangs;
35 int x, y, w, h; 35 int x, y, w, h;
36 Eina_Bool internal;
37 36
38 Evas_Object *hand[4]; 37 Evas_Object *hand[4];
39 38