Add to git.
[monolith.git] / src / ml_form_input.h
1 /* Monolith form input class.
2  * - by Richard W.M. Jones <rich@annexia.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  * $Id: ml_form_input.h,v 1.3 2002/08/30 14:28:47 rich Exp $
19  */
20
21 #ifndef ML_FORM_INPUT_H
22 #define ML_FORM_INPUT_H
23
24 #include "monolith.h"
25
26 /* As with widgets, form inputs are opaque except within ml_form_input.c
27  * itself.
28  */
29 typedef void *ml_form_input;
30
31 /* A pointer to this struct must occupy the second slot in every
32  * form input structure we define elsewhere (just after the widget
33  * pointer in the first slot).
34  */
35 struct ml_form_input_operations
36 {
37   void (*clear_value) (void *form_input);
38   void (*set_value) (void *form_input, const char *value);
39   const char *(*get_value) (void *form_input);
40 };
41
42 /* Function: ml_form_input_set_value - Operations on generic form inputs.
43  * Function: ml_form_input_get_value
44  * Function: ml_form_input_clear_value
45  *
46  * @code{ml_form_input_(set|get)_value} update the value field in any
47  * form input.
48  *
49  * @code{ml_form_input_clear_value} clears (nulls) the value field.
50  */
51 extern void ml_form_input_set_value (ml_form_input form_input, const char *value);
52 extern const char *ml_form_input_get_value (ml_form_input form_input);
53 extern void ml_form_input_clear_value (ml_form_input form_input);
54
55 #endif /* ML_FORM_INPUT_H */