-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathprefab.h
103 lines (90 loc) · 2.89 KB
/
prefab.h
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#pragma src "/usr/inferno/libprefab"
typedef struct PElement PElement;
typedef struct PCompound PCompound;
typedef struct Memimage Memimage;
enum
{
Dirty,
Clean
};
enum Elementtype /* same as in prefab.m */
{
EIcon,
EText,
ETitle,
EHorizontal,
EVertical,
ESeparator,
NEtypes
};
enum Adjust /* same as in prefab.m */
{
/* first arg: size of elements */
Adjpack = 10, /* leave alone, pack tightly */
Adjequal = 11, /* make equal */
Adjfill = 12, /* make equal, filling available space */
/* second arg: position of element within space */
Adjleft = 20,
Adjup = 20,
Adjcenter = 21,
Adjright = 22,
Adjdown = 22
};
enum
{
Maxchars = 128 /* maximum # chars in a word */
};
struct PElement
{
Prefab_Element e;
Point drawpt;
Prefab_Compound*highlight;
List* first;
List* last;
List* vfirst;
List* vlast;
int nkids;
int newline;
int pkind; /* for error check against e.kind */
};
struct PCompound
{
Prefab_Compound c;
Display* display;
};
extern Type* TLayout;
extern Type* TElement;
extern Type* TCompound;
PCompound* iconbox(Prefab_Environ*, Draw_Point, String*, Draw_Image*, Draw_Image*);
PCompound* textbox(Prefab_Environ*, Draw_Rect, String*, String*);
PCompound* layoutbox(Prefab_Environ*, Draw_Rect, String*, List*);
PCompound* box(Prefab_Environ*, Draw_Point, Prefab_Element*, Prefab_Element*);
PElement* separatorelement(Prefab_Environ*, Draw_Rect, Draw_Image*, Draw_Image*);
PElement* iconelement(Prefab_Environ*, Draw_Rect, Draw_Image*, Draw_Image*);
PElement* textelement(Prefab_Environ*, String*, Draw_Rect, enum Elementtype);
PElement* layoutelement(Prefab_Environ*, List*, Draw_Rect, enum Elementtype);
PElement* elistelement(Prefab_Environ*, Prefab_Element*, enum Elementtype);
PElement* appendelist(Prefab_Element*, Prefab_Element*);
void drawcompound(Prefab_Compound*);
void redrawcompound(Image*, Rectangle, Prefab_Compound*);
void refreshcompound(Image*, Rectangle, void*);
void drawelement(Prefab_Element*, Image*, Rectangle, int, int);
void translateelement(Prefab_Element*, Point);
void adjustelement(Prefab_Element*, int, int);
void highlightelement(Prefab_Element*, Image*, Prefab_Compound*, int);
void clipelement(Prefab_Element*, Rectangle);
void scrollelement(Prefab_Element*, Point, int*);
int showelement(Prefab_Element*, Prefab_Element*);
void edge(Prefab_Environ*, Image*, Draw_Rect, Draw_Rect);
int fitrect(Rectangle*, Rectangle);
Draw_Rect edgerect(Prefab_Environ*, Draw_Point, Draw_Rect*);
List* prefabwrap(void*);
List* listoflayout(Prefab_Style*, String*, int);
extern PElement* lookupelement(Prefab_Element*);
extern PCompound* lookupcompound(Prefab_Compound*);
extern PElement* checkelement(Prefab_Element*);
extern PCompound* checkcompound(Prefab_Compound*);
extern int badenviron(Prefab_Environ*, int);
extern PElement* mkelement(Prefab_Environ*, enum Elementtype);
extern Point iconsize(Image*);
extern void localrefreshcompound(Memimage*, Rectangle, void*);