Enlightenment CVS committal Author : moom Project : e17 Module : proto
Dir : e17/proto/etk/src/lib Modified Files: etk_colorpicker.c etk_container.h etk_table.c etk_table.h Log Message: New API BREAK!! :) * Change the name of the fill policy flags the table: e.g. ETK_FILL_POLICY_HEXPAND --> ETK_TABLE_HEXPAND also, 3 more convenient flags: ETK_TABLE_EXPAND = ETK_TABLE_HEXPAND | ETK_TABLE_VEXPAND ETK_TABLE_FILL = ETK_TABLE_HFILL | ETK_TABLE_VFILL ETK_TABLE_EXPAND_FILL = ETK_TABLE_FILL | ETK_TABLE_EXPAND * etk_table_attach_defaults() --> etk_table_attach_default() =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_colorpicker.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- etk_colorpicker.c 13 Aug 2006 22:42:23 -0000 1.19 +++ etk_colorpicker.c 15 Aug 2006 16:33:26 -0000 1.20 @@ -303,14 +303,12 @@ etk_widget_show(cp->main_table); cp->picker_widget = etk_widget_new(ETK_WIDGET_TYPE, "theme_group", "picker", NULL); - etk_table_attach(ETK_TABLE(cp->main_table), cp->picker_widget, 0, 0, 0, 0, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VFILL | ETK_FILL_POLICY_HEXPAND | ETK_FILL_POLICY_VEXPAND); + etk_table_attach_default(ETK_TABLE(cp->main_table), cp->picker_widget, 0, 0, 0, 0); etk_widget_visibility_locked_set(cp->picker_widget, ETK_TRUE); etk_widget_show(cp->picker_widget); cp->component_table = etk_table_new(3, 6, ETK_FALSE); - etk_table_attach(ETK_TABLE(cp->main_table), cp->component_table, 1, 1, 0, 0, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VFILL | ETK_FILL_POLICY_HEXPAND | ETK_FILL_POLICY_VEXPAND); + etk_table_attach_default(ETK_TABLE(cp->main_table), cp->component_table, 1, 1, 0, 0); etk_widget_visibility_locked_set(cp->component_table, ETK_TRUE); etk_widget_show(cp->component_table); @@ -322,13 +320,13 @@ else cp->radios[i] = etk_radio_button_new_with_label_from_widget(labels[i], ETK_RADIO_BUTTON(cp->radios[0])); etk_table_attach(ETK_TABLE(cp->component_table), cp->radios[i], 0, 0, i, i, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VEXPAND); + 0, 0, ETK_TABLE_HFILL | ETK_TABLE_VEXPAND); etk_widget_visibility_locked_set(cp->radios[i], ETK_TRUE); etk_widget_show(cp->radios[i]); cp->sliders[i] = etk_hslider_new(0.0, values[i], 0.0, steps[i], steps[i] * 5); etk_table_attach(ETK_TABLE(cp->component_table), cp->sliders[i], 1, 1, i, i, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_HEXPAND | ETK_FILL_POLICY_VEXPAND); + 0, 0, ETK_TABLE_HFILL | ETK_TABLE_EXPAND); etk_widget_visibility_locked_set(cp->sliders[i], ETK_TRUE); etk_widget_show(cp->sliders[i]); @@ -337,7 +335,7 @@ cp->value_labels[i] = etk_label_new("0"); etk_table_attach(ETK_TABLE(cp->component_table), cp->value_labels[i], 2, 2, i, i, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VEXPAND); + 0, 0, ETK_TABLE_HFILL | ETK_TABLE_VEXPAND); etk_widget_size_request_set(cp->value_labels[i], 28, -1); etk_widget_visibility_locked_set(cp->value_labels[i], ETK_TRUE); etk_widget_show(cp->value_labels[i]); @@ -355,20 +353,20 @@ /* We create the widgets for the color preview */ cp->color_table = etk_table_new(2, 1, ETK_FALSE); etk_table_attach(ETK_TABLE(cp->main_table), cp->color_table, 0, 0, 1, 1, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VFILL | ETK_FILL_POLICY_HEXPAND); + 0, 0, ETK_TABLE_FILL | ETK_TABLE_HEXPAND); etk_widget_visibility_locked_set(cp->color_table, ETK_TRUE); etk_widget_show(cp->color_table); /* Current color preview */ cp->current_color_label = etk_label_new(_("Current")); etk_table_attach(ETK_TABLE(cp->color_table), cp->current_color_label, 0, 0, 0, 0, - 0, 0, ETK_FILL_POLICY_HFILL); + 0, 0, ETK_TABLE_HFILL); etk_widget_visibility_locked_set(cp->current_color_label, ETK_TRUE); etk_widget_show(cp->current_color_label); cp->current_color_widget = etk_widget_new(ETK_WIDGET_TYPE, "theme_group", "color_preview", NULL); etk_table_attach(ETK_TABLE(cp->color_table), cp->current_color_widget, 1, 1, 0, 0, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_HEXPAND); + 0, 0, ETK_TABLE_HFILL | ETK_TABLE_HEXPAND); etk_widget_visibility_locked_set(cp->current_color_widget, ETK_TRUE); etk_widget_show(cp->current_color_widget); =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_container.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- etk_container.h 25 May 2006 21:07:00 -0000 1.7 +++ etk_container.h 15 Aug 2006 16:33:26 -0000 1.8 @@ -19,18 +19,6 @@ /** Checks if the object is an Etk_Container */ #define ETK_IS_CONTAINER(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_CONTAINER_TYPE)) -/** @brief Describes how a child fills and expands the space allocated by its parent container */ -typedef enum Etk_Fill_Policy_Flags -{ - ETK_FILL_POLICY_NONE = 1 << 0, /**< The child doesn't fill or expand */ - ETK_FILL_POLICY_HFILL = 1 << 1, /**< The child fills all the horizontal space allocated for him */ - ETK_FILL_POLICY_VFILL = 1 << 2, /**< The child fills all the vertical space allocated for him */ - ETK_FILL_POLICY_HEXPAND = 1 << 3, /**< The child expands horizontally: the cell containing the child */ - /**< will take as much place as possible in the horizontal direction */ - ETK_FILL_POLICY_VEXPAND = 1 << 4 /**< The child expands vertically: the cell containing the child */ - /**< will take as much place as possible in the vertical direction */ -} Etk_Fill_Policy_Flags; - /** * @brief @widget The structure of a container * @structinfo =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_table.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- etk_table.c 13 Aug 2006 22:42:23 -0000 1.17 +++ etk_table.c 15 Aug 2006 16:33:26 -0000 1.18 @@ -10,7 +10,6 @@ * @{ */ -/* Gets the array index of the cell located at column "col" and row "row" in table "table" */ #define ETK_TABLE_CELL_INDEX(table, col, row) ((row) * (table)->num_cols + (col)) #define ETK_TABLE_CELL_MIN_SIZE 10 @@ -199,7 +198,7 @@ * @param fill_policy The fill policy of the child */ void etk_table_attach(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, - int top_attach, int bottom_attach, int x_padding, int y_padding, Etk_Fill_Policy_Flags fill_policy) + int top_attach, int bottom_attach, int x_padding, int y_padding, Etk_Table_Fill_Policy fill_policy) { Etk_Table_Cell *cell; int i, j; @@ -238,7 +237,8 @@ } /** - * @brief Simpler version of etk_table_attach: padding is set to 0 and fill policy is FILL and EXPAND in the both directions. + * @brief Same as etk_table_attach() but with default settings: padding is set to 0 and + * the fill policy is ETK_TABLE_EXPAND_FILL. * @param table a table * @param child the child widget to attach * @param left_attach the column where the left size of the child will be attached @@ -246,10 +246,9 @@ * @param top_attach the row where the top size of the child will be attached * @param bottom_attach the row where the bottom size of the child will be attached */ -void etk_table_attach_defaults(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach) +void etk_table_attach_default(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach) { - etk_table_attach(table, child, left_attach, right_attach, top_attach, bottom_attach, - 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VFILL | ETK_FILL_POLICY_HEXPAND | ETK_FILL_POLICY_VEXPAND); + etk_table_attach(table, child, left_attach, right_attach, top_attach, bottom_attach, 0, 0, ETK_TABLE_EXPAND_FILL); } /** @@ -412,12 +411,12 @@ cell_size = (2 * cell->x_padding + child_requisition.w) / (cell->right_attach - cell->left_attach + 1); if (max_col_width < cell_size) max_col_width = cell_size; - hexpand |= (cell->fill_policy & ETK_FILL_POLICY_HEXPAND); + hexpand |= (cell->fill_policy & ETK_TABLE_HEXPAND); cell_size = (2 * cell->y_padding + child_requisition.h) / (cell->bottom_attach - cell->top_attach + 1); if (max_row_height < cell_size) max_row_height = cell_size; - vexpand |= (cell->fill_policy & ETK_FILL_POLICY_VEXPAND); + vexpand |= (cell->fill_policy & ETK_TABLE_VEXPAND); } for (i = 0; i < table->num_cols; i++) @@ -461,8 +460,8 @@ { if (table->cols[cell->left_attach].requested_size < child_requisition.w + 2 * cell->x_padding) table->cols[cell->left_attach].requested_size = child_requisition.w + 2 * cell->x_padding; - table->cols[cell->left_attach].expand |= (cell->fill_policy & ETK_FILL_POLICY_HEXPAND); - hexpand |= (cell->fill_policy & ETK_FILL_POLICY_HEXPAND); + table->cols[cell->left_attach].expand |= (cell->fill_policy & ETK_TABLE_HEXPAND); + hexpand |= (cell->fill_policy & ETK_TABLE_HEXPAND); } /* Rows */ @@ -470,8 +469,8 @@ { if (table->rows[cell->top_attach].requested_size < child_requisition.h + 2 * cell->y_padding) table->rows[cell->top_attach].requested_size = child_requisition.h + 2 * cell->y_padding; - table->rows[cell->top_attach].expand |= (cell->fill_policy & ETK_FILL_POLICY_VEXPAND); - vexpand |= (cell->fill_policy & ETK_FILL_POLICY_VEXPAND); + table->rows[cell->top_attach].expand |= (cell->fill_policy & ETK_TABLE_VEXPAND); + vexpand |= (cell->fill_policy & ETK_TABLE_VEXPAND); } } /* Then, we treat the children that span multiple columns or rows */ @@ -496,7 +495,7 @@ for (i = cell->left_attach; i <= cell->right_attach; i++) { cells_size += table->cols[i].requested_size; - if (!hexpand && (cell->fill_policy & ETK_FILL_POLICY_HEXPAND)) + if (!hexpand && (cell->fill_policy & ETK_TABLE_HEXPAND)) table->cols[i].expand = ETK_TRUE; if (table->cols[i].expand) num_expandable_cells++; @@ -532,7 +531,7 @@ for (i = cell->top_attach; i <= cell->bottom_attach; i++) { cells_size += table->rows[i].requested_size; - if (!vexpand && (cell->fill_policy & ETK_FILL_POLICY_VEXPAND)) + if (!vexpand && (cell->fill_policy & ETK_TABLE_VEXPAND)) table->rows[i].expand = ETK_TRUE; if (table->rows[i].expand) num_expandable_cells++;; @@ -691,7 +690,7 @@ child_geometry.h = table->rows[cell->bottom_attach].offset - table->rows[cell->top_attach].offset + table->rows[cell->bottom_attach].size - 2 * cell->y_padding; - etk_container_child_space_fill(child, &child_geometry, cell->fill_policy & ETK_FILL_POLICY_HFILL, cell->fill_policy & ETK_FILL_POLICY_VFILL, 0.5, 0.5); + etk_container_child_space_fill(child, &child_geometry, cell->fill_policy & ETK_TABLE_HFILL, cell->fill_policy & ETK_TABLE_VFILL, 0.5, 0.5); etk_widget_size_allocate(child, child_geometry); } } @@ -705,7 +704,7 @@ /* Adds a child to the table */ static void _etk_table_child_add(Etk_Container *container, Etk_Widget *widget) { - etk_table_attach_defaults(ETK_TABLE(container), widget, 0, 0, 0, 0); + etk_table_attach_default(ETK_TABLE(container), widget, 0, 0, 0, 0); } /* Removes the child from the table */ =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_table.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- etk_table.h 12 May 2006 19:13:39 -0000 1.4 +++ etk_table.h 15 Aug 2006 16:33:26 -0000 1.5 @@ -19,6 +19,21 @@ /** Checks if the object is an Etk_Table */ #define ETK_IS_TABLE(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_TABLE_TYPE)) +/** @brief Describes how a child of the table should fill and expand the space allocated to it */ +typedef enum Etk_Table_Fill_Policy +{ + ETK_TABLE_NONE = 1 << 0, /**< The child doesn't fill or expand */ + ETK_TABLE_HFILL = 1 << 1, /**< The child fills all the horizontal space allocated to it */ + ETK_TABLE_VFILL = 1 << 2, /**< The child fills all the vertical space allocated to it */ + ETK_TABLE_HEXPAND = 1 << 3, /**< The child expands horizontally: the cell containing the child */ + /**< will take as much place as possible in the horizontal direction */ + ETK_TABLE_VEXPAND = 1 << 4, /**< The child expands vertically: the cell containing the child */ + /**< will take as much place as possible in the vertical direction */ + ETK_TABLE_FILL = ETK_TABLE_HFILL | ETK_TABLE_VFILL, /**< Equivalent to ETK_TABLE_HFILL | ETK_TABLE_VFILL */ + ETK_TABLE_EXPAND = ETK_TABLE_HEXPAND | ETK_TABLE_VEXPAND, /**< Equivalent to ETK_TABLE_HEXPAND | ETK_TABLE_VEXPAND */ + ETK_TABLE_EXPAND_FILL = ETK_TABLE_EXPAND | ETK_TABLE_FILL, /**< Equivalent to ETK_TABLE_EXPAND | ETK_TABLE_FILL */ +} Etk_Table_Fill_Policy; + /* A cell of a table */ typedef struct Etk_Table_Cell { @@ -29,7 +44,7 @@ int bottom_attach; int x_padding; int y_padding; - Etk_Fill_Policy_Flags fill_policy; + Etk_Table_Fill_Policy fill_policy; Etk_Widget *child; } Etk_Table_Cell; @@ -70,9 +85,8 @@ void etk_table_cell_clear(Etk_Table *table, int col, int row); void etk_table_resize(Etk_Table *table, int num_cols, int num_rows); -void etk_table_attach(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, - int top_attach, int bottom_attach, int x_padding, int y_padding, Etk_Fill_Policy_Flags fill_policy); -void etk_table_attach_defaults(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach); +void etk_table_attach(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach, int x_padding, int y_padding, Etk_Table_Fill_Policy fill_policy); +void etk_table_attach_default(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach); void etk_table_homogeneous_set(Etk_Table *table, Etk_Bool homogeneous); Etk_Bool etk_table_homogeneous_get(Etk_Table *table); ------------------------------------------------------------------------- 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