Esempio n. 1
1
void appIcon_Init(Widget* w_TopLevel, int argc, char* argv[])
{	
	Position x, y;
	Dimension w, h;
	
	appLList = (struct NODE *)malloc(sizeof(struct NODE));
	appLList->ptrData = NULL;
	appLList->next = NULL;
	
	
	XtSetLanguageProc (NULL, NULL, NULL);
	*w_TopLevel = XtVaOpenApplication (&GXIM_App, "gXipmsg", NULL, 0, &argc, argv, NULL,sessionShellWidgetClass, NULL);

	APPICON_Form = XmCreateForm (*w_TopLevel, "ipmsgForm", NULL, 0);
	
	// Create list holder
	APPICON_List_Users = XmCreateScrolledList (APPICON_Form, "List", NULL, 0);
	
	XtVaGetValues (APPICON_Form, XmNforeground, &fg, XmNbackground, &bg, NULL);
	
	pixmap =XmGetPixmap (XtScreen (APPICON_Form), "ipmsg.xpm", fg, bg);
	
	if(pixmap == XmUNSPECIFIED_PIXMAP)
	{
		pixmap = XmGetPixmap (XtScreen (APPICON_Form), "/etc/gXipmsg/ipmsg.xpm", fg, bg);
	}
		
	// Create icon button
	n = 0;
	XtSetArg (args[n], XmNlabelType, XmPIXMAP); n++; 
	XtSetArg (args[n], XmNlabelPixmap, pixmap); n++;
	APPICON_BtnG_Icon = XmCreatePushButtonGadget (APPICON_Form, "ipmsgButton", args, n);	
	XtAddCallback (APPICON_BtnG_Icon, XmNactivateCallback, appIcon_IconCallBack, APPICON_List_Users);
	XtManageChild (APPICON_BtnG_Icon);	
	
	XtManageChild (APPICON_Form);
	
	x = WidthOfScreen (XtScreen (*w_TopLevel));
	y = HeightOfScreen (XtScreen (*w_TopLevel));
	XtVaGetValues(*w_TopLevel, XmNwidth, &w, XmNheight, &h, NULL);
	
	x = x - (w+150);
	y = y - (h+150);
	
	XtVaSetValues (*w_TopLevel,
		       XmNmwmDecorations, MWM_DECOR_TITLE | MWM_DECOR_MENU,	
		       XmNmwmFunctions, MWM_FUNC_CLOSE | MWM_FUNC_MOVE,
		       XmNtitle, "gXip",
		       XmNx, x,
		       XmNy, y,
		       NULL);	
	
	// Materialize major widgets
	XtRealizeWidget (*w_TopLevel);
}
Esempio n. 2
0
void
XFE_LdapSearchView::buildResult()
{
  Widget ldapCommands;
  Arg argv[10];
  Cardinal ac = 0;

    XFE_MNSearchView::buildResult();

    ac = 0;
    XtSetArg(argv[ac], XmNorientation, XmHORIZONTAL); ac++;
    ldapCommands = XmCreateRowColumn(m_result.container, "ldapCommands", argv, ac);

    XtVaSetValues(ldapCommands, 
                  XmNtopAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_FORM,
                  XmNleftAttachment, XmATTACH_FORM,
                  XmNrightAttachment, XmATTACH_FORM,
                  0);

    ac = 0;
    m_toCompose =  XmCreatePushButtonGadget(ldapCommands, "toCompose", argv,ac);
    m_toAddrBook =  XmCreatePushButtonGadget(ldapCommands, "toAddrBook", argv,ac);
    XtSetSensitive(m_toAddrBook, False);
    XtSetSensitive(m_toCompose,False);

    XtManageChild(m_toAddrBook);
    XtManageChild(m_toCompose);

	XtAddCallback(m_toAddrBook, XmNactivateCallback, 
				  XFE_LdapSearchView::toAddrBookCallback, 
				  this);
	XtAddCallback(m_toCompose, XmNactivateCallback, 
				  XFE_LdapSearchView::toComposeCallback, 
				  this);

    Dimension h, mh;

    XtVaGetValues(m_toAddrBook, XmNheight, &h, 0 );

    XtVaGetValues(ldapCommands, XmNmarginHeight, &mh, 0 );

    h = h + mh *2;

    XtVaSetValues(m_outliner->getBaseWidget(),
                  XmNbottomOffset, h,
                  0);
    XtManageChild(ldapCommands);
}
Esempio n. 3
0
void font_box_fill_menu (Widget **menu_buttons, Widget menu, int *number, char ***menu_list)
{
	int i;

	*menu_buttons = (Widget *) cmalloc ((*number)*sizeof (Widget));
	for (i = 0; i < *number; i++) {
		(*menu_buttons) [i] = XmCreatePushButtonGadget (menu, (*menu_list) [i], NULL, 0);
		XtManageChild ((*menu_buttons) [i]);
	}
}
Esempio n. 4
0
void XFE_ReadAttachPanel::createWidgets(Widget parent)
{
    // create panel UI

    XFE_AttachPanel::createWidgets(parent);

    // set up drag handler
    Widget dragWidget=XtNameToWidget(getBaseWidget(),"*pane");
    if (dragWidget)
        _attachDrag=new XFE_ReadAttachDrag(dragWidget,this);

    // create popup

    Arg args[10];
    int n=0;
    // disable keyboard accelerators and naviagtion in popup - they cause
    // crashes. In future, use XFE_PopupMenu when the menu items become real
    // xfeCmd's - it is more robust.
    XtSetArg(args[n],XmNtraversalOn,False);n++;
    _popupMenu = XFE_PopupMenu::CreatePopupMenu(_popupParent,
												"msgViewAttachPopup",args,n);

    _open=XmCreatePushButtonGadget(_popupMenu,"open",NULL,0);
    XtAddCallback(_open,XmNactivateCallback,OpenCb,this);
    XtManageChild(_open);
    
    _save=XmCreatePushButtonGadget(_popupMenu,"save",NULL,0);
    XtAddCallback(_save,XmNactivateCallback,SaveCb,this);
    XtManageChild(_save);
    
    _properties=XmCreatePushButtonGadget(_popupMenu,"properties",NULL,0);
    XtAddCallback(_properties,XmNactivateCallback,PropertiesCb,this);
    XtManageChild(_properties);
    
    initializePopupMenu();
}
Esempio n. 5
0
static Widget createPanelHelp(Widget parent, const char *helpText, const char *title)
{
    Arg al[20];
    int ac;
    Widget form, text, button;
    XmString st1;
    
    ac = 0;
    form = CreateFormDialog(parent, "helpForm", al, ac);

    ac = 0;
    XtSetArg (al[ac], XmNbottomAttachment, XmATTACH_FORM);  ac++;
    XtSetArg (al[ac], XmNtopAttachment, XmATTACH_NONE);  ac++;
    XtSetArg(al[ac], XmNlabelString, st1=XmStringCreateLtoR ("OK", 
                      XmSTRING_DEFAULT_CHARSET)); ac++;
    XtSetArg (al[ac], XmNmarginWidth, BUTTON_WIDTH_MARGIN);  ac++;
    button = XmCreatePushButtonGadget(form, "ok", al, ac);
    XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)helpDismissCB,
    	    (char *)form);
    XmStringFree(st1);
    XtManageChild(button);
    SET_ONE_RSRC(form, XmNdefaultButton, button);
    
    ac = 0;
    XtSetArg(al[ac], XmNrows, 15);  ac++;
    XtSetArg(al[ac], XmNcolumns, 60);  ac++;
    XtSetArg(al[ac], XmNresizeHeight, False);  ac++;
    XtSetArg(al[ac], XmNtraversalOn, False); ac++;
    XtSetArg(al[ac], XmNwordWrap, True);  ac++;
    XtSetArg(al[ac], XmNscrollHorizontal, False);  ac++;
    XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT);  ac++;
    XtSetArg(al[ac], XmNeditable, False);  ac++;
    XtSetArg(al[ac], XmNvalue, helpText);  ac++;
    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET);  ac++;
    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNbottomWidget, button);  ac++;
    text = XmCreateScrolledText(form, "helpText", al, ac);
    AddMouseWheelSupport(text);
    XtManageChild(text);
    
    SET_ONE_RSRC(XtParent(form), XmNtitle, title);
    
    return form;
}
Esempio n. 6
0
static Widget
CreateMenuBtn (
   Widget parent,
   Boolean isPushButton,
   MenuDesc * menuDesc,
   int btnIndex )
{
   int n;
   Arg args[10];
   Widget child;
   XmString labelString;

   n = 0;
   labelString = XmStringCreateLocalized(menuDesc->label);
   XtSetArg(args[n], XmNlabelString, labelString);		n++;
   XtSetArg(args[n], XmNmnemonic, menuDesc->mnemonic[0]);	n++;
   if (isPushButton)
      child = XmCreatePushButtonGadget(parent, menuDesc->name, args, n);
   else
   {
      XtSetArg(args[n], XmNvisibleWhenOff,TRUE);n++;
      child = XmCreateToggleButtonGadget(parent, menuDesc->name, args, n);
   }
   if (menuDesc->helpCallback)
   {
      XtAddCallback(child, XmNhelpCallback, menuDesc->helpCallback, 
                    menuDesc->helpData);
   }
   if (menuDesc->activateCallback)
   {
      if (isPushButton)
      {
         XtAddCallback(child, XmNactivateCallback, menuDesc->activateCallback, 
                       menuDesc->activateData);
      }
      else
      {
         XtAddCallback(child, XmNvalueChangedCallback, 
                       menuDesc->activateCallback, menuDesc->activateData);
      }
   }
   XmStringFree(labelString);
   return (child);
}
Esempio n. 7
0
void
XFE_AttachmentMenu::add_attachment_menu_items(Widget menu)
{
    const MSG_AttachmentData *data;
    Arg av [20];
    int ac;
    XmString xmname;

    if (!m_attachmentData)
        return;

    for (data = m_attachmentData;
            data != NULL;
            data ++)
    {
        char buf[1000];
        char *name, *description;
        Widget button;

        name = data->real_name;
        if (name == NULL) name = "";

        description = data->description;
        if (description == NULL) description = "";

        PR_snprintf(buf, sizeof(buf), "%s (%s)", name, description);

        xmname = XmStringCreate(buf, XmFONTLIST_DEFAULT_TAG);

        ac = 0;
        XtSetArg (av[ac], XmNlabelString, xmname);
        ac++;
        XtSetArg (av[ac], XmNuserData, data);
        ac++;

        button = XmCreatePushButtonGadget(menu, "openAttachment", av, ac);

        XtAddCallback(button, XmNactivateCallback, activate_cb, this);
        XtManageChild(button);

        XmStringFree(xmname);
    }
}
Esempio n. 8
0
static Widget CreatePushButtonGadget(char *label, char mnemonic,
                                     Widget parent)
{
    Widget widget;
    register int  n;
    Arg args[MAX_ARGS];
    XmString tcs;

    n = 0;
    tcs = XmStringLtoRCreate(label, XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, tcs);
    n++;
    XtSetArg(args[n], XmNmnemonic, mnemonic);
    n++;
    widget = XmCreatePushButtonGadget(parent, label, args, n);
    XtManageChild(widget);
    XmStringFree(tcs);

    return(widget);
}
Esempio n. 9
0
Widget 
_XmBB_CreateButtonG(
        Widget bb,
        XmString l_string,
	char *name,
        XmLabelStringLoc l_loc )
{
    Arg		        al[10] ;
    register Cardinal   ac = 0 ;
    Widget              button ;
    XmTakesDefaultTrait trait_default ;
    XmString            default_label_string_loc = NULL;
/****************/

    if(    l_string    )
	{
	    XtSetArg( al[ac], XmNlabelString, l_string) ; ac++ ;
        }
    else
	{
	    default_label_string_loc = XmStringCreate(GetLabelString(l_loc),
						      XmFONTLIST_DEFAULT_TAG);
	    XtSetArg( al[ac], XmNlabelString, default_label_string_loc); ac++;
	}
	    
    XtSetArg( al[ac], XmNstringDirection, BB_StringDirection( bb)) ; ac++ ;

    button = XmCreatePushButtonGadget( (Widget) bb, name, al, ac) ;

    trait_default = (XmTakesDefaultTrait) XmeTraitGet((XtPointer)
						      XtClass(button), 
						      XmQTtakesDefault) ;
    if (trait_default) 
	trait_default->showAsDefault  (button, XmDEFAULT_READY);

    if (default_label_string_loc)
	XmStringFree(default_label_string_loc);

    return( button ) ;
}
Esempio n. 10
0
// Override
void
XFE_LdapSearchView::addDefaultFolders()
{
  int i;
  Widget popupW;
  Cardinal ac = 0;
  Arg av[10];
  XP_List    *directories = FE_GetDirServers();
  int nDirs = XP_ListCount(directories);

  XtVaGetValues(m_rules.scopeOptW, XmNsubMenuId, &popupW, 0);
  /* Hopefully: Get Number of Scope Names from MSG */ 
  for ( i = 0; i < nDirs; i++)
  {
    Widget btn;
    XmString xmStr;

    DIR_Server *dir = (DIR_Server*)XP_ListGetObjectNum(directories,i+1);

    if ( dir && dir->dirType == LDAPDirectory )
    {

       xmStr = XmStringCreateLtoR(dir->description,
                                XmSTRING_DEFAULT_CHARSET);

       ac = 0;
       XtSetArg(av[ac], XmNuserData, i); ac++;
       XtSetArg(av[ac], XmNlabelString, xmStr); ac++;
       btn = XmCreatePushButtonGadget(popupW, "ldapDirectory", av, ac);

       XtAddCallback(btn, XmNactivateCallback, 
			XFE_LdapSearchView::folderOptionCallback, 
			this);

       XtManageChild(btn);
       XmStringFree(xmStr);
    }
   }
}
Esempio n. 11
0
static void
GetFullFontList(Widget w)
{
	Widget	b;
	int	i, j, nfonts, ii, nogood, ac;
	char	**list, *p, *q;
	char	field[14][64];	/* ??? FIX ME */
	struct xlfd_fields	**fields;
	Arg	al[2];

	/*
	 * Use userdata field to pass the FC widget id.
	 *
	 * We need this because we might get called from a tearoff,
	 * and in a tearoff we cannot walk up the widget tree to find
	 * the FontChooser.
	 */
	ac = 0;
	XtSetArg(al[ac], XmNuserData, (XtPointer)w); ac++;

	for (i=0; i<14; i++) {
		XtAddCallback(FC_Menus(w)[i], XmNentryCallback, FCFilter, (XtPointer)i);

		b = XmCreatePushButtonGadget(FC_Menus(w)[i], "*", al, ac);
		XtManageChild(b);

		XtVaSetValues(FC_Menus(w)[i], XmNmenuHistory, b, NULL);

		FC_Setting(w)[i] = XtNewString("*");
	}

	list = XListFonts(XtDisplay(w), FC_Pattern(w), 4096, &nfonts);
	fields = (struct xlfd_fields **)XtCalloc(14, sizeof(struct xlfd_fields *));

	for (i=0; i<nfonts; i++) {
		/* sscanf doesn't cope well with empty fields, so do this ourselves. */
		nogood = 0;
		for (j=0, p=list[i]; j<14; j++) {
			/* Scan for a dash and a string starting at p, store it in field */
			if (*p != '-') {
				fprintf(stderr, "%s: Can't scan font name '%s'\n",
					XtName(w), list[i]);
				nogood = 1;
				break;
			}
			p++;
			for (q=p, ii=0; *q && *q != '-' && ii < 64; q++, ii++)
				field[j][ii] = *q;
			field[j][ii] = '\0';
			if (*q)
				p = q;
			else
				break;
		}

		for (j=0; j<14; j++) {
			Remember(fields, j, field[j]);
		}
	}

	/* Create buttons */
	for (i=0; i<14; i++) {
		/*
		 * Sort according to criteria from resource.
		 */
		if (FC_SortCriteria(w) && strlen(FC_SortCriteria(w)) > 13) {
		    size_t	s, n;

		    s = sizeof(char *);
		    n = fields[i]->num;

		    if (FC_SortCriteria(w)[i] == 'n' ||  FC_SortCriteria(w)[i] == 'N') {
			qsort(fields[i]->names, n, s, qsort_helper_num);
		    } else if (FC_SortCriteria(w)[i] == 'a' ||  FC_SortCriteria(w)[i] == 'A') {
			qsort(fields[i]->names, n, s, qsort_helper_alpha);
		    } else {
			;	/* don't sort, silently */
		    }
		}

		for (j=0; j<fields[i]->num; j++) {
			b = XmCreatePushButtonGadget(FC_Menus(w)[i], fields[i]->names[j], al, ac);
			XtManageChild(b);
			XtFree(fields[i]->names[j]);
		}
		XtFree((XtPointer)fields[i]->names);
		XtFree((XtPointer)fields[i]);
	}

	XtFree((XtPointer)fields);
	XFreeFontNames(list);

	ShowCount(w, nfonts);
}
Esempio n. 12
0
Widget
_DtTermViewCreateGlobalOptionsDialog
(
    Widget		  parent
)
{
    OptionsDialogType	 *options;
    Widget		  cursorFrame;
    Widget		  cursorForm;
    Widget		  backgroundFrame;
    Widget		  backgroundForm;
    Widget		  scrollFrame;
    Widget		  scrollForm;
    Widget		  bellFrame;
    Widget		  bellForm;
    Widget		  label;
    Widget		  pulldown;
    Widget		  tmp;
    Widget		  separator;
    Widget		  button;
    Widget		  cancel;
    Widget		  reset;
    XmString		  string;
    XmString		  helpString;
    XmString		  okString;
    XmString		  cancelString;
    XmString		  resetString;
    Arg			  al[20];
    int			  ac;
    _DtTermViewLineupList *lineupList;
    DtTermViewWidget      tw = (DtTermViewWidget) parent;
    
    options = (OptionsDialogType *) XtMalloc(sizeof(OptionsDialogType));
    (void) memset(options, '\0', sizeof(*options));

    options->dtterm = tw->termview.term;

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,34, "Terminal - Global Options")));
    okString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,2, "OK")));
    cancelString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,3, "Cancel")));
    helpString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,4, "Help")));
    resetString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,33, "Reset")));
    (void) XtSetArg(al[ac], XmNdialogTitle, string);			ac++;
    (void) XtSetArg(al[ac], XmNokLabelString, okString);		ac++;
    (void) XtSetArg(al[ac], XmNcancelLabelString, cancelString);	ac++;
    (void) XtSetArg(al[ac], XmNhelpLabelString, helpString);		ac++;
    (void) XtSetArg(al[ac], XmNautoUnmanage, False);			ac++;
    options->dialog = XmCreateTemplateDialog(parent, (GETMESSAGE(NL_SETN_ViewGlobalDialog,5, "global")), al, ac);
    (void) XmStringFree(okString);
    (void) XmStringFree(cancelString);
    (void) XmStringFree(helpString);
    (void) XtSetArg(al[0], XmNlabelString, resetString);
    reset = XmCreatePushButtonGadget(options->dialog, "ResetButton", al, 1);
    XtManageChild(reset);
    (void) XmStringFree(resetString);
    (void) XtAddCallback(reset, XmNactivateCallback,
	    MapGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNokCallback,
	    OkGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNcancelCallback,
	    CancelGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNmapCallback,
	    MapGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNhelpCallback,
	    HelpTerminalOptionsCallback, (XtPointer) tw);

    options->shell = XtParent(options->dialog);

    ac = 0;
    (void) XtSetArg(al[ac], XmNallowShellResize, False);		ac++;
    (void) XtSetValues(options->shell, al, ac);

    ac = 0;
    options->form = XmCreateForm(options->dialog, "form", al, ac);
    (void) XtManageChild(options->form);

    /****************************************************************
     ****************************************************************
     *** Cursor parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    cursorFrame = XmCreateFrame(options->form, "cursorFrame", al, ac);
    (void) XtManageChild(cursorFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,6, "Cursor Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(cursorFrame, "cursorFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    cursorForm = XmCreateForm(cursorFrame, "cursorForm", al, ac);

    /****************************************************************
     * option menu: type [ box | underline ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(cursorForm, "cursorTypePulldown");
    options->cursor.type.box =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,7, "Box")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.type.underline =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,8, "Underline")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.type.invisible =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,14, "Invisible")), NoSymbol, NULL, NULL, NULL, NULL);

    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(cursorForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,9, "Cursor Style")), NoSymbol, al, ac);
    options->cursor.type.option = tmp;

    /* add to the lineup list... */
    lineupList = _DtTermViewLineupListCreate();
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->cursor.type.option),
	    options->cursor.type.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * option menu: blink [ on | off ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(cursorForm, "cursorBlinkPulldown");
    (void) XtAddCallback(pulldown, XmNentryCallback,
	    CursorBlinkCallback, (XtPointer) options);
    options->cursor.blink.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,10, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.blink.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,11, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);

    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(cursorForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,12, "Blinking Cursor")), NoSymbol, al, ac);
    options->cursor.blink.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->cursor.blink.option),
	    options->cursor.blink.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * text field: blink rate _250_
     */

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,13, "Blink Rate (milliseconds)")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);	ac++;
    options->cursor.blinkRate.label =
	    XmCreateLabelGadget(cursorForm, "blinkRateLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(options->cursor.blinkRate.label);

    ac = 0;
    (void) XtSetArg(al[ac], DtNcolumns, 4);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET);	ac++;
    (void) XtSetArg(al[ac], XmNleftWidget, options->cursor.blinkRate.label);
									ac++;
    (void) XtSetArg(al[ac], XmNleftOffset, CORRECTION_TEXT_OFFSET);	ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNnavigationType, XmNONE);  		ac++;
    options->cursor.blinkRate.text =
	    XmCreateTextField(cursorForm, (GETMESSAGE(NL_SETN_ViewGlobalDialog,15, "blinkRate")), al, ac);
    (void) XtManageChild(options->cursor.blinkRate.text);
    options->cursor.blinkRate.oldBlinkRate = 0;

    /* make the label and textfield the same height... */
    _DtTermViewEqualizeHeights(options->cursor.blinkRate.label,
	    options->cursor.blinkRate.text);

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    options->cursor.blinkRate.label,
	    options->cursor.blinkRate.text,
	    CORRECTION_LABEL);

    /* manage the cursor form... */
    (void) XtManageChild(cursorForm);


    /****************************************************************
     ****************************************************************
     **** Background parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, cursorFrame);		ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    backgroundFrame = XmCreateFrame(options->form, "backgroundFrame",
	    al, ac);
    (void) XtManageChild(backgroundFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,16, "Color Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(backgroundFrame, "backgroundFrameLabel",
	    al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    backgroundForm = XmCreateForm(backgroundFrame, "backgroundForm", al, ac);

    /****************************************************************
     * option menu: inverse video [on | off ]
     */

    pulldown =
	    _DtTermViewCreatePulldown(backgroundForm, "inverseVideoPulldown");
    options->background.inverse.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,18, "Normal")), NoSymbol,
	    NULL, NULL, NULL, NULL);
    options->background.inverse.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,17, "Inverse")), NoSymbol,
	    NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    tmp = _DtTermViewCreateOptionMenu(backgroundForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,19, "Window Background")), NoSymbol, al, ac);
    options->background.inverse.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->background.inverse.option),
	    options->background.inverse.option,
	    CORRECTION_OPTION_MENU);

    /* manage the cursor form... */
    (void) XtManageChild(backgroundForm);

    
    /****************************************************************
     ****************************************************************
     **** Scroll parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, backgroundFrame);		ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    scrollFrame = XmCreateFrame(options->form, "scrollFrame", al, ac);
    (void) XtManageChild(scrollFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,20, "Scroll Behavior")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(scrollFrame, "scrollFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    scrollForm = XmCreateForm(scrollFrame, "scrollForm", al, ac);

    /****************************************************************
     * option menu: type [jump | smooth ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(scrollForm, "ScrollTypePulldown");
    options->scroll.type.jump =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,21, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->scroll.type.smooth =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,22, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    tmp = _DtTermViewCreateOptionMenu(scrollForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,23, "Smooth Scrolling")), NoSymbol, al, ac);
    options->scroll.type.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->scroll.type.option),
	    options->scroll.type.option,
	    CORRECTION_OPTION_MENU);

    /* manage the cursor form... */
    (void) XtManageChild(scrollForm);


    /****************************************************************
     ****************************************************************
     *** Bell parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, scrollFrame);			ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    bellFrame = XmCreateFrame(options->form, "bellFrame",
	    al, ac);
    (void) XtManageChild(bellFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,24, "Bell Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(bellFrame, "bellFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    bellForm = XmCreateForm(bellFrame, "bellForm", al, ac);

    /****************************************************************
     * option menu: Type [audible | visible ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(bellForm, "typePulldown");
    options->bell.type.audible =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,25, "Audible")), NoSymbol, NULL, NULL, NULL, NULL);
    options->bell.type.visual =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,26, "Visible")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(bellForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,27, "Bell Type")), NoSymbol, al, ac);
    options->bell.type.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->bell.type.option),
	    options->bell.type.option,
	    CORRECTION_OPTION_MENU);


    /****************************************************************
     * option menu: Margin Bell [on | off ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(bellForm, "bellMarginPulldown");
    (void) XtAddCallback(pulldown, XmNentryCallback,
	    BellMarginCallback, (XtPointer) options);
    options->bell.bellMargin.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,28, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->bell.bellMargin.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,29, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(bellForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,30, "Margin Warning")), NoSymbol, al, ac);
    options->bell.bellMargin.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->bell.bellMargin.option),
	    options->bell.bellMargin.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * text field: Margin _8_
     */
    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,31, "Margin Distance")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);	ac++;
    options->bell.bellMarginDistance.label =
	    XmCreateLabelGadget(bellForm, "bellMarginDistanceLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(options->bell.bellMarginDistance.label);

    ac = 0;
    (void) XtSetArg(al[ac], DtNcolumns, 3);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET);	ac++;
    (void) XtSetArg(al[ac], XmNleftWidget,
	    options->bell.bellMarginDistance.label);			ac++;
    (void) XtSetArg(al[ac], XmNleftOffset, CORRECTION_TEXT_OFFSET);	ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNnavigationType, XmNONE);  		ac++;
    options->bell.bellMarginDistance.text =
	    XmCreateTextField(bellForm, "margin", al, ac);
    (void) XtManageChild(options->bell.bellMarginDistance.text);

    /* make the label and textfield the same height... */
    _DtTermViewEqualizeHeights(options->bell.bellMarginDistance.label,
	    options->bell.bellMarginDistance.text);

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    options->bell.bellMarginDistance.label,
	    options->bell.bellMarginDistance.text,
	    CORRECTION_LABEL);

    /* manage the margin form... */
    (void) XtManageChild(bellForm);

    /* lineup all the labels... */
    (void) _DtTermViewLineupListLineup(lineupList);
    (void) _DtTermViewLineupListFree(lineupList);
    lineupList = (_DtTermViewLineupList *) 0;

    /* create the apply button... */
    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,32, "Apply")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    button = XmCreatePushButtonGadget(options->dialog, "apply", al, ac);
    (void) XmStringFree(string);
    (void) XtAddCallback(button, XmNactivateCallback,
	    ApplyGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtManageChild(button);

    ac = 0;
    (void) XtSetArg(al[ac], XmNmwmFunctions, MWM_FUNC_MOVE);		ac++;
    (void) XtSetArg(al[ac], XmNmwmDecorations,
	    MWM_DECOR_MENU | MWM_DECOR_BORDER | MWM_DECOR_TITLE);	ac++;
    (void) XtSetValues(options->shell, al, ac);

    (void) XtManageChild(options->dialog);


    return(options->dialog);
}
Esempio n. 13
0
////////////////////////////////////////////////////////////////////////
//
// Description:
//	This creates the tracking rate preference sheet stuff.
//
// Use: protected
Widget
InvFullViewer::createTrackingPrefSheetGuts(Widget parent)
//
////////////////////////////////////////////////////////////////////////
{
    Widget label, thumb, text, device, devicem, devices[6];
    Arg args[12];
    XmString string;
    int n;

    // create a form to hold everything together
    Widget form = XtCreateWidget("", xmFormWidgetClass,
                                 parent, NULL, 0);

    // create device choice
    devicem = XmCreatePulldownMenu(form, (char *)"trackingmenu", NULL, 0);
    devices[0] = XmCreatePushButtonGadget(devicem, (char *)"Logitec on com1", NULL, 0);
    devices[1] = XmCreatePushButtonGadget(devicem, (char *)"Logitec on com2", NULL, 0);
    devices[2] = XmCreatePushButtonGadget(devicem, (char *)"Fastrak on com1", NULL, 0);
    devices[3] = XmCreatePushButtonGadget(devicem, (char *)"Fastrak on com2", NULL, 0);
    devices[4] = XmCreatePushButtonGadget(devicem, (char *)"Fastrak on com3", NULL, 0);
    devices[5] = XmCreatePushButtonGadget(devicem, (char *)"Fastrak on com4", NULL, 0);
    XtAddCallback(devices[0], XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingDevice1CB, (XtPointer) this);
    XtAddCallback(devices[1], XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingDevice2CB, (XtPointer) this);
    XtAddCallback(devices[2], XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingDevice3CB, (XtPointer) this);
    XtAddCallback(devices[3], XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingDevice4CB, (XtPointer) this);
    XtAddCallback(devices[4], XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingDevice5CB, (XtPointer) this);
    XtAddCallback(devices[5], XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingDevice6CB, (XtPointer) this);
    XtManageChildren(devices, 6);
    string = XmStringCreate((char *)"xxTrackingdevices:", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
    n = 0;
    XtSetArg(args[n], XmNlabelString, string);
    n++;
    XtSetArg(args[n], XmNsubMenuId, devicem);
    n++;
    device = XmCreateOptionMenu(form, (char *)"trackingoption", args, n);

    // create the label
    label = XtCreateWidget("Tracking rate:", xmLabelGadgetClass,
                           form, NULL, 0);

    // allocate the thumbwheel
    n = 0;
    XtSetArg(args[n], XmNvalue, 110);
    n++;
    XtSetArg(args[n], SgNangleRange, 720);
    n++;
    XtSetArg(args[n], XmNmaximum, 1010);
    n++;
    XtSetArg(args[n], XmNminimum, 10);
    n++;
    // XtSetArg(args[n], SgNunitsPerRotation, 1000); n++;
    XtSetArg(args[n], SgNshowHomeButton, FALSE);
    n++;
    XtSetArg(args[n], XmNhighlightThickness, 0);
    n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL);
    n++;
    trackingWheel = thumb = SgCreateThumbWheel(form, (char *)"", args, n);

    XtAddCallback(thumb, XmNvalueChangedCallback,
                  (XtCallbackProc)InvFullViewer::trackingWheelCB, (XtPointer) this);
    // XtAddCallback(thumb, XmNdragCallback,
    //     (XtCallbackProc) InvFullViewer::trackingWheelCB, (XtPointer) this);

    // allocate the text field
    n = 0;
    char str[15];
    sprintf(str, "%.6f", trackingWheelVal);
    XtSetArg(args[n], XmNvalue, str);
    n++;
    XtSetArg(args[n], XmNhighlightThickness, 1);
    n++;
    XtSetArg(args[n], XmNcolumns, 8);
    n++;
    trackingField = text = XtCreateWidget("", xmTextWidgetClass,
                                          form, args, n);
    XtAddCallback(text, XmNactivateCallback,
                  (XtCallbackProc)InvFullViewer::trackingFieldCB,
                  (XtPointer) this);

    // layout

    n = 0;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);
    n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);
    n++;
    XtSetValues(text, args, n);

    n = 0;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET);
    n++;
    XtSetArg(args[n], XmNbottomWidget, text);
    n++;
    XtSetArg(args[n], XmNbottomOffset, 3);
    n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);
    n++;
    XtSetArg(args[n], XmNrightWidget, text);
    n++;
    XtSetArg(args[n], XmNrightOffset, 3);
    n++;
    XtSetValues(thumb, args, n);

    n = 0;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET);
    n++;
    XtSetArg(args[n], XmNbottomWidget, thumb);
    n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);
    n++;
    XtSetArg(args[n], XmNrightWidget, thumb);
    n++;
    XtSetArg(args[n], XmNrightOffset, 5);
    n++;
    XtSetValues(label, args, n);

    n = 0;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);
    n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);
    n++;
    XtSetArg(args[n], XmNtopWidget, thumb);
    n++;
    XtSetArg(args[n], XmNtopOffset, 3);
    n++;
    XtSetValues(device, args, n);

    // manage children
    XtManageChild(text);
    XtManageChild(thumb);
    XtManageChild(label);
    XtManageChild(device);
    return form;
}
Esempio n. 14
0
Widget XmCreatePushButtonGadget_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreatePushButtonGadget(parent, name, arglist, argcount);}
Esempio n. 15
0
/*****************************************************************************
 * Function:	    void _DtHelpBuildPathArea(Widget parent,
 *                                 DtHelpDialogWidget nw);  
 *
 *
 * Parameters:      parent      Specifies the widget ID of the help dialog you
 *                              want to set the topic in.
 *                  nw          Specifies the current help dialog widget.
 *
 * Return Value:    Void.
 *
 * Purpose: 	    Creates/updates the Path Display area on top of the help 
 *                  dialog.
 *
 *****************************************************************************/
void _DtHelpBuildPathArea(
    Widget parent,
    DtHelpDialogWidget nw)
{

  Arg		args[20];
  int      	n;	
  Widget pathForm, pathLabel, btnBox, tocFrame;
  Widget _pathForm;
  XmString labelString;
  XmFontList  defaultList;
  DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;

  Dimension button1, button2, button3, button4;
  Dimension maxBtnWidth;

 
  /* Create a form to  hold the topic map stuff */
  n = 0;
  XtSetArg (args[n], XmNmarginWidth, 1);				n++;
  XtSetArg (args[n], XmNmarginHeight, 1);				n++;
  XtSetArg (args[n], XmNshadowType, XmSHADOW_OUT);			n++;
  XtSetArg (args[n], XmNautoUnmanage, False);				n++;
  pathForm = XmCreateForm (parent, "pathForm", args, n);

  n = 0;
  XtSetArg (args[n], XmNmarginWidth, 1);				n++;
  XtSetArg (args[n], XmNmarginHeight, 1);				n++;
  XtSetArg (args[n], XmNshadowType, XmSHADOW_OUT);			n++;
  XtSetArg (args[n], XmNautoUnmanage, False);				n++;
  _pathForm = XmCreateForm (pathForm, "_pathForm", args, n);

  labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE
                          (9, 1,"Volume: ")));
  n = 0;
  XtSetArg (args[n], XmNlabelString, labelString);			n++;
  XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); 		n++;
  XtSetArg (args[n], XmNleftOffset, 0);				        n++;
  XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM);			n++;
  XtSetArg (args[n], XmNtopOffset, 0);                                  n++;
  XtSetArg (args[n], XmNtraversalOn, FALSE);                            n++;
  pathLabel = 
         XmCreateLabelGadget (_pathForm, "pathLabel", args, n);
  XtManageChild (pathLabel);
  XmStringFree (labelString);


  /* Create a label for our volume title. We fill it out later 
   * bacause at this point we may not have yet opened the volume.
   */

  n = 0;
  XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); 		n++;
  XtSetArg (args[n], XmNleftWidget, pathLabel);		                n++;
  XtSetArg (args[n], XmNleftOffset, 1);				        n++;
  XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM);			n++;
  XtSetArg (args[n], XmNtopOffset, 0);                                  n++;
  XtSetArg (args[n], XmNalignment, XmALIGNMENT_BEGINNING);		n++;
  hw->help_dialog.browser.volumeLabel = 
         XmCreateLabelGadget (_pathForm, "volumeLabel", args, n);
  XtManageChild (hw->help_dialog.browser.volumeLabel);


  /* Build a container for our toc to sit in.  We do this because we cannot
  * set form constraints on our toc, but can on the container.
  */
  
  n = 0;
  XtSetArg(args[n],  XmNshadowThickness, 0);		                n++;
  XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM);         	n++;
  XtSetArg (args[n], XmNleftOffset, 0);			                n++;
  XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); 		n++;
  XtSetArg (args[n], XmNbottomOffset, 0);		                n++;
  XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET);		n++;
  XtSetArg (args[n], XmNtopOffset, 0);                                  n++;
  XtSetArg (args[n], XmNtopWidget, _pathForm);n++;
  tocFrame =  XmCreateFrame (pathForm, "tocFrame", args, n);
  XtManageChild (tocFrame);


  /* Build our button box rowcol widget container */
  n = 0;
  XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET);        	n++;
  XtSetArg (args[n], XmNleftOffset,3);		                        n++;
  XtSetArg (args[n], XmNleftWidget, tocFrame);                          n++;
  XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); 		n++;
  XtSetArg (args[n], XmNbottomOffset, 2);		                n++;
  XtSetArg (args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET);	n++;
  XtSetArg (args[n], XmNtopOffset, 2);                                  n++;
  XtSetArg (args[n], XmNtopWidget, tocFrame);                           n++;
  XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); 		n++;
  XtSetArg (args[n], XmNrightOffset, 1);		                n++;
  XtSetArg (args[n], XmNspacing, 5);			                n++;
  XtSetArg (args[n], XmNentryVerticalAlignment, XmALIGNMENT_CENTER);    n++;
  XtSetArg (args[n], XmNpacking, XmPACK_COLUMN);	                n++;
  XtSetArg (args[n], XmNorientation, XmVERTICAL);	                n++;
  btnBox = XmCreateRowColumn (pathForm, "BtnBox", args, n);
  XtManageChild (btnBox);

  
  /* Backtrack button */
  labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE(9, 2,"Backtrack")));
  n = 0; 
  XtSetArg(args[n], XmNlabelString, labelString); n++;
  hw->help_dialog.browser.btnBoxBackBtn  = XmCreatePushButtonGadget(btnBox,
                                            "btnBoxBackBtn", args, n);
  XtManageChild (hw->help_dialog.browser.btnBoxBackBtn);
  XmStringFree(labelString); 
  XtAddCallback(hw->help_dialog.browser.btnBoxBackBtn,XmNactivateCallback, 
                 _DtHelpDisplayBackCB, (XtPointer) hw); 
  XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);


  /* History Button */
  labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE(9, 3,"History...")));
  n = 0;
  XtSetArg(args[n], XmNlabelString, labelString); n++;
  hw->help_dialog.browser.btnBoxHistoryBtn = XmCreatePushButtonGadget(btnBox,
				          "btnBoxHistoryBtn",args, n);
  XtManageChild (hw->help_dialog.browser.btnBoxHistoryBtn);
  XmStringFree(labelString); 
  XtAddCallback(hw->help_dialog.browser.btnBoxHistoryBtn,XmNactivateCallback, 
                 _DtHelpDisplayHistoryCB, (XtPointer) hw); 
   

  /* Index  button */
  labelString = 
  XmStringCreateLocalized(((char *)_DTGETMESSAGE(9, 4,"Index...")));
  n = 0;
  XtSetArg(args[n], XmNlabelString, labelString); n++;
  hw->help_dialog.browser.btnBoxIndexBtn = XmCreatePushButtonGadget(btnBox,
	    		          "btnBoxIndexBtn",args, n);
  XtManageChild (hw->help_dialog.browser.btnBoxIndexBtn);
  XmStringFree(labelString); 
  XtAddCallback(hw->help_dialog.browser.btnBoxIndexBtn,XmNactivateCallback, 
                _DtHelpDisplayIndexCB, (XtPointer) hw); 


  /* Top Level Browser Button */
 
  if (hw->help_dialog.browser.showTopLevelBtn == TRUE)
    {
      labelString = 
      XmStringCreateLocalized(((char *)_DTGETMESSAGE(9, 5,"Top Level")));
      n = 0;
      XtSetArg(args[n], XmNlabelString, labelString); n++;
      hw->help_dialog.browser.btnBoxTopLevelBtn = XmCreatePushButtonGadget(btnBox,
	    		          "btnBoxTopLevelBtn",args, n);
      XtManageChild (hw->help_dialog.browser.btnBoxTopLevelBtn);
      XmStringFree(labelString); 
      XtAddCallback(hw->help_dialog.browser.btnBoxTopLevelBtn,XmNactivateCallback, 
                    _DtHelpDisplayBrowserHomeCB, (XtPointer) hw); 

    }

  /* Get our current fontlist value */
  n = 0;
  XtSetArg (args[n], XmNfontList, &(defaultList));  ++n;
  XtGetValues (hw->help_dialog.menu.topBtn, args, n);


  /* Build the Display Area */

  hw->help_dialog.browser.pTocArea = _DtHelpCreateDisplayArea(tocFrame,
                                   "TocArea",
                                    ((short) hw->help_dialog.display.scrollBarPolicy),
                                    ((short) hw->help_dialog.display.scrollBarPolicy),
				    True,
                                    ((int) hw->help_dialog.browser.visiblePathCount),
                                    1,
                                    _DtHelpDialogHypertextCB,
                                    NULL /*ResizeHelpDialogCB*/,
                                    _DtHelpFilterExecCmdCB,
                                    (XtPointer) hw,
                                    defaultList);
 

  /* We build a blank toc at first, it gets filled in later when 
   * updatePathArea gets called.
   */
   

  XtManageChild(_pathForm);
  XtManageChild(pathForm);


  /* Perform some sizing stuff here to ensure that we layout our UI 
   * per the current fonts.
   */

   /* Get the size of each button */
   n = 0;
   XtSetArg(args[n], XmNwidth, &button1);   ++n;
   XtGetValues(hw->help_dialog.browser.btnBoxBackBtn, args, n);
   n = 0;
   XtSetArg(args[n], XmNwidth, &button2);   ++n;
   XtGetValues(hw->help_dialog.browser.btnBoxHistoryBtn, args, n);
 
   n = 0;
   XtSetArg(args[n], XmNwidth, &button3);   ++n;
   XtGetValues(hw->help_dialog.browser.btnBoxIndexBtn, args, n);

   if (hw->help_dialog.browser.showTopLevelBtn == True)
    {
      n = 0;
      XtSetArg(args[n], XmNwidth, &button4);   ++n;
      XtGetValues(hw->help_dialog.browser.btnBoxTopLevelBtn, args, n);
    }
   else
     button4 = 0;

   if (button1 >= button2)
     maxBtnWidth = button1;
   else
     maxBtnWidth = button2;

   if (button3 >= maxBtnWidth)
     maxBtnWidth = button3;
   
   if (hw->help_dialog.browser.showTopLevelBtn == True)
     if (button4 >= maxBtnWidth)
       maxBtnWidth = button4;

   /* Set our toc right hand attachments */
   n = 0;
   XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); 		n++;
   XtSetArg (args[n], XmNrightOffset, maxBtnWidth +10);	                n++;
   XtSetValues (tocFrame, args, n);


}
Esempio n. 16
0
/*+++++++++++++++++++++++++++++++++++++++*/
static Widget 
build_keyboardDlg(
        Widget shell )
{
    register int     i, n;
    Arg              args[MAX_ARGS];
    Widget           widget_list[12]; 
    int              count = 0;
    Widget           form;
    Pixel            foreground, background;
    Boolean          set;
    XmString         button_string[NUM_LABELS]; 
    XmString         string;

    /* Set up DialogBoxDialog button labels */
    button_string[0] = CMPSTR(_DtOkString);
    button_string[1] = CMPSTR(_DtCancelString);
    button_string[2] = CMPSTR(_DtHelpString);

    /* Create toplevel DialogBox */

    /* saveRestore
     * Note that save.poscnt has been initialized elsewhere.  
     * save.posArgs may contain information from restoreBeep().*/

    XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);  
    save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);  
    save.poscnt++;
    XtSetArg (save.posArgs[save.poscnt], XmNdefaultPosition, False); 
    save.poscnt++;
    style.kbdDialog = __DtCreateDialogBoxDialog(shell, "KeyboardDialog", save.posArgs, save.poscnt);
    XtAddCallback(style.kbdDialog, XmNcallback, ButtonCB, NULL);
    XtAddCallback(style.kbdDialog, XmNhelpCallback,
            (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_KEYBOARD_DIALOG);

    XmStringFree(button_string[0]);
    XmStringFree(button_string[1]);
    XmStringFree(button_string[2]);

    widget_list[0] = _DtDialogBoxGetButton(style.kbdDialog,2);
    n=0;
    XtSetArg(args[n], XmNautoUnmanage, False); n++;
    XtSetArg(args[n], XmNcancelButton, widget_list[0]); n++;
    XtSetValues (style.kbdDialog, args, n);

    n=0;
    XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(13, 6, "Style Manager - Keyboard"))); n++;
    XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
    XtSetArg(args[n], XmNmwmFunctions,  DIALOG_MWM_FUNC ); n++;
    XtSetValues (XtParent(style.kbdDialog), args, n);

    n = 0;
    XtSetArg(args[n], XmNhorizontalSpacing, style.horizontalSpacing); n++;
    XtSetArg(args[n], XmNverticalSpacing, style.verticalSpacing); n++;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    form = XmCreateForm(style.kbdDialog, "keyboardForm", args, n);

    /* create keyboard pixmap */

    n = 0;
    XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
    XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
    XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
    XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
    XtSetArg(args[n], XmNstring, NULL); n++;  
    XtSetArg(args[n], XmNshadowThickness, 0); n++;  
    XtSetArg(args[n], XmNimageName, KEYBOARD_ICON); n++;  
    XtSetArg(args[n], XmNtraversalOn, False); n++;  
    widget_list[count++] = 
    kbd.pictLabel= _DtCreateIcon(form, "keyboardpictLabel", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT);  n++;
    XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH);  n++;
    string = CMPSTR(((char *)GETMESSAGE(13, 2, "Default")));
    XtSetArg(args[n], XmNlabelString, string); n++;
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    widget_list[count++] = 
    kbd.systemDefault= XmCreatePushButtonGadget(form, "systemDefault", args, n);
    XmStringFree(string);
    
    n = 0;
    set = (kbd.values.global_auto_repeat == AutoRepeatModeOn) ? True : False;
    XtSetArg(args[n], XmNset, set);  n++;
    string = CMPSTR(((char *)GETMESSAGE(13, 3, "Auto Repeat")));
    XtSetArg(args[n], XmNlabelString, string); n++;
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    widget_list[count++] = 
    kbd.autoRepeatToggle= XmCreateToggleButtonGadget(form, "autoRepeatToggle", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;
    string = CMPSTR(((char *)GETMESSAGE(13, 4, "Click Volume")));
    XtSetArg(args[n], XmNmarginHeight, 0); n++;
    XtSetArg(args[n], XmNlabelString, string); n++;
    widget_list[count++] = 
    kbd.volumeLabGad= XmCreateLabelGadget(form,"volumeLabGad", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNmaximum, VOLUME_MAX); n++; 
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
    XtSetArg(args[n], XmNshowValue, True); n++;
    XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++; 
    XtSetArg(args[n], XmNscaleWidth, SCALE_WIDTH); n++; 
    widget_list[count++] = 
    kbd.volumeScale= XmCreateScale(form,"volumeScale", args, n);

    XtAddCallback(style.kbdDialog, XmNmapCallback, layoutCB, NULL);
    XtAddCallback(style.kbdDialog, XmNmapCallback, _DtmapCB_keyboardDlg, shell);
    XtAddCallback(kbd.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);
    XtAddCallback(kbd.volumeScale, XmNvalueChangedCallback, valueChangedCB, NULL);
    XtAddCallback(kbd.autoRepeatToggle, XmNvalueChangedCallback, autoRepeatToggleCB, NULL);

    XtManageChild(form);
    XtManageChildren(widget_list,count); 

    return(style.kbdDialog);
}
Esempio n. 17
0
main(int argc, char *argv[])
{
  int i;

  exename= argv[0];

  if (argc>1) { /* Check for command line arguments */
    i= 1;
    while ((--argc > 0) && (argv[i][0]=='-')) {
      int c= argv[i][1];
      switch (c) {
      case 'a':
	automanage= 1;
	fprintf(stderr,"%s: Windows will be automanaged.\n",argv[0]);
	break;
      default:
	fprintf(stderr,"%s: illegal option %c\n",argv[0],c);
	fprintf(stderr,"usage: %s [-a]\n",argv[0]);
	argc= 0;
	break;
      }
      i++;
    }
  }

  if (!automanage) {
    Arg args[16]; 
    Widget toplevel, main_window, menu_bar, menu_pane, button;
    Widget draw_form;
    XmString title_string;
    int width=300, height=300;

    i = 0;
    toplevel = XtInitialize("p3d", "xpainter", NULL, 0, &i, NULL);

    i= 0;
    main_window= XmCreateMainWindow(toplevel, "main_window", args, i);

    i= 0;
    menu_bar= XmCreateMenuBar(main_window, "menu_bar", args, i);
    XtManageChild(menu_bar);

    i= 0;
    menu_pane= XmCreatePulldownMenu(menu_bar, "menu_pane", args, i);

    title_string= XmStringCreateSimple("File");
    i= 0;
    XtSetArg(args[i], XmNsubMenuId, menu_pane); i++;
    XtSetArg(args[i], XmNlabelString, title_string); i++;
    button= XmCreateCascadeButton(menu_bar,"file",args,i);
    if (title_string) XmStringFree(title_string);
    XtManageChild(button);

    title_string= XmStringCreateSimple("Show");
    i= 0;
    XtSetArg(args[i], XmNlabelString, title_string); i++;
    button= XmCreatePushButtonGadget(menu_pane,"show",args,i);
    XtAddCallback(button,XmNactivateCallback,show_cb,NULL);
    if (title_string) XmStringFree(title_string);
    XtManageChild(button);

    title_string= XmStringCreateSimple("Exit");
    i= 0;
    XtSetArg(args[i], XmNlabelString, title_string); i++;
    button= XmCreatePushButtonGadget(menu_pane,"exit",args,i);
    XtAddCallback(button,XmNactivateCallback,exit_cb,NULL);
    if (title_string) XmStringFree(title_string);
    XtManageChild(button);

    i= 0;
    draw_form= XmCreateForm(main_window,"draw_form", args, i);
    XtManageChild(draw_form);

    i = 0;
    XtSetArg(args[i], XtNwidth, width); i++;
    XtSetArg(args[i], XtNheight, height); i++;
    XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
    XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
    XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;

#ifdef USE_OPENGL
    XtSetArg(args[i], GLwNrgba, TRUE); i++;
    XtSetArg(args[i], GLwNdoublebuffer, TRUE); i++;
    XtSetArg(args[i], GLwNdepthSize, 16); i++;
    XtSetArg(args[i], GLwNallocateBackground, TRUE); i++;
    XtSetArg(args[i], GLwNinstallBackground, TRUE); i++;
    drawa= GLwCreateMDrawingArea(draw_form, "spina", args, i);
#else
    XtSetArg(args[i], GlxNglxConfig, glxconfig); i++;
    drawa= GlxCreateMDraw(draw_form, "spina", args, i);
#endif
    XtManageChild(drawa);

    i = 0;
    XtSetArg(args[i], XtNwidth, width); i++;
    XtSetArg(args[i], XtNheight, height); i++;
    XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
    XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
    XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
    XtSetArg(args[i], XmNleftWidget, drawa); i++;
    XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;

#ifdef USE_OPENGL
    XtSetArg(args[i], GLwNrgba, TRUE); i++;
    XtSetArg(args[i], GLwNdoublebuffer, TRUE); i++;
    XtSetArg(args[i], GLwNdepthSize, 16); i++;
    XtSetArg(args[i], GLwNallocateBackground, TRUE); i++;
    XtSetArg(args[i], GLwNinstallBackground, TRUE); i++;
    drawb= GLwCreateMDrawingArea(draw_form, "spinb", args, i);
#else
    XtSetArg(args[i], GlxNglxConfig, glxconfig); i++;
    drawb= GlxCreateMDraw(draw_form, "spinb", args, i);
#endif
    XtManageChild(drawb);

    XtManageChild(main_window);

    XtRealizeWidget(toplevel);
  }
  else { /* automanage renderers */
    dp_init_ren("myrena", "gl","",
		"title=\"Ren A\",size=\"256x256+200+200\"");
    dp_init_ren("myrenb", "gl","",
		"title=\"Ren B\",size=\"300x400+500+500\"");
    fprintf(stderr, "%s: renderer initialized\n",exename);
    dp_print_ren("myrena");
    dp_print_ren("myrenb");
    rens_initialized= 1;
    build_geom();
  }

  if (!automanage) {
    XtMainLoop();
  }
  else {
    fprintf(stderr, "%s: about to render\n",exename);
    for (i=0; i<180; i++) make_new_snaps();
    finish_and_shutdown();
  }
}
Esempio n. 18
0
void
main(int argc, char **argv)
{
    int    		i,j;
    Cardinal		n;
    XmString            Label;
    Arg			args[MAX_ARGS];
    int			test_num;
    char		test_char;
    char		ContainerName[NAME_LEN + 1];
    
    ContainerName[0] = '\0';
    test_num = 0;
    test_char = '\0';
    
    CommonTestInit(argc, argv);

    if (UserData != NULL) {
	
	if (strcmp(UserData, "a") == 0) 
	    test_num = 1;
	else if (strcmp(UserData, "b") == 0) 
	    test_num = 2;
	else if (strcmp(UserData, "c") == 0) 
	    test_num = 3;
	else if (strcmp(UserData, "d") == 0) 
	    test_num = 4;
	
	test_char = *UserData;
	
	free(UserData);
	
    }
    sprintf(ContainerName, "Container4%c", test_char);

    /*
     * Create a main window
     */
    n = 0;
    XtSetArg(args[n], XmNborderWidth, 2); n++;
    MainW1 = XmCreateMainWindow(Shell1, "MainW1", args, n);
    XtManageChild(MainW1);

    /*
     * Create a menu bar with a pulldown menu for interacting with the 
     * clipboard
     */

    n = 0;
    menubar1 = XmCreateMenuBar(MainW1, "menubar1", args, n);
    XtManageChild(menubar1);

    n = 0;
    pulldown1 = XmCreatePulldownMenu(menubar1, "pulldown1", args, n);
    
    Label = XmStringCreate("Edit", XmSTRING_DEFAULT_CHARSET);
    n = 0;
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNsubMenuId, pulldown1);  n++;
    menu_btn1 = XmCreateCascadeButton(menubar1, "menu_btn1", args, n);
    XtManageChild(menu_btn1);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Cut", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    CutPB1 = XmCreatePushButtonGadget(pulldown1, "CutPB1", args, n);
    XtManageChild(CutPB1);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Copy", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    CopyPB1 = XmCreatePushButtonGadget(pulldown1, "CopyPB1", args, n);
    XtManageChild(CopyPB1);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Copy Link", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    CopyLinkPB1 = XmCreatePushButtonGadget(pulldown1, "CopyLinkPB1", args, n);
    XtManageChild(CopyLinkPB1);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Paste", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    PastePB1 = XmCreatePushButtonGadget(pulldown1, "PastePB1", args, n);
    XtManageChild(PastePB1);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Paste Link", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    PasteLinkPB1= XmCreatePushButtonGadget(pulldown1, "PasteLinkPB1", args, n);
    XtManageChild(PasteLinkPB1);
    XmStringFree(Label);
    
    /*
     * Create the container 
     */

    ColumnHeadings = (XmStringTable) XtMalloc(NUM_COL * sizeof(XmString));

    for (i = 0; i < NUM_COL; i++)
	 ColumnHeadings[i] = XmStringGenerate(ColumnHeadingText[i],
					      NULL,
					      XmCHARSET_TEXT,
					      NULL);

    n = 0;
    XtSetArg(args[n], XmNdetailColumnHeading, ColumnHeadings); n++;
    XtSetArg(args[n], XmNdetailColumnHeadingCount, NUM_COL); n++;
    XtSetArg(args[n], XmNdetailOrderCount, NUM_COL-1); n++;
    Container4 = XmCreateContainer(MainW1, ContainerName, args, n);

    XtManageChild(Container4);
    
    XtAddCallback(Container4, XmNdefaultActionCallback, PrintChildrenCB, NULL);
    XtAddCallback(Container4, XmNconvertCallback, ConvertCB, NULL);
    XtAddCallback(Container4, XmNdestinationCallback, DestinationCB, NULL);

    XtAddCallback(CutPB1, XmNactivateCallback, CutCB, (XtPointer) Container4);
    XtAddCallback(CopyPB1, XmNactivateCallback, CopyCB, (XtPointer)Container4);
    XtAddCallback(CopyLinkPB1, XmNactivateCallback, CopyLinkCB, 
		  (XtPointer) Container4);
    XtAddCallback(PastePB1, XmNactivateCallback, PasteCB, 
		  (XtPointer) Container4);
    XtAddCallback(PasteLinkPB1, XmNactivateCallback, PasteLinkCB, 
		  (XtPointer) Container4);

    for (i=0; i<NUM_COL; i++)
      XmStringFree(ColumnHeadings[i]);
    XtFree((XtPointer) ColumnHeadings);

    EntryDetails = (XmStringTable *) XtMalloc(NUM_OBJ * sizeof(XmStringTable));
    
    for (i = 0; i < NUM_OBJ; i++) {
	ColumnHeadings = (XmStringTable)XtMalloc((NUM_COL-1) * sizeof(XmString));
	ColumnHeadings[0] = XmStringGenerate(FullTitleText[i],
					     NULL,
					     XmCHARSET_TEXT,
					     NULL);
	ColumnHeadings[1] = XmStringGenerate(FlavorText[i],
					     NULL,
					     XmCHARSET_TEXT,
					     NULL);
	ColumnHeadings[2] = XmStringGenerate(AgeText[i],
					     NULL,
					     XmCHARSET_TEXT,
					     NULL);
	EntryDetails[i] = ColumnHeadings;
    }


    n = 0;
    XtSetArg(args[n], XmNx, 100); n++;
    XtSetArg(args[n], XmNy, 100); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[0]); n++;
    IconGad1 = XmCreateIconGadget(Container4, "IconGad1", args, n);
    XtManageChild(IconGad1);
    
    n = 0;
    XtSetArg(args[n], XmNx, 200); n++;
    XtSetArg(args[n], XmNy, 200); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[1]); n++;
    IconGad2 = XmCreateIconGadget(Container4, "IconGad2", args, n);
    XtManageChild(IconGad2);
    
    n = 0;
    XtSetArg(args[n], XmNx, 300); n++;
    XtSetArg(args[n], XmNy, 100); n++;
    XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[2]); n++;
    IconGad3 = XmCreateIconGadget(Container4, "IconGad3", args, n);
    XtManageChild(IconGad3);
    
    n = 0;
    XtSetArg(args[n], XmNx, 50); n++;
    XtSetArg(args[n], XmNy, 400); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[3]); n++;
    IconGad4 = XmCreateIconGadget(Container4, "IconGad4", args, n);
    XtManageChild(IconGad4);
    
    n = 0;
    XtSetArg(args[n], XmNentryParent, IconGad3); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    XtSetArg(args[n], XmNdetail, EntryDetails[4]); n++;
    IconGad31 = XmCreateIconGadget(Container4, "IconGad31", args, n);
    XtManageChild(IconGad31);
    
    n = 0;
    XtSetArg(args[n], XmNentryParent, IconGad3); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[5]); n++;
    IconGad32 = XmCreateIconGadget(Container4, "IconGad32", args, n);
    XtManageChild(IconGad32);
    
    n = 0;
    XtSetArg(args[n], XmNentryParent, IconGad32); n++;
    XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[6]); n++;
    IconGad321 = XmCreateIconGadget(Container4, "IconGad321", args, n);
    XtManageChild(IconGad321);
    
    n = 0;
    XtSetArg(args[n], XmNentryParent, IconGad321); n++;
    XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[7]); n++;
    IconGad3211 = XmCreateIconGadget(Container4, "IconGad3211", args, n);
    XtManageChild(IconGad3211);
    
    n = 0;
    XtSetArg(args[n], XmNentryParent, IconGad3); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[8]); n++;
    IconGad33 = XmCreateIconGadget(Container4, "IconGad33", args, n);
    XtManageChild(IconGad33);
    
    n = 0;
    XtSetArg(args[n], XmNx, 70); n++;
    XtSetArg(args[n], XmNy, 420); n++;
    XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++;
    XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; 
    XtSetArg(args[n], XmNdetail, EntryDetails[9]); n++;
    IconGad5 = XmCreateIconGadget(Container4, "IconGad5", args, n);
    XtManageChild(IconGad5);
    
    XmMainWindowSetAreas(MainW1, menubar1, NULL, NULL, NULL, Container4);

    for (i = 0; i < NUM_OBJ; i++) {
	
	ColumnHeadings = EntryDetails[i];
	for (j = 0; j < NUM_COL-1; j++)
	    XmStringFree(ColumnHeadings[j]);
	XtFree((XtPointer)ColumnHeadings);
	
    }
    XtFree((XtPointer)EntryDetails);
    
    XtRealizeWidget(Shell1);
    
    CommonPause();

    CommonPause();

    XmContainerRelayout(Container4);
    CommonPause();

    if ((test_num == 1) || (test_num == 2)) {
	TestContainerReorder();
	CommonPause();
    }

    /*
     * Create another Container for UTM testing
     */
    CreateAnotherContainer();
    CommonPause();
    CommonPause();
    CommonPause();
    CommonPause();
    CommonPause();
    CommonPause();
    CommonPause();

    CommonPause();
    
    XtAppMainLoop(app_context);
    
}
Esempio n. 19
0
static void CreateAnotherContainer()
{
    Widget        PopupShell;
    Widget        MainW2, menubar2, pulldown2, menu_btn2;
    Widget        CutPB2, CopyPB2, CopyLinkPB2, PastePB2, PasteLinkPB2;
    Widget        OtherContainer4;
    Widget        IconGad6, IconGad7, IconGad8, IconGad9, IconGad10;
    Cardinal      n;
    XmString      Label;
    Arg	          args[MAX_ARGS];

    /*
     * Create a Dialog Shell
     */
    n = 0;
    XtSetArg(args[n], XtNgeometry, "=375x375+400+300"); n++;
    XtSetArg(args[n], XtNallowShellResize, True); n++;
    PopupShell = XtCreatePopupShell("OtherContainer", 
				    topLevelShellWidgetClass, Shell1,
				    args, n);

    /*
     * Create a main window
     */
    n = 0;
    XtSetArg(args[n], XmNborderWidth, 2); n++;
    MainW2 = XmCreateMainWindow(PopupShell, "MainW2", args, n);
    XtManageChild(MainW2);

    /*
     * Create a menu bar with a pulldown menu for interacting with the 
     * clipboard
     */

    n = 0;
    menubar2 = XmCreateMenuBar(MainW2, "menubar2", args, n);
    XtManageChild(menubar2);

    n = 0;
    pulldown2 = XmCreatePulldownMenu(menubar2, "pulldown2", args, n);
    
    Label = XmStringCreate("Edit", XmSTRING_DEFAULT_CHARSET);
    n = 0;
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNsubMenuId, pulldown2);  n++;
    menu_btn2 = XmCreateCascadeButton(menubar2, "menu_btn2", args, n);
    XtManageChild(menu_btn2);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Cut", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    CutPB2 = XmCreatePushButtonGadget(pulldown2, "CutPB2", args, n);
    XtManageChild(CutPB2);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Copy", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    CopyPB2 = XmCreatePushButtonGadget(pulldown2, "CopyPB2", args, n);
    XtManageChild(CopyPB2);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Copy Link", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    CopyLinkPB2 = XmCreatePushButtonGadget(pulldown2, "CopyLinkPB2", args, n);
    XtManageChild(CopyLinkPB2);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Paste", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    PastePB2 = XmCreatePushButtonGadget(pulldown2, "PastePB2", args, n);
    XtManageChild(PastePB2);
    XmStringFree(Label);

    n = 0;
    Label = XmStringCreate("Paste Link", XmSTRING_DEFAULT_CHARSET);
    XtSetArg(args[n], XmNlabelString, Label);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    PasteLinkPB2= XmCreatePushButtonGadget(pulldown2, "PasteLinkPB2", args, n);
    XtManageChild(PasteLinkPB2);
    XmStringFree(Label);
    
    /*
     * Create the container 
     */
    n = 0;
    XtSetArg(args[n], XmNwidth, 450); n++;
    XtSetArg(args[n], XmNheight, 450); n++;
    XtSetArg(args[n], XmNentryViewType, XmANY_ICON); n++;
    XtSetArg(args[n], XmNlayoutType, XmSPATIAL); n++;
    XtSetArg(args[n], XmNspatialStyle, XmNONE); n++;
    XtSetArg(args[n], XmNautomaticSelection, XmNO_AUTO_SELECT); n++;
    OtherContainer4 = XmCreateContainer(MainW2, "OtherContainer", args, n);
    XtManageChild(OtherContainer4);
    
    XtAddCallback(OtherContainer4, XmNconvertCallback, ConvertCB, NULL);
    XtAddCallback(OtherContainer4, XmNdestinationCallback, DestinationCB, 
		  NULL);

    XtAddCallback(CutPB2, XmNactivateCallback, CutCB, 
		  (XtPointer) OtherContainer4);
    XtAddCallback(CopyPB2, XmNactivateCallback, CopyCB, 
		  (XtPointer) OtherContainer4);
    XtAddCallback(CopyLinkPB2, XmNactivateCallback, CopyLinkCB,
		  (XtPointer) OtherContainer4);
    XtAddCallback(PastePB2, XmNactivateCallback, PasteCB, 
		  (XtPointer) OtherContainer4);
    XtAddCallback(PasteLinkPB2, XmNactivateCallback, PasteLinkCB, 
		  (XtPointer) OtherContainer4);
    n = 0;
    XtSetArg(args[n], XmNx, 50); n++;
    XtSetArg(args[n], XmNy, 50); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    IconGad6 = XmCreateIconGadget(OtherContainer4, "IconGad6", args, n);
    XtManageChild(IconGad6);
    
    n = 0;
    XtSetArg(args[n], XmNx, 150); n++;
    XtSetArg(args[n], XmNy, 150); n++;
    XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++;
    IconGad7 = XmCreateIconGadget(OtherContainer4, "IconGad7", args, n);
    XtManageChild(IconGad7);
    
    n = 0;
    XtSetArg(args[n], XmNx, 50); n++;
    XtSetArg(args[n], XmNy, 300); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    IconGad8 = XmCreateIconGadget(OtherContainer4, "IconGad8", args, n);
    XtManageChild(IconGad8);
    
    n = 0;
    XtSetArg(args[n], XmNx, 300); n++;
    XtSetArg(args[n], XmNy, 300); n++;
    XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++;
    IconGad9 = XmCreateIconGadget(OtherContainer4, "IconGad9", args, n);
    XtManageChild(IconGad9);
    
    n = 0;
    XtSetArg(args[n], XmNx, 200); n++;
    XtSetArg(args[n], XmNy, 50); n++;
    XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++;
    IconGad10 = XmCreateIconGadget(OtherContainer4, "IconGad10", args, n);
    XtManageChild(IconGad10);
    
    XmMainWindowSetAreas(MainW2, menubar2, NULL, NULL, NULL, OtherContainer4);

    XtPopup(PopupShell, XtGrabNone);
}
Esempio n. 20
0
void Find(Widget w, XtPointer client_data, XtPointer call_data)
{
    Widget frm, pane, rc, b, list, opt;
    XmString item;
    int n, i;
    Arg args[MAX_ARGS];

    n=0;
    XtSetArg(args[n], XmNallowShellResize, True); n++;
    cbdata.top=XmCreateDialogShell(globl.parent, "findbox", args, n);
    XtManageChild(cbdata.top);

    n=0;
    /* XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++; */
    frm=XmCreateRowColumn(cbdata.top, "container", args, n);
    XtManageChild(frm);

    n=0;
    XtSetArg(args[n], XmNnumColumns, 2); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    rc=XmCreateRowColumn(frm, "inputs", args, n);
    XtManageChild(rc);

    n=0;
    XtManageChild(XmCreateLabelGadget(rc, "Find entries where", args, n));

    n=0;
    opt=XmCreatePulldownMenu(rc, "pane", args, n);

    for(i=0; i<NFIELDS; i++)
    {
	n=0;
	b=XmCreatePushButtonGadget(opt, dbrnames[i], args, n);
        XtAddCallback(b, XmNactivateCallback, FindSetFrom, (XtPointer) i);
	XtManageChild(b);
    }

    n=0;
    XtSetArg(args[n], XmNsubMenuId, opt); n++;
    list=XmCreateOptionMenu(rc, "fromMenu", args, n);
    XtManageChild(list);

    /* relation */

    n=0;
    opt=XmCreatePulldownMenu(rc, "pane", args, n);

    for(i=0; relentries[i]!=NULL; i++)
    {
	n=0;
	b=XmCreatePushButtonGadget(opt, relentries[i], args, n);
        XtAddCallback(b, XmNactivateCallback, FindSetRelation, (XtPointer) i);
	XtManageChild(b);
    }

    n=0;
    XtSetArg(args[n], XmNsubMenuId, opt); n++;
    list=XmCreateOptionMenu(rc, "relationMenu", args, n);
    XtManageChild(list);

    /* end of relation */

    n=0;
    cbdata.value=XmCreateTextField(rc, "findsel", args, n);
    XtManageChild(cbdata.value);

    n=0;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNnumColumns, 2); n++;
    rc=XmCreateRowColumn(frm, "inputs", args, n);
    XtManageChild(rc);

    n=0;
    b=XmCreatePushButtonGadget(rc, "Go", args, n);
    XtAddCallback(b, XmNactivateCallback, FindCB, (XtPointer) &cbdata);
    XtManageChild(b);

    n=0;
    b=XmCreatePushButtonGadget(rc, "Close", args, n);
    XtAddCallback(b, XmNactivateCallback, CloseFindWindow, NULL);
    XtManageChild(b);
}
Esempio n. 21
0
int main ( int argc, char *argv[] )
{
  XtAppContext	app_con ;

  Widget	toplevel ;
  Widget	menu_widget ;
  Widget	opt_widget ;
  Widget	button ;
  
  Arg		arg[5] ;
  Cardinal	arg_num ;
  int 		i ;
  int		val[] = { 0, 1, 2, 3, 4, 5 } ;
  int		j = 0 ;
  char 		buffer[10] ;
    
  toplevel = XtVaAppInitialize( &app_con,
    NULL,
    NULL, 0,
    &argc, argv,
    NULL,
    NULL );
    
  menu_widget = XmCreatePulldownMenu(
    toplevel, "pulldown", NULL, 0 );

#if 0
  /* 
   * if this callback is added, all subsequent callbacks get called too 
   */
  XtAddCallback( menu_widget, XmNentryCallback, entry_cb, &val[j++] );  
#endif

  arg_num = 0 ;
  XtSetArg( arg[arg_num], XmNsubMenuId, menu_widget );	arg_num++ ;
  opt_widget = XmCreateOptionMenu(
    toplevel, "options", arg, arg_num );

#if 0
  /* 
   * if this callback is added, all subsequent callbacks get called too 
   */
  XtAddCallback( menu_widget, XmNentryCallback, entry_cb, &val[j++] );  
#endif

  for ( i = 0 ; i < 5 ; i++ )
  {
    sprintf( buffer, "item%d", i );
    button = XmCreatePushButtonGadget( 
      menu_widget, buffer, NULL, 0 );
    XtManageChild( button );
  }

  XtAddCallback( menu_widget, XmNentryCallback, entry_cb, &val[j++] );  

#if 1
  /* 
   * if this button is created, lesstif doesn't call the entry callback
   * for item0 .. item4, but calls it for item5
   */
    sprintf( buffer, "item%d", i );
    button = XmCreatePushButtonGadget( 
      menu_widget, buffer, NULL, 0 );
    XtManageChild( button );
#endif

  XtManageChild( opt_widget );

  XtAddCallback( menu_widget, XmNentryCallback, entry_cb, &val[j++] );  

  XtRealizeWidget( toplevel );
  
  {
  static XtWidgetGeometry Expected[] = {
  	CWWidth | CWHeight,		0,	0,	80,	35,	0,0,0,
  	CWWidth | CWHeight | CWX | CWY,	3,	3,	4,	29,	0,0,0,
  	CWWidth | CWHeight | CWX | CWY,	10,	3,	67,	29,	0,0,0,
};

  PrintDetails(toplevel, Expected);
  }
    LessTifTestMainLoop(toplevel);
    /*
  XtAppMainLoop( app_con );
  */
  
  return 0;
}
Esempio n. 22
0
/*+++++++++++++++++++++++++++++++++++++++*/
static Widget 
build_dtwmDlg(
        Widget shell )
{
    register int     i, n;
    Arg              args[MAX_ARGS];
    XmString         button_string[NUM_LABELS]; 
    XmString         string; 
    Widget           form;
    Widget           windowFocusForm;
    Widget           iconPlacementForm;
    int              count = 0;
    Widget           widgetList1[6];

    /* get dtwm resource values  */

    /* Set up DialogBoxDialog button labels */
    button_string[0] = CMPSTR((String) _DtOkString);
    button_string[1] = CMPSTR((String) _DtCancelString);
    button_string[2] = CMPSTR((String) _DtHelpString);

    /* Create toplevel DialogBox */
    /* saveRestore
     * Note that save.poscnt has been initialized elsewhere.  
     * save.posArgs may contain information from restoreBeep().*/

    XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);  save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);  save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
    save.poscnt++;
    style.dtwmDialog = 
        __DtCreateDialogBoxDialog(shell, "dtwmDialog", save.posArgs, save.poscnt);
    XtAddCallback(style.dtwmDialog, XmNhelpCallback,
            (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_DTWM_DIALOG);

    XmStringFree(button_string[0]);
    XmStringFree(button_string[1]);
    XmStringFree(button_string[2]);

    widgetList1[0] = _DtDialogBoxGetButton(style.dtwmDialog,2);
    n=0;
    XtSetArg(args[n], XmNautoUnmanage, False); n++;
    XtSetArg(args[n], XmNcancelButton, widgetList1[0]); n++;
    XtSetValues (style.dtwmDialog, args, n);

    n=0;
    XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(18, 1, "Style Manager - Window"))); n++;
    XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
    XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
    XtSetValues (XtParent(style.dtwmDialog), args, n);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    form = XmCreateForm(style.dtwmDialog, "dtwmForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
    XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
    XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
    XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
    XtSetArg(args[n], XmNstring, NULL); n++;  
    XtSetArg(args[n], XmNshadowThickness, 0); n++;  
    XtSetArg(args[n], XmNimageName, DTWM_ICON); n++;  
    XtSetArg(args[n], XmNtraversalOn, False); n++;  
    widgetList1[count++] = 
    dtwm.pictLabel = _DtCreateIcon(form, "dtwmpictLabel", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT);  n++;
    XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH);  n++;
    string = CMPSTR(((char *)GETMESSAGE(18, 2, "Default")));
    XtSetArg(args[n], XmNlabelString, string); n++;
    widgetList1[count++] = dtwm.systemDefault = 
        XmCreatePushButtonGadget(form, "systemDefault", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 3, "Window Behavior"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = dtwm.windowFocusTB
        = _DtCreateTitleBox(form, "windowFocusTB", args, n);
    XmStringFree(string);
    
    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    windowFocusForm = 
        XmCreateForm(dtwm.windowFocusTB, "windowFocusForm", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 4, "Window Icons"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = dtwm.iconPlacementTB
        = _DtCreateTitleBox(form, "iconPlacementTB", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    iconPlacementForm = 
        XmCreateForm(dtwm.iconPlacementTB, "iconPlacementForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginWidth, 0); n++;
    XtSetArg(args[n], XmNmarginHeight, 0); n++;
    dtwm.focusPolicyRC = 
        XmCreateRadioBox(windowFocusForm, "focusPolicyRC", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 13, "Point In Window To Make Active"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.pointerTG = 
        XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "pointerTG", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 14, "Click In Window To Make Active"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.explicitTG = 
        XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "explicitTG", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNmargin, 0); n++;
    dtwm.focusSeparator = 
        XmCreateSeparatorGadget(windowFocusForm, "focusSeparator", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 15, "Raise Window When Made Active"));
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    XtSetArg(args[n], XmNlabelString, string);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    dtwm.autoRaiseTG = 
        XmCreateToggleButtonGadget(windowFocusForm, "autoRaiseTG", args, n);
    XmStringFree(string);


    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 11, "Allow Primary Windows On Top"));
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    XtSetArg(args[n], XmNlabelString, string);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    dtwm.secStackTG = 
        XmCreateToggleButtonGadget(windowFocusForm, "secStackTG", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 16, "Show Contents During Move"));
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    XtSetArg(args[n], XmNlabelString, string);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    dtwm.moveOpaqueTG = 
        XmCreateToggleButtonGadget(windowFocusForm, "moveOpaqueTG", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNmarginWidth, 0); n++;
    XtSetArg(args[n], XmNmarginHeight, 0); n++;
    dtwm.useIconBoxRC = 
        XmCreateRadioBox(iconPlacementForm, "useIconBoxRC", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 9, "Use Icon Box"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.iconBoxTG = 
        XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "iconBoxTG", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 10, "Place On Workspace"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.desktopTG = 
        XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "desktopTG", args, n);
    XmStringFree(string);

    XtAddCallback(style.dtwmDialog, XmNmapCallback, formLayoutCB, NULL);
    XtAddCallback(style.dtwmDialog, XmNmapCallback, _DtmapCB_dtwmDlg, shell);
    XtAddCallback(style.dtwmDialog, XmNcallback, ButtonCB, NULL);
    XtAddCallback(dtwm.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);

    XtManageChild(form);
    XtManageChildren(widgetList1,count); 

    XtManageChild(windowFocusForm);
    XtManageChild(iconPlacementForm);

    XtManageChild(dtwm.focusPolicyRC);
    XtManageChild(dtwm.pointerTG);
    XtManageChild(dtwm.explicitTG);

    XtManageChild(dtwm.focusSeparator);
    XtManageChild(dtwm.autoRaiseTG);
    XtManageChild(dtwm.secStackTG);
    XtManageChild(dtwm.moveOpaqueTG);

    XtManageChild(dtwm.useIconBoxRC);
    XtManageChild(dtwm.iconBoxTG);
    XtManageChild(dtwm.desktopTG);

    return(style.dtwmDialog);
}
Esempio n. 23
0
/*
 * Function:  _DtPrintCreateHdrFtrFrame
 *
 * Creates a frame for specifying the contents of page headers and footers.
 * The frame contains four option menus, one for each _DtPrintHdrFtrEnum.
 * The pulldown menus for the option menu are constructed from the .string
 * field in the array of _DtPrintHdrFtrSpec in "specs".
 * 
 * _DtPrintCreateHdrFtrFrame copies the pointer to the array of
 * _DtPrintHdrFtrSpec.  IT DOES NOT COPY THE ELEMENTS OF THE ARRAY.
 *
 *	parent -	specifies the parent of the frame.
 *	nspecs -	specifies the number of entries in the specs array.
 *	specs -		array of header/footer specifiers.  The .string
 *			field is used to construct labels in the GUI.
 *			The .data field is returned in calls to
 *			_DtPrintGetHdrFtrSpec.
 *
 * Returns the widget id for the frame.
 */
Widget
_DtPrintCreateHdrFtrFrame(
	Widget		parent,
	int		nspecs,
	char		**spec_strings,
	void		**spec_data
	)
{
    DtpoHdrFtrFrame	*info;
    Arg		args[16];
    int		n;
    int		i;
    XmString	xms;

    info = (DtpoHdrFtrFrame *) XtMalloc( sizeof(DtpoHdrFtrFrame) );
    info->nspecs = nspecs;
    info->specs = (DtpoHdrFtrSpec *) XtMalloc(nspecs*sizeof(DtpoHdrFtrSpec));
    for (i=0; i<nspecs; i++)
    {
        info->specs[i].string = spec_strings[i];
	if (spec_data != (void*) NULL)
          info->specs[i].data = spec_data[i];
	else
	  info->specs[i].data = (void*) NULL;
	info->specs[i].button = (Widget) NULL;
    }


    /*
     * Create the frame and attach add a destroyCallback to clean up
     * memory allocated for this object.
     */
    n = 0;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    info->frame = XmCreateFrame(parent, "HdrFtrFrame", args, n);
    XtAddCallback(
		info->frame,
		XmNdestroyCallback,
		_DtPrintDestroyHdrFtrFrameCB,
		(XtPointer) info
		);

    /*
     * Create a label child for the frame
     */
    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_LABEL);
    n = 0;
    XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    info->label = XmCreateLabel(info->frame, "HdrFtrLabel", args, n);
    XtManageChild(info->label);
    XmStringFree(xms);

    /*
     * Create a form work area child which will be populated by the
     * OptionMenu's.
     */
    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNfractionBase, 2); n++;
    info->form = XmCreateForm(info->frame, "HdrFtrForm", args, n);

    /*
     * Create the pulldown menu for the option menus.
     * Store the button index in the userData resource of each button.
     */
    info->menu = XmCreatePulldownMenu(parent, "HdrFtrMenu", NULL, 0);
    for (i=0; i<info->nspecs; i++)
    {
	static char	button_label[32];

	sprintf(button_label, "Button%d", i);
	xms = XmStringCreateLocalized(info->specs[i].string);
	n = 0;
	XtSetArg(args[n], XmNlabelString, xms); n++;
	XtSetArg(args[n], XmNuserData, i); n++;
	info->specs[i].button =
	    XmCreatePushButtonGadget(info->menu, button_label, args, n);
        XmStringFree(xms);
        XtManageChild(info->specs[i].button);
    }


    /*
     * Create the option menus using the menu created above.
     */
    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_TOP_LEFT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
    XtSetArg(args[n], XmNrightPosition, 1); n++;
    XtSetArg(args[n], XmNrightOffset, 5); n++;

    info->top_left = XmCreateOptionMenu(
				info->form,
				"PageHeaderLeftOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->top_left);

    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_TOP_RIGHT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top_left); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;

    info->top_right = XmCreateOptionMenu(
				info->form,
				"PageHeaderRightOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->top_right);

    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_BOTTOM_LEFT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top_left); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top_left); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;

    info->bottom_left = XmCreateOptionMenu(
				info->form,
				"PageFooterLeftOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->bottom_left);

    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_BOTTOM_RIGHT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->bottom_left); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top_right); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;

    info->bottom_right = XmCreateOptionMenu(
				info->form,
				"PageFooterRightOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->bottom_right);

    XtManageChild(info->form);
    return info->frame;
}
Esempio n. 24
0
/*+++++++++++++++++++++++++++++++++++++++*/
static Widget 
BuildI18nDlg(
      Widget shell )
{
    register int     i, n;
    Arg              args[MAX_ARGS];
    XmString         button_string[NUM_LABELS]; 
    XmString         string; 
    Widget           form;
    Widget           inputMethodForm;
    Widget           imStartModeForm;
    Widget           preeditTypeForm;
    int              count = 0;
    Widget           widgetList1[6];

    /* get i18n resource values  */

    /* Set up DialogBoxDialog button labels */
    button_string[0] = CMPSTR((String) _DtOkString);
    button_string[1] = CMPSTR((String) _DtCancelString);
    button_string[2] = CMPSTR((String) _DtHelpString);

    /* Create toplevel DialogBox */

    /* Initialize the i18n structure */
    i18n.pictLabel = NULL;
    i18n.systemDefault = NULL;
    i18n.inputMethodTB = NULL;
    i18n.serverHostLabel = NULL;
    i18n.serverHostCB = NULL;
    i18n.inputMethodLabel = NULL;
    i18n.inputMethodRC = NULL;
    i18n.imStartModeTB = NULL;
    i18n.imStartModeRC = NULL;
    i18n.askAtLoginTG = NULL;
    i18n.resumeCurrentImTG = NULL;
    i18n.preeditTypeTB = NULL;
    i18n.preeditTypeList = NULL;
    i18n.buttonMoveUp = NULL;
    i18n.buttonMoveDown = NULL;
    i18n.warnDialog = NULL;

    /* saveRestore
     * Note that save.poscnt has been initialized elsewhere.  
     * save.posArgs may contain information from restoreBeep().*/

    XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);  
    save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
    save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
    save.poscnt++;
    style.i18nDialog = 
        __DtCreateDialogBoxDialog(shell, "i18nDialog", save.posArgs, 
				  save.poscnt);
    XtAddCallback(style.i18nDialog, XmNhelpCallback,
            (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_I18N_DIALOG);

    XmStringFree(button_string[0]);
    XmStringFree(button_string[1]);
    XmStringFree(button_string[2]);

    widgetList1[0] = _DtDialogBoxGetButton(style.i18nDialog,2);
    n=0;
    XtSetArg(args[n], XmNautoUnmanage, False); n++;
    XtSetArg(args[n], XmNcancelButton, widgetList1[0]); n++;
    XtSetValues (style.i18nDialog, args, n);

    n=0;
    XtSetArg(args[n], XmNtitle, 
	 ((char *)GETMESSAGE(19, 1, "Style Manager - Internationalization")));
    n++;
    XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
    XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
    XtSetValues (XtParent(style.i18nDialog), args, n);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    form = XmCreateForm(style.i18nDialog, "i18nForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
    XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
    XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
    XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
    XtSetArg(args[n], XmNstring, NULL); n++;  
    XtSetArg(args[n], XmNshadowThickness, 0); n++;  
    XtSetArg(args[n], XmNimageName, I18N_ICON); n++;  
    XtSetArg(args[n], XmNtraversalOn, False); n++;  
    widgetList1[count++] = i18n.pictLabel =
	_DtCreateIcon(form, "i18npictLabel", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT);  n++;
    XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH);  n++;
    string = CMPSTR(((char *)GETMESSAGE(19, 2, "Default")));
    XtSetArg(args[n], XmNlabelString, string); n++;
    widgetList1[count++] = i18n.systemDefault = 
        XmCreatePushButtonGadget(form, "systemDefault", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 3, "Input Method"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = i18n.inputMethodTB =
        _DtCreateTitleBox(form, "inputMethodTB", args, n);
    XmStringFree(string);
    
    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    inputMethodForm = 
        XmCreateForm(i18n.inputMethodTB, "inputMethodForm", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 4, "Input Method Start Mode"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = i18n.imStartModeTB =
        _DtCreateTitleBox(form, "imStartModeTB", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    imStartModeForm = 
        XmCreateForm(i18n.imStartModeTB, "imStartModeForm", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 5, "Preedit Type"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = i18n.preeditTypeTB =
        _DtCreateTitleBox(form, "preeditTypeTB", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    preeditTypeForm = 
        XmCreateForm(i18n.preeditTypeTB, "preeditTypeForm", args, n);

    /* Create widgets inside the inputMethodForm */
    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 6, "Server Host :"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    i18n.serverHostLabel = 
	XmCreateLabelGadget(inputMethodForm, "serverHostLabel", args, n);

    n = 0;
    XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); n++;
    i18n.serverHostCB =
  	(Widget) (intptr_t) XmCreateComboBox(inputMethodForm, "serverHostCB", args, n);

    XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
		  XmNactivateCallback, ServerHostCB, NULL);
    XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
		  XmNfocusCallback, TextFocusCB, NULL);
    XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
		  XmNlosingFocusCallback, TextLosingFocusCB, NULL);
    

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 7, "Input Method"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    i18n.inputMethodLabel = 
	XmCreateLabelGadget(inputMethodForm, "inputMethodLabel", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
    XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
    i18n.inputMethodRC = 
        XmCreateRadioBox(inputMethodForm, "inputMethodRC", args, n);


    /* Create widgets inside the imStartModeForm */
    n = 0;
    XtSetArg(args[n], XmNmarginWidth, 0); n++;
    XtSetArg(args[n], XmNmarginHeight, 0); n++;
    i18n.imStartModeRC = 
        XmCreateRadioBox(imStartModeForm, "imStartModeRC", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 8, "Ask at login"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    i18n.askAtLoginTG = 
	XmCreateToggleButtonGadget(i18n.imStartModeRC, "askAtLoginTG", 
				   args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 9, "Resume Current Input Method"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    i18n.resumeCurrentImTG = 
        XmCreateToggleButtonGadget(i18n.imStartModeRC, "resumeCurrentImTG", 
				   args, n);
    XmStringFree(string);

    /* Create widgets inside the preeditTypeForm */

    n = 0;
    XtSetArg(args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
    i18n.preeditTypeList =
	(Widget) (intptr_t) XmCreateList(preeditTypeForm, "preeditTypeList", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 10, "Move Up"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    XtSetArg(args[n], XmNsensitive, False); n++;
    i18n.buttonMoveUp =
	XmCreatePushButtonGadget(preeditTypeForm, "buttonMoveUp", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(19, 11, "Move Down"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    XtSetArg(args[n], XmNsensitive, False); n++;
    i18n.buttonMoveDown =
	XmCreatePushButtonGadget(preeditTypeForm, "buttonMoveDown", args, n);
    XmStringFree(string);

    XtAddCallback(style.i18nDialog, XmNmapCallback, FormLayoutCB, NULL);
    XtAddCallback(style.i18nDialog, XmNmapCallback, MapCB, shell);
    XtAddCallback(style.i18nDialog, XmNcallback, ButtonCB, NULL);
    XtAddCallback(i18n.systemDefault, XmNactivateCallback, 
		  SystemDefaultCB, NULL);
    XtAddCallback(i18n.preeditTypeList, XmNbrowseSelectionCallback, 
		  ListItemSelectCB, NULL);
    XtAddCallback(i18n.buttonMoveUp, XmNactivateCallback, 
		  MoveUpCB, NULL);
    XtAddCallback(i18n.buttonMoveDown, XmNactivateCallback, 
		  MoveDownCB, NULL);

    XtManageChild(form);
    XtManageChildren(widgetList1,count); 

    XtManageChild(inputMethodForm);
    XtManageChild(imStartModeForm);
    XtManageChild(preeditTypeForm);

    XtManageChild(i18n.serverHostLabel);
    XtManageChild(i18n.serverHostCB);
    XtManageChild(i18n.inputMethodLabel);
    XtManageChild(i18n.inputMethodRC);

    XtManageChild(i18n.imStartModeRC);
    XtManageChild(i18n.askAtLoginTG);
    XtManageChild(i18n.resumeCurrentImTG);

    XtManageChild(i18n.preeditTypeList);
    XtManageChild(i18n.buttonMoveUp);
    XtManageChild(i18n.buttonMoveDown);

    return(style.i18nDialog);
}
Esempio n. 25
0
int 
main (int argc, char **argv)
{
  Widget             workRegion, simpleWidget, simpleGadget;
  register int       n;
  Arg                args[MAX_ARGS];
  Position           x, y;
  Dimension          width, height, border_width;

  CommonTestInit(argc, argv);

  n = 0;
  XtSetArg(args[n], XmNwidth,  200);  n++;
  XtSetArg(args[n], XmNheight, 200);  n++;
  XtSetValues(Shell1, args, n);

  XtRealizeWidget(Shell1);

  /* set up a manager */
  n = 0;
  XtSetArg(args[n],XmNnoResize, True);  n++;
  XtSetArg(args[n],XmNresizePolicy, XmRESIZE_NONE);  n++;
  XtSetArg(args[n],XmNwidth, 200);  n++;
  XtSetArg(args[n],XmNheight, 200);  n++;
  workRegion = XmCreateBulletinBoard(Shell1,"WorkRegion", args, n);

  XtManageChild(workRegion);

  /* Instantiate a PushButton widget. */
  n = 0;
  XtSetArg(args[n],XmNrecomputeSize, False);  n++;
  XtSetArg(args[n],XmNshadowThickness, 5);  n++;
  XtSetArg(args[n],XmNmarginWidth, 5);  n++;
  XtSetArg(args[n],XmNx, 5);  n++;
  XtSetArg(args[n],XmNy, 5);  n++;
  XtSetArg(args[n],XmNborderWidth, 5);  n++;
  XtSetArg(args[n],XmNwidth, 90);  n++;
  XtSetArg(args[n],XmNheight, 50);  n++;
  simpleWidget = XmCreatePushButton(workRegion,"Widget", args, n);
  XtManageChild(simpleWidget);
  CommonPause();

  /* move the child widget */
  XmeConfigureObject(simpleWidget, 30, 30, 90, 50, 5);
  XtVaGetValues(simpleWidget,
		XmNx, &x,
		XmNy, &y,
		NULL);
  if (x != 30 || y !=30)
    printf("ERROR: incorrect position values\n");
  CommonPause();

  /* change the child widget's border */
  XmeConfigureObject(simpleWidget, 30, 30, 90, 50, 25);
  XtVaGetValues(simpleWidget,
		XmNborderWidth, &border_width,
		NULL);
  if (border_width != 25)
    printf("ERROR: incorrect border value\n");
  CommonPause();

  /* change the size of the widget */
  XmeConfigureObject(simpleWidget, 30, 30, 150, 100, 5);
  XtVaGetValues(simpleWidget,
		XmNheight, &height,
		XmNwidth, &width,
		NULL);
  if (width != 150 || height != 100)
    printf("ERROR: incorrect size values\n");
  CommonPause();

  /* Instantiate a PushButton gadget. */
  XtDestroyWidget(simpleWidget);
  n = 0;
  XtSetArg(args[n],XmNrecomputeSize, False);  n++;
  XtSetArg(args[n],XmNshadowThickness, 5);  n++;
  XtSetArg(args[n],XmNmarginWidth, 5);  n++;
  XtSetArg(args[n],XmNx, 5);  n++;
  XtSetArg(args[n],XmNy, 5);  n++;
  XtSetArg(args[n],XmNborderWidth, 5);  n++;
  XtSetArg(args[n],XmNwidth, 90);  n++;
  XtSetArg(args[n],XmNheight, 50);  n++;
  simpleGadget = XmCreatePushButtonGadget(workRegion,"Gadget", args, n);
  XtManageChild(simpleGadget);
  CommonPause();

  /* move the child gadget */
  XmeConfigureObject(simpleGadget, 80, 30, 90, 50, 5);
  XtVaGetValues(simpleGadget,
		XmNx, &x,
		XmNy, &y,
		NULL);
  if (x != 80 || y !=30)
    printf("ERROR: incorrect position values\n");
  CommonPause();

  /* change the child gadget's border */
  XmeConfigureObject(simpleGadget, 30, 30, 90, 50, 25);
  XtVaGetValues(simpleGadget,
		XmNborderWidth, &border_width,
		NULL);
  if (border_width != 25)
    printf("ERROR: incorrect border value: %d\n",border_width);
  CommonPause();

  /* change the size of the gadget */
  XmeConfigureObject(simpleGadget, 30, 30, 150, 100, 5);
  XtVaGetValues(simpleGadget,
		XmNheight, &height,
		XmNwidth, &width,
		NULL);
  if (width != 150 || height != 100)
    printf("ERROR: incorrect size values\n");
  CommonPause();

  CommonPause(); /* quit */
  XtAppMainLoop(app_context);
  XtDestroyWidget(Shell1);
}
Esempio n. 26
0
void 
MakeButtons( void )
{
    register int i;

    Dimension	width;

    Dimension	max_width;	/* maximum width  of a set of widgets	   */
    Dimension	max_height;	/* maximum height of a set of widgets	   */

    int		origin;		/* horizontal origin for button placement  */
    int		spacing;	/* spacing between buttons (width/32)      */

     
    /* 
     * create the buttons...
     */

    /* ok button */
    
    i = InitArg(PushBG);
    XtSetArg(argt[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
    XtSetArg(argt[i], XmNbottomPosition, 95); i++;
    XtSetArg(argt[i], XmNtraversalOn, True); i++;
    XtSetArg(argt[i], XmNleftAttachment,   XmATTACH_FORM);	i++;

    xmstr = ReadCatalogXms(MC_LABEL_SET, MC_OK_LABEL, MC_DEF_OK_LABEL );
    XtSetArg(argt[i], XmNlabelString,			xmstr		); i++;

    ok_button = XmCreatePushButtonGadget(matte1, "ok_button", argt, i);

    XmStringFree(xmstr);
    XtManageChild(ok_button);

    XtAddCallback(ok_button, XmNactivateCallback, DoAccept, NULL);    


    /* clear button */

    i -= 2;
    XtSetArg(argt[i], XmNleftAttachment,	XmATTACH_WIDGET);	i++;
    XtSetArg(argt[i], XmNleftWidget,		ok_button);		i++;
    xmstr = ReadCatalogXms(MC_CHOOSER_SET, MC_UPDATE_LABEL, MC_DEF_UPDATE_LABEL);
    XtSetArg(argt[i], XmNlabelString,		xmstr); 		i++;

    clear_button = XmCreatePushButtonGadget(matte1, "clear_button", argt, i);

    XmStringFree(xmstr);
    XtManageChild(clear_button);
    XtAddCallback(clear_button, XmNactivateCallback, DoPing,
                  (XtPointer) 0);   



    /* help button */
    
    i -= 3;
    xmstr = ReadCatalogXms(MC_LABEL_SET, MC_HELP_LABEL, MC_DEF_HELP_LABEL);
    XtSetArg(argt[i], XmNlabelString,			xmstr		); i++;

    help_button = XmCreatePushButtonGadget(matte1, "help_button", argt, i);
    XtAddCallback(help_button, XmNactivateCallback, ShowDialogCB, 
    		  (XtPointer) help_chooser);
    XmStringFree(xmstr);
    XtManageChild(help_button);


    i = InitArg(Label);
    XtSetArg(argt[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
    XtSetArg(argt[i], XmNbottomPosition, 95); i++;
    XtSetArg(argt[i], XmNleftAttachment,	XmATTACH_WIDGET);	i++;
    XtSetArg(argt[i], XmNleftWidget,		clear_button);		i++;
    xmstr = ReadCatalogXms(MC_LABEL_SET, MC_OPTIONS_LABEL, MC_DEF_OPTIONS_LABEL );
    XtSetArg(argt[i], XmNlabelString,			xmstr		); i++;

    options_button = DtCreateMenuButton(matte1, "options_button", argt, i);

    XmStringFree(xmstr);
    XtManageChild(options_button);

    /** set attachment for help button **/
    i = 0;
    XtSetArg(argt[i], XmNleftAttachment,	XmATTACH_WIDGET);	i++;
    XtSetArg(argt[i], XmNleftWidget,		options_button);	i++;
    XtSetArg(argt[i], XmNrightAttachment,	XmATTACH_FORM);		i++;
    XtSetValues(help_button, argt, i);


    /*
     *  tell form that ok_button is the default button...
     */

    i = 0;
    XtSetArg(argt[i], XmNdefaultButton,		ok_button		); i++;
    XtSetValues(matte1,  argt, i);

    

    /*
     * make all buttons the same size...
     */
     

    max_width = max_height = 0;
    GetBiggest(ok_button, &max_width, &max_height);
    GetBiggest(clear_button,   &max_width, &max_height);
    GetBiggest(options_button, &max_width, &max_height);
    GetBiggest(help_button,    &max_width, &max_height);

    if ( max_width < MIN_BUTTON_SIZE) max_width = MIN_BUTTON_SIZE;
    
    i = 0;
    XtSetArg(argt[i], XmNwidth,			max_width		); i++;
    XtSetArg(argt[i], XmNheight,		max_height		); i++;
    XtSetArg(argt[i], XmNrecomputeSize,		False			); i++;

    XtSetValues(ok_button,      argt, i);
    XtSetValues(clear_button,   argt, i);
    XtSetValues(options_button, argt, i);
    XtSetValues(help_button,    argt, i);
}
Esempio n. 27
0
/*
** Create a dialog for the output of a shell command.  The dialog lives until
** the user presses the Dismiss button, and is then destroyed
*/
static void createOutputDialog(Widget parent, char *text)
{
    Arg al[50];
    int ac, rows, cols, hasScrollBar, wrapped;
    Widget form, textW, button;
    XmString st1;

    /* measure the width and height of the text to determine size for dialog */
    measureText(text, MAX_OUT_DIALOG_COLS, &rows, &cols, &wrapped);
    if (rows > MAX_OUT_DIALOG_ROWS) {
    	rows = MAX_OUT_DIALOG_ROWS;
    	hasScrollBar = True;
    } else
    	hasScrollBar = False;
    if (cols > MAX_OUT_DIALOG_COLS)
    	cols = MAX_OUT_DIALOG_COLS;
    if (cols == 0)
    	cols = 1;
    /* Without completely emulating Motif's wrapping algorithm, we can't
       be sure that we haven't underestimated the number of lines in case
       a line has wrapped, so let's assume that some lines could be obscured
       */
    if (wrapped)
	hasScrollBar = True;
    ac = 0;
    form = CreateFormDialog(parent, "shellOutForm", al, ac);

    ac = 0;
    XtSetArg(al[ac], XmNlabelString, st1=MKSTRING("OK")); ac++;
    XtSetArg(al[ac], XmNmarginWidth, BUTTON_WIDTH_MARGIN); ac++;
    XtSetArg(al[ac], XmNhighlightThickness, 0);  ac++;
    XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE);  ac++;
    button = XmCreatePushButtonGadget(form, "ok", al, ac);
    XtManageChild(button);
    XtVaSetValues(form, XmNdefaultButton, button, NULL);
    XtVaSetValues(form, XmNcancelButton, button, NULL);
    XmStringFree(st1);
    XtAddCallback(button, XmNactivateCallback, destroyOutDialogCB,
    	    XtParent(form));
    
    ac = 0;
    XtSetArg(al[ac], XmNrows, rows);  ac++;
    XtSetArg(al[ac], XmNcolumns, cols);  ac++;
    XtSetArg(al[ac], XmNresizeHeight, False);  ac++;
    XtSetArg(al[ac], XmNtraversalOn, False); ac++;
    XtSetArg(al[ac], XmNwordWrap, True);  ac++;
    XtSetArg(al[ac], XmNscrollHorizontal, False);  ac++;
    XtSetArg(al[ac], XmNscrollVertical, hasScrollBar);  ac++;
    XtSetArg(al[ac], XmNhighlightThickness, 0);  ac++;
    XtSetArg(al[ac], XmNspacing, 0);  ac++;
    XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT);  ac++;
    XtSetArg(al[ac], XmNeditable, False);  ac++;
    XtSetArg(al[ac], XmNvalue, text);  ac++;
    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET);  ac++;
    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);  ac++;
    XtSetArg(al[ac], XmNbottomWidget, button);  ac++;
    textW = XmCreateScrolledText(form, "outText", al, ac);
    AddMouseWheelSupport(textW);
    XtManageChild(textW);
    
    XtVaSetValues(XtParent(form), XmNtitle, "Output from Command", NULL);
    ManageDialogCenteredOnPointer(form);
}
Esempio n. 28
0
EIF_POINTER font_box_create (char * a_name, EIF_POINTER a_parent, EIF_BOOLEAN dialog)
{
	Widget form, select_form, mode_option;
	Widget mode_menu, stand_fonts_button, non_stand_fonts_button;
	Widget non_stand_list;
	Widget stand_column, frame;
	Widget form_button;
	Widget ok_button, apply_button, cancel_button;
	Widget family_menu_b, weight_menu_b, slant_menu_b;
	Widget width_menu_b, point_menu_b, resolution_menu_b;
	Widget family_menu, weight_menu, slant_menu;
	Widget width_menu, point_menu, resolution_menu;
	Widget text;
	Widget *family_menu_buttons;
	Widget *weight_menu_buttons;
	Widget *slant_menu_buttons;
	Widget *width_menu_buttons;
	Widget *point_menu_buttons;
	Widget *resolution_menu_buttons;
	font_box_data * client;
	XmString string;
	Display * display;
	int number_fonts;
	char ** fonts_list;
	char ** non_stand_fonts_list;
	int number_non_stand, number_stand;
	XmString * non_stand_strings;
	font_box_font_info ** stand_fonts_list;
	int i, j;
	char * tmp_string;
	XmString tmp_xm_string;
	char **family_menu_list;
	char **weight_menu_list;
	char **slant_menu_list;
	char **width_menu_list;
	char **point_menu_list;
	char **resolution_menu_list;
	int number_family, number_weight, number_slant;
	int number_width, number_point, number_resolution;

/*
 * Creation of form dialog
 */
	if (dialog) {
		form = XmCreateFormDialog ((Widget) a_parent, (String) a_name, NULL, 0);
		XtVaSetValues (form, XmNautoUnmanage, False, NULL);
	}
	else form = XmCreateForm ((Widget) a_parent, (String) a_name, NULL, 0);

/*
 * Creation of sub-widgets
 */
	select_form = XmCreateForm (form, "selectForm", NULL, 0);
	XtManageChild (select_form);
	text = XmCreateText (form, "text", NULL, 0);
	XtManageChild (text);
	form_button = XmCreateForm (form, "buttonsForm", NULL, 0);
	XtManageChild (form_button);
	mode_option = XmCreateOptionMenu (select_form, "switchOption", NULL, 0);
	XtManageChild (mode_option);
	mode_menu = XmCreatePulldownMenu (select_form, "switchMenu", NULL, 0);
	stand_fonts_button = XmCreatePushButtonGadget (mode_menu, "standFont", NULL, 0);
	XtManageChild (stand_fonts_button);
	non_stand_fonts_button = XmCreatePushButtonGadget (mode_menu, "nonStandFont", NULL, 0);
	XtManageChild (non_stand_fonts_button);

/*
 * Creation of non-standard font selection system
 */
	non_stand_list = XmCreateScrolledList (select_form, "nonStandList", NULL, 0);
	XtManageChild (non_stand_list);

/*
 * Creation of standard font selection system
 */
	frame = XmCreateFrame (select_form, "standFrame", NULL, 0);
	XtManageChild (frame);
	stand_column = XmCreateRowColumn (frame, "standColumn", NULL, 0);
	XtManageChild (stand_column);
	family_menu_b = XmCreateOptionMenu (stand_column, "familyMenuButton", NULL, 0);
	XtManageChild (family_menu_b);
	weight_menu_b = XmCreateOptionMenu (stand_column, "weightMenuButton", NULL, 0);
	XtManageChild (weight_menu_b);
	slant_menu_b = XmCreateOptionMenu (stand_column, "slantMenuButton", NULL, 0);
	XtManageChild (slant_menu_b);
	width_menu_b = XmCreateOptionMenu (stand_column, "widthMenuButton", NULL, 0);
	XtManageChild (width_menu_b);
	point_menu_b = XmCreateOptionMenu (stand_column, "pointMenuButton", NULL, 0);
	XtManageChild (point_menu_b);
	resolution_menu_b = XmCreateOptionMenu (stand_column, "resolutionMenuButton", NULL, 0);
	XtManageChild (resolution_menu_b);
	family_menu = XmCreatePulldownMenu (stand_column, "familyMenu", NULL, 0);
	weight_menu = XmCreatePulldownMenu (stand_column, "weightMenu", NULL, 0);
	slant_menu = XmCreatePulldownMenu (stand_column, "slantMenu", NULL, 0);
	width_menu = XmCreatePulldownMenu (stand_column, "widthMenu", NULL, 0);
	point_menu = XmCreatePulldownMenu (stand_column, "pointMenu", NULL, 0);
	resolution_menu = XmCreatePulldownMenu (stand_column, "resolutionMenu", NULL, 0);

/*
 * Creation of buttons
 */
	ok_button = XmCreatePushButtonGadget (form_button, "Ok", NULL, 0);
	XtManageChild (ok_button);
	apply_button = XmCreatePushButtonGadget (form_button, "Apply", NULL, 0);
	XtManageChild (apply_button);
	cancel_button = XmCreatePushButtonGadget (form_button, "Cancel", NULL, 0);
	XtManageChild (cancel_button);

/*
 * Attachments in font selection system
 */
	AttachTop (mode_option, 0);
	AttachLeft (mode_option, 0);
	AttachRight (mode_option, 0);

/*
 * Attachments in non-standard font selection system
 */
	AttachTopWidget (mode_option, XtParent (non_stand_list), 5);
	AttachLeft (XtParent (non_stand_list), 0);
	AttachRight (XtParent (non_stand_list), 0);
	AttachBottom (XtParent (non_stand_list), 0);

/*
 * Attachments in standard font selection system
 */
	AttachTopWidget (mode_option, frame, 5);
	AttachLeft (frame, 0);
	AttachRight (frame, 0);
	AttachBottom (frame, 0);

/*
 * Attachments in buttons form
 */
	XtVaSetValues (form_button, XmNfractionBase, 6, NULL);
	AttachTop (ok_button, 0);
	AttachBottom (ok_button, 0);
	AttachTop (apply_button, 0);
	AttachBottom (apply_button, 0);
	AttachTop (cancel_button, 0);
	AttachBottom (cancel_button, 0);

/*
 * Attachments in global form
 */
	AttachTop (select_form, 10);
	AttachLeft (select_form, 10);
	AttachRight (select_form, 10);
	AttachTopWidget (select_form, text, 10);
	AttachLeft (text, 10);
	AttachRight (text, 10);
	AttachBottomWidget (form_button, text, 10);
	AttachLeft (form_button, 10);
	AttachRight (form_button, 10);
	AttachBottom (form_button, 10);

/*
 * Default values
 */
	XtVaSetValues (family_menu_b, XmNsubMenuId, family_menu, NULL);
	XtVaSetValues (weight_menu_b, XmNsubMenuId, weight_menu, NULL);
	XtVaSetValues (slant_menu_b, XmNsubMenuId, slant_menu, NULL);
	XtVaSetValues (width_menu_b, XmNsubMenuId, width_menu, NULL);
	XtVaSetValues (point_menu_b, XmNsubMenuId, point_menu, NULL);
	XtVaSetValues (resolution_menu_b, XmNsubMenuId, resolution_menu, NULL);
	XmTextSetString (text, "Current_selected_font");
	XtVaSetValues (text, XmNresizeHeight, True, XmNeditMode, XmMULTI_LINE_EDIT, NULL);
	XtVaSetValues (XtParent (non_stand_list), XmNmappedWhenManaged, False, NULL);
	string = XmStringCreateLtoR ("Non standard fonts", XmSTRING_DEFAULT_CHARSET);
	XtVaSetValues (non_stand_fonts_button, XmNlabelString, string, NULL);
	XmStringFree (string);
	string = XmStringCreateLtoR ("Standard fonts", XmSTRING_DEFAULT_CHARSET);
	XtVaSetValues (stand_fonts_button, XmNlabelString, string, NULL);
	XmStringFree (string);
	XtVaSetValues (mode_option, XmNsubMenuId, mode_menu, NULL);
	XtVaSetValues (mode_option, XmNmenuHistory, stand_fonts_button, NULL);

/*
 * Callbacks
 */
	client = (font_box_data *) cmalloc (sizeof (font_box_data));
	XtAddCallback (non_stand_list, XmNbrowseSelectionCallback, (XtCallbackProc) font_box_select_non_stand, client);
	XtAddCallback (stand_fonts_button, XmNactivateCallback, (XtCallbackProc) font_box_switch_to_stand, client);
	XtAddCallback (non_stand_fonts_button, XmNactivateCallback, (XtCallbackProc) font_box_switch_to_non_stand, client);
	XtAddCallback (form, XmNdestroyCallback, (XtCallbackProc) font_box_destroy_action, client);

/*
 * Fill the client structure
 */
	client->non_stand_list = non_stand_list;
	client->is_stand_mode = 1;
	client->frame = frame;
	client->text = text;
	client->family_menu_b = family_menu_b;
	client->weight_menu_b = weight_menu_b;
	client->slant_menu_b = slant_menu_b;
	client->width_menu_b = width_menu_b;
	client->point_menu_b = point_menu_b;
	client->resolution_menu_b = resolution_menu_b;
	client->form = form;
	client->ok_button = ok_button;
	client->apply_button = apply_button;
	client->cancel_button = cancel_button;
	client->buttons_shown = 7;
	client->stand_fonts_button = stand_fonts_button;
	client->non_stand_fonts_button = non_stand_fonts_button;
	font_box_attach_buttons (client);

/*
 * Get the font list of current display
 */
	display = XtDisplay (form);
	fonts_list = XListFonts (display, "*", 10000, &number_fonts);

/*
 * Get the non standard fonts
 */
	number_non_stand = 0;
	for (i = 0; i < number_fonts; i++)
		if ('-' != *(fonts_list [i])) number_non_stand++;
	non_stand_strings = (XmString *) cmalloc (number_non_stand*sizeof (XmString));
	non_stand_fonts_list = (char **) cmalloc (number_non_stand*sizeof (char *));
	for (i = j = 0; i < number_fonts; i++)
		if ('-' != *(fonts_list [i])) {
			non_stand_fonts_list [j] = fonts_list [i];
			non_stand_strings [j++] = XmStringCreate (fonts_list [i], XmSTRING_DEFAULT_CHARSET);
		}
	i = 1;
	while (i)
		for (j = i = 0; j < number_non_stand-1; j++)
			if (strcmp (non_stand_fonts_list [j], non_stand_fonts_list [j+1]) > 0) {
				i = 1;
				tmp_string = non_stand_fonts_list [j];
				non_stand_fonts_list [j] = non_stand_fonts_list [j+1];
				non_stand_fonts_list [j+1] = tmp_string;
				tmp_xm_string = non_stand_strings [j];
				non_stand_strings [j] = non_stand_strings [j+1];
				non_stand_strings [j+1] = tmp_xm_string;
			}
	XmListAddItems (non_stand_list, non_stand_strings, number_non_stand, 1);
	XmListSelectPos (non_stand_list, 1, False);

/*
 * Get the standard fonts
 */
	number_stand = number_fonts-number_non_stand;
	stand_fonts_list = (font_box_font_info **) cmalloc (number_stand*sizeof (font_box_font_info *));
	for (i = j = 0; i < number_fonts; i++)
		if ('-' == *(fonts_list [i])) {
			stand_fonts_list [j++] = font_box_create_font_info (fonts_list [i]);
		}
	number_family = 0;
	number_weight = 0;
	number_slant = 0;
	number_width = 0;
	number_point = 0;
	number_resolution = 0;
	for (i = 0; i < number_stand; i++) {
		font_box_put_item (&(stand_fonts_list [i]->family), &number_family, &family_menu_list);
		font_box_put_item (&(stand_fonts_list [i]->weight), &number_weight, &weight_menu_list);
		font_box_put_item (&(stand_fonts_list [i]->slant), &number_slant, &slant_menu_list);
		font_box_put_item (&(stand_fonts_list [i]->width), &number_width, &width_menu_list);
		font_box_put_item (&(stand_fonts_list [i]->point), &number_point, &point_menu_list);
		font_box_put_item (&(stand_fonts_list [i]->resolution), &number_resolution, &resolution_menu_list);
	}
	font_box_sort_alpha (&number_family, &family_menu_list);
	font_box_sort_alpha (&number_weight, &weight_menu_list);
	font_box_sort_alpha (&number_slant, &slant_menu_list);
	font_box_sort_alpha (&number_width, &width_menu_list);
	font_box_sort_num (&number_point, &point_menu_list);
	font_box_sort_alpha (&number_resolution, &resolution_menu_list);
	font_box_fill_menu (&family_menu_buttons, family_menu, &number_family, &family_menu_list);
	font_box_fill_menu (&weight_menu_buttons, weight_menu, &number_weight, &weight_menu_list);
	font_box_fill_menu (&slant_menu_buttons, slant_menu, &number_slant, &slant_menu_list);
	font_box_fill_menu (&width_menu_buttons, width_menu, &number_width, &width_menu_list);
	font_box_fill_menu (&point_menu_buttons, point_menu, &number_point, &point_menu_list);
	font_box_fill_menu (&resolution_menu_buttons, resolution_menu, &number_resolution, &resolution_menu_list);
	for (i = 0; i < number_family; i++)
		XtAddCallback (family_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_family, client);
	for (i = 0; i < number_weight; i++)
		XtAddCallback (weight_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_weight, client);
	for (i = 0; i < number_slant; i++)
		XtAddCallback (slant_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_slant, client);
	for (i = 0; i < number_width; i++)
		XtAddCallback (width_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_width, client);
	for (i = 0; i < number_point; i++)
		XtAddCallback (point_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_point, client);
	for (i = 0; i < number_resolution; i++)
		XtAddCallback (resolution_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_resolution, client);

/*
 * Fill the client structure
 */
	client->non_stand_fonts_list = non_stand_fonts_list;
	client->stand_fonts_list = stand_fonts_list;
	client->current_font_name = non_stand_fonts_list [0];
	client->current_stand_font = 0;
	client->current_non_stand_font = 0;
	client->family_menu_buttons = family_menu_buttons;
	client->weight_menu_buttons = weight_menu_buttons;
	client->slant_menu_buttons = slant_menu_buttons;
	client->width_menu_buttons = width_menu_buttons;
	client->point_menu_buttons = point_menu_buttons;
	client->resolution_menu_buttons = resolution_menu_buttons;
	client->family_menu_list = family_menu_list;
	client->weight_menu_list = weight_menu_list;
	client->slant_menu_list = slant_menu_list;
	client->width_menu_list = width_menu_list;
	client->point_menu_list = point_menu_list;
	client->resolution_menu_list = resolution_menu_list;
	client->number_stand = number_stand;
	client->number_family = number_family;
	client->number_weight = number_weight;
	client->number_slant = number_slant;
	client->number_width = number_width;
	client->number_point = number_point;
	client->number_resolution = number_resolution;
	client->current_font = NULL;
	client->current_family = client->current_weight = client->current_slant = -1;
	client->current_width = client->current_point = client->current_resolution = -1;
	font_box_set_family (family_menu_buttons [0], client, NULL);

	return (EIF_POINTER) client;
}
Esempio n. 29
0
void NxmPushBtnMenu_create ( Widget pushb, long interval, char *items[],
                             int nitems, XtCallbackProc callback )
/************************************************************************
 * NxmPushBtnMenu_create                                                *
 *                                                                      *
 * This function creates a popup menu attached to a push button.        *
 *                                                                      *
 * NxmPushBtnMenu_create(pushb, interval, items, nitems, callback)      *
 *                                                                      *
 * Input parameters:                                                    *
 *  pushb               Widget       the push button id                 *
 *  interval		long	     elapsed time to pop up menu	*
 *  *items[]            char         menu items name 		        *
 *  nitems              int          number of items in the menu        *
 *  *callback()         void         callback function for the menu     *
 *                                                                      *
 * Output parameters:                                                   *
 *          NONE                                                        *
 *                                                                      *
 * Return parameters:                                                   *
 *          NONE                                                        *
 *                                                                      *
 **                                                                     *
 * Log:                                                                 *
 * R. Tian/SAIC		10/02						*
 ***********************************************************************/
{
    long	ii;
    Widget	menu_pane, menu_item;
    Widget	parent;
/*---------------------------------------------------------------------*/
/*
 * make sure at least 0.5 second interval.
 */
    if(interval > _interval) {
	_interval = interval;
    }

/*
 * the menu and push button will have the same parent.
 */
    parent = XtParent(pushb);

/*
 * create the pop up menu.
 */
    menu_pane = XmCreatePopupMenu(parent, "a_menu_pane", NULL, 0);

    for(ii = 0; ii < nitems; ++ii) {
	menu_item = XmCreatePushButtonGadget(menu_pane, items[ii], NULL, 0);
        XtManageChild(menu_item);
	XtAddCallback(menu_item, XmNactivateCallback,
                      (XtCallbackProc)callback,(XtPointer)ii);
    }

/*
 * attach the menu to the push button.
 */
    XtAddCallback(pushb, XmNarmCallback, 
                  (XtCallbackProc)NxmPushBtnMenu_poseCb, menu_pane);
    XtAddCallback(pushb, XmNdisarmCallback,
                  (XtCallbackProc)NxmPushBtnMenu_unPoseCb, menu_pane);
    XtAddEventHandler(pushb, LeaveWindowMask, FALSE,
                      (XtEventHandler)NxmPushBtnMenu_unPoseCb, menu_pane);
}
Esempio n. 30
0
void buttonHistory(Widget w, XtPointer client, XtPointer call) {
	int i;
	unsigned long k;

	Arg newArgs[CONFIG_ARG_COUNT];

	extern struct mainInfo *pMainMainInfo;

	historyClose(w, client, call);

	if(pMainMainInfo->hstPixmap == 0) {
		if((pMainMainInfo->hstPixmap = XCreatePixmap(pMainMainInfo->appDisplay, RootWindowOfScreen(pMainMainInfo->appScreen), NUM_HISTORY_WIDTH, NUM_HISTORY_HEIGHT, DefaultDepthOfScreen(pMainMainInfo->appScreen))) == 0) {
			warningMessage(ERROR_SLIGHT, "Error occurred while trying to allocate memory for pixmap", pMainMainInfo);

			return;
		}
	}

	// Create panel

	i = 0;

	XtSetArg(newArgs[i], XmNtitle, WINDOW_TITLE_HISTORY); i++;
	XtSetArg(newArgs[i], XmNdeleteResponse, XmDESTROY); i++;

	pMainMainInfo->hstDialog = XmCreateDialogShell(pMainMainInfo->dlgHistory, TITLE_HISTORY_TITLE, newArgs, i);

	i = 0;

	XtSetArg(newArgs[i], XmNorientation, XmVERTICAL); i++;
	XtSetArg(newArgs[i], XmNpacking, XmPACK_TIGHT); i++;
	XtSetArg(newArgs[i], XmNscrollingPolicy, XmAUTOMATIC); i++;

	pMainMainInfo->hstPanel = XmCreateRowColumn(pMainMainInfo->hstDialog, "history_panel", newArgs, i);

	i = 0;

	XtSetArg(newArgs[i], XmNorientation, XmHORIZONTAL); i++;
	XtSetArg(newArgs[i], XmNpacking, XmPACK_TIGHT); i++;
	XtSetArg(newArgs[i], XmNscrollingPolicy, XmAUTOMATIC); i++;

	pMainMainInfo->hstOutput = XmCreateRowColumn(pMainMainInfo->hstPanel, "history_form", newArgs, i);

	// Create drawing area

	i = 0;

	XtSetArg(newArgs[i], XmNwidth, NUM_HISTORY_WIDTH); i++;
	XtSetArg(newArgs[i], XmNheight, NUM_HISTORY_HEIGHT); i++;

	pMainMainInfo->hstDraw = XmCreateDrawingArea(pMainMainInfo->hstOutput, "history_drawing", newArgs, i);

	XtAddCallback(pMainMainInfo->hstDraw, XmNinputCallback, historyExpose, NULL);
	XtAddCallback(pMainMainInfo->hstDraw, XmNexposeCallback, historyExpose, NULL);

	XtVaSetValues(pMainMainInfo->hstDraw, XmNuserData, pMainMainInfo->appGC, NULL);
	XtManageChild(pMainMainInfo->hstDraw);

	// Create control area

	i = 0;

	XtSetArg(newArgs[i], XmNorientation, XmVERTICAL); i++;
	XtSetArg(newArgs[i], XmNpacking, XmPACK_TIGHT); i++;
	XtSetArg(newArgs[i], XmNrowColumnType, XmWORK_AREA); i++;
	XtSetArg(newArgs[i], XmNscrollingPolicy, XmNONE); i++;

	pMainMainInfo->hstCtrl = XtCreateManagedWidget("history_controls", xmRowColumnWidgetClass, pMainMainInfo->hstOutput, newArgs, i);

	// Create control area menus

	netFetchDays(pMainMainInfo);

	pMainMainInfo->hstMenuDate = XmCreatePulldownMenu(pMainMainInfo->hstCtrl, "date", NULL, 0);

	i = 0;

	XtSetArg(newArgs[i], XmNsubMenuId, pMainMainInfo->hstMenuDate); i++;

	pMainMainInfo->hstOptionDate = XmCreateOptionMenu(pMainMainInfo->hstCtrl, "option", newArgs, i);

	XtManageChild(pMainMainInfo->hstOptionDate);

	for(k = 0; ; k++) {
		if(pMainMainInfo->hstArrays[k].label[0] == 0) {
			break;
		}

		pMainMainInfo->hstButtonDate = XtCreateManagedWidget(pMainMainInfo->hstArrays[k].label, xmPushButtonWidgetClass, pMainMainInfo->hstMenuDate, NULL, 0);

		XtAddCallback(pMainMainInfo->hstButtonDate, XmNactivateCallback, historyMenuDate, (XtPointer) k);
	}

	if(k == 0) {
		pMainMainInfo->hstButtonDate = XtCreateManagedWidget(TITLE_HISTORY_MENU_EMPTY, xmPushButtonWidgetClass, pMainMainInfo->hstMenuDate, NULL, 0);
	}

	pMainMainInfo->hstDaysFetch = 0;

	// Create separator

	pMainMainInfo->hstButton = XmCreateSeparatorGadget(pMainMainInfo->hstCtrl, "history_separator", NULL, 0);

	XtManageChild(pMainMainInfo->hstButton);

	// Create control area buttons

	i = 0;

	XtSetArg(newArgs[i], XmNshowAsDefault, True); i++;

	pMainMainInfo->hstButton = XmCreatePushButtonGadget(pMainMainInfo->hstCtrl, TITLE_HISTORY_BUTTON_UPDATE, newArgs, i);

	XtAddCallback(pMainMainInfo->hstButton, XmNactivateCallback, historyUpdate, NULL);
	XtManageChild(pMainMainInfo->hstButton);

	i = 0;

	XtSetArg(newArgs[i], XmNshowAsDefault, True); i++;

	pMainMainInfo->hstButton = XmCreatePushButtonGadget(pMainMainInfo->hstCtrl, TITLE_HISTORY_BUTTON_SAVE, newArgs, i);

	XtAddCallback(pMainMainInfo->hstButton, XmNactivateCallback, historyExport, NULL);
	XtManageChild(pMainMainInfo->hstButton);

	// Create separator

	pMainMainInfo->hstButton = XmCreateSeparatorGadget(pMainMainInfo->hstCtrl, "history_separator", NULL, 0);

	XtManageChild(pMainMainInfo->hstButton);

	i = 0;

	XtSetArg(newArgs[i], XmNshowAsDefault, True); i++;

	pMainMainInfo->hstButton = XmCreatePushButtonGadget(pMainMainInfo->hstCtrl, TITLE_HISTORY_BUTTON_DISMISS, newArgs, i);

	XtAddCallback(pMainMainInfo->hstButton, XmNactivateCallback, historyClose, NULL);
	XtManageChild(pMainMainInfo->hstButton);

	XtManageChild(pMainMainInfo->hstOutput);
	XtManageChild(pMainMainInfo->hstPanel);

	historyMenuDate(w, client, call);
}