Add inverted checkboxes (tick in box when value is false)
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 565
This commit is contained in:
parent
1d41349f03
commit
6b9f3748cf
2 changed files with 14 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,11 @@ struct txt_checkbox_s
|
|||
txt_widget_t widget;
|
||||
char *label;
|
||||
int *variable;
|
||||
int inverted;
|
||||
};
|
||||
|
||||
txt_checkbox_t *TXT_NewCheckBox(char *label, int *variable);
|
||||
txt_checkbox_t *TXT_NewInvertedCheckBox(char *label, int *variable);
|
||||
|
||||
#endif /* #ifndef TXT_CHECKBOX_H */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue