LOCAL void fb_setattrs(WINDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; WINWINDOW *win = req->tvr_Op.SetAttrs.Window; TINT neww, newh; data.v = win; data.num = 0; data.mod = mod; data.neww = -1; data.newh = -1; TInitHook(&hook, setattrfunc, &data); TForEachTag(req->tvr_Op.SetAttrs.Tags, &hook); req->tvr_Op.SetAttrs.Num = data.num; win_getminmax(win, &win->fbv_MinWidth, &win->fbv_MinHeight, &win->fbv_MaxWidth, &win->fbv_MaxHeight, TFALSE); neww = data.neww < 0 ? (TINT) win->fbv_Width : data.neww; newh = data.newh < 0 ? (TINT) win->fbv_Height : data.newh; if (neww < win->fbv_MinWidth || newh < win->fbv_MinHeight) { neww = TMAX(neww, win->fbv_MinWidth); newh = TMAX(newh, win->fbv_MinHeight); neww += win->fbv_BorderWidth; newh += win->fbv_BorderHeight; SetWindowPos(win->fbv_HWnd, NULL, 0, 0, neww, newh, SWP_NOMOVE); } }
LOCAL void dfb_setattrs(DFBDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; DFBWINDOW *v = req->tvr_Op.SetAttrs.Window; data.v = v; data.num = 0; data.mod = mod; data.sizechanged = TFALSE; TInitHook(&hook, setattrfunc, &data); TForEachTag(req->tvr_Op.SetAttrs.Tags, &hook); req->tvr_Op.SetAttrs.Num = data.num; if (data.sizechanged) { TIMSG *imsg; v->wminwidth = v->wminwidth <= 0 ? 1 : v->wminwidth; v->wminheight = v->wminheight <= 0 ? 1 : v->wminheight; v->wmaxwidth = v->wmaxwidth <= 0 ? 1000000 : v->wmaxwidth; v->wmaxheight = v->wmaxheight <= 0 ? 1000000 : v->wmaxheight; if (v->wmaxwidth > 0) v->winwidth = TMIN(v->winwidth, v->wmaxwidth); if (v->wmaxheight > 0) v->winheight = TMIN(v->winheight, v->wmaxheight); if (v->wminwidth > 0) v->winwidth = TMAX(v->winwidth, v->wminwidth); if (v->wminheight > 0) v->winheight = TMAX(v->winheight, v->wminheight); v->window->Resize(v->window, v->winwidth, v->winheight); if ((v->eventmask & TITYPE_NEWSIZE) && getimsg(mod, v, &imsg, TITYPE_NEWSIZE)) { imsg->timsg_Width = v->winwidth; imsg->timsg_Height = v->winheight; TAddTail(&v->imsgqueue, &imsg->timsg_Node); } if ((v->eventmask & TITYPE_REFRESH) && getimsg(mod, v, &imsg, TITYPE_REFRESH)) { imsg->timsg_X = v->winleft; imsg->timsg_Y = v->wintop; imsg->timsg_Width = v->winwidth; imsg->timsg_Height = v->winheight; TAddTail(&v->imsgqueue, &imsg->timsg_Node); } } }
LOCAL void dfb_drawtags(DFBDISPLAY *mod, struct TVRequest *req) { struct THook hook; struct drawdata data; data.v = req->tvr_Op.DrawTags.Window; data.mod = mod; TInitHook(&hook, drawtagfunc, &data); TForEachTag(req->tvr_Op.DrawTags.Tags, &hook); }
LOCAL void fb_drawtags(WINDISPLAY *mod, struct TVRequest *req) { WINWINDOW *win = req->tvr_Op.DrawTags.Window; struct THook hook; struct drawdata data; data.v = win; data.mod = mod; data.fgpen = TNULL; data.bgpen = TNULL; TInitHook(&hook, drawtagfunc, &data); TForEachTag(req->tvr_Op.DrawTags.Tags, &hook); }
LOCAL void dfb_getfontattrs(DFBDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; data.mod = mod; data.font = req->tvr_Op.GetFontAttrs.Font; data.num = 0; TInitHook(&hook, dfb_hostgetfattrfunc, &data); TForEachTag(req->tvr_Op.GetFontAttrs.Tags, &hook); req->tvr_Op.GetFontAttrs.Num = data.num; }
LOCAL void dfb_getattrs(DFBDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; data.v = req->tvr_Op.GetAttrs.Window; data.num = 0; data.mod = mod; TInitHook(&hook, getattrfunc, &data); TForEachTag(req->tvr_Op.GetAttrs.Tags, &hook); req->tvr_Op.GetAttrs.Num = data.num; }
LOCAL void fb_getfontattrs(WINDISPLAY *mod, struct TVRequest *req) { struct attrdata data; data.num = 0; struct THook hook; SelectObject(mod->fbd_DeviceHDC, req->tvr_Op.GetFontAttrs.Font); if (GetTextMetrics(mod->fbd_DeviceHDC, &data.textmetric)) { data.mod = mod; TInitHook(&hook, fb_hostgetfattrfunc, &data); TForEachTag(req->tvr_Op.GetFontAttrs.Tags, &hook); } req->tvr_Op.GetFontAttrs.Num = data.num; }
LOCAL void fb_getattrs(WINDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; WINWINDOW *win = req->tvr_Op.GetAttrs.Window; data.v = win; data.num = 0; data.mod = mod; TInitHook(&hook, getattrfunc, &data); EnterCriticalSection(&win->fbv_LockExtents); TForEachTag(req->tvr_Op.GetAttrs.Tags, &hook); LeaveCriticalSection(&win->fbv_LockExtents); req->tvr_Op.GetAttrs.Num = data.num; }
LOCAL void fb_setattrs(WINDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; WINWINDOW *win = req->tvr_Op.SetAttrs.Window; TINT noww, nowh, neww, newh, minw, minh; data.v = win; data.num = 0; data.mod = mod; data.neww = -1; data.newh = -1; TInitHook(&hook, setattrfunc, &data); EnterCriticalSection(&win->fbv_LockExtents); TForEachTag(req->tvr_Op.SetAttrs.Tags, &hook); win_getminmax(win, &win->fbv_MinWidth, &win->fbv_MinHeight, &win->fbv_MaxWidth, &win->fbv_MaxHeight, TFALSE); noww = (TINT) win->fbv_Width; nowh = (TINT) win->fbv_Height; minw = (TINT) win->fbv_MinWidth; minh = (TINT) win->fbv_MinHeight; LeaveCriticalSection(&win->fbv_LockExtents); neww = data.neww < 0 ? noww : data.neww; newh = data.newh < 0 ? nowh : data.newh; if (neww < minw || newh < minh) { neww = TMAX(neww, minw); newh = TMAX(newh, minh); neww += win->fbv_BorderWidth; newh += win->fbv_BorderHeight; SetWindowPos(win->fbv_HWnd, NULL, 0, 0, neww, newh, SWP_NOMOVE); } req->tvr_Op.SetAttrs.Num = data.num; }
TLIBAPI TBOOL TForEachTag(struct TTagItem *taglist, struct THook *hook) { TBOOL complete = TFALSE; if (hook) { complete = TTRUE; while (taglist && complete) { switch ((TUINT) taglist->tti_Tag) { case TTAG_DONE: return complete; case TTAG_MORE: taglist = (struct TTagItem *) taglist->tti_Value; break; case TTAG_SKIP: taglist += 1 + (TINT) taglist->tti_Value; break; case TTAG_GOSUB: complete = TForEachTag((struct TTagItem *) taglist->tti_Value, hook); taglist++; break; default: complete = (TBOOL) TCALLHOOKPKT(hook, taglist, TMSG_FOREACHTAG); case TTAG_IGNORE: taglist++; break; } } } return TFALSE; }
LOCAL void fb_getattrs(WINDISPLAY *mod, struct TVRequest *req) { struct attrdata data; struct THook hook; RECT wrect; WINWINDOW *win = req->tvr_Op.GetAttrs.Window; data.v = win; data.num = 0; data.mod = mod; TInitHook(&hook, getattrfunc, &data); GetWindowRect(win->fbv_HWnd, &wrect); win->fbv_Left = wrect.left + win->fbv_BorderLeft; win->fbv_Top = wrect.top + win->fbv_BorderHeight; win->fbv_Width = wrect.right - wrect.left - win->fbv_BorderWidth; win->fbv_Height = wrect.bottom - wrect.top - win->fbv_BorderHeight; TForEachTag(req->tvr_Op.GetAttrs.Tags, &hook); req->tvr_Op.GetAttrs.Num = data.num; }