diff options
author | David Walter Seikel | 2014-05-12 02:47:54 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-12 02:47:54 +1000 |
commit | a0f30eea71e05f114e6a708b07768995c884914c (patch) | |
tree | 5735ce1e4a072b6a15280e16d6c053cf0fd71b3d | |
parent | Move the callback comments. (diff) | |
download | SledjHamr-a0f30eea71e05f114e6a708b07768995c884914c.zip SledjHamr-a0f30eea71e05f114e6a708b07768995c884914c.tar.gz SledjHamr-a0f30eea71e05f114e6a708b07768995c884914c.tar.bz2 SledjHamr-a0f30eea71e05f114e6a708b07768995c884914c.tar.xz |
Fix up winFang move and resize. Still more to fix here though.
-rw-r--r-- | src/extantz/files.c | 4 | ||||
-rw-r--r-- | src/extantz/woMan.c | 6 | ||||
-rw-r--r-- | src/libraries/winFang.c | 75 | ||||
-rw-r--r-- | src/libraries/winFang.edc | 22 | ||||
-rw-r--r-- | src/libraries/winFang.h | 8 | ||||
-rw-r--r-- | src/purkle/purkle.c | 4 |
6 files changed, 79 insertions, 40 deletions
diff --git a/src/extantz/files.c b/src/extantz/files.c index 12dcc8d..799f1ac 100644 --- a/src/extantz/files.c +++ b/src/extantz/files.c | |||
@@ -158,7 +158,7 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
158 | elm_interface_fileselector_expandable_set(EINA_TRUE), | 158 | elm_interface_fileselector_expandable_set(EINA_TRUE), |
159 | elm_interface_fileselector_folder_only_set(EINA_FALSE) | 159 | elm_interface_fileselector_folder_only_set(EINA_FALSE) |
160 | ); | 160 | ); |
161 | elm_layout_box_append(me->win, BOX, fs); | 161 | elm_layout_box_append(me->win, WF_BOX, fs); |
162 | 162 | ||
163 | elm_fileselector_path_set(fs, path); | 163 | elm_fileselector_path_set(fs, path); |
164 | elm_fileselector_is_save_set(fs, save); | 164 | elm_fileselector_is_save_set(fs, save); |
@@ -264,7 +264,7 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
264 | elm_box_pack_end(vbox, bt); | 264 | elm_box_pack_end(vbox, bt); |
265 | eo_unref(bt); | 265 | eo_unref(bt); |
266 | 266 | ||
267 | elm_layout_box_append(me->win, BOX, vbox); | 267 | elm_layout_box_append(me->win, WF_BOX, vbox); |
268 | evas_object_show(vbox); | 268 | evas_object_show(vbox); |
269 | eo_unref(vbox); | 269 | eo_unref(vbox); |
270 | 270 | ||
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c index 7e476ea..b2f7ee3 100644 --- a/src/extantz/woMan.c +++ b/src/extantz/woMan.c | |||
@@ -184,7 +184,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
184 | 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); |
185 | 185 | ||
186 | // 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. |
187 | elm_layout_box_append(me->win, BOX, tb); | 187 | elm_layout_box_append(me->win, WF_BOX, tb); |
188 | evas_object_show(tb); | 188 | evas_object_show(tb); |
189 | 189 | ||
190 | gridList = elm_genlist_add(me->win); | 190 | gridList = elm_genlist_add(me->win); |
@@ -267,7 +267,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
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); | 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); |
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); | 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); |
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); | 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); |
270 | elm_layout_box_append(me->win, BOX, nf); | 270 | elm_layout_box_append(me->win, WF_BOX, nf); |
271 | 271 | ||
272 | bt = eo_add(ELM_OBJ_BUTTON_CLASS, me->win, | 272 | bt = eo_add(ELM_OBJ_BUTTON_CLASS, me->win, |
273 | // evas_obj_text_set("Login"), | 273 | // evas_obj_text_set("Login"), |
@@ -277,7 +277,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
277 | ); | 277 | ); |
278 | 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. |
279 | // evas_object_smart_callback_add(bt, "clicked", NULL, NULL); | 279 | // evas_object_smart_callback_add(bt, "clicked", NULL, NULL); |
280 | elm_layout_box_append(me->win, BOX, bt); | 280 | elm_layout_box_append(me->win, WF_BOX, bt); |
281 | eo_unref(bt); | 281 | eo_unref(bt); |
282 | 282 | ||
283 | return me; | 283 | return me; |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index d17d732..cd83291 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -1,24 +1,6 @@ | |||
1 | #include "winFang.h" | 1 | #include "winFang.h" |
2 | 2 | ||
3 | 3 | ||
4 | // Elm inlined image windows needs this to change focus on mouse click. | ||
5 | // Evas style event callback. | ||
6 | static void _cb_mouse_down_elm(void *data, Evas *evas, Evas_Object *obj, void *event_info) | ||
7 | { | ||
8 | winFang *win = data; | ||
9 | Evas_Event_Mouse_Down *ev = event_info; | ||
10 | |||
11 | if (1 == ev->button) | ||
12 | { | ||
13 | Evas_Object *objs = evas_object_top_at_pointer_get(win->e); | ||
14 | |||
15 | // TODO - This always returns the elm_win. So how the hell do you tell what got clicked on? | ||
16 | printf("%s %s\n", evas_object_type_get(objs), evas_object_name_get(objs)); | ||
17 | |||
18 | elm_object_focus_set(obj, EINA_TRUE); | ||
19 | } | ||
20 | } | ||
21 | |||
22 | static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) | 4 | static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) |
23 | { | 5 | { |
24 | Evas_Object *img = win->win, *test; | 6 | Evas_Object *img = win->win, *test; |
@@ -40,7 +22,7 @@ static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Co | |||
40 | EINA_LIST_FOREACH(objs, this, test) | 22 | EINA_LIST_FOREACH(objs, this, test) |
41 | { | 23 | { |
42 | const char * name = evas_object_name_get(test); | 24 | const char * name = evas_object_name_get(test); |
43 | if (name && (strcmp("winFang", name) == 0)) | 25 | if (name && (strcmp(WF_LAYOUT, name) == 0)) |
44 | i++; | 26 | i++; |
45 | } | 27 | } |
46 | if (2 <= i) | 28 | if (2 <= i) |
@@ -72,7 +54,6 @@ static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Co | |||
72 | else if (i == 3) cy += win->h; | 54 | else if (i == 3) cy += win->h; |
73 | evas_object_move(win->hand[i], cx - 15, cy - 15); | 55 | evas_object_move(win->hand[i], cx - 15, cy - 15); |
74 | } | 56 | } |
75 | // TODO - This just stretches everything, we don't really want that. | ||
76 | } | 57 | } |
77 | 58 | ||
78 | static void cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info) | 59 | static void cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info) |
@@ -139,6 +120,28 @@ static void _onBgMove(void *data, Evas *evas, Evas_Object *obj, void *event_info | |||
139 | _checkWindowBounds(win, x, y, w, h); | 120 | _checkWindowBounds(win, x, y, w, h); |
140 | } | 121 | } |
141 | 122 | ||
123 | static void _onBgUnclick(void *data, Evas *evas, Evas_Object *obj, void *event_info) | ||
124 | { | ||
125 | Evas_Event_Mouse_Down *ev = event_info; | ||
126 | |||
127 | if (1 == ev->button) | ||
128 | { | ||
129 | evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP, _onBgUnclick); | ||
130 | evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static void _onBgClick(void *data, Evas *evas, Evas_Object *obj, void *event_info) | ||
135 | { | ||
136 | Evas_Event_Mouse_Down *ev = event_info; | ||
137 | |||
138 | if (1 == ev->button) | ||
139 | { | ||
140 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, _onBgUnclick, data); | ||
141 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, data); | ||
142 | } | ||
143 | } | ||
144 | |||
142 | static void _on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 145 | static void _on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
143 | { | 146 | { |
144 | elm_exit(); | 147 | elm_exit(); |
@@ -165,6 +168,7 @@ void winFangShow(winFang *win) | |||
165 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) | 168 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) |
166 | { | 169 | { |
167 | winFang *result; | 170 | winFang *result; |
171 | Evas_Object *obj; | ||
168 | char buf[PATH_MAX]; | 172 | char buf[PATH_MAX]; |
169 | int i; | 173 | int i; |
170 | 174 | ||
@@ -186,17 +190,28 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
186 | result->win = eo_add(ELM_OBJ_LAYOUT_CLASS, parent->win, | 190 | result->win = eo_add(ELM_OBJ_LAYOUT_CLASS, parent->win, |
187 | evas_obj_size_set(result->w, result->h), | 191 | evas_obj_size_set(result->w, result->h), |
188 | evas_obj_position_set(result->x, result->y), | 192 | evas_obj_position_set(result->x, result->y), |
189 | evas_obj_name_set("winFang"), | 193 | evas_obj_name_set(WF_LAYOUT), |
190 | elm_obj_layout_file_set(buf, "winFang/layout"), | 194 | elm_obj_layout_file_set(buf, WF_LAYOUT), |
191 | evas_obj_visibility_set(EINA_TRUE) | 195 | evas_obj_visibility_set(EINA_TRUE) |
192 | ); | 196 | ); |
193 | result->e = evas_object_evas_get(result->win); | 197 | result->e = evas_object_evas_get(result->win); |
194 | 198 | ||
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 | 199 | ||
200 | // Something to catch clicks on the background, for moving the window. | ||
201 | // Cov Elm is uncooperative with this sort of thing, so we need to stick in a rectangle. | ||
202 | obj = eo_add(EVAS_OBJ_RECTANGLE_CLASS, result->win, | ||
203 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | ||
204 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
205 | evas_obj_name_set(WF_UNDERLAY), | ||
206 | evas_obj_color_set(0, 0, 0, 0), | ||
207 | evas_obj_visibility_set(EINA_TRUE) | ||
208 | ); | ||
209 | elm_object_part_content_set(result->win, WF_UNDERLAY, obj); | ||
210 | evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _onBgClick, result); | ||
211 | eo_unref(obj); | ||
212 | |||
213 | if (title) | ||
214 | elm_object_part_text_set(result->win, WF_TITLE, title); | ||
200 | /* | 215 | /* |
201 | result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win, | 216 | result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win, |
202 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), | 217 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), |
@@ -209,6 +224,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
209 | elm_box_pack_end(result->box, result->title); | 224 | elm_box_pack_end(result->box, result->title); |
210 | eo_unref(result->title); | 225 | eo_unref(result->title); |
211 | */ | 226 | */ |
227 | |||
212 | /* | 228 | /* |
213 | obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win, | 229 | obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win, |
214 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), | 230 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, 1.0), |
@@ -220,17 +236,15 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
220 | eo_unref(obj1); | 236 | eo_unref(obj1); |
221 | */ | 237 | */ |
222 | 238 | ||
223 | if (title) | ||
224 | elm_object_part_text_set(result->win, TITLE, title); | ||
225 | |||
226 | result->grid = eo_add(ELM_OBJ_GRID_CLASS, result->win, | 239 | result->grid = eo_add(ELM_OBJ_GRID_CLASS, result->win, |
227 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 240 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
228 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 241 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
242 | evas_obj_name_set(WF_SWALLOW), | ||
229 | // TODO - Actually, this should be minus the size of the title stuff. | 243 | // TODO - Actually, this should be minus the size of the title stuff. |
230 | elm_obj_grid_size_set(result->w, result->h), | 244 | elm_obj_grid_size_set(result->w, result->h), |
231 | evas_obj_visibility_set(EINA_TRUE) | 245 | evas_obj_visibility_set(EINA_TRUE) |
232 | ); | 246 | ); |
233 | elm_object_part_content_set(result->win, SWALLOW, result->grid); | 247 | elm_object_part_content_set(result->win, WF_SWALLOW, result->grid); |
234 | 248 | ||
235 | elm_layout_sizing_eval(result->win); | 249 | elm_layout_sizing_eval(result->win); |
236 | 250 | ||
@@ -341,6 +355,7 @@ Widget *widgetAdd(winFang *win, const Eo_Class *klass, Evas_Object *parent, char | |||
341 | { | 355 | { |
342 | result->label = strdup(title); | 356 | result->label = strdup(title); |
343 | elm_object_text_set(result->obj, result->label); | 357 | elm_object_text_set(result->obj, result->label); |
358 | evas_object_name_set(result->obj, title); | ||
344 | } | 359 | } |
345 | } | 360 | } |
346 | 361 | ||
diff --git a/src/libraries/winFang.edc b/src/libraries/winFang.edc index 0fca7a9..7705a0b 100644 --- a/src/libraries/winFang.edc +++ b/src/libraries/winFang.edc | |||
@@ -43,8 +43,28 @@ collections { | |||
43 | } | 43 | } |
44 | 44 | ||
45 | part { | 45 | part { |
46 | name: "winFang/underlay"; | ||
47 | type: SWALLOW; | ||
48 | mouse_events: 1; | ||
49 | |||
50 | description { | ||
51 | state: "default" 0.0; | ||
52 | |||
53 | rel1 { | ||
54 | relative: 0.0 0.0; | ||
55 | to: "winFang/background"; | ||
56 | } | ||
57 | rel2 { | ||
58 | relative: 1.0 1.0; | ||
59 | to: "winFang/background"; | ||
60 | } | ||
61 | } | ||
62 | } // winFang/underlay | ||
63 | |||
64 | part { | ||
46 | name: "winFang/title"; | 65 | name: "winFang/title"; |
47 | type: TEXT; | 66 | type: TEXT; |
67 | mouse_events: 0; | ||
48 | 68 | ||
49 | description { | 69 | description { |
50 | state: "default" 0.0; | 70 | state: "default" 0.0; |
@@ -71,6 +91,7 @@ collections { | |||
71 | part { | 91 | part { |
72 | name: "winFang/box"; | 92 | name: "winFang/box"; |
73 | type: BOX; | 93 | type: BOX; |
94 | mouse_events: 1; | ||
74 | 95 | ||
75 | description { | 96 | description { |
76 | state: "default" 0.0; | 97 | state: "default" 0.0; |
@@ -93,6 +114,7 @@ collections { | |||
93 | part { | 114 | part { |
94 | name: "winFang/content"; | 115 | name: "winFang/content"; |
95 | type: SWALLOW; | 116 | type: SWALLOW; |
117 | mouse_events: 1; | ||
96 | 118 | ||
97 | description { | 119 | description { |
98 | state: "default" 0.0; | 120 | state: "default" 0.0; |
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index d2e03cf..c55a75e 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -16,9 +16,11 @@ | |||
16 | #include <EPhysics.h> | 16 | #include <EPhysics.h> |
17 | 17 | ||
18 | 18 | ||
19 | #define BOX "winFang/box" | 19 | #define WF_LAYOUT "winFang/layout" |
20 | #define TITLE "winFang/title" | 20 | #define WF_UNDERLAY "winFang/underlay" |
21 | #define SWALLOW "winFang/content" | 21 | #define WF_TITLE "winFang/title" |
22 | #define WF_BOX "winFang/box" | ||
23 | #define WF_SWALLOW "winFang/content" | ||
22 | 24 | ||
23 | 25 | ||
24 | typedef struct _winFang | 26 | typedef struct _winFang |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index b1a45e1..98bfd13 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -29,7 +29,7 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
29 | evas_obj_visibility_set(EINA_TRUE) | 29 | evas_obj_visibility_set(EINA_TRUE) |
30 | ); | 30 | ); |
31 | elm_object_text_set(en, "History is shown here"); | 31 | elm_object_text_set(en, "History is shown here"); |
32 | elm_layout_box_append(me->win, BOX, en); | 32 | elm_layout_box_append(me->win, WF_BOX, en); |
33 | eo_unref(en); | 33 | eo_unref(en); |
34 | 34 | ||
35 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); | 35 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); |
@@ -38,7 +38,7 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
38 | elm_obj_entry_scrollable_set(EINA_TRUE), | 38 | elm_obj_entry_scrollable_set(EINA_TRUE), |
39 | elm_obj_entry_editable_set(EINA_TRUE) | 39 | elm_obj_entry_editable_set(EINA_TRUE) |
40 | ); | 40 | ); |
41 | elm_layout_box_append(me->win, BOX, wid->obj); | 41 | elm_layout_box_append(me->win, WF_BOX, wid->obj); |
42 | 42 | ||
43 | return me; | 43 | return me; |
44 | } | 44 | } |