1 | /* pmtty.h -*- C++ -*-
|
---|
2 | Copyright (c) 1996 Eberhard Mattes
|
---|
3 |
|
---|
4 | This file is part of pmgdb.
|
---|
5 |
|
---|
6 | pmgdb is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | pmgdb is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with pmgdb; see the file COPYING. If not, write to
|
---|
18 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
---|
19 | Boston, MA 02111-1307, USA. */
|
---|
20 |
|
---|
21 |
|
---|
22 | // A frame window showing scrollable text; with tty-like output and cursor
|
---|
23 |
|
---|
24 | class pmtty : public pmtxt
|
---|
25 | {
|
---|
26 | public:
|
---|
27 | typedef pmtxt parent;
|
---|
28 |
|
---|
29 | // Constructors and destructors, initialization
|
---|
30 | pmtty (pmapp *app, unsigned id, ULONG frame_flags, const SWP *pswp,
|
---|
31 | const char *fontnamesize = 0);
|
---|
32 | ~pmtty ();
|
---|
33 | void delete_all ();
|
---|
34 |
|
---|
35 | // Painting
|
---|
36 | void puts (const char *s, size_t len);
|
---|
37 | void puts (const char *s) { puts (s, strlen (s)); }
|
---|
38 | void backspace (int n = 1);
|
---|
39 | void cursor (bool on);
|
---|
40 |
|
---|
41 | // Attributes
|
---|
42 | void set_fg_color (COLOR color) { pmtxt::set_fg_color (sel_attr, color); }
|
---|
43 | void set_fg_color () { pmtxt::set_fg_color (sel_attr); }
|
---|
44 |
|
---|
45 | void set_bg_color (COLOR color) { pmtxt::set_bg_color (sel_attr, color); }
|
---|
46 | void set_bg_color () { pmtxt::set_bg_color (sel_attr); }
|
---|
47 |
|
---|
48 | const struct pmtxt_attr &get_attr () const {return sel_attr;}
|
---|
49 | void set_attr (const struct pmtxt_attr &a) {sel_attr = a;}
|
---|
50 | void set_attr () {sel_attr = get_default_attr ();}
|
---|
51 |
|
---|
52 | void set_line_width (int width);
|
---|
53 | int get_line () const { return y; }
|
---|
54 | int get_column () const { return x; }
|
---|
55 | bool get_xy (POINTL *ptl);
|
---|
56 |
|
---|
57 | private:
|
---|
58 | int x, y;
|
---|
59 | bool cursor_enabled; // True iff cursor enabled with cursor()
|
---|
60 | bool cursor_painted; // True iff cursor painted
|
---|
61 | int cursor_hidden; // Positive iff cursor temporarily hidden
|
---|
62 | pmtxt_attr sel_attr;
|
---|
63 | int line_width;
|
---|
64 | int cursor_width;
|
---|
65 | HPS hpsCursor;
|
---|
66 | RECTL rclCursor;
|
---|
67 |
|
---|
68 | // Override member functions of pmframe
|
---|
69 | MRESULT wm_setfocus (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
70 | MRESULT wm_timer (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
71 | MRESULT wm_presparamchanged (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
72 |
|
---|
73 | // Override member functions of pmtxt
|
---|
74 | void painting (bool start);
|
---|
75 | void font_changed ();
|
---|
76 |
|
---|
77 | void create_hpsCursor ();
|
---|
78 | void cursor_on ();
|
---|
79 | void cursor_off ();
|
---|
80 | void paint_cursor ();
|
---|
81 | void remove_cursor ();
|
---|
82 | void puts1 (const char *s, size_t len);
|
---|
83 | };
|
---|