2
/* Lefteris Koutsofios - AT&T Bell Laboratories */
9
#define WVU widget->u.v
11
int GVcreatewidget (Gwidget_t *parent, Gwidget_t *widget,
12
int attrn, Gwattr_t *attrp) {
21
wflags = WS_OVERLAPPEDWINDOW;
23
po.x = po.y = CW_USEDEFAULT;
24
ps.x = ps.y = MINVWSIZE;
25
for (ai = 0; ai < attrn; ai++) {
26
switch (attrp[ai].id) {
28
GETORIGIN (attrp[ai].u.p, po);
31
GETSIZE (attrp[ai].u.s, ps, MINVWSIZE);
37
Gerr (POS, G_ERRCANNOTSETATTR1, "zorder");
40
Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
43
WVU->func = attrp[ai].u.func;
46
widget->udata = attrp[ai].u.u;
49
Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
53
if (!(widget->w = CreateWindow ("LeftyClass", s, wflags, po.x, po.y,
54
ps.x, ps.y, (HWND) 0, (HMENU) 0, hinstance, NULL))) {
55
Gerr (POS, G_ERRCANNOTCREATEWIDGET);
58
ShowWindow (widget->w, SW_SHOW);
59
UpdateWindow (widget->w);
63
int GVsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
66
DWORD wflags1, wflags2, wflags3, wflags4;
69
wflags1 = SWP_NOMOVE | SWP_NOZORDER;
70
wflags2 = SWP_NOSIZE | SWP_NOZORDER;
71
wflags3 = SWP_NOSIZE | SWP_NOMOVE;
72
wflags4 = SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE;
73
for (ai = 0; ai < attrn; ai++) {
74
switch (attrp[ai].id) {
76
GETORIGIN (attrp[ai].u.p, po);
77
SetWindowPos (widget->w, (HWND) NULL, po.x, po.y, 0, 0, wflags2);
80
GETSIZE (attrp[ai].u.s, ps, MINVWSIZE);
81
SetWindowPos (widget->w, (HWND) NULL, 0, 0, ps.x, ps.y, wflags1);
84
SetWindowText (widget->w, attrp[ai].u.t);
87
if (Strcmp (attrp[ai].u.t, "top") == 0)
88
SetWindowPos (widget->w, (HWND) HWND_TOP, 0, 0, 0, 0, wflags3);
89
else if (Strcmp (attrp[ai].u.t, "bottom") == 0)
90
SetWindowPos (widget->w, (HWND) HWND_BOTTOM,
93
Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
98
Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
101
WVU->func = attrp[ai].u.func;
104
widget->udata = attrp[ai].u.u;
107
Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
114
int GVgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
118
for (ai = 0; ai < attrn; ai++) {
119
switch (attrp[ai].id) {
121
GetWindowRect (widget->w, &r);
122
attrp[ai].u.p.x = r.left, attrp[ai].u.p.y = r.top;
125
GetWindowRect (widget->w, &r);
126
attrp[ai].u.s.x = r.right - r.left;
127
attrp[ai].u.s.y = r.bottom - r.top;
130
Gerr (POS, G_ERRNOTIMPLEMENTED);
133
Gerr (POS, G_ERRNOTIMPLEMENTED);
136
sprintf (&Gbufp[0], "0x%lx", widget->w);
137
attrp[ai].u.t = &Gbufp[0];
140
attrp[ai].u.func = WVU->func;
143
attrp[ai].u.u = widget->udata;
146
Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
153
int GVdestroywidget (Gwidget_t *widget) {
155
DestroyWindow (widget->w);