aboutsummaryrefslogtreecommitdiffstats
path: root/widget.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-10 20:22:33 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-10 20:22:33 +0000
commita390d8386961109a8e182897753080538dce8625 (patch)
treecc950b0ce0cb241f374de0671aa2bc2cacae8140 /widget.c
parent76ffcfa4c6fb4cf45126bfd97c3ab0affe1e8e0d (diff)
downloadlcd4linux-a390d8386961109a8e182897753080538dce8625.tar.gz
[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
Diffstat (limited to 'widget.c')
-rw-r--r--widget.c43
1 files changed, 41 insertions, 2 deletions
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; i<nClasses; i++) {
+ if (strcasecmp(widget->name, 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;
}