static gmx_bool ButtonCallBack(t_x11 *x11, XEvent *event, Window w, void *data) { XEvent letter; t_mwbut *but; t_windata *wd; but = (t_mwbut *)data; wd = &(but->wd); switch (event->type) { case Expose: XSetForeground(x11->disp, x11->gc, WHITE); XDrawRoundRect(x11->disp, wd->self, x11->gc, 0, 0, wd->width-1, wd->height-1); TextInWin(x11, wd, wd->text, eXCenter, eYCenter); XSetForeground(x11->disp, x11->gc, x11->fg); break; case EnterNotify: /* LightBorder(x11->disp,wd->self,WHITE);*/ XSetForeground(x11->disp, x11->gc, WHITE); XDrawRoundRect(x11->disp, wd->self, x11->gc, 1, 1, wd->width-3, wd->height-3); XSetForeground(x11->disp, x11->gc, x11->fg); break; case LeaveNotify: /* LightBorder(x11->disp,wd->self,BLUE);*/ XSetForeground(x11->disp, x11->gc, BLUE); XDrawRoundRect(x11->disp, wd->self, x11->gc, 1, 1, wd->width-3, wd->height-3); XSetForeground(x11->disp, x11->gc, x11->fg); break; case ButtonPress: letter.type = ClientMessage; letter.xclient.display = x11->disp; letter.xclient.window = wd->Parent; letter.xclient.message_type = 0; letter.xclient.format = 32; letter.xclient.data.l[0] = but->ID; letter.xclient.data.l[1] = (long)event->xbutton.button; XSendEvent(x11->disp, wd->Parent, True, 0, &letter); break; default: break; } return FALSE; }
void RectWin(Display *disp, GC gc, t_windata *win, unsigned long color) { int bw = 1; /*2*w.bwidth;*/ XSetForeground(disp, gc, color); XDrawRoundRect(disp, win->self, gc, 0, 0, win->width-bw, win->height-bw); }
static int WndProcGB(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event) { t_windata *win; int x, y; if (dlgitem->type != edlgGB) { gmx_incons("gb processing"); } win = &(dlgitem->win); x = XTextWidth(x11->font, win->text, strlen(win->text)); y = XTextHeight(x11->font); switch (event->type) { case Expose: XSetForeground(x11->disp, x11->gc, x11->fg); XDrawRoundRect(x11->disp, win->self, x11->gc, 0, y/2, win->width-1, win->height-y/2-1); XClearArea(x11->disp, win->self, OFFS_X, 0, x+OFFS_X, y, False); TextInRect(x11, win->self, win->text, 2*OFFS_X, 0, x, y, eXCenter, eYCenter); break; case EnterNotify: case LeaveNotify: break; default: return DefWndProc(x11, dlgitem, event); } return ITEMOK; }
void RoundRectWin(Display *disp, GC gc, t_windata *win, int offsx, int offsy, unsigned long color) { XSetLineAttributes(disp, gc, 1, LineOnOffDash, CapButt, JoinRound); XSetForeground(disp, gc, color); XDrawRoundRect(disp, win->self, gc, offsx, offsy, win->width-2*offsx-1, win->height-2*offsy-1); XSetLineAttributes(disp, gc, 1, LineSolid, CapButt, JoinRound); }