summaryrefslogtreecommitdiff
path: root/textscreen/txt_checkbox.c
diff options
context:
space:
mode:
authorSimon Howard2006-06-29 18:07:32 +0000
committerSimon Howard2006-06-29 18:07:32 +0000
commit6b9f3748cf561254f085fa83ada80cb5ba9b3946 (patch)
treea0c5474075230270c347cedcc6dca5f8f445bd2d /textscreen/txt_checkbox.c
parent1d41349f0326187866c8212fed490f95b9692e47 (diff)
downloadchocolate-doom-6b9f3748cf561254f085fa83ada80cb5ba9b3946.tar.gz
chocolate-doom-6b9f3748cf561254f085fa83ada80cb5ba9b3946.tar.bz2
chocolate-doom-6b9f3748cf561254f085fa83ada80cb5ba9b3946.zip
Add inverted checkboxes (tick in box when value is false)
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 565
Diffstat (limited to 'textscreen/txt_checkbox.c')
-rw-r--r--textscreen/txt_checkbox.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/textscreen/txt_checkbox.c b/textscreen/txt_checkbox.c
index cde095a8..56746f5f 100644
--- a/textscreen/txt_checkbox.c
+++ b/textscreen/txt_checkbox.c
@@ -33,7 +33,7 @@ static void TXT_CheckBoxDrawer(TXT_UNCAST_ARG(checkbox), int selected)
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
- if (*checkbox->variable)
+ if ((*checkbox->variable != 0) ^ checkbox->inverted)
{
TXT_DrawString("\x07");
}
@@ -112,7 +112,18 @@ txt_checkbox_t *TXT_NewCheckBox(char *label, int *variable)
TXT_InitWidget(checkbox, &txt_checkbox_class);
checkbox->label = strdup(label);
checkbox->variable = variable;
+ checkbox->inverted = 0;
return checkbox;
}
+txt_checkbox_t *TXT_NewInvertedCheckBox(char *label, int *variable)
+{
+ txt_checkbox_t *result;
+
+ result = TXT_NewCheckBox(label, variable);
+ result->inverted = 1;
+
+ return result;
+}
+