예제 #1
0
static gboolean
gnt_check_box_clicked(GntWidget *widget, GntMouseEvent event, int x, int y)
{
	if (event == GNT_LEFT_MOUSE_DOWN) {
		toggle_selection(widget);
		return TRUE;
	}
	return FALSE;
}
예제 #2
0
static gboolean
gnt_check_box_key_pressed(GntWidget *widget, const char *text)
{
	if (text[0] == ' ' && text[1] == '\0')
	{
		toggle_selection(widget);
		return TRUE;
	}

	return FALSE;
}
예제 #3
0
파일: boxes.c 프로젝트: huilang22/Projects
/****************************************

                widget_cb

*****************************************
Purpose:  To process user interactions from the
          widgets used in the detail view.
****************************************/
void widget_cb (Widget w, XtPointer client_data,
		XtPointer call_data)
{
  XmDrawingAreaCallbackStruct *cb;
  XButtonEvent *event;          /* event */
  int           ndx;            /* index into accts table */
  static int    old_time = -1;	/* time of previous event */

  cb = (XmDrawingAreaCallbackStruct *) call_data;
  event = (XButtonEvent *) cb->event;
  ndx = (int) client_data;

  /* only process on button-up */

  if ((cb->reason == XmCR_INPUT) && (event->type == ButtonRelease))
  {

    /* button 1 is used for selection; on double-click send message to */
    /* custinfo */

    if (event->button == Button1 || event->button == Button2)
    {
      toggle_selection (ndx);
      if (event->time < old_time + DOUBLE_CLICK_TIME)
      {
	send_account (&outbuf, &inbuf, accts[ndx].account_no, child);
	sprintf (buf, "Sending account <%s> to CustInfo",
		 accts[ndx].external_id);
	XmTextFieldSetString(orgview_status, buf);
      }
      old_time = event->time;	/* save time of event */
    }

    /* button 3 is used to display more information about the account */
    /* in a popup */

    else if (event->button == Button3)
      display_selected_account (ndx);
  }
  else				/* simple refresh */
    if (XtWindow (accts[ndx].bb)) /* widget has been initialized */
    {
      if (selected_acct == ndx)	/* need to recolor background */
	XtVaSetValues (accts[ndx].bb, XmNbackground, highlight, NULL);
      draw_widget_text (ndx, ndx == selected_acct); /* refresh the text */
    }
}