summaryrefslogtreecommitdiff
path: root/terminal.h
blob: ac809eba9a2219631f2855dc1fda33f9254eb15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (C) 2003 Mooffie <mooffie@typo.co.il>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.

#ifndef BDE_TERMINAL_H
#define BDE_TERMINAL_H

#include <config.h>

// _XOPEN_SOURCE_EXTENDED is necessary for the wide-curses API
#ifdef HAVE_WIDE_CURSES
# define _XOPEN_SOURCE_EXTENDED 1
#endif
 
#if defined(HAVE_NCURSESW_NCURSES_H)
# include <ncursesw/ncurses.h>
#elif defined(HAVE_NCURSES_H)
# include <ncurses.h>
#else
# include <curses.h>
#endif

// :TODO: move this gettext() stuff to a more relevant header?
#ifdef USE_GETTEXT
# include <libintl.h>
# define _(String) gettext(String)
# define gettext_noop(String) String
# define N_(String) gettext_noop(String)
#else
# define _(String) String
# define N_(String) String
# define textdomain(Domain)
# define bindtextdomain(Package, Directory)
#endif

class terminal {
private:
    static bool initialized;

public:
    static bool is_utf8;	// Are we in UTF-8 locale?

    static bool force_iso88598;	// Assume this is an ISO-8859-8 terminal?

    static bool is_fixed;	// Do we use a "fixed" terminal? a terminal
				// which is not capable of displaying wide-
				// characetrs and combining characters.

    static bool is_color;	// Does our terminal support colors?
    
    static bool use_default_colors;// ncurses' use_default_colors() used?

    static bool do_arabic_shaping; // instruct all widgets to do arabic shaping.

    static bool graphical_boxes;   // Use graphical chars for the menu, scrollbar.

    static void init();
    static void finish();
    static bool was_ctrl_c_pressed();
    static bool is_interactive();
    static void determine_locale();
    static bool under_x11();
};

void DISABLE_SIGTSTP();

#endif