1
/* $Id: widget.h 996 2009-03-23 17:22:24Z volker $
2
* $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget.h $
4
* generic widget handling
6
* Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
7
* Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
9
* This file is part of LCD4Linux.
11
* LCD4Linux is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2, or (at your option)
16
* LCD4Linux is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34
struct WIDGET; /* forward declaration */
37
typedef struct WIDGET_CLASS {
40
int (*init) (struct WIDGET * Self);
41
int (*draw) (struct WIDGET * Self);
42
int (*find) (struct WIDGET * Self, void *needle);
43
int (*quit) (struct WIDGET * Self);
47
typedef struct WIDGET {
50
struct WIDGET *parent;
59
int x2; /* x of opposite corner, -1 for no display widget */
60
int y2; /* y of opposite corner, -1 for no display widget */
64
#define WIDGET_TYPE_RC 1
65
#define WIDGET_TYPE_XY 2
66
#define WIDGET_TYPE_GPO 3
67
#define WIDGET_TYPE_TIMER 4
68
#define WIDGET_TYPE_KEYPAD 5
71
int widget_register(WIDGET_CLASS * widget);
72
void widget_unregister(void);
73
int intersect(WIDGET * w1, WIDGET * w2);
74
int widget_add(const char *name, const int type, const int layer, const int row, const int col);
75
WIDGET *widget_find(int type, void *needle);
76
int widget_color(const char *section, const char *name, const char *key, RGBA * C);
79
#define MIN(a,b) ((a) < (b) ? (a) : (b))
81
#define MAX(a,b) ((a) > (b) ? (a) : (b))