From bbe7f194ee035c6cafdc5102092b7b422541aeab Mon Sep 17 00:00:00 2001 From: reinelt Date: Sun, 11 Jan 2004 18:26:02 +0000 Subject: [lcd4linux @ 2004-01-11 18:26:02 by reinelt] further widget and layout processing git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@306 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- widget.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'widget.c') diff --git a/widget.c b/widget.c index 301914d..60414fe 100644 --- a/widget.c +++ b/widget.c @@ -1,4 +1,4 @@ -/* $Id: widget.c,v 1.5 2004/01/11 09:26:15 reinelt Exp $ +/* $Id: widget.c,v 1.6 2004/01/11 18:26:02 reinelt Exp $ * * generic widget handling * @@ -21,6 +21,9 @@ * * * $Log: widget.c,v $ + * Revision 1.6 2004/01/11 18:26:02 reinelt + * further widget and layout processing + * * Revision 1.5 2004/01/11 09:26:15 reinelt * layout starts to exist... * @@ -86,12 +89,50 @@ int widget_register (WIDGET_CLASS *widget) } -int widget_add (char *section, char *name) +int widget_add (char *name) { + int i; + char *section; + char *class; + + WIDGET_CLASS *Class; + WIDGET *Widget; + + // prepare config section + // strlen("Widget:")=7 + section=malloc(strlen(name)+8); + strcpy(section, "Widget:"); + strcat(section, name); + + // get widget class + class=cfg_get(section, "class", NULL); + if (class==NULL || *class=='\0') { + error ("error: widget '%s' has no class!", name); + return -1; + } + + // lookup widget class + for (i=0; iname = name; + Widget->class = Class; + if (Class->init!=0) { + Class->init(Widget); + } + return 0; } -- cgit v1.2.3