示例#1
0
文件: cmnutils.c 项目: juddy/edcde
void delete_all_list_items (Widget list)
{
XtArgVal /* int */ item_count = 0;

XtVaGetValues (list, XmNitemCount, &item_count, NULL);
if (item_count > 0) {
  XmListDeleteItemsPos (list, item_count, 1);
}
return;
}
示例#2
0
void RGISGrpPanel::Remove (DBObjTableField *group)

	{
	int *selectPos, selectCount;

	if(!XmListGetSelectedPos (GroupListWGT,&selectPos,&selectCount)) return;
	if (selectCount > 1) { XtFree ((char *) selectPos); return; }
	XmListDeleteItemsPos (GroupListWGT,1,selectPos [0]);
	if (GroupLIST != (DBObjectLIST<DBObjTableField> *) NULL)
		XmListSelectPos (GroupListWGT,selectPos [0],True);
	}
示例#3
0
/* Iterate through all descendents of an mo_node, but not the given
   mo_node itself, and kill them.  This is equivalent to calling
   mo_kill_node on each of those nodes, except this is faster since
   all the Motif list entries can be killed at once. */
mo_status mo_kill_node_descendents (mo_window *win, mo_node *node)
{
  mo_node *foo;
  int count = 0;

  if (node == NULL)
    return mo_succeed;
  for (foo = node->next; foo != NULL; foo = foo->next)
    {
      mo_free_node_data (foo);
      count++;
    }

  /* Free count number of items from the end of the list... */
  if (win->history_list && count)
    {
      XmListDeleteItemsPos (win->history_list, count, node->position + 1);
    }

  return mo_succeed;
}
示例#4
0
/*
 * The following callback routine deletes (NITEMS - VITEMS) items
 * from the scrollList, resulting in the disappearence of the
 * vertical scrollbar. Also, if CR5080 has not been fixed, or
 * has reappeared, this will result in a core dump.
 */
static void delete_items(Widget w, XtPointer client_data,
			XtPointer call_data)

{
  XmListDeleteItemsPos (List1, (NITEMS - VITEMS), VITEMS);
}
示例#5
0
文件: Command.c 项目: att/uwin
static void
_XmCommandCallback(Widget w, XtPointer client, XtPointer call)
{
    XmCommandCallbackStruct cbs;
    XmAnyCallbackStruct *p = (XmAnyCallbackStruct *)call;
    XmListCallbackStruct *l = (XmListCallbackStruct *) call;
    XmCommandWidget cw = (XmCommandWidget)XtParent(w);
    char *t;

    if (client != C_ACT)
	cw = (XmCommandWidget)XtParent(XtParent(w));

    DEBUGOUT(_LtDebug(__FILE__, (Widget)cw, "_XmCommandCallback [%s]\n",
	(client == C_ACT) ? "TextField Activate" : "List Selection"));

    /*
     * In the cases of TextField Activate and List DefaultAction, we need to
     * call a callback ourselves.
     * In the List SingleSelect case, just make the list item show up in
     * TextField.
     */
    if (client == C_ACT)
    {
	cbs.reason = XmCR_COMMAND_ENTERED;
	cbs.event = p->event;

	t = XmTextFieldGetString(w);

	cbs.value = XmStringCreateSimple(t);
	cbs.length = (t == NULL) ? 0 : strlen(t);

	XtFree(t);

	XtCallCallbackList((Widget)cw, cw->command.callback, &cbs);
    }

    if (client == C_LIST_SELECT)
    {
	if (!XmStringGetLtoR(l->item, XmFONTLIST_DEFAULT_TAG, &t))
	{
	    return;
	}

	XmTextFieldSetString(SB_Text(cw), t);

	cbs.value = XmStringCreateSimple(t);

	XtFree(t);

	return;
    }

    if (client == C_LIST_DOUBLE)
    {
	cbs.reason = XmCR_COMMAND_ENTERED;
	cbs.event = l->event;
	cbs.value = l->item;
	cbs.length = XmStringLength(l->item);

	XtCallCallbackList((Widget)cw, cw->command.callback, &cbs);
    }

    /* If we have an error condition, remove it */
    if (Com_Error(cw))
    {
	Com_Error(cw) = False;
	XmListDeletePos(SB_List(cw), 0);
    }

    /* We need to blindly insert now.  */
    XmListAddItemUnselected(SB_List(cw), cbs.value, 0);  /* 0 is at the end */

    /*
     * If #items in list is larger than HistoryMaxItems, remove the first
     * This code will actually delete more than just the first item, in case
     * some sick programmer decides to manually cram more items in the list
     * than XmNhistoryMaxItems allows
     */
    if (List_ItemCount(SB_List(cw)) > Com_HistoryMaxItems(cw))
    {
	DEBUGOUT(_LtDebug(__FILE__, (Widget)cw,
			  "_XmCommandCallback: List too long; removing %d items"
			  " from list\n",
			  List_ItemCount(SB_List(cw)) -
				Com_HistoryMaxItems(cw)));

	XmListDeleteItemsPos(SB_List(cw),
			     List_ItemCount(SB_List(cw)) -
				Com_HistoryMaxItems(cw), 1);
    }
    if (client != C_LIST_DOUBLE)	/* FIX ME - I think this is right ! */
    {
	XmStringFree(cbs.value);
    }

    /* Clear the text field */
    XmTextFieldSetString(SB_Text(cw), "");
}