#include <string.h>
#include "draw.h"
#include "config.h"
#include "wifi.h"


typedef struct Widget {
	int id;
	int x;
	int y;
	int value;
	int range;
	char type;
	void *data;
	struct Widget *next;
} Widget;

typedef struct Slider {
	int size;
	int orientation;
} Slider;

typedef struct Knob {
	int radius;
} Knob;

typedef struct Toggle {
	int size;
} Toggle;

extern Widget *head;
extern Widget *last;

void AddWidget(Widget *add);
void DelWidget(int id);

Widget *MakeSlider(int id, int x, int y, int value, int range, int size, char orientation);
Widget *MakeKnob(int id, int x, int y, int value, int range, int radius);
Widget *MakeToggle(int id, int x, int y, int value, int range, int size);
Widget *FindTouched(Widget *head, int x, int y);
void DrawWidget(Widget *which);
void SetSlider(Widget *which, int dx, int dy);
void SetKnob(Widget *which, int dx, int dy);
void SetToggle(Widget *which);
void SetValue(int id, int value);
void DrawAllWidgets();

