2021-09-24 19:57:15 +02:00
|
|
|
#include <wups.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct ConfigItemBoolean {
|
2022-09-24 17:41:20 +02:00
|
|
|
char *configId;
|
2021-09-24 19:57:15 +02:00
|
|
|
WUPSConfigItemHandle handle;
|
|
|
|
bool defaultValue;
|
|
|
|
bool value;
|
|
|
|
char trueValue[32];
|
|
|
|
char falseValue[32];
|
|
|
|
void *callback;
|
|
|
|
} ConfigItemBoolean;
|
|
|
|
|
|
|
|
typedef void (*BooleanValueChangedCallback)(ConfigItemBoolean *, bool);
|
|
|
|
|
2022-09-24 17:41:20 +02:00
|
|
|
bool WUPSConfigItemBoolean_AddToCategory(WUPSConfigCategoryHandle cat, const char *configId, const char *displayName, bool defaultValue, BooleanValueChangedCallback callback);
|
|
|
|
bool WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *configId, const char *displayName, bool defaultValue, BooleanValueChangedCallback callback, const char *trueValue,
|
2021-09-24 19:57:15 +02:00
|
|
|
const char *falseValue);
|
|
|
|
|
2022-09-24 17:41:20 +02:00
|
|
|
#define WUPSConfigItemBoolean_AddToCategoryHandled(__config__, __cat__, __configIs__, __displayName__, __defaultValue__, __callback__) \
|
2022-02-03 16:24:36 +01:00
|
|
|
do { \
|
2022-09-24 17:41:20 +02:00
|
|
|
if (!WUPSConfigItemBoolean_AddToCategory(__cat__, __configIs__, __displayName__, __defaultValue__, __callback__)) { \
|
2022-02-03 16:24:36 +01:00
|
|
|
WUPSConfig_Destroy(__config__); \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-09-24 19:57:15 +02:00
|
|
|
|
|
|
|
#define WUPSConfigItemBoolean_AddToCategoryHandledEx(__config__, __cat__, __configID__, __displayName__, __defaultValue__, __callback__, __trueValue__, __falseValue__) \
|
2022-02-03 16:24:36 +01:00
|
|
|
do { \
|
|
|
|
if (!WUPSConfigItemBoolean_AddToCategoryEx(__cat__, __configID__, __displayName__, __defaultValue__, __callback__, __trueValue__, __falseValue__)) { \
|
|
|
|
WUPSConfig_Destroy(__config__); \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-09-24 19:57:15 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|