Beispiel #1
0
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeMenuItemPreviousItem(Widget item)
{
	int			position_index;
	Widget		parent;
	Cardinal	num_children;
	Widget		previous = NULL;

    assert( _XfeIsAlive(item) );
    assert( XtIsObject(item) );

	parent = _XfeParent(item);

    assert( XmIsRowColumn(_XfeParent(item)) );

	position_index = XfeMenuItemPositionIndex(item);

	num_children = _XfemNumChildren(parent);

	if (position_index > 0)
	{
		previous = _XfeChildrenIndex(parent,position_index - 1);
	}

	return previous;
}
Beispiel #2
0
void
awt_util_mapChildren(Widget w, void (*func)(Widget,void *),
                     int32_t applyToCurrent, void *data) {
    WidgetList                  wlist;
    Cardinal                    wlen = 0;
    Cardinal                    i;

    /* The widget may have been destroyed by another thread. */
    if ((w == NULL) || (!XtIsObject(w)) || (w->core.being_destroyed))
        return;

    if (applyToCurrent != 0) {
        (*func)(w, data);
    }
    if (!XtIsComposite(w)) {
        return;
    }

    XtVaGetValues(w,
                  XmNchildren, &wlist,
                  XmNnumChildren, &wlen,
                  NULL);
    if (wlen > 0) {
        for (i=0; i < wlen; i++) {
            awt_util_mapChildren(wlist[i], func, 1, data);
        }
    }
}
Beispiel #3
0
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeMenuItemNextItem(Widget item)
{
	int			position_index;
	Widget		parent;
	Cardinal	num_children;
	Widget		next = NULL;

    assert( _XfeIsAlive(item) );
    assert( XtIsObject(item) );

	parent = _XfeParent(item);

    assert( XmIsRowColumn(_XfeParent(item)) );

	position_index = XfeMenuItemPositionIndex(item);

	num_children = _XfemNumChildren(parent);

	if (position_index < (num_children - 1))
	{
		next = _XfeChildrenIndex(parent,position_index + 1);
	}

	return next;
}
Beispiel #4
0
/*----------------------------------------------------------------------*/
/* extern */ int
XfeMenuItemPositionIndex(Widget item)
{
	XmRowColumnConstraintRec * rccp;

    assert( _XfeIsAlive(item) );
    assert( XmIsRowColumn(_XfeParent(item)) );
    assert( XtIsObject(item) );

	rccp = (XmRowColumnConstraintRec *) (item -> core . constraints);

	return (int) rccp -> row_column . position_index;
}
JNIEXPORT void JNICALL
Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
				       jobject newSource)
{
    jbyteArray bdata;

    AWT_LOCK();

    bdata = (jbyteArray)(*env)->GetObjectField(env, self, awtEventIDs.bdata);

    if (bdata != NULL) {
	XEvent *xev;
	Window w;
	jboolean dummy;

	/* get the widget out of the peer newSource */
	struct ComponentData *cdata = (struct ComponentData *)
	    JNU_GetLongFieldAsPtr(env, newSource, mComponentPeerIDs.pData);
	if (JNU_IsNull(env, cdata) || (cdata == NULL) ||
	    ((cdata->widget != NULL) && (XtIsObject(cdata->widget)) &&
	     (cdata->widget->core.being_destroyed))) {
	    JNU_ThrowNullPointerException(env, "null widget");
	    AWT_UNLOCK();
	    return;
	}
	
	/* get the Window out of the widget */
	w = XtWindow(cdata->widget);

	if (w == None) {
	    JNU_ThrowNullPointerException(env, "null window");
	    AWT_UNLOCK();
	    return;
	}

	/* reset the filed in the event */
	xev = (XEvent *)(*env)->GetPrimitiveArrayCritical(env, bdata, &dummy);
	if (xev == NULL) {
	    JNU_ThrowNullPointerException(env, "null data");
	    AWT_UNLOCK();
	    return;
	}
	xev->xany.window = w;
	(*env)->ReleasePrimitiveArrayCritical(env, bdata, (void *)xev, 0);
    }

    AWT_UNLOCK();
}