~amavect/makeu

ref: b6f6785f804b8f37745fdeff16f2e707c3a25664 makeu/components.h -rw-r--r-- 1.9 KiB
b6f6785famavect rename com.h to more standard fns.h 1 year, 5 months ago
                                                                                
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
typedef struct Slider Slider;
typedef struct HSVmap HSVmap;
typedef struct Screenpick Screenpick;

/* screen back buffer */
extern Image *screenbuf;

struct Slider {
	double val; /* starting value */
	double min; /* minimum value */
	double max; /* maximum value */
	double inc; /* scroll wheel increment */
	int ishoriz; /* is horizontal? */
	char *fmt; /* display format for the current value (a double) */
	void (*onchange)(double); /* passes val on change */
	/* internal */
	Rectangle r;
	Image *bg;
	Image *fg;
	Image *bka;
	Image *wta;
};

struct HSVmap{
	HSVd hsv;
	void (*onchange)(HSVd); /* passes color on change */
	Mousectl *mctl; /* pointer for menu 2 */
	/* internal */
	Ratioxy pos;
	int maptype; /* HS=0, SV=1, HV=2 */
	Rectangle r;
	Image *huex;
	Image *satx;
	Image *saty;
	Image *valy;
	Image *pix;
	Image *circ;
};

struct Screenpick {
	ulong color; /* The selected color, RGB form */
	Mousectl *mctl; /* pointer for cursor changing */
	void (*onchange)(ulong); /* passes color on change */
	/* internal */
	int screenfd; /* /dev/screen */
	Rectangle r; /* current size */
	int state; /* state machine */
	int linesize;
	uchar *linebuf;
	Image* screenline;
	Image* pixel;
};

extern Point hsvmapinit(Elementile*);
extern void hsvmapresize(Elementile*, Rectangle);
extern int hsvmapupdate(Elementile*);
extern int hsvmapmouse(Elementile*, Mouse);
extern int hsvmapkeyboard(Elementile*, Rune);
extern void hsvmapfree(Elementile*);

extern Point screenpickinit(Elementile*);
extern void screenpickresize(Elementile*, Rectangle);
extern int screenpickupdate(Elementile*);
extern int screenpickmouse(Elementile*, Mouse);
extern int screenpickkeyboard(Elementile*, Rune);

extern Point sliderinit(Elementile*);
extern void sliderresize(Elementile*, Rectangle);
extern int sliderupdate(Elementile*);
extern int slidermouse(Elementile*, Mouse);
extern int sliderkeyboard(Elementile*, Rune);