nconf.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0 */
  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. typedef enum {
  31. NORMAL = 1,
  32. MAIN_HEADING,
  33. MAIN_MENU_BOX,
  34. MAIN_MENU_FORE,
  35. MAIN_MENU_BACK,
  36. MAIN_MENU_GREY,
  37. MAIN_MENU_HEADING,
  38. SCROLLWIN_TEXT,
  39. SCROLLWIN_HEADING,
  40. SCROLLWIN_BOX,
  41. DIALOG_TEXT,
  42. DIALOG_MENU_FORE,
  43. DIALOG_MENU_BACK,
  44. DIALOG_BOX,
  45. INPUT_BOX,
  46. INPUT_HEADING,
  47. INPUT_TEXT,
  48. INPUT_FIELD,
  49. FUNCTION_TEXT,
  50. FUNCTION_HIGHLIGHT,
  51. ATTR_MAX
  52. } attributes_t;
  53. extern attributes_t attributes[];
  54. typedef enum {
  55. F_HELP = 1,
  56. F_SYMBOL = 2,
  57. F_INSTS = 3,
  58. F_CONF = 4,
  59. F_BACK = 5,
  60. F_SAVE = 6,
  61. F_LOAD = 7,
  62. F_SEARCH = 8,
  63. F_EXIT = 9,
  64. } function_key;
  65. void set_colors(void);
  66. /* this changes the windows attributes !!! */
  67. void print_in_middle(WINDOW *win,
  68. int starty,
  69. int startx,
  70. int width,
  71. const char *string,
  72. chtype color);
  73. int get_line_length(const char *line);
  74. int get_line_no(const char *text);
  75. const char *get_line(const char *text, int line_no);
  76. void fill_window(WINDOW *win, const char *text);
  77. int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
  78. int dialog_inputbox(WINDOW *main_window,
  79. const char *title, const char *prompt,
  80. const char *init, char **resultp, int *result_len);
  81. void refresh_all_windows(WINDOW *main_window);
  82. void show_scroll_win(WINDOW *main_window,
  83. const char *title,
  84. const char *text);