2 * Copyright (C) 2015 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #define TEXT(k,...) {.f.type=FORM_TEXT, .f.hotkey=k, __VA_ARGS__}
20 #define NUMBER(k,...) {.f.type=FORM_NUMBER, .f.hotkey=k, __VA_ARGS__}
21 #define DATE(k,...) {.f.type=FORM_DATE, .f.hotkey=k, __VA_ARGS__}
22 #define BUTTON(k,...) {.f.type=FORM_BUTTON, .f.hotkey=k, __VA_ARGS__}
23 #define LIST(k,...) {.f.type=FORM_LIST, .f.hotkey=k, __VA_ARGS__}
25 #define HEAD(t,...) &(form_field_t){.type=FORM_LABEL, .label=t, .attr.bold=1}
26 #define LABEL(t,...) &(form_field_t){.type=FORM_LABEL, .label=t}
28 #define CHECK(t,...) {.f.type=FORM_BUTTON, .f.label=t}
29 #define TOGGLE(t,...) {.f.type=FORM_BUTTON, .f.label=t}
30 #define RADIO(t,...) {.f.type=FORM_BUTTON, .f.label=t}
31 #define BUTTONS(t,...) {.f.type=FORM_BUTTON, .f.label=t} // LIST[buttons]
90 form_field_t *fields[][10];
94 void form_show(form_t *form);
95 void form_draw(WINDOW *win);
96 int form_run(int key, mmask_t btn, int row, int col);