Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_box.c ewl_button.c ewl_button.h ewl_cell.c ewl_container.c
ewl_container.h ewl_embed.c ewl_embed.h ewl_entry.c
ewl_entry.h ewl_filedialog.h ewl_grid.c ewl_grid.h
ewl_menu_base.c ewl_menu_base.h ewl_notebook.c ewl_notebook.h
ewl_object.c ewl_object.h ewl_theme.c ewl_theme.h ewl_widget.c
ewl_widget.h
Log Message:
Changed some of the initialization functions to return status indicators.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_box.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- ewl_box.c 20 Nov 2003 00:41:41 -0000 1.59
+++ ewl_box.c 3 Jan 2004 21:23:11 -0000 1.60
@@ -105,12 +105,18 @@
/*
* Initialize the container portion of the box
*/
- if (o == EWL_ORIENTATION_HORIZONTAL)
- ewl_container_init(EWL_CONTAINER(b), "hbox", ewl_box_add_cb,
- ewl_box_child_resize_cb, ewl_box_remove_cb);
- else
- ewl_container_init(EWL_CONTAINER(b), "vbox", ewl_box_add_cb,
- ewl_box_child_resize_cb, ewl_box_remove_cb);
+ if (o == EWL_ORIENTATION_HORIZONTAL) {
+ if (!ewl_container_init(EWL_CONTAINER(b), "hbox",
+ ewl_box_add_cb, ewl_box_child_resize_cb,
+ ewl_box_remove_cb))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+ else {
+ if (!ewl_container_init(EWL_CONTAINER(b), "vbox",
+ ewl_box_add_cb, ewl_box_child_resize_cb,
+ ewl_box_remove_cb))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_box_configure_cb,
NULL);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_button.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- ewl_button.c 12 Nov 2003 20:07:17 -0000 1.51
+++ ewl_button.c 3 Jan 2004 21:23:11 -0000 1.52
@@ -28,29 +28,34 @@
*
* Initializes a button to default values and callbacks.
*/
-void ewl_button_init(Ewl_Button * b, char *label)
+int ewl_button_init(Ewl_Button * b, char *label)
{
Ewl_Widget *w;
DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET("b", b, 0);
w = EWL_WIDGET(b);
- ewl_box_init(EWL_BOX(b), EWL_ORIENTATION_HORIZONTAL);
+ if (!ewl_box_init(EWL_BOX(b), EWL_ORIENTATION_HORIZONTAL))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
ewl_widget_set_appearance(w, "button");
/*
* Create and setup the label for the button if it's desired.
*/
- if (label) {
+ if (label)
b->label_object = ewl_text_new(label);
+
+ if (b->label_object) {
ewl_object_set_alignment(EWL_OBJECT(b->label_object),
EWL_FLAG_ALIGN_CENTER);
ewl_container_append_child(EWL_CONTAINER(b), b->label_object);
ewl_widget_show(b->label_object);
}
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_button.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- ewl_button.h 10 Nov 2003 16:25:50 -0000 1.21
+++ ewl_button.h 3 Jan 2004 21:23:11 -0000 1.22
@@ -39,7 +39,7 @@
};
Ewl_Widget *ewl_button_new(char *l);
-void ewl_button_init(Ewl_Button * b, char *label);
+int ewl_button_init(Ewl_Button * b, char *label);
void ewl_button_set_label(Ewl_Button * b, char *l);
char *ewl_button_get_label(Ewl_Button *b);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_cell.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_cell.c 19 Nov 2003 20:18:34 -0000 1.10
+++ ewl_cell.c 3 Jan 2004 21:23:11 -0000 1.11
@@ -35,8 +35,9 @@
DCHECK_PARAM_PTR_RET("cell", cell, FALSE);
- ewl_container_init(EWL_CONTAINER(cell), "cell", ewl_cell_add_cb,
- ewl_cell_child_resize_cb, NULL);
+ if (!ewl_container_init(EWL_CONTAINER(cell), "cell", ewl_cell_add_cb,
+ ewl_cell_child_resize_cb, NULL))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_CONFIGURE,
ewl_cell_configure_cb, NULL);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- ewl_container.c 17 Dec 2003 02:18:37 -0000 1.56
+++ ewl_container.c 3 Jan 2004 21:23:11 -0000 1.57
@@ -7,27 +7,29 @@
* @param add: the function to call when children added to container
* @param remove: the function to call when children removed from container
* @param rs: the function to call when children of container are resized
- * @return Returns no value.
+ * @return Returns TRUE on success, otherwise FALSE.
* @brief Initialize a containers default fields and callbacks
*
* Initializes the default values of the container, this also sets up the
* widget fields of the container, so the @a appearance string is necessary.
*/
-void
+int
ewl_container_init(Ewl_Container * c, char *appearance, Ewl_Child_Add add,
Ewl_Child_Resize rs, Ewl_Child_Remove remove)
{
Ewl_Widget *w;
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("c", c);
+ DCHECK_PARAM_PTR_RET("c", c, FALSE);
w = EWL_WIDGET(c);
/*
* Initialize the fields inherited from the widget class
*/
- ewl_widget_init(w, appearance);
+ if (!ewl_widget_init(w, appearance))
+ DRETURN_INT(0, DLEVEL_STABLE);
+
ewl_object_set_recursive(EWL_OBJECT(w), TRUE);
/*
@@ -51,7 +53,7 @@
ewl_callback_append(w, EWL_CALLBACK_REPARENT,
ewl_container_reparent_cb, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(1, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_container.h 25 Nov 2003 07:47:29 -0000 1.28
+++ ewl_container.h 3 Jan 2004 21:23:11 -0000 1.29
@@ -59,7 +59,7 @@
Ewl_Container *redirect; /**< Non-internal widgets placed here */
};
-void ewl_container_init(Ewl_Container * widget, char *appearance,
+int ewl_container_init(Ewl_Container * widget, char *appearance,
Ewl_Child_Add add, Ewl_Child_Resize rs,
Ewl_Child_Remove remove);
void ewl_container_add_notify(Ewl_Container * container,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_embed.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_embed.c 8 Dec 2003 21:59:44 -0000 1.18
+++ ewl_embed.c 3 Jan 2004 21:23:11 -0000 1.19
@@ -81,9 +81,11 @@
/*
* Initialize the fields of the inherited container class
*/
- ewl_container_init(EWL_CONTAINER(w), "embed",
- ewl_embed_child_add_cb, ewl_embed_child_resize_cb,
- NULL);
+ if (!ewl_container_init(EWL_CONTAINER(w), "embed",
+ ewl_embed_child_add_cb,
+ ewl_embed_child_resize_cb, NULL))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
ewl_object_set_fill_policy(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
ewl_object_set_toplevel(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL);
@@ -103,6 +105,8 @@
ewd_list_append(ewl_embed_list, w);
+ w->tab_order = ewd_list_new();
+
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -269,6 +273,70 @@
DRETURN_PTR(EWL_EMBED(w), DLEVEL_STABLE);
}
+/**
+ * @param e: the embed that holds widgets to change tab order
+ * @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_push_tab_order(Ewl_Embed *e, Ewl_Widget *w)
+{
+ 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 (ewd_list_goto(e->tab_order, w))
+ ewd_list_remove(e->tab_order);
+
+ ewd_list_prepend(e->tab_order, w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param e: the embed containing a widget to remove from the tab order
+ * @param w: the widget to remove from the tab order list
+ * @return Returns no value.
+ * @brief Removes the widget @a w from the tab order list for @a e.
+ */
+void ewl_embed_remove_tab_order(Ewl_Embed *e, Ewl_Widget *w)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR("w", w);
+
+ if (ewd_list_goto(e->tab_order, w))
+ ewd_list_remove(e->tab_order);
+
+ 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_next_tab_order(Ewl_Embed *e)
+{
+ Ewl_Widget *w;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("e", e);
+
+ if (!(w = ewd_list_next(e->tab_order))) {
+ ewd_list_goto_first(e->tab_order);
+ w = ewd_list_next(e->tab_order);
+ }
+
+ if (w)
+ ewl_widget_send_focus(w);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
void ewl_embed_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data)
{
Ewl_Object *o;
@@ -323,6 +391,9 @@
if (ewd_list_goto(ewl_embed_list, w))
ewd_list_remove(ewl_embed_list);
+
+ ewd_list_destroy(emb->tab_order);
+ emb->tab_order = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_embed.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_embed.h 25 Nov 2003 07:47:29 -0000 1.10
+++ ewl_embed.h 3 Jan 2004 21:23:11 -0000 1.11
@@ -38,7 +38,8 @@
Evas *evas; /**< Evas where drawing takes place. */
Ecore_X_Window evas_window; /**< The window holding the evas. */
- Evas_Object *smart; /**< Object to manipulate Ewl_Embed from evas */
+ Evas_Object *smart; /**< Object to manipulate Ewl_Embed from evas */
+ Ewd_List *tab_order; /**< Order of widgets to send focus on tab */
};
Ewl_Widget *ewl_embed_new(void);
@@ -48,6 +49,9 @@
void ewl_embed_font_path_add(char *path);
Ewl_Embed *ewl_embed_find_by_evas_window(Ecore_X_Window win);
Ewl_Embed *ewl_embed_find_by_widget(Ewl_Widget * w);
+void ewl_embed_next_tab_order(Ewl_Embed *e);
+void ewl_embed_remove_tab_order(Ewl_Embed *e, Ewl_Widget *w);
+void ewl_embed_push_tab_order(Ewl_Embed *e, Ewl_Widget *w);
/*
* Internally used callbacks, override at your own risk.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- ewl_entry.c 7 Dec 2003 07:33:19 -0000 1.74
+++ ewl_entry.c 3 Jan 2004 21:23:11 -0000 1.75
@@ -24,22 +24,25 @@
/**
* @param e: the entry widget to initialize
* @param text: the initial text to display in the widget
- * @return Returns no value.
+ * @return Returns TRUE on success, FALSE on failure.
* @brief Initialize an entry widget to default values
*
* Initializes the entry widget @a e to it's default values and callbacks.
*/
-void ewl_entry_init(Ewl_Entry * e, char *text)
+int ewl_entry_init(Ewl_Entry * e, char *text)
{
Ewl_Widget *w;
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR_RET("e", e, FALSE);
w = EWL_WIDGET(e);
- ewl_container_init(EWL_CONTAINER(w), "entry", ewl_entry_child_add_cb,
- ewl_entry_child_resize_cb, NULL);
+ if (!ewl_container_init(EWL_CONTAINER(w), "entry",
+ ewl_entry_child_add_cb,
+ ewl_entry_child_resize_cb, NULL))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
ewl_object_set_fill_policy(EWL_OBJECT(w), EWL_FLAG_FILL_HSHRINK |
EWL_FLAG_FILL_HFILL);
ewl_container_intercept_callback(EWL_CONTAINER(w), EWL_CALLBACK_SELECT);
@@ -68,8 +71,9 @@
NULL);
ewl_entry_set_editable(e, TRUE);
+ ewl_widget_push_tab_order(EWL_WIDGET(e));
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_entry.h 19 Nov 2003 20:18:34 -0000 1.27
+++ ewl_entry.h 3 Jan 2004 21:23:11 -0000 1.28
@@ -41,7 +41,7 @@
};
Ewl_Widget *ewl_entry_new(char *text);
-void ewl_entry_init(Ewl_Entry * e, char *text);
+int ewl_entry_init(Ewl_Entry * e, char *text);
void ewl_entry_set_text(Ewl_Entry * e, char *t);
char *ewl_entry_get_text(Ewl_Entry * e);
void ewl_entry_set_editable(Ewl_Entry *e, unsigned int edit);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_filedialog.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ewl_filedialog.h 16 Dec 2003 00:09:18 -0000 1.7
+++ ewl_filedialog.h 3 Jan 2004 21:23:11 -0000 1.8
@@ -20,18 +20,17 @@
/**
* @struct Ewl_Filedialog
* Creates a floating widget with different filedialog components.
- *
*/
struct Ewl_Filedialog
{
- Ewl_Floater box; /* the box container */
- Ewl_Filedialog_Type type; /* define what type of filedialog */
+ Ewl_Floater box; /**< the box container */
+ Ewl_Filedialog_Type type; /**< define what type of filedialog */
- Ewl_Widget *selector; /* Ewl_Fileselector */
- Ewl_Widget *path_label; /* label to display current path */
- Ewl_Widget *entry; /* entry for manual input or current selected */
+ Ewl_Widget *selector; /**< Ewl_Fileselector */
+ Ewl_Widget *path_label; /**< label to display current path */
+ Ewl_Widget *entry; /**< entry for manual input or current selected */
- void *dialog; /* open or save dialog */
+ void *dialog; /**< open or save dialog */
};
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_grid.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_grid.c 2 Dec 2003 21:59:08 -0000 1.14
+++ ewl_grid.c 3 Jan 2004 21:23:11 -0000 1.15
@@ -34,16 +34,17 @@
* Returns no value. Responsible for setting up default values and
* callbacks within a grid structure
*/
-void ewl_grid_init(Ewl_Grid * g, int cols, int rows)
+int ewl_grid_init(Ewl_Grid * g, int cols, int rows)
{
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("g", g);
+ DCHECK_PARAM_PTR_RET("g", g, FALSE);
/*
* Initialize the grids inherited fields
*/
- ewl_container_init(EWL_CONTAINER(g), "vbox", ewl_grid_add_cb,
- ewl_grid_auto_resize_cb, NULL);
+ if (!ewl_container_init(EWL_CONTAINER(g), "vbox", ewl_grid_add_cb,
+ ewl_grid_auto_resize_cb, NULL))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
/*
* Initialize the lists that keep track of the
@@ -51,12 +52,12 @@
*/
g->col_size = NEW(Ewl_Grid_Info, cols);
if (!g->col_size)
- DRETURN(DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
g->row_size = NEW(Ewl_Grid_Info, rows);
if (!g->row_size) {
FREE(g->col_size);
- DRETURN(DLEVEL_STABLE);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
/*
@@ -75,7 +76,7 @@
ewl_callback_append(EWL_WIDGET(g), EWL_CALLBACK_CONFIGURE,
ewl_grid_configure_cb, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_grid.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_grid.h 19 Nov 2003 20:18:34 -0000 1.4
+++ ewl_grid.h 3 Jan 2004 21:23:11 -0000 1.5
@@ -40,7 +40,8 @@
typedef struct _ewl_grid_child Ewl_Grid_Child;
-struct _ewl_grid_child {
+struct _ewl_grid_child
+{
int start_col;
int start_row;
@@ -49,7 +50,7 @@
};
Ewl_Widget *ewl_grid_new(int cols, int rows);
-void ewl_grid_init(Ewl_Grid * g, int cols, int rows);
+int ewl_grid_init(Ewl_Grid * g, int cols, int rows);
void ewl_grid_add(Ewl_Grid * g, Ewl_Widget * w,
int start_col, int end_col, int start_row,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- ewl_menu_base.c 22 Dec 2003 06:04:57 -0000 1.21
+++ ewl_menu_base.c 3 Jan 2004 21:23:11 -0000 1.22
@@ -80,17 +80,19 @@
* Initializes a menu item to default values and adds the
* image pointed to by the path @a image, and adds the text in @a text.
*/
-void ewl_menu_item_init(Ewl_Menu_Item * item, char *image, char *text)
+int ewl_menu_item_init(Ewl_Menu_Item * item, char *image, char *text)
{
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("item", item);
+ DCHECK_PARAM_PTR_RET("item", item, FALSE);
/*
* Initialize the inherited container fields.
*/
- ewl_container_init(EWL_CONTAINER(item), "menuitem",
- ewl_menu_item_add_cb, ewl_menu_item_resize_cb, NULL);
+ if (!ewl_container_init(EWL_CONTAINER(item), "menuitem",
+ ewl_menu_item_add_cb, ewl_menu_item_resize_cb,
+ NULL))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
ewl_object_set_fill_policy(EWL_OBJECT(item), EWL_FLAG_FILL_HFILL);
ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CONFIGURE,
@@ -133,19 +135,25 @@
ewl_container_append_child(EWL_CONTAINER(item), item->icon);
ewl_widget_show(item->icon);
}
+ else
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
/*
* Create the text object for the menu item.
*/
- if (text) {
+ if (text)
item->text = ewl_text_new(text);
+
+ if (item->text) {
ewl_container_append_child(EWL_CONTAINER(item), item->text);
ewl_object_set_alignment(EWL_OBJECT(item->text),
EWL_FLAG_ALIGN_LEFT);
ewl_widget_show(item->text);
}
+ else
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_menu_base.h 22 Dec 2003 06:04:57 -0000 1.11
+++ ewl_menu_base.h 3 Jan 2004 21:23:11 -0000 1.12
@@ -76,7 +76,7 @@
};
Ewl_Widget *ewl_menu_item_new(char *image, char *title);
-void ewl_menu_item_init(Ewl_Menu_Item * menu, char *image,
+int ewl_menu_item_init(Ewl_Menu_Item * menu, char *image,
char *title);
Ewl_Menu_Separator *ewl_menu_separator_new(void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_notebook.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ewl_notebook.c 17 Dec 2003 19:22:03 -0000 1.41
+++ ewl_notebook.c 3 Jan 2004 21:23:11 -0000 1.42
@@ -26,12 +26,12 @@
*
* Returns no value. Sets the fields and callbacks of @n to their defaults.
*/
-void ewl_notebook_init(Ewl_Notebook * n)
+int ewl_notebook_init(Ewl_Notebook * n)
{
Ewl_Widget *w;
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("n", n);
+ DCHECK_PARAM_PTR_RET("n", n, FALSE);
w = EWL_WIDGET(n);
@@ -39,8 +39,10 @@
* Initialize the container portion of the notebook and set the fill
* policy to fill the area available.
*/
- ewl_container_init(EWL_CONTAINER(w), "tnotebook", ewl_notebook_add_cb,
- ewl_notebook_resize_cb, ewl_notebook_add_cb);
+ if (!ewl_container_init(EWL_CONTAINER(w), "tnotebook",
+ ewl_notebook_add_cb, ewl_notebook_resize_cb,
+ ewl_notebook_add_cb))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
ewl_object_set_fill_policy(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
@@ -54,12 +56,18 @@
* notebook.
*/
n->tab_box = ewl_hbox_new();
- ewl_widget_set_internal(n->tab_box, TRUE);
- ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box), EWL_FLAG_FILL_NONE);
- ewl_object_set_alignment(EWL_OBJECT(n->tab_box), EWL_FLAG_ALIGN_LEFT |
- EWL_FLAG_ALIGN_TOP);
- ewl_container_append_child(EWL_CONTAINER(n), n->tab_box);
- ewl_widget_show(n->tab_box);
+ if (n->tab_box) {
+ ewl_widget_set_internal(n->tab_box, TRUE);
+ ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box),
+ EWL_FLAG_FILL_NONE);
+ ewl_object_set_alignment(EWL_OBJECT(n->tab_box),
+ EWL_FLAG_ALIGN_LEFT |
+ EWL_FLAG_ALIGN_TOP);
+ ewl_container_append_child(EWL_CONTAINER(n), n->tab_box);
+ ewl_widget_show(n->tab_box);
+ }
+ else
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
/*
* Attach the necessary callbacks for the notebook
@@ -67,7 +75,7 @@
ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
ewl_notebook_configure_top_cb, NULL);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_notebook.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_notebook.h 25 Nov 2003 22:09:47 -0000 1.17
+++ ewl_notebook.h 3 Jan 2004 21:23:11 -0000 1.18
@@ -16,7 +16,7 @@
};
Ewl_Widget *ewl_notebook_new(void);
-void ewl_notebook_init(Ewl_Notebook * n);
+int ewl_notebook_init(Ewl_Notebook * n);
void ewl_notebook_append_page(Ewl_Notebook * n, Ewl_Widget * c,
Ewl_Widget * l);
void ewl_notebook_prepend_page(Ewl_Notebook * n, Ewl_Widget * c,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_object.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- ewl_object.c 20 Nov 2003 02:21:29 -0000 1.48
+++ ewl_object.c 3 Jan 2004 21:23:11 -0000 1.49
@@ -11,9 +11,10 @@
* widget instead. The separation is really just a convenience factor, a
* Widget really is the lowest common class.
*/
-void ewl_object_init(Ewl_Object * o)
+int ewl_object_init(Ewl_Object * o)
{
- DCHECK_PARAM_PTR("o", o);
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET("o", o, FALSE);
/*
* Set the default minimum sizes.
@@ -32,6 +33,8 @@
*/
o->flags = EWL_FLAG_FILL_NORMAL | EWL_FLAG_ALIGN_LEFT |
EWL_FLAG_ALIGN_TOP;
+
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_object.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- ewl_object.h 20 Oct 2003 15:42:57 -0000 1.38
+++ ewl_object.h 3 Jan 2004 21:23:11 -0000 1.39
@@ -91,7 +91,7 @@
unsigned int flags; /**< Bitmask indicating fill policy and alignment */
};
-void ewl_object_init(Ewl_Object * o);
+int ewl_object_init(Ewl_Object * o);
void ewl_object_get_current_geometry(Ewl_Object * o, int *x, int *y,
int *w, int *h);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ewl_theme.c 19 Nov 2003 20:18:36 -0000 1.49
+++ ewl_theme.c 3 Jan 2004 21:23:11 -0000 1.50
@@ -35,21 +35,25 @@
* Alloacte and clear the default theme
*/
def_theme_data = ewd_hash_new(ewd_str_hash, ewd_str_compare);
+ if (!def_theme_data)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
/*
* Setup a string with the path to the users theme dir
*/
theme_name = ewl_config_get_str("system", "/theme/name");
-
if (!theme_name)
theme_name = strdup("default");
+ if (!theme_name)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
home = getenv("HOME");
if (!home) {
DERROR("Environment variable HOME not defined\n"
"Try export HOME=/home/user in a bash like environemnt or\n"
"setenv HOME=/home/user in a csh like environment.\n");
- exit(-1);
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
snprintf(theme_path, PATH_MAX, "%s/.e/ewl/themes/%s", home, theme_name);
@@ -77,8 +81,8 @@
}
if (!theme_db) {
- DERROR("No theme db =( exiting....");
- exit(-1);
+ DERROR("No theme db =( ....");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
}
}
@@ -122,19 +126,19 @@
/**
* @param w: the widget to initialize theme information
- * @return Returns no value.
+ * @return Returns TRUE on success, FALSE on failure.
* @brief Initialize a widgets theme information to the default
*
* Sets the widget @a w's theme information to the default values.
*/
-void ewl_theme_init_widget(Ewl_Widget * w)
+int ewl_theme_init_widget(Ewl_Widget * w)
{
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR_RET("w", w, FALSE);
w->theme = def_theme_data;
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_theme.h 16 Oct 2003 20:54:25 -0000 1.18
+++ ewl_theme.h 3 Jan 2004 21:23:11 -0000 1.19
@@ -11,7 +11,7 @@
*/
int ewl_theme_init(void);
-void ewl_theme_init_widget(Ewl_Widget * w);
+int ewl_theme_init_widget(Ewl_Widget * w);
void ewl_theme_deinit_widget(Ewl_Widget * w);
char *ewl_theme_path(void);
Ewd_List *ewl_theme_font_path_get(void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -3 -r1.94 -r1.95
--- ewl_widget.c 10 Dec 2003 05:36:12 -0000 1.94
+++ ewl_widget.c 3 Jan 2004 21:23:11 -0000 1.95
@@ -1,4 +1,3 @@
-
#include <Ewl.h>
@@ -7,6 +6,7 @@
Ewl_Widget *last_focused = NULL;
Ewl_Widget *dnd_widget = NULL;
+static void ewl_widget_rebuild_appearance(Ewl_Widget *w);
static void ewl_widget_get_theme_padding(Ewl_Widget *w, int *l, int *r,
int *t, int *b);
static void ewl_widget_get_theme_insets(Ewl_Widget *w, int *l, int *r,
@@ -15,30 +15,30 @@
/**
* @param w: the widget to initialize
* @param appearance: the key for the widgets theme appearance
- *
- * @return No value.
+ * @return Returns TRUE on success, FALSE on failure.
* @brief Initialize a widget to default values and callbacks
*
* The widget w is initialized to default values and is
* assigned the default callbacks. The appearance key is assigned for easy
* access to theme information.
*/
-void ewl_widget_init(Ewl_Widget * w, char *appearance)
+int ewl_widget_init(Ewl_Widget * w, char *appearance)
{
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR("w", w);
-
- DCHECK_PARAM_PTR("appearance", appearance);
+ DCHECK_PARAM_PTR_RET("w", w, FALSE);
+ DCHECK_PARAM_PTR_RET("appearance", appearance, FALSE);
/*
* Set size fields on the object
*/
- ewl_object_init(EWL_OBJECT(w));
+ if (!ewl_object_init(EWL_OBJECT(w)))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
/*
* Set up the necessary theme structures
*/
- ewl_theme_init_widget(w);
+ if (!ewl_theme_init_widget(w))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
ewl_object_remove_state(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
LAYER(w) = 10;
@@ -75,7 +75,7 @@
ewl_widget_set_appearance(w, appearance);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -648,28 +648,25 @@
DRETURN_INT(sum, DLEVEL_STABLE);
}
-void ewl_widget_rebuild_appearance(Ewl_Widget *w)
+/**
+ * @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.
+ */
+void ewl_widget_push_tab_order(Ewl_Widget *w)
{
- char *base;
- char path[PATH_MAX];
+ Ewl_Embed *e;
- DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
- DCHECK_PARAM_PTR("w->appearance", w->appearance);
-
- base = strrchr(w->appearance, '/');
- if (base) {
- *base = '\0';
- base++;
- }
- else
- base = w->appearance;
-
- snprintf(path, PATH_MAX, "%s/%s",
- (w->parent ? w->parent->appearance : ""), base);
+ DENTER_FUNCTION(DLEVEL_STABLE);
- FREE(w->appearance);
- w->appearance = strdup(path);
+ e = ewl_embed_find_by_widget(w);
+ ewl_embed_push_tab_order(EWL_EMBED(e), w);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -809,6 +806,11 @@
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
+/**
+ * @param w: the widget to receive keyboard focus
+ * @return Returns no value.
+ * @brief Changes the keyboard focus to the widget @a w.
+ */
void ewl_widget_send_focus(Ewl_Widget *w)
{
DENTER_FUNCTION(DLEVEL_STABLE);
@@ -818,6 +820,10 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+/**
+ * @return Returns the currnetly focused widget.
+ * @brief Retrieve the currently focused widget.
+ */
Ewl_Widget *ewl_widget_get_focused()
{
DENTER_FUNCTION(DLEVEL_STABLE);
@@ -825,6 +831,32 @@
DRETURN_PTR(last_key, DLEVEL_STABLE);
}
+static void ewl_widget_rebuild_appearance(Ewl_Widget *w)
+{
+ char *base;
+ char path[PATH_MAX];
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR("w", w);
+ DCHECK_PARAM_PTR("w->appearance", w->appearance);
+
+ base = strrchr(w->appearance, '/');
+ if (base) {
+ *base = '\0';
+ base++;
+ }
+ else
+ base = w->appearance;
+
+ snprintf(path, PATH_MAX, "%s/%s",
+ (w->parent ? w->parent->appearance : ""), base);
+
+ FREE(w->appearance);
+ w->appearance = strdup(path);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
/*
* Perform the series of operations common to every widget when
* they are destroyed. This should ALWAYS be the the last callback
@@ -832,18 +864,12 @@
*/
void ewl_widget_destroy_cb(Ewl_Widget * w, void *ev_data, void *data)
{
- Ewl_Embed *emb;
Ewd_List *destroy_cbs;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
/*
- * First find it's parent embed so we can destroy the evas objects.
- */
- emb = ewl_embed_find_by_widget(w);
-
- /*
* First remove the parents reference to this widget to avoid bad
* references.
*/
@@ -1067,8 +1093,16 @@
*/
void ewl_widget_unrealize_cb(Ewl_Widget * w, void *ev_data, void *user_data)
{
+ Ewl_Embed *emb;
+
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
+
+ /*
+ * First find it's parent embed so we can destroy the evas objects.
+ */
+ emb = ewl_embed_find_by_widget(w);
+ ewl_embed_remove_tab_order(emb, w);
/*
* Destroy the clip box used for fx.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ewl_widget.h 8 Dec 2003 23:13:41 -0000 1.39
+++ ewl_widget.h 3 Jan 2004 21:23:11 -0000 1.40
@@ -46,7 +46,7 @@
/*
* Initialize a widget to it's default values
*/
-void ewl_widget_init(Ewl_Widget * w, char *appearance);
+int ewl_widget_init(Ewl_Widget * w, char *appearance);
/*
* Signal the widget that it's parent has changed.
@@ -136,7 +136,6 @@
/*
* Notify a widget to rebuild it's appearance string.
*/
-void ewl_widget_rebuild_appearance(Ewl_Widget *w);
void ewl_widget_print_tree(Ewl_Widget *w);
void ewl_widget_print(Ewl_Widget *w);
@@ -152,6 +151,7 @@
void ewl_widget_send_focus(Ewl_Widget *w);
Ewl_Widget *ewl_widget_get_focused(void);
+void ewl_widget_push_tab_order(Ewl_Widget *w);
/**
* @def LAYER(w)
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs