2008-11-30 22:31:20 +00:00
|
|
|
/** \file server/widget.h
|
2008-12-14 09:33:01 +00:00
|
|
|
* Public interface to the widget methods.
|
2008-11-30 22:31:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* This file is part of LCDd, the lcdproc server.
|
2001-12-27 23:30:36 +00:00
|
|
|
*
|
2008-11-30 22:31:20 +00:00
|
|
|
* This file is released under the GNU General Public License.
|
|
|
|
|
* Refer to the COPYING file distributed with this package.
|
2001-12-27 23:30:36 +00:00
|
|
|
*
|
2011-01-05 23:34:37 +00:00
|
|
|
* Copyright (c) 1999, William Ferrell, Selene Scriven
|
2001-12-27 23:30:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2002-06-29 16:37:18 +00:00
|
|
|
#include "screen.h"
|
|
|
|
|
/* These headers are placed here on purpose ! (circular references) */
|
|
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#ifndef WIDGET_H
|
|
|
|
|
#define WIDGET_H
|
|
|
|
|
|
2002-04-26 00:00:31 +00:00
|
|
|
struct Widget;
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* These correspond to the index into the "types" array...*/
|
2002-04-26 00:00:31 +00:00
|
|
|
typedef enum WidgetType {
|
|
|
|
|
WID_NONE = 0,
|
|
|
|
|
WID_STRING,
|
|
|
|
|
WID_HBAR,
|
|
|
|
|
WID_VBAR,
|
|
|
|
|
WID_ICON,
|
|
|
|
|
WID_TITLE,
|
|
|
|
|
WID_SCROLLER,
|
|
|
|
|
WID_FRAME,
|
|
|
|
|
WID_NUM
|
|
|
|
|
} WidgetType;
|
|
|
|
|
|
2008-12-14 09:33:01 +00:00
|
|
|
|
|
|
|
|
/** Widget structure */
|
2002-04-26 00:00:31 +00:00
|
|
|
typedef struct Widget {
|
2008-12-14 09:33:01 +00:00
|
|
|
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 */
|
2002-04-26 00:00:31 +00:00
|
|
|
//LinkedList *kids; /* Frames can contain more widgets...*/
|
|
|
|
|
} Widget;
|
|
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#define WID_MAX_DIR 4
|
|
|
|
|
|
2002-04-26 00:00:31 +00:00
|
|
|
/* Create new widget */
|
2007-04-02 21:29:53 +00:00
|
|
|
Widget *widget_create(char *id, WidgetType type, Screen *screen);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2002-04-26 00:00:31 +00:00
|
|
|
/* Destroy a widget */
|
2007-04-02 21:29:53 +00:00
|
|
|
int widget_destroy(Widget *w);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2002-04-26 00:00:31 +00:00
|
|
|
/* Convert a widget typename to a widget type */
|
2007-04-02 21:29:53 +00:00
|
|
|
WidgetType widget_typename_to_type(char *typename);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2002-04-26 00:00:31 +00:00
|
|
|
/* Convert a widget typename to a widget type */
|
2007-04-02 21:29:53 +00:00
|
|
|
char *widget_type_to_typename(WidgetType t);
|
2002-04-26 00:00:31 +00:00
|
|
|
|
|
|
|
|
/* Search subwidgets of a widget */
|
2007-04-02 21:29:53 +00:00
|
|
|
Widget *widget_search_subs(Widget *w, char *id);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2002-05-20 21:25:17 +00:00
|
|
|
/* Convert icon number to icon name */
|
2007-04-02 21:29:53 +00:00
|
|
|
char *widget_icon_to_iconname(int icon);
|
2002-05-20 21:25:17 +00:00
|
|
|
|
|
|
|
|
/* Convert iconname to icon number */
|
2007-04-02 21:29:53 +00:00
|
|
|
int widget_iconname_to_icon(char *iconname);
|
2002-05-20 21:25:17 +00:00
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#endif
|