grid.h - ltkx - GUI toolkit for X11 (old)
HTML git clone git://lumidify.org/ltkx.git (fast, but not encrypted)
HTML git clone https://lumidify.org/ltkx.git (encrypted, but very slow)
HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ltkx.git (over tor)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
grid.h (3680B)
---
1 /*
2 * This file is part of the Lumidify ToolKit (LTK)
3 * Copyright (c) 2016, 2017, 2018 lumidify <nobody@lumidify.org>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24 #ifndef _LTK_GRID_H_
25 #define _LTK_GRID_H_
26
27 /* Requires the following incude: <X11/Xlib.h>, "ltk.h" */
28
29 /*
30 * Struct to represent a grid widget.
31 */
32 typedef struct LtkGrid {
33 LtkWidget widget;
34 unsigned int rows;
35 unsigned int columns;
36 LtkWidget **widget_grid;
37 unsigned int *row_heights;
38 unsigned int *column_widths;
39 unsigned int *row_weights;
40 unsigned int *column_weights;
41 unsigned int *row_pos;
42 unsigned int *column_pos;
43 } LtkGrid;
44
45 /*
46 * Set the weight of a row in a grid.
47 * grid: The grid.
48 * row: The row.
49 * weight: The weight to set the row to.
50 */
51 void ltk_set_row_weight(LtkGrid * grid, int row, int weight);
52
53 /*
54 * Set the weight of a column in a grid.
55 * grid: The grid.
56 * column: The column.
57 * weight: The weight to set the row to.
58 */
59 void ltk_set_column_weight(LtkGrid * grid, int column, int weight);
60
61 /*
62 * Draw all the widgets in a grid.
63 * grid: The grid to draw the widgets of.
64 */
65 void ltk_draw_grid(LtkGrid * grid);
66
67 /*
68 * Create a grid.
69 * window: The window the grid will displayed on.
70 * rows: The number of rows in the grid.
71 * columns: The number of columns in the grid.
72 */
73 LtkGrid *ltk_create_grid(LtkWindow * window, int rows, int columns);
74
75 /*
76 * Destroy a grid.
77 * grid: Pointer to the grid.
78 */
79 void ltk_destroy_grid(LtkGrid *grid);
80
81 /*
82 * Recalculate the positions and dimensions of the
83 * columns, rows, and widgets in a grid.
84 * grid: Pointer to the grid.
85 */
86 void ltk_recalculate_grid(LtkGrid *grid);
87
88 /*
89 * Grid a widget.
90 * widget: Pointer to the widget.
91 * grid: The grid.
92 * row: The row to grid the widget in.
93 * column: The column to grid the widget in.
94 * rowspan: The amount of rows the widget should span.
95 * columnspan: The amount of columns the widget should span.
96 * sticky: Mask of the sticky values (LTK_STICKY_*).
97 */
98 void ltk_grid_widget(LtkWidget *widget, LtkGrid *grid, int row, int column,
99 int rowspan, int columnspan, unsigned short sticky);
100
101 /*
102 * Delegate a mouse press event on the grid to the proper widget.
103 * grid: The grid.
104 * event: The event to be handled.
105 */
106 void ltk_grid_mouse_press(LtkGrid *grid, XEvent event);
107
108 /*
109 * Delegate a mouse release event on the grid to the proper widget.
110 * grid: The grid.
111 * event: The event to be handled.
112 */
113 void ltk_grid_mouse_release(LtkGrid *grid, XEvent event);
114
115 /*
116 * Delegate a mouse motion event on the grid to the proper widget.
117 * grid: The grid.
118 * event: The event to be handled.
119 */
120 void ltk_grid_motion_notify(LtkGrid *grid, XEvent event);
121
122 #endif