Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_menu_base.c ewl_menu_base.h ewl_seeker.c
Log Message:
More progress on the menus. Fixed the seeker to work correctly.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_menu_base.c 21 Jun 2003 22:50:13 -0000 1.9
+++ ewl_menu_base.c 23 Jun 2003 05:59:19 -0000 1.10
@@ -118,17 +118,26 @@
EWL_CALLBACK_DESELECT);
/*
- * Create the icon if one is requested.
+ * Create the icon if one is requested, or a spacer if not, but there is
+ * text to be displayed.
*/
if (image)
item->icon = ewl_image_new(image);
- else
+ else if (text)
item->icon = ewl_spacer_new();
- ewl_object_set_alignment(EWL_OBJECT(item->icon), EWL_ALIGNMENT_CENTER);
- ewl_object_set_maximum_size(EWL_OBJECT(item->icon), 20, 20);
- ewl_container_append_child(EWL_CONTAINER(item), item->icon);
- ewl_widget_show(item->icon);
+ /*
+ * Did we create an icon or a placeholder? Goodie, then finish it's
+ * setup. We don't always want to create one, in the case that a
+ * separator is going to be packed in here instead.
+ */
+ if (item->icon) {
+ ewl_object_set_alignment(EWL_OBJECT(item->icon),
+ EWL_ALIGNMENT_CENTER);
+ ewl_object_set_maximum_size(EWL_OBJECT(item->icon), 20, 20);
+ ewl_container_append_child(EWL_CONTAINER(item), item->icon);
+ ewl_widget_show(item->icon);
+ }
/*
* Create the text object for the menu item.
@@ -140,6 +149,54 @@
EWL_ALIGNMENT_LEFT);
ewl_widget_show(item->text);
}
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * ewl_menu_separator_new - create a separator menu item
+ *
+ * Returns a new menu item separator on success, NULL on failure.
+ */
+Ewl_Menu_Separator *ewl_menu_separator_new()
+{
+ Ewl_Menu_Separator *sep;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ sep = NEW(Ewl_Menu_Separator, 1);
+ if (!sep)
+ DRETURN_PTR(NULL, DLEVEL_STABLE);
+
+ ZERO(sep, Ewl_Menu_Separator, 1);
+ ewl_menu_separator_init(sep);
+
+ DRETURN_PTR(sep, DLEVEL_STABLE);
+}
+
+/**
+ * ewl_menu_separator_init - initialize a menu separator item
+ * @sep: the menu separator item to initialize
+ *
+ * Returns no value. Sets up the internal fields of the menu separator item to
+ * some sane defaults.
+ */
+void ewl_menu_separator_init(Ewl_Menu_Separator *sep)
+{
+ Ewl_Widget *separator;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ DCHECK_PARAM_PTR("sep", sep);
+
+ ewl_menu_item_init(EWL_MENU_ITEM(sep), NULL, NULL);
+
+ separator = ewl_separator_new(EWL_ORIENTATION_HORIZONTAL);
+ if (!separator)
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_container_append_child(EWL_CONTAINER(sep), separator);
+ ewl_widget_show(separator);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_menu_base.h 3 Jun 2003 04:00:46 -0000 1.2
+++ ewl_menu_base.h 23 Jun 2003 05:59:19 -0000 1.3
@@ -29,6 +29,15 @@
int submenu;
};
+typedef struct _ewl_menu_separator Ewl_Menu_Separator;
+
+#define EWL_MENU_SEPARATOR(s) ((Ewl_Menu_Separator *)s)
+
+struct _ewl_menu_separator
+{
+ Ewl_Menu_Item item;
+};
+
typedef struct _ewl_menu_base Ewl_Menu_Base;
#define EWL_MENU_BASE(menu) ((Ewl_Menu_Base *) menu)
@@ -61,6 +70,9 @@
Ewl_Widget *ewl_menu_item_new(char *image, char *title);
void ewl_menu_item_init(Ewl_Menu_Item * menu, char *image,
char *title);
+
+Ewl_Menu_Separator *ewl_menu_separator_new();
+void ewl_menu_separator_init(Ewl_Menu_Separator *sep);
void ewl_menu_base_init(Ewl_Menu_Base * menu, char *image,
char *title);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_seeker.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_seeker.c 21 Jun 2003 22:50:13 -0000 1.37
+++ ewl_seeker.c 23 Jun 2003 05:59:19 -0000 1.38
@@ -144,6 +144,9 @@
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("s", s);
+ if (v == s->value)
+ DRETURN(DLEVEL_STABLE);
+
if (v < 0)
v = 0;
@@ -480,8 +483,7 @@
scale = (double)(my - dy) / (double)dh;
}
- s->value = scale * s->range;
- ewl_widget_configure(w);
+ ewl_seeker_set_value(s, scale * s->range);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -490,6 +492,7 @@
{
Ewl_Seeker *s;
Ecore_Event_Mouse_Down *ev;
+ double value;
int xx, yy, ww, hh;
DENTER_FUNCTION(DLEVEL_STABLE);
@@ -503,37 +506,26 @@
ewl_object_get_current_geometry(EWL_OBJECT(s->dragbar),
&xx, &yy, &ww, &hh);
+ value = s->value;
+
/*
* Increment or decrement the value based on the position of the click
* relative to the dragbar and the orientation of the seeker.
*/
if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
if (ev->x < xx)
- s->value -= s->step;
+ value -= s->step;
else if (ev->x > xx + ww)
- s->value += s->step;
+ value += s->step;
}
else {
if (ev->y < yy)
- s->value += s->step;
+ value -= s->step;
else if (ev->y > yy + hh)
- s->value -= s->step;
+ value += s->step;
}
- if (s->value < 0.0)
- s->value = 0.0;
- else if (s->value > s->range)
- s->value = s->range;
-
- /*
- * Determine the new position of the dragbar and configure it.
- */
- ewl_widget_configure(EWL_WIDGET(s));
-
- /*
- * Now signal that the value of the seeker has changed.
- */
- ewl_callback_call(EWL_WIDGET(s), EWL_CALLBACK_VALUE_CHANGED);
+ ewl_seeker_set_value(s, value);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs