GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_widget_switch.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
29#ifndef GP_WIDGET_SWITCH_H
30#define GP_WIDGET_SWITCH_H
31
34
48gp_widget *gp_widget_switch_new(const char *on_label, gp_widget_stock_type on_stock,
49 const char *off_label, gp_widget_stock_type off_stock,
50 bool set);
51
67static inline gp_widget *gp_widget_switch_new_ev(const char *on_label,
68 gp_widget_stock_type on_stock,
69 const char *off_label,
70 gp_widget_stock_type off_stock,
71 bool set,
72 int (*on_event)(gp_widget_event *ev),
73 void *priv)
74{
75 gp_widget *ret = gp_widget_switch_new(on_label, on_stock, off_label, off_stock, set);
76
77 gp_widget_on_event_set(ret, on_event, priv);
78
79 return ret;
80}
81
82#endif /* GP_WIDGET_SWITCH_H */
A bollean widget class.
void gp_widget_on_event_set(gp_widget *self, int(*on_event)(gp_widget_event *), void *priv)
Sets a widget event handler.
A stock image widget.
gp_widget_stock_type
Stock image type.
static gp_widget * gp_widget_switch_new_ev(const char *on_label, gp_widget_stock_type on_stock, const char *off_label, gp_widget_stock_type off_stock, bool set, int(*on_event)(gp_widget_event *ev), void *priv)
Allocate and initialize new switch widget.
gp_widget * gp_widget_switch_new(const char *on_label, gp_widget_stock_type on_stock, const char *off_label, gp_widget_stock_type off_stock, bool set)
Allocate and initialize new switch widget.
Event structure passed to widget event handler.
A widget base.
Definition gp_widget.h:28