terminal.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright (C) 2003 Mooffie <mooffie@typo.co.il>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  16. #ifndef BDE_TERMINAL_H
  17. #define BDE_TERMINAL_H
  18. #include <config.h>
  19. // _XOPEN_SOURCE_EXTENDED is necessary for the wide-curses API
  20. #ifdef HAVE_WIDE_CURSES
  21. # define _XOPEN_SOURCE_EXTENDED 1
  22. #endif
  23. #if defined(HAVE_NCURSESW_NCURSES_H)
  24. # include <ncursesw/ncurses.h>
  25. #elif defined(HAVE_NCURSES_H)
  26. # include <ncurses.h>
  27. #else
  28. # include <curses.h>
  29. #endif
  30. // :TODO: move this gettext() stuff to a more relevant header?
  31. #ifdef USE_GETTEXT
  32. # include <libintl.h>
  33. # define _(String) gettext(String)
  34. # define gettext_noop(String) String
  35. # define N_(String) gettext_noop(String)
  36. #else
  37. # define _(String) String
  38. # define N_(String) String
  39. # define textdomain(Domain)
  40. # define bindtextdomain(Package, Directory)
  41. #endif
  42. class terminal {
  43. private:
  44. static bool initialized;
  45. public:
  46. static bool is_utf8; // Are we in UTF-8 locale?
  47. static bool force_iso88598; // Assume this is an ISO-8859-8 terminal?
  48. static bool is_fixed; // Do we use a "fixed" terminal? a terminal
  49. // which is not capable of displaying wide-
  50. // characetrs and combining characters.
  51. static bool is_color; // Does our terminal support colors?
  52. static bool use_default_colors;// ncurses' use_default_colors() used?
  53. static bool do_arabic_shaping; // instruct all widgets to do arabic shaping.
  54. static bool graphical_boxes; // Use graphical chars for the menu, scrollbar.
  55. static void init();
  56. static void finish();
  57. static bool was_ctrl_c_pressed();
  58. static bool is_interactive();
  59. static void determine_locale();
  60. static bool under_x11();
  61. };
  62. void DISABLE_SIGTSTP();
  63. #endif