void w_cpwalk(WORD wh, WORD obj, WORD depth, WORD usetrue) { GRECT c; /* start with window's */ /* true size as clip */ if ( usetrue ) w_getsize(WS_TRUE, wh, &c); else { /* use global clip */ gsx_gclip(&c); /* add in drop shadow */ c.g_w += 2; c.g_h += 2; } w_bldactive(wh); do_walk(wh, gl_awind, obj, depth, &c); }
void wm_set(WORD w_handle, WORD w_field, WORD *pinwds) { WORD which, liketop, i; register WORD wbar; WORD osl, osz, nsl, nsz; GRECT t; WINDOW *pwin; osl = osz = nsl = nsz = 0; which = -1; /* grab the window sync */ wm_update(TRUE); pwin = &D.w_win[w_handle]; wbar = wm_gsizes(w_field, &osl, &osz); if (wbar) { pinwds[0] = max(-1, pinwds[0]); pinwds[0] = min(1000, pinwds[0]); } liketop = ( ( w_handle == gl_wtop ) || ( pwin->w_flags & VF_SUBWIN ) ); switch(w_field) { case WF_NAME: which = W_NAME; break; case WF_INFO: which = W_INFO; break; case WF_SIZTOP: ob_order(gl_wtree, w_handle, NIL); /* fall thru */ case WF_CXYWH: draw_change(w_handle, (GRECT *)&pinwds[0]); break; case WF_TOP: if (w_handle != gl_wtop) { for(i=W_TREE[ROOT].ob_head; i>ROOT; i=W_TREE[i].ob_next) { if ( (i != w_handle) && (D.w_win[i].w_owner == rlr) && (D.w_win[i].w_flags & VF_SUBWIN) && (pwin->w_flags & VF_SUBWIN) ) wm_mktop(i); } wm_mktop(w_handle); } break; case WF_NEWDESK: pwin->w_owner = rlr; desk_tree[rlr->p_pid] = gl_newdesk = *(LONG *) &pinwds[0]; desk_root[rlr->p_pid] = gl_newroot = pinwds[2]; break; case WF_HSLSIZ: pwin->w_hslsiz = pinwds[0]; break; case WF_VSLSIZ: pwin->w_vslsiz = pinwds[0]; break; case WF_HSLIDE: pwin->w_hslide = pinwds[0]; break; case WF_VSLIDE: pwin->w_vslide = pinwds[0]; break; case WF_TATTRB: if (pinwds[0] & WA_SUBWIN) pwin->w_flags |= VF_SUBWIN; else pwin->w_flags &= ~VF_SUBWIN; if (pinwds[0] & WA_KEEPWIN) pwin->w_flags |= VF_KEEPWIN; else pwin->w_flags &= ~VF_KEEPWIN; break; } if ( (wbar) && (liketop) ) { w_bldactive(w_handle); wm_gsizes(w_field, &nsl, &nsz); if ( (osl != nsl) || (osz != nsz) || (pwin->w_flags & VF_SUBWIN) ) { w_getsize(WS_TRUE, w_handle, &t); do_walk(w_handle, gl_awind, wbar + 3, MAX_DEPTH, &t); } } if (which != -1) w_strchg(w_handle, which, *(LONG *)pinwds); /* give up the sync */ wm_update(FALSE); }
static void hctl_window(WORD w_handle, WORD mx, WORD my) { GRECT t, f, pt; WINDOW *pwin = &D.w_win[w_handle]; WORD x, y, w, h; WORD wm, hm; WORD kind; WORD cpt, message; LONG tree; message = 0; x = y = w = h = 0; if ( (w_handle == gl_wtop) || ( (pwin->w_flags & VF_SUBWIN) && (D.w_win[gl_wtop].w_flags & VF_SUBWIN) ) ) { /* * went down on active window so handle control points */ w_bldactive(w_handle); tree = gl_awind; cpt = ob_find(gl_awind, 0, 10, mx, my); w_getsize(WS_CURR, w_handle, &t); r_get(&t, &x, &y, &w, &h); kind = pwin->w_kind; switch(cpt) { case W_CLOSER: if ( kind & HOTCLOSE ) { message = WM_CLOSED; break; } /* else fall thru */ case W_FULLER: if ( gr_watchbox(gl_awind, cpt, SELECTED, NORMAL) ) { message = (cpt == W_CLOSER) ? WM_CLOSED : WM_FULLED; ob_change(gl_awind, cpt, NORMAL, TRUE); } break; case W_NAME: if ( kind & MOVER ) { /* prevent the mover gadget from being moved completely offscreen */ r_set(&f, 0, gl_hbox, gl_rscreen.g_w + w - gl_wbox - 6, MAX_COORDINATE); gr_dragbox(w, h, x, y, &f, &x, &y); message = WM_MOVED; } break; case W_SIZER: if (kind & SIZER) { w_getsize(WS_WORK, w_handle, &t); t.g_x -= x; t.g_y -= y; t.g_w -= w; t.g_h -= h; wm = gl_wchar; hm = gl_hchar; if (kind & (LFARROW | RTARROW | HSLIDE)) wm = gl_wbox * 7; if (kind & (UPARROW | DNARROW | VSLIDE)) hm = gl_hbox * 7; gr_rubwind(x, y, wm, hm, &t, &w, &h); message = WM_SIZED; } break; case W_HSLIDE: case W_VSLIDE: ob_actxywh(tree, cpt + 1, &pt); if (inside(mx, my, &pt)) { cpt = (cpt==W_HSLIDE) ? W_HELEV : W_VELEV; goto doelev; } /* fix up cpt for index into gl_wa[] */ if (cpt == W_HSLIDE) { if ( !(mx < pt.g_x) ) cpt += 1; } else { if ( !(my < pt.g_y) ) cpt += 1; } /* fall thru */ case W_UPARROW: case W_DNARROW: case W_LFARROW: case W_RTARROW: message = WM_ARROWED; x = gl_wa[cpt - W_UPARROW]; break; case W_HELEV: case W_VELEV: doelev: message = (cpt == W_HELEV) ? WM_HSLID : WM_VSLID; x = gr_slidebox(gl_awind, cpt - 1, cpt, (cpt == W_VELEV)); /* slide is 1 less than elev */ break; } } else { perform_untop(gl_wtop); /* * went down on inactive window so tell ap. to bring it to top */ message = WM_TOPPED; } ct_msgup(message, pwin->w_owner, w_handle, x, y, w, h); }