From a390d8386961109a8e182897753080538dce8625 Mon Sep 17 00:00:00 2001 From: reinelt Date: Sat, 10 Jan 2004 20:22:33 +0000 Subject: [lcd4linux @ 2004-01-10 20:22:33 by reinelt] added new function 'cfg_list()' (not finished yet) added layout.c (will replace processor.c someday) added widget_text.c (will be the first and most important widget) modified lcd4linux.c so that old-style configs should work, too git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@304 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- widget.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'widget.c') diff --git a/widget.c b/widget.c index d2bb73d..e152571 100644 --- a/widget.c +++ b/widget.c @@ -1,4 +1,4 @@ -/* $Id: widget.c,v 1.3 2004/01/10 17:34:40 reinelt Exp $ +/* $Id: widget.c,v 1.4 2004/01/10 20:22:33 reinelt Exp $ * * generic widget handling * @@ -21,6 +21,12 @@ * * * $Log: widget.c,v $ + * Revision 1.4 2004/01/10 20:22:33 reinelt + * added new function 'cfg_list()' (not finished yet) + * added layout.c (will replace processor.c someday) + * added widget_text.c (will be the first and most important widget) + * modified lcd4linux.c so that old-style configs should work, too + * * Revision 1.3 2004/01/10 17:34:40 reinelt * further matrixOrbital changes * widgets initialized @@ -50,6 +56,39 @@ #include "cfg.h" #include "widget.h" -int widget_register (void) + +static WIDGET_CLASS *Classes=NULL; +static int nClasses=0; + +static WIDGET *Widgets=NULL; +static int nWidgets=0; + + +int widget_register (WIDGET_CLASS *widget) +{ + int i; + + for (i=0; iname, Classes[i].name)==0) { + error ("internal error: widget '%s' already exists!"); + return -1; + } + } + + nClasses++; + Classes=realloc(Classes, nClasses*sizeof(WIDGET_CLASS)); + Classes[nClasses-1] = *widget; + + return 0; +} + + +int widget_add (char *section, char *name) { + nWidgets++; + Widgets=realloc(Widgets, nWidgets*sizeof(WIDGET)); + + Widgets[nWidgets-1].name = name; + + return 0; } -- cgit v1.2.3