Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_label.c ewl_paned.c ewl_paned.h ewl_separator.c
ewl_separator.h
Log Message:
API changes, paned is broken now, but it had some issues anyways and nothing
was lost in the code.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_label.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ewl_label.c 3 Oct 2005 06:43:07 -0000 1.8
+++ ewl_label.c 4 Oct 2005 05:23:26 -0000 1.9
@@ -137,5 +137,3 @@
ewl_object_preferred_inner_size_set(EWL_OBJECT(la), (int)nw, (int)nh);
}
-
-
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_paned.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_paned.c 3 Oct 2005 06:43:07 -0000 1.4
+++ ewl_paned.c 4 Oct 2005 05:23:26 -0000 1.5
@@ -15,12 +15,11 @@
void *user_data);
/**
- * @param orient: the desired orientation of the paned widget
* @return Returns NULL on failure, or a pointer to a new paned widget on
success.
* @brief Allocate and initialize a new paned widget
*/
Ewl_Widget *
-ewl_paned_new(Ewl_Orientation orient)
+ewl_paned_new()
{
Ewl_Paned *pane = NULL;
@@ -30,7 +29,7 @@
if (!pane)
DRETURN_PTR(NULL, DLEVEL_STABLE);
- if (!ewl_paned_init(pane, orient)) {
+ if (!ewl_paned_init(pane)) {
ewl_widget_destroy(EWL_WIDGET(pane));
pane = NULL;
}
@@ -39,13 +38,52 @@
}
/**
+ * @return Returns NULL on failure, or a pointer to a new paned widget on
success.
+ * @brief Allocate and initialize a new paned widget with horizontal
orientation
+ */
+Ewl_Widget *
+ewl_hpaned_new()
+{
+ Ewl_Widget *pane = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ pane = ewl_paned_new();
+
+ if (pane)
+ ewl_box_orientation_set(EWL_BOX(pane),
+ EWL_ORIENTATION_HORIZONTAL);
+
+ DRETURN_PTR(pane, DLEVEL_STABLE);
+}
+
+/**
+ * @return Returns NULL on failure, or a pointer to a new paned widget on
success.
+ * @brief Allocate and initialize a new paned widget with vertical orientation
+ */
+Ewl_Widget *
+ewl_vpaned_new()
+{
+ Ewl_Widget *pane = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ pane = ewl_paned_new();
+
+ if (pane)
+ ewl_box_orientation_set(EWL_BOX(pane),
+ EWL_ORIENTATION_VERTICAL);
+
+ DRETURN_PTR(pane, DLEVEL_STABLE);
+}
+
+/**
* @param p: the paned widget to initialize
- * @param orient: the orientation of the paned widget
* @return Returns 1 on success or 0 on failure
* @brief Initialize a new paned widget to default values
*/
int
-ewl_paned_init(Ewl_Paned *p, Ewl_Orientation orient)
+ewl_paned_init(Ewl_Paned *p)
{
Ewl_Widget *w = NULL;
@@ -58,8 +96,12 @@
DRETURN_INT(FALSE, DLEVEL_STABLE);
}
- ewl_box_orientation_set(EWL_BOX(p), orient);
- p->orientation = orient;
+ ewl_widget_appearance_set(w, "paned");
+ ewl_widget_inherit(w, "paned");
+
+ ewl_callback_prepend(EWL_WIDGET(p), EWL_CALLBACK_CONFIGURE,
+ ewl_paned_configure_cb, NULL);
+
p->grabbed = FALSE;
p->first = EWL_BOX(ewl_vbox_new());
@@ -67,10 +109,7 @@
ewl_object_fill_policy_set(EWL_OBJECT(p->first), EWL_FLAG_FILL_ALL);
ewl_widget_show(EWL_WIDGET(p->first));
- if (orient == EWL_ORIENTATION_HORIZONTAL)
- p->grabber = EWL_BOX(ewl_hbox_new());
- else
- p->grabber = EWL_BOX(ewl_vbox_new());
+ p->grabber = ewl_vseparator_new();
ewl_container_child_append(EWL_CONTAINER(p), EWL_WIDGET(p->grabber));
ewl_callback_append(EWL_WIDGET(p->grabber), EWL_CALLBACK_MOUSE_DOWN,
@@ -98,23 +137,12 @@
p->active = EWL_POSITION_LEFT;
ewl_container_redirect_set(EWL_CONTAINER(p), EWL_CONTAINER(p->first));
- ewl_widget_appearance_set(w, "paned");
- ewl_widget_inherit(w, "paned");
ewl_widget_appearance_set(EWL_WIDGET(p->first), "first");
ewl_widget_appearance_set(EWL_WIDGET(p->second), "second");
- if (orient == EWL_ORIENTATION_HORIZONTAL) {
- ewl_widget_appearance_set(EWL_WIDGET(p->grabber),
- "grabber_horizontal");
- ewl_object_fill_policy_set(EWL_OBJECT(p),
- EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
-
- } else {
- ewl_widget_appearance_set(EWL_WIDGET(p->grabber),
- "grabber_vertical");
- ewl_object_fill_policy_set(EWL_OBJECT(p),
- EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL);
- }
+ // ewl_widget_appearance_set(EWL_WIDGET(p->grabber),
"grabber_horizontal");
+ ewl_object_fill_policy_set(EWL_OBJECT(p),
+ EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -227,6 +255,33 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+void
+ewl_paned_configure_cb(Ewl_Widget *w, void *ev __UNUSED__,
+ void *user_data __UNUSED__)
+{
+ Ewl_Orientation o;
+ Ewl_Paned *p = EWL_PANED(w);
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ /*
+ * Swap the orientation on the internal boxes if they are changed
+ */
+ o = ewl_box_orientation_get(EWL_BOX(p));
+ if (o == ewl_separator_orientation_get(EWL_SEPARATOR(p->grabber))) {
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ ewl_separator_orientation_set(EWL_SEPARATOR(p->grabber),
+ EWL_ORIENTATION_VERTICAL);
+ }
+ else {
+ ewl_separator_orientation_set(EWL_SEPARATOR(p->grabber),
+ EWL_ORIENTATION_HORIZONTAL);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
static void
ewl_paned_grabber_mouse_down_cb(Ewl_Widget *w, void *ev __UNUSED__,
void *user_data)
@@ -275,7 +330,7 @@
return;
mm = (Ewl_Event_Mouse_Move *)ev;
- if (p->orientation == EWL_ORIENTATION_HORIZONTAL) {
+ if (ewl_box_orientation_get(EWL_BOX(p)) == EWL_ORIENTATION_HORIZONTAL) {
int x = mm->x;
// ewl_object_x_request(EWL_OBJECT(p->grabber), x);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_paned.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_paned.h 10 Apr 2005 05:05:18 -0000 1.4
+++ ewl_paned.h 4 Oct 2005 05:23:26 -0000 1.5
@@ -32,27 +32,17 @@
{
Ewl_Box base;
Ewl_Box *first;
- Ewl_Box *grabber;
+ Ewl_Widget *grabber;
Ewl_Box *second;
Ewl_Position active;
Ewl_Orientation orientation;
int grabbed;
};
-/**
- * @def ewl_hpaned_new()
- * Shortcut to allocate a new horizontal Ewl_Paned
- */
-#define ewl_hpaned_new() ewl_paned_new(EWL_ORIENTATION_HORIZONTAL)
-
- /**
- * @def ewl_vpaned_new()
- * Shortcut to allocate a new vertial Ewl_Paned
- */
-#define ewl_vpaned_new() ewl_paned_new(EWL_ORIENTATION_VERTICAL)
-
-Ewl_Widget *ewl_paned_new(Ewl_Orientation orient);
-int ewl_paned_init(Ewl_Paned *p, Ewl_Orientation orient);
+Ewl_Widget *ewl_paned_new(void);
+Ewl_Widget *ewl_hpaned_new(void);
+Ewl_Widget *ewl_vpaned_new(void);
+int ewl_paned_init(Ewl_Paned *p);
void ewl_paned_active_set(Ewl_Paned *p, Ewl_Position pos);
Ewl_Position ewl_paned_active_get(Ewl_Paned *p);
@@ -62,6 +52,12 @@
void ewl_paned_second_pane_append(Ewl_Paned *p, Ewl_Widget
*w);
void ewl_paned_second_pane_prepend(Ewl_Paned *p, Ewl_Widget
*w);
+
+/*
+ * Internally used callbacks, override at your own risk.
+ */
+void ewl_paned_configure_cb(Ewl_Widget *w, void *ev, void
*user_data);
+
/**
* @}
*/
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_separator.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_separator.c 3 Oct 2005 06:43:07 -0000 1.4
+++ ewl_separator.c 4 Oct 2005 05:23:26 -0000 1.5
@@ -4,11 +4,10 @@
#include "ewl_private.h"
/**
- * @param o: the orientation of the newly allocated separator widget
* @return Returns pointer to new separator widget on success, NULL on failure.
* @brief Allocate a new separator widget
*/
-Ewl_Widget *ewl_separator_new(Ewl_Orientation o)
+Ewl_Widget *ewl_separator_new()
{
Ewl_Separator *s;
@@ -18,43 +17,68 @@
if (!s)
DRETURN_PTR(NULL, DLEVEL_STABLE);
- ewl_separator_init(s, o);
+ ewl_separator_init(s);
DRETURN_PTR(EWL_WIDGET(s), DLEVEL_STABLE);
}
/**
* @param s: the separator to initialize
- * @param o: the orientation of the separator to be initialized
- * @return Returns no value.
+ * @return Returns TRUE on success, FALSE on failure.
* @brief Initialize the separator and inherited fields
*
* Clears the contents of the separator and stores the
- * default values along with the orientation specified by @a o.
+ * default values.
*/
-void ewl_separator_init(Ewl_Separator * s, Ewl_Orientation o)
+int ewl_separator_init(Ewl_Separator * s)
{
Ewl_Widget *w;
DENTER_FUNCTION(DLEVEL_STABLE);
w = EWL_WIDGET(s);
- ewl_widget_init(w);
+ if (!ewl_widget_init(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+ ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
+ ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL);
+ ewl_widget_inherit(w, "separator");
+
+ ewl_object_alignment_set(EWL_OBJECT(s), EWL_FLAG_ALIGN_LEFT);
+
+ s->orientation = EWL_ORIENTATION_HORIZONTAL;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
+void
+ewl_separator_orientation_set(Ewl_Separator *s, Ewl_Orientation o)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ DCHECK_PARAM_PTR("s", s);
+
+ if (s->orientation == o)
+ DRETURN(DLEVEL_STABLE);
if (o == EWL_ORIENTATION_HORIZONTAL) {
ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL);
}
else {
- ewl_widget_appearance_set(w, "vseparator");
- ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_VFILL);
+ ewl_widget_appearance_set(EWL_WIDGET(s), "vseparator");
}
- ewl_widget_inherit(w, "separator");
-
- ewl_object_alignment_set(EWL_OBJECT(s), EWL_FLAG_ALIGN_LEFT);
- s->orientation = o;
+ ewl_widget_configure(EWL_WIDGET(s));
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+Ewl_Orientation
+ewl_separator_orientation_get(Ewl_Separator *s)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ DCHECK_PARAM_PTR_RET("s", s, EWL_ORIENTATION_HORIZONTAL);
+
+ DRETURN_INT(s->orientation, DLEVEL_STABLE);
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_separator.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_separator.h 17 Feb 2005 19:14:56 -0000 1.3
+++ ewl_separator.h 4 Oct 2005 05:23:26 -0000 1.4
@@ -52,8 +52,10 @@
*/
#define ewl_vseparator_new() ewl_separator_new(EWL_ORIENTATION_VERTICAL)
-Ewl_Widget *ewl_separator_new(Ewl_Orientation o);
-void ewl_separator_init(Ewl_Separator * s, Ewl_Orientation o);
+Ewl_Widget *ewl_separator_new();
+int ewl_separator_init(Ewl_Separator * s);
+void ewl_separator_orientation_set(Ewl_Separator *s,
Ewl_Orientation o);
+Ewl_Orientation ewl_separator_orientation_get(Ewl_Separator *s);
/**
* @}
-------------------------------------------------------
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