From: ewt Date: Sat, 1 Aug 1998 15:53:16 +0000 (+0000) Subject: changes to clean up the interface, including: X-Git-Tag: r0-30~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e4664f82909135a0ba273aa5c68d82c8bbd7f7d;p=thirdparty%2Fnewt.git changes to clean up the interface, including: 1) newtListboxSelectItem() uses a key, not an index 2) newtListboxAddEntry() was removed (it was redundant anyway) (a #define was added for backwards compatibility) 3) DOBORDER flag was renambed to just BORDER 4) NEWT_FLAG_NOSCROLL was removed as only listboxes used it, and negative logic sucks [this one will be a pita] --- diff --git a/newt.h b/newt.h index 8c5ae46..5ac374b 100644 --- a/newt.h +++ b/newt.h @@ -62,13 +62,16 @@ enum newtFlagsSense { NEWT_FLAGS_SET, NEWT_FLAGS_RESET, NEWT_FLAGS_TOGGLE }; #define NEWT_FLAG_HIDDEN (1 << 1) #define NEWT_FLAG_SCROLL (1 << 2) #define NEWT_FLAG_DISABLED (1 << 3) -#define NEWT_FLAG_NOSCROLL (1 << 4) /* for listboxes */ -#define NEWT_FLAG_DOBORDER (1 << 5) +/* OBSOLETE #define NEWT_FLAG_NOSCROLL (1 << 4) for listboxes */ +#define NEWT_FLAG_BORDER (1 << 5) #define NEWT_FLAG_WRAP (1 << 6) #define NEWT_FLAG_NOF12 (1 << 7) #define NEWT_FLAG_MULTIPLE (1 << 8) #define NEWT_FLAG_SELECTED (1 << 9) +#define NEWT_FD_READ (1 << 0) +#define NEWT_FD_WRITE (1 << 1) + /* Backwards compatibility */ #define NEWT_LISTBOX_RETURNEXIT NEWT_FLAG_RETURNEXIT #define NEWT_ENTRY_SCROLL NEWT_FLAG_SCROLL @@ -80,8 +83,8 @@ enum newtFlagsSense { NEWT_FLAGS_SET, NEWT_FLAGS_RESET, NEWT_FLAGS_TOGGLE }; #define NEWT_TEXTBOX_SCROLL NEWT_FLAG_SCROLL #define NEWT_FORM_NOF12 NEWT_FLAG_NOF12 -#define NEWT_FD_READ (1 << 0) -#define NEWT_FD_WRITE (1 << 1) +#define newtListboxAddEntry newtListboxAppendEntry + typedef struct newtComponent_struct * newtComponent; @@ -110,7 +113,7 @@ void newtResume(void); void newtPushHelpLine(const char * text); void newtRedrawHelpLine(void); void newtPopHelpLine(void); -void newtDrawRootText(int row, int col, const char * text); +void newtDrawRootText(int col, int row, const char * text); void newtBell(void); /* Components */ @@ -139,12 +142,11 @@ newtComponent newtListbox(int left, int top, int height, int flags); void * newtListboxGetCurrent(newtComponent co); void newtListboxSetCurrent(newtComponent co, int num); void newtListboxSetCurrentByKey(newtComponent co, void * key); -void newtListboxSetText(newtComponent co, int num, const char * text); void newtListboxSetEntry(newtComponent co, int num, const char * text); void newtListboxSetWidth(newtComponent co, int width); -/* return the data passed to AddEntry */ void newtListboxSetData(newtComponent co, int num, void * data); -int newtListboxAddEntry(newtComponent co, const char * text, const void * data); +int newtListboxAppendEntry(newtComponent co, const char * text, + const void * data); /* Send the key to insert after, or NULL to insert at the top */ int newtListboxInsertEntry(newtComponent co, const char * text, const void * data, void * key); int newtListboxDeleteEntry(newtComponent co, void * data); @@ -153,13 +155,13 @@ void newtListboxGetEntry(newtComponent co, int num, char **text, void **data); /* Returns an array of data pointers from items, last element is NULL */ void **newtListboxGetSelection(newtComponent co, int *numitems); void newtListboxClearSelection(newtComponent co); -void newtListboxSelectItem(newtComponent co, int item, +void newtListboxSelectItem(newtComponent co, const void * key, enum newtFlagsSense sense); newtComponent newtTextboxReflowed(int left, int top, char * text, int width, int flexDown, int flexUp, int flags); -newtComponent newtTextbox(int left, int top, int with, int height, int flags); +newtComponent newtTextbox(int left, int top, int width, int height, int flags); void newtTextboxSetText(newtComponent co, const char * text); void newtTextboxSetHeight(newtComponent co, int height); int newtTextboxGetNumLines(newtComponent co);