/*----------------------------------------------------------------------*/ /* 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; }
/*----------------------------------------------------------------------*/ /* 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; }
/*----------------------------------------------------------------------*/ /* extern */ Widget XfeChildrenIndex(Widget w,Cardinal i) { assert( XtIsComposite(w) ); return _XfeChildrenIndex(w,i); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeOptionMenuSetItem(Widget menu,Cardinal i) { Widget submenu; assert( _XfeIsAlive(menu) ); assert( XfeMenuIsOptionMenu(menu) ); submenu = RC_OptionSubMenu(menu); if (_XfeIsAlive(submenu)) { if ((i >= 0) && (i < _XfemNumChildren(submenu))) { XtVaSetValues(menu,XmNmenuHistory,_XfeChildrenIndex(submenu,i),NULL); } } }
/*----------------------------------------------------------------------*/ /* extern */ Cardinal XfeChildrenCountAlive(Widget w) { Cardinal num_alive = 0; Cardinal i; assert( w != NULL ); for (i = 0; i < _XfemNumChildren(w); i ++) { if (_XfeIsAlive(_XfeChildrenIndex(w,i))) { num_alive++; } } return num_alive; }
/*----------------------------------------------------------------------*/ /* extern */ Cardinal XfeChildrenGetNumManaged(Widget w) { Cardinal i; Cardinal num_managed = 0; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); for (i = 0; i < _XfemNumChildren(w); i++) { if (_XfeIsManaged(_XfeChildrenIndex(w,i))) { num_managed++; } } return num_managed; }
/*----------------------------------------------------------------------*/ /* extern */ int XfeOptionMenuGetItem(Widget menu) { Cardinal i; Widget submenu; assert( _XfeIsAlive(menu) ); assert( XfeMenuIsOptionMenu(menu) ); submenu = RC_OptionSubMenu(menu); if (_XfeIsAlive(submenu)) { for (i = 0; i < _XfemNumChildren(submenu); i++) { if (_XfeChildrenIndex(submenu,i) == RC_MemWidget(menu)) { return (int) i; } } } return -1; }