Ejemplo n.º 1
0
void 
PostMenuCB( Widget w, XtPointer client_data, XtPointer call_data )
{

    XmAnyCallbackStruct *p;

    p = (XmAnyCallbackStruct *) call_data;

#ifdef VG_TRACE
    vg_TRACE_EXECUTION("main:  entered PostMenuCB ...");
#endif /* VG_TRACE */

    /*
     *  make options menus if they don't yet exist...
     */

    if (options_menu == NULL)
	MakeOptionsMenu();


    /*
     *  post menu...
     */

    if (p->reason == XmCR_ARM       	&&
	p->event->type == ButtonPress) {

	XmMenuPosition(options_menu, p->event);
	XtManageChild(options_menu);
    }
}
Ejemplo n.º 2
0
/* ARGSUSED */
static void NxmPushBtnMenu_poseIt(XtPointer clnt, XtIntervalId id)
/************************************************************************
 * NxmPushBtnMenu_poseIt                                                *
 *                                                                      *
 * This function actually pops up the menu.				*
 *                                                                      *
 * NxmPushBtnMenu_poseIti ( clnt, id )					*
 *                                                                      *
 * Input parameters:                                                    *
 *  clnt		XtPointer    client data			*
 *  id                  XtIntervalId timeout id 			*
 *                                                                      *
 * Output parameters:                                                   *
 *          NONE                                                        *
 *                                                                      *
 * Return parameters:                                                   *
 *          NONE                                                        *
 *                                                                      *
 **                                                                     *
 * Log:                                                                 *
 * R. Tian/SAIC		10/02						*
 ***********************************************************************/
{
    pos_t 	*pos_p;
    Widget	popup;
/*---------------------------------------------------------------------*/

    pos_p = (pos_t *)clnt;
    popup = pos_p->menu;

    XmMenuPosition(popup, &(pos_p->event));
    XtManageChild(popup);
}
Ejemplo n.º 3
0
// Doc in superclass.
void
XtNativePopupMenu::popUp(Widget inside, int x, int y)
{
  assert(inside != NULL);

  MenuRecord * root = this->getMenuRecord(0);
  if (root == NULL) {
#if SOXT_DEBUG
    SoDebugError::postInfo("XtNativePopupMenu::PopUp", "no root menu");
#endif // SOXT_DEBUG
    return;
  }
  // FIXME: build menu
  if (this->dirty) {
    if (this->popup != (Widget) NULL) {
      // FIXME: destroy existing menu widget hierarchy
    }
    this->popup = this->build(inside);
  }
  this->dirty = FALSE;

  // Find global mouse pointer coordinates.
  Display * display = XtDisplay(inside);
  XButtonEvent pos;
  Window dummyarg;
  Bool b = XTranslateCoordinates(display,
                                 XtWindow(inside),
                                 DefaultRootWindow(display),
                                 x, y, &pos.x_root, &pos.y_root, &dummyarg);
  assert(b == True); // or we've got a bug

  XmMenuPosition(this->popup, &pos);
  XtManageChild(this->popup);
} // popUp()
Ejemplo n.º 4
0
//
//  Modifies the popupmenu.
//
int WFoeMotif::modify_popup( unsigned long popupmenu_mask, int x, int y)
{
  static char buttontext[][40] = { "ObjectEditor", "SubWindow", "Connect", "Delete",
				   "Paste", "Copy", "Cut", "PrintSelect", "HelpClass"};
  static XtCallbackProc callback[] = { (void (*)(Widget,void *,void*))activate_attribute,
				       (void (*)(Widget,void *,void*))activate_subwindow,
				       (void (*)(Widget,void *,void*))activate_getobj,
				       (void (*)(Widget,void *,void*))activate_delete,
				       (void (*)(Widget,void *,void*))activate_paste,
				       (void (*)(Widget,void *,void*))activate_copy,
				       (void (*)(Widget,void *,void*))activate_cut,
				       (void (*)(Widget,void *,void*))activate_printselect,
				       (void (*)(Widget,void *,void*))activate_helpclass};

  Widget Menu, w;
  XEvent event;
  int i;
  Arg ArgList[5]; 
  XmFontList fontlist;
  XFontStruct *font;
  XmFontListEntry fontentry;

  popupmenu_mask = popupmenu_mask;

  event.xbutton.x_root = x + 5;
  event.xbutton.y_root = y;
  event.xbutton.x = 0;
  event.xbutton.y = 0;

  // Set default fontlist
  font = XLoadQueryFont( flow_Display( widgets.pane),
			 "-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1");
  fontentry = XmFontListEntryCreate( (char*) "tag1", XmFONT_IS_FONT, font);
  fontlist = XmFontListAppendEntry( NULL, fontentry);
  XtFree( (char *)fontentry);

  i = 0;
  XtSetArg(ArgList[i], XmNbuttonFontList, fontlist); i++;
  XtSetArg(ArgList[i], XmNlabelFontList, fontlist); i++;
  Menu = XmCreatePopupMenu( widgets.pane, (char*) "_popup", ArgList, i);  
  XtAddCallback( Menu, XmNunmapCallback, 
		 (XtCallbackProc)popup_unmap_cb, this);

  XmFontListFree( fontlist);

  for ( i = 0; i < 9; i++) {
    if ( popupmenu_mask & (1 << i)) {
      w = XtVaCreateManagedWidget( buttontext[i], xmPushButtonGadgetClass, 
			       Menu, NULL);

      XtAddCallback( w, XmNactivateCallback, (XtCallbackProc) callback[i], 
		    (XtPointer) this);
    }
  }
  widgets.popupmenu = Menu;
  XmMenuPosition( widgets.popupmenu, &event.xbutton);
  XtManageChild( widgets.popupmenu);
  return FOE__SUCCESS ;
}
Ejemplo n.º 5
0
Archivo: motif.c Proyecto: E-LLP/QuIP
void post_menu_handler (Widget w, XtPointer client_data,
	XButtonPressedEvent *event)
{
	Widget popup = (Widget) client_data;

	XmMenuPosition(popup, (XButtonPressedEvent *)event);
	XtManageChild (popup);
}
Ejemplo n.º 6
0
static void iconPopup(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
 DTIconRec *dticon;

 if (!(dticon = findIcon(w)))
     return;
 XmMenuPosition(dticon->popup, (XButtonPressedEvent *)event);
 XtManageChild(dticon->popup);
}
Ejemplo n.º 7
0
void filePopup(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
 Window root, child, win;
 Widget button;
 FileWindowRec *fw;
 int x, y, x_win, y_win;
 unsigned int mask;
 int item;

 fw = findFileWidgetByForm(w);
 if (!fw || fw->scrolled == None)  return;
 win = XtWindow(fw->icon_box);
 XQueryPointer(dpy, win, &root, &child, &x, &y, &x_win, &y_win, &mask);
 if (child != None)
 {
     button = XtWindowToWidget(dpy, child);
     item = findFileItem(fw, button);
     XtVaSetValues(fw->form, XmNuserData, (XtPointer) item, NULL);
     fileSelect(fw, item);
     if (S_ISDIR(fw->files[item]->stats.st_mode))
     {
	 XmMenuPosition(fw->dirPopup, (XButtonPressedEvent *) event);
	 XtManageChild(fw->dirPopup);
     }
     else if (fw->files[item]->stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
     {
	 XmMenuPosition(fw->execPopup, (XButtonPressedEvent *) event);
	 XtManageChild(fw->execPopup);
     }
     else
     {
	 XmMenuPosition(fw->filePopup, (XButtonPressedEvent *) event);
	 XtManageChild(fw->filePopup);
     }
 }
 else
 {
     XmMenuPosition(fw->formPopup, (XButtonPressedEvent *) event);
     XtManageChild(fw->formPopup);
 }
}
Ejemplo n.º 8
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeMenuPositionXY(Widget menu,Position x_root,Position y_root)
{
	XButtonPressedEvent be;

    assert( _XfeIsAlive(menu) );
    assert( XmIsRowColumn(menu) );

	/* In the motif source code, only the x_root and y_root members are used */
	be.x_root = x_root;
	be.y_root = y_root;

	XmMenuPosition(menu,&be);
}
Ejemplo n.º 9
0
void
mgv_events(Widget w, XtPointer closure, XEvent *ev, Boolean *cont)
{
	MGV	*m = (MGV *)closure;
	USEUP(w); USEUP(cont);
	assert(MgvOK(m));

	if(ev->type != ButtonPress
	|| ev->xbutton.button != 3)
		return;
	XmMenuPosition(m->popup, &ev->xbutton);
	XtManageChild(m->popup);
	XtPopup(XtParent(m->popup), XtGrabNone);
}
Ejemplo n.º 10
0
void parentsPopup(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
 FileWindowRec *fw;

 for (fw = file_windows; fw; fw = fw->next)
 {
     if (w == fw->dirfield)  break;
 }
 if (fw)
 {
     XmMenuPosition(fw->dirfieldPopup, (XButtonPressedEvent *) event);
     XtManageChild(fw->dirfieldPopup);
 }
}
Ejemplo n.º 11
0
void incb(Widget w, XtPointer client, XtPointer call)
{
	Widget				menu = (Widget)client;
	XmDrawingAreaCallbackStruct	*cbs = (XmDrawingAreaCallbackStruct *) call;

	if (cbs->event->type != ButtonPress)
		return;
	if (cbs->event->xbutton.button != 3)
		return;

	fprintf(stderr, "Popping up the menu ...\n");

	XmMenuPosition(menu, (XButtonPressedEvent *)cbs->event);
	XtManageChild(menu);
}
Ejemplo n.º 12
0
void popupAct(Widget, XEvent *event, String*, Cardinal*)
{
    static Widget gdb_popup_w = 0;

    if (gdb_popup_w == 0)
    {
	gdb_popup_w = MMcreatePopupMenu(gdb_w, "gdb_popup", gdb_popup);
	MMaddCallbacks(gdb_popup);
	MMaddHelpCallback(gdb_popup, ImmediateHelpCB);
	InstallButtonTips(gdb_popup_w);
    }

    XmMenuPosition(gdb_popup_w, &event->xbutton);
    XtManageChild(gdb_popup_w);
}
Ejemplo n.º 13
0
static void PostMenuHandler ( Widget w, XtPointer clientData,
                              XEvent *event, Boolean *flag ) 
{
    int button;
    Widget menu = ( Widget )  clientData;

    if ( event->type == ButtonPress &&
         event->xbutton.button == Button3 ) 
    {
       /*
        * Position the menu over the pointer and post the menu.
        */

        XmMenuPosition ( menu, ( XButtonPressedEvent * )  event );
        XtManageChild ( menu );
    }
}
Ejemplo n.º 14
0
void 
buttonPressEventHandler(Widget w, 
			XtPointer client_data,
			XEvent *e, 
			Boolean *cont)
{
  XButtonEvent *be = (XButtonEvent*)e;

  printf ("Inside buttonPressEventHandler\n");

  if (be->button == 3)
  {
    printf ("  It was button 3\n");
    XmMenuPosition(popup, be);
    
    XtManageChild(popup);
  }
}
Ejemplo n.º 15
0
/*
**  Button1 press: evaluate at curpos
**  Button2 press: clear marks.  start mark at curpos.
**  Button2 motion: clear old stop mark.  stop mark at curpos
**  Button2 release: same as motion.
*/
static void video_event_handler(Widget w, XtPointer clientData, XEvent *event, Boolean *b)
{
	PLOT *plot = (PLOT *)clientData;
	XButtonEvent *butevent;
	XMotionEvent *motevent;
	XKeyEvent *keyevent;
	char *keybuf;
	KeySym key_sym;
	Modifiers mod_return;
	Widget ew;

	switch (event->type)
	{
		case KeyRelease:
			keyevent = (XKeyEvent *)event;
			ew = XtWindowToWidget(XtDisplay(w), keyevent->window);
			if (ew != plot->plot_widget)
				panel_event_handler(ew, (XtPointer)plot->panel, event, b);
			else
			{
				XtTranslateKeycode(XtDisplay(w), keyevent->keycode, 0, &mod_return, &key_sym);
				if ((keybuf = XKeysymToString(key_sym)) != NULL)
				{
					if (KEY_IS_UP(keybuf))
					{
						panel_unzoom(plot->panel);
					}
					else
					{
						panel_handle_keyrelease(w, plot, keyevent, keybuf);
					}
				}
			}
			break;

		case ButtonPress:
			butevent = (XButtonEvent *) event;
			switch (butevent->button)
			{
				case Button1:
					break;

				case Button2:
					break;

				case Button3:
					XmMenuPosition(plot->plot_popupmenu_widget, butevent);
					XtManageChild(plot->plot_popupmenu_widget);
					break;

				default:
					break;
			}
			break;

		case ButtonRelease:
			butevent = (XButtonEvent *) event;
			switch (butevent->button)
			{
				case Button1:
					break;
				case Button2:
					break;
				case Button3:
					break;
				default:
					break;
			}
			break;

		case MotionNotify:
			motevent = (XMotionEvent *)event;
			if (motevent->state & Button1Mask)
			{
			}
			else if (motevent->state & Button2Mask)
			{
			}
			else if (motevent->state & Button2Mask)
			{
			}
			break;

		default:
			break;
	}
}
Ejemplo n.º 16
0
void PostPopup(Widget widget, XmRowColumnWidget popup, XEvent *event)
{
  printf("PostPopup\n");
  XmMenuPosition((Widget) popup, &event->xbutton);
  XtManageChild((Widget) popup);
}