Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_alignment.c etk_box.c etk_box.h etk_button.h etk_canvas.c 
        etk_combobox.c etk_combobox.h 


Log Message:
* [Etk_Box]Remove etk_box_child_reorder() because the position number 
doesn't really make sense in a box. If you want to reorder the children, 
you can just repack them
* [Etk_Box]Implementation of etk_box_child_packing_set/get() to set/get 
the packing settings of a child of a box
* [Etk_Box]Fix the focus order
* [Etk_Combobox] Add etk_combobox_item_prepend/append_relative to the 
API, to add an item before/aftern an existing item
* [Etk_Combobox] The item height can now be defined by the theme. And 
also by the user with etk_combobox_item_height_set()
* Formatting and English fixes


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_alignment.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etk_alignment.c     12 May 2006 19:13:39 -0000      1.5
+++ etk_alignment.c     13 May 2006 23:44:40 -0000      1.6
@@ -214,7 +214,7 @@
    Etk_Alignment *alignment;
    Etk_Widget *child;
    Etk_Container *container;
-   Etk_Size child_requisition;
+   Etk_Size child_size;
 
    if (!(alignment = ETK_ALIGNMENT(widget)))
       return;
@@ -223,24 +223,24 @@
 
    if ((child = etk_bin_child_get(ETK_BIN(alignment))))
    {
-      etk_widget_size_request(child, &child_requisition);
+      etk_widget_size_request(child, &child_size);
 
       geometry.x += etk_container_border_width_get(container);
       geometry.y += etk_container_border_width_get(container);
       geometry.w -= 2 * etk_container_border_width_get(container);
       geometry.h -= 2 * etk_container_border_width_get(container);
 
-      if (geometry.w > child_requisition.w)
+      if (geometry.w > child_size.w)
       {
-         child_requisition.w += alignment->xscale * (geometry.w - 
child_requisition.w);
-         geometry.x += alignment->xalign * (geometry.w - child_requisition.w);
-         geometry.w = child_requisition.w;
+         child_size.w += alignment->xscale * (geometry.w - child_size.w);
+         geometry.x += alignment->xalign * (geometry.w - child_size.w);
+         geometry.w = child_size.w;
       }
-      if (geometry.h > child_requisition.h)
+      if (geometry.h > child_size.h)
       {
-         child_requisition.h += alignment->yscale * (geometry.h - 
child_requisition.h);
-         geometry.y += alignment->yalign * (geometry.h - child_requisition.h);
-         geometry.h = child_requisition.h;
+         child_size.h += alignment->yscale * (geometry.h - child_size.h);
+         geometry.y += alignment->yalign * (geometry.h - child_size.h);
+         geometry.h = child_size.h;
       }
 
       etk_widget_size_allocate(child, geometry);
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_box.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- etk_box.c   13 May 2006 12:04:00 -0000      1.11
+++ etk_box.c   13 May 2006 23:44:40 -0000      1.12
@@ -158,42 +158,85 @@
 }
 
 /**
- * @brief Moves the child to a new position in the box
+ * @brief Sets the packing settings of a child of the box
  * @param box a box
- * @param child the child to move
- * @param position the new position of the child
- */ 
-void etk_box_child_reorder(Etk_Box *box, Etk_Widget *child, int position)
+ * @param child a child of the box. If @a child is not packed in the box, this 
function has no effect
+ * @param padding the padding to set to the child. See etk_box_pack_start() 
for more information
+ * @param expand the expand setting to set to the child. See 
etk_box_pack_start() for more information
+ * @param fill the fill setting to set to the child. See etk_box_pack_start() 
for more information
+ * @param pack_end whether or not the child is packed at the end of the box.
+ * See etk_box_pack_start() for more information
+ * @see etk_box_pack_start()
+ */
+void etk_box_child_packing_set(Etk_Box *box, Etk_Widget *child, int padding, 
Etk_Bool expand, Etk_Bool fill, Etk_Bool pack_end)
 {
    Evas_List *l;
    Etk_Box_Cell *cell;
-   int i;
-
-   if (!box || !child || (child->parent != ETK_WIDGET(box)))
+   
+   if (!box || !child)
       return;
+   
+   for (l = box->cells; l; l = l->next)
+   {
+      cell = l->data;
+      
+      if (cell->child == child)
+      {
+         cell->padding = padding;
+         cell->expand = expand;
+         cell->fill = fill;
+         cell->pack_end = pack_end;
+         etk_widget_size_recalc_queue(ETK_WIDGET(box));
+         return;
+      }
+   }
+}
 
-   position = ETK_CLAMP(0, evas_list_count(box->cells) - 1, position);
-
-   for (l = box->cells, i = 0; l; l = l->next, i++)
+/**
+ * @brief Gets the packing settings of a child of the box
+ * @param box a box
+ * @param child a child of the box. It has to be packed in the box.
+ * @param padding the location to store the padding of the child. See 
etk_box_pack_start() for more information
+ * @param expand the location to store the expand setting of the child. See 
etk_box_pack_start() for more information
+ * @param fill the location to store the fill setting of the child. See 
etk_box_pack_start() for more information
+ * @param pack_end the location to store whether or not the child is packed at 
the end of the box.
+ * See etk_box_pack_start() for more information
+ * @see etk_box_pack_start()
+ */
+void etk_box_child_packing_get(Etk_Box *box, Etk_Widget *child, int *padding, 
Etk_Bool *expand, Etk_Bool *fill, Etk_Bool *pack_end)
+{
+   Evas_List *l;
+   Etk_Box_Cell *cell;
+   
+   if (!box || !child)
+      return;
+   
+   for (l = box->cells; l; l = l->next)
    {
       cell = l->data;
+      
       if (cell->child == child)
       {
-         if (i == position)
-            return;
-         else if (i < position)
-         {
-            box->cells = evas_list_append_relative(box->cells, cell, 
evas_list_nth(box->cells, position));
-            box->cells = evas_list_remove_list(box->cells, l);
-         }
-         else
-         {
-            box->cells = evas_list_prepend_relative(box->cells, cell, 
evas_list_nth(box->cells, position));
-            box->cells = evas_list_remove_list(box->cells, l);
-         }
+         if (padding)
+            *padding = cell->padding;
+         if (expand)
+            *expand = cell->expand;
+         if (fill)
+            *fill = cell->fill;
+         if (pack_end)
+            *pack_end = cell->pack_end;
          return;
       }
    }
+   
+   if (padding)
+      *padding = 0;
+   if (expand)
+      *expand = ETK_FALSE;
+   if (fill)
+      *fill = ETK_FALSE;
+   if (pack_end)
+      *pack_end = ETK_FALSE;
 }
 
 /**
@@ -791,8 +834,6 @@
 static void _etk_box_pack_full(Etk_Box *box, Etk_Widget *child, Etk_Bool 
expand, Etk_Bool fill, int padding, Etk_Bool pack_end)
 {
    Etk_Box_Cell *cell, *last_cell;
-   Evas_List *l;
-   Etk_Widget *w;
    
    if (!box || !child)
       return;
@@ -806,22 +847,14 @@
    
    /* Adds the child in the focus_order list, at the right place */
    last_cell = evas_list_data(evas_list_last(box->cells));
-   if (!last_cell)
+   if (!last_cell || !evas_list_find(ETK_WIDGET(box)->focus_order, 
last_cell->child))
       ETK_WIDGET(box)->focus_order = 
evas_list_append(ETK_WIDGET(box)->focus_order, child);
    else
    {
-      for (l = ETK_WIDGET(box)->focus_order; l; l = l->next)
-      {
-         w = ETK_WIDGET(l->data);
-         if (w == last_cell->child)
-         {
-            if (last_cell->pack_end)
-               ETK_WIDGET(box)->focus_order = 
evas_list_prepend_relative(ETK_WIDGET(box)->focus_order, child, l);
-            else
-               ETK_WIDGET(box)->focus_order = 
evas_list_append_relative(ETK_WIDGET(box)->focus_order, child, l);
-            break;
-         }
-      }
+      if (last_cell->pack_end)
+         ETK_WIDGET(box)->focus_order = 
evas_list_prepend_relative(ETK_WIDGET(box)->focus_order, child, 
last_cell->child);
+      else
+         ETK_WIDGET(box)->focus_order = 
evas_list_append_relative(ETK_WIDGET(box)->focus_order, child, 
last_cell->child);
    }
    
    box->cells = evas_list_append(box->cells, cell);
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_box.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- etk_box.h   12 May 2006 19:13:39 -0000      1.4
+++ etk_box.h   13 May 2006 23:44:40 -0000      1.5
@@ -81,11 +81,11 @@
 
 void etk_box_pack_start(Etk_Box *box, Etk_Widget *child, Etk_Bool expand, 
Etk_Bool fill, int padding);
 void etk_box_pack_end(Etk_Box *box, Etk_Widget *child, Etk_Bool expand, 
Etk_Bool fill, int padding);
-void etk_box_child_reorder(Etk_Box *box, Etk_Widget *child, int position);
+void etk_box_child_packing_set(Etk_Box *box, Etk_Widget *child, int padding, 
Etk_Bool expand, Etk_Bool fill, Etk_Bool pack_end);
+void etk_box_child_packing_get(Etk_Box *box, Etk_Widget *child, int *padding, 
Etk_Bool *expand, Etk_Bool *fill, Etk_Bool *pack_end);
 
 void etk_box_spacing_set(Etk_Box *box, int spacing);
 int etk_box_spacing_get(Etk_Box *box);
-
 void etk_box_homogeneous_set(Etk_Box *box, Etk_Bool homogeneous);
 Etk_Bool etk_box_homogeneous_get(Etk_Box *box);
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_button.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- etk_button.h        12 May 2006 19:13:39 -0000      1.4
+++ etk_button.h        13 May 2006 23:44:40 -0000      1.5
@@ -6,6 +6,10 @@
 #include "etk_types.h"
 #include "etk_stock.h"
 
+/* TODO/FIXME list:
+ * - For some reasons, sometimes the child is not "swallowed" (see Extrackt's 
combobox)
+ */
+
 /**
  * @defgroup Etk_Button Etk_Button
  * @brief The Etk_Button widget is a widget that emits a signal when it is 
pressed, released and clicked
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_canvas.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- etk_canvas.c        12 May 2006 19:13:39 -0000      1.9
+++ etk_canvas.c        13 May 2006 23:44:40 -0000      1.10
@@ -55,7 +55,7 @@
  * (probably because the canvas and the object do not belong to the same evas)
  * @note The object will be automatically deleted when the canvas is destroyed
  * @warning The object position remains relative to the window, and not to the 
canvas itself
- * (See the detailed description Etk_Canvas, at the top of this page, for more 
informations)
+ * (See the detailed description Etk_Canvas, at the top of this page, for more 
information)
  */
 Etk_Bool etk_canvas_object_add(Etk_Canvas *canvas, Evas_Object *object)
 {
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_combobox.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- etk_combobox.c      12 May 2006 19:13:39 -0000      1.10
+++ etk_combobox.c      13 May 2006 23:44:40 -0000      1.11
@@ -11,19 +11,22 @@
 #include "etk_signal.h"
 #include "etk_signal_callback.h"
 
+#define ETK_COMBOBOX_DEFAULT_ITEM_HEIGHT 24
+
 /**
  * @addtogroup Etk_Combobox
  * @{
  */
 
-enum _Etk_Combobox_Signal_Id
+enum Etk_Combobox_Signal_Id
 {
    ETK_COMBOBOX_ACTIVE_ITEM_CHANGED_SIGNAL,
    ETK_COMBOBOX_NUM_SIGNALS
 };
 
-enum _Etk_Combobox_Property_Id
+enum Etk_Combobox_Property_Id
 {
+   ETK_COMBOBOX_ITEM_HEIGHT_PROPERTY,
    ETK_COMBOBOX_ACTIVE_ITEM_PROPERTY
 };
 
@@ -32,15 +35,16 @@
 static void _etk_combobox_property_set(Etk_Object *object, int property_id, 
Etk_Property_Value *value);
 static void _etk_combobox_property_get(Etk_Object *object, int property_id, 
Etk_Property_Value *value);
 static void _etk_combobox_item_destructor(Etk_Combobox_Item *item);
-static void _etk_combobox_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition);
+static void _etk_combobox_size_request(Etk_Widget *widget, Etk_Size *size);
 static void _etk_combobox_size_allocate(Etk_Widget *widget, Etk_Geometry 
geometry);
-static void _etk_combobox_window_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition);
+static void _etk_combobox_window_size_request(Etk_Widget *widget, Etk_Size 
*size);
 static void _etk_combobox_window_size_allocate(Etk_Widget *widget, 
Etk_Geometry geometry);
 static void _etk_combobox_item_size_allocate(Etk_Widget *widget, Etk_Geometry 
geometry);
-static void _etk_combobox_active_item_size_request(Etk_Widget *widget, 
Etk_Size *size_requisition);
+static void _etk_combobox_active_item_size_request(Etk_Widget *widget, 
Etk_Size *size);
 static void _etk_combobox_active_item_size_allocate(Etk_Widget *widget, 
Etk_Geometry geometry);
 static void _etk_combobox_focus_handler(Etk_Widget *widget);
 static void _etk_combobox_unfocus_handler(Etk_Widget *widget);
+static void _etk_combobox_realize_cb(Etk_Object *object, void *data);
 static void _etk_combobox_key_down_cb(Etk_Object *object, void *event_info, 
void *data);
 static void _etk_combobox_button_toggled_cb(Etk_Object *object, void *data);
 static void _etk_combobox_window_popped_down_cb(Etk_Object *object, void 
*data);
@@ -75,6 +79,8 @@
       _etk_combobox_signals[ETK_COMBOBOX_ACTIVE_ITEM_CHANGED_SIGNAL] = 
etk_signal_new("active_item_changed",
          combobox_type, -1, etk_marshaller_VOID__VOID, NULL, NULL);
       
+      etk_type_property_add(combobox_type, "item_height", 
ETK_COMBOBOX_ITEM_HEIGHT_PROPERTY,
+         ETK_PROPERTY_INT, ETK_PROPERTY_READABLE_WRITABLE, 
etk_property_value_int(ETK_COMBOBOX_DEFAULT_ITEM_HEIGHT));
       etk_type_property_add(combobox_type, "active_item", 
ETK_COMBOBOX_ACTIVE_ITEM_PROPERTY,
          ETK_PROPERTY_POINTER, ETK_PROPERTY_READABLE_WRITABLE, 
etk_property_value_pointer(NULL));
       
@@ -128,6 +134,47 @@
 }
 
 /**
+ * @brief Set the height of the combobox's items. By default, it uses the 
height defined by the theme
+ * @param combobox a combobox
+ * @param item_height the height to set to the items of the combobox.
+ * If @a item_height <= 0, the default height defined by the theme will be used
+ */
+void etk_combobox_item_height_set(Etk_Combobox *combobox, int item_height)
+{
+   if (!combobox)
+      return;
+   
+   if (item_height > 0)
+   {
+      combobox->item_height = item_height;
+      combobox->item_height_set = ETK_TRUE;
+      etk_object_notify(ETK_OBJECT(combobox), "item_height");
+   }
+   else if (combobox->item_height_set)
+   {
+      if (etk_widget_theme_object_data_get(ETK_WIDGET(combobox), 
"item_height", "%d", &combobox->item_height) != 1 ||
+         combobox->item_height <= 0)
+      {
+         combobox->item_height = ETK_COMBOBOX_DEFAULT_ITEM_HEIGHT;
+      }
+      combobox->item_height_set = ETK_FALSE;
+      etk_object_notify(ETK_OBJECT(combobox), "item_height");
+   }
+}
+
+/**
+ * @brief Gets the height of the combobox's items
+ * @param combobox a combobox
+ * @return Returns the height of the combobox's items
+ */
+int etk_combobox_item_height_get(Etk_Combobox *combobox)
+{
+   if (!combobox)
+      return 0;
+   return combobox->item_height;
+}
+
+/**
  * @brief Adds a column to the combobox. The combobox should not be already be 
built
  * @param combobox a combobox
  * @param col_type the type of widget that will be packed in the column
@@ -299,7 +346,7 @@
  * If the type of a column is ETK_COMBOBOX_IMAGE, the argument must be an 
"Etk_Image *" @n
  * If the type of a column is ETK_COMBOBOX_OTHER, the argument must be an 
"Etk_Widget *"
  * @return Returns the new item
- * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show() on it. 
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show() 
  */
 Etk_Combobox_Item *etk_combobox_item_prepend(Etk_Combobox *combobox, ...)
 {
@@ -320,9 +367,9 @@
  * @brief Prepends a new item to the combobox
  * @param combobox a combobox
  * @param args the different widgets to attach to the columns of the item.
- * See: etk_combobox_item_prepend()'s ... argument for more informations
+ * See etk_combobox_item_prepend()'s "..." argument for more information
  * @return Returns the new item
- * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show() on it.
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
  * @see etk_combobox_item_prepend
  */
 Etk_Combobox_Item *etk_combobox_item_prepend_valist(Etk_Combobox *combobox, 
va_list args)
@@ -347,9 +394,9 @@
  * @brief Appends a new item to the combobox
  * @param combobox a combobox
  * @param ... the different widgets to attach to the columns of the item.
- * See: etk_combobox_item_prepend()'s ... argument for more informations
+ * See etk_combobox_item_prepend()'s "..." argument for more information
  * @return Returns the new item
- * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show() on it.
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
  * @see etk_combobox_item_prepend
  */
 Etk_Combobox_Item *etk_combobox_item_append(Etk_Combobox *combobox, ...)
@@ -371,9 +418,9 @@
  * @brief Appends a new item to the combobox
  * @param combobox a combobox
  * @param args the different widgets to attach to the columns of the item.
- * See: etk_combobox_item_prepend()'s ... argument for more informations
+ * See etk_combobox_item_prepend()'s "..." argument for more information
  * @return Returns the new item
- * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show() on it.
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
  * @see etk_combobox_item_prepend
  */
 Etk_Combobox_Item *etk_combobox_item_append_valist(Etk_Combobox *combobox, 
va_list args)
@@ -395,6 +442,116 @@
 }
 
 /**
+ * @brief Adds a new item to the combobox, before an existing item
+ * @param combobox a combobox
+ * @param relative the item before which the new item will be added.
+ * If @a relative is not in the combobox, the new item is prepended to the 
start of the combobox
+ * @param ... the different widgets to attach to the columns of the item.
+ * See etk_combobox_item_prepend()'s "..." argument for more information
+ * @return Returns the new item
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
+ * @see etk_combobox_item_prepend
+ */
+Etk_Combobox_Item *etk_combobox_item_prepend_relative(Etk_Combobox *combobox, 
Etk_Combobox_Item *relative, ...)
+{
+   Etk_Combobox_Item *item;
+   va_list args;
+   
+   if (!combobox)
+      return NULL;
+   
+   va_start(args, relative);
+   item = etk_combobox_item_prepend_relative_valist(combobox, relative, args);
+   va_end(args);
+   
+   return item;
+}
+
+/**
+ * @brief Adds a new item to the combobox, before an existing item
+ * @param combobox a combobox
+ * @param relative the item before which the new item will be added.
+ * If @a relative is not in the combobox, the new item is prepended to the 
start of the combobox
+ * @param args the different widgets to attach to the columns of the item.
+ * See etk_combobox_item_prepend()'s "..." argument for more information
+ * @return Returns the new item
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
+ * @see etk_combobox_item_prepend
+ */
+Etk_Combobox_Item *etk_combobox_item_prepend_relative_valist(Etk_Combobox 
*combobox, Etk_Combobox_Item *relative, va_list args)
+{
+   Etk_Combobox_Item *item;
+   va_list args2;
+   
+   if (!combobox)
+      return NULL;
+   
+   va_copy(args2, args);
+   item = _etk_combobox_item_new_valist(combobox, args2);
+   va_end(args2);
+   
+   if (item)
+      combobox->items = evas_list_prepend_relative(combobox->items, item, 
relative);
+   
+   return item;
+}
+
+/**
+ * @brief Adds a new item to the combobox, after an existing item
+ * @param combobox a combobox
+ * @param relative the item after which the new item will be added.
+ * If @a relative is not in the combobox, the new item is appended to the end 
of the combobox
+ * @param ... the different widgets to attach to the columns of the item.
+ * See etk_combobox_item_prepend()'s "..." argument for more information
+ * @return Returns the new item
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
+ * @see etk_combobox_item_prepend()
+ */
+Etk_Combobox_Item *etk_combobox_item_append_relative(Etk_Combobox *combobox, 
Etk_Combobox_Item *relative, ...)
+{
+   Etk_Combobox_Item *item;
+   va_list args;
+   
+   if (!combobox)
+      return NULL;
+   
+   va_start(args, relative);
+   item = etk_combobox_item_append_relative_valist(combobox, relative, args);
+   va_end(args);
+   
+   return item;
+}
+
+/**
+ * @brief Adds a new item to the combobox, after an existing item
+ * @param combobox a combobox
+ * @param relative the item after which the new item will be added.
+ * If @a relative is not in the combobox, the new item is appended to the end 
of the combobox
+ * @param args the different widgets to attach to the columns of the item.
+ * See etk_combobox_item_prepend()'s "..." argument for more information
+ * @return Returns the new item
+ * @note Unlike other widgets, the new item will be automatically shown, so 
you won't have to call etk_widget_show()
+ * @see etk_combobox_item_prepend
+ */
+Etk_Combobox_Item *etk_combobox_item_append_relative_valist(Etk_Combobox 
*combobox, Etk_Combobox_Item *relative, va_list args)
+{
+   Etk_Combobox_Item *item;
+   va_list args2;
+   
+   if (!combobox)
+      return NULL;
+   
+   va_copy(args2, args);
+   item = _etk_combobox_item_new_valist(combobox, args2);
+   va_end(args2);
+   
+   if (item)
+      combobox->items = evas_list_append_relative(combobox->items, item, 
relative);
+   
+   return item;
+}
+
+/**
  * @brief Removes an item from the combobox
  * @param combobox a combobox
  * @param item the item to remove
@@ -517,7 +674,8 @@
    combobox->num_cols = 0;
    combobox->cols = NULL;
    combobox->items = NULL;
-   combobox->item_height = 24;
+   combobox->item_height = ETK_COMBOBOX_DEFAULT_ITEM_HEIGHT;
+   combobox->item_height_set = ETK_FALSE;
    combobox->built = ETK_FALSE;
    
    ETK_WIDGET(combobox)->focus = _etk_combobox_focus_handler;
@@ -525,6 +683,7 @@
    ETK_WIDGET(combobox)->size_request = _etk_combobox_size_request;
    ETK_WIDGET(combobox)->size_allocate = _etk_combobox_size_allocate;
    
+   etk_signal_connect("realize", ETK_OBJECT(combobox), 
ETK_CALLBACK(_etk_combobox_realize_cb), NULL);
    etk_signal_connect("key_down", ETK_OBJECT(combobox), 
ETK_CALLBACK(_etk_combobox_key_down_cb), NULL);
 }
 
@@ -559,6 +718,9 @@
 
    switch (property_id)
    {
+      case ETK_COMBOBOX_ITEM_HEIGHT_PROPERTY:
+         etk_combobox_item_height_set(combobox, 
etk_property_value_int_get(value));
+         break;
       case ETK_COMBOBOX_ACTIVE_ITEM_PROPERTY:
          etk_combobox_active_item_set(combobox, 
ETK_COMBOBOX_ITEM(etk_property_value_pointer_get(value)));
          break;
@@ -577,6 +739,9 @@
    
    switch (property_id)
    {
+      case ETK_COMBOBOX_ITEM_HEIGHT_PROPERTY:
+         etk_property_value_int_set(value, combobox->item_height);
+         break;
       case ETK_COMBOBOX_ACTIVE_ITEM_PROPERTY:
          etk_property_value_pointer_set(value, combobox->active_item);
          break;
@@ -620,13 +785,13 @@
 }
 
 /* Calculates the ideal size of the combobox */
-static void _etk_combobox_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition)
+static void _etk_combobox_size_request(Etk_Widget *widget, Etk_Size *size)
 {
    Etk_Combobox *combobox;
    
-   if (!(combobox = ETK_COMBOBOX(widget)) || !size_requisition)
+   if (!(combobox = ETK_COMBOBOX(widget)) || !size)
       return;
-   etk_widget_size_request(combobox->button, size_requisition);
+   etk_widget_size_request(combobox->button, size);
 }
 
 /* Resizes the combobox to the allocated geometry */
@@ -640,21 +805,21 @@
 }
 
 /* Calculates the ideal size of the combobox window */
-static void _etk_combobox_window_size_request(Etk_Widget *widget, Etk_Size 
*size_requisition)
+static void _etk_combobox_window_size_request(Etk_Widget *widget, Etk_Size 
*size)
 {
    Etk_Combobox *combobox;
    int i;
    
-   if (!widget || !size_requisition)
+   if (!widget || !size)
       return;
    if (!(combobox = ETK_COMBOBOX(etk_object_data_get(ETK_OBJECT(widget), 
"_Etk_Combobox_Window::Combobox"))))
       return;
    
-   size_requisition->w = 0;
+   size->w = 0;
    for (i = 0; i < combobox->num_cols; i++)
-      size_requisition->w += combobox->cols[i]->size;
+      size->w += combobox->cols[i]->size;
    
-   size_requisition->h = evas_list_count(combobox->items) * 
combobox->item_height;
+   size->h = evas_list_count(combobox->items) * combobox->item_height;
 }
 
 /* Resizes the combobox window to the allocated geometry */
@@ -734,22 +899,24 @@
 }
 
 /* Calculates the ideal size of the active item of the combobox (the item in 
the combobox button */
-static void _etk_combobox_active_item_size_request(Etk_Widget *widget, 
Etk_Size *size_requisition)
+static void _etk_combobox_active_item_size_request(Etk_Widget *widget, 
Etk_Size *size)
 {
    Etk_Combobox *combobox;
    int i;
    
-   if (!widget || !size_requisition)
+   if (!widget || !size)
       return;
    if (!(combobox = ETK_COMBOBOX(etk_object_data_get(ETK_OBJECT(widget), 
"_Etk_Combobox_Window::Combobox"))))
       return;
    
-   size_requisition->w = 0;
-   size_requisition->h = 0;
+   size->w = 0;
+   /* TODO: active_item_size_request: height */
+   /* size->h = combobox->item_height; */
+   size->h = 0;
    for (i = 0; i < combobox->num_cols; i++)
    {
       if (combobox->cols[i]->type != ETK_COMBOBOX_OTHER)
-         size_requisition->w += combobox->cols[i]->size;
+         size->w += combobox->cols[i]->size;
    }
 }
 
@@ -849,6 +1016,25 @@
    etk_widget_theme_object_signal_emit(combobox->button, "unfocus");
 }
 
+/* Called when the combobox is realized */
+static void _etk_combobox_realize_cb(Etk_Object *object, void *data)
+{
+   Etk_Combobox *combobox;
+   
+   if (!(combobox = ETK_COMBOBOX(object)))
+      return;
+   
+   if (!combobox->item_height_set)
+   {
+      if (etk_widget_theme_object_data_get(ETK_WIDGET(combobox), 
"item_height", "%d", &combobox->item_height) != 1 ||
+         combobox->item_height <= 0)
+      {
+         combobox->item_height = ETK_COMBOBOX_DEFAULT_ITEM_HEIGHT;
+      }
+      etk_object_notify(ETK_OBJECT(combobox), "item_height");
+   }
+}
+
 /* Called when a key is pressed on the combobox */
 static void _etk_combobox_key_down_cb(Etk_Object *object, void *event_info, 
void *data)
 {
@@ -1097,6 +1283,11 @@
  * @signal_data
  *
  * \par Properties:
+ * @prop_name "item_height": The height of an item of the combobox (should be 
> 0)
+ * @prop_type Integer
+ * @prop_rw
+ * @prop_val 24
+ * \par
  * @prop_name "active_item": The active item of the combobox (the item 
displayed in the combobox button)
  * @prop_type Pointer (Etk_Combobox_Item *)
  * @prop_rw
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_combobox.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- etk_combobox.h      12 May 2006 19:13:39 -0000      1.7
+++ etk_combobox.h      13 May 2006 23:44:40 -0000      1.8
@@ -7,6 +7,12 @@
 #include <Evas.h>
 #include "etk_types.h"
 
+/* TODO/FIXME list:
+ * - Combobox item separator!
+ * - Bug in the default theme: when you press the combobox button, and you 
release it with the mouse out of it,
+ * the button looks pressed.
+ */
+
 /**
  * @defgroup Etk_Combobox Etk_Combobox
  * @brief The Etk_Combobox widget is made up of a button that shows a popup 
menu when it is clicked,
@@ -92,6 +98,7 @@
    
    Evas_List *items;
    int item_height;
+   Etk_Bool item_height_set;
    
    Etk_Bool built;
 };
@@ -102,6 +109,9 @@
 Etk_Widget *etk_combobox_new();
 Etk_Widget *etk_combobox_new_default();
 
+void etk_combobox_item_height_set(Etk_Combobox *combobox, int item_height);
+int etk_combobox_item_height_get(Etk_Combobox *combobox);
+
 void etk_combobox_column_add(Etk_Combobox *combobox, Etk_Combobox_Column_Type 
col_type, int size, Etk_Bool expand, Etk_Bool hfill, Etk_Bool vfill, float 
xalign, float yalign);
 void etk_combobox_build(Etk_Combobox *combobox);
 
@@ -113,6 +123,11 @@
 Etk_Combobox_Item *etk_combobox_item_prepend_valist(Etk_Combobox *combobox, 
va_list args);
 Etk_Combobox_Item *etk_combobox_item_append(Etk_Combobox *combobox, ...);
 Etk_Combobox_Item *etk_combobox_item_append_valist(Etk_Combobox *combobox, 
va_list args);
+
+Etk_Combobox_Item *etk_combobox_item_prepend_relative(Etk_Combobox *combobox, 
Etk_Combobox_Item *relative, ...);
+Etk_Combobox_Item *etk_combobox_item_prepend_relative_valist(Etk_Combobox 
*combobox, Etk_Combobox_Item *relative, va_list args);
+Etk_Combobox_Item *etk_combobox_item_append_relative(Etk_Combobox *combobox, 
Etk_Combobox_Item *relative, ...);
+Etk_Combobox_Item *etk_combobox_item_append_relative_valist(Etk_Combobox 
*combobox, Etk_Combobox_Item *relative, va_list args);
 
 void etk_combobox_item_remove(Etk_Combobox *combobox, Etk_Combobox_Item *item);
 void etk_combobox_clear(Etk_Combobox *combobox);




-------------------------------------------------------
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