nconf.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
  4. *
  5. * Derived from menuconfig.
  6. */
  7. #include <ctype.h>
  8. #include <errno.h>
  9. #include <fcntl.h>
  10. #include <limits.h>
  11. #include <stdarg.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14. #include <unistd.h>
  15. #include <ncurses.h>
  16. #include <menu.h>
  17. #include <panel.h>
  18. #include <form.h>
  19. #include <stdio.h>
  20. #include <time.h>
  21. #include <sys/time.h>
  22. #define max(a, b) ({\
  23. typeof(a) _a = a;\
  24. typeof(b) _b = b;\
  25. _a > _b ? _a : _b; })
  26. #define min(a, b) ({\
  27. typeof(a) _a = a;\
  28. typeof(b) _b = b;\
  29. _a < _b ? _a : _b; })
  30. extern int attr_normal;
  31. extern int attr_main_heading;
  32. extern int attr_main_menu_box;
  33. extern int attr_main_menu_fore;
  34. extern int attr_main_menu_back;
  35. extern int attr_main_menu_grey;
  36. extern int attr_main_menu_heading;
  37. extern int attr_scrollwin_text;
  38. extern int attr_scrollwin_heading;
  39. extern int attr_scrollwin_box;
  40. extern int attr_dialog_text;
  41. extern int attr_dialog_menu_fore;
  42. extern int attr_dialog_menu_back;
  43. extern int attr_dialog_box;
  44. extern int attr_input_box;
  45. extern int attr_input_heading;
  46. extern int attr_input_text;
  47. extern int attr_input_field;
  48. extern int attr_function_text;
  49. extern int attr_function_highlight;
  50. typedef enum {
  51. F_HELP = 1,
  52. F_SYMBOL = 2,
  53. F_INSTS = 3,
  54. F_CONF = 4,
  55. F_BACK = 5,
  56. F_SAVE = 6,
  57. F_LOAD = 7,
  58. F_SEARCH = 8,
  59. F_EXIT = 9,
  60. } function_key;
  61. void set_colors(void);
  62. /* this changes the windows attributes !!! */
  63. void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs);
  64. int get_line_length(const char *line);
  65. int get_line_no(const char *text);
  66. const char *get_line(const char *text, int line_no);
  67. void fill_window(WINDOW *win, const char *text);
  68. int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
  69. int dialog_inputbox(WINDOW *main_window,
  70. const char *title, const char *prompt,
  71. const char *init, char **resultp, int *result_len);
  72. void refresh_all_windows(WINDOW *main_window);
  73. void show_scroll_win(WINDOW *main_window,
  74. const char *title,
  75. const char *text);