grid.h (1693B)
1 /* 2 * Copyright (c) 2016-2024 lumidify <nobody@lumidify.org> 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef LTK_GRID_H 18 #define LTK_GRID_H 19 20 #include "widget.h" 21 #include "window.h" 22 23 #define LTK_GRID_SIGNAL_INVALID -1 24 25 /* 26 * Struct to represent a grid widget. 27 */ 28 typedef struct { 29 ltk_widget widget; 30 ltk_widget **widget_grid; 31 int *row_heights; 32 int *column_widths; 33 int *row_weights; 34 int *column_weights; 35 int *row_pos; 36 int *column_pos; 37 int rows; 38 int columns; 39 } ltk_grid; 40 41 /* FIXME: proper error handling for different errors in add/remove */ 42 ltk_grid *ltk_grid_create(ltk_window *window, int rows, int columns); 43 int ltk_grid_add( 44 ltk_grid *grid, ltk_widget *widget, 45 int row, int column, int row_span, int column_span, 46 ltk_sticky_mask sticky 47 ); 48 int ltk_grid_remove(ltk_grid *grid, ltk_widget *widget); 49 void ltk_grid_set_row_weight(ltk_grid *grid, int row, int weight); 50 void ltk_grid_set_column_weight(ltk_grid *grid, int column, int weight); 51 52 #endif /* LTK_GRID_H */