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

« back to all changes in this revision

Viewing changes to lib5250/menu.h

  • Committer: Bazaar Package Importer
  • Author(s): Carey Evans
  • Date: 2009-12-17 22:23:00 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091217222300-cyutcin1bc0m9wrd
Tags: 0.17.4-2
Fix many compiler warnings, especially implicit pointer conversions
(closes: #561165, #561166).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef MENU_H
 
2
#define MENU_H
 
3
 
 
4
/* TN5250 - An implementation of the 5250 telnet protocol.
 
5
 * Copyright (C) 2005-2008 James Rich
 
6
 * 
 
7
 * This file is part of TN5250.
 
8
 *
 
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)
 
12
 * any later version.
 
13
 * 
 
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.
 
18
 * 
 
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
 
23
 * 
 
24
 */
 
25
 
 
26
#ifdef __cplusplus
 
27
extern "C"
 
28
{
 
29
#endif
 
30
 
 
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 */
 
40
 
 
41
 
 
42
  struct _Tn5250Menubar;
 
43
  struct _Tn5250Menuitem;
 
44
  struct _Tn5250DBuffer;
 
45
 
 
46
/***** lib5250/Tn5250Menubar
 
47
 * NAME
 
48
 *    Tn5250Menubar
 
49
 * SYNOPSIS
 
50
 *    Tn5250Menubar *menubar = tn5250_menubar_new ();
 
51
 * DESCRIPTION
 
52
 *    The Tn5250Menubar object manages a 5250 menubar on the display.
 
53
 * SOURCE
 
54
 */
 
55
  struct _Tn5250Menubar
 
56
  {
 
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;
 
62
    int menuitem_count;
 
63
    unsigned char flagbyte1;
 
64
    unsigned char flagbyte2;
 
65
    unsigned char flagbyte3;
 
66
    unsigned short restricted_cursor;
 
67
    unsigned char type;
 
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;
 
74
  };
 
75
 
 
76
  typedef struct _Tn5250Menubar Tn5250Menubar;
 
77
/*******/
 
78
 
 
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)
 
90
 
 
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,
 
98
                                                        int id);
 
99
  extern Tn5250Menubar *tn5250_menubar_list_copy (Tn5250Menubar * list);
 
100
  extern Tn5250Menubar *tn5250_menubar_hit_test (Tn5250Menubar * list, int x,
 
101
                                                 int y);
 
102
 
 
103
  extern void tn5250_menubar_select_next (Tn5250Menubar * This, int *x,
 
104
                                          int *y);
 
105
  extern void tn5250_menubar_select_prev (Tn5250Menubar * This, int *x,
 
106
                                          int *y);
 
107
 
 
108
 
 
109
 
 
110
/***** lib5250/Tn5250Menuitem
 
111
 * NAME
 
112
 *    Tn5250Menuitem
 
113
 * SYNOPSIS
 
114
 *    Tn5250Menuitem *menuitem = tn5250_menuitem_new ();
 
115
 * DESCRIPTION
 
116
 *    The Tn5250Menuitem object manages a 5250 menuitem on the display.
 
117
 * SOURCE
 
118
 */
 
119
  struct _Tn5250Menuitem
 
120
  {
 
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;
 
128
    int size;
 
129
    short available;
 
130
    short selected;
 
131
    unsigned char *text;
 
132
    unsigned int row;           /* Row menubar starts on */
 
133
    unsigned int column;        /* Column menubar starts on */
 
134
    struct _Tn5250Menubar *menubar;
 
135
  };
 
136
 
 
137
  typedef struct _Tn5250Menuitem Tn5250Menuitem;
 
138
/*******/
 
139
 
 
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)
 
148
 
 
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 *
 
156
                                                          list, int id);
 
157
  extern Tn5250Menuitem *tn5250_menuitem_list_copy (Tn5250Menuitem * list);
 
158
  extern Tn5250Menuitem *tn5250_menuitem_hit_test (Tn5250Menuitem * list,
 
159
                                                   int x, int y);
 
160
 
 
161
  void tn5250_menu_add_menuitem (Tn5250Menubar * This,
 
162
                                 Tn5250Menuitem * menuitem);
 
163
 
 
164
 
 
165
#ifndef _TN5250_MENU_PRIVATE_DEFINED
 
166
#define _TN5250_MENU_PRIVATE_DEFINED
 
167
  struct _Tn5250MenubarPrivate
 
168
  {
 
169
    long dummy;
 
170
  };
 
171
  struct _Tn5250MenuitemPrivate
 
172
  {
 
173
    long dummy;
 
174
  };
 
175
#endif
 
176
 
 
177
#ifdef __cplusplus
 
178
}
 
179
 
 
180
#endif
 
181
#endif                          /* MENU_H */