Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_colorpicker_vertical.c etk_combobox.c etk_dialog.h 
        etk_drag.h etk_image.c etk_label.c etk_label.h etk_menu.c 
        etk_menu.h etk_menu_bar.c etk_menu_bar.h etk_menu_item.h 
        etk_menu_shell.c etk_menu_shell.h etk_statusbar.c etk_tree.c 
        etk_types.h 


Log Message:
* [Menu_Shell] Add etk_menu_shell_prepend_relative(), 
etk_menu_shell_append_relative(), etk_menu_shell_insert() and 
etk_menu_shell_items_get() to the API.
* [Tree] Display a warning when the user tries to add a row when the tree is 
not built
* Documentation of these files:
  - etk_menu_bar.c/h
  - etk_menu.c/h
* Added a "TODO/FIXME" list at the beginning of several headers
* Formatting and small fixes
* Doxygen's warnings--


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_colorpicker_vertical.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- etk_colorpicker_vertical.c  15 Jan 2006 11:07:16 -0000      1.7
+++ etk_colorpicker_vertical.c  14 May 2006 21:29:22 -0000      1.8
@@ -569,3 +569,5 @@
    if (cpv->cursor)
       evas_object_image_size_set(cpv->cursor, cpv->map_width, 1);
 }
+
+/** @} */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_combobox.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- etk_combobox.c      14 May 2006 14:14:58 -0000      1.12
+++ etk_combobox.c      14 May 2006 21:29:22 -0000      1.13
@@ -191,7 +191,7 @@
       return;
    if (combobox->built)
    {
-      ETK_WARNING("The combobox shouldn't be already built when you add a new 
column");
+      ETK_WARNING("Unable to add a new column to the combobox because the 
combobox has been built");
       return;
    }
    
@@ -1186,7 +1186,7 @@
       return NULL;
    if (!combobox->built)
    {
-      ETK_WARNING("The combobox should be already built when you add a new 
item to it");
+      ETK_WARNING("Unable to add a new item to the combobox because 
etk_combobox_build() has not been called yet");
       return NULL;
    }
    
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_dialog.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- etk_dialog.h        12 May 2006 19:13:39 -0000      1.6
+++ etk_dialog.h        14 May 2006 21:29:22 -0000      1.7
@@ -5,6 +5,11 @@
 #include "etk_window.h"
 #include "etk_types.h"
 
+/* TODO/FIXME list:
+ * - We should certainly set some X hints to make the dialogs not simple 
windows anymore
+ * - Find a way to make modal dialogs
+ */
+
 /**
  * @defgroup Etk_Dialog Etk_Dialog
  * @brief A dialog is a window with buttons in its bottom area to allow the 
user to respond to a request
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_drag.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk_drag.h  16 Feb 2006 01:40:16 -0000      1.2
+++ etk_drag.h  14 May 2006 21:29:22 -0000      1.3
@@ -1,4 +1,4 @@
-/** @file etk_dnd.h */
+/** @file etk_drag.h */
 #ifndef _ETK_DRAG_H_
 #define _ETK_DRAG_H_
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_image.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- etk_image.c 12 May 2006 19:13:39 -0000      1.18
+++ etk_image.c 14 May 2006 21:29:22 -0000      1.19
@@ -31,7 +31,7 @@
 static void _etk_image_property_get(Etk_Object *object, int property_id, 
Etk_Property_Value *value);
 static void _etk_image_realize_cb(Etk_Object *object, void *data);
 static void _etk_image_unrealize_cb(Etk_Object *object, void *data);
-static void _etk_image_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition);
+static void _etk_image_size_request(Etk_Widget *widget, Etk_Size *size);
 static void _etk_image_size_allocate(Etk_Widget *widget, Etk_Geometry 
geometry);
 static void _etk_image_load(Etk_Image *image);
 
@@ -474,11 +474,11 @@
 }
 
 /* Calculates the ideal size of the image */
-static void _etk_image_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition)
+static void _etk_image_size_request(Etk_Widget *widget, Etk_Size *size)
 {
    Etk_Image *image;
 
-   if (!(image = ETK_IMAGE(widget)) || !size_requisition)
+   if (!(image = ETK_IMAGE(widget)) || !size)
       return;
 
    if (image->image_object)
@@ -489,16 +489,16 @@
 
          edje_object_size_min_get(image->image_object, &min_x, &min_y);
          edje_object_size_min_calc(image->image_object, &calc_x, &calc_y);
-         size_requisition->w = ETK_MAX(min_x, calc_x);
-         size_requisition->h = ETK_MAX(min_y, calc_y);
+         size->w = ETK_MAX(min_x, calc_x);
+         size->h = ETK_MAX(min_y, calc_y);
       }
       else
-         evas_object_image_size_get(image->image_object, &size_requisition->w, 
&size_requisition->h);
+         evas_object_image_size_get(image->image_object, &size->w, &size->h);
    }
    else
    {
-      size_requisition->w = 0;
-      size_requisition->h = 0;
+      size->w = 0;
+      size->h = 0;
    }
 }
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_label.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_label.c 12 May 2006 19:13:39 -0000      1.13
+++ etk_label.c 14 May 2006 21:29:22 -0000      1.14
@@ -351,6 +351,7 @@
 /**
  * @addtogroup Etk_Label
  *
+ * @image html label.png
  * You can use html-like tags to format the text of the label. For example, 
"<b>Text</b>" makes <b>Text</b> bold. @n
  * Here is the list of the supported tags: @n
  * TODO: [Doc] List of the tags for the label
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_label.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk_label.h 12 May 2006 19:13:39 -0000      1.2
+++ etk_label.h 14 May 2006 21:29:22 -0000      1.3
@@ -5,6 +5,13 @@
 #include <Evas.h>
 #include "etk_widget.h"
 
+/*
+ * TODO/FIXME list:
+ * - The style has to be defined by the theme
+ * - Fix bad size_request and bad rendering (evas_textblock bug?)
+ * - Document the different style tags
+ */
+
 /**
  * @defgroup Etk_Label Etk_Label
  * @brief The Etk_Label widget is a simple widget that can display text
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_menu.c  7 Apr 2006 15:36:11 -0000       1.13
+++ etk_menu.c  14 May 2006 21:29:22 -0000      1.14
@@ -12,7 +12,7 @@
  * @{
  */
 
-enum _Etk_Menu_Signal_Id
+enum Etk_Menu_Signal_Id
 {
    ETK_MENU_POPPED_DOWN_SIGNAL,
    ETK_MENU_POPPED_UP_SIGNAL,
@@ -21,7 +21,7 @@
 
 static void _etk_menu_constructor(Etk_Menu *menu);
 static void _etk_menu_destructor(Etk_Menu *menu);
-static void _etk_menu_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition);
+static void _etk_menu_size_request(Etk_Widget *widget, Etk_Size *size);
 static void _etk_menu_size_allocate(Etk_Widget *widget, Etk_Geometry geometry);
 static void _etk_menu_window_popped_up_cb(Etk_Object *object, void *data);
 static void _etk_menu_window_popped_down_cb(Etk_Object *object, void *data);
@@ -45,7 +45,7 @@
 
 /**
  * @brief Gets the type of an Etk_Menu
- * @return Returns the type on an Etk_Menu
+ * @return Returns the type of an Etk_Menu
  */
 Etk_Type *etk_menu_type_get()
 {
@@ -53,10 +53,13 @@
 
    if (!menu_type)
    {
-      menu_type = etk_type_new("Etk_Menu", ETK_MENU_SHELL_TYPE, 
sizeof(Etk_Menu), ETK_CONSTRUCTOR(_etk_menu_constructor), 
ETK_DESTRUCTOR(_etk_menu_destructor));
+      menu_type = etk_type_new("Etk_Menu", ETK_MENU_SHELL_TYPE, 
sizeof(Etk_Menu),
+         ETK_CONSTRUCTOR(_etk_menu_constructor), 
ETK_DESTRUCTOR(_etk_menu_destructor));
       
-      _etk_menu_signals[ETK_MENU_POPPED_UP_SIGNAL] = 
etk_signal_new("popped_up", menu_type, -1, etk_marshaller_VOID__VOID, NULL, 
NULL);
-      _etk_menu_signals[ETK_MENU_POPPED_DOWN_SIGNAL] = 
etk_signal_new("popped_down", menu_type, -1, etk_marshaller_VOID__VOID, NULL, 
NULL);
+      _etk_menu_signals[ETK_MENU_POPPED_UP_SIGNAL] = 
etk_signal_new("popped_up",
+         menu_type, -1, etk_marshaller_VOID__VOID, NULL, NULL);
+      _etk_menu_signals[ETK_MENU_POPPED_DOWN_SIGNAL] = 
etk_signal_new("popped_down",
+         menu_type, -1, etk_marshaller_VOID__VOID, NULL, NULL);
    }
 
    return menu_type;
@@ -72,10 +75,10 @@
 }
 
 /**
- * @brief Popups the menu at the position (x, y)
+ * @brief Pops up the menu at the position (x, y)
  * @param menu a menu
- * @param x the x component of the location where to popup the menu
- * @param y the y component of the location where to popup the menu
+ * @param x the x component of the position where to popup the menu
+ * @param y the y component of the position where to popup the menu
  */
 void etk_menu_popup_at_xy(Etk_Menu *menu, int x, int y)
 {
@@ -85,7 +88,7 @@
 }
 
 /**
- * @brief Popups the menu at the mouse pointer position
+ * @brief Pops up the menu at the mouse position
  * @param menu a menu
  */
 void etk_menu_popup(Etk_Menu *menu)
@@ -96,7 +99,7 @@
 }
 
 /**
- * @brief Pops down the menu and its children
+ * @brief Pops down the menu and all its submenus (menus attached to its items)
  * @param menu a menu
  */
 void etk_menu_popdown(Etk_Menu *menu)
@@ -112,7 +115,7 @@
  *
  **************************/
 
-/* Initializes the members */
+/* Initializes the menu */
 static void _etk_menu_constructor(Etk_Menu *menu)
 {
    if (!menu)
@@ -141,29 +144,29 @@
 }
 
 /* Calculates the ideal size of the menu */
-static void _etk_menu_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition)
+static void _etk_menu_size_request(Etk_Widget *widget, Etk_Size *size)
 {
    Evas_List *l;
    Etk_Menu_Shell *menu_shell;
    
-   if (!(menu_shell = ETK_MENU_SHELL(widget)) || !size_requisition)
+   if (!(menu_shell = ETK_MENU_SHELL(widget)) || !size)
       return;
    
-   size_requisition->w = 0;
-   size_requisition->h = 0;
+   size->w = 0;
+   size->h = 0;
    for (l = menu_shell->items; l; l = l->next)
    {
-      Etk_Size child_requisition;
+      Etk_Size child_size;
       
-      etk_widget_size_request(ETK_WIDGET(l->data), &child_requisition);
-      size_requisition->w = ETK_MAX(size_requisition->w, child_requisition.w);
-      size_requisition->h += child_requisition.h;
+      etk_widget_size_request(ETK_WIDGET(l->data), &child_size);
+      size->w = ETK_MAX(size->w, child_size.w);
+      size->h += child_size.h;
    }
-   /* TODO: Fixme: size request */
-   size_requisition->w += 15;
+   /* TODO: FIXME: incorrect calculated width */
+   size->w += 15;
 }
 
-/* Resizes the menu to the size allocation */
+/* Resizes the menu to the allocated size */
 static void _etk_menu_size_allocate(Etk_Widget *widget, Etk_Geometry geometry)
 {
    Etk_Geometry child_geometry;
@@ -195,23 +198,24 @@
       else
          etk_widget_theme_object_signal_emit(ETK_WIDGET(item), "arrow_hide");
       
-      etk_widget_theme_object_signal_emit(ETK_WIDGET(item), 
items_have_left_widget ? "left_widget_show" : "left_widget_hide");
+      etk_widget_theme_object_signal_emit(ETK_WIDGET(item),
+         items_have_left_widget ? "left_widget_show" : "left_widget_hide");
    }
    
    y_offset = geometry.y;
    child_geometry.x = geometry.x;
    for (l = menu_shell->items; l; l = l->next)
    {
-      Etk_Size child_requisition;
+      Etk_Size child_size;
       
       item = ETK_MENU_ITEM(l->data);
-      etk_widget_size_request(ETK_WIDGET(item), &child_requisition);
+      etk_widget_size_request(ETK_WIDGET(item), &child_size);
       child_geometry.y = y_offset;
       child_geometry.w = geometry.w;
-      child_geometry.h = child_requisition.h;
+      child_geometry.h = child_size.h;
       
       etk_widget_size_allocate(ETK_WIDGET(item), child_geometry);
-      y_offset += child_requisition.h;
+      y_offset += child_geometry.h;
    }
 }
 
@@ -255,36 +259,11 @@
 {
    Etk_Menu_Shell *menu_shell;
    Evas_Event_Key_Down *event;
-   //Evas_List *l;
    
    if (!(menu_shell = ETK_MENU_SHELL(data)) || !(event = event_info))
       return;
    
-   /*if (strcmp(event->keyname, "Down") == 0)
-   {
-      if (!menu_shell->items)
-         return;
-      if (!combobox->selected_item || !(l = 
evas_list_find_list(combobox->items, combobox->selected_item)) || !l->next)
-         _etk_combobox_selected_item_set(combobox, 
ETK_COMBOBOX_ITEM(combobox->items->data));
-      else
-         _etk_combobox_selected_item_set(combobox, 
ETK_COMBOBOX_ITEM(l->next->data));
-   }
-   else if (strcmp(event->keyname, "Up") == 0)
-   {
-      if (!combobox->items)
-         return;
-      if (!combobox->selected_item || !(l = 
evas_list_find_list(combobox->items, combobox->selected_item)) || !l->prev)
-         _etk_combobox_selected_item_set(combobox, 
ETK_COMBOBOX_ITEM(evas_list_last(combobox->items)->data));
-      else
-         _etk_combobox_selected_item_set(combobox, 
ETK_COMBOBOX_ITEM(l->prev->data));
-   }
-   else if (strcmp(event->keyname, "Return") == 0 || strcmp(event->keyname, 
"space") == 0 || strcmp(event->keyname, "KP_Enter") == 0)
-   {
-      if (combobox->selected_item)
-         etk_combobox_active_item_set(combobox, combobox->selected_item);
-   }
-   else if (strcmp(event->keyname, "Escape") == 0)
-      etk_popup_window_popdown(combobox->window);*/
+   /* TODO: keyboard navigation */
 }
 
 /* Called when an item is added to the menu */
@@ -393,3 +372,39 @@
 }
 
 /** @} */
+
+/**************************
+ *
+ * Documentation
+ *
+ **************************/
+
+/**
+ * @addtogroup Etk_Menu
+ *
+ * @image html menu.png
+ * The items of the menu are packed vertically. @n
+ * To add or remove items, you have to use the functions provided by the 
Etk_Menu_Shell:
+ * etk_menu_shell_append(), etk_menu_shell_remove(), ... @n @n
+ * A menu is usually popped up by clicking on an item of a menu bar, or by 
activating an item of another menu. @n
+ * You can also pop up a menu at the mouse position with etk_menu_popup() or 
at a specific position with
+ * etk_menu_popup_xy(). The menu could then be popped down with 
etk_menu_popdown().
+ * 
+ * 
+ * \par Object Hierarchy:
+ * - Etk_Object
+ *   - Etk_Widget
+ *     - Etk_Menu_Shell
+ *       - Etk_Menu
+ *
+ * \par Signals:
+ * @signal_name "popped_up": Emitted when the the menu has been popped up
+ * @signal_cb void callback(Etk_Menu *menu, void *data)
+ * @signal_arg menu: the menu that has been popped up
+ * @signal_data
+ * \par
+ * @signal_name "popped_down": Emitted when the the menu has been popped down
+ * @signal_cb void callback(Etk_Menu *menu, void *data)
+ * @signal_arg menu: the menu that has been popped down
+ * @signal_data
+ */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etk_menu.h  7 Apr 2006 15:36:11 -0000       1.5
+++ etk_menu.h  14 May 2006 21:29:22 -0000      1.6
@@ -5,23 +5,33 @@
 #include "etk_menu_shell.h"
 #include "etk_types.h"
 
+/* TODO/FIXME list:
+ * - Sometimes, when the menu is popped down, the window stay visible, but its 
content is hidden
+ * - The width of the menu window is not correctly calculated. Probably a bug 
of edje_object_size_min_calc().
+ * For now, 15 pixels are manually added to the calculated width
+ * - Keyboard navigation!
+ * - better theme grouping?
+ * - Sometimes the menu is not popped up at the right place (maybe a bug ot 
Etk_Popup_Window)
+ */
+
 /**
  * @defgroup Etk_Menu Etk_Menu
+ * @brief The Etk_Menu widget is a menu shell implemented in a popup window
  * @{
  */
 
-/** @brief Gets the type of a menu */
+/** Gets the type of a menu */
 #define ETK_MENU_TYPE       (etk_menu_type_get())
-/** @brief Casts the object to an Etk_Menu */
+/** Casts the object to an Etk_Menu */
 #define ETK_MENU(obj)       (ETK_OBJECT_CAST((obj), ETK_MENU_TYPE, Etk_Menu))
-/** @brief Check if the object is an Etk_Menu */
+/** Check if the object is an Etk_Menu */
 #define ETK_IS_MENU(obj)    (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_TYPE))
 
 /**
- * @struct Etk_Menu
- * @brief An Etk_Menu is a popup window containing several menu items
+ * @brief @widget The structure of a menu
+ * @structinfo
  */
-struct _Etk_Menu
+struct Etk_Menu
 {
    /* private: */
    /* Inherit from Etk_Menu_Shell */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_bar.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- etk_menu_bar.c      7 Apr 2006 15:36:11 -0000       1.4
+++ etk_menu_bar.c      14 May 2006 21:29:22 -0000      1.5
@@ -16,7 +16,7 @@
  */
 
 static void _etk_menu_bar_constructor(Etk_Menu_Bar *menu_bar);
-static void _etk_menu_bar_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition);
+static void _etk_menu_bar_size_request(Etk_Widget *widget, Etk_Size *size);
 static void _etk_menu_bar_size_allocate(Etk_Widget *widget, Etk_Geometry 
geometry);
 static void _etk_menu_bar_item_added_cb(Etk_Object *object, void *item, void 
*data);
 static void _etk_menu_bar_item_removed_cb(Etk_Object *object, void *item, void 
*data);
@@ -36,21 +36,24 @@
 
 /**
  * @brief Gets the type of an Etk_Menu_Bar
- * @return Returns the type on an Etk_Menu_Bar
+ * @return Returns the type of an Etk_Menu_Bar
  */
 Etk_Type *etk_menu_bar_type_get()
 {
    static Etk_Type *menu_bar_type = NULL;
 
    if (!menu_bar_type)
-      menu_bar_type = etk_type_new("Etk_Menu_Bar", ETK_MENU_SHELL_TYPE, 
sizeof(Etk_Menu_Bar), ETK_CONSTRUCTOR(_etk_menu_bar_constructor), NULL);
+   {
+      menu_bar_type = etk_type_new("Etk_Menu_Bar", ETK_MENU_SHELL_TYPE, 
sizeof(Etk_Menu_Bar),
+         ETK_CONSTRUCTOR(_etk_menu_bar_constructor), NULL);
+   }
 
    return menu_bar_type;
 }
 
 /**
- * @brief Creates a new menu_bar
- * @return Returns the new menu_bar widget
+ * @brief Creates a new menu bar
+ * @return Returns the new menu bar widget
  */
 Etk_Widget *etk_menu_bar_new()
 {
@@ -63,7 +66,7 @@
  *
  **************************/
 
-/* Initializes the members */
+/* Initializes the menu bar */
 static void _etk_menu_bar_constructor(Etk_Menu_Bar *menu_bar)
 {
    if (!menu_bar)
@@ -77,28 +80,28 @@
    etk_signal_connect("item_removed", ETK_OBJECT(menu_bar), 
ETK_CALLBACK(_etk_menu_bar_item_removed_cb), NULL);
 }
 
-/* Calculates the ideal size of the menu_bar */
-static void _etk_menu_bar_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition)
+/* Calculates the ideal size of the menu bar */
+static void _etk_menu_bar_size_request(Etk_Widget *widget, Etk_Size *size)
 {
    Evas_List *l;
    Etk_Menu_Shell *menu_shell;
    
-   if (!(menu_shell = ETK_MENU_SHELL(widget)) || !size_requisition)
+   if (!(menu_shell = ETK_MENU_SHELL(widget)) || !size)
       return;
    
-   size_requisition->w = 0;
-   size_requisition->h = 0;
+   size->w = 0;
+   size->h = 0;
    for (l = menu_shell->items; l; l = l->next)
    {
-      Etk_Size child_requisition;
+      Etk_Size child_size;
       
-      etk_widget_size_request(ETK_WIDGET(l->data), &child_requisition);
-      size_requisition->w += child_requisition.w;
-      size_requisition->h = ETK_MAX(size_requisition->h, child_requisition.h);
+      etk_widget_size_request(ETK_WIDGET(l->data), &child_size);
+      size->w += child_size.w;
+      size->h = ETK_MAX(size->h, child_size.h);
    }
 }
 
-/* Resizes the menu_bar to the size allocation */
+/* Resizes the menu bar to the allocated size */
 static void _etk_menu_bar_size_allocate(Etk_Widget *widget, Etk_Geometry 
geometry)
 {
    Etk_Geometry child_geometry;
@@ -113,15 +116,15 @@
    child_geometry.y = geometry.y;
    for (l = menu_shell->items; l; l = l->next)
    {
-      Etk_Size child_requisition;
+      Etk_Size child_size;
       
-      etk_widget_size_request(ETK_WIDGET(l->data), &child_requisition);
+      etk_widget_size_request(ETK_WIDGET(l->data), &child_size);
       child_geometry.x = x_offset;
-      child_geometry.w = child_requisition.w;
+      child_geometry.w = child_size.w;
       child_geometry.h = geometry.h;
       
       etk_widget_size_allocate(ETK_WIDGET(l->data), child_geometry);
-      x_offset += child_requisition.w;
+      x_offset += child_geometry.w;
    }
 }
 
@@ -173,8 +176,11 @@
    Evas_List *l;
    Etk_Widget *item;
    
-   if (!(menu_bar = ETK_MENU_BAR(data)) || !(toplevel = 
etk_widget_toplevel_parent_get(ETK_WIDGET(menu_bar))) || !(mouse_event = event))
+   if (!(menu_bar = ETK_MENU_BAR(data)) || !(toplevel = 
etk_widget_toplevel_parent_get(ETK_WIDGET(menu_bar))) ||
+      !(mouse_event = event))
+   {
       return 1;
+   }
    
    /* If the mouse pointer is above a menu item, we select it */
    etk_toplevel_widget_geometry_get(toplevel, &tx, &ty, NULL, NULL);
@@ -224,7 +230,10 @@
    }
    
    if (!_etk_menu_bar_mouse_move_handler)
-      _etk_menu_bar_mouse_move_handler = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, _etk_menu_bar_mouse_move_cb, 
menu_bar);
+   {
+      _etk_menu_bar_mouse_move_handler = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE,
+         _etk_menu_bar_mouse_move_cb, menu_bar);
+   }
    menu_bar->item_selected = ETK_TRUE;
 }
 
@@ -265,3 +274,25 @@
 }
 
 /** @} */
+
+/**************************
+ *
+ * Documentation
+ *
+ **************************/
+
+/**
+ * @addtogroup Etk_Menu_Bar
+ *
+ * @image html menu_bar.png
+ * The menu bar is a menu shell whose items are packed horizontally.
+ * A menu bar is usually packed at the top of a window. @n
+ * To add or remove items, you have to use the functions provided by the 
Etk_Menu_Shell:
+ * etk_menu_shell_append(), etk_menu_shell_remove(), ...
+ * 
+ * \par Object Hierarchy:
+ * - Etk_Object
+ *   - Etk_Widget
+ *     - Etk_Menu_Shell
+ *       - Etk_Menu_Bar
+ */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_bar.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk_menu_bar.h      12 May 2006 19:13:39 -0000      1.2
+++ etk_menu_bar.h      14 May 2006 21:29:22 -0000      1.3
@@ -5,6 +5,11 @@
 #include "etk_menu_shell.h"
 #include "etk_types.h"
 
+/* TODO/FIXME list:
+ * - Improve default theme
+ * - Add keyboard navigation
+ */
+
 /**
  * @defgroup Etk_Menu_Bar Etk_Menu_Bar
  * @brief A menu bar is an horizontal bar that can contain several menu items
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_item.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- etk_menu_item.h     4 Mar 2006 23:29:47 -0000       1.6
+++ etk_menu_item.h     14 May 2006 21:29:22 -0000      1.7
@@ -106,7 +106,7 @@
 };
 
 /**
- * @struct Etk_Menu_Item_Check
+ * @struct Etk_Menu_Item_Radio
  * @brief A menu item with a radiobox
  */
 struct _Etk_Menu_Item_Radio
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_shell.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etk_menu_shell.c    7 Apr 2006 15:36:11 -0000       1.5
+++ etk_menu_shell.c    14 May 2006 21:29:22 -0000      1.6
@@ -11,7 +11,7 @@
  * @{
  */
 
-enum _Etk_Menu_Shell_Signal_Id
+enum Etk_Menu_Shell_Signal_Id
 {
    ETK_MENU_SHELL_ITEM_ADDED_SIGNAL,
    ETK_MENU_SHELL_ITEM_REMOVED_SIGNAL,
@@ -32,7 +32,7 @@
 
 /**
  * @brief Gets the type of an Etk_Menu_Shell
- * @return Returns the type on an Etk_Menu_Shell
+ * @return Returns the type of an Etk_Menu_Shell
  */
 Etk_Type *etk_menu_shell_type_get()
 {
@@ -40,17 +40,20 @@
 
    if (!menu_shell_type)
    {
-      menu_shell_type = etk_type_new("Etk_Menu_Shell", ETK_WIDGET_TYPE, 
sizeof(Etk_Menu_Shell), ETK_CONSTRUCTOR(_etk_menu_shell_constructor), 
ETK_DESTRUCTOR(_etk_menu_shell_destructor));
+      menu_shell_type = etk_type_new("Etk_Menu_Shell", ETK_WIDGET_TYPE, 
sizeof(Etk_Menu_Shell),
+         ETK_CONSTRUCTOR(_etk_menu_shell_constructor), 
ETK_DESTRUCTOR(_etk_menu_shell_destructor));
    
-      _etk_menu_shell_signals[ETK_MENU_SHELL_ITEM_ADDED_SIGNAL] = 
etk_signal_new("item_added", menu_shell_type, -1, etk_marshaller_VOID__POINTER, 
NULL, NULL);
-      _etk_menu_shell_signals[ETK_MENU_SHELL_ITEM_REMOVED_SIGNAL] = 
etk_signal_new("item_removed", menu_shell_type, -1, 
etk_marshaller_VOID__POINTER, NULL, NULL);
+      _etk_menu_shell_signals[ETK_MENU_SHELL_ITEM_ADDED_SIGNAL] = 
etk_signal_new("item_added",
+         menu_shell_type, -1, etk_marshaller_VOID__POINTER, NULL, NULL);
+      _etk_menu_shell_signals[ETK_MENU_SHELL_ITEM_REMOVED_SIGNAL] = 
etk_signal_new("item_removed",
+         menu_shell_type, -1, etk_marshaller_VOID__POINTER, NULL, NULL);
    }
 
    return menu_shell_type;
 }
 
 /** 
- * @brief Adds a menu_shell item at the start of the menu shell
+ * @brief Adds a menu item at the start of the menu shell
  * @param menu_shell a menu shell
  * @param item the menu item to prepend to the menu shell
  */
@@ -60,13 +63,11 @@
       return;
    
    menu_shell->items = evas_list_prepend(menu_shell->items, item);
-   etk_widget_parent_set(ETK_WIDGET(item), ETK_WIDGET(menu_shell));
-   item->parent = menu_shell;
-   etk_signal_emit(_etk_menu_shell_signals[ETK_MENU_SHELL_ITEM_ADDED_SIGNAL], 
ETK_OBJECT(menu_shell), NULL, item);
+   _etk_menu_shell_item_add(menu_shell, item);
 }
 
 /** 
- * @brief Adds a menu_shell item at the end of the menu shell
+ * @brief Adds a menu item at the end of the menu shell
  * @param menu_shell a menu shell
  * @param item the menu item to append to the menu shell
  */
@@ -80,6 +81,65 @@
 }
 
 /**
+ * @brief Adds a menu item before an existing item of the menu shell
+ * @param menu_shell a menu shell
+ * @param item the menu item to add
+ * @param relative the item before which @a item will be added.
+ * If @a relative is not in the menu shell, @a item will be added at the start 
of the menu shell
+ */
+void etk_menu_shell_prepend_relative(Etk_Menu_Shell *menu_shell, Etk_Menu_Item 
*item, Etk_Menu_Item *relative)
+{
+   if (!menu_shell || !item)
+      return;
+   
+   menu_shell->items = evas_list_prepend_relative(menu_shell->items, item, 
relative);
+   _etk_menu_shell_item_add(menu_shell, item);
+}
+
+/**
+ * @brief Adds a menu item after an existing item of the menu shell
+ * @param menu_shell a menu shell
+ * @param item the menu item to add
+ * @param relative the item after which @a item will be added.
+ * If @a relative is not in the menu shell, @a item will be added at the end 
of the menu shell
+ */
+void etk_menu_shell_append_relative(Etk_Menu_Shell *menu_shell, Etk_Menu_Item 
*item, Etk_Menu_Item *relative)
+{
+   if (!menu_shell || !item)
+      return;
+   
+   menu_shell->items = evas_list_append_relative(menu_shell->items, item, 
relative);
+   _etk_menu_shell_item_add(menu_shell, item);
+}
+
+/**
+ * @brief Inserts a menu item to the menu shell at a specific position
+ * @param menu_shell a menu shell
+ * @param item the menu item to insert
+ * @param position the position where to insert the item (0 being the first). 
@n
+ * If @a position <= 0, the item will be prepended. @n
+ * If @a position >= the number of items of the menu shell, the item will be 
appended
+ */
+void etk_menu_shell_insert(Etk_Menu_Shell *menu_shell, Etk_Menu_Item *item, 
int position)
+{
+   if (!menu_shell || !item)
+      return;
+   
+   if (position <= 0)
+      menu_shell->items = evas_list_prepend(menu_shell->items, item);
+   else if (position >= evas_list_count(menu_shell->items))
+      menu_shell->items = evas_list_append(menu_shell->items, item);
+   else
+   {
+      void *rel;
+      
+      rel = evas_list_nth(menu_shell->items, position);
+      menu_shell->items = evas_list_prepend_relative(menu_shell->items, item, 
rel);
+   }
+   _etk_menu_shell_item_add(menu_shell, item);
+}
+
+/**
  * @brief Removes an item from the menu shell
  * @param menu_shell a menu shell
  * @param item the item to remove
@@ -101,6 +161,26 @@
    }
 }
 
+/**
+ * @brief Gets the list of the items of the menu shell
+ * @param menu_shell a menu shell
+ * @return Returns the list of the items of the menu shell.
+ * The returned list will have to be freed with evas_list_free()
+ */
+Evas_List *etk_menu_shell_items_get(Etk_Menu_Shell *menu_shell)
+{
+   Evas_List *list, *l;
+   
+   if (!menu_shell)
+      return NULL;
+   
+   list = NULL;
+   for (l = menu_shell->items; l; l = l->next)
+      list = evas_list_append(list, l->data);
+   
+   return list;
+}
+
 /**************************
  *
  * Etk specific functions
@@ -136,7 +216,25 @@
    etk_widget_parent_set(ETK_WIDGET(item), ETK_WIDGET(menu_shell));
    item->parent = menu_shell;
    etk_signal_emit(_etk_menu_shell_signals[ETK_MENU_SHELL_ITEM_ADDED_SIGNAL], 
ETK_OBJECT(menu_shell), NULL, item);
-   etk_widget_size_recalc_queue(ETK_WIDGET(menu_shell));
 }
 
 /** @} */
+
+/**************************
+ *
+ * Documentation
+ *
+ **************************/
+
+/**
+ * @addtogroup Etk_Menu_Shell
+ *
+ * New menu items can be added to the menu shell with etk_menu_shell_append(), 
etk_menu_shell_insert()... @n
+ * Menu items can be removed from the menu shell with etk_menu_shell_remove(). 
@n
+ * You can also get the list of the menu items of the menu shell with 
etk_menu_shell_items_get().
+ * 
+ * \par Object Hierarchy:
+ * - Etk_Object
+ *   - Etk_Widget
+ *     - Etk_Menu_Shell
+ */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_menu_shell.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etk_menu_shell.h    7 Apr 2006 15:36:11 -0000       1.5
+++ etk_menu_shell.h    14 May 2006 21:29:22 -0000      1.6
@@ -8,21 +8,22 @@
 
 /**
  * @defgroup Etk_Menu_Shell Etk_Menu_Shell
+ * @brief Etk_Menu_Shell is the base class used to derive Etk_Menu and 
Etk_Menu_Bar
  * @{
  */
 
-/** @brief Gets the type of a menu shell */
+/** Gets the type of a menu shell */
 #define ETK_MENU_SHELL_TYPE       (etk_menu_shell_type_get())
-/** @brief Casts the object to an Etk_Menu_Shell */
+/** Casts the object to an Etk_Menu_Shell */
 #define ETK_MENU_SHELL(obj)       (ETK_OBJECT_CAST((obj), ETK_MENU_SHELL_TYPE, 
Etk_Menu_Shell))
-/** @brief Check if the object is an Etk_Menu_Shell */
+/** Check if the object is an Etk_Menu_Shell */
 #define ETK_IS_MENU_SHELL(obj)    (ETK_OBJECT_CHECK_TYPE((obj), 
ETK_MENU_SHELL_TYPE))
 
 /**
- * @struct Etk_Menu_Shell
- * @brief Etk_Menu_Shell is the base class for Etk_Menu and Etk_Menu_Bar
-  */
-struct _Etk_Menu_Shell
+ * @brief @widget The structure of a menu shell
+ * @structinfo
+ */
+struct Etk_Menu_Shell
 {
    /* private: */
    /* Inherit from Etk_Widget */
@@ -36,7 +37,11 @@
 
 void etk_menu_shell_prepend(Etk_Menu_Shell *menu_shell, Etk_Menu_Item *item);
 void etk_menu_shell_append(Etk_Menu_Shell *menu_shell, Etk_Menu_Item *item);
+void etk_menu_shell_prepend_relative(Etk_Menu_Shell *menu_shell, Etk_Menu_Item 
*item, Etk_Menu_Item *relative);
+void etk_menu_shell_append_relative(Etk_Menu_Shell *menu_shell, Etk_Menu_Item 
*item, Etk_Menu_Item *relative);
+void etk_menu_shell_insert(Etk_Menu_Shell *menu_shell, Etk_Menu_Item *item, 
int position);
 void etk_menu_shell_remove(Etk_Menu_Shell *menu_shell, Etk_Menu_Item *item);
+Evas_List *etk_menu_shell_items_get(Etk_Menu_Shell *menu_shell);
 
 /** @} */
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_statusbar.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- etk_statusbar.c     4 Mar 2006 18:04:10 -0000       1.7
+++ etk_statusbar.c     14 May 2006 21:29:22 -0000      1.8
@@ -115,7 +115,7 @@
  * @brief Pushs on the statusbar message stack a new message
  * @param statusbar a statusbar
  * @param message the message to push
- * @param context id the context id to associate to the message. You can 
generate a context id with @a etk_statusbar_context_id_get()
+ * @param context_id the context id to associate to the message. You can 
generate a context id with @a etk_statusbar_context_id_get()
  * @return Returns the message id of the pushed message, or -1 on failure
  */
 int etk_statusbar_push(Etk_Statusbar *statusbar, const char *message, int 
context_id)
@@ -171,7 +171,7 @@
 /**
  * @brief Removes the message corresponding to the message id from the 
statusbar
  * @param statusbar a statusbar
- * @param message id the message id of the message, returned when you've 
pushed the message with @a etk_statusbar_push()
+ * @param message_id the message id of the message, returned when you've 
pushed the message with @a etk_statusbar_push()
  */
 void etk_statusbar_remove(Etk_Statusbar *statusbar, int message_id)
 {
@@ -197,7 +197,7 @@
 
 /**
  * @brief Sets whether the status bar has a resize grip
- * @param status bar a status bar
+ * @param statusbar a status bar
  * @param has_resize_grip @a has_resize_grip == ETK_TRUE if the statusbar 
should have a resize grip
  */
 void etk_statusbar_has_resize_grip_set(Etk_Statusbar *statusbar, Etk_Bool 
has_resize_grip)
@@ -212,7 +212,7 @@
 
 /**
  * @brief Gets whether the status bar has a resize grip
- * @param status bar a status bar
+ * @param statusbar a status bar
  * @return Returns ETK_TRUE if the statusbar has a resize grip
  */
 Etk_Bool etk_statusbar_has_resize_grip_get(Etk_Statusbar *statusbar)
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_tree.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- etk_tree.c  19 Apr 2006 21:52:36 -0000      1.63
+++ etk_tree.c  14 May 2006 21:29:22 -0000      1.64
@@ -583,8 +583,14 @@
  */
 void etk_tree_mode_set(Etk_Tree *tree, Etk_Tree_Mode mode)
 {
-   if (!tree || tree->built)
+   if (!tree)
+      return;
+   if (tree->built)
+   {
+      ETK_WARNING("Unable to change the mode of the tree because the tree has 
been built.");
       return;
+   }
+   
    tree->mode = mode;
    etk_object_notify(ETK_OBJECT(tree), "mode");
 }
@@ -755,7 +761,7 @@
    Etk_Tree_Row *new_row;
    va_list args;
 
-   if (!tree || !tree->built)
+   if (!tree)
       return NULL;
 
    va_start(args, tree);
@@ -776,8 +782,13 @@
    Etk_Tree_Row *new_row;
 
 
-   if (!tree || !tree->built)
+   if (!tree)
+      return NULL;
+   if (!tree->built)
+   {
+      ETK_WARNING("Unable to add a row to the tree because etk_tree_build() 
has not been called yet");
       return NULL;
+   }
 
    new_row = _etk_tree_row_new_valist(tree, &tree->root, args);
 
@@ -795,8 +806,19 @@
    Etk_Tree_Row *new_row;
    va_list args;
 
-   if (!row || !row->tree || !row->tree->built || (row->tree->mode != 
ETK_TREE_MODE_TREE))
+   if (!row || !row->tree)
+      return NULL;
+   if (row->tree->mode != ETK_TREE_MODE_TREE)
+   {
+      ETK_WARNING("Unable to add a row as a child of an existing row of "
+         "the tree because the mode of the tree is not ETK_TREE_MODE_TREE");
+      return NULL;
+   }
+   if (!row->tree->built)
+   {
+      ETK_WARNING("Unable to add a row to the tree because etk_tree_build() 
has not been called yet");
       return NULL;
+   }
 
    va_start(args, row);
    new_row = _etk_tree_row_new_valist(row->tree, row, args);
@@ -3029,3 +3051,5 @@
 {
    _etk_tree_drag_started = ETK_FALSE;
 }
+
+/** @} */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_types.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- etk_types.h 12 May 2006 19:13:39 -0000      1.38
+++ etk_types.h 14 May 2006 21:29:22 -0000      1.39
@@ -85,8 +85,8 @@
 typedef struct _Etk_HSeparator Etk_HSeparator;
 typedef struct _Etk_VSeparator Etk_VSeparator;
 typedef struct _Etk_Popup_Window Etk_Popup_Window;
-typedef struct _Etk_Menu_Shell Etk_Menu_Shell;
-typedef struct _Etk_Menu Etk_Menu;
+typedef struct Etk_Menu_Shell Etk_Menu_Shell;
+typedef struct Etk_Menu Etk_Menu;
 typedef struct Etk_Menu_Bar Etk_Menu_Bar;
 typedef struct _Etk_Menu_Item Etk_Menu_Item;
 typedef struct _Etk_Menu_Item_Separator Etk_Menu_Item_Separator;
@@ -124,5 +124,7 @@
 {
    int r, g, b, a;
 } Etk_Color;
+
+/** @} */
 
 #endif




-------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to