Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_notebook.c ewl_notebook.h 


Log Message:
Functions for switching the currently visible page in the notebook.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_notebook.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- ewl_notebook.c      12 Nov 2003 20:07:17 -0000      1.34
+++ ewl_notebook.c      13 Nov 2003 23:38:01 -0000      1.35
@@ -532,6 +532,70 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+/**
+ * @param n: the notebook to switch tabs
+ * @param t: the tab number to switch to
+ * @return Returns no value.
+ * @brief Switches to the tab number @a t in the notebook widget @a n.
+ *
+ * The notebook @a n switches to the tab number @a t where @a t is between 0
+ * and the number of widgets in the notebook.
+ */
+void ewl_notebook_set_visible_page(Ewl_Notebook *n, int t)
+{
+       int i = 0;
+       Ewl_Container *c;
+       Ewl_Widget *child = NULL;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       c = EWL_CONTAINER(n);
+
+       if (!ewd_list_nodes(c->children) || t > ewd_list_nodes(c->children))
+               DRETURN(DLEVEL_STABLE);
+
+       i = 0;
+       ewd_list_goto_first(c->children);
+       while (i != t && (child = ewd_list_next(c->children))) {
+               if (child != n->tab_box)
+                       i++;
+       }
+
+       if (child == n->visible_page)
+               DRETURN(DLEVEL_STABLE);
+
+       ewl_widget_hide(n->visible_page);
+       n->visible_page = child;
+       ewl_widget_show(child);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param n: the notebook to retrieve the current visible page number
+ * @return Returns the current page number on success.
+ * @brief Retrieves the position of the current page in the notebook @a n.
+ */
+int ewl_notebook_get_visible_page(Ewl_Notebook *n)
+{
+       int i = 0;
+       Ewl_Container *c;
+       Ewl_Widget *child = NULL;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       c = EWL_CONTAINER(n);
+
+       ewd_list_goto_first(c->children);
+       while (child != n->visible_page &&
+                       (child = ewd_list_next(c->children))) {
+               if (child != n->tab_box)
+                       i++;
+       }
+
+       DRETURN_INT(i, DLEVEL_STABLE);
+}
+
 void
 __ewl_notebook_configure_top(Ewl_Widget * w, void *ev_data, void *user_data)
 {
@@ -563,7 +627,8 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void __ewl_notebook_tabcb(Ewl_Widget *widget, void *ev_data, void *user_data) {
+void __ewl_notebook_tabcb(Ewl_Widget *widget, void *ev_data, void *user_data)
+{
        Ewl_Widget *page;
        Ewl_Notebook *nb;
        
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_notebook.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ewl_notebook.h      29 Sep 2003 21:46:50 -0000      1.13
+++ ewl_notebook.h      13 Nov 2003 23:38:01 -0000      1.14
@@ -39,4 +39,7 @@
 
 void            ewl_notebook_set_tabs_visible(Ewl_Notebook * n, int show);
 
+void            ewl_notebook_set_visible_page(Ewl_Notebook *n, int t);
+int             ewl_notebook_get_visible_page(Ewl_Notebook *n);
+
 #endif                         /* __EWL_NOTEBOOK_H__ */




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to