~siretart/lcd4linux/debian

« back to all changes in this revision

Viewing changes to widget.h

  • Committer: Reinhard Tartler
  • Date: 2011-04-27 17:24:15 UTC
  • mto: This revision was merged to the branch mainline in revision 750.
  • Revision ID: siretart@tauware.de-20110427172415-6n4aptmvmz0eztvm
Tags: upstream-0.11.0~svn1143
ImportĀ upstreamĀ versionĀ 0.11.0~svn1143

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: widget.h 996 2009-03-23 17:22:24Z volker $
 
2
 * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/widget.h $
 
3
 *
 
4
 * generic widget handling
 
5
 *
 
6
 * Copyright (C) 2003, 2004 Michael Reinelt <michael@reinelt.co.at>
 
7
 * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
 
8
 *
 
9
 * This file is part of LCD4Linux.
 
10
 *
 
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)
 
14
 * any later version.
 
15
 *
 
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.
 
20
 *
 
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.
 
24
 *
 
25
 */
 
26
 
 
27
 
 
28
#ifndef _WIDGET_H_
 
29
#define _WIDGET_H_
 
30
 
 
31
#include "rgb.h"
 
32
 
 
33
 
 
34
struct WIDGET;                  /* forward declaration */
 
35
 
 
36
 
 
37
typedef struct WIDGET_CLASS {
 
38
    char *name;
 
39
    int type;
 
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);
 
44
} WIDGET_CLASS;
 
45
 
 
46
 
 
47
typedef struct WIDGET {
 
48
    char *name;
 
49
    WIDGET_CLASS *class;
 
50
    struct WIDGET *parent;
 
51
    RGBA fg_color;
 
52
    RGBA bg_color;
 
53
    int fg_valid;
 
54
    int bg_valid;
 
55
    int layer;
 
56
    int row;
 
57
    int col;
 
58
    void *data;
 
59
    int x2;                     /* x of opposite corner, -1 for no display widget */
 
60
    int y2;                     /* y of opposite corner, -1 for no display widget */
 
61
} WIDGET;
 
62
 
 
63
 
 
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
 
69
 
 
70
 
 
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);
 
77
 
 
78
#undef MIN
 
79
#define MIN(a,b) ((a) < (b) ? (a) : (b))
 
80
#undef MAX
 
81
#define MAX(a,b) ((a) > (b) ? (a) : (b))
 
82
#define NOCOORD (-1)
 
83
 
 
84
#endif