GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
include
widgets
gp_widget_grid.h
Go to the documentation of this file.
1
//SPDX-License-Identifier: LGPL-2.0-or-later
2
3
/*
4
5
Copyright (c) 2014-2024 Cyril Hrubis <metan@ucw.cz>
6
7
*/
8
81
#ifndef GP_WIDGET_GRID_H
82
#define GP_WIDGET_GRID_H
83
84
#include <stdint.h>
85
89
enum
gp_widget_grid_flags
{
91
GP_WIDGET_GRID_FRAME
= 0x01,
93
GP_WIDGET_GRID_UNIFORM
= 0x02,
94
};
95
96
/* row/column cell sizes, offsets and fill coefs */
97
struct
gp_widget_grid_cell {
98
unsigned
int
size;
99
unsigned
int
off;
100
uint8_t fill;
101
};
102
104
typedef
struct
gp_widget_grid_gap
{
111
uint8_t
padd
;
120
uint8_t
fill
;
121
}
gp_widget_grid_gap
;
122
134
gp_widget
*
gp_widget_grid_new
(
unsigned
int
cols,
unsigned
int
rows,
135
enum
gp_widget_grid_flags
flags);
136
143
unsigned
int
gp_widget_grid_cols_get
(
gp_widget
*self);
144
151
unsigned
int
gp_widget_grid_rows_get
(
gp_widget
*self);
152
166
const
gp_widget_grid_gap
*
gp_widget_grid_cols_gaps_get
(
gp_widget
*self);
167
181
const
gp_widget_grid_gap
*
gp_widget_grid_rows_gaps_get
(
gp_widget
*self);
182
189
enum
gp_widget_grid_flags
gp_widget_grid_flags_get
(
gp_widget
*self);
190
197
void
gp_widget_grid_flags_set
(
gp_widget
*self,
enum
gp_widget_grid_flags
flags);
198
213
gp_widget
*
gp_widget_grid_put
(
gp_widget
*self,
unsigned
int
col,
unsigned
int
row,
214
gp_widget
*child);
215
225
gp_widget
*
gp_widget_grid_rem
(
gp_widget
*self,
unsigned
int
col,
unsigned
int
row);
226
236
gp_widget
*
gp_widget_grid_get
(
gp_widget
*self,
unsigned
int
col,
unsigned
int
row);
237
245
static
inline
void
gp_widget_grid_del
(
gp_widget
*self,
unsigned
col,
unsigned
int
row)
246
{
247
gp_widget
*ret =
gp_widget_grid_rem
(self, col, row);
248
249
gp_widget_free
(ret);
250
}
251
259
void
gp_widget_grid_rows_ins
(
gp_widget
*self,
unsigned
int
row,
unsigned
int
rows);
260
267
static
inline
void
gp_widget_grid_row_ins
(
gp_widget
*self,
unsigned
int
row)
268
{
269
gp_widget_grid_rows_ins
(self, row, 1);
270
}
271
280
unsigned
int
gp_widget_grid_rows_append
(
gp_widget
*self,
unsigned
int
rows);
281
289
static
inline
unsigned
int
gp_widget_grid_row_append
(
gp_widget
*self)
290
{
291
return
gp_widget_grid_rows_append
(self, 1);
292
}
293
300
void
gp_widget_grid_rows_prepend
(
gp_widget
*self,
unsigned
int
rows);
301
307
static
inline
void
gp_widget_grid_row_prepend
(
gp_widget
*self)
308
{
309
return
gp_widget_grid_rows_prepend
(self, 1);
310
}
311
322
void
gp_widget_grid_rows_del
(
gp_widget
*self,
unsigned
int
row,
unsigned
int
rows);
323
333
static
inline
void
gp_widget_grid_row_del
(
gp_widget
*self,
unsigned
int
row)
334
{
335
gp_widget_grid_rows_del
(self, row, 1);
336
}
337
345
void
gp_widget_grid_cols_ins
(
gp_widget
*self,
unsigned
int
col,
unsigned
int
cols);
346
353
static
inline
void
gp_widget_grid_col_ins
(
gp_widget
*self,
unsigned
int
col)
354
{
355
gp_widget_grid_cols_ins
(self, col, 1);
356
}
357
366
unsigned
int
gp_widget_grid_cols_append
(
gp_widget
*self,
unsigned
int
cols);
367
375
static
inline
unsigned
int
gp_widget_grid_col_append
(
gp_widget
*self)
376
{
377
return
gp_widget_grid_cols_append
(self, 1);
378
}
379
386
void
gp_widget_grid_cols_prepend
(
gp_widget
*self,
unsigned
int
cols);
387
393
static
inline
void
gp_widget_grid_col_prepend
(
gp_widget
*self)
394
{
395
return
gp_widget_grid_cols_prepend
(self, 1);
396
}
397
408
void
gp_widget_grid_cols_del
(
gp_widget
*self,
unsigned
int
col,
unsigned
int
cols);
409
419
static
inline
void
gp_widget_grid_col_del
(
gp_widget
*self,
unsigned
int
col)
420
{
421
gp_widget_grid_cols_del
(self, col, 1);
422
}
423
424
433
void
gp_widget_grid_border_set
(
gp_widget
*self,
enum
gp_widget_border
border,
434
int
padd,
int
fill);
435
443
static
inline
void
gp_widget_grid_no_border
(
gp_widget
*self)
444
{
445
gp_widget_grid_border_set
(self,
GP_WIDGET_BORDER_ALL
, 0, 0);
446
}
447
461
void
gp_widget_grid_col_fill_set
(
gp_widget
*self,
unsigned
int
col, uint8_t fill);
462
476
void
gp_widget_grid_row_fill_set
(
gp_widget
*self,
unsigned
int
row, uint8_t fill);
477
478
#endif
/* GP_WIDGET_GRID_H */
gp_widget_free
void gp_widget_free(gp_widget *self)
Frees widget memory.
gp_widget_grid_cols_get
unsigned int gp_widget_grid_cols_get(gp_widget *self)
Returns number of grid columns.
gp_widget_grid_row_prepend
static void gp_widget_grid_row_prepend(gp_widget *self)
Prepends a new (empty) row at the top of the grid.
Definition
gp_widget_grid.h:307
gp_widget_grid_put
gp_widget * gp_widget_grid_put(gp_widget *self, unsigned int col, unsigned int row, gp_widget *child)
Puts a child widget into a frame widget.
gp_widget_grid_rows_ins
void gp_widget_grid_rows_ins(gp_widget *self, unsigned int row, unsigned int rows)
Inserts new (empty) rows to the grid.
gp_widget_grid_cols_prepend
void gp_widget_grid_cols_prepend(gp_widget *self, unsigned int cols)
Prepends a new (empty) columns at the left side of the grid.
gp_widget_grid_new
gp_widget * gp_widget_grid_new(unsigned int cols, unsigned int rows, enum gp_widget_grid_flags flags)
Allocates and initializes a widget grid.
gp_widget_grid_rows_del
void gp_widget_grid_rows_del(gp_widget *self, unsigned int row, unsigned int rows)
Delete rows from the grid.
gp_widget_grid_rows_get
unsigned int gp_widget_grid_rows_get(gp_widget *self)
Returns number of grid rows.
gp_widget_grid_cols_ins
void gp_widget_grid_cols_ins(gp_widget *self, unsigned int col, unsigned int cols)
Inserts new (empty) columns to the grid.
gp_widget_grid_rows_append
unsigned int gp_widget_grid_rows_append(gp_widget *self, unsigned int rows)
Appends a new (empty) rows at the bottom of the grid.
gp_widget_grid_col_del
static void gp_widget_grid_col_del(gp_widget *self, unsigned int col)
Delete column from the grid.
Definition
gp_widget_grid.h:419
gp_widget_grid_flags_get
enum gp_widget_grid_flags gp_widget_grid_flags_get(gp_widget *self)
gp_widget_grid_del
static void gp_widget_grid_del(gp_widget *self, unsigned col, unsigned int row)
Deletes a child widget at col, row from a grid.
Definition
gp_widget_grid.h:245
gp_widget_grid_row_ins
static void gp_widget_grid_row_ins(gp_widget *self, unsigned int row)
Inserts new (empty) row to the grid.
Definition
gp_widget_grid.h:267
gp_widget_grid_col_append
static unsigned int gp_widget_grid_col_append(gp_widget *self)
Appends a new (empty) colum at the right side of the grid.
Definition
gp_widget_grid.h:375
gp_widget_grid_flags
gp_widget_grid_flags
A widget grid flags.
Definition
gp_widget_grid.h:89
GP_WIDGET_GRID_FRAME
@ GP_WIDGET_GRID_FRAME
Definition
gp_widget_grid.h:91
GP_WIDGET_GRID_UNIFORM
@ GP_WIDGET_GRID_UNIFORM
Definition
gp_widget_grid.h:93
gp_widget_grid_col_ins
static void gp_widget_grid_col_ins(gp_widget *self, unsigned int col)
Inserts new (empty) column to the grid.
Definition
gp_widget_grid.h:353
gp_widget_grid_rows_prepend
void gp_widget_grid_rows_prepend(gp_widget *self, unsigned int rows)
Prepends a new (empty) rows at the top of the grid.
gp_widget_grid_col_prepend
static void gp_widget_grid_col_prepend(gp_widget *self)
Prepends a new (empty) column at the left side of the grid.
Definition
gp_widget_grid.h:393
gp_widget_grid_col_fill_set
void gp_widget_grid_col_fill_set(gp_widget *self, unsigned int col, uint8_t fill)
Sets grid cell column fill coeficient.
gp_widget_grid_flags_set
void gp_widget_grid_flags_set(gp_widget *self, enum gp_widget_grid_flags flags)
gp_widget_grid_no_border
static void gp_widget_grid_no_border(gp_widget *self)
Disables grid padd and fill.
Definition
gp_widget_grid.h:443
gp_widget_grid_row_append
static unsigned int gp_widget_grid_row_append(gp_widget *self)
Appends a new (empty) row at the bottom of the grid.
Definition
gp_widget_grid.h:289
gp_widget_grid_cols_append
unsigned int gp_widget_grid_cols_append(gp_widget *self, unsigned int cols)
Appends a new (empty) colums at the right side of the grid.
gp_widget_grid_rem
gp_widget * gp_widget_grid_rem(gp_widget *self, unsigned int col, unsigned int row)
Removes child widget at col, row from a grid.
gp_widget_grid_cols_gaps_get
const gp_widget_grid_gap * gp_widget_grid_cols_gaps_get(gp_widget *self)
Returns a widget grid horizontal borders.
gp_widget_grid_row_fill_set
void gp_widget_grid_row_fill_set(gp_widget *self, unsigned int row, uint8_t fill)
Sets grid cell row fill coeficient.
gp_widget_grid_get
gp_widget * gp_widget_grid_get(gp_widget *self, unsigned int col, unsigned int row)
Returns a pointer to a widget at col, row.
gp_widget_grid_cols_del
void gp_widget_grid_cols_del(gp_widget *self, unsigned int col, unsigned int cols)
Delete columns from the grid.
gp_widget_grid_rows_gaps_get
const gp_widget_grid_gap * gp_widget_grid_rows_gaps_get(gp_widget *self)
Returns a widget grid vertical borders.
gp_widget_grid_row_del
static void gp_widget_grid_row_del(gp_widget *self, unsigned int row)
Removes row from the grid.
Definition
gp_widget_grid.h:333
gp_widget_grid_border_set
void gp_widget_grid_border_set(gp_widget *self, enum gp_widget_border border, int padd, int fill)
Sets border padd or fill coeficients.
gp_widget_border
gp_widget_border
Describes borders.
Definition
gp_widget_types.h:31
GP_WIDGET_BORDER_ALL
@ GP_WIDGET_BORDER_ALL
All borders selected.
Definition
gp_widget_types.h:47
gp_widget_grid_gap
Describes a row or a column border or a gap between cells.
Definition
gp_widget_grid.h:104
gp_widget_grid_gap::padd
uint8_t padd
A padding, static part of the border/gap.
Definition
gp_widget_grid.h:111
gp_widget_grid_gap::fill
uint8_t fill
A dynamic part of the border/gap.
Definition
gp_widget_grid.h:120
gp_widget
A widget base.
Definition
gp_widget.h:28
Generated by
1.9.8