Enlightenment CVS committal Author : moom Project : e17 Module : proto
Dir : e17/proto/etk/src/lib Modified Files: etk_bin.h etk_box.c etk_toplevel_widget.c etk_widget.c etk_widget.h Log Message: * The widgets can now change the focus order of their children. * Implementation of a correct focus order in Etk_Box =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_bin.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- etk_bin.h 12 May 2006 19:13:39 -0000 1.5 +++ etk_bin.h 13 May 2006 12:04:00 -0000 1.6 @@ -5,6 +5,10 @@ #include "etk_container.h" #include "etk_types.h" +/* TODO: Etk_Bin + - The "swallow" code should be included in Etk_Widget.c + */ + /** * @defgroup Etk_Bin Etk_Bin * @brief The Etk_Bin widget is a container that can contain only one child =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_box.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- etk_box.c 12 May 2006 19:13:39 -0000 1.10 +++ etk_box.c 13 May 2006 12:04:00 -0000 1.11 @@ -274,6 +274,7 @@ ETK_CONTAINER(box)->child_add = _etk_box_child_add; ETK_CONTAINER(box)->child_remove = _etk_box_child_remove; ETK_CONTAINER(box)->children_get = _etk_box_children_get; + ETK_WIDGET(box)->use_focus_order = ETK_TRUE; } /* Destroys the box */ @@ -356,6 +357,7 @@ etk_widget_parent_set_full(widget, NULL, ETK_FALSE); free(cell); box->cells = evas_list_remove_list(box->cells, l); + ETK_WIDGET(box)->focus_order = evas_list_remove(ETK_WIDGET(box)->focus_order, widget); etk_widget_size_recalc_queue(ETK_WIDGET(box)); return; } @@ -784,11 +786,13 @@ * **************************/ -/* Adds the "child" to the "box" : "expand" and "fill" describe its fill policy, "padding" is the size of the space - * on the sides of the child and if "pack_end" == ETK_TRUE, the child will be packed at the end of the box */ +/* Adds the "child" to the "box" : "expand" and "fill" describe its fill policy, "padding" is the amount of space + * on the sides of the child and. If "pack_end" == ETK_TRUE, the child will be packed at the end of the box */ static void _etk_box_pack_full(Etk_Box *box, Etk_Widget *child, Etk_Bool expand, Etk_Bool fill, int padding, Etk_Bool pack_end) { - Etk_Box_Cell *cell; + Etk_Box_Cell *cell, *last_cell; + Evas_List *l; + Etk_Widget *w; if (!box || !child) return; @@ -799,6 +803,26 @@ cell->padding = padding; cell->pack_end = pack_end; cell->child = child; + + /* Adds the child in the focus_order list, at the right place */ + last_cell = evas_list_data(evas_list_last(box->cells)); + if (!last_cell) + ETK_WIDGET(box)->focus_order = evas_list_append(ETK_WIDGET(box)->focus_order, child); + else + { + for (l = ETK_WIDGET(box)->focus_order; l; l = l->next) + { + w = ETK_WIDGET(l->data); + if (w == last_cell->child) + { + if (last_cell->pack_end) + ETK_WIDGET(box)->focus_order = evas_list_prepend_relative(ETK_WIDGET(box)->focus_order, child, l); + else + ETK_WIDGET(box)->focus_order = evas_list_append_relative(ETK_WIDGET(box)->focus_order, child, l); + break; + } + } + } box->cells = evas_list_append(box->cells, cell); etk_widget_parent_set(child, ETK_WIDGET(box)); =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_toplevel_widget.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- etk_toplevel_widget.c 7 Apr 2006 15:36:11 -0000 1.14 +++ etk_toplevel_widget.c 13 May 2006 12:04:00 -0000 1.15 @@ -112,39 +112,39 @@ } /** - * @brief Gets the next widget to focus. Mainly for widget implementations + * @brief Gets the previous widget to focus. Mainly for widget implementations * @param toplevel_widget a toplevel widget - * @return Returns the next widget to focus + * @return Returns the previous widget to focus */ -Etk_Widget *etk_toplevel_widget_focused_widget_next_get(Etk_Toplevel_Widget *toplevel_widget) +Etk_Widget *etk_toplevel_widget_focused_widget_prev_get(Etk_Toplevel_Widget *toplevel_widget) { Etk_Widget *focused_parent; if (!toplevel_widget) return NULL; - if (toplevel_widget->focused_widget && (focused_parent = ETK_WIDGET(toplevel_widget->focused_widget->parent))) - return _etk_toplevel_widget_next_to_focus_get(focused_parent, toplevel_widget->focused_widget); + if (toplevel_widget->focused_widget && (focused_parent = toplevel_widget->focused_widget->parent)) + return _etk_toplevel_widget_prev_to_focus_get(focused_parent, toplevel_widget->focused_widget); else - return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(toplevel_widget), NULL); + return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(toplevel_widget), NULL); } /** - * @brief Gets the previous widget to focus. Mainly for widget implementations + * @brief Gets the next widget to focus. Mainly for widget implementations * @param toplevel_widget a toplevel widget - * @return Returns the previous widget to focus + * @return Returns the next widget to focus */ -Etk_Widget *etk_toplevel_widget_focused_widget_prev_get(Etk_Toplevel_Widget *toplevel_widget) +Etk_Widget *etk_toplevel_widget_focused_widget_next_get(Etk_Toplevel_Widget *toplevel_widget) { Etk_Widget *focused_parent; if (!toplevel_widget) return NULL; - if (toplevel_widget->focused_widget && (focused_parent = ETK_WIDGET(toplevel_widget->focused_widget->parent))) - return _etk_toplevel_widget_prev_to_focus_get(focused_parent, toplevel_widget->focused_widget); + if (toplevel_widget->focused_widget && (focused_parent = toplevel_widget->focused_widget->parent)) + return _etk_toplevel_widget_next_to_focus_get(focused_parent, toplevel_widget->focused_widget); else - return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(toplevel_widget), NULL); + return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(toplevel_widget), NULL); } /** @@ -322,47 +322,53 @@ /* Gets recursively the next widget to focus */ static Etk_Widget *_etk_toplevel_widget_next_to_focus_get(Etk_Widget *node, Etk_Widget *from) { + Evas_List *focus_order; Evas_List *l; if (!node) return NULL; if (node->focusable) return node; - if (!node->children) - return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(node->parent), node); + + focus_order = node->use_focus_order ? node->focus_order : node->children; + if (!focus_order) + return _etk_toplevel_widget_next_to_focus_get(node->parent, node); - if (from && (l = evas_list_find_list(node->children, from))) + if (from && (l = evas_list_find_list(focus_order, from))) { if (l->next) return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(l->next->data), NULL); else - return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(node->parent), node); + return _etk_toplevel_widget_next_to_focus_get(node->parent, node); } else - return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(node->children->data), NULL); + return _etk_toplevel_widget_next_to_focus_get(ETK_WIDGET(focus_order->data), NULL); } /* Gets recursively the previous widget to focus */ static Etk_Widget *_etk_toplevel_widget_prev_to_focus_get(Etk_Widget *node, Etk_Widget *from) { + Evas_List *focus_order; Evas_List *l; if (!node) return NULL; if (node->focusable) return node; - if (!node->children) - return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(node->parent), node); + + focus_order = node->use_focus_order ? node->focus_order : node->children; + if (!focus_order) + return _etk_toplevel_widget_prev_to_focus_get(node->parent, node); - if (from && (l = evas_list_find_list(node->children, from))) + if (from && (l = evas_list_find_list(focus_order, from))) { if (l->prev) return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(l->prev->data), NULL); else - return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(node->parent), node); + return _etk_toplevel_widget_prev_to_focus_get(node->parent, node); } else - return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(evas_list_data(evas_list_last(node->children))), NULL); + return _etk_toplevel_widget_prev_to_focus_get(ETK_WIDGET(evas_list_data(evas_list_last(focus_order))), NULL); } /** @} */ =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_widget.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -3 -r1.51 -r1.52 --- etk_widget.c 7 Apr 2006 15:36:11 -0000 1.51 +++ etk_widget.c 13 May 2006 12:04:00 -0000 1.52 @@ -1741,6 +1741,7 @@ widget->toplevel_parent = NULL; widget->child_properties = NULL; widget->children = NULL; + widget->focus_order = NULL; widget->theme_object = NULL; widget->theme_min_width = 0; @@ -1793,6 +1794,7 @@ widget->focusable = ETK_FALSE; widget->focus_on_press = ETK_FALSE; widget->can_pass_focus = ETK_TRUE; + widget->use_focus_order = ETK_FALSE; widget->has_event_object = ETK_FALSE; widget->repeat_mouse_events = ETK_FALSE; widget->pass_mouse_events = ETK_FALSE; @@ -1833,8 +1835,8 @@ etk_container_remove(ETK_CONTAINER(widget->parent), widget); etk_widget_parent_set(widget, NULL); } + evas_list_free(widget->focus_order); - /* Unref theme children/parent */ while (widget->theme_children) { ETK_WIDGET(widget->theme_children->data)->theme_parent = NULL; @@ -1843,10 +1845,9 @@ if (widget->theme_parent) widget->theme_parent->theme_children = evas_list_remove(widget->theme_parent->theme_children, widget); - /* Free what need to be freed */ + /* Remove the widget from the dnd lists */ if (widget->accepts_dnd && widget->dnd_dest) _etk_widget_dnd_dest_widgets = evas_list_remove(_etk_widget_dnd_dest_widgets, widget); - if (widget->accepts_dnd && widget->dnd_source) _etk_widget_dnd_source_widgets = evas_list_remove(_etk_widget_dnd_source_widgets, widget); =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_widget.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- etk_widget.h 7 Apr 2006 15:36:11 -0000 1.28 +++ etk_widget.h 13 May 2006 12:04:00 -0000 1.29 @@ -142,6 +142,7 @@ Etk_Widget *parent; void *child_properties; Evas_List *children; + Evas_List *focus_order; Evas_Object *theme_object; int theme_min_width, theme_min_height; @@ -159,9 +160,9 @@ int left_inset, right_inset, top_inset, bottom_inset; Etk_Geometry geometry; Etk_Geometry inner_geometry; - /* The size wanted by the user */ + /* The size requested by the user */ Etk_Size requested_size; - /* The result of the last etk_widget_size_request() */ + /* The result of the last call to etk_widget_size_request() */ Etk_Size last_size_requisition; void (*size_request)(Etk_Widget *widget, Etk_Size *size_requisition); void (*size_allocate)(Etk_Widget *widget, Etk_Geometry geometry); @@ -192,6 +193,7 @@ unsigned char focusable : 1; unsigned char focus_on_press : 1; unsigned char can_pass_focus : 1; + unsigned char use_focus_order : 1; unsigned char need_size_recalc : 1; unsigned char need_redraw : 1; unsigned char need_theme_min_size_recalc : 1; ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs