00001
00002 #ifndef EWL_GRID_H
00003 #define EWL_GRID_H
00004
00026 #define EWL_GRID_TYPE "grid"
00027
00032 #define EWL_GRID_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_GRID_TYPE))
00033
00037 typedef struct Ewl_Grid_Info Ewl_Grid_Info;
00038
00042 struct Ewl_Grid_Info
00043 {
00044 int current_size;
00045 int current_pos;
00046 int preferred_size;
00047 union {
00048 int size;
00049 float rel_size;
00050 } user;
00052 Ewl_Grid_Resize_Type resize_type;
00053 };
00054
00058 typedef struct Ewl_Grid Ewl_Grid;
00059
00064 #define EWL_GRID(grid) ((Ewl_Grid *)grid)
00065
00069 struct Ewl_Grid
00070 {
00071 Ewl_Container container;
00073 Ewl_Grid_Info *col_size;
00074 Ewl_Grid_Info *row_size;
00075 unsigned char data_dirty:1;
00077 unsigned char homogeneous_h:1;
00078 unsigned char homogeneous_v:1;
00080 Ewl_Orientation orientation;
00082 int rows;
00083 int cols;
00084 int space;
00086 char *map;
00087 };
00088
00092 typedef struct Ewl_Grid_Child Ewl_Grid_Child;
00093
00097 struct Ewl_Grid_Child
00098 {
00099 int start_col;
00100 int start_row;
00102 int end_col;
00103 int end_row;
00104 };
00105
00106 Ewl_Widget *ewl_grid_new(void);
00107 int ewl_grid_init(Ewl_Grid *g);
00108
00109 void ewl_grid_child_position_set(Ewl_Grid *g, Ewl_Widget *child,
00110 int start_col, int end_col, int start_row,
00111 int end_row);
00112 void ewl_grid_child_position_get(Ewl_Grid *g, Ewl_Widget *child,
00113 int *start_col, int *end_col, int *start_row,
00114 int *end_row);
00115
00116 void ewl_grid_dimensions_set(Ewl_Grid *g, int col, int row);
00117 void ewl_grid_dimensions_get(Ewl_Grid *g, int *col, int *row);
00118
00119 int ewl_grid_column_current_w_get(Ewl_Grid *g, int col);
00120 void ewl_grid_column_fixed_w_set(Ewl_Grid *g, int col, int width);
00121 int ewl_grid_column_fixed_w_get(Ewl_Grid *g, int col);
00122 void ewl_grid_column_relative_w_set(Ewl_Grid *g, int col, float relw);
00123 float ewl_grid_column_relative_w_get(Ewl_Grid *g, int col);
00124 void ewl_grid_column_preferred_w_use(Ewl_Grid *g, int col);
00125 void ewl_grid_column_w_remove(Ewl_Grid *g, int col);
00126
00127 int ewl_grid_row_current_h_get(Ewl_Grid *g, int row);
00128 void ewl_grid_row_fixed_h_set(Ewl_Grid *g, int row, int height);
00129 int ewl_grid_row_fixed_h_get(Ewl_Grid *g, int row);
00130 void ewl_grid_row_relative_h_set(Ewl_Grid *g, int col, float relh);
00131 float ewl_grid_row_relative_h_get(Ewl_Grid *g, int col);
00132 void ewl_grid_row_preferred_h_use(Ewl_Grid *g, int col);
00133 void ewl_grid_row_h_remove(Ewl_Grid *g, int row);
00134
00135 void ewl_grid_orientation_set(Ewl_Grid *g, Ewl_Orientation orientation);
00136 Ewl_Orientation ewl_grid_orientation_get(Ewl_Grid *g);
00137
00138 void ewl_grid_homogeneous_set(Ewl_Grid *g, unsigned int h);
00139
00140 void ewl_grid_hhomogeneous_set(Ewl_Grid *g, unsigned int h);
00141 unsigned int ewl_grid_hhomogeneous_get(Ewl_Grid *g);
00142
00143 void ewl_grid_vhomogeneous_set(Ewl_Grid *g, unsigned int h);
00144 unsigned int ewl_grid_vhomogeneous_get(Ewl_Grid *g);
00145
00146
00147
00148
00149 void ewl_grid_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
00150 void ewl_grid_cb_destroy(Ewl_Widget *w, void *ev_data , void *user_data);
00151 void ewl_grid_cb_child_add(Ewl_Container *p, Ewl_Widget *c);
00152 void ewl_grid_cb_child_remove(Ewl_Container *p, Ewl_Widget *c, int idx);
00153 void ewl_grid_cb_child_show(Ewl_Container *p, Ewl_Widget *child);
00154 void ewl_grid_cb_child_resize(Ewl_Container *p, Ewl_Widget *child,
00155 int size, Ewl_Orientation o);
00156
00161 #endif
00162