Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_iconbox.c etk_iconbox.h etk_label.c etk_widget.c 


Log Message:
* [Iconbox] Fix: the labels now disappear correctly when an icon is 
removed


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_iconbox.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- etk_iconbox.c       8 Aug 2006 18:51:22 -0000       1.11
+++ etk_iconbox.c       21 Aug 2006 13:13:08 -0000      1.12
@@ -193,14 +193,39 @@
    iconbox = model->iconbox;
    iconbox->models = evas_list_remove(iconbox->models, model);
    if (iconbox->current_model == model)
-      iconbox->current_model = evas_list_data(evas_list_last(iconbox->models));
-   if (iconbox->default_model == model)
-      iconbox->default_model = NULL;
+      iconbox->current_model = evas_list_data(iconbox->models);
    
    free(model);
 }
 
 /**
+ * @brief Sets the model used by the iconbox
+ * @param iconbox an iconbox
+ * @param model the model that the iconbox should use (if NULL, no icon will 
be displayed)
+ */
+void etk_iconbox_current_model_set(Etk_Iconbox *iconbox, Etk_Iconbox_Model 
*model)
+{
+   if (!iconbox || (model && model->iconbox != iconbox))
+      return;
+   
+   iconbox->current_model = model;
+   etk_signal_emit_by_name("scroll_size_changed", ETK_OBJECT(iconbox->grid), 
NULL);
+   etk_widget_redraw_queue(iconbox->grid);
+}
+
+/**
+ * @brief Gets the model currently used by the iconbox
+ * @param iconbox an iconbox
+ * @return Returns the model currently used by the iconbox
+ */
+Etk_Iconbox_Model *etk_iconbox_current_model_get(Etk_Iconbox *iconbox)
+{
+   if (!iconbox)
+      return NULL;
+   return iconbox->current_model;
+}
+
+/**
  * @brief Sets the global geometry of the iconbox model
  * @param model an iconbox model
  * @param width the width of the cells of the model (min = 10)
@@ -364,33 +389,6 @@
 }
 
 /**
- * @brief Sets the model used by the iconbox
- * @param iconbox an iconbox
- * @param model the model that the iconbox should use (if NULL, no icon will 
be displayed)
- */
-void etk_iconbox_current_model_set(Etk_Iconbox *iconbox, Etk_Iconbox_Model 
*model)
-{
-   if (!iconbox || (model && model->iconbox != iconbox))
-      return;
-   
-   iconbox->current_model = model;
-   etk_signal_emit_by_name("scroll_size_changed", ETK_OBJECT(iconbox->grid), 
NULL);
-   etk_widget_redraw_queue(iconbox->grid);
-}
-
-/**
- * @brief Gets the model currently used by the iconbox
- * @param iconbox an iconbox
- * @return Returns the model currently used by the iconbox
- */
-Etk_Iconbox_Model *etk_iconbox_current_model_get(Etk_Iconbox *iconbox)
-{
-   if (!iconbox)
-      return NULL;
-   return iconbox->current_model;
-}
-
-/**
  * @brief Freezes the iconbox: it will not be updated until it is thawed. @n
  * This function is useful when you want to add a lot of icons efficiently.
  * @param iconbox an iconbox
@@ -420,7 +418,8 @@
  * @brief Appends a new icon to the iconbox
  * @param iconbox a iconbox
  * @param filename the filename of the image to use for the icon. It can be 
either an image or an edje file
- * @param edje_group the edje group to use for the icon. If NULL, @a filename 
will be considerated as a normal image file
+ * @param edje_group the edje group to use for the icon. If NULL, @a filename 
will be considerated as a
+ * normal image file
  * @param label the label to associate to the icon
  * @return Returns the new icon
  */
@@ -431,6 +430,7 @@
    if (!iconbox)
       return NULL;
    
+   /* TODO: more insert func */
    icon = malloc(sizeof(Etk_Iconbox_Icon));
    icon->iconbox = iconbox;
    icon->prev = NULL;
@@ -516,13 +516,17 @@
 }
 
 /**
- * @brief Gets the icon located below the position (x, y). The position should 
be relative to the canvas
+ * @brief Gets the icon located below the position ( @a x, @a y ). The 
position should be relative to the canvas
+ * (TODO: relative to the icobox instead?)
  * @param iconbox an iconbox
  * @param x the x position
  * @param y the y position
- * @param over_cell if @a over_cell == ETK_TRUE, the function will return the 
icon if (x, y) is over the cell of the icon
- * @param over_icon if @a over_icon == ETK_TRUE, the function will return the 
icon if (x, y) is over the image of the icon
- * @param over_label if @a over_label == ETK_TRUE, the function will return 
the icon if (x, y) is over the label of the icon
+ * @param over_cell if @a over_cell is ETK_TRUE, the function will return the 
icon if (x, y) is over
+ * the cell of the icon
+ * @param over_icon if @a over_icon == ETK_TRUE, the function will return the 
icon if (x, y) is over
+ * the image of the icon
+ * @param over_label if @a over_label == ETK_TRUE, the function will return 
the icon if (x, y) is over
+ * the label of the icon
  * @return Returns the icon located below the position (x, y), or NULL if none
  */
 Etk_Iconbox_Icon *etk_iconbox_icon_get_at_xy(Etk_Iconbox *iconbox, int x, int 
y, Etk_Bool over_cell, Etk_Bool over_icon, Etk_Bool over_label)
@@ -584,11 +588,10 @@
 }
 
 /**
- * @brief Sets the file used for the icon image
+ * @brief Sets the file path of the icon's image
  * @param icon an icon
- * @param filename the filename of the image to use for the icon
- * @param edje_group the edje group to use if the image file is an edje 
animation.
- * It has to be set to NULL for a "normal" image
+ * @param filename the filename of the icon's image
+ * @param edje_group the edje group of the icon's image. It has to be set to 
NULL for a "normal" image
  */
 void etk_iconbox_icon_file_set(Etk_Iconbox_Icon *icon, const char *filename, 
const char *edje_group)
 {
@@ -611,10 +614,10 @@
 }
 
 /**
- * @brief Sets the file used for the icon image
+ * @brief Sets the file used by the icon's image
  * @param icon an icon
- * @param filename a location where to store the filename of the image used by 
the icon
- * @param edje_group a location where to store the edje group of the image 
used by the icon
+ * @param filename a location where to store the filename of the icon's image
+ * @param edje_group a location where to store the edje group of the icon's 
image
  */
 void etk_iconbox_icon_file_get(Etk_Iconbox_Icon *icon, const char **filename, 
const char **edje_group)
 {
@@ -794,6 +797,7 @@
    
    iconbox->scrolled_view = etk_scrolled_view_new();
    etk_widget_visibility_locked_set(iconbox->scrolled_view, ETK_TRUE);
+   /* TODO: Why do we need this? */
    etk_widget_repeat_mouse_events_set(iconbox->scrolled_view, ETK_TRUE);
    etk_widget_parent_set(iconbox->scrolled_view, ETK_WIDGET(iconbox));
    etk_widget_show(iconbox->scrolled_view);
@@ -805,15 +809,15 @@
    etk_widget_show(iconbox->grid);
 
    iconbox->models = NULL;
-   iconbox->default_model = etk_iconbox_model_new(iconbox);
-   iconbox->current_model = iconbox->default_model;
+   iconbox->current_model = etk_iconbox_model_new(iconbox);
    
    iconbox->num_icons = 0;
    iconbox->first_icon = NULL;
    iconbox->last_icon = NULL;
-      
+   
    iconbox->frozen = ETK_FALSE;
    
+   /* TODO: size request */
    ETK_WIDGET(iconbox)->size_allocate = _etk_iconbox_size_allocate;
    
    etk_signal_connect("realize", ETK_OBJECT(iconbox), 
ETK_CALLBACK(_etk_iconbox_realize_cb), NULL);
@@ -828,7 +832,6 @@
    
    etk_iconbox_clear(iconbox);
    
-   iconbox->default_model = NULL;
    iconbox->current_model = NULL;
    while (iconbox->models)
       etk_iconbox_model_free(iconbox->models->data);
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_iconbox.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- etk_iconbox.h       25 May 2006 21:07:00 -0000      1.7
+++ etk_iconbox.h       21 Aug 2006 13:13:08 -0000      1.8
@@ -21,8 +21,8 @@
 #define ETK_IS_ICONBOX(obj)    (ETK_OBJECT_CHECK_TYPE((obj), ETK_ICONBOX_TYPE))
 
 /**
- * @brief Describes the model of an iconbox: it includes the position and the 
size of the cell, the icon and
- * the label. An iconbox can have several models, and you can change its 
current model to change the view
+ * @brief Describes the model of an iconbox: it includes the position and the 
size of the cell, of the icon and
+ * of the label. An iconbox can have several models, and you can change its 
current model to change the view
  * @structinfo
  */
 struct Etk_Iconbox_Model
@@ -74,7 +74,7 @@
 };
 
 /**
- * @brief @widget The structure of an iconbox
+ * @brief @widget A widget that can display icons aligned on a grid
  * @structinfo
  */
 struct Etk_Iconbox
@@ -88,7 +88,6 @@
 
    Evas_List *models;
    Etk_Iconbox_Model *current_model;
-   Etk_Iconbox_Model *default_model;
    
    int num_icons;
    Etk_Iconbox_Icon *first_icon;
@@ -98,11 +97,15 @@
    Etk_Bool frozen;
 };
 
-Etk_Type *etk_iconbox_type_get();
+/* TODO: scrolled_view_get() */
+
+Etk_Type   *etk_iconbox_type_get();
 Etk_Widget *etk_iconbox_new();
 
 Etk_Iconbox_Model *etk_iconbox_model_new(Etk_Iconbox *iconbox);
-void etk_iconbox_model_free(Etk_Iconbox_Model *model);
+void               etk_iconbox_model_free(Etk_Iconbox_Model *model);
+void               etk_iconbox_current_model_set(Etk_Iconbox *iconbox, 
Etk_Iconbox_Model *model);
+Etk_Iconbox_Model *etk_iconbox_current_model_get(Etk_Iconbox *iconbox);
 
 void etk_iconbox_model_geometry_set(Etk_Iconbox_Model *model, int width, int 
height, int xpadding, int ypadding);
 void etk_iconbox_model_geometry_get(Etk_Iconbox_Model *model, int *width, int 
*height, int *xpadding, int *ypadding);
@@ -111,31 +114,27 @@
 void etk_iconbox_model_label_geometry_set(Etk_Iconbox_Model *model, int x, int 
y, int width, int height, float xalign, float yalign);
 void etk_iconbox_model_label_geometry_get(Etk_Iconbox_Model *model, int *x, 
int *y, int *width, int *height, float *xalign, float *yalign);
 
-void etk_iconbox_current_model_set(Etk_Iconbox *iconbox, Etk_Iconbox_Model 
*model);
-Etk_Iconbox_Model *etk_iconbox_current_model_get(Etk_Iconbox *iconbox);
-
 void etk_iconbox_freeze(Etk_Iconbox *iconbox);
 void etk_iconbox_thaw(Etk_Iconbox *iconbox);
 
 Etk_Iconbox_Icon *etk_iconbox_append(Etk_Iconbox *iconbox, const char 
*filename, const char *edje_group, const char *label);
-void etk_iconbox_icon_del(Etk_Iconbox_Icon *icon);
-void etk_iconbox_clear(Etk_Iconbox *iconbox);
+void              etk_iconbox_icon_del(Etk_Iconbox_Icon *icon);
+void              etk_iconbox_clear(Etk_Iconbox *iconbox);
 Etk_Iconbox_Icon *etk_iconbox_icon_get_at_xy(Etk_Iconbox *iconbox, int x, int 
y, Etk_Bool over_cell, Etk_Bool over_icon, Etk_Bool over_label);
 
-void etk_iconbox_icon_file_set(Etk_Iconbox_Icon *icon, const char *filename, 
const char *edje_group);
-void etk_iconbox_icon_file_get(Etk_Iconbox_Icon *icon, const char **filename, 
const char **edje_group);
-void etk_iconbox_icon_label_set(Etk_Iconbox_Icon *icon, const char *label);
+void        etk_iconbox_icon_file_set(Etk_Iconbox_Icon *icon, const char 
*filename, const char *edje_group);
+void        etk_iconbox_icon_file_get(Etk_Iconbox_Icon *icon, const char 
**filename, const char **edje_group);
+void        etk_iconbox_icon_label_set(Etk_Iconbox_Icon *icon, const char 
*label);
 const char *etk_iconbox_icon_label_get(Etk_Iconbox_Icon *icon);
 
 void etk_iconbox_icon_data_set(Etk_Iconbox_Icon *icon, void *data);
 void etk_iconbox_icon_data_set_full(Etk_Iconbox_Icon *icon, void *data, void 
(*free_cb)(void *data));
 void *etk_iconbox_icon_data_get(Etk_Iconbox_Icon *icon);
 
-void etk_iconbox_select_all(Etk_Iconbox *iconbox);
-void etk_iconbox_unselect_all(Etk_Iconbox *iconbox);
-
-void etk_iconbox_icon_select(Etk_Iconbox_Icon *icon);
-void etk_iconbox_icon_unselect(Etk_Iconbox_Icon *icon);
+void     etk_iconbox_select_all(Etk_Iconbox *iconbox);
+void     etk_iconbox_unselect_all(Etk_Iconbox *iconbox);
+void     etk_iconbox_icon_select(Etk_Iconbox_Icon *icon);
+void     etk_iconbox_icon_unselect(Etk_Iconbox_Icon *icon);
 Etk_Bool etk_iconbox_is_selected(Etk_Iconbox_Icon *icon);
 
 /** @} */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_label.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- etk_label.c 13 Aug 2006 22:42:23 -0000      1.20
+++ etk_label.c 21 Aug 2006 13:13:08 -0000      1.21
@@ -336,16 +336,16 @@
       _etk_label_style_use = 0;
    }
 
+   label->clip = evas_object_rectangle_add(evas);
+   evas_object_show(label->clip);
+   etk_widget_member_object_add(ETK_WIDGET(label), label->clip);
+   
    label->text_object = evas_object_textblock_add(evas);
    evas_object_textblock_style_set(label->text_object, _etk_label_style);
    evas_object_show(label->text_object);
    etk_widget_member_object_add(ETK_WIDGET(label), label->text_object);
-   _etk_label_style_use++;
-
-   label->clip = evas_object_rectangle_add(evas);
    evas_object_clip_set(label->text_object, label->clip);
-   evas_object_show(label->clip);
-   etk_widget_member_object_add(ETK_WIDGET(label), label->clip);
+   _etk_label_style_use++;
 
    evas_object_textblock_text_markup_set(label->text_object, label->text);
    etk_widget_size_recalc_queue(ETK_WIDGET(label));
@@ -365,6 +365,7 @@
       evas_textblock_style_free(_etk_label_style);
       _etk_label_style = NULL;
    }
+   label->text_object = NULL;
    label->clip = NULL;
 }
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_widget.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- etk_widget.c        20 Aug 2006 20:41:20 -0000      1.74
+++ etk_widget.c        21 Aug 2006 13:13:08 -0000      1.75
@@ -1322,13 +1322,15 @@
  * @brief Adds an evas object to the list of member objects of the widget. @n
  * A member object is automatically shown/hidden when the widget is 
shown/hidden, it is automatically clipped when the
  * widget is, and it is used by the widget to receive mouse events. @n
- * The object will be automatically deleted when the object will be 
unrealized, unless you remove it before the widget
- * is deleted, with etk_widget_member_object_del().
+ * The object will be automatically deleted when the object is unrealized, 
unless you remove it before the widget
+ * is deleted with etk_widget_member_object_del().
  * @param widget a widget
  * @param object the evas object to add
  * @return Returns ETK_TRUE on success. ETK_FALSE on failure, probably because 
the widget and the object do not
  * belong to the same evas, or because the widget is not realized yet
- * @note The object has to belong to the same evas than the widget
+ * @note The object has to belong to the same evas as the widget
+ * @note The object may be clipped against the clip object of the widget. So 
if you want to clip the object against your
+ * own clip object, you'll have to clip it after having called 
etk_widget_member_object_add()
  * @widget_implementation
  */
 Etk_Bool etk_widget_member_object_add(Etk_Widget *widget, Evas_Object *object)
@@ -1943,7 +1945,6 @@
    if (!widget)
       return;
 
-   _etk_widget_unrealize(widget);
    etk_widget_parent_set(widget, NULL);
    
    while (widget->theme_children)
@@ -1976,6 +1977,8 @@
    
    if (!(widget = ETK_WIDGET(object)))
       return;
+   
+   _etk_widget_unrealize(widget);
    
    /* Remove the children */
    while (widget->children)



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