2023-12-10 23:19:58 +08:00
|
|
|
/*
|
|
|
|
|
* lib/ui/src/ui_debug.h
|
|
|
|
|
*
|
2026-06-27 23:50:18 +08:00
|
|
|
* Copyright (c) 2023-2026, Liu Chao <hello@lcui.dev> All rights reserved.
|
2023-12-10 23:19:58 +08:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
2026-06-27 23:50:18 +08:00
|
|
|
* This file is part of LCUI, distributed under the MIT License found
|
|
|
|
|
* in the LICENSE.TXT file in the root directory of this source tree.
|
2023-12-10 23:19:58 +08:00
|
|
|
*/
|
|
|
|
|
|
2022-02-20 22:12:44 +08:00
|
|
|
void ui_widget_to_string(ui_widget_t *w, char *str);
|
2024-11-07 23:44:01 +08:00
|
|
|
void ui_widget_size_to_string(ui_widget_t *w, char str[40]);
|
|
|
|
|
void ui_widget_min_size_to_string(ui_widget_t *w, char str[40]);
|
2022-02-20 22:12:44 +08:00
|
|
|
|
|
|
|
|
#define UI_WIDGET_STR(W, STR) \
|
2026-06-03 00:15:50 +08:00
|
|
|
char STR[256]; \
|
|
|
|
|
ui_widget_to_string(W, STR);
|
2022-02-20 22:12:44 +08:00
|
|
|
|
|
|
|
|
#define UI_WIDGET_SIZE_STR(W, STR) \
|
2026-06-03 00:15:50 +08:00
|
|
|
char STR[32]; \
|
|
|
|
|
ui_widget_size_to_string(W, STR);
|
2022-02-20 22:12:44 +08:00
|
|
|
|
2024-11-07 23:44:01 +08:00
|
|
|
#define UI_WIDGET_MIN_SIZE_STR(W, STR) \
|
2026-06-03 00:15:50 +08:00
|
|
|
char STR[32]; \
|
|
|
|
|
ui_widget_min_size_to_string(W, STR);
|
2024-11-07 23:44:01 +08:00
|
|
|
|
2022-02-20 22:12:44 +08:00
|
|
|
#ifdef UI_DEBUG_ENABLED
|
|
|
|
|
extern int ui_debug_msg_indent;
|
|
|
|
|
|
2026-06-03 00:15:50 +08:00
|
|
|
/* clang-format off */
|
|
|
|
|
#define UI_DEBUG_BEGIN do {
|
|
|
|
|
#define UI_DEBUG_END } while (0)
|
|
|
|
|
/* clang-format on */
|
|
|
|
|
|
|
|
|
|
#define UI_DEBUG_MSG(FMT, ...) \
|
|
|
|
|
logger_log(LOGGER_LEVEL_DEBUG, "%*s" FMT "\n", \
|
|
|
|
|
ui_debug_msg_indent * 4, "", ##__VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
#define UI_DEBUG_INDENT_INC ++ui_debug_msg_indent
|
|
|
|
|
#define UI_DEBUG_INDENT_DEC --ui_debug_msg_indent
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
/* clang-format off */
|
|
|
|
|
#define UI_DEBUG_BEGIN do { if (0) {
|
|
|
|
|
#define UI_DEBUG_END } } while (0)
|
|
|
|
|
/* clang-format on */
|
|
|
|
|
|
|
|
|
|
#define UI_DEBUG_MSG(FMT, ...)
|
|
|
|
|
#define UI_DEBUG_INDENT_INC
|
|
|
|
|
#define UI_DEBUG_INDENT_DEC
|
2022-02-20 22:12:44 +08:00
|
|
|
|
|
|
|
|
#endif
|