buttonDestroy,
} ;
-static newtComponent createButton(int left, int row, char * text, int compact) {
+static newtComponent createButton(int left, int row, const char * text, int compact) {
newtComponent co;
struct button * bu;
return co;
}
-newtComponent newtCompactButton(int left, int row, char * text) {
+newtComponent newtCompactButton(int left, int row, const char * text) {
return createButton(left, row, text, 1);
}
-newtComponent newtButton(int left, int row, char * text) {
+newtComponent newtButton(int left, int row, const char * text) {
return createButton(left, row, text, 0);
}
enum type type;
char value;
int active, inactive;
- void * data;
+ const void * data;
int flags;
};
cbDestroy,
} ;
-newtComponent newtListitem(int left, int top, char * text, int isDefault,
- newtComponent prevItem, void * data, int flags) {
+newtComponent newtListitem(int left, int top, const char * text, int isDefault,
+ newtComponent prevItem, const void * data, int flags) {
newtComponent co;
struct checkbox * li;
void * newtListitemGetData(newtComponent co) {
struct checkbox * rb = co->data;
- return rb->data;
+ return (void *)rb->data;
}
-void newtListitemSet(newtComponent co, char * text) {
+void newtListitemSet(newtComponent co, const char * text) {
struct checkbox * li = co->data;
free(li->text);
co->width = strlen(text) + 4;
}
-newtComponent newtRadiobutton(int left, int top, char * text, int isDefault,
+newtComponent newtRadiobutton(int left, int top, const char * text, int isDefault,
newtComponent prevButton) {
newtComponent co;
newtComponent curr;
return setMember;
}
-newtComponent newtCheckbox(int left, int top, char * text, char defValue,
- char * seq, char * result) {
+newtComponent newtCheckbox(int left, int top, const char * text, char defValue,
+ const char * seq, char * result) {
newtComponent co;
struct checkbox * cb;
struct eventResult cbEvent(newtComponent co, struct event ev) {
struct checkbox * cb = co->data;
struct eventResult er;
- char * cur;
+ const char * cur;
if (ev.when == EV_NORMAL) {
switch (ev.event) {
/* globals -- ick */
int buttonHeight = 1;
-newtComponent (*makeButton)(int left, int right, char * text) =
+newtComponent (*makeButton)(int left, int right, const char * text) =
newtCompactButton;
static void addButtons(int height, int width, newtComponent form,
entryDestroy,
} ;
-void newtEntrySet(newtComponent co, char * value, int cursorAtEnd) {
+void newtEntrySet(newtComponent co, const char * value, int cursorAtEnd) {
struct entry * en = co->data;
if ((strlen(value) + 1) > (unsigned int)en->bufAlloced) {
entryDraw(co);
} ;
-newtComponent newtEntry(int left, int top, char * initialValue, int width,
+newtComponent newtEntry(int left, int top, const char * initialValue, int width,
char ** resultPtr, int flags) {
newtComponent co;
struct entry * en;
int flags;
int vertOffset;
newtComponent vertBar, exitComp;
- char * help;
+ const char * help;
int numRows;
int * hotKeys;
int numHotKeys;
return 1;
}
-newtComponent newtForm(newtComponent vertBar, char * help, int flags) {
+newtComponent newtForm(newtComponent vertBar, const char * help, int flags) {
newtComponent co;
struct form * form;
labelDestroy,
} ;
-newtComponent newtLabel(int left, int top, char * text) {
+newtComponent newtLabel(int left, int top, const char * text) {
newtComponent co;
struct label * la;
return co;
}
-void newtLabelSetText(newtComponent co, char * text) {
+void newtLabelSetText(newtComponent co, const char * text) {
int newLength;
struct label * la = co->data;
/* Linked list of items in the listbox */
struct items {
- void *key, *data;
+ void *key;
+ const void *data;
unsigned char isSelected;
struct items *next;
};
i++, item = item->next);
if (item)
- return item->data;
+ return (void *)item->data;
else
return NULL;
}
for(i = 0, item = li->boxItems; item != NULL;
item = item->next)
if(item->isSelected)
- retval[i++] = item->data;
+ retval[i++] = (void *)item->data;
*numitems = li->numSelected;
return retval;
}
-void newtListboxSetText(newtComponent co, int num, char * text) {
+void newtListboxSetText(newtComponent co, int num, const char * text) {
struct listbox * li = co->data;
int i;
struct items *item;
listboxDraw(co);
}
-void newtListboxSetEntry(newtComponent co, int num, char * text) {
+void newtListboxSetEntry(newtComponent co, int num, const char * text) {
newtListboxSetText(co, num, text);
}
item->data = data;
}
-int newtListboxAddEntry(newtComponent co, char * text, void * data) {
+int newtListboxAddEntry(newtComponent co, const char * text,
+ const void * data) {
struct listbox * li = co->data;
struct items *item;
}
-int newtListboxInsertEntry(newtComponent co, char * text, void * data,
- int num) {
+int newtListboxInsertEntry(newtComponent co, const char * text,
+ const void * data, int num) {
struct listbox * li = co->data;
struct items *item, *t;
int i;
if (text)
*text = item->key;
if (data)
- *data = item->data;
+ *data = (void *)item->data;
}
}
static int cursorRow, cursorCol;
-static char * defaultHelpLine =
+static const char * defaultHelpLine =
" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"
;
};
static char keyPrefix = '\033';
-static char * version = "Newt windowing library version " VERSION
+static const char * version = "Newt windowing library version " VERSION
" - (C) 1996 Red Hat Software. "
"Redistributable under the term of the Library "
"GNU Public License. "
}
int newtOpenWindow(int left, int top, int width, int height,
- char * title) {
+ const char * title) {
int j, row, col;
int n;
int i;
SLsmg_set_char_set(0);
SLsmg_write_char(' ');
SLsmg_set_color(NEWT_COLORSET_TITLE);
- SLsmg_write_string(currentWindow->title);
+ SLsmg_write_string((char *)currentWindow->title);
SLsmg_set_color(NEWT_COLORSET_BORDER);
SLsmg_write_char(' ');
SLsmg_set_char_set(1);
SLsmg_write_string(buf);
}
-void newtPushHelpLine(char * text) {
+void newtPushHelpLine(const char * text) {
if (!text)
text = defaultHelpLine;
newtRedrawHelpLine();
}
-void newtDrawRootText(int row, int col, char * text) {
+void newtDrawRootText(int row, int col, const char * text) {
SLsmg_set_color(NEWT_COLORSET_ROOTTEXT);
if (col < 0) {
}
SLsmg_gotorc(row, col);
- SLsmg_write_string(text);
+ SLsmg_write_string((char *)text);
}
int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense) {
void newtDelay(int usecs);
/* top, left are *not* counting the border */
int newtOpenWindow(int left, int top, int width, int height,
- char * title);
+ const char * title);
void newtPopWindow(void);
void newtSetColors(struct newtColors colors);
void newtRefresh(void);
void newtSuspend(void);
void newtSetSuspendCallback(newtSuspendCallback cb);
void newtResume(void);
-void newtPushHelpLine(char * text);
+void newtPushHelpLine(const char * text);
void newtRedrawHelpLine(void);
void newtPopHelpLine(void);
-void newtDrawRootText(int row, int col, char * text);
+void newtDrawRootText(int row, int col, const char * text);
void newtBell(void);
/* Components */
-newtComponent newtCompactButton(int left, int top, char * text);
-newtComponent newtButton(int left, int top, char * text);
-newtComponent newtCheckbox(int left, int top, char * text, char defValue,
- char * seq, char * result);
-newtComponent newtRadiobutton(int left, int top, char * text, int isDefault,
+newtComponent newtCompactButton(int left, int top, const char * text);
+newtComponent newtButton(int left, int top, const char * text);
+newtComponent newtCheckbox(int left, int top, const char * text, char defValue,
+ const char * seq, char * result);
+newtComponent newtRadiobutton(int left, int top, const char * text, int isDefault,
newtComponent prevButton);
newtComponent newtRadioGetCurrent(newtComponent setMember);
-newtComponent newtListitem(int left, int top, char * text, int isDefault,
- newtComponent prevItem, void * data, int flags);
-void newtListitemSet(newtComponent co, char * text);
+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);
-newtComponent newtLabel(int left, int top, char * text);
-void newtLabelSetText(newtComponent co, char * text);
+newtComponent newtLabel(int left, int top, const char * text);
+void newtLabelSetText(newtComponent co, const char * text);
newtComponent newtVerticalScrollbar(int left, int top, int height,
int normalColorset, int thumbColorset);
void newtScrollbarSet(newtComponent co, int where, int total);
newtComponent newtListbox(int left, int top, int height, int flags);
void * newtListboxGetCurrent(newtComponent co);
void newtListboxSetCurrent(newtComponent co, int num);
-void newtListboxSetText(newtComponent co, int num, char * text);
-void newtListboxSetEntry(newtComponent co, int num, char * text);
+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, char * text, void * data);
-int newtListboxInsertEntry(newtComponent co, char * text, void * data, int num);
+int newtListboxAddEntry(newtComponent co, const char * text, const void * data);
+int newtListboxInsertEntry(newtComponent co, const char * text, const void * data, int num);
int newtListboxDeleteEntry(newtComponent co, int num);
void newtListboxClear(newtComponent co); /* removes all entries from listbox */
void newtListboxGetEntry(newtComponent co, int num, char **text, void **data);
} u;
} ;
-newtComponent newtForm(newtComponent vertBar, char * help, int flags);
+newtComponent newtForm(newtComponent vertBar, const char * help, int flags);
newtComponent newtFormGetCurrent(newtComponent co);
void newtFormSetBackground(newtComponent co, int color);
void newtFormSetCurrent(newtComponent co, newtComponent subco);
void newtDrawForm(newtComponent form);
void newtFormAddHotKey(newtComponent co, int key);
-newtComponent newtEntry(int left, int top, char * initialValue, int width,
+newtComponent newtEntry(int left, int top, const char * initialValue, int width,
char ** resultPtr, int flags);
-void newtEntrySet(newtComponent co, char * value, int cursorAtEnd);
+void newtEntrySet(newtComponent co, const char * value, int cursorAtEnd);
void newtEntrySetFlags(newtComponent co, int flags, enum newtFlagsSense sense);
newtComponent newtScale(int left, int top, int width, long long fullValue);