1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 2006 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 // 02111-1307, USA.
20 //
21 
22 #ifndef TXT_INPUTBOX_H
23 #define TXT_INPUTBOX_H
24 
25 /**
26  * @file txt_inputbox.h
27  *
28  * Input box widget.
29  */
30 
31 /**
32  * Input box widget.
33  *
34  * An input box is a widget that displays a value, which can be
35  * selected to enter a new value.
36  *
37  * Input box widgets can be of an integer or string type.
38  */
39 
40 typedef struct txt_inputbox_s txt_inputbox_t;
41 
42 #include "txt_widget.h"
43 
44 struct txt_inputbox_s
45 {
46     txt_widget_t widget;
47     char *buffer;
48     unsigned int size;
49     int editing;
50     void *value;
51 };
52 
53 /**
54  * Create a new input box widget for controlling a string value.
55  *
56  * @param value         Pointer to a string variable that contains
57  *                      a pointer to the current value of the
58  *                      input box.  The value should be allocated
59  *                      dynamically; when the string is changed it
60  *                      will be freed and the variable set to point
61  *                      to the new string value.
62  * @param size          Width of the input box, in characters.
63  * @return              Pointer to the new input box widget.
64  */
65 
66 txt_inputbox_t *TXT_NewInputBox(char **value, int size);
67 
68 /**
69  * Create a new input box widget for controlling an integer value.
70  *
71  * @param value         Pointer to an integer variable containing
72  *                      the value of the input box.
73  * @param size          Width of the input box, in characters.
74  * @return              Pointer to the new input box widget.
75  */
76 
77 txt_inputbox_t *TXT_NewIntInputBox(int *value, int size);
78 
79 #endif /* #ifndef TXT_INPUTBOX_H */
80 
81 
82