Exemplo n.º 1
0
static void draw_atom(Display *disp, Window w, GC gc,
                      atom_id ai, iv2 vec2[], unsigned long col[], int size[],
                      bool bBall, bool bPlus)
{
    int xi, yi;

    xi = vec2[ai][XX];
    yi = vec2[ai][YY];
    XSetForeground(disp, gc, col[ai]);
    if (bBall)
    {
        XFillCircle(disp, w, gc, xi, yi, size[ai]-1);
        XSetForeground(disp, gc, BLACK);
        XDrawCircle(disp, w, gc, xi, yi, size[ai]);
        /*    XSetForeground(disp,gc,WHITE);
           XFillCircle(disp,w,gc,xi+4,yi-4,4); */
    }
    else if (bPlus)
    {
        XDrawLine(disp, w, gc, xi-MSIZE, yi, xi+MSIZE+1, yi);
        XDrawLine(disp, w, gc, xi, yi-MSIZE, xi, yi+MSIZE+1);
    }
    else
    {
        XDrawLine(disp, w, gc, xi-1, yi, xi+1, yi);
    }

}
Exemplo n.º 2
0
static int WndProcRB(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
{
    t_radiobutton *rb;
    t_windata     *win;
    int            x, y, rad;

    if (dlgitem->type != edlgRB)
    {
        gmx_incons("radiobutton processing");
    }
    rb  = &(dlgitem->u.radiobutton);
    win = &(dlgitem->win);

    rad = win->height/3;
    x   = rad;
    y   = win->height/2;
    switch (event->type)
    {
        case Expose:
            XClearArea(x11->disp, win->self, x-rad, y-rad, x+rad, y+rad, False);
            if (rb->bSelect)
            {
                /* Filled */
                XFillCircle(x11->disp, win->self, x11->gc, x, y, rad);
            }
            XDrawCircle(x11->disp, win->self, x11->gc, x, y, rad);
            x += rad+OFFS_X;
            TextInRect(x11, win->self, win->text, x, 0, win->width-x, win->height,
                       eXLeft, eYCenter);
            break;
        case ButtonPress:
            if (!rb->bSelect)
            {
                return RBPRESSED;
            }
            XBell(x11->disp, 50);
            break;
        case EnterNotify:
        case LeaveNotify:
            break;
        default:
            return DefWndProc(x11, dlgitem, event);
    }
    return ITEMOK;
}