From: msw Date: Fri, 5 Feb 1999 19:30:35 +0000 (+0000) Subject: Added a hack to disable checkboxes. This will go away with a generic X-Git-Tag: r0-40~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60c6e639bf76a712e7ad2f055f38798a2d4b526a;p=thirdparty%2Fnewt.git Added a hack to disable checkboxes. This will go away with a generic comp flag setting function later. --- diff --git a/checkbox.c b/checkbox.c index 785c17f..c7db418 100644 --- a/checkbox.c +++ b/checkbox.c @@ -123,11 +123,35 @@ newtComponent newtCheckbox(int left, int top, const char * text, char defValue, return co; } +void newtCheckboxSetFlags(newtComponent co, int flags, enum newtFlagsSense sense) { + struct checkbox * cb = co->data; + int row, col; + + cb->flags = newtSetFlags(cb->flags, flags, sense); + + if (!(cb->flags & NEWT_FLAG_DISABLED)) + co->takesFocus = 1; + else + co->takesFocus = 0; + + newtGetrc(&row, &col); + cbDraw(co); + newtGotorc(row, col); +} + static void cbDraw(newtComponent c) { struct checkbox * cb = c->data; if (c->top == -1 || !c->isMapped) return; + if (cb->flags & NEWT_FLAG_DISABLED) { + cb->inactive = NEWT_COLORSET_DISENTRY; + cb->active = NEWT_COLORSET_DISENTRY; + } else { + cb->inactive = COLORSET_CHECKBOX; + cb->active = COLORSET_ACTCHECKBOX; + } + SLsmg_set_color(cb->inactive); newtGotorc(c->top, c->left); diff --git a/newt.h b/newt.h index 1e408d5..c6377fd 100644 --- a/newt.h +++ b/newt.h @@ -124,6 +124,9 @@ newtComponent newtCheckbox(int left, int top, const char * text, char defValue, const char * seq, char * result); char newtCheckboxGetValue(newtComponent co); void newtCheckboxSetValue(newtComponent co, char value); +void newtCheckboxSetFlags(newtComponent co, int flags, enum newtFlagsSense sense); + + newtComponent newtRadiobutton(int left, int top, const char * text, int isDefault, newtComponent prevButton); newtComponent newtRadioGetCurrent(newtComponent setMember); @@ -199,6 +202,7 @@ newtComponent newtEntry(int left, int top, const char * initialValue, int width, 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); newtComponent newtScale(int left, int top, int width, long long fullValue); void newtScaleSet(newtComponent co, unsigned long long amount);