When launching a file from the finder, add the new file into the command line at...
[chocolate-doom.git] / textscreen / txt_spinctrl.h
blob5a8153192ba5de663b17386d538818a9d4db4439
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_SPINCONTROL_H
23 #define TXT_SPINCONTROL_H
25 /**
26 * @file txt_spinctrl.h
28 * Spin control widget.
31 /**
32 * Spin control widget.
34 * A spin control widget works as an input box that can be used to
35 * set numeric values, but also has buttons that allow its value
36 * to be increased or decreased.
39 typedef struct txt_spincontrol_s txt_spincontrol_t;
41 typedef enum
43 TXT_SPINCONTROL_INT,
44 TXT_SPINCONTROL_FLOAT,
45 } txt_spincontrol_type_t;
47 #include "txt_widget.h"
49 struct txt_spincontrol_s
51 txt_widget_t widget;
52 txt_spincontrol_type_t type;
53 union { float f; int i; } min, max, *value, step;
54 int editing;
55 char *buffer;
58 /**
59 * Create a new spin control widget tracking an integer value.
61 * @param value Pointer to the variable containing the value
62 * displayed in the widget.
63 * @param min Minimum value that may be set.
64 * @param max Maximum value that may be set.
65 * @return Pointer to the new spin control widget.
68 txt_spincontrol_t *TXT_NewSpinControl(int *value, int min, int max);
70 /**
71 * Create a new spin control widget tracking a float value.
73 * @param value Pointer to the variable containing the value
74 * displayed in the widget.
75 * @param min Minimum value that may be set.
76 * @param max Maximum value that may be set.
77 * @return Pointer to the new spin control widget.
80 txt_spincontrol_t *TXT_NewFloatSpinControl(float *value, float min, float max);
82 #endif /* #ifndef TXT_SPINCONTROL_H */