Enlightenment CVS committal
Author : moom
Project : e17
Module : proto
Dir : e17/proto/etk/src/lib
Modified Files:
etk_menu_item.c etk_notebook.c etk_notebook.h
Log Message:
* [Notebook] Commit back the changes of Lok to show/hide the tab bar.
The functions have been renamed to etk_notebook_tabs_visible_set/get().
Thanks to Lok :)
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_item.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- etk_menu_item.c 8 Aug 2006 00:57:33 -0000 1.17
+++ etk_menu_item.c 8 Aug 2006 16:33:00 -0000 1.18
@@ -1028,7 +1028,7 @@
* \par
* @prop_name "active" (only for Etk_Menu_Item_Check and Etk_Menu_Item_Radio):
* Whether or not the menu item is active (i.e. toggled)
- * @prop_type Etk_Bool
+ * @prop_type Boolean
* @prop_rw
* @prop_val ETK_FALSE
* \par
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_notebook.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- etk_notebook.c 8 Aug 2006 02:55:30 -0000 1.24
+++ etk_notebook.c 8 Aug 2006 16:33:01 -0000 1.25
@@ -18,8 +18,15 @@
ETK_NOTEBOOK_NUM_SIGNALS
};
+enum Etk_Notebook_Property_Id
+{
+ ETK_NOTEBOOK_TABS_VISIBLE_PROPERTY
+};
+
static void _etk_notebook_constructor(Etk_Notebook *notebook);
static void _etk_notebook_destructor(Etk_Notebook *notebook);
+static void _etk_notebook_property_set(Etk_Object *object, int property_id,
Etk_Property_Value *value);
+static void _etk_notebook_property_get(Etk_Object *object, int property_id,
Etk_Property_Value *value);
static void _etk_notebook_size_request(Etk_Widget *widget, Etk_Size *size);
static void _etk_notebook_size_allocate(Etk_Widget *widget, Etk_Geometry
geometry);
static void _etk_notebook_tab_bar_size_request(Etk_Widget *widget, Etk_Size
*size);
@@ -61,6 +68,12 @@
_etk_notebook_signals[ETK_NOTEBOOK_PAGE_CHANGED_SIGNAL] =
etk_signal_new("current_page_changed",
notebook_type, -1, etk_marshaller_VOID__VOID, NULL, NULL);
+
+ etk_type_property_add(notebook_type, "tabs_visible",
ETK_NOTEBOOK_TABS_VISIBLE_PROPERTY,
+ ETK_PROPERTY_BOOL, ETK_PROPERTY_READABLE_WRITABLE,
etk_property_value_bool(ETK_TRUE));
+
+ notebook_type->property_set = _etk_notebook_property_set;
+ notebook_type->property_get = _etk_notebook_property_get;
}
return notebook_type;
@@ -379,6 +392,46 @@
return etk_bin_child_get(ETK_BIN(page->frame));
}
+/**
+ * @brief Sets whethet the tab bar should be visible or not
+ * @param notebook a notebook
+ * @param tabs_visible if @a tabs_visible is ETK_FALSE, the tab bar will be
hidden
+ */
+void etk_notebook_tabs_visible_set(Etk_Notebook *notebook, Etk_Bool
tabs_visible)
+{
+ Evas_List *l;
+ Etk_Notebook_Page *page;
+
+ if (!notebook || notebook->tab_bar_visible == tabs_visible)
+ return;
+
+ if (tabs_visible)
+ etk_widget_show(notebook->tab_bar);
+ else
+ etk_widget_hide(notebook->tab_bar);
+
+ for (l = notebook->pages; l; l = l->next)
+ {
+ page = l->data;
+ etk_widget_theme_group_set(page->frame, tabs_visible ? "frame" : NULL);
+ }
+
+ notebook->tab_bar_visible = tabs_visible;
+ etk_object_notify(ETK_OBJECT(notebook), "tabs_visible");
+}
+
+/**
+ * @brief Gets whether the tab bar is visible or not
+ * @param notebook a notebook
+ * @return Returns ETK_TRUE if the tab bar is visible, ETK_FALSE otherwise
+ */
+Etk_Bool etk_notebook_tabs_visible_get(Etk_Notebook *notebook)
+{
+ if (!notebook)
+ return ETK_FALSE;
+ return notebook->tab_bar_visible;
+}
+
/**************************
*
* Etk specific functions
@@ -394,6 +447,7 @@
notebook->pages = NULL;
notebook->current_page = NULL;
notebook->tab_bar_focused = ETK_FALSE;
+ notebook->tab_bar_visible = ETK_TRUE;
_etk_notebook_tab_bar_create(notebook);
@@ -421,6 +475,42 @@
free(page);
}
}
+
+/* Sets the property whose id is "property_id" to the value "value" */
+static void _etk_notebook_property_set(Etk_Object *object, int property_id,
Etk_Property_Value *value)
+{
+ Etk_Notebook *notebook;
+
+ if (!(notebook = ETK_NOTEBOOK(object)) || !value)
+ return;
+
+ switch (property_id)
+ {
+ case ETK_NOTEBOOK_TABS_VISIBLE_PROPERTY:
+ etk_notebook_tabs_visible_set(notebook,
etk_property_value_bool_get(value));
+ break;
+ default:
+ break;
+ }
+}
+
+/* Gets the value of the property whose id is "property_id" */
+static void _etk_notebook_property_get(Etk_Object *object, int property_id,
Etk_Property_Value *value)
+{
+ Etk_Notebook *notebook;
+
+ if (!(notebook = ETK_NOTEBOOK(object)) || !value)
+ return;
+
+ switch (property_id)
+ {
+ case ETK_NOTEBOOK_TABS_VISIBLE_PROPERTY:
+ etk_property_value_bool_set(value, notebook->tab_bar_visible);
+ break;
+ default:
+ break;
+ }
+}
/* Calculates the ideal size of the notebook */
static void _etk_notebook_size_request(Etk_Widget *widget, Etk_Size *size)
@@ -711,7 +801,10 @@
etk_widget_show(new_page->tab);
etk_signal_connect("toggled", ETK_OBJECT(new_page->tab),
ETK_CALLBACK(_etk_notebook_tab_toggled_cb), notebook);
- new_page->frame = etk_widget_new(ETK_BIN_TYPE, "theme_group", "frame",
NULL);
+ if (notebook->tab_bar_visible)
+ new_page->frame = etk_widget_new(ETK_BIN_TYPE, "theme_group", "frame",
NULL);
+ else
+ new_page->frame = etk_widget_new(ETK_BIN_TYPE, NULL);
etk_widget_parent_set(new_page->frame, ETK_WIDGET(notebook));
etk_widget_visibility_locked_set(new_page->frame, ETK_TRUE);
etk_widget_hide(new_page->frame);
@@ -784,4 +877,10 @@
* @signal_cb void callback(Etk_Notebook *notebook, void *data)
* @signal_arg notebook: the notebook whose active page has been changed
* @signal_data
+ *
+ * \par Properties:
+ * @prop_name "tabs_visible": Whether the tab bar is visible or not
+ * @prop_type Boolean
+ * @prop_rw
+ * @prop_val ETK_TRUE
*/
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_notebook.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- etk_notebook.h 8 Aug 2006 02:55:30 -0000 1.16
+++ etk_notebook.h 8 Aug 2006 16:33:01 -0000 1.17
@@ -45,6 +45,7 @@
Etk_Widget *tab_bar;
Etk_Bool tab_bar_focused;
+ Etk_Bool tab_bar_visible;
Evas_List *pages;
Etk_Notebook_Page *current_page;
@@ -73,6 +74,9 @@
void etk_notebook_page_child_set(Etk_Notebook *notebook, int page_num,
Etk_Widget *child);
Etk_Widget *etk_notebook_page_child_get(Etk_Notebook *notebook, int page_num);
+
+void etk_notebook_tabs_visible_set(Etk_Notebook *notebook, Etk_Bool
tabs_visible);
+Etk_Bool etk_notebook_tabs_visible_get(Etk_Notebook *notebook);
/** @} */
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs