Enlightenment CVS committal
Author : ymer
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_fileselector.c ewl_table.h ewl_table.c
Log Message:
preliminary table code move to the new cell and row codes .. doesn't work yet so don't
call me and bitch about it yet :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_fileselector.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_fileselector.c 19 Jan 2003 13:17:57 -0000 1.5
+++ ewl_fileselector.c 3 Feb 2003 00:21:09 -0000 1.6
@@ -199,14 +199,15 @@
int num, i, f_count, d_count, result;
char dir[PATH_MAX];
- Ewl_Table_Child *tc;
+ Ewl_Cell *cell;
+ Ewl_Widget *txt;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("fs", fs);
dir_head = file_head = NULL;
num = i = f_count = d_count = result = 0;
- tc = NULL;
+ cell = NULL;
strncpy(dir, directory, PATH_MAX);
@@ -312,25 +313,24 @@
(const char *) dir, PATH_MAX);
fs->d_info[d_count].dirEntry = dentries[i];
- tc = (Ewl_Table_Child *)
- ewl_table_add_return(EWL_TABLE
- (fs->dirs),
- dentries[i]->
- d_name, 1, 1,
+ cell = (Ewl_Cell *) ewl_cell_new();
+ txt = ewl_text_new(dentries[i]->d_name);
+ ewl_container_append_child(
+ EWL_CONTAINER(cell), txt);
+ ewl_table_add(EWL_TABLE(fs->dirs), cell, 1, 1,
d_count + 1,
d_count + 1);
- ewl_widget_show(EWL_WIDGET(tc));
+ ewl_widget_show(EWL_WIDGET(cell));
- ewl_callback_append(EWL_WIDGET(tc->widget),
- EWL_CALLBACK_MOUSE_UP,
+ ewl_callback_append(txt, EWL_CALLBACK_MOUSE_UP,
__directory_clicked, fs);
- ewl_widget_set_data(tc->widget, (void *) tc,
+ ewl_widget_set_data(txt, (void *) cell,
(int *) d_count);
}
- /* else if it is a regulare file add it to the
+ /* else if it is a regular file add it to the
* file table
*/
else if (S_ISREG(statBuffer.st_mode)) {
@@ -343,25 +343,24 @@
(const char *) dir, PATH_MAX);
fs->f_info[f_count].status = statBuffer;
- tc = (Ewl_Table_Child *)
- ewl_table_add_return(EWL_TABLE
- (fs->files),
- dentries[i]->
- d_name, 1, 1,
- f_count + 1,
- f_count + 1);
+ cell = (Ewl_Cell *) ewl_cell_new();
+ txt = ewl_text_new(dentries[i]->d_name);
+ ewl_container_append_child(
+ EWL_CONTAINER(cell), txt);
+ ewl_table_add(EWL_TABLE(fs->files), cell, 1, 1,
+ f_count + 1,
+ f_count + 1);
- ewl_widget_show(EWL_WIDGET(tc));
+ ewl_widget_show(EWL_WIDGET(cell));
if (fs->file_clicked != NULL) {
- ewl_callback_append(EWL_WIDGET
- (tc->widget),
- EWL_CALLBACK_MOUSE_UP,
- fs->file_clicked,
- fs);
+ ewl_callback_append(txt,
+ EWL_CALLBACK_MOUSE_UP,
+ fs->file_clicked,
+ fs);
}
- ewl_widget_set_data(tc->widget, (void *) tc,
+ ewl_widget_set_data(txt, (void *) cell,
(int *) f_count);
}
@@ -371,6 +370,7 @@
}
}
+
/**
* add directories '.' and '..' to the directory table
*/
@@ -378,26 +378,29 @@
strcpy(fs->d_info[d_count].name, "..");
strcpy(fs->d_info[d_count].path, dir);
- tc = (Ewl_Table_Child *) ewl_table_add_return(EWL_TABLE(fs->dirs),
- "..", 1, 1, d_count + 1,
- d_count + 1);
- ewl_widget_show(EWL_WIDGET(tc));
- ewl_callback_append(EWL_WIDGET(tc), EWL_CALLBACK_MOUSE_UP,
+ cell = (Ewl_Cell *) ewl_cell_new();
+ txt = ewl_text_new("..");
+ ewl_container_append_child(EWL_CONTAINER(cell), txt);
+ ewl_table_add(EWL_TABLE(fs->dirs), cell, 1, 1, d_count+1, d_count+1);
+ ewl_widget_show(EWL_WIDGET(cell));
+ ewl_callback_append(EWL_WIDGET(txt), EWL_CALLBACK_MOUSE_UP,
__directory_clicked, fs);
- ewl_widget_set_data(tc->widget, (void *) tc, (int *) d_count);
+ ewl_widget_set_data(txt, (void *) cell, (int *) d_count);
d_count--;
strcpy(fs->d_info[d_count].name, ".");
strcpy(fs->d_info[d_count].path, dir);
- tc = (Ewl_Table_Child *) ewl_table_add_return(EWL_TABLE(fs->dirs),
- ".", 1, 1, d_count + 1,
- d_count + 1);
- ewl_widget_show(EWL_WIDGET(tc));
- ewl_callback_append(EWL_WIDGET(tc), EWL_CALLBACK_MOUSE_UP,
+
+ cell = (Ewl_Cell *) ewl_cell_new();
+ txt = ewl_text_new(".");
+ ewl_container_append_child(EWL_CONTAINER(cell), txt);
+ ewl_table_add(EWL_TABLE(fs->dirs), cell, 1, 1, d_count+1, d_count+1);
+ ewl_widget_show(EWL_WIDGET(cell));
+ ewl_callback_append(EWL_WIDGET(txt), EWL_CALLBACK_MOUSE_UP,
__directory_clicked, fs);
- ewl_widget_set_data(tc->widget, (void *) tc, (int *) d_count);
+ ewl_widget_set_data(txt, (void *) cell, (int *) d_count);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_table.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_table.h 25 May 2002 05:46:42 -0000 1.14
+++ ewl_table.h 3 Feb 2003 00:21:09 -0000 1.15
@@ -24,23 +24,12 @@
};
-typedef struct _ewl_table_child Ewl_Table_Child;
-
-#define EWL_TABLE_CHILD(child) ((Ewl_Table_Child *)child)
-struct _ewl_table_child {
- Ewl_Container container;
- Ewl_Widget *widget;
-};
Ewl_Widget *ewl_table_new(int cols, int rows, char **col_headers);
void ewl_table_init(Ewl_Table * t, int cols, int rows,
char **col_headers);
-void ewl_table_add(Ewl_Table * table, char *text, int start_col,
+void ewl_table_add(Ewl_Table * table, Ewl_Cell * cell, int start_col,
int end_col, int start_row, int end_row);
-Ewl_Widget *ewl_table_add_return(Ewl_Table * table, char *text,
- int start_col, int end_col, int start_row,
- int end_row);
-
void ewl_table_reset(Ewl_Table * t, int cols, int rows,
char **c_headers);
void ewl_table_row_select(Ewl_Table * t, int boolean);
@@ -51,7 +40,7 @@
void ewl_table_get_col_w(Ewl_Table * table, int col, int *width);
void ewl_table_get_row_h(Ewl_Table * table, int row, int *height);
-void ewl_table_get_col_row(Ewl_Table * table, char *text,
+void ewl_table_get_col_row(Ewl_Table * table, Ewl_Cell * cell,
int *start_col, int *end_col,
int *start_row, int *end_row);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_table.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- ewl_table.c 14 Jan 2003 21:45:05 -0000 1.32
+++ ewl_table.c 3 Feb 2003 00:21:09 -0000 1.33
@@ -12,8 +12,6 @@
void __ewl_table_child_select(Ewl_Widget * w, void *ev_data,
void *user_data);
-Ewl_Table_Child *__ewl_table_create_child(Ewl_Widget * w);
-
/**
* ewl_table_new - create a new table
@@ -52,8 +50,8 @@
*/
void ewl_table_init(Ewl_Table * t, int cols, int rows, char **col_headers)
{
- Ewl_Widget *button;
- Ewl_Table_Child *child;
+ Ewl_Widget *button;
+ Ewl_Cell *cell;
int i;
DENTER_FUNCTION(DLEVEL_STABLE);
@@ -78,11 +76,13 @@
if (col_headers != NULL) {
for (i = 1; i <= cols; i++) {
+ cell = (Ewl_Cell *) ewl_cell_new();
button = ewl_button_new(col_headers[i - 1]);
ewl_widget_disable(button);
- child = __ewl_table_create_child(button);
- ewl_grid_add(t->grid, EWL_WIDGET(child), i, i, 1, 1);
- ewl_widget_show(EWL_WIDGET(child));
+ ewl_container_append_child(EWL_CONTAINER(cell), button);
+ ewl_grid_add(t->grid, EWL_WIDGET(cell), i, i, 1, 1);
+ ewl_widget_show(EWL_WIDGET(button));
+ ewl_widget_show(EWL_WIDGET(cell));
}
t->col_headers = col_headers;
@@ -120,82 +120,27 @@
* Returns no value.
*/
void
-ewl_table_add(Ewl_Table * table, char *text,
+ewl_table_add(Ewl_Table * table, Ewl_Cell * cell,
int start_col, int end_col, int start_row, int end_row)
{
- /*---------------------------------
- * DEVELOPER NOTE:
- * Need to create a new child widget (container containing the
- * widget passed in here). Then add the child to the grid.
- *---------------------------------*/
-
- Ewl_Table_Child *child;
- Ewl_Widget *txt;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("table", table);
- txt = ewl_button_new(text);
- child = __ewl_table_create_child(txt);
- ewl_grid_add(table->grid, EWL_WIDGET(child),
+ ewl_grid_add(table->grid, EWL_WIDGET(cell),
start_col, end_col, start_row, end_row);
- ewl_callback_prepend(child->widget, EWL_CALLBACK_MOUSE_UP,
+ ewl_callback_prepend(EWL_WIDGET(cell), EWL_CALLBACK_MOUSE_UP,
__ewl_table_child_select, table);
- ewl_widget_show(EWL_WIDGET(child));
+ ewl_widget_show(EWL_WIDGET(cell));
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-/**
- * ewl_table_add_return - add a child widget to the table
- * @table: the table
- * @text: the text to add
- * @start_col: the start column
- * @end_col: the end columnt
- * @start_row: the start row
- * @end_row: the end row
- *
- * Returns the child widget created so people can add callbacks and do
- * other fun stuff to it.
- */
-Ewl_Widget *ewl_table_add_return(Ewl_Table * table, char *text,
- int start_col, int end_col, int start_row,
- int end_row)
-{
-
- /*---------------------------------
- * DEVELOPER NOTE:
- * Need to create a new child widget (container containing the
- * widget passed in here). Then add the child to the grid.
- *---------------------------------*/
-
- Ewl_Table_Child *child;
- Ewl_Widget *txt;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- if (!table) {
- printf("no table\n");
- return NULL;
- }
-
- txt = ewl_button_new(text);
- child = __ewl_table_create_child(txt);
- ewl_grid_add(table->grid, EWL_WIDGET(child),
- start_col, end_col, start_row, end_row);
-
- ewl_callback_prepend(child->widget, EWL_CALLBACK_MOUSE_UP,
- __ewl_table_child_select, table);
-
- DRETURN_PTR(EWL_WIDGET(child), DLEVEL_STABLE);
-}
-
-
/**
* ewl_table_get_col_row - get the column and row of a widget
@@ -209,7 +154,7 @@
*
* Returns nothing
*/
-void ewl_table_get_col_row(Ewl_Table * t, char *text, /* Ewl_Widget *w */
+void ewl_table_get_col_row(Ewl_Table * t, Ewl_Cell * cell,
int *start_col, int *end_col, int *start_row,
int *end_row)
{
@@ -220,7 +165,7 @@
* widget and store it's column/row specs in the col/row
* parameters and I think that is in fact what it does now. It
* is not tested.
- *---------------------------------
+ *---------------------------------*/
Ewl_Widget *child;
Ewl_Grid_Child *g_child;
@@ -228,14 +173,13 @@
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("t", t);
- DCHECK_PARAM_PTR("w", w);
children = EWL_CONTAINER(t->grid)->children;
ewd_list_goto_first(children);
while ((child = ewd_list_next(children)) != NULL)
{
- if (child == w) {
+ if (child == EWL_WIDGET(cell)) {
g_child = (Ewl_Grid_Child *) ewl_widget_get_data(child,
(void *) t->grid);
@@ -253,9 +197,7 @@
}
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-
- */
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -299,7 +241,7 @@
if (start_col >= gc->start_col && end_col <= gc->end_col &&
start_row >= gc->start_row && end_row <= gc->end_row) {
- ewd_list_append(list, EWL_TABLE_CHILD(child)->widget);
+ ewd_list_append(list, child);
}
}
@@ -419,8 +361,8 @@
*/
void ewl_table_reset(Ewl_Table * t, int cols, int rows, char **col_headers)
{
- Ewl_Widget *button;
- Ewl_Table_Child *child;
+ Ewl_Widget *button;
+ Ewl_Cell *cell;
int i;
DENTER_FUNCTION(DLEVEL_STABLE);
@@ -432,13 +374,12 @@
if (col_headers != NULL) {
for (i = 1; i <= cols; i++) {
+ cell = (Ewl_Cell *) ewl_cell_new();
button = ewl_button_new(col_headers[i - 1]);
- ewl_object_set_fill_policy(EWL_OBJECT(button),
- EWL_FILL_POLICY_VSHRINK);
ewl_widget_disable(button);
- child = __ewl_table_create_child(button);
- ewl_grid_add(t->grid, EWL_WIDGET(child), i, i, 1, 1);
- ewl_widget_show(EWL_WIDGET(child));
+ ewl_container_append_child(EWL_CONTAINER(cell), button);
+ ewl_grid_add(t->grid, EWL_WIDGET(cell), i, i, 1, 1);
+ ewl_widget_show(EWL_WIDGET(cell));
}
t->col_headers = col_headers;
@@ -476,9 +417,9 @@
t->selected.start_r == gc->start_row &&
t->selected.end_c == gc->end_col &&
t->selected.end_r == gc->end_row) {
- tw = EWL_TEXT(EWL_BUTTON
- (EWL_TABLE_CHILD(child)->widget)->
- label_object);
+
+ tw = (Ewl_Text *) ewd_list_goto_first(
+ EWL_CONTAINER(child)->children);
DRETURN_PTR(ewl_text_get_text(tw), DLEVEL_STABLE);
@@ -490,125 +431,6 @@
}
-
-Ewl_Table_Child *__ewl_table_create_child(Ewl_Widget * w)
-{
-
- /*---------------------------------
- * DEVELOPER NOTE:
- * This function is supposed to create a new container, put the
- * widget in this container. Then this container will be the
- * actual child widget we add to the grid.
- *---------------------------------*/
-
- Ewl_Table_Child *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- child = NEW(Ewl_Table_Child, 1);
- if (!child)
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-
- memset(child, 0, sizeof(Ewl_Table_Child));
-
- /*
- * Initialize the inherited fields
- */
- ewl_container_init(EWL_CONTAINER(child), "/box/vertical", NULL, NULL);
- ewl_object_set_fill_policy(EWL_OBJECT(child), EWL_FILL_POLICY_FILL);
-
-
- /*
- * Add the widget
- */
- ewl_container_append_child(EWL_CONTAINER(child), w);
- child->widget = w;
-
- /*
- * Add callbacks
- */
- ewl_callback_append(EWL_WIDGET(child), EWL_CALLBACK_CONFIGURE,
- __ewl_table_child_configure, NULL);
- ewl_callback_append(EWL_WIDGET(child), EWL_CALLBACK_SHOW,
- __ewl_table_child_show, NULL);
-
-
-
- DRETURN_PTR(EWL_TABLE_CHILD(child), DLEVEL_STABLE);
-}
-
-
-
-void __ewl_table_child_show(Ewl_Widget * w, void *ev_data, void *user_data)
-{
- Ewl_Table_Child *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
- child = EWL_TABLE_CHILD(w);
-
- ewl_widget_show(child->widget);
- ewl_widget_configure(child->widget);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-
-void __ewl_table_child_configure(Ewl_Widget * w, void *ev_data, void *user_data)
-{
-
- /*---------------------------------
- * DEVELOPER NOTE:
- * The purpose of this method is to set the size of the actual
- * widget inside a grid child container. These widgets will be
- * resized according to their fill policies and
- * current/preferred size accordiningly.
- *
- *
- * Right now I just resize the widgets to take up all available
- * space but this will be changed as soon as preferred sizing
- * works according to new design scheme. I also resize the
- * clipping are of the container to the correct values.
- *---------------------------------*/
-
- Ewl_Window *window;
- Ewl_Object *o;
- Ewl_Grid *g;
- Ewl_Table_Child *c;
- Ewl_Grid_Child *gc;
- int width, height, i;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
-
-
- o = EWL_OBJECT(w);
- c = EWL_TABLE_CHILD(w);
- g = EWL_GRID(w->parent);
-
-
- ewl_object_request_geometry(EWL_OBJECT(c->widget),
- CURRENT_X(o), CURRENT_Y(o),
- CURRENT_W(o) - INSET_LEFT(o) +
- INSET_RIGHT(o),
- CURRENT_H(o) - INSET_TOP(o) +
- INSET_BOTTOM(o));
-
- gc = (Ewl_Grid_Child *) ewl_widget_get_data(w, (void *) g);
-
- width = height = 0;
- for (i = gc->start_col - 1; i < gc->end_col; i++) {
- width += g->col_size[i].size;
- height += g->row_size[i].size;
- }
-
- window = ewl_window_find_window_by_widget(w);
- evas_object_resize(w->fx_clip_box, width, height);
-
- ewl_widget_configure(EWL_WIDGET(c->widget));
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
void __ewl_table_child_select(Ewl_Widget * w, void *ev_data, void *user_data)
{
Ewl_Table *t;
@@ -620,8 +442,7 @@
t = EWL_TABLE(user_data);
- gc = (Ewl_Grid_Child *) ewl_widget_get_data(w->parent,
- (void *) t->grid);
+ gc = (Ewl_Grid_Child *) ewl_widget_get_data(w, (void *) t->grid);
t->selected.start_r = gc->start_row;
t->selected.start_c = gc->start_col;
@@ -693,7 +514,6 @@
ewl_widget_configure(child);
}
-
DLEAVE_FUNCTION(DLEVEL_STABLE);
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs