modified: myjupyterlab.sh
[GalaxyCodeBases.git] / tools / vbindiff / curses / ConWin.hpp
blob956c3a26777fd751c75b1794d4eb5484c5fac494
1 //--------------------------------------------------------------------
2 //
3 // Visual Binary Diff
4 // Copyright 1997-2005 by Christopher J. Madsen
5 //
6 // Support class for curses applications
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of
11 // the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //--------------------------------------------------------------------
22 #ifndef INCLUDED_CONWIN_HPP
24 #define INCLUDED_CONWIN_HPP
26 #include <panel.h>
27 #undef border // It interferes with my member function
29 #define KEY_ESCAPE 0x1B
30 #define KEY_TAB 0x09
31 #define KEY_DELETE 0x7F
32 #define KEY_RETURN 0x0D
34 enum Style {
35 cBackground = 0,
36 cPromptWin,
37 cPromptKey,
38 cPromptBdr,
39 cCurrentMode,
40 cFileName,
41 cFileWin,
42 cFileDiff,
43 cFileEdit
46 class ConWindow
48 protected:
49 PANEL *pan;
50 WINDOW *win;
52 public:
53 ConWindow();
54 ~ConWindow();
55 void init(short x, short y, short width, short height, Style style);
56 void close();
58 void border() { ::box(win, 0, 0); };
59 void clear() { werase(win); };
60 void move(short x, short y) { move_panel(pan, y, x); };
61 ///void put(short x, short y, const String& s);
62 void put(short x, short y, const char* s) { mvwaddstr(win, y, x, s); };
63 void putAttribs(short x, short y, Style color, short count);
64 void putChar(short x, short y, char c, short count);
65 int readKey();
66 void resize(short width, short height);
67 void setAttribs(Style color);
68 void setCursor(short x, short y);
69 void update(unsigned short margin=0) {};
71 void hide() { hide_panel(pan); };
72 void show() { show_panel(pan); };
74 static void getScreenSize(int& x, int& y) { getmaxyx(curscr, y, x); };
75 static void hideCursor() { curs_set(0); };
76 static void showCursor(bool insert=true) { curs_set(insert ? 1 : 2); };
77 static void shutdown();
78 static bool startup();
79 }; // end ConWindow
81 #endif // INCLUDED_CONWIN_HPP
83 //--------------------------------------------------------------------
84 // Local Variables:
85 // mode: c++
86 // c-file-style: "cjm"
87 // End: