Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_list.c ewl_list.h ewl_widget.c
Log Message:
- Make sure we have read the entire type string before assuming a match.
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_list.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_list.c 17 Jul 2006 04:39:06 -0000 1.3
+++ ewl_list.c 2 Aug 2006 00:40:48 -0000 1.4
@@ -3,6 +3,13 @@
#include "ewl_macros.h"
#include "ewl_private.h"
+static void ewl_list_cb_highlight_configure(Ewl_Widget *w,
+ void *ev, void *data);
+static void ewl_list_cb_highlighted_destroy(Ewl_Widget *w,
+ void *ev, void *data);
+static void ewl_list_cb_highlight_destroy(Ewl_Widget *w,
+ void *ev, void *data);
+
/**
* @return Returns a new Ewl_Widget on success or NULL on failure
* @brief Creates and initializes a new Ewl_List widget
@@ -206,12 +213,38 @@
DCHECK_PARAM_PTR("list", list);
DCHECK_TYPE("list", list, EWL_LIST_TYPE);
- if (list->selected == w)
+ if (list->selected.widget == w)
DRETURN(DLEVEL_STABLE);
- /* XXX probably need to do some theme thing here to highlight as
- * selected */
- list->selected = w;
+ if (list->selected.highlight)
+ ewl_widget_destroy(list->selected.highlight);
+
+ list->selected.widget = w;
+
+ if (w)
+ {
+ Ewl_Widget *f;
+ int width, height;
+
+ f = ewl_floater_new();
+ ewl_widget_internal_set(f, TRUE);
+ ewl_widget_appearance_set(f, "highlight");
+ ewl_floater_follow_set(EWL_FLOATER(f), w);
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+ ewl_object_size_request(EWL_OBJECT(f), width, height);
+
+ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+ ewl_list_cb_highlight_configure, f);
+ ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+ ewl_list_cb_highlighted_destroy, f);
+ ewl_callback_prepend(f, EWL_CALLBACK_DESTROY,
+ ewl_list_cb_highlight_destroy, w);
+ ewl_container_child_append(EWL_CONTAINER(list), f);
+ ewl_widget_show(f);
+
+ list->selected.highlight = f;
+ }
+
ewl_callback_call(EWL_WIDGET(list), EWL_CALLBACK_VALUE_CHANGED);
@@ -230,7 +263,7 @@
DCHECK_PARAM_PTR_RET("list", list, NULL);
DCHECK_TYPE_RET("list", list, EWL_LIST_TYPE, NULL);
- DRETURN_PTR(list->selected, DLEVEL_STABLE);
+ DRETURN_PTR(list->selected.widget, DLEVEL_STABLE);
}
/**
@@ -272,10 +305,11 @@
DCHECK_PARAM_PTR_RET("list", list, -1);
DCHECK_TYPE_RET("list", list, EWL_LIST_TYPE, -1);
- if (!list->selected)
+ if (!list->selected.widget)
DRETURN_INT(-1, DLEVEL_STABLE);
- idx = ewl_container_child_index_get(EWL_CONTAINER(list),
list->selected);
+ idx = ewl_container_child_index_get(EWL_CONTAINER(list),
+ list->selected.widget);
DRETURN_INT(idx, DLEVEL_STABLE);
}
@@ -340,6 +374,10 @@
DCHECK_TYPE("c", c, EWL_CONTAINER_TYPE);
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+ /* the highlight floaters are internal */
+ if (ewl_widget_internal_is(w))
+ DRETURN(DLEVEL_STABLE);
+
ewl_callback_append(w, EWL_CALLBACK_CLICKED,
ewl_list_cb_item_clicked, c);
@@ -366,7 +404,7 @@
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
list = EWL_LIST(c);
- if (list->selected == w)
+ if (list->selected.widget == w)
ewl_list_selected_widget_set(list, NULL);
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -391,7 +429,7 @@
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
list = EWL_LIST(c);
- if (list->selected == w)
+ if (list->selected.widget == w)
ewl_list_selected_widget_set(list, NULL);
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -418,6 +456,62 @@
list = data;
ewl_list_selected_widget_set(list, w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ewl_list_cb_highlight_configure(Ewl_Widget *w, void *ev, void *data)
+{
+ Ewl_Object *f;
+ int width, height;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("data", data);
+ DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE("data", data, EWL_FLOATER_TYPE);
+
+ f = data;
+ ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+ ewl_object_size_request(f, width, height);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ewl_list_cb_highlighted_destroy(Ewl_Widget *w, void *ev, void *data)
+{
+ Ewl_Widget *f;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("data", data);
+ DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+ DCHECK_TYPE("data", data, EWL_FLOATER_TYPE);
+
+ f = data;
+ ewl_widget_destroy(f);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ewl_list_cb_highlight_destroy(Ewl_Widget *w, void *ev, void *data)
+{
+ Ewl_Widget *o;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("data", data);
+ DCHECK_TYPE("w", w, EWL_FLOATER_TYPE);
+ DCHECK_TYPE("data", data, EWL_WIDGET_TYPE);
+
+ o = data;
+ ewl_callback_del(o, EWL_CALLBACK_CONFIGURE,
+ ewl_list_cb_highlight_configure);
+ ewl_callback_del(o, EWL_CALLBACK_DESTROY,
+ ewl_list_cb_highlighted_destroy);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_list.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_list.h 17 Jul 2006 04:39:06 -0000 1.3
+++ ewl_list.h 2 Aug 2006 00:40:48 -0000 1.4
@@ -36,7 +36,11 @@
Ewl_View *view; /**< The view for the list */
void *data; /**< The data for the list */
- Ewl_Widget *selected; /**< The selected widget */
+ struct {
+ Ewl_Widget *widget; /**< The selected widget */
+ Ewl_Widget *highlight; /**< The highlight widget */
+ } selected; /**< Selected widget info */
+
unsigned char dirty:1; /**< Has the model changed? */
};
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -3 -r1.92 -r1.93
--- ewl_widget.c 1 Aug 2006 21:32:16 -0000 1.92
+++ ewl_widget.c 2 Aug 2006 00:40:48 -0000 1.93
@@ -1606,7 +1606,7 @@
}
/* if we ended with the : then this is a match */
- if (*end == ':')
+ if ((*end == ':') && (*(type + count) == '\0'))
{
found = TRUE;
break;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs