4
/* TN5250 - An implementation of the 5250 telnet protocol.
5
* Copyright (C) 2005-2008 James Rich
7
* This file is part of TN5250.
9
* TN5250 is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU Lesser General Public License as published by
11
* the Free Software Foundation; either version 2.1, or (at your option)
14
* TN5250 is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Lesser General Public License for more details.
19
* You should have received a copy of the GNU Lesser General Public License
20
* along with this software; see the file COPYING. If not, write to
21
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
* Boston, MA 02111-1307 USA
31
#define MENU_TYPE_MENUBAR 0x01 /* Menu bar */
32
#define MENU_TYPE_SINGLE_SELECT_FIELD 0x11 /* Single choice selection field */
33
#define MENU_TYPE_MULTIPLE_SELECT_FIELD 0x12 /* Multiple choice selection field */
34
#define MENU_TYPE_SINGLE_SELECT_LIST 0x21 /* Single choice selection list */
35
#define MENU_TYPE_MULTIPLE_SELECT_LIST 0x22 /* Multiple choice selection list */
36
#define MENU_TYPE_SINGLE_SELECT_FIELD_PULL_DOWN 0x31 /* Single choice selection field and a pull-down list */
37
#define MENU_TYPE_MULTIPLE_SELECT_FIELD_PULL_DOWN 0x32 /* Multiple choice selection field and a pull-down list */
38
#define MENU_TYPE_PUSH_BUTTONS 0x41 /* Push buttons */
39
#define MENU_TYPE_PUSH_BUTTONS_PULL_DOWN 0x51 /* Push buttons in a pull-down menu */
42
struct _Tn5250Menubar;
43
struct _Tn5250Menuitem;
44
struct _Tn5250DBuffer;
46
/***** lib5250/Tn5250Menubar
50
* Tn5250Menubar *menubar = tn5250_menubar_new ();
52
* The Tn5250Menubar object manages a 5250 menubar on the display.
57
struct _Tn5250MenubarPrivate *data;
58
struct _Tn5250Menubar *next;
59
struct _Tn5250Menubar *prev;
60
unsigned int id; /* Numeric ID of this menubar */
61
struct _Tn5250Menuitem *menuitem_list;
63
unsigned char flagbyte1;
64
unsigned char flagbyte2;
65
unsigned char flagbyte3;
66
unsigned short restricted_cursor;
68
unsigned int row; /* Row menubar starts on */
69
unsigned int column; /* Column menubar starts on */
70
unsigned int itemsize; /* max size (in characters) of menubar item */
71
unsigned int height; /* height (in rows) of menubar */
72
unsigned int items; /* number of items on this menubar */
73
struct _Tn5250DBuffer *table;
76
typedef struct _Tn5250Menubar Tn5250Menubar;
79
/* Manipulate menubars */
80
extern Tn5250Menubar *tn5250_menubar_new ();
81
extern Tn5250Menubar *tn5250_menubar_copy (Tn5250Menubar * This);
82
extern void tn5250_menubar_destroy (Tn5250Menubar * This);
83
#define tn5250_menubar_restricted_cursor(This) ((This)->restricted_cursor)
84
#define tn5250_menubar_type(This) ((This)->type)
85
#define tn5250_menubar_start_row(This) ((This)->row)
86
#define tn5250_menubar_start_col(This) ((This)->column)
87
#define tn5250_menubar_itemsize(This) ((This)->itemsize)
88
#define tn5250_menubar_height(This) ((This)->height)
89
#define tn5250_menubar_items(This) ((This)->items)
91
/* Manipulate menubar lists */
92
extern Tn5250Menubar *tn5250_menubar_list_destroy (Tn5250Menubar * list);
93
extern Tn5250Menubar *tn5250_menubar_list_add (Tn5250Menubar * list,
94
Tn5250Menubar * node);
95
extern Tn5250Menubar *tn5250_menubar_list_remove (Tn5250Menubar * list,
96
Tn5250Menubar * node);
97
extern Tn5250Menubar *tn5250_menubar_list_find_by_id (Tn5250Menubar * list,
99
extern Tn5250Menubar *tn5250_menubar_list_copy (Tn5250Menubar * list);
100
extern Tn5250Menubar *tn5250_menubar_hit_test (Tn5250Menubar * list, int x,
103
extern void tn5250_menubar_select_next (Tn5250Menubar * This, int *x,
105
extern void tn5250_menubar_select_prev (Tn5250Menubar * This, int *x,
110
/***** lib5250/Tn5250Menuitem
114
* Tn5250Menuitem *menuitem = tn5250_menuitem_new ();
116
* The Tn5250Menuitem object manages a 5250 menuitem on the display.
119
struct _Tn5250Menuitem
121
struct _Tn5250MenuitemPrivate *data;
122
struct _Tn5250Menuitem *next;
123
struct _Tn5250Menuitem *prev;
124
unsigned int id; /* Numeric ID of this menuitem */
125
unsigned char flagbyte1;
126
unsigned char flagbyte2;
127
unsigned char flagbyte3;
132
unsigned int row; /* Row menubar starts on */
133
unsigned int column; /* Column menubar starts on */
134
struct _Tn5250Menubar *menubar;
137
typedef struct _Tn5250Menuitem Tn5250Menuitem;
140
/* Manipulate menuitems */
141
extern Tn5250Menuitem *tn5250_menuitem_new ();
142
extern Tn5250Menuitem *tn5250_menuitem_copy (Tn5250Menuitem * This);
143
extern void tn5250_menuitem_destroy (Tn5250Menuitem * This);
144
extern int tn5250_menuitem_new_row (Tn5250Menuitem * This);
145
extern int tn5250_menuitem_new_col (Tn5250Menuitem * This);
146
#define tn5250_menuitem_start_row(This) ((This)->row)
147
#define tn5250_menuitem_start_col(This) ((This)->column)
149
/* Manipulate menuitem lists */
150
extern Tn5250Menuitem *tn5250_menuitem_list_destroy (Tn5250Menuitem * list);
151
extern Tn5250Menuitem *tn5250_menuitem_list_add (Tn5250Menuitem * list,
152
Tn5250Menuitem * node);
153
extern Tn5250Menuitem *tn5250_menuitem_list_remove (Tn5250Menuitem * list,
154
Tn5250Menuitem * node);
155
extern Tn5250Menuitem *tn5250_menuitem_list_find_by_id (Tn5250Menuitem *
157
extern Tn5250Menuitem *tn5250_menuitem_list_copy (Tn5250Menuitem * list);
158
extern Tn5250Menuitem *tn5250_menuitem_hit_test (Tn5250Menuitem * list,
161
void tn5250_menu_add_menuitem (Tn5250Menubar * This,
162
Tn5250Menuitem * menuitem);
165
#ifndef _TN5250_MENU_PRIVATE_DEFINED
166
#define _TN5250_MENU_PRIVATE_DEFINED
167
struct _Tn5250MenubarPrivate
171
struct _Tn5250MenuitemPrivate