summaryrefslogtreecommitdiff
path: root/lib/libforms/forms.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libforms/forms.h')
-rw-r--r--lib/libforms/forms.h97
1 files changed, 67 insertions, 30 deletions
diff --git a/lib/libforms/forms.h b/lib/libforms/forms.h
index 36031be3d8b2..636b55c90979 100644
--- a/lib/libforms/forms.h
+++ b/lib/libforms/forms.h
@@ -34,63 +34,89 @@
#include <ncurses.h>
-#define F_END 0
-#define F_TEXT 1
-#define F_ACTION 2
-#define F_INPUT 3
-#define F_MENU 4
+#define FF_UNKNOWN 0
+#define FF_TEXT 1
+#define FF_ACTION 2
+#define FF_INPUT 3
+#define FF_MENU 4
#define F_DEFATTR 0
#define F_SELATTR A_REVERSE
-#define F_DONE 1
-#define F_CANCEL -1
+/* Status values */
+
+#define FS_ERROR -1
+#define FS_OK 0
+#define FS_EXIT 1
+#define FS_CANCEL 2
+#define FS_NOBIND 3
+#define FS_RUNNING 4
+
+
+typedef enum {
+ FT_ANY,
+ FT_FORM,
+ FT_COLTAB,
+ FT_FIELD_INST,
+ FT_FIELD_DEF,
+ FT_FUNC
+} TupleType;
+
+struct Tuple {
+ char *name;
+ int type;
+ void *addr;
+ struct Tuple *next;
+};
struct col_pair {
int f;
int b;
};
-struct form {
+struct Form {
+ int status;
int no_fields;
- int start_field;
- int current_field;
- struct field *field;
+ char *startfield;
+ struct Field *current_field;
+ struct Field *prev_field;
+ struct Field *fieldlist;
int height;
int width;
int y;
int x;
int attr;
- struct col_pair *color_table;
+ char *colortable;
WINDOW *window;
};
-struct text_field {
+struct TextField {
char *text;
};
-struct action_field {
+struct ActionField {
char *text;
- void (* fn)();
+ char *fn;
};
-struct input_field {
+struct InputField {
int lbl_flag;
char *label;
char *input;
int limit;
};
-struct menu_field {
- int no_options;
+struct MenuField {
int selected;
+ int no_options;
char **options;
};
struct help_link {
};
-struct field {
+struct Field {
+ char *defname;
int type;
int y;
int x;
@@ -98,17 +124,19 @@ struct field {
int width;
int attr;
int selattr;
- int next;
- int up;
- int down;
- int left;
- int right;
+ char *fnext;
+ char *fup;
+ char *fdown;
+ char *fleft;
+ char *fright;
+ char *f_keymap;
union {
- struct text_field *text;
- struct action_field *action;
- struct input_field *input;
- struct menu_field *menu;
+ struct TextField *text;
+ struct ActionField *action;
+ struct InputField *input;
+ struct MenuField *menu;
}field;
+ struct Field *next;
/*
struct help_link help;
*/
@@ -118,9 +146,18 @@ struct field {
extern unsigned int keymap[];
/* Externally visible function declarations */
+struct Form *form_start(const char *);
+struct Tuple *form_get_tuple(const char *, TupleType);
+struct Tuple *form_next_tuple(const char *, TupleType, struct Tuple *);
+int form_bind_tuple(char *, TupleType, void *);
+void print_status(char *);
+void exit_form(struct Form *form);
+void cancel_form(struct Form *form);
+
+
+#ifdef not
int update_form(struct form *);
int initfrm(struct form *);
void endfrm(struct form *);
-void exit_form(void);
-void cancel_form(void);
void print_status(char *);
+#endif