terminal.h
7.21 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* Copyright (C) 2008 Banco do Brasil S.A.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 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 Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <config.h>
#include <internals.h>
#include <v3270/selection.h>
G_BEGIN_DECLS
struct _v3270Class
{
GtkWidgetClass parent_class;
// Internal properties.
struct {
size_t count; // Number of properties.
GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties.
// Properties saved to the configuration file.
const gchar **persistent;
// Signal related properties
GParamSpec * online;
GParamSpec * associated_lu;
GParamSpec * selection;
GParamSpec * session_name;
GParamSpec * trace;
GParamSpec * has_copy;
GParamSpec * has_timer;
struct
{
guint toggle;
guint boolean;
guint integer;
guint uint;
guint str;
} type;
} properties;
// Cursors
GdkCursor * cursors[LIB3270_POINTER_COUNT];
// Atoms
GdkAtom clipboard_formatted; ///< @brief Format for internal clipboard cut & paste.
// Signals
void (*activate)(GtkWidget *widget);
void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE_ID toggle_id,gboolean toggle_state,const gchar *toggle_name);
void (*message_changed)(v3270 *widget, LIB3270_MESSAGE id);
guint (*load_popup_response)(v3270 *widget, const gchar *popup_name, guint response);
gboolean (*save_popup_response)(v3270 *widget, const gchar *popup_name, guint response);
};
/*--[ Defines]---------------------------------------------------------------------------------------*/
#define OIA_TOP_MARGIN 2
#define KEY_FLAG_SHIFT 0x0001
#ifndef WIN32
#define KEY_FLAG_ALT 0x0002
#endif // !WIN32
typedef enum _V3270SelectionOption {
V3270_SELECTION_PLAIN_TEXT = 0x00, ///< @brief Uses only plain text.
V3270_SELECTION_FONT_FAMILY = 0x01, ///< @brief Inform font-family.
V3270_SELECTION_COLORS = 0x02, ///< @brief Inform terminal colors.
V3270_SELECTION_NON_BREAKABLE_SPACE = 0x04, ///< @brief Use non breakable spaces.
V3270_SELECTION_SCREEN_PASTE = 0x08, ///< @brief Enable screen paste.
V3270_SELECTION_SMART_COPY = 0x10, ///< @brief Enable copy/append based on current selection state.
V3270_SELECTION_DIALOG_STATE = 0x20, ///< @brief Used for settings dialog.
V3270_SELECTION_PIXBUFF = 0x40, ///< @brief Allow pixbuf formats.
} V3270SelectionOption;
#define V3270_SELECTION_DEFAULT (V3270_SELECTION_FONT_FAMILY|V3270_SELECTION_COLORS|V3270_SELECTION_NON_BREAKABLE_SPACE|V3270_SELECTION_DIALOG_STATE)
#define V3270_SELECTION_ENABLE_HTML (V3270_SELECTION_FONT_FAMILY|V3270_SELECTION_COLORS|V3270_SELECTION_NON_BREAKABLE_SPACE)
/*--[ Globals ]--------------------------------------------------------------------------------------*/
struct v3270_ssl_status_msg
{
long id;
const gchar * icon;
const gchar * text;
const gchar * message;
};
/*--[ Widget data ]----------------------------------------------------------------------------------*/
struct _v3270
{
GtkWidget parent;
// flags
unsigned int selecting : 1; ///< @brief Selecting region
unsigned int moving : 1; ///< @brief Moving selected region
unsigned int resizing : 1; ///< @brief Resizing selected region
unsigned int scaled_fonts : 1; ///< @brief Use scaled fonts
unsigned int drawing : 1; ///< @brief Draw widget?
unsigned int freeze : 1; ///< @brief True when the "save settings" signal is disabled.
unsigned int append : 1; ///< @brief Next smart-copy operation will be append.
unsigned int copying : 1; ///< @brief Copy with center mouse button
unsigned int open_url : 1; ///< @brief Emit 'open-url' signal when and http:// or https:// url is selected by 'word-select' action.
/// @brief Action properties.
// GtkResponseType responses[V3270_TOGGLEABLE_DIALOG_CUSTOM];
GSource * timer;
GtkIMContext * input_method;
unsigned short keyflags;
struct {
int baddr; ///< @brief Selection address.
GdkAtom target; ///< @brief A GdkAtom which identifies the clipboard to use. GDK_SELECTION_CLIPBOARD gives the default clipboard.
V3270_COPY_MODE format; ///< @brief Copy mode.
GList * blocks; ///< @brief Selection blocks.
V3270SelectionOption options; ///< @brief Selection options.
gchar * font_family; ///< @brief Font family for HTML paste.
struct {
gchar * scheme; ///< @brief Name of the selection color scheme
gchar * value; ///< @brief List of colors for selection.
} color;
} selection;
LIB3270_POINTER pointer_id;
unsigned char pointer; /**< Mouse pointer ID */
// Font info
cairo_surface_t * surface;
v3270FontInfo font;
gint minimum_width;
gint minimum_height;
// Colors
GdkRGBA color[V3270_COLOR_COUNT]; /**< Terminal widget colors */
// OIA
struct
{
GdkRectangle rect[V3270_OIA_FIELD_COUNT];
V3270_OIA_FIELD selected; /**< Clicked OIA field */
} oia;
struct
{
unsigned char show; /**< Cursor flag */
unsigned char chr; /**< Char at cursor position */
unsigned short attr; /**< Attribute at cursor position */
GdkRectangle rect; /**< Cursor rectangle */
GSource * timer; /**< Cursor blinking timer */
cairo_surface_t * surface; /**< Cursor image */
} cursor;
// Acessibility
GtkAccessible * accessible;
// Session
H3270 * host; /**< Related 3270 session */
gchar * remap_filename; /**< @brief XML file with remap table. */
struct {
gchar *name; /**< @brief Session name (for window title) */
gchar *title; /**< @brief Session title (for window title) */
} session;
// Auto disconnect
struct
{
time_t timestamp; /**< Last action in this widget */
guint disconnect; /**< Time (in minutes) for auto disconnect */
GSource * timer; /**< Auto disconnect timer */
} activity;
char script; ///< @brief Script ID.
// Blink
struct
{
unsigned int show : 1; ///< @brief Show element?
GSource * timer; ///< @brief Timer source.
} blink;
GtkWidget * trace; ///< @brief Trace window handle.
// Keyboard accelerators.
GSList * accelerators; ///< @brief Keyboard accelerators.
// Scroll actions.
struct
{
void (*activate)(GtkWidget *, gpointer); ///< @brief Callback for scroll activation.
gpointer arg; ///< @brief Argument for callback.
} scroll[4]; ///< @brief Scroll actions.
};
G_GNUC_INTERNAL void v3270_activate(GtkWidget *widget);
G_GNUC_INTERNAL GdkPixbuf * v3270_get_as_pixbuf(GtkWidget *widget);
/*--[ Globals ]--------------------------------------------------------------------------------------*/
G_END_DECLS