Don't crash if key settings are set in a configuration file that are out of range...
[chocolate-doom.git] / textscreen / txt_inputbox.h
blob6237bc914e8c38558e43adc48bee2243727b4344
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.
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.
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.
22 #ifndef TXT_INPUTBOX_H
23 #define TXT_INPUTBOX_H
25 /**
26 * @file txt_inputbox.h
28 * Input box widget.
31 /**
32 * Input box widget.
34 * An input box is a widget that displays a value, which can be
35 * selected to enter a new value.
37 * Input box widgets can be of an integer or string type.
40 typedef struct txt_inputbox_s txt_inputbox_t;
42 #include "txt_widget.h"
44 struct txt_inputbox_s
46 txt_widget_t widget;
47 char *buffer;
48 unsigned int size;
49 int editing;
50 void *value;
53 /**
54 * Create a new input box widget for controlling a string value.
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.
66 txt_inputbox_t *TXT_NewInputBox(char **value, int size);
68 /**
69 * Create a new input box widget for controlling an integer value.
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.
77 txt_inputbox_t *TXT_NewIntInputBox(int *value, int size);
79 #endif /* #ifndef TXT_INPUTBOX_H */