File: widget.h

package info (click to toggle)
lcdproc 0.5.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,064 kB
  • sloc: ansic: 59,645; sh: 1,740; perl: 681; makefile: 417
file content (72 lines) | stat: -rw-r--r-- 1,844 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/** \file server/widget.h
 * Public interface to the widget methods.
 */

/* This file is part of LCDd, the lcdproc server.
 *
 * This file is released under the GNU General Public License.
 * Refer to the COPYING file distributed with this package.
 *
 * Copyright (c) 1999, William Ferrell, Selene Scriven
 */

#ifndef WIDGET_H
#define WIDGET_H

#define INC_TYPES_ONLY 1
#include "screen.h"
#undef INC_TYPES_ONLY

/* These correspond to the index into the "types" array...*/
typedef enum WidgetType {
	WID_NONE = 0,
	WID_STRING,
	WID_HBAR,
	WID_VBAR,
	WID_ICON,
	WID_TITLE,
	WID_SCROLLER,
	WID_FRAME,
	WID_NUM
} WidgetType;


/** Widget structure */
typedef struct Widget {
	char *id;			/**< the widget's name */
	WidgetType type;		/**< the widget's type */
	Screen *screen;			/**< What screen is this widget in ? */
	int x, y;			/**< Position */
	int width, height;		/**< Visible size */
	int left, top, right, bottom;	/**< bounding rectangle */
	int length;			/**< size or direction */
	int speed;			/**< For scroller... */
	char *text;			/**< text or binary data */
	struct Screen *frame_screen;	/**< frame widget get an associated screen */
	//LinkedList *kids;		/* Frames can contain more widgets...*/
} Widget;

#define WID_MAX_DIR 4

/* Create new widget */
Widget *widget_create(char *id, WidgetType type, Screen *screen);

/* Destroy a widget */
int widget_destroy(Widget *w);

/* Convert a widget typename to a widget type */
WidgetType widget_typename_to_type(char *typename);

/* Convert a widget typename to a widget type */
char *widget_type_to_typename(WidgetType t);

/* Search subwidgets of a widget */
Widget *widget_search_subs(Widget *w, char *id);

/* Convert icon number to icon name */
char *widget_icon_to_iconname(int icon);

/* Convert iconname to icon number */
int widget_iconname_to_icon(char *iconname);

#endif