Don't crash if key settings are set in a configuration file that are out of range...
[chocolate-doom.git] / textscreen / txt_button.h
blob7c16c01b402b99ab6cedda5a150ee1a3c030e8c2
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_BUTTON_H
23 #define TXT_BUTTON_H
25 /**
26 * @file txt_button.h
28 * Button widget.
31 /**
32 * Button widget.
34 * A button is a widget that can be selected to perform some action.
35 * When a button is pressed, it emits the "pressed" signal.
38 typedef struct txt_button_s txt_button_t;
40 #include "txt_widget.h"
42 struct txt_button_s
44 txt_widget_t widget;
45 char *label;
48 /**
49 * Create a new button widget.
51 * @param label The label to use on the new button.
52 * @return Pointer to the new button widget.
55 txt_button_t *TXT_NewButton(char *label);
57 /**
58 * Create a new button widget, binding the "pressed" signal to a
59 * specified callback function.
61 * @param label The label to use on the new button.
62 * @param func The callback function to invoke.
63 * @param user_data User-specified pointer to pass to the callback.
64 * @return Pointer to the new button widget.
67 txt_button_t *TXT_NewButton2(char *label, TxtWidgetSignalFunc func,
68 void *user_data);
70 /**
71 * Change the label used on a button.
73 * @param button The button.
74 * @param label The new label.
77 void TXT_SetButtonLabel(txt_button_t *button, char *label);
79 #endif /* #ifndef TXT_BUTTON_H */