1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* NAppGUI Cross-platform C SDK
* 2015-2025 Francisco Garcia Collado
* MIT Licence
* https://nappgui.com/en/legal/license.html
*
* File: osbutton.c
*
*/
/* Operating System native button */
#include "osbutton.h"
#include "osbutton.inl"
#include <sewer/cassert.h>
/*---------------------------------------------------------------------------*/
bool_t _osbutton_text_allowed(const uint32_t flags)
{
switch (button_get_type(flags))
{
case ekBUTTON_PUSH:
case ekBUTTON_CHECK2:
case ekBUTTON_CHECK3:
case ekBUTTON_RADIO:
return TRUE;
case ekBUTTON_FLAT:
case ekBUTTON_FLATGLE:
return FALSE;
cassert_default();
}
return FALSE;
}
/*---------------------------------------------------------------------------*/
bool_t _osbutton_image_allowed(const uint32_t flags)
{
switch (button_get_type(flags))
{
case ekBUTTON_CHECK2:
case ekBUTTON_CHECK3:
case ekBUTTON_RADIO:
return FALSE;
case ekBUTTON_PUSH:
case ekBUTTON_FLAT:
case ekBUTTON_FLATGLE:
return TRUE;
cassert_default();
}
return FALSE;
}
/*---------------------------------------------------------------------------*/
void _osbutton_detach_and_destroy(OSButton **button, OSPanel *panel)
{
cassert_no_null(button);
osbutton_detach(*button, panel);
osbutton_destroy(button);
}
/*---------------------------------------------------------------------------*/