4 #define NEWT_COLORSET_ROOT 2
5 #define NEWT_COLORSET_BORDER 3
6 #define NEWT_COLORSET_WINDOW 4
7 #define NEWT_COLORSET_SHADOW 5
8 #define NEWT_COLORSET_TITLE 6
9 #define NEWT_COLORSET_BUTTON 7
10 #define NEWT_COLORSET_ACTBUTTON 8
11 #define NEWT_COLORSET_CHECKBOX 9
12 #define NEWT_COLORSET_ACTCHECKBOX 10
13 #define NEWT_COLORSET_ENTRY 11
14 #define NEWT_COLORSET_LABEL 12
15 #define NEWT_COLORSET_LISTBOX 13
16 #define NEWT_COLORSET_ACTLISTBOX 14
17 #define NEWT_COLORSET_TEXTBOX 15
18 #define NEWT_COLORSET_ACTTEXTBOX 16
19 #define NEWT_COLORSET_HELPLINE 17
20 #define NEWT_COLORSET_ROOTTEXT 18
21 #define NEWT_COLORSET_EMPTYSCALE 19
22 #define NEWT_COLORSET_FULLSCALE 20
23 #define NEWT_COLORSET_DISENTRY 21
25 enum newtFlagsSense
{ NEWT_FLAGS_SET
, NEWT_FLAGS_RESET
};
28 char * rootFg
, * rootBg
;
29 char * borderFg
, * borderBg
;
30 char * windowFg
, * windowBg
;
31 char * shadowFg
, * shadowBg
;
32 char * titleFg
, * titleBg
;
33 char * buttonFg
, * buttonBg
;
34 char * actButtonFg
, * actButtonBg
;
35 char * checkboxFg
, * checkboxBg
;
36 char * actCheckboxFg
, * actCheckboxBg
;
37 char * entryFg
, * entryBg
;
38 char * labelFg
, * labelBg
;
39 char * listboxFg
, * listboxBg
;
40 char * actListboxFg
, * actListboxBg
;
41 char * textboxFg
, * textboxBg
;
42 char * actTextboxFg
, * actTextboxBg
;
43 char * helpLineFg
, * helpLineBg
;
44 char * rootTextFg
, * rootTextBg
;
45 char * emptyScale
, * fullScale
;
46 char * disabledEntryFg
, * disabledEntryBg
;
49 typedef struct newtComponent
* newtComponent
;
51 extern struct newtColors newtDefaultColorPalette
;
53 typedef void (*newtCallback
)(newtComponent
, void *);
54 typedef void (*newtSuspendCallback
)(void);
57 int newtFinished(void);
59 void newtWaitForKey(void);
60 void newtClearKeyBuffer(void);
61 void newtDelay(int usecs
);
62 /* top, left are *not* counting the border */
63 int newtOpenWindow(int left
, int top
, int width
, int height
,
65 void newtPopWindow(void);
66 void newtSetColors(struct newtColors colors
);
67 void newtRefresh(void);
68 void newtSuspend(void);
69 void newtSetSuspendCallback(newtSuspendCallback cb
);
70 void newtResume(void);
71 void newtPushHelpLine(char * text
);
72 void newtRedrawHelpLine(void);
73 void newtPopHelpLine(void);
74 void newtDrawRootText(int row
, int col
, char * text
);
78 newtComponent
newtButton(int left
, int top
, char * text
);
79 newtComponent
newtCheckbox(int left
, int top
, char * text
, char defValue
,
80 char * seq
, char * result
);
81 newtComponent
newtRadiobutton(int left
, int top
, char * text
, int isDefault
,
82 newtComponent prevButton
);
83 newtComponent
newtRadioGetCurrent(newtComponent setMember
);
84 newtComponent
newtListitem(int left
, int top
, char * text
, int isDefault
,
85 newtComponent prevItem
, void * data
);
86 void newtListitemSet(newtComponent co
, char * text
);
87 void * newtListitemGetData(newtComponent co
);
89 newtComponent
newtLabel(int left
, int top
, char * text
);
90 void newtLabelSetText(newtComponent co
, char * text
);
91 newtComponent
newtVerticalScrollbar(int left
, int top
, int height
,
92 int normalColorset
, int thumbColorset
);
93 void newtScrollbarSet(newtComponent co
, int where
, int total
);
95 #define NEWT_LISTBOX_RETURNEXIT (1 << 0)
96 newtComponent
newtListbox(int left
, int top
, int height
, int flags
);
97 /* return the data passed to AddEntry */
98 void * newtListboxGetCurrent(newtComponent co
);
99 void newtListboxSetCurrent(newtComponent co
, int num
);
100 void newtListboxAddEntry(newtComponent co
, char * text
, void * data
);
101 void newtListboxSetEntry(newtComponent co
, int num
, char * text
);
103 #define NEWT_TEXTBOX_WRAP (1 << 0)
104 #define NEWT_TEXTBOX_SCROLL (1 << 1)
106 newtComponent
newtTextbox(int left
, int top
, int with
, int height
, int flags
);
107 void newtTextboxSetText(newtComponent co
, const char * text
);
109 #define NEWT_FORM_NOF12 (1 << 0)
111 struct newtExitStruct
{
112 enum { NEWT_EXIT_HOTKEY
, NEWT_EXIT_COMPONENT
} reason
;
119 newtComponent
newtForm(newtComponent vertBar
, char * help
, int flags
);
120 newtComponent
newtFormGetCurrent(newtComponent co
);
121 void newtFormSetBackground(newtComponent co
, int color
);
122 void newtFormSetCurrent(newtComponent co
, newtComponent subco
);
123 void newtFormAddComponent(newtComponent form
, newtComponent co
);
124 void newtFormAddComponents(newtComponent form
, ...);
125 void newtFormSetHeight(newtComponent co
, int height
);
126 void newtFormSetWidth(newtComponent co
, int width
);
127 newtComponent
newtRunForm(newtComponent form
); /* obsolete */
128 void newtFormRun(newtComponent co
, struct newtExitStruct
* es
);
129 void newtDrawForm(newtComponent form
);
130 void newtFormAddHotKey(newtComponent co
, int key
);
132 #define NEWT_ENTRY_SCROLL (1 << 0)
133 #define NEWT_ENTRY_HIDDEN (1 << 1)
134 #define NEWT_ENTRY_RETURNEXIT (1 << 2)
135 #define NEWT_ENTRY_DISABLED (1 << 3)
137 newtComponent
newtEntry(int left
, int top
, char * initialValue
, int width
,
138 char ** resultPtr
, int flags
);
139 void newtEntrySet(newtComponent co
, char * value
, int cursorAtEnd
);
140 void newtEntrySetFlags(newtComponent co
, int flags
, enum newtFlagsSense sense
);
142 newtComponent
newtScale(int left
, int top
, int width
, long long fullValue
);
143 void newtScaleSet(newtComponent co
, long long amount
);
145 void newtComponentAddCallback(newtComponent co
, newtCallback f
, void * data
);
147 /* this also destroys all of the components (including other forms) on the
149 void newtFormDestroy(newtComponent form
);
153 #define NEWT_KEY_TAB '\t'
154 #define NEWT_KEY_ENTER '\r'
155 #define NEWT_KEY_SUSPEND '\032' /* ctrl - z*/
156 #define NEWT_KEY_RETURN NEWT_KEY_ENTER
158 #define NEWT_KEY_EXTRA_BASE 0x8000
159 #define NEWT_KEY_UP NEWT_KEY_EXTRA_BASE + 1
160 #define NEWT_KEY_DOWN NEWT_KEY_EXTRA_BASE + 2
161 #define NEWT_KEY_LEFT NEWT_KEY_EXTRA_BASE + 4
162 #define NEWT_KEY_RIGHT NEWT_KEY_EXTRA_BASE + 5
163 #define NEWT_KEY_BKSPC NEWT_KEY_EXTRA_BASE + 6
164 #define NEWT_KEY_DELETE NEWT_KEY_EXTRA_BASE + 7
165 #define NEWT_KEY_HOME NEWT_KEY_EXTRA_BASE + 8
166 #define NEWT_KEY_END NEWT_KEY_EXTRA_BASE + 9
167 #define NEWT_KEY_UNTAB NEWT_KEY_EXTRA_BASE + 10
168 #define NEWT_KEY_PGUP NEWT_KEY_EXTRA_BASE + 11
169 #define NEWT_KEY_PGDN NEWT_KEY_EXTRA_BASE + 12
171 #define NEWT_KEY_F1 NEWT_KEY_EXTRA_BASE + 101
172 #define NEWT_KEY_F2 NEWT_KEY_EXTRA_BASE + 102
173 #define NEWT_KEY_F3 NEWT_KEY_EXTRA_BASE + 103
174 #define NEWT_KEY_F4 NEWT_KEY_EXTRA_BASE + 104
175 #define NEWT_KEY_F5 NEWT_KEY_EXTRA_BASE + 105
176 #define NEWT_KEY_F6 NEWT_KEY_EXTRA_BASE + 106
177 #define NEWT_KEY_F7 NEWT_KEY_EXTRA_BASE + 107
178 #define NEWT_KEY_F8 NEWT_KEY_EXTRA_BASE + 108
179 #define NEWT_KEY_F9 NEWT_KEY_EXTRA_BASE + 109
180 #define NEWT_KEY_F10 NEWT_KEY_EXTRA_BASE + 110
181 #define NEWT_KEY_F11 NEWT_KEY_EXTRA_BASE + 111
182 #define NEWT_KEY_F12 NEWT_KEY_EXTRA_BASE + 112