#define NEWT_COLORSET_ACTSELLISTBOX 23
#define NEWT_COLORSET_SELLISTBOX 24
+#define NEWT_COLORSET_CUSTOM(x) (30 + (x))
+
#define NEWT_ARG_LAST -100000
#define NEWT_ARG_APPEND -1
void newtResizeScreen(int redraw);
void newtWaitForKey(void);
void newtClearKeyBuffer(void);
-void newtDelay(int usecs);
+void newtDelay(unsigned int usecs);
/* top, left are *not* counting the border */
-int newtOpenWindow(int left, int top, int width, int height,
- const char * title);
-int newtCenteredWindow(int width, int height, const char * title);
+int newtOpenWindow(int left,int top,
+ unsigned int width,unsigned int height,
+ const char * title);
+int newtCenteredWindow(unsigned int width,unsigned int height, const char * title);
void newtPopWindow(void);
+void newtPopWindowNoRefresh(void);
void newtSetColors(struct newtColors colors);
+void newtSetColor(int colorset, char *fg, char *bg);
void newtRefresh(void);
void newtSuspend(void);
void newtSetSuspendCallback(newtSuspendCallback cb, void * data);
void newtSetHelpCallback(newtCallback cb);
-void newtResume(void);
+int newtResume(void);
void newtPushHelpLine(const char * text);
void newtRedrawHelpLine(void);
void newtPopHelpLine(void);
newtComponent newtRadiobutton(int left, int top, const char * text, int isDefault,
newtComponent prevButton);
newtComponent newtRadioGetCurrent(newtComponent setMember);
-newtComponent newtListitem(int left, int top, const char * text, int isDefault,
- newtComponent prevItem, const void * data, int flags);
-void newtListitemSet(newtComponent co, const char * text);
-void * newtListitemGetData(newtComponent co);
+void newtRadioSetCurrent(newtComponent setMember);
void newtGetScreenSize(int * cols, int * rows);
newtComponent newtLabel(int left, int top, const char * text);
void newtLabelSetText(newtComponent co, const char * text);
+void newtLabelSetColors(newtComponent co, int colorset);
newtComponent newtVerticalScrollbar(int left, int top, int height,
int normalColorset, int thumbColorset);
void newtScrollbarSet(newtComponent co, int where, int total);
+void newtScrollbarSetColors(newtComponent co, int normal, int thumb);
newtComponent newtListbox(int left, int top, int height, int flags);
void * newtListboxGetCurrent(newtComponent co);
void newtTextboxSetText(newtComponent co, const char * text);
void newtTextboxSetHeight(newtComponent co, int height);
int newtTextboxGetNumLines(newtComponent co);
+void newtTextboxSetColors(newtComponent co, int normal, int active);
char * newtReflowText(char * text, int width, int flexDown, int flexUp,
int * actualWidth, int * actualHeight);
struct newtExitStruct {
enum { NEWT_EXIT_HOTKEY, NEWT_EXIT_COMPONENT, NEWT_EXIT_FDREADY,
- NEWT_EXIT_TIMER } reason;
+ NEWT_EXIT_TIMER, NEWT_EXIT_ERROR } reason;
union {
int watch;
int key;
void newtFormRun(newtComponent co, struct newtExitStruct * es);
void newtDrawForm(newtComponent form);
void newtFormAddHotKey(newtComponent co, int key);
+int newtFormGetScrollPosition(newtComponent co);
+void newtFormSetScrollPosition(newtComponent co, int position);
typedef int (*newtEntryFilter)(newtComponent entry, void * data, int ch,
int cursor);
newtComponent newtEntry(int left, int top, const char * initialValue, int width,
- char ** resultPtr, int flags);
+ const char ** resultPtr, int flags);
void newtEntrySet(newtComponent co, const char * value, int cursorAtEnd);
void newtEntrySetFilter(newtComponent co, newtEntryFilter filter, void * data);
char * newtEntryGetValue(newtComponent co);
void newtEntrySetFlags(newtComponent co, int flags, enum newtFlagsSense sense);
+void newtEntrySetColors(newtComponent co, int normal, int disabled);
+int newtEntryGetCursorPosition(newtComponent co);
+void newtEntrySetCursorPosition(newtComponent co, int position);
newtComponent newtScale(int left, int top, int width, long long fullValue);
void newtScaleSet(newtComponent co, unsigned long long amount);
+void newtScaleSetColors(newtComponent co, int empty, int full);
void newtComponentAddCallback(newtComponent co, newtCallback f, void * data);
void newtComponentTakesFocus(newtComponent co, int val);
+void newtComponentGetPosition(newtComponent co, int * left, int * top);
+void newtComponentGetSize(newtComponent co, int * width, int * height);
+
+/* This callback is called when a component is destroyed. */
+void newtComponentAddDestroyCallback(newtComponent co,
+ newtCallback f, void * data);
+
/* this also destroys all of the components (including other forms) on the
form */
void newtFormDestroy(newtComponent form);
+/* NB: You SHOULD NOT call this for components which have been added
+ * to a form (ie. almost all components). They are destroyed along
+ * with the form when you call newtFormDestroy.
+ */
+void newtComponentDestroy(newtComponent co);
+
/* Key codes */
#define NEWT_KEY_TAB '\t'
/* not really a key, but newtGetKey returns it */
#define NEWT_KEY_RESIZE NEWT_KEY_EXTRA_BASE + 113
+#define NEWT_KEY_ERROR NEWT_KEY_EXTRA_BASE + 114
#define NEWT_ANCHOR_LEFT (1 << 0)
#define NEWT_ANCHOR_RIGHT (1 << 1)