Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_embed.c ewl_embed.h ewl_enums.h ewl_widget.c ewl_widget.h
Log Message:
- move some globals from ewl_widget.c into the ewl_embed struct
- cleanup naming along the way
- flush out a bit more of the api for handling tab order
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_embed.c 2 Oct 2005 06:23:48 -0000 1.9
+++ ewl_embed.c 14 Oct 2005 03:18:18 -0000 1.10
@@ -3,13 +3,8 @@
#include "ewl_macros.h"
#include "ewl_private.h"
-extern Ewl_Widget *last_selected;
-extern Ewl_Widget *last_key;
-extern Ewl_Widget *last_focused;
-extern Ewl_Widget *dnd_widget;
-
-Ecore_List *ewl_embed_list = NULL;
-Evas_Smart *embedded_smart = NULL;
+Ecore_List *ewl_embed_list = NULL;
+static Evas_Smart *embedded_smart = NULL;
static void ewl_embed_smart_add_cb(Evas_Object *obj);
static void ewl_embed_smart_del_cb(Evas_Object *obj);
@@ -112,7 +107,7 @@
ecore_list_append(ewl_embed_list, w);
- w->tab_order = ecore_list_new();
+ w->tab_order = ecore_dlist_new();
w->obj_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
DRETURN_INT(TRUE, DLEVEL_STABLE);
@@ -262,19 +257,18 @@
* If a widget has been selected then we send the keystroke to the
* appropriate widget.
*/
- if (!last_key || !ewl_container_parent_of(EWL_WIDGET(embed),
- last_key)) {
- if (last_selected)
- last_key = last_selected;
+ if (!embed->last.focused) {
+ if (embed->last.clicked)
+ embed->last.focused = embed->last.clicked;
else
- last_key = EWL_WIDGET(embed);
+ embed->last.focused = EWL_WIDGET(embed);
}
/*
* Dispatcher of key down events, these get sent to the last widget
* selected, and every parent above it.
*/
- temp = last_key;
+ temp = embed->last.focused;
while (temp) {
if (!(ewl_object_state_has(EWL_OBJECT(temp),
EWL_FLAG_STATE_DISABLED)))
@@ -312,7 +306,7 @@
* Dispatcher of key up events, these get sent to the last widget
* selected, and every parent above it.
*/
- temp = last_key;
+ temp = embed->last.focused;
while (temp) {
if (!(ewl_object_state_has(EWL_OBJECT(temp),
EWL_FLAG_STATE_DISABLED)))
@@ -359,8 +353,8 @@
* to triggering the callback to avoid funkiness if the callback
* causes the widget to be destroyed.
*/
- deselect = last_selected;
- last_key = last_selected = widget;
+ deselect = embed->last.clicked;
+ embed->last.focused = embed->last.clicked = widget;
ev.modifiers = mods;
ev.x = x;
@@ -444,7 +438,7 @@
* When the mouse is released the widget no longer has a pressed state,
* the widget and its parents are notified in this change of state.
*/
- temp = last_selected;
+ temp = embed->last.clicked;
while (temp) {
if (!(ewl_object_state_has(EWL_OBJECT(temp),
EWL_FLAG_STATE_DISABLED))) {
@@ -454,7 +448,6 @@
EWL_CALLBACK_MOUSE_UP, &ev);
}
-
temp = temp->parent;
}
@@ -487,8 +480,9 @@
* Focus a new widget if the mouse isn't pressed on the currently
* focused widget.
*/
- if (!last_focused || !ewl_object_state_has(EWL_OBJECT(last_focused),
EWL_FLAG_STATE_PRESSED)) {
-
+ if (!embed->last.mouse_in
+ ||
!ewl_object_state_has(EWL_OBJECT(embed->last.mouse_in),
+ EWL_FLAG_STATE_PRESSED)) {
widget =
ewl_container_child_at_recursive_get(EWL_CONTAINER(embed),
x, y);
if (!widget)
@@ -500,59 +494,56 @@
* Defocus all widgets up to the level of a shared parent of
* old and newly focused widgets.
*/
- while (last_focused && (widget != last_focused) &&
- !ewl_container_parent_of(last_focused, widget))
{
- ewl_object_state_remove(EWL_OBJECT(last_focused),
+ while (embed->last.mouse_in && (widget != embed->last.mouse_in)
+ &&
!ewl_container_parent_of(embed->last.mouse_in, widget)) {
+
ewl_object_state_remove(EWL_OBJECT(embed->last.mouse_in),
EWL_FLAG_STATE_HILITED);
- ewl_callback_call(last_focused, EWL_CALLBACK_FOCUS_OUT);
- last_focused = last_focused->parent;
+ ewl_callback_call(embed->last.mouse_in,
EWL_CALLBACK_FOCUS_OUT);
+ embed->last.mouse_in = embed->last.mouse_in->parent;
}
-
- }
- else {
- widget = last_focused;
}
+ else
+ widget = embed->last.mouse_in;
/*
* Pass out the movement event up the chain, allows parents to
* react to mouse movement in their children.
*/
- last_focused = widget;
- while (last_focused) {
-
- if (!(ewl_object_state_has(EWL_OBJECT(last_focused),
+ embed->last.mouse_in = widget;
+ while (embed->last.mouse_in) {
+ if (!(ewl_object_state_has(EWL_OBJECT(embed->last.mouse_in),
EWL_FLAG_STATE_DISABLED))) {
/*
* First mouse move event in a widget marks it focused.
*/
- if (!(ewl_object_state_has(EWL_OBJECT(last_focused),
+ if
(!(ewl_object_state_has(EWL_OBJECT(embed->last.mouse_in),
EWL_FLAG_STATE_HILITED))) {
- ewl_object_state_add(EWL_OBJECT(last_focused),
+
ewl_object_state_add(EWL_OBJECT(embed->last.mouse_in),
EWL_FLAG_STATE_HILITED);
- ewl_callback_call_with_event_data(last_focused,
+
ewl_callback_call_with_event_data(embed->last.mouse_in,
EWL_CALLBACK_FOCUS_IN, &ev);
}
- ewl_callback_call_with_event_data(last_focused,
+ ewl_callback_call_with_event_data(embed->last.mouse_in,
EWL_CALLBACK_MOUSE_MOVE, &ev);
}
- last_focused = last_focused->parent;
+ embed->last.mouse_in = embed->last.mouse_in->parent;
}
- last_focused = widget;
+ embed->last.mouse_in = widget;
- if (dnd_widget && ewl_object_state_has(EWL_OBJECT(dnd_widget),
+ if (embed->dnd_widget &&
ewl_object_state_has(EWL_OBJECT(embed->dnd_widget),
EWL_FLAG_STATE_DND))
- ewl_callback_call_with_event_data(dnd_widget,
+ ewl_callback_call_with_event_data(embed->dnd_widget,
EWL_CALLBACK_MOUSE_MOVE, &ev);
+ else
+ embed->dnd_widget = NULL;
- if (last_selected && ewl_object_state_has(EWL_OBJECT(last_selected),
+ if (embed->last.clicked &&
ewl_object_state_has(EWL_OBJECT(embed->last.clicked),
EWL_FLAG_STATE_PRESSED))
- ewl_callback_call_with_event_data(last_selected,
+ ewl_callback_call_with_event_data(embed->last.clicked,
EWL_CALLBACK_MOUSE_MOVE, &ev);
- else
- dnd_widget = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -576,10 +567,10 @@
ev.x = x;
ev.y = y;
- while (last_focused) {
- ewl_callback_call_with_event_data(last_focused,
+ while (embed->last.mouse_in) {
+ ewl_callback_call_with_event_data(embed->last.mouse_in,
EWL_CALLBACK_FOCUS_OUT, &ev);
- last_focused = last_focused->parent;
+ embed->last.mouse_in = embed->last.mouse_in->parent;
}
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -608,7 +599,7 @@
ev.z = z;
ev.dir = dir;
- w = last_focused;
+ w = embed->last.mouse_in;
if (!w) {
ewl_callback_call_with_event_data(EWL_WIDGET(embed),
EWL_CALLBACK_MOUSE_WHEEL,
@@ -743,24 +734,142 @@
}
/**
- * @param e: the embed that holds widgets to change tab order
+ * @param e: the embed that holds widgets
* @param w: the widget that will be moved to the front of the tab order list
* @return Returns no value.
* @brief Moves the widget @a w to the front of the tab order list.
*/
-void ewl_embed_tab_order_push(Ewl_Embed *e, Ewl_Widget *w)
+void ewl_embed_tab_order_prepend(Ewl_Embed *e, Ewl_Widget *w)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("e", e);
DCHECK_PARAM_PTR("w", w);
+ ewl_embed_tab_order_insert(e, w, 0);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: The embed that holds the widgets
+ * @param w: The widget to be append to the tab order
+ * @return Returns no value.
+ * @brief Moves the widget @a w to the end of the tab order
+ */
+void ewl_embed_tab_order_append(Ewl_Embed *e, Ewl_Widget *w)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR("w", w);
+
+ ewl_embed_tab_order_insert(e, w, ecore_list_nodes(e->tab_order));
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: The embed that holds the widgets
+ * @param w: The widget to insert into the tab order
+ * @param idx: The index to insert into
+ * @return Returns no value.
+ * @brief Moves the given widget @a w to the position @a idx
+ */
+void ewl_embed_tab_order_insert(Ewl_Embed *e, Ewl_Widget *w, unsigned int idx)
+{
+ int current_idx = 0;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR("w", w);
+
if (!ewl_container_parent_of(EWL_WIDGET(e), w))
DRETURN(DLEVEL_STABLE);
- if (ecore_list_goto(e->tab_order, w))
- ecore_list_remove(e->tab_order);
+ current_idx = ecore_dlist_index(e->tab_order);
+
+ /* make sure this widget isn't already in the list */
+ if (ecore_dlist_goto(e->tab_order, w)) {
+ int del_idx;
+
+ /* if this widget was before or at our current focused
+ * widget then we need to decrement our counter */
+ del_idx = ecore_dlist_index(e->tab_order);
+ if (del_idx <= current_idx) current_idx --;
+
+ ecore_dlist_remove(e->tab_order);
+ }
+
+ ecore_dlist_goto_index(e->tab_order, idx);
+ ecore_dlist_insert(e->tab_order, w);
+
+ /* if we inserted before or at our currently focused item then we
+ * need to advance our current item to the correct spot */
+ if (current_idx <= idx) current_idx ++;
+ ecore_dlist_goto_index(e->tab_order, current_idx);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: The embed to insert the widget into the tab order
+ * @param w: The widget ot insert into the tab order
+ * @param after: The widget to insert after
+ * @return Returns no value.
+ * @brief Inserts the @a w widget into the tab order after the @a after widget
+ */
+void ewl_embed_tab_order_insert_after(Ewl_Embed *e, Ewl_Widget *w,
+ Ewl_Widget *after)
+{
+ int cur_idx, idx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("after", after);
+
+ cur_idx = ecore_dlist_index(e->tab_order);
+ if (!ecore_dlist_goto(e->tab_order, after))
+ {
+ ewl_embed_tab_order_append(e, w);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ idx = ecore_dlist_index(e->tab_order);
+ ecore_dlist_goto_index(e->tab_order, cur_idx);
- ecore_list_prepend(e->tab_order, w);
+ ewl_embed_tab_order_insert(e, w, idx + 1);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: The embed to insert the widget into the tab order
+ * @param w: The widget ot insert into the tab order
+ * @param before: The widget to insert after
+ * @return Returns no value.
+ * @brief Inserts the @a w widget into the tab order before the @a before
widget
+ */
+void ewl_embed_tab_order_insert_before(Ewl_Embed *e, Ewl_Widget *w,
+ Ewl_Widget *before)
+{
+ int cur_idx, idx;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("before", before);
+
+ cur_idx = ecore_dlist_index(e->tab_order);
+ if (!ecore_dlist_goto(e->tab_order, before))
+ {
+ ewl_embed_tab_order_prepend(e, w);
+ DRETURN(DLEVEL_STABLE);
+ }
+
+ idx = ecore_dlist_index(e->tab_order);
+ ecore_dlist_goto_index(e->tab_order, cur_idx);
+
+ ewl_embed_tab_order_insert(e, w, idx);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -777,8 +886,8 @@
DCHECK_PARAM_PTR("e", e);
DCHECK_PARAM_PTR("w", w);
- if (ecore_list_goto(e->tab_order, w))
- ecore_list_remove(e->tab_order);
+ if (ecore_dlist_goto(e->tab_order, w))
+ ecore_dlist_remove(e->tab_order);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -795,13 +904,87 @@
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("e", e);
- if (!(w = ecore_list_next(e->tab_order))) {
- ecore_list_goto_first(e->tab_order);
- w = ecore_list_next(e->tab_order);
- }
+ if (!(w = ecore_dlist_next(e->tab_order)))
+ ecore_dlist_goto_first(e->tab_order);
+
+ w = ecore_dlist_current(e->tab_order);
+ if (w) ewl_widget_focus_send(w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: the embed to change focus of it's contained widgets
+ * @return Returns no value.
+ * @brief Changes focus to the next widget in the circular tab order list.
+ */
+void ewl_embed_tab_order_previous(Ewl_Embed *e)
+{
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+
+ if (!(w = ecore_dlist_previous(e->tab_order)))
+ ecore_dlist_goto_last(e->tab_order);
+
+ w = ecore_dlist_current(e->tab_order);
+ if (w) ewl_widget_focus_send(w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param embed: The embed to set the focused widget too
+ * @param w: The widget to set as having focus
+ * @return Returns no value.
+ */
+void ewl_embed_focused_widget_set(Ewl_Embed *embed, Ewl_Widget *w)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("embed", embed);
+ DCHECK_PARAM_PTR("w", w);
+
+ embed->last.focused = w;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param embed: The embed to get the curerntly focused widget
+ * @return Returns the currently focused widget
+ */
+Ewl_Widget *ewl_embed_focused_widget_get(Ewl_Embed *embed)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ DRETURN_PTR(embed->last.focused, DLEVEL_STABLE);
+}
+
+/**
+ * @param e: The embed to cleanup
+ * @param w: The wiget to check while cleaning up
+ * @return Returns no value.
+ * @brief This will check to see if the given widget is one of the last
+ * selected, clicked, mouse_in or the drag-n-drop widget and if so, set them
+ * to NULL
+ */
+void ewl_embed_info_widgets_cleanup(Ewl_Embed *e, Ewl_Widget *w)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+
+ if (w == e->last.focused)
+ e->last.focused = NULL;
+
+ if (w == e->last.clicked)
+ e->last.clicked = NULL;
+
+ if (w == e->last.mouse_in)
+ e->last.mouse_in = NULL;
- if (w)
- ewl_widget_focus_send(w);
+ if (w == e->dnd_widget)
+ e->dnd_widget = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -961,7 +1144,7 @@
ecore_hash_destroy(emb->obj_cache);
emb->obj_cache = NULL;
- ecore_list_destroy(emb->tab_order);
+ ecore_dlist_destroy(emb->tab_order);
emb->tab_order = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_embed.h 27 Sep 2005 04:40:09 -0000 1.3
+++ ewl_embed.h 14 Oct 2005 03:18:19 -0000 1.4
@@ -52,12 +52,21 @@
Evas_Object *smart; /**< Manipulate Ewl_Embed from evas */
Evas_Object *ev_clip; /**< Clip box to receive evas events */
- Ecore_List *tab_order; /**< Order of widgets to send focus */
+ Ecore_DList *tab_order; /**< Order of widgets to send focus */
Ecore_Hash *obj_cache; /**< Hash of object queues for reuse */
int max_layer; /**< The maximum widget layer used */
int focus; /**< Indicates if it receives focus */
+
+ struct
+ {
+ Ewl_Widget *clicked;
+ Ewl_Widget *focused;
+ Ewl_Widget *mouse_in;
+ } last;
+
+ Ewl_Widget *dnd_widget;
};
Ewl_Widget *ewl_embed_new(void);
@@ -91,9 +100,22 @@
void ewl_embed_object_cache(Ewl_Embed *e, Evas_Object *obj);
Evas_Object *ewl_embed_object_request(Ewl_Embed *e, char *type);
-void ewl_embed_tab_order_next(Ewl_Embed *e);
+void ewl_embed_tab_order_append(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_tab_order_prepend(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_tab_order_insert(Ewl_Embed *e, Ewl_Widget *w,
+ unsigned int idx);
+void ewl_embed_tab_order_insert_before(Ewl_Embed *e, Ewl_Widget *w,
+ Ewl_Widget *before);
+void ewl_embed_tab_order_insert_after(Ewl_Embed *e, Ewl_Widget *w,
+ Ewl_Widget *after);
void ewl_embed_tab_order_remove(Ewl_Embed *e, Ewl_Widget *w);
-void ewl_embed_tab_order_push(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_tab_order_next(Ewl_Embed *e);
+void ewl_embed_tab_order_previous(Ewl_Embed *e);
+
+void ewl_embed_focused_widget_set(Ewl_Embed *e, Ewl_Widget *w);
+Ewl_Widget *ewl_embed_focused_widget_get(Ewl_Embed *e);
+void ewl_embed_info_widgets_cleanup(Ewl_Embed *e, Ewl_Widget *w);
+
void ewl_embed_coord_to_screen(Ewl_Embed *e, int xx, int yy,
int *x, int *y);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_enums.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_enums.h 10 Oct 2005 15:27:10 -0000 1.14
+++ ewl_enums.h 14 Oct 2005 03:18:19 -0000 1.15
@@ -146,7 +146,9 @@
EWL_FLAG_STATE_PRESSED = 0x400000,
EWL_FLAG_STATE_SELECTED = 0x8000000,
EWL_FLAG_STATE_DND = 0x1000000,
- EWL_FLAG_STATE_DISABLED = 0x2000000
+ EWL_FLAG_STATE_DISABLED = 0x2000000,
+
+ EWL_FLAG_STOP_TAB_FOCUS_CHANGE = 0x4000000
};
#define EWL_FLAG_FILL_NORMAL (EWL_FLAG_FILL_FILL)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ewl_widget.c 13 Oct 2005 19:50:17 -0000 1.22
+++ ewl_widget.c 14 Oct 2005 03:18:19 -0000 1.23
@@ -3,11 +3,6 @@
#include "ewl_macros.h"
#include "ewl_private.h"
-Ewl_Widget *last_selected = NULL;
-Ewl_Widget *last_key = NULL;
-Ewl_Widget *last_focused = NULL;
-Ewl_Widget *dnd_widget = NULL;
-
static Ecore_Hash *ewl_widget_name_table = NULL;
static void ewl_widget_theme_padding_get(Ewl_Widget *w, int *l, int *r,
@@ -308,6 +303,8 @@
*/
void ewl_widget_hide(Ewl_Widget * w)
{
+ Ewl_Embed *emb;
+
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
@@ -317,17 +314,8 @@
if (HIDDEN(w))
DRETURN(DLEVEL_STABLE);
- /*
- * These are only applicable to visible widgets.
- */
- if (w == last_selected)
- last_selected = NULL;
- if (w == last_key)
- last_key = NULL;
- if (w == last_focused)
- last_focused = NULL;
- if (w == dnd_widget)
- dnd_widget = NULL;
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_info_widgets_cleanup(emb, w);
ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
@@ -788,20 +776,101 @@
* @return Returns no value.
* @brief Changes the order in the embed so @a w receives focus first on tab.
*
+ * This moves the widget @a w to the end of the tab order list in the embed
+ * that holds it.
+ */
+void ewl_widget_tab_order_append(Ewl_Widget *w)
+{
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_tab_order_append(emb, w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: the widget to be moved to the front of the focus list
+ * @return Returns no value.
+ * @brief Changes the order in the embed so @a w receives focus first on tab.
+ *
* This moves the widget @a w to the front of the tab order list in the embed
- * that holds it. This is the recommended method for manipulating tab order,
- * The embed versions should only be accessed internally if you understand
- * their ramifications.
+ * that holds it.
+ */
+void ewl_widget_tab_order_prepend(Ewl_Widget *w)
+{
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_tab_order_prepend(emb, w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: the widget to be moved to the front of the focus list
+ * @return Returns no value.
+ * @brief Changes the order in the embed so @a w receives focus first on tab.
+ *
+ * This moves the widget @a w to the given index in the tab order list in the
embed
+ * that holds it.
+ */
+void ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx)
+{
+ Ewl_Embed *emb;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_tab_order_insert(emb, w, idx);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: The widget to be inserted into the tab order
+ * @param before: The widget we are to be inserted before
+ * @return Returns no value.
+ * @brief Inserts the widget into the tab order before the @a before widget
*/
-void ewl_widget_tab_order_push(Ewl_Widget *w)
+void ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget *before)
{
- Ewl_Embed *e;
+ Ewl_Embed *emb;
+ DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("before", before);
+
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_tab_order_insert_before(emb, w, before);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: The widget to insert into the tab order
+ * @param after: The widget to insert after
+ * @return Returns no value.
+ * @brief Insert the given widget into the tab order after the @a after
+ * widget
+ */
+void ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget *after)
+{
+ Ewl_Embed *emb;
+
DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("after", after);
- e = ewl_embed_widget_find(w);
- ewl_embed_tab_order_push(EWL_EMBED(e), w);
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_tab_order_insert_after(emb, w, after);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1006,9 +1075,12 @@
*/
void ewl_widget_focus_send(Ewl_Widget *w)
{
+ Ewl_Embed *emb;
+
DENTER_FUNCTION(DLEVEL_STABLE);
- last_key = w;
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_focused_widget_set(emb, w);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1017,11 +1089,17 @@
* @return Returns the currnetly focused widget.
* @brief Retrieve the currently focused widget.
*/
-Ewl_Widget *ewl_widget_focused_get()
+Ewl_Widget *ewl_widget_focused_get(void)
{
+ Ewl_Embed *emb;
+ Ewl_Widget *w = NULL;
+
DENTER_FUNCTION(DLEVEL_STABLE);
- DRETURN_PTR(last_key, DLEVEL_STABLE);
+ emb = ewl_embed_widget_find(w);
+ w = ewl_embed_focused_widget_get(emb);
+
+ DRETURN_PTR(w, DLEVEL_STABLE);
}
/**
@@ -1174,6 +1252,7 @@
void *user_data __UNUSED__)
{
Ewl_Container *pc;
+ Ewl_Embed *emb;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
@@ -1196,20 +1275,8 @@
if (pc)
ewl_container_child_hide_call(pc, w);
- /*
- * Cleanup a variety of references to that can be held.
- */
- if (last_selected == w)
- last_selected = NULL;
-
- if (last_key == w)
- last_key = NULL;
-
- if (last_focused == w)
- last_focused = NULL;
-
- if (dnd_widget == w)
- dnd_widget = NULL;
+ emb = ewl_embed_widget_find(w);
+ ewl_embed_info_widgets_cleanup(emb, w);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ewl_widget.h 3 Oct 2005 06:43:07 -0000 1.15
+++ ewl_widget.h 14 Oct 2005 03:18:19 -0000 1.16
@@ -222,8 +222,15 @@
unsigned int ewl_widget_clipped_is(Ewl_Widget *w);
void ewl_widget_focus_send(Ewl_Widget *w);
+
Ewl_Widget *ewl_widget_focused_get(void);
-void ewl_widget_tab_order_push(Ewl_Widget *w);
+
+void ewl_widget_tab_order_append(Ewl_Widget *w);
+void ewl_widget_tab_order_prepend(Ewl_Widget *w);
+void ewl_widget_tab_order_insert(Ewl_Widget *w, unsigned int idx);
+void ewl_widget_tab_order_insert_before(Ewl_Widget *w, Ewl_Widget
*before);
+void ewl_widget_tab_order_insert_after(Ewl_Widget *w, Ewl_Widget
*after);
+void ewl_widget_tab_order_remove(Ewl_Widget *w);
void ewl_widget_color_set(Ewl_Widget *w, int r, int g,
int b, int a);
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs