~ubuntu-branches/ubuntu/maverick/tn5250/maverick

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
#ifndef MENU_H
#define MENU_H

/* TN5250 - An implementation of the 5250 telnet protocol.
 * Copyright (C) 2005-2008 James Rich
 * 
 * This file is part of TN5250.
 *
 * TN5250 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 2.1, or (at your option)
 * any later version.
 * 
 * TN5250 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 Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA
 * 
 */

#ifdef __cplusplus
extern "C"
{
#endif

#define MENU_TYPE_MENUBAR 0x01	/* Menu bar */
#define MENU_TYPE_SINGLE_SELECT_FIELD 0x11	/* Single choice selection field */
#define MENU_TYPE_MULTIPLE_SELECT_FIELD 0x12	/* Multiple choice selection field */
#define MENU_TYPE_SINGLE_SELECT_LIST 0x21	/* Single choice selection list */
#define MENU_TYPE_MULTIPLE_SELECT_LIST 0x22	/* Multiple choice selection list */
#define MENU_TYPE_SINGLE_SELECT_FIELD_PULL_DOWN 0x31	/* Single choice selection field and a pull-down list */
#define MENU_TYPE_MULTIPLE_SELECT_FIELD_PULL_DOWN 0x32	/* Multiple choice selection field and a pull-down list */
#define MENU_TYPE_PUSH_BUTTONS 0x41	/* Push buttons */
#define MENU_TYPE_PUSH_BUTTONS_PULL_DOWN 0x51	/* Push buttons in a pull-down menu */


  struct _Tn5250Menubar;
  struct _Tn5250Menuitem;
  struct _Tn5250DBuffer;

/***** lib5250/Tn5250Menubar
 * NAME
 *    Tn5250Menubar
 * SYNOPSIS
 *    Tn5250Menubar *menubar = tn5250_menubar_new ();
 * DESCRIPTION
 *    The Tn5250Menubar object manages a 5250 menubar on the display.
 * SOURCE
 */
  struct _Tn5250Menubar
  {
    struct _Tn5250MenubarPrivate *data;
    struct _Tn5250Menubar *next;
    struct _Tn5250Menubar *prev;
    unsigned int id;		/* Numeric ID of this menubar */
    struct _Tn5250Menuitem *menuitem_list;
    int menuitem_count;
    unsigned char flagbyte1;
    unsigned char flagbyte2;
    unsigned char flagbyte3;
    unsigned short restricted_cursor;
    unsigned char type;
    unsigned int row;		/* Row menubar starts on */
    unsigned int column;	/* Column menubar starts on */
    unsigned int itemsize;	/* max size (in characters) of menubar item */
    unsigned int height;	/* height (in rows) of menubar */
    unsigned int items;		/* number of items on this menubar */
    struct _Tn5250DBuffer *table;
  };

  typedef struct _Tn5250Menubar Tn5250Menubar;
/*******/

/* Manipulate menubars */
  extern Tn5250Menubar *tn5250_menubar_new ();
  extern Tn5250Menubar *tn5250_menubar_copy (Tn5250Menubar * This);
  extern void tn5250_menubar_destroy (Tn5250Menubar * This);
#define tn5250_menubar_restricted_cursor(This) ((This)->restricted_cursor)
#define tn5250_menubar_type(This) ((This)->type)
#define tn5250_menubar_start_row(This) ((This)->row)
#define tn5250_menubar_start_col(This) ((This)->column)
#define tn5250_menubar_itemsize(This) ((This)->itemsize)
#define tn5250_menubar_height(This) ((This)->height)
#define tn5250_menubar_items(This) ((This)->items)

/* Manipulate menubar lists */
  extern Tn5250Menubar *tn5250_menubar_list_destroy (Tn5250Menubar * list);
  extern Tn5250Menubar *tn5250_menubar_list_add (Tn5250Menubar * list,
						 Tn5250Menubar * node);
  extern Tn5250Menubar *tn5250_menubar_list_remove (Tn5250Menubar * list,
						    Tn5250Menubar * node);
  extern Tn5250Menubar *tn5250_menubar_list_find_by_id (Tn5250Menubar * list,
							int id);
  extern Tn5250Menubar *tn5250_menubar_list_copy (Tn5250Menubar * list);
  extern Tn5250Menubar *tn5250_menubar_hit_test (Tn5250Menubar * list, int x,
						 int y);

  extern void tn5250_menubar_select_next (Tn5250Menubar * This, int *x,
					  int *y);
  extern void tn5250_menubar_select_prev (Tn5250Menubar * This, int *x,
					  int *y);



/***** lib5250/Tn5250Menuitem
 * NAME
 *    Tn5250Menuitem
 * SYNOPSIS
 *    Tn5250Menuitem *menuitem = tn5250_menuitem_new ();
 * DESCRIPTION
 *    The Tn5250Menuitem object manages a 5250 menuitem on the display.
 * SOURCE
 */
  struct _Tn5250Menuitem
  {
    struct _Tn5250MenuitemPrivate *data;
    struct _Tn5250Menuitem *next;
    struct _Tn5250Menuitem *prev;
    unsigned int id;		/* Numeric ID of this menuitem */
    unsigned char flagbyte1;
    unsigned char flagbyte2;
    unsigned char flagbyte3;
    int size;
    short available;
    short selected;
    unsigned char *text;
    unsigned int row;		/* Row menubar starts on */
    unsigned int column;	/* Column menubar starts on */
    struct _Tn5250Menubar *menubar;
  };

  typedef struct _Tn5250Menuitem Tn5250Menuitem;
/*******/

/* Manipulate menuitems */
  extern Tn5250Menuitem *tn5250_menuitem_new ();
  extern Tn5250Menuitem *tn5250_menuitem_copy (Tn5250Menuitem * This);
  extern void tn5250_menuitem_destroy (Tn5250Menuitem * This);
  extern int tn5250_menuitem_new_row (Tn5250Menuitem * This);
  extern int tn5250_menuitem_new_col (Tn5250Menuitem * This);
#define tn5250_menuitem_start_row(This) ((This)->row)
#define tn5250_menuitem_start_col(This) ((This)->column)

/* Manipulate menuitem lists */
  extern Tn5250Menuitem *tn5250_menuitem_list_destroy (Tn5250Menuitem * list);
  extern Tn5250Menuitem *tn5250_menuitem_list_add (Tn5250Menuitem * list,
						   Tn5250Menuitem * node);
  extern Tn5250Menuitem *tn5250_menuitem_list_remove (Tn5250Menuitem * list,
						      Tn5250Menuitem * node);
  extern Tn5250Menuitem *tn5250_menuitem_list_find_by_id (Tn5250Menuitem *
							  list, int id);
  extern Tn5250Menuitem *tn5250_menuitem_list_copy (Tn5250Menuitem * list);
  extern Tn5250Menuitem *tn5250_menuitem_hit_test (Tn5250Menuitem * list,
						   int x, int y);

  void tn5250_menu_add_menuitem (Tn5250Menubar * This,
				 Tn5250Menuitem * menuitem);


#ifndef _TN5250_MENU_PRIVATE_DEFINED
#define _TN5250_MENU_PRIVATE_DEFINED
  struct _Tn5250MenubarPrivate
  {
    long dummy;
  };
  struct _Tn5250MenuitemPrivate
  {
    long dummy;
  };
#endif

#ifdef __cplusplus
}

#endif
#endif				/* MENU_H */