]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
removed newtEntryAddCallback(), changed callback logic to use component
authorewt <ewt>
Tue, 6 Aug 1996 20:24:09 +0000 (20:24 +0000)
committerewt <ewt>
Tue, 6 Aug 1996 20:24:09 +0000 (20:24 +0000)
callbacks

entry.c

diff --git a/entry.c b/entry.c
index 22032f837058cba0d86bdd580948607af0bb483f..5e9e54b94313b23dc4f60c5ebdedb3bd18ab57e6 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -14,8 +14,6 @@ struct entry {
     int bufUsed;               /* amount of the buffer that's been used */
     int cursorPosition;        /* cursor *in the string* on on screen */
     int firstChar;             /* first character position being shown */
-    void * callbackData;
-    newtCallback callback;
 };
 
 static void entryDraw(newtComponent co);
@@ -66,6 +64,7 @@ newtComponent newtEntry(int left, int top, char * initialValue, int width,
     co->height = 1;
     co->width = width;
     co->takesFocus = 1;
+    co->callback = NULL;
 
     co->ops = &entryOps;
 
@@ -74,7 +73,6 @@ newtComponent newtEntry(int left, int top, char * initialValue, int width,
     en->firstChar = 0;
     en->bufUsed = 0;
     en->bufAlloced = width + 1;
-    en->callback = NULL;
 
     if (initialValue && strlen(initialValue) > width) {
        en->bufAlloced = strlen(initialValue) + 1;
@@ -93,13 +91,6 @@ newtComponent newtEntry(int left, int top, char * initialValue, int width,
     return co;
 }
 
-void newtEntryAddCallback(newtComponent co, newtCallback f, void * data) {
-    struct entry * en = co->data;
-
-    en->callback = f;
-    en->callbackData = data;
-}
-
 static void entryDraw(newtComponent co) {
     struct entry * en = co->data;
     int i;
@@ -178,7 +169,7 @@ static struct eventResult entryEvent(struct newtComponent * co,
            /*SLtt_set_cursor_visibility(1);*/
            newtGotorc(0, 0);
            er.result = ER_SWALLOWED;
-           if (en->callback) en->callback(co, en->callbackData);
+           if (co->callback) co->callback(co, co->callbackData);
            break;
 
          case EV_KEYPRESS: