2 * Author: Marc van Kempen
3 * Desc: include file for UI-objects
5 * Copyright (c) 1995, Marc van Kempen
9 * This software may be used, modified, copied, distributed, and
10 * sold, in both source and binary form provided that the above
11 * copyright and these terms are retained, verbatim, as the first
12 * lines of this file. Under no circumstances is the author
13 * responsible for the proper functioning of this software, nor does
14 * the author assume any responsibility for damages incurred with
22 /***********************************************************************
26 ***********************************************************************/
28 #define ctrl(a) ((a) - 'a' + 1)
30 /* the Object types */
35 /* the return signals from the selection routines */
36 /* 1000 and higher should avoid conflicts with keys pressed */
37 #define SEL_CR 1001 /* return was pressed */
38 #define SEL_ESC 1002 /* ESC pressed */
39 #define SEL_TAB 1003 /* TAB pressed */
40 #define SEL_BACKTAB 1004 /* SHIFT-TAB pressed */
41 #define SEL_BUTTON 1005 /* a button was pressed */
43 /***********************************************************************
47 ***********************************************************************/
50 WINDOW
*win
; /* the window it's contained in */
51 char *title
; /* the prompt for the input field */
52 char *s
; /* initial value of the input field */
53 int x
, y
, w
, len
; /* the (y, x) position of the upperleft */
54 /* corner and the width <w> of the display */
55 /* and length <len> of the field */
56 int attr_mask
; /* special attributes */
60 WINDOW
*win
; /* the windows it's contained in */
61 char *title
; /* the title of the list */
62 char **name
; /* the names of the list */
63 int *seld
; /* the currently selected names */
64 char *elt
; /* the current element in the list list[sel] */
65 int x
, y
, w
, h
, n
; /* dimensions of list and # of elements (n) */
66 int scroll
, sel
; /* current position in the list */
70 WINDOW
*win
; /* the window it's contained in */
71 char *title
; /* title for the button */
72 int x
, y
, w
, h
; /* its dimensions */
73 int *pushed
; /* boolean that determines wether button was pushed */
76 typedef struct ComposeObj
{
79 struct ComposeObj
*next
, *prev
;
82 /**********************************************************************
86 **********************************************************************/
88 void RefreshStringObj(StringObj
*so
);
89 StringObj
*NewStringObj(WINDOW
*win
, char *title
, char *s
,
90 int y
, int x
, int w
, int len
);
91 int SelectStringObj(StringObj
*so
);
92 void DelStringObj(StringObj
*so
);
94 void RefreshListObj(ListObj
*lo
);
95 ListObj
*NewListObj(WINDOW
*win
, char *title
, char **list
,
96 char *listelt
, int y
, int x
, int h
, int w
, int n
);
97 void UpdateListObj(ListObj
*lo
, char **list
, int n
);
98 int SelectListObj(ListObj
*lo
);
99 void DelListObj(ListObj
*obj
);
100 void MarkCurrentListObj(ListObj
*lo
);
101 void MarkAllListObj(ListObj
*lo
);
102 void UnMarkAllListObj(ListObj
*lo
);
104 void RefreshButtonObj(ButtonObj
*bo
);
105 ButtonObj
*NewButtonObj(WINDOW
*win
, char *title
, int *pushed
,
107 int SelectButtonObj(ButtonObj
*bo
);
108 void DelButtonObj(ButtonObj
*bo
);
109 void AddObj(ComposeObj
**Obj
, int objtype
, void *obj
);
110 void FreeObj(ComposeObj
*Obj
);
111 int ReadObj(ComposeObj
*Obj
);
112 int PollObj(ComposeObj
**Obj
);
113 void DelObj(ComposeObj
*Obj
);