Esempio n. 1
0
void EvtKeyVScrollBar(struct XObj *xobj, XKeyEvent *EvtKey)
{
	KeySym ks;
	unsigned char buf[10];

	XLookupString(EvtKey, (char *)buf, sizeof(buf), &ks, NULL);
	if (ks == XK_Down && xobj->value > 0) {
		HideThumbV(xobj);
		xobj->value--;
		DrawThumbV(xobj, NULL);
		SendMsg(xobj,SingleClic);
	}
	else if (ks == XK_Up &&
		 xobj->value <
		 xobj->width*(xobj->value3-xobj->value2) /
		 (xobj->width)+xobj->value2) {
		HideThumbV(xobj);
		xobj->value++;
		DrawThumbV(xobj, NULL);
		SendMsg(xobj,SingleClic);
	}
	else if (ks == XK_Return) {
		EvtMouseVScrollBar(xobj, NULL);
	}
}
Esempio n. 2
0
void DrawVScrollBar(struct XObj *xobj)
{
  int x,y,w,h;
  char str[20];
  int asc,desc,dir;
  XCharStruct struc;

  /* Calcul de la taille de l'ascenseur */
  x = xobj->width/2 - 12;
  y = 0;
  w = 24;
  h = xobj->height;
  DrawReliefRect(x, y, w, h, xobj, shad, hili);
  DrawThumbV(xobj);

  /* Ecriture des valeurs */
  XTextExtents(xobj->xfont, "lp", strlen("lp"), &dir, &asc, &desc, &struc);
  x = x + 26;
  y = asc + 2;
  sprintf(str, "%d", xobj->value3);
  DrawString(dpy, xobj, xobj->win, x, y, str, strlen(str), fore, hili, back,
	     !xobj->flags[1]);
  sprintf(str, "%d", xobj->value2);
  y = h - desc - 2;
  DrawString(dpy, xobj, xobj->win, x, y, str, strlen(str), fore, hili, back,
	     !xobj->flags[1]);
}
Esempio n. 3
0
void EvtMouseVScrollBar(struct XObj *xobj, XButtonEvent *EvtButton)
{
	static XEvent event;
	int oldy = 0;
	int oldvalue = -1;
	int newvalue;
	int x1,y1,x2,y2;
	Window Win1,Win2;
	unsigned int modif;
	fd_set in_fdset;

	do
	{
		/* On suit les mouvements de la souris */
		FQueryPointer(dpy, *xobj->ParentWin, &Win1, &Win2,
			      &x1, &y1, &x2, &y2, &modif);
		y2 = y2 - xobj->y;
		if (y2 < 15)
			y2 = 15;
		if (y2 > xobj->height - 21)
			y2 = xobj->height - 21;
		if (oldy != y2)
		{
			oldy = y2;
			/* calcule de xobj->value */
			newvalue = (y2-15)*xobj->height/(xobj->height - 36) *
				(xobj->value2 - xobj->value3) /
				(xobj->height) + xobj->value3;
			if (newvalue!=oldvalue)
			{
				HideThumbV(xobj);
				xobj->value = newvalue;
				DrawThumbV(xobj, NULL);
				oldvalue = newvalue;
				SendMsg(xobj,SingleClic);
				XSync(dpy,0);
				usleep(10000);
			}
		}
		FD_ZERO(&in_fdset);
		FD_SET(x_fd, &in_fdset);
		select(32, SELECT_FD_SET_CAST &in_fdset, NULL, NULL, NULL);
	}
	while (!FCheckTypedEvent(dpy, ButtonRelease, &event) &&
	       EvtButton != NULL);
}
Esempio n. 4
0
void DrawVScrollBar(struct XObj *xobj, XEvent *evp)
{
	int x,y,w,h;
	char str[20];

	/* Calcul de la taille de l'ascenseur */
	x = xobj->width/2 - 12;
	y = 0;
	w = 24;
	h = xobj->height;
	DrawThumbV(xobj, evp);
	DrawReliefRect(x, y, w, h, xobj, shad, hili);
	/* Ecriture des valeurs */
	x = x + 26;
	y = xobj->Ffont->ascent + 2;
	sprintf(str, "%d", xobj->value3);
	MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back,
		     !xobj->flags[1], NULL, evp);
	sprintf(str, "%d", xobj->value2);
	y = h - xobj->Ffont->descent - 2;
	MyDrawString(dpy, xobj, xobj->win, x, y, str, fore, hili, back,
		     !xobj->flags[1], NULL, evp);
}