GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
include
widgets
gp_widget_tabs.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
23
#ifndef GP_WIDGET_TABS_H
24
#define GP_WIDGET_TABS_H
25
27
enum
gp_widget_tabs_event_type
{
29
GP_WIDGET_TABS_DEACTIVATED
,
31
GP_WIDGET_TABS_ACTIVATED
,
32
};
33
44
gp_widget
*
gp_widget_tabs_new
(
unsigned
int
tabs_cnt,
unsigned
int
active_tab,
45
const
char
*tab_labels[],
int
flags);
46
54
unsigned
int
gp_widget_tabs_cnt
(
gp_widget
*self);
55
65
gp_widget
*
gp_widget_tabs_put
(
gp_widget
*self,
unsigned
int
tab,
66
gp_widget
*child);
67
76
static
inline
gp_widget
*
gp_widget_tabs_rem
(
gp_widget
*self,
unsigned
int
tab)
77
{
78
return
gp_widget_tabs_put
(self, tab, NULL);
79
}
80
89
gp_widget
*
gp_widget_tabs_child_get
(
gp_widget
*self,
unsigned
int
tab);
90
91
static
inline
void
gp_widget_tabs_del(
gp_widget
*self,
unsigned
int
tab)
92
{
93
gp_widget
*ret =
gp_widget_tabs_rem
(self, tab);
94
95
gp_widget_free
(ret);
96
}
97
106
void
gp_widget_tabs_tab_ins
(
gp_widget
*self,
unsigned
int
tab,
107
const
char
*label,
gp_widget
*child);
108
118
unsigned
int
gp_widget_tabs_tab_append
(
gp_widget
*self,
119
const
char
*label,
gp_widget
*child);
120
128
static
inline
void
gp_widget_tabs_tab_prepend
(
gp_widget
*self,
129
const
char
*label,
130
gp_widget
*child)
131
{
132
return
gp_widget_tabs_tab_ins
(self, 0, label, child);
133
}
134
143
gp_widget
*
gp_widget_tabs_tab_rem
(
gp_widget
*self,
unsigned
int
tab);
144
153
int
gp_widget_tabs_tab_rem_by_child
(
gp_widget
*self,
gp_widget
*child);
154
165
static
inline
int
gp_widget_tabs_tab_del_by_child
(
gp_widget
*self,
gp_widget
*child)
166
{
167
if
(!
gp_widget_tabs_tab_rem_by_child
(self, child))
168
return
1;
169
170
gp_widget_free
(child);
171
172
return
0;
173
}
174
183
static
inline
void
gp_widget_tabs_tab_del
(
gp_widget
*self,
unsigned
int
tab)
184
{
185
gp_widget
*ret =
gp_widget_tabs_tab_rem
(self, tab);
186
187
gp_widget_free
(ret);
188
}
189
197
unsigned
int
gp_widget_tabs_active_get
(
gp_widget
*self);
198
206
gp_widget
*
gp_widget_tabs_active_child_get
(
gp_widget
*self);
207
214
void
gp_widget_tabs_active_set
(
gp_widget
*self,
unsigned
int
tab);
215
223
void
gp_widget_tabs_active_set_rel
(
gp_widget
*self,
int
dir,
int
wrap_around);
224
233
int
gp_widget_tabs_tab_by_child
(
gp_widget
*self,
gp_widget
*child);
234
243
const
char
*
gp_widget_tabs_label_get
(
gp_widget
*self,
unsigned
int
tab);
244
252
const
char
*
gp_widget_tabs_active_label_get
(
gp_widget
*self);
253
254
#endif
/* GP_WIDGET_TABS_H */
gp_widget_free
void gp_widget_free(gp_widget *self)
Frees widget memory.
gp_widget_tabs_tab_del_by_child
static int gp_widget_tabs_tab_del_by_child(gp_widget *self, gp_widget *child)
Delete a tab identified by a child widget.
Definition
gp_widget_tabs.h:165
gp_widget_tabs_child_get
gp_widget * gp_widget_tabs_child_get(gp_widget *self, unsigned int tab)
Returns a pointer to a child in a tab.
gp_widget_tabs_new
gp_widget * gp_widget_tabs_new(unsigned int tabs_cnt, unsigned int active_tab, const char *tab_labels[], int flags)
Allocates and initializes a new tabs widget.
gp_widget_tabs_tab_prepend
static void gp_widget_tabs_tab_prepend(gp_widget *self, const char *label, gp_widget *child)
Appends a tab at the begining.
Definition
gp_widget_tabs.h:128
gp_widget_tabs_tab_rem_by_child
int gp_widget_tabs_tab_rem_by_child(gp_widget *self, gp_widget *child)
Remove a tab identified by a child widget.
gp_widget_tabs_tab_append
unsigned int gp_widget_tabs_tab_append(gp_widget *self, const char *label, gp_widget *child)
Appends a tab at the end.
gp_widget_tabs_event_type
gp_widget_tabs_event_type
A gp_widget_event::sub_type for a tabs widget.
Definition
gp_widget_tabs.h:27
GP_WIDGET_TABS_ACTIVATED
@ GP_WIDGET_TABS_ACTIVATED
A tab activated.
Definition
gp_widget_tabs.h:31
GP_WIDGET_TABS_DEACTIVATED
@ GP_WIDGET_TABS_DEACTIVATED
A tab is deactivated.
Definition
gp_widget_tabs.h:29
gp_widget_tabs_active_set_rel
void gp_widget_tabs_active_set_rel(gp_widget *self, int dir, int wrap_around)
Set active tab position relative to the currently active tab.
gp_widget_tabs_tab_by_child
int gp_widget_tabs_tab_by_child(gp_widget *self, gp_widget *child)
Returns tab idx by child pointer.
gp_widget_tabs_active_get
unsigned int gp_widget_tabs_active_get(gp_widget *self)
Returns active tab index.
gp_widget_tabs_active_child_get
gp_widget * gp_widget_tabs_active_child_get(gp_widget *self)
Returns active tab child widget.
gp_widget_tabs_label_get
const char * gp_widget_tabs_label_get(gp_widget *self, unsigned int tab)
Returns a tab label.
gp_widget_tabs_tab_rem
gp_widget * gp_widget_tabs_tab_rem(gp_widget *self, unsigned int tab)
Remove a tab at position.
gp_widget_tabs_cnt
unsigned int gp_widget_tabs_cnt(gp_widget *self)
Returns number of tabs.
gp_widget_tabs_tab_ins
void gp_widget_tabs_tab_ins(gp_widget *self, unsigned int tab, const char *label, gp_widget *child)
Adds a tab at an offset.
gp_widget_tabs_put
gp_widget * gp_widget_tabs_put(gp_widget *self, unsigned int tab, gp_widget *child)
Puts a child into a tab.
gp_widget_tabs_active_set
void gp_widget_tabs_active_set(gp_widget *self, unsigned int tab)
Set active tab.
gp_widget_tabs_tab_del
static void gp_widget_tabs_tab_del(gp_widget *self, unsigned int tab)
Delete a tab at position.
Definition
gp_widget_tabs.h:183
gp_widget_tabs_rem
static gp_widget * gp_widget_tabs_rem(gp_widget *self, unsigned int tab)
Removes child from a tab and returns pointer to it.
Definition
gp_widget_tabs.h:76
gp_widget_tabs_active_label_get
const char * gp_widget_tabs_active_label_get(gp_widget *self)
Returns active tab label.
gp_widget
A widget base.
Definition
gp_widget.h:28
Generated by
1.9.8