diff options
author | Mystery Man <unknown@mandriva.org> | 2002-07-09 13:18:50 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-07-09 13:18:50 +0000 |
commit | 061aa98f8ab5e8b097f3c67e8074f3b057d1d1bf (patch) | |
tree | 6a497ebd94857616d1351e47418c0c3d6db4f563 /mdk-stage1/newt/label.c | |
parent | a6a904a31e39b74144c53f0cc4086d496b70c09a (diff) | |
download | drakx-061aa98f8ab5e8b097f3c67e8074f3b057d1d1bf.tar drakx-061aa98f8ab5e8b097f3c67e8074f3b057d1d1bf.tar.gz drakx-061aa98f8ab5e8b097f3c67e8074f3b057d1d1bf.tar.bz2 drakx-061aa98f8ab5e8b097f3c67e8074f3b057d1d1bf.tar.xz drakx-061aa98f8ab5e8b097f3c67e8074f3b057d1d1bf.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_8_3mdk'.V1_1_8_3mdk
Diffstat (limited to 'mdk-stage1/newt/label.c')
-rw-r--r-- | mdk-stage1/newt/label.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/mdk-stage1/newt/label.c b/mdk-stage1/newt/label.c deleted file mode 100644 index f1a9cebbf..000000000 --- a/mdk-stage1/newt/label.c +++ /dev/null @@ -1,81 +0,0 @@ -#include <slang.h> -#include <stdlib.h> -#include <string.h> - -#include "newt.h" -#include "newt_pr.h" - -struct label { - char * text; - int length; -}; - -static void labelDraw(newtComponent co); -static void labelDestroy(newtComponent co); - -static struct componentOps labelOps = { - labelDraw, - newtDefaultEventHandler, - labelDestroy, - newtDefaultPlaceHandler, - newtDefaultMappedHandler, -} ; - -newtComponent newtLabel(int left, int top, const char * text) { - newtComponent co; - struct label * la; - - co = malloc(sizeof(*co)); - la = malloc(sizeof(struct label)); - co->data = la; - - co->ops = &labelOps; - - co->height = 1; - co->width = strlen(text); - co->top = top; - co->left = left; - co->takesFocus = 0; - - la->length = strlen(text); - la->text = strdup(text); - - return co; -} - -void newtLabelSetText(newtComponent co, const char * text) { - int newLength; - struct label * la = co->data; - - newLength = strlen(text); - if (newLength <= la->length) { - memset(la->text, ' ', la->length); - memcpy(la->text, text, newLength); - } else { - free(la->text); - la->text = strdup(text); - la->length = newLength; - co->width = newLength; - } - - labelDraw(co); -} - -static void labelDraw(newtComponent co) { - struct label * la = co->data; - - if (co->isMapped == -1) return; - - SLsmg_set_color(COLORSET_LABEL); - - newtGotorc(co->top, co->left); - SLsmg_write_string(la->text); -} - -static void labelDestroy(newtComponent co) { - struct label * la = co->data; - - free(la->text); - free(la); - free(co); -} |