Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_iconbox.c ewl_iconbox.h
Log Message:
Add some layout functions
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_iconbox.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- ewl_iconbox.c 21 Oct 2005 12:51:34 -0000 1.38
+++ ewl_iconbox.c 22 Oct 2005 00:16:50 -0000 1.39
@@ -4,13 +4,6 @@
#include "ewl_private.h"
-int mouse_state = 0;
-static int nextx=0;
-
-
-
-
-
/*Ecore_List *ewl_iconbox_icon_list;*/
/**
@@ -165,6 +158,9 @@
ewl_object_fill_policy_set(EWL_OBJECT(ib->ewl_iconbox_menu_floater),
EWL_FLAG_FILL_FILL);
+ /*Set the defaults to 0*/
+ ib->lx = ib->ly = ib->iw = ib->ih = 0;
+
/* Get the context menu ready */
ib->ewl_iconbox_context_menu = ewl_imenu_new();
@@ -289,6 +285,11 @@
+void ewl_iconbox_icon_size_custom_set(Ewl_IconBox* ib, int w, int h) {
+ ib->iw = w;
+ ib->ih = h;
+}
+
void ewl_iconbox_context_menu_item_add(Ewl_IconBox* ib, Ewl_Widget* item) {
@@ -605,13 +606,10 @@
Ewl_IconBox_Icon* ewl_iconbox_icon_add(Ewl_IconBox* iconbox, char* name, char*
icon_file)
{
Ewl_Widget* ib;
- /*ib = malloc(sizeof(Ewl_IconBox_Icon));*/
- /*printf ("Making an icon called '%s'\n", name);*/
+ int sw, sh;
ib = ewl_iconbox_icon_new();
-
-
EWL_ICONBOX_ICON(ib)->selected = 0;
EWL_ICONBOX_ICON(ib)->floater = ewl_floater_new();
ewl_floater_follow_set(EWL_FLOATER( EWL_ICONBOX_ICON(ib)->floater ),
@@ -643,9 +641,19 @@
*/
ewl_container_child_append(EWL_CONTAINER(iconbox->ewl_iconbox_pane_inner),
EWL_WIDGET(EWL_ICONBOX_ICON(ib)->floater));
- /* Find the enxt pos for this icon FIXME add this to layout engine */
- ewl_floater_position_set(EWL_FLOATER(EWL_ICONBOX_ICON(ib)->floater),
nextx, 0);
- nextx += 75;
+
+ /*----------------------*/
+ /*Get the icon next position*/
+
ewl_object_current_size_get(EWL_OBJECT(iconbox->ewl_iconbox_scrollpane),
&sw,&sh);
+ ewl_floater_position_set(EWL_FLOATER(EWL_ICONBOX_ICON(ib)->floater),
iconbox->lx, iconbox->ly);
+
+ if (iconbox->lx + iconbox->iw + EWL_ICONBOX_ICON_PADDING > sw ) {
+ iconbox->ly += EWL_ICONBOX_ICON_PADDING + iconbox->ih;
+ iconbox->lx = 0;
+ } else {
+ iconbox->lx += EWL_ICONBOX_ICON_PADDING + iconbox->iw;
+ }
+ /*----------------------*/
/*Show*/
@@ -683,7 +691,6 @@
void ewl_iconbox_clear(Ewl_IconBox* ib)
{
Ewl_IconBox_Icon* list_item;
- nextx = 0;
/*printf("*** Deleting all icons...\n");*/
@@ -703,6 +710,8 @@
}
ib->drag_icon = NULL;
+ ib->lx = 0;
+ ib->ly = 0;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_iconbox.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ewl_iconbox.h 21 Oct 2005 12:51:34 -0000 1.15
+++ ewl_iconbox.h 22 Oct 2005 00:16:50 -0000 1.16
@@ -78,6 +78,8 @@
Ewl_IconBox_Icon* edit_icon;
int xdown, ydown; /* Last icon button down x/y, for
edge resistence */
int dx, dy; /* Drag start x/y */
+ int lx, ly; /*Layout x, layout y */
+ int iw, ih; /*Custom icon width/height*/
/*Background*/
Evas_Object* background;
@@ -106,6 +108,7 @@
/* External functions */
+void ewl_iconbox_icon_size_custom_set(Ewl_IconBox* ib, int w, int h);
void ewl_iconbox_editable_set(Ewl_IconBox *ib, int edit);
void ewl_iconbox_icon_arrange(Ewl_IconBox* ib);
void ewl_iconbox_deselect_all(Ewl_IconBox* ib);
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs