Esempio n. 1
0
/*
*       Stretch the free corner of a XOR box(w,h) that is pinned at
*       another corner based on mouse movement until the button comes
*       up.  This is also called a rubber-band box.
*/
void gr_rubbox(WORD xorigin, WORD yorigin, WORD wmin, WORD hmin,
               WORD *pwend, WORD *phend)
{
        gr_rubwind(xorigin, yorigin, wmin, hmin, &gl_rzero, pwend, phend);
}
Esempio n. 2
0
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);
}