home *** CD-ROM | disk | FTP | other *** search
- #include "xsignal.h"
-
- void OpenSignal();
- void InsertSignal();
- void SaveSignal();
- void SaveMarkedSignal();
- void file_popup();
-
- /* translations for the button to popup the menu
- * file_popup positions the shell.
- * MenuPopup realizes the shell.
- */
- static String pb_Trans =
- "<EnterWindow>: highlight() \n\
- <LeaveWindow>: unhighlight() \n\
- <Btn1Down>: file_popup(%s) MenuPopup(%s)";
-
- /* translations for the command buttons of the popup menu
- * the command callback is invoked when the button is released with
- * the pointer in the command widget.
- */
- static String cb_Trans =
- "<EnterWindow>: set() \n\
- <LeaveWindow>: unset() \n\
- <Btn1Up>: notify()";
-
- /* translations for the shell of the popup menu.
- * when the button is released the shell catches it and pops itself down.
- */
- static String pm_Trans =
- "<LeaveWindow>: MenuPopdown()";
-
- /* new actions added by this program */
- static XtActionsRec menu_actions[] = {
- { "file_popup", file_popup },
- };
- static char *popup_menu_name = "file_popup";
- void
- InitFilePopup(pane)
- sigbox *pane;
- {
- static XtCallbackRec b_callbacks[2];
- Arg args[6];
- Cardinal i = 0;
- char ptrans[250];
- Widget pop_layout;
-
- XtAddActions((XtActionList)menu_actions, XtNumber(menu_actions));
-
- /* create the translations for the button which pops up the menu */
- /* we pass the name of the popup menu to both file_popup and MenuPopup*/
- (void)sprintf(ptrans, pb_Trans, popup_menu_name, popup_menu_name);
- i = 0;
- XtSetArg(args[i],XtNtranslations, XtParseTranslationTable(ptrans)); i++;
- XtSetValues(pane->file_button, args, i);
-
- /* create the popup menu ... its shell, its layout widget and the menu
- * buttons it holds.
- */
- i = 0;
- XtSetArg(args[i],XtNtranslations,XtParseTranslationTable(pm_Trans));i++;
- pane->file_popup = XtCreatePopupShell("file_popup",
- overrideShellWidgetClass, pane->file_button,
- (ArgList)args,i);
-
- i = 0;
- XtSetArg(args[i], XtNheight, 4*MENUHIGH); i++;
- XtSetArg(args[i], XtNwidth, 70); i++;
- XtSetArg(args[i], XtNvertPane, TRUE); i++;
- pop_layout = XtCreateManagedWidget("layout", menuPaneWidgetClass,
- pane->file_popup, (ArgList)args, i);
-
- i = 0;
- XtSetArg(args[i], XtNwidth, 70); i++;
- XtSetArg(args[i], XtNheight, MENUHIGH); i++;
-
- /* set the translations for the buttons of the menu.
- * Set on window entry. Unset on window leave.
- * Call the callback when button 1 is released.
- */
- XtSetArg(args[i],XtNtranslations,XtParseTranslationTable(cb_Trans));i++;
- XtSetArg(args[i], XtNcallback, b_callbacks); i++;
- XtSetArg(args[i], XtNlabel, "open"); i++;
- b_callbacks[0].callback = OpenSignal;
- b_callbacks[0].closure = (caddr_t) pane;
- XtCreateManagedWidget("new_signal", commandWidgetClass,
- pop_layout, (ArgList)args, i);
-
- i = 5;
- XtSetArg(args[4], XtNlabel, "insert");
- b_callbacks[0].callback = InsertSignal;
- b_callbacks[0].closure = (caddr_t) pane;
- XtCreateManagedWidget("insert_signal", commandWidgetClass,
- pop_layout, (ArgList)args, i);
-
- i = 5;
- XtSetArg(args[4], XtNlabel, "save");
- b_callbacks[0].callback = SaveSignal;
- b_callbacks[0].closure = (caddr_t) pane;
- XtCreateManagedWidget("save_signal", commandWidgetClass,
- pop_layout, (ArgList)args, i);
-
- i = 5;
- XtSetArg(args[4], XtNlabel, "save marked");
- b_callbacks[0].callback = SaveMarkedSignal;
- b_callbacks[0].closure = (caddr_t) pane;
- XtCreateManagedWidget("save_marked", commandWidgetClass,
- pop_layout, (ArgList)args, i);
-
- }
-