messenger-cli

Command-line user interface for GNUnet Messenger
Log | Files | Refs | README | LICENSE

util.h (2357B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2022--2025 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 <stdlib.h>
     30 #include <curses.h>
     31 
     32 #define UNUSED __attribute__((unused))
     33 
     34 #define UTIL_LOGO_ROWS 10
     35 #define UTIL_LOGO_COLS 28
     36 
     37 #define UTIL_UNIQUE_COLORS 6
     38 
     39 /**
     40  * Prints the main logo of the application
     41  * onto a specified view.
     42  *
     43  * @param[in,out] window Window view
     44  */
     45 void
     46 util_print_logo(WINDOW *window);
     47 
     48 /**
     49  * Print information on the right side of
     50  * the application besides the main logo.
     51  *
     52  * @param[in,out] window Window view
     53  * @param[in] info Information
     54  */
     55 void
     56 util_print_info(WINDOW *window,
     57                 const char *info);
     58 
     59 /**
     60  * Print a prompt with properly cut text
     61  * into a window view of the application.
     62  *
     63  * @param[in,out] window Window view
     64  * @param[in] prompt Prompt text
     65  */
     66 void
     67 util_print_prompt(WINDOW *window,
     68                   const char *prompt);
     69 
     70 /**
     71  * Initializes the unique color attributes
     72  * for using inside window views.
     73  */
     74 void
     75 util_init_unique_colors(void);
     76 
     77 /**
     78  * Enables a color attribute representing
     79  * a unique color for some specific data
     80  * pointer.
     81  *
     82  * @param[in,out] window Window view
     83  * @param[in] data Data pointer
     84  */
     85 void
     86 util_enable_unique_color(WINDOW *window,
     87                          const void *data);
     88 
     89 /**
     90  * Disables a color attribute representing
     91  * a unique color for some specific data
     92  * pointer.
     93  *
     94  * @param[in,out] window Window view
     95  * @param[in] data Data pointer
     96  */
     97 void
     98 util_disable_unique_color(WINDOW *window,
     99                           const void *data);
    100 
    101 #endif /* UTIL_H_ */