Esempio n. 1
0
void
xaw_create_menu(struct button_info *item, Widget parent, int *ret_width)
{
    Dimension y_pos = resource.btn_top_spacing;
    size_t i;

    XtAppAddActions(XtWidgetToApplicationContext(globals.widgets.form_widget), menu_actions, XtNumber(menu_actions));

    for (i = 0; item != NULL && i < item->size; i++) {
        Widget button;
        Dimension w, h;

        if (item->elems[i].type == BT_SEP) { /* separator */
            XDVI_ERROR((stderr, "Cannot have a separator on a toplevel Xaw menu (ignoring)"));
            /* y_pos += resource.btn_between_extra; */
            continue;
        }
        else if (item->elems[i].submenu != NULL) { /* menu button, create a pulldown menu */
            Widget shell;

            button = XtVaCreateWidget("button", menuButtonWidgetClass, parent,
                                      XtNmenuName, item->elems[i].title,
                                      XtNlabel, item->elems[i].title,
                                      XtNx, resource.btn_side_spacing,
                                      XtNy, y_pos,
                                      XtNborderWidth, resource.btn_border_width,
                                      NULL);
            shell = XtCreatePopupShell(item->elems[i].title, simpleMenuWidgetClass, button, NULL, 0);

            create_menu_entries(item->elems[i].submenu, shell);
        }
        else { /* command button */
            command_call[0].closure = (XtPointer)item->elems[i].action;
            button = XtVaCreateWidget(item->elems[i].title, commandWidgetClass, parent,
                                      XtNlabel, item->elems[i].title,
                                      XtNx, resource.btn_side_spacing,
                                      XtNy, y_pos,
                                      XtNborderWidth, resource.btn_border_width,
                                      XtNcallback, (XtArgVal)command_call,
                                      NULL);
        }
        XtVaGetValues(button, XtNwidth, &w, XtNheight, &h, NULL);
        y_pos += h + resource.btn_between_spacing + 2 * resource.btn_border_width;
        if (w > m_panel_width)
            m_panel_width = w;
        item->elems[i].widget = button;
    }

    /* adjust button sizes, and manage buttons (managing them earlier may result
       in `parent has no geometry manager' error) */
    for (i = 0; item != NULL && i < item->size; i++) {
        XtVaSetValues(item->elems[i].widget, XtNwidth, m_panel_width, NULL);
        XtManageChild(item->elems[i].widget);
    }

    m_y_pos = y_pos - resource.btn_between_spacing + resource.btn_top_spacing + 2 * resource.btn_border_width;
    m_panel_width += 2 * resource.btn_side_spacing + resource.btn_border_width;
    XtVaSetValues(panel_widget, XtNwidth, m_panel_width, NULL);
    *ret_width = m_panel_width;
}
Esempio n. 2
0
Widget
xaw_create_menu_widgets(Widget parent)
{
    /* hack to disable the magnifier in the panel: */
    XtTranslations panel_translations = XtParseTranslationTable("#augment <ButtonPress>:");

    XtAppAddActions(XtWidgetToApplicationContext(parent), menu_actions, XtNumber(menu_actions));

    line_widget = XtVaCreateWidget("line", widgetClass, parent,
                                   XtNbackground, (XtArgVal)resource.fore_Pixel,
                                   XtNwidth, (XtArgVal)1,
                                   XtNfromHoriz, (XtArgVal)globals.widgets.vport_widget,
                                   XtNborderWidth, (XtArgVal)0,
                                   XtNtop, (XtArgVal)XtChainTop,
                                   XtNbottom, (XtArgVal)XtChainBottom,
                                   XtNleft, (XtArgVal)XtChainRight,
                                   XtNright, (XtArgVal)XtChainRight,
                                   NULL);
    panel_widget = XtVaCreateWidget("panel", compositeWidgetClass, parent,
                                    XtNborderWidth, (XtArgVal)0,
                                    XtNfromHoriz, (XtArgVal)line_widget,
                                    XtNtranslations, (XtArgVal)panel_translations,
                                    XtNtop, (XtArgVal)XtChainTop,
                                    XtNbottom, (XtArgVal)XtChainBottom,
                                    XtNleft, (XtArgVal)XtChainRight,
                                    XtNright, (XtArgVal)XtChainRight,
                                    NULL);
    return panel_widget;
}
Esempio n. 3
0
int
main(int argc, char *argv[]) {
    Widget rc, frame1, label;

    XtSetLanguageProc(NULL, NULL, NULL);

    top = XtVaAppInitialize(&app_context,
                            "Test-prog",
                            NULL, 0,
                            &argc, argv,
                            NULL,
                            NULL);

    main_window =
        XtVaCreateManagedWidget("mainwin", xmMainWindowWidgetClass, top, NULL);

    XmRepTypeInstallTearOffModelConverter();

    menubar = XmCreateMenuBar(main_window, "menubar", NULL, 0);
    XtManageChild(menubar);

    XmMainWindowSetAreas(main_window,menubar,NULL,NULL,NULL,NULL);

    rc = XtVaCreateWidget("rc", xmRowColumnWidgetClass, main_window, NULL);

    XtVaSetValues(main_window, XmNworkWindow, rc, NULL);
    XtManageChild(rc);

    frame1 = XtVaCreateWidget("frame1",
                              xmFrameWidgetClass,
                              rc,
                              NULL);
    XtManageChild(frame1);

    XtRealizeWidget(top);

    label = XtVaCreateManagedWidget("Rampaging Bulldozers",
                                    xmLabelWidgetClass,
                                    frame1,
                                    NULL);

    {
        static XtWidgetGeometry Expected[] = {
            CWWidth | CWHeight            ,   56,   72,   16,   32, 0,0,0, /* mainwin */
            CWWidth | CWHeight | CWX | CWY,    0,    0,   16,   16, 0,0,0, /* menubar */
            CWWidth | CWHeight | CWX | CWY,    0,   16,   16,   16, 0,0,0, /* rc */
            CWWidth | CWHeight | CWX | CWY,    3,    3,   10,    4, 0,0,0, /* frame1 */
            CWWidth | CWHeight | CWX | CWY,    2,    2,    6,    1, 0,0,0, /* Rampaging Bulldozers */
        };
        /* toplevel should be replaced with to correct applicationShell */
        PrintDetails(top, Expected);
    }
    LessTifTestMainLoop(top);

    exit(0);
}
Esempio n. 4
0
static void 
InitContainerOutline (Widget w, XtPointer client_data, XtPointer call_data) 
{
    Widget container, *icongs; 
    Cardinal i ;

    /* get the number of classes in Xt/Motif */
    i = InitClassArray() ;

    /* allocate space for the array of icongadgets to be managed
       at once */
    icongs = (Widget*) XtMalloc(i * sizeof(Widget));

    XtAddCallback (w, XmNtraverseObscuredCallback, TravCB, NULL);

    /* create the container */
    container = XtVaCreateManagedWidget("ContainerOutline",
					xmContainerWidgetClass, w,
					NULL);

    /* setup our clipwindow/workwindow constraint stuff */
    XmdSWAdjustView (w) ;

    /* create the root */
    icongs[0] = XtVaCreateWidget(
		                 ClassName(icong_array[0]->class_info.w_class),
				 xmIconGadgetClass, container,
				 XmNentryParent, NULL,
				 XmNsensitive, 
				 icong_array[0]->class_info.documented,
				 XmNuserData, 
				 &(icong_array[0]->class_info),
				 NULL);
    i = 1 ;
    while (icong_array[i]) {
	/* parent_index has been set during InitClassArray */
	icongs[i] = XtVaCreateWidget(
				ClassName(icong_array[i]->class_info.w_class),
				   xmIconGadgetClass, container,
				   XmNentryParent, 
				      icongs[icong_array[i]->parent_index],
				   XmNsensitive, 
				      icong_array[i]->class_info.documented,
				   XmNuserData, 
				       &(icong_array[i]->class_info),
				   NULL);
	i++ ;
    }

    XtManageChildren(icongs, i);
	 
}
Esempio n. 5
0
static void 
InitPanedWindow (Widget w, XtPointer client_data, XtPointer call_data) 
{
    Widget child_w[2], sub_pane, temp, form, frame;

    child_w[0] = XtVaCreateWidget("Arrow1", xmArrowButtonWidgetClass,
				  w, NULL);
    sub_pane = child_w[1] = XtVaCreateWidget("SubPane", 
					     xmPanedWindowWidgetClass,
					     w, NULL);
    XtManageChildren(child_w, 2);

    child_w[0] = XtVaCreateWidget("Arrow2", xmArrowButtonWidgetClass,
				  sub_pane, NULL);
    temp = child_w[1] = XtVaCreateWidget("Temp", xmMessageBoxWidgetClass,
					 sub_pane, NULL);
    XtRealizeWidget(temp);
    XtManageChildren(child_w, 2);

    form = XtVaCreateManagedWidget("Form", xmFormWidgetClass,
				   temp, NULL);

    frame = child_w[0] = XtVaCreateWidget("Frame", xmFrameWidgetClass,
					  form, NULL);
    child_w[1] = XtVaCreateWidget("TextF", xmTextFieldWidgetClass,
				  form, NULL);
    XtManageChildren(child_w, 2);
    XtAddCallback (temp, XmNokCallback, OKCB, (XtPointer)child_w[1]);

    child_w[0] = XtVaCreateWidget("Title", xmLabelGadgetClass,
				  frame, NULL);
    child_w[1] = XtVaCreateWidget("Label", xmLabelWidgetClass,
				  frame, NULL);
    XtManageChildren(child_w, 2);
}
Esempio n. 6
0
static XmToolTipConfigTrait
ToolTipGetData (Widget w)
{
    Widget top = w;
    XmToolTipConfigTrait ttp;

    while (XtParent (top))
    {
        top = XtParent (top);
    }

    ttp = (XmToolTipConfigTrait) XmeTraitGet (top, XmQTtoolTipConfig);

    if (ttp != NULL && ttp->label == NULL && !top->core.being_destroyed)
    {
        Widget shell;

        shell = XtVaCreateWidget ("TipShell",
                                  transientShellWidgetClass, top,
                                  XmNoverrideRedirect, True, NULL);

        ttp->label = XmCreateLabel (shell, "TipLabel", NULL, 0);
        XtManageChild (ttp->label);
#ifdef FIX_1388
        XtAddCallback(top, XmNdestroyCallback, (XtCallbackProc) ToolTipLabelDestroyCallback, (XtPointer) NULL);
#endif
    }
    return ttp;
}
Esempio n. 7
0
static Widget CreateMenu(Widget parent,char *name,char *label,
    int mnemonic, Widget *cascade_btn)
{
    Widget
        menu_w,
        cascade_w;

    XmString
        xmstr;

    menu_w=XmCreatePulldownMenu(parent,name,NULL,0);       
    cascade_w=XtVaCreateWidget(name,     
        xmCascadeButtonWidgetClass, parent, 
        XmNlabelString, xmstr=XmStringCreateSimple(label),
        XmNsubMenuId, menu_w,
        NULL);
    XmStringFree(xmstr);

    if (mnemonic != 0) 
    {
        XtVaSetValues(cascade_w,
            XmNmnemonic,mnemonic,
            NULL);
    }
    XtManageChild(cascade_w);

    if (cascade_btn != NULL)
        *cascade_btn=cascade_w;

    return (menu_w);
}
Esempio n. 8
0
Widget UIDialogForm (char *dialogTitle,int resize)

	{
	Widget dShell, bulletin, pane, actionForm, button;
	XmString ok = XmStringCreate ((char *) "Accept",UICharSetBold);
	XmString cancel = XmStringCreate ((char *) "Discard",UICharSetBold);

	dShell = XtVaCreatePopupShell (dialogTitle,xmDialogShellWidgetClass,UITopLevel (),
								XmNkeyboardFocusPolicy,		XmEXPLICIT,
								XmNallowShellResize,			true,
								NULL);
	bulletin = XtVaCreateWidget (UIDialogBulletinName + 1,xmBulletinBoardWidgetClass,dShell,
								XmNnoResize,					resize,
								XmNdialogStyle,				XmDIALOG_FULL_APPLICATION_MODAL,
								XmNtransient,					true,
								XmNmarginHeight,				5,
								XmNmarginWidth,				5,
								NULL);
	XtAddCallback (bulletin,XmNunmapCallback,(XtCallbackProc) UILoopStopCBK,NULL);
	pane = XtVaCreateManagedWidget (UIDialogPaneName + 1,xmPanedWindowWidgetClass,bulletin,
								XmNsashWidth,					1,
								XmNsashHeight,					1,
								XmNallowResize,				true,
								NULL);
	XtVaCreateManagedWidget (UIDialogFormName + 1, xmFormWidgetClass, pane,
								XmNshadowThickness,			0,
								XmNallowResize,				true,
								NULL);
	actionForm = XtVaCreateManagedWidget (UIDialogActionFormName + 1,xmFormWidgetClass,pane,
								XmNallowResize,				false,
								XmNshadowThickness,			0, NULL);
	button = XtVaCreateManagedWidget (UIDialogOkButtonName + 1,xmPushButtonWidgetClass,actionForm,
								XmNtopAttachment,				XmATTACH_FORM,
								XmNtopOffset,					5,
								XmNbottomAttachment,			XmATTACH_FORM,
								XmNbottomOffset,				5,
								XmNleftAttachment,			XmATTACH_POSITION,
								XmNleftPosition,				20,
								XmNrightAttachment,			XmATTACH_POSITION,
								XmNrightPosition,				40,
								XmNlabelString,				ok,
								NULL);
	XtSetSensitive (button,false);
	XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) UILoopStopCBK,NULL);
	button = XtVaCreateManagedWidget (UIDialogCancelButtonName+ 1,xmPushButtonWidgetClass,actionForm,
								XmNtopAttachment,				XmATTACH_FORM,
								XmNtopOffset,					5,
								XmNbottomAttachment,			XmATTACH_FORM,
								XmNbottomOffset,				5,
								XmNleftAttachment,			XmATTACH_POSITION,
								XmNleftPosition,				60,
								XmNrightAttachment,			XmATTACH_POSITION,
								XmNrightPosition,				80,
								XmNlabelString,				cancel,
								NULL);
	XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) UILoopStopCBK,NULL);
	XmStringFree (ok);
	XmStringFree (cancel);
	return (dShell);
	}
Esempio n. 9
0
static Widget   _Uxbuild_styleOpenDialog()
{
        Widget  styleOpenDialog_shell;

        styleOpenDialog_shell = XtVaCreatePopupShell( "styleOpenDialog_shell",
                        xmDialogShellWidgetClass, histoStyle,
                        XmNshellUnitType, XmPIXELS,
                        XmNtitle, "styleOpenDialog",
                        NULL );

        styleOpenDialog = XtVaCreateWidget( "styleOpenDialog",
                        xmFileSelectionBoxWidgetClass, styleOpenDialog_shell,
           RES_CONVERT( XmNselectionLabelString, "Enter the style file name" ),
                        RES_CONVERT( XmNpattern, "*.style" ),
                        RES_CONVERT( XmNdialogTitle, "Open Style" ),
                        XmNunitType, XmPIXELS,
                        NULL );

        UxPutContext( styleOpenDialog, (char *) UxStyleOpenDialogContext );

        XtAddCallback( styleOpenDialog, XmNdestroyCallback,
                        UxFreeClientDataCB,
                        (XtPointer) UxStyleOpenDialogContext );



        return ( styleOpenDialog );
}
Esempio n. 10
0
static Widget   _Uxbuild_execDialog()
{
        Widget  execDialog_shell;

        execDialog_shell = XtVaCreatePopupShell( "execDialog_shell",
                        xmDialogShellWidgetClass, exec_parent,
                        XmNx, 231,
                        XmNy, 193,
                        XmNwidth, 390,
                        XmNheight, 416,
                        XmNtitle, "execDialog",
                        NULL );

        execDialog = XtVaCreateWidget( "execDialog",
                        xmFileSelectionBoxWidgetClass, execDialog_shell,
                        RES_CONVERT( XmNdirMask, "*.kumac" ),
                   RES_CONVERT( XmNselectionLabelString, "Execute PAW Macro" ),
                        RES_CONVERT( XmNdialogTitle, "Exec Arguments" ),
                        XmNheight, 416,
                        XmNwidth, 390,
                        NULL );

        UxPutContext( execDialog, (char *) UxExecDialogContext );

        XtAddCallback( execDialog, XmNdestroyCallback,
                        UxFreeClientDataCB,
                        (XtPointer) UxExecDialogContext );



        return ( execDialog );
}
Esempio n. 11
0
static Widget   _Uxbuild_openCeDialog()
{
        Widget  openCeDialog_shell;

        openCeDialog_shell = XtVaCreatePopupShell( "openCeDialog_shell",
                        xmDialogShellWidgetClass, save_parent,
                        XmNwidth, 355,
                        XmNheight, 435,
                        XmNtitle, "openCeDialog",
                        NULL );

        openCeDialog = XtVaCreateWidget( "openCeDialog",
                        xmFileSelectionBoxWidgetClass, openCeDialog_shell,
                      RES_CONVERT( XmNselectionLabelString, "Enter File Name" ),
                        RES_CONVERT( XmNpattern, "*.cuts" ),
                        RES_CONVERT( XmNdialogTitle, "Open Cuts File" ),
                        XmNheight, 435,
                        XmNwidth, 355,
                        NULL );

        UxPutContext( openCeDialog, (char *) UxOpenCeDialogContext );

        XtAddCallback( openCeDialog, XmNdestroyCallback,
                        UxFreeClientDataCB,
                        (XtPointer) UxOpenCeDialogContext );



        return ( openCeDialog );
}
Esempio n. 12
0
void
XFE_TaskBar::createFloatingWidgets(Widget parent)
{
	XP_ASSERT( XfeIsAlive(parent) );

	unsigned char	orientation = 
		fe_globalPrefs.task_bar_horizontal ? XmHORIZONTAL : XmVERTICAL;
	
	// Create the floating task bar
	m_widget = XtVaCreateWidget(FLOATING_TASK_BAR_NAME,
								xfeTaskBarWidgetClass,
								parent,
								XmNorientation,			orientation,
								XmNusePreferredWidth,	True,
								XmNusePreferredHeight,	True,
								NULL);

	// Create floating buttons
	createButtons(m_floatingSpec);

	// Show both label and pixmap for floating tools
	XtVaSetValues(m_widget,XmNbuttonLayout,XmBUTTON_LABEL_ON_BOTTOM,NULL);

	// Update the floating appearance for the first time
	updateFloatingAppearance();
 
	// Update the icons layout when needed
    XFE_MozillaApp::theApp()->registerInterest(
		XFE_MozillaApp::updateToolbarAppearance,
		this,
		(XFE_FunctionNotification)updateIconAppearance_cb);
}
Esempio n. 13
0
Widget UISelectionCreate (char *selectTitle)

	{
	Widget dShell, selection;

	dShell = XtVaCreatePopupShell (selectTitle,xmDialogShellWidgetClass,UITopLevel (),
										XmNminWidth,				200,
										XmNallowShellResize,		true,
										XmNtransient,				true,
										XmNkeyboardFocusPolicy,	XmEXPLICIT,
										NULL);
	selection = XtVaCreateWidget ("UISelectionDialog",xmSelectionBoxWidgetClass,dShell,
										XmNnoResize,				true,
										XmNdialogStyle,			XmDIALOG_FULL_APPLICATION_MODAL,
										XmNautoUnmanage,			false,
										XmNmustMatch,				true,
										NULL);
	XtVaSetValues (XmSelectionBoxGetChild (selection,XmDIALOG_OK_BUTTON),XmNdefaultButtonShadowThickness, 0,NULL);
	XtVaSetValues (XmSelectionBoxGetChild (selection,XmDIALOG_CANCEL_BUTTON),XmNdefaultButtonShadowThickness, 0,NULL);
	XtUnmanageChild (XmSelectionBoxGetChild (selection,XmDIALOG_HELP_BUTTON));
	XtUnmanageChild (XmSelectionBoxGetChild (selection,XmDIALOG_APPLY_BUTTON));
	XtUnmanageChild (XmSelectionBoxGetChild (selection,XmDIALOG_SELECTION_LABEL));
	XtUnmanageChild (XmSelectionBoxGetChild (selection,XmDIALOG_TEXT));

	XtAddCallback (selection,XmNokCallback,(XtCallbackProc) _UIOkSelectionCallback,NULL);
	XtAddCallback (selection,XmNokCallback,(XtCallbackProc) UILoopStopCBK,NULL);
	XtAddCallback (selection,XmNcancelCallback,(XtCallbackProc)	UILoopStopCBK,NULL);
	XtAddCallback (selection,XmNdestroyCallback,(XtCallbackProc) UILoopStopCBK,NULL);
	XtAddCallback (selection,XmNnoMatchCallback,(XtCallbackProc) _UINoMatchSelectionCallback,NULL);
	return (selection);
	}
Esempio n. 14
0
Widget UIFileSelectionCreate(char *titleText, char *directory, char *pattern, int type) {
    static char fullPath[DBDataFileNameLen];
    XmString string;
    Widget dShell, selection;

    dShell = XtVaCreatePopupShell(titleText, xmDialogShellWidgetClass, UITopLevel(),
                                  XmNallowShellResize, true,
                                  XmNtransient, true,
                                  XmNkeyboardFocusPolicy, XmEXPLICIT,
                                  NULL);
    selection = XtVaCreateWidget("UIFileSelectionDialog", xmFileSelectionBoxWidgetClass, dShell,
                                 XmNfileTypeMask, type,
                                 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
                                 NULL);
    if (directory != NULL) {
        string = XmStringCreate(directory, UICharSetNormal);
        XtVaSetValues(selection, XmNdirectory, string, NULL);
        XmStringFree(string);
    }
    if (pattern != NULL) {
        string = XmStringCreate(pattern, UICharSetNormal);
        XtVaSetValues(selection, XmNpattern, string, NULL);
        XmStringFree(string);
    }

    XtUnmanageChild(XmFileSelectionBoxGetChild(selection, XmDIALOG_HELP_BUTTON));
    XtAddCallback(selection, XmNokCallback, (XtCallbackProc) _UIFileSelectionOkCBK, fullPath);
    XtAddCallback(selection, XmNokCallback, (XtCallbackProc) UILoopStopCBK, NULL);
    XtAddCallback(selection, XmNcancelCallback, (XtCallbackProc) UILoopStopCBK, NULL);
    XtAddCallback(selection, XmNnoMatchCallback, (XtCallbackProc) _UIFileSelectionNoMatchCBK, NULL);

    return (selection);
}
Esempio n. 15
0
/*----------------------------------------------------------------------*/
static Widget
ArrowCreate(Widget w)
{
/*     XfeComboBoxPart *	cp  = _XfeComboBoxPart(w); */
	Widget				arrow = NULL;

	arrow = XtVaCreateWidget(ARROW_NAME,
							 xfeArrowWidgetClass,
							 w,
							 XmNbackground,			_XfeBackgroundPixel(w),
							 XmNbackgroundPixmap,	_XfeBackgroundPixmap(w),
 							 XmNshadowThickness,		1,
/*  							 XmNemulateMotif,			False, */
 							 XmNraiseBorderThickness,	0,
							 XmNraiseOnEnter,			False,
 							 XmNfillOnEnter,			False,
 							 XmNshadowThickness,		0,

							 XmNbuttonType,				XmBUTTON_TOGGLE,

							 NULL);


	XfeOverrideTranslations(arrow,_XfeComboBoxArrowTranslations);

#if 0
	XtAddCallback(arrow,XmNarmCallback,ArrowArmCB,w);
	XtAddCallback(arrow,XmNdisarmCallback,ArrowDisarmCB,w);
	XtAddCallback(arrow,XmNactivateCallback,ArrowActivateCB,w);
#endif

/* 	XtAddCallback(arrow,XmNactivateCallback,ArrowActivateCB,w); */

	return arrow;
}
Esempio n. 16
0
static Widget
build_stdErrDialog( void )
{
    Widget    stdErrDialog_shell;
    XmString tmpXmStr, tmpXmStr2;
    Arg  args[10];
    int  n;


    stdErrDialog_shell = XtVaCreatePopupShell( "stdErrDialog_shell",
                        xmDialogShellWidgetClass, mainWindow,
                        XmNtitle, GETSTR(8,2, "Icon Editor - Error"),
                        NULL );

    tmpXmStr = GETXMSTR(8,4, "Continue");
    tmpXmStr2= GETXMSTR(8,2, "Icon Editor - Error");
    stdErrDialog = XtVaCreateWidget( "stdErrDialog",
                        xmMessageBoxWidgetClass, stdErrDialog_shell,
                        XmNokLabelString, tmpXmStr,
                        XmNdialogTitle, tmpXmStr2,
                        XmNdialogType, XmDIALOG_ERROR,
                        NULL );
    XmStringFree(tmpXmStr);
    XmStringFree(tmpXmStr2);

    XtAddCallback( stdErrDialog, XmNokCallback, okCallback_stdErrDialog, NULL);

    n = 0;
    XtSetArg (args[n], XmNuseAsyncGeometry, True);                          n++;
    XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
    XtSetValues (stdErrDialog_shell, args, n);

    return ( stdErrDialog );
}
Esempio n. 17
0
void UIMenuItem::CreateButton(Widget menuWidget,
                              UIMenuItem *menuBut,
                              void *menuData) {
    Arg wargs[2];
    int argNum = 0, menuNum;
    char mnemonic[2];
    Widget subMenu;
    XmString string;

    switch (menuBut->Type) {
        case UIMENU_FUNCTION:
            string = XmStringCreate(menuBut->Label, UICharSetNormal);
            menuBut->Button = XtVaCreateWidget("UIFunctionButton", xmPushButtonGadgetClass, menuWidget,
                                               XmNuserData, menuBut,
                                               XmNlabelString, string,
                                               NULL);
            XtAddCallback(menuBut->Button, XmNactivateCallback, (XtCallbackProc) _UIMenuButtonCBK,
                          (XtPointer) menuData);
            XmStringFree(string);
            break;
        case UIMENU_SUBMENU:
            argNum = 0;
            subMenu = XmCreatePulldownMenu(menuWidget, (char *) "GHAASPullDownMenu", wargs, argNum);

            mnemonic[0] = menuBut->Label[0];
            mnemonic[1] = '\0';
            string = XmStringCreate(menuBut->Label, UICharSetBold);
            menuBut->Button = XtVaCreateWidget("UISubmenuButton", xmCascadeButtonWidgetClass, menuWidget,
                                               XmNlabelString, string,
                                               XmNsubMenuId, subMenu,
                                               XmNmnemonic, XStringToKeysym(mnemonic),
                                               NULL);
            XmStringFree(string);
            if (menuBut->Action != NULL)
                for (menuNum = 0; ((UIMenuItem *) menuBut->Action)[menuNum].Type != 0; ++menuNum)
                    menuBut->CreateButton(subMenu, ((UIMenuItem *) menuBut->Action) + menuNum, menuData);
            break;
        case UIMENU_SEPARATOR:
            menuBut->Button = XmCreateSeparatorGadget(menuWidget, (char *) "GHAASMenuSeparator", NULL, 0);
            break;
        default:
            CMmsgPrint(CMmsgAppError, "Not valid Button type in: %s %d", __FILE__, __LINE__);
            return;
    }
    if (menuBut->VisibleVAR == UIMENU_NORULE) XtManageChild(menuBut->Button);
    XtSetSensitive(menuBut->Button, menuBut->SensitiveVAR == UIMENU_NORULE);
}
Esempio n. 18
0
void ScaleObj::CreateScale(MotifUI *parent, char *title, int value,
		           int numDecimalPoints, int max, int min,
		           int scaleMultiple, ScaleType style, boolean showValue)
{
   _style = style;
   _value = value;
   _numDecimalPoints = numDecimalPoints;
   _max = max;
   _min = min;
   _scaleMultiple = scaleMultiple;
   _style = style;
   _showValue = showValue;
   CheckValues(false);

   int orientation;
   short points = _numDecimalPoints; 
   if (_style == VERTICAL_SCALE)
      orientation = XmVERTICAL;
   else
      orientation = XmHORIZONTAL;

   XmString xm_string = StringCreate(title);
   _w = XtVaCreateManagedWidget(title, xmFormWidgetClass,
				parent->InnerWidget(), NULL);
   _minLabel = XtVaCreateWidget(title, xmLabelWidgetClass, _w,
				XmNtopAttachment, XmATTACH_FORM,
				XmNbottomAttachment, XmATTACH_FORM,
				XmNleftAttachment, XmATTACH_FORM, NULL);
   _maxLabel = XtVaCreateWidget(title, xmLabelWidgetClass, _w,
				XmNtopAttachment, XmATTACH_FORM,
				XmNbottomAttachment, XmATTACH_FORM,
				XmNrightAttachment, XmATTACH_FORM, NULL);
   _scale = XtVaCreateManagedWidget(title, xmScaleWidgetClass, _w,
				    XmNmaximum, _max,
                                    XmNminimum, _min, XmNvalue, _value,
				    XmNscaleMultiple, _scaleMultiple,
                                    XmNdecimalPoints, points,
				    XmNtitleString, xm_string,
				    XmNshowValue, _showValue,
				    XmNtopAttachment, XmATTACH_FORM,
				    XmNbottomAttachment, XmATTACH_FORM,
				    XmNorientation, orientation, NULL);
   StringFree(xm_string);
   SetString(_minLabel, _min);
   SetString(_maxLabel, _max);
   ShowValue(_showValue);
}
Esempio n. 19
0
void guitst_createMain ( Widget parent )
/************************************************************************
 * guitst_createMain   	                                                *
 *                                                                      *
 * This function creates the main window				*
 *                                                                      *
 * void	guitst_createMain( parent )					*
 *                                                                      *
 * Input parameters:                                                    *
 *                                                                      *
 *      parent    Widget    parent widget id                        	*
 *                                                                      *
 * Output parameters:                                                   *
 *                      NONE                                            *
 *                                                                      *
 * Return parameters:                                                   *
 *                                                                      *
 ** Log:                                                                *
 *      S. Wang/GSC    10/97	                                        *
 ***********************************************************************/
{
Widget	main_w, button;
Pixel	bg;
long	ii;

/*---------------------------------------------------------------------*/

	main_w = XtVaCreateWidget("mainw_pane",
                        xmPanedWindowWidgetClass, parent,
                        XmNsashWidth,             1,
                        XmNsashHeight,            1,
                        NULL, 0);

	_menuBar = XmCreateMenuBar(main_w, "menubar", NULL, 0);
        XtVaGetValues(parent, XmNbackground, &bg, NULL);
        XtVaSetValues(_menuBar, XmNbackground, bg, NULL);

	/*
	 * create Exit button
	 */

        button = XmCreateCascadeButton( _menuBar, 
					"Exit", NULL, 0 );

        XtVaSetValues( button, XmNbackground, bg, NULL );
        XtManageChild( button );

        XtAddCallback( button, XmNactivateCallback,
         	        guitst_exitCb, (XtPointer)ii );

	XtManageChild( _menuBar );

	guitst_createCanvas( main_w );

	XtManageChild( main_w );

}
Esempio n. 20
0
void Create(Widget w, XtPointer client, XtPointer call)
{
	int	i = (int)client;
	char	s[20];
	sprintf(s, "button %d", i);
	arr[i] = XtVaCreateWidget(s, xmPushButtonWidgetClass, sw,
			XmNx,	20,
			XmNy,	20 + 20 * i,
			NULL);
}
Esempio n. 21
0
void 
HiCB (Widget w, XtPointer client_data, XtPointer call_data)
{
	Widget Shell, butt1, butt2;
	Widget rc;
        XmString xmstr = XmStringCreateSimple("A Dialog");
	printf ("HiCB\n");

	Shell = XtVaCreateWidget ("Shell1", xmDialogShellWidgetClass, toplevel,
			XmNwidth, 100,
			XmNheight, 40,
		NULL);
	rc = XtVaCreateWidget ("OK", xmFormWidgetClass, Shell,
			XmNentryAlignment,	XmALIGNMENT_CENTER, 
			XmNorientation,		XmHORIZONTAL, 
			XmNpacking,		XmPACK_COLUMN, 
			XmNnumColumns,		2,
			XmNwidth,		100,
			XmNheight,		100,
		NULL);

	butt1 = XtVaCreateManagedWidget ("OK", xmPushButtonWidgetClass, rc,
			XmNleftAttachment,	XmATTACH_FORM,
			XmNleftOffset,		10,
			XmNrightAttachment,	XmATTACH_FORM,
			XmNrightOffset,		10,
			XmNbottomAttachment,	XmATTACH_POSITION,
			XmNbottomPosition,	40,
		NULL);
	butt2 = XtVaCreateManagedWidget ("Cancel", xmPushButtonWidgetClass, rc,
			XmNtopAttachment,	XmATTACH_WIDGET,
			XmNtopWidget,		butt1,
			XmNtopOffset,		20,
			XmNleftAttachment,	XmATTACH_FORM,
			XmNleftOffset,		10,
			XmNrightAttachment,	XmATTACH_FORM,
			XmNrightOffset,		10,
		NULL);
	XtManageChild (rc);


	XtVaSetValues(rc, XmNdialogTitle, xmstr, NULL);
}
Esempio n. 22
0
WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* WXUNUSED(display) )
{
    Widget rTlw = XtVaCreateWidget( "dummy_widget", topLevelShellWidgetClass,
                                    (Widget)wxTheApp->GetTopLevelWidget(),
                                    NULL );
    XtSetMappedWhenManaged( rTlw, False );
    XtRealizeWidget( rTlw );

    return (WXWidget)rTlw;
}
Esempio n. 23
0
static Widget   _Uxbuild_OpenFile(void)
{
        Widget          _UxParent;

        /* Creation of OpenFile */
        _UxParent = XtVaCreatePopupShell( "OpenFile_shell",
                        xmDialogShellWidgetClass, UxTopLevel,
                        XmNx, 200,
                        XmNy, 290,
                        XmNwidth, 398,
                        XmNheight, 500,
                        XmNallowShellResize, TRUE,
                        XmNshellUnitType, XmPIXELS,
                        XmNtitle, GETMESSAGE(12, 25, "Create Action - Open"),
                        NULL );

        OpenFile = XtVaCreateWidget( "OpenFile",
                        xmFileSelectionBoxWidgetClass,
                        _UxParent,
                        XmNresizePolicy, XmRESIZE_GROW,
                        XmNunitType, XmPIXELS,
                        XmNwidth, 398,
                        XmNheight, 500,
                        RES_CONVERT( XmNdialogTitle, GETMESSAGE(12, 25, "Create Action - Open")),
                        RES_CONVERT( XmNdirectory, "" ),
                        RES_CONVERT( XmNtextString, "" ),
                        RES_CONVERT( XmNdirSpec, "" ),
                        XmNdialogType, XmDIALOG_FILE_SELECTION,
                        XmNtextColumns, 20,
                        XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
                        XmNallowOverlap, FALSE,
                        RES_CONVERT( XmNchildPlacement, "place_below_selection" ),
                        XmNdefaultPosition, FALSE,
                        RES_CONVERT( XmNdirMask, "" ),
                        RES_CONVERT( XmNpattern, "" ),
                        NULL );
        XtAddCallback( OpenFile, XmNcancelCallback,
                (XtCallbackProc) cancelCB_OpenFile,
                (XtPointer) UxOpenFileContext );
        XtAddCallback( OpenFile, XmNokCallback,
                (XtCallbackProc) okCallback_OpenFile,
                (XtPointer) UxOpenFileContext );
        XtAddCallback( OpenFile, XmNhelpCallback,
                (XtCallbackProc) helpCallback_OpenFile,
                (XtPointer) UxOpenFileContext );
        XtVaSetValues(OpenFile, XmNuserData, OpenFile, NULL);

        UxPutContext( OpenFile, (char *) UxOpenFileContext );

        XtAddCallback( OpenFile, XmNdestroyCallback,
                (XtCallbackProc) UxDestroyContextCB,
                (XtPointer) UxOpenFileContext);

        return ( OpenFile );
}
Esempio n. 24
0
Widget
XltVaCreateNumEntry(Widget parent, char *name,...)
{
    Widget w;
    va_list args;

    va_start(args, name);
    w = XtVaCreateWidget(name, xrwsNumEntryWidgetClass, parent, args);
    va_end(args);
    return (w);
}
Esempio n. 25
0
static void PM_create_gui()
{
  Widget frame;
  Widget progress_row_column;

  PM_form = XtVaCreateWidget( "form_widget",
		xmFormWidgetClass, PM_widget,
		XmNmarginWidth, PM_MARGIN,
		XmNmarginHeight, PM_MARGIN,
		XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL,
		XmNbackground, hci_get_read_color( BACKGROUND_COLOR1 ), 
		XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), 
		NULL );

  frame = XtVaCreateManagedWidget( "frame_widget",
		xmFrameWidgetClass, PM_form,
		XmNshadowType, XmSHADOW_ETCHED_IN,
		XmNshadowThickness, PM_THICKNESS,
		XmNtopAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		XmNbackground, hci_get_read_color( BACKGROUND_COLOR1 ), 
		XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), 
		NULL );

  progress_row_column = XtVaCreateManagedWidget( "progress_rowcol",
		xmRowColumnWidgetClass, frame,
		XmNorientation, XmVERTICAL,
		XmNmarginWidth, PM_MARGIN,
		XmNmarginHeight, PM_MARGIN,
		XmNbackground, hci_get_read_color( BACKGROUND_COLOR1 ), 
		XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), 
		NULL );

  Operation_label = XtVaCreateManagedWidget( Operation_label_buf, 
		xmLabelWidgetClass, progress_row_column,
		XmNbackground, hci_get_read_color( BACKGROUND_COLOR1 ), 
		XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), 
		XmNfontList, hci_get_fontlist( LIST ),
		XmNrecomputeSize, True,
		NULL );

  Transfer_bytes_label = XtVaCreateManagedWidget( " ",
		xmLabelWidgetClass, progress_row_column, 
		XmNbackground, hci_get_read_color( BACKGROUND_COLOR1 ), 
		XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), 
		XmNfontList, hci_get_fontlist( LIST ),
		XmNrecomputeSize, True,
		NULL );

  XtManageChild( PM_form );

  PM_adjust_size();
}
Esempio n. 26
0
void
create_statusline(void)
{
    Position vport_h, clip_x, clip_w;
    static Position my_h = 0;

    /*
     * FIXME: is there a better way to set the y position depending on
     * the height of the widget?
     * It doesn't work to change the value of XtNy *after* creating
     * the widget!
     */

    if (!initialized) {
	/*
	 * determine height of statusline (depending on the font used).
	 * This is not changeable at runtime, so it's determined once and
	 * for all at program start.
	 */
	statusline = XtVaCreateWidget("statusline", labelWidgetClass, vport_widget,
				      XtNlabel, (XtArgVal) "test",
				      NULL);
	XtVaGetValues(statusline, XtNheight, &my_h, NULL);
	XtDestroyWidget(statusline);
	initialized = True;
	/* initialize g_string_savebuf */
#ifdef T1LIB
	sprintf(g_string_savebuf, "This is xdvik %s   (T1Lib rendering %s)",
		TVERSION, resource.t1lib ? "on" : "switched off");
#else
	sprintf(g_string_savebuf, "This is xdvik %s", TVERSION);
#endif	
    }
    /* determine position and width of statusline */
    XtVaGetValues(clip_widget, XtNx, &clip_x, XtNwidth, &clip_w, NULL);
    XtVaGetValues(vport_widget, XtNheight, &vport_h, NULL);
    if (vport_h - my_h <= 0) {
#ifdef DEBUG
	fprintf(stderr, "=======not printing statusline\n");
#endif /* DEBUG */
	return;
    }
    statusline = XtVaCreateManagedWidget("statusline", labelWidgetClass, vport_widget,
					 XtNlabel, (XtArgVal) g_string_savebuf,
					 XtNwidth, clip_w,
					 XtNx, clip_x - 1,	/* so that left border becomes invisible */
					 XtNy, vport_h - my_h,
					 XtNborderWidth, 1,
					 XtNjustify, XtJustifyLeft,
					 XtNborder, (XtArgVal) resource._fore_Pixel,	/* same as for the buttons line */
					 NULL);
}
Esempio n. 27
0
void InitPropertiesTab()
{

  Widget prop_form, prop_scroll, vscroll;

  prop_frame = XtVaCreateWidget( "prop_frame",
				 xmFrameWidgetClass, tab_form,
				 XmNtopAttachment, XmATTACH_WIDGET,
				 XmNtopWidget, main_tab,
				 XmNbottomAttachment, XmATTACH_FORM,
				 XmNleftAttachment, XmATTACH_FORM,
				 XmNrightAttachment, XmATTACH_FORM,
				 XmNchildType, XmFRAME_WORKAREA_CHILD,
				 XmNshadowType, XmSHADOW_ETCHED_OUT,
				 NULL );

  prop_form = XtVaCreateManagedWidget( "prop_form",
				       xmFormWidgetClass, prop_frame,
				       XmNtopAttachment, XmATTACH_FORM,
				       XmNbottomAttachment, XmATTACH_FORM,
				       XmNleftAttachment, XmATTACH_FORM,
				       XmNrightAttachment, XmATTACH_FORM,
				       NULL, 0 );

  prop_scroll = XtVaCreateManagedWidget( "prop_scroll",
					 xmScrolledWindowWidgetClass,prop_form,
					 XmNtopAttachment, XmATTACH_FORM,
					 XmNrightAttachment, XmATTACH_FORM,
					 XmNleftAttachment, XmATTACH_FORM,
					 XmNbottomAttachment, XmATTACH_FORM,
					 XmNscrollBarPlacement, XmBOTTOM_RIGHT,
					 XmNscrollHorizontal, FALSE,
					 XmNhorizontalScrollBar, NULL,
					 NULL );
  
  prop_out = XtVaCreateManagedWidget( "prop_out",
				      xmTextWidgetClass, prop_scroll,
				      XmNshadowThickness, 0,
				      XmNeditMode, XmMULTI_LINE_EDIT,
				      XmNeditable, FALSE,
				      XmNcursorPositionVisible, FALSE, 	
				      XmNautoShowCursorPosition, FALSE,
				      XmNwordWrap, TRUE,
				      XmNscrollHorizontal, FALSE,
				      NULL );

  XtVaGetValues( prop_scroll, XmNverticalScrollBar, &vscroll, NULL );
  XtVaSetValues( vscroll, XmNshadowThickness, 2, XmNwidth, 15, NULL );
  
}
Esempio n. 28
0
XsMDICanvas::XsMDICanvas (const char *name, Widget parent) : XsComponent (name)
{
   assert (parent != 0);

// Initialize

   _list = 0;
   _num = 0;
   _max = 0;
   _place = 0;
   
// Install resources

   _setResources (parent, _resources);
   
// Create the scrolled window

   const int nargs = 10;
   Arg   args[nargs];
   int   n = 0;
   
   XtSetArg (args[n], XmNscrollingPolicy, XmAUTOMATIC);   n++;
   XtSetArg (args[n], XmNscrolledWindowMarginHeight, (Dimension)0);  n++;
   XtSetArg (args[n], XmNscrolledWindowMarginWidth, (Dimension)0);   n++;
   XtSetArg (args[n], XmNmarginHeight, (Dimension)5);    n++;
   XtSetArg (args[n], XmNmarginWidth, (Dimension)5);     n++;

   assert (n <= nargs);
			   
   _base = XmCreateScrolledWindow (parent, _name, args, n);
   
// Install the destroy handler
            
   _installDestroyHandler ( );
		
// Create the drawing area (canvas)

   _drawArea = XtVaCreateWidget ("canvas", xmDrawingAreaWidgetClass,
      _base, XmNmarginHeight, (Dimension)0, XmNmarginWidth, (Dimension)0,
      NULL);

// Set resize callback on drawing area

   XtAddCallback (_drawArea, XmNresizeCallback, _canvasResizeCallback, (XtPointer)this);

// Set resize callback on clip window

   XtVaGetValues (_base, XmNclipWindow, &_clipWin, NULL);
   XtAddCallback (_clipWin, XmNresizeCallback, _clipResizeCallback, (XtPointer)this);
}
Esempio n. 29
0
void InitClientsTab()
{
  Widget clients_form, out_scroll;

  clients_frame = XtVaCreateWidget( "clients_frame", xmFrameWidgetClass, 
				    tab_form,
				    XmNtopAttachment, XmATTACH_WIDGET,
				    XmNtopWidget, main_tab,
				    XmNbottomAttachment, XmATTACH_FORM,
				    XmNleftAttachment, XmATTACH_FORM,	
				    XmNrightAttachment, XmATTACH_FORM,
				    XmNchildType, XmFRAME_WORKAREA_CHILD,
				    XmNshadowType, XmSHADOW_ETCHED_OUT,
				    XmNmarginHeight, 3,
				    XmNmarginWidth, 3,		
				    NULL );

  clients_form = XtVaCreateManagedWidget( "clients_form", xmFormWidgetClass, 
					  clients_frame,
					  XmNtopAttachment, XmATTACH_FORM,
					  XmNbottomAttachment, XmATTACH_FORM,
					  XmNleftAttachment, XmATTACH_FORM,
					  XmNrightAttachment, XmATTACH_FORM,
					  NULL );
  
  clients_out = XmCreateScrolledText( clients_form, "clients_out", NULL, 0 );
  XtManageChild( clients_out );

  out_scroll = XtParent( clients_out );

  XtVaSetValues( out_scroll,
		 XmNtopAttachment, XmATTACH_FORM,
		 XmNbottomAttachment, XmATTACH_FORM,
		 XmNleftAttachment, XmATTACH_FORM,	
		 XmNrightAttachment, XmATTACH_FORM,
		 NULL );

  XtVaSetValues( clients_out,
		 XmNshadowThickness, 0,		 
		 XmNwordWrap, TRUE,
		 XmNeditMode, XmMULTI_LINE_EDIT,
		 XmNeditable, FALSE,  			/* can't edit */
		 XmNcursorPositionVisible, FALSE, 	/* no cursor */
		 XmNautoShowCursorPosition, FALSE,
		 XmNscrollingPolicy, XmAUTOMATIC,
		 NULL );

}
Esempio n. 30
0
RGISPanel::RGISPanel (Widget parent,Widget leftWidget)

	{
	FormWGT = XtVaCreateWidget ("RGISPanelForm",xmFormWidgetClass,parent,
									XmNtopAttachment,			XmATTACH_OPPOSITE_WIDGET,
									XmNtopWidget,				leftWidget,
									XmNleftAttachment,		XmATTACH_WIDGET,
									XmNleftWidget,				leftWidget,
									XmNleftOffset,				5,
									XmNrightAttachment,		XmATTACH_FORM,
									XmNrightOffset,			5,
									XmNbottomAttachment,		XmATTACH_FORM,
									XmNbottomOffset,			5,
									XmNshadowThickness,		1,
									NULL);
	}