aboutsummaryrefslogtreecommitdiffstats
path: root/widget.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-30 05:47:38 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-30 05:47:38 +0000
commit2523e50fbb5a076f9535c18dcce9ed7a0716e28d (patch)
treee9b5c891e426a38a451e52fbd9ece443b5f59457 /widget.c
parent5eca256613eb7e4fb476d5efa71a835af5bb5d06 (diff)
downloadlcd4linux-2523e50fbb5a076f9535c18dcce9ed7a0716e28d.tar.gz
[lcd4linux @ 2006-01-30 05:47:34 by reinelt]
graphic subsystem changed to full-color RGBA git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@626 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'widget.c')
-rw-r--r--widget.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/widget.c b/widget.c
index 57c2c4a..5476cd1 100644
--- a/widget.c
+++ b/widget.c
@@ -1,4 +1,4 @@
-/* $Id: widget.c,v 1.21 2005/12/18 16:18:36 reinelt Exp $
+/* $Id: widget.c,v 1.22 2006/01/30 05:47:38 reinelt Exp $
*
* generic widget handling
*
@@ -21,6 +21,9 @@
*
*
* $Log: widget.c,v $
+ * Revision 1.22 2006/01/30 05:47:38 reinelt
+ * graphic subsystem changed to full-color RGBA
+ *
* Revision 1.21 2005/12/18 16:18:36 reinelt
* GPO's added again
*
@@ -182,11 +185,41 @@ void widget_unregister(void)
nClasses = 0;
}
-int widget_add(const char *name, const int type, const int row, const int col)
+int widget_color(const char *section, const char *name, const char *key, RGBA * C)
+{
+ char *color;
+
+ C->R = 0;
+ C->G = 0;
+ C->B = 0;
+ C->A = 0;
+
+ color = cfg_get(section, key, NULL);
+
+ if (color == NULL)
+ return 0;
+
+ if (*color == '\0') {
+ free(color);
+ return 0;
+ }
+
+ if (color2RGBA(color, C) < 0) {
+ error("widget '%s': ignoring illegal %s color '%s'", name, key, color);
+ free(color);
+ return 0;
+ }
+ free(color);
+ return 1;
+}
+
+int widget_add(const char *name, const int type, const int layer, const int row, const int col)
{
int i;
char *section;
char *class;
+ int fg_valid, bg_valid;
+ RGBA FG, BG;
WIDGET_CLASS *Class;
WIDGET *Widget;
@@ -204,8 +237,14 @@ int widget_add(const char *name, const int type, const int row, const int col)
error("error: widget '%s' has no class!", name);
if (class)
free(class);
+ free(section);
return -1;
}
+
+ /* get widget foreground color */
+ fg_valid = widget_color(section, name, "foreground", &FG);
+ bg_valid = widget_color(section, name, "background", &BG);
+
free(section);
/* lookup widget class */
@@ -265,6 +304,11 @@ int widget_add(const char *name, const int type, const int row, const int col)
Widget->name = strdup(name);
Widget->class = Class;
Widget->parent = Parent;
+ Widget->fg_color = FG;
+ Widget->bg_color = BG;
+ Widget->fg_valid = fg_valid;
+ Widget->bg_valid = bg_valid;
+ Widget->layer = layer;
Widget->row = row;
Widget->col = col;