util.h (2337B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2022--2026 GNUnet e.V. 4 5 GNUnet is free software: you can redistribute it and/or modify it 6 under the terms of the GNU Affero General Public License as published 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 /* 21 * @author Tobias Frisch 22 * @file util.h 23 */ 24 25 #ifndef UTIL_H_ 26 #define UTIL_H_ 27 28 #include <stdbool.h> 29 #include <curses.h> 30 31 #define UNUSED __attribute__((unused)) 32 33 #define UTIL_LOGO_ROWS 10 34 #define UTIL_LOGO_COLS 28 35 36 #define UTIL_UNIQUE_COLORS 6 37 38 /** 39 * Prints the main logo of the application 40 * onto a specified view. 41 * 42 * @param[in,out] window Window view 43 */ 44 void 45 util_print_logo(WINDOW *window); 46 47 /** 48 * Print information on the right side of 49 * the application besides the main logo. 50 * 51 * @param[in,out] window Window view 52 * @param[in] info Information 53 */ 54 void 55 util_print_info(WINDOW *window, 56 const char *info); 57 58 /** 59 * Print a prompt with properly cut text 60 * into a window view of the application. 61 * 62 * @param[in,out] window Window view 63 * @param[in] prompt Prompt text 64 */ 65 void 66 util_print_prompt(WINDOW *window, 67 const char *prompt); 68 69 /** 70 * Initializes the unique color attributes 71 * for using inside window views. 72 */ 73 void 74 util_init_unique_colors(void); 75 76 /** 77 * Enables a color attribute representing 78 * a unique color for some specific data 79 * pointer. 80 * 81 * @param[in,out] window Window view 82 * @param[in] data Data pointer 83 */ 84 void 85 util_enable_unique_color(WINDOW *window, 86 const void *data); 87 88 /** 89 * Disables a color attribute representing 90 * a unique color for some specific data 91 * pointer. 92 * 93 * @param[in,out] window Window view 94 * @param[in] data Data pointer 95 */ 96 void 97 util_disable_unique_color(WINDOW *window, 98 const void *data); 99 100 #endif /* UTIL_H_ */