Exemplo n.º 1
0
XFE_PrefsProxiesViewDialog::XFE_PrefsProxiesViewDialog(XFE_PrefsDialog *prefsDialog, // prefs dialog
													   Widget     parent,      // dialog parent
													   char      *name,        // dialog name
													   Boolean    modal)       // modal dialog?
	: XFE_Dialog(parent, 
				 name,
				 TRUE,     // ok
				 TRUE,     // cancel
				 FALSE,    // help
				 FALSE,    // apply
				 FALSE,    // separator
				 modal     // modal
				 ),
	  m_prefsDialog(prefsDialog),
	  m_prefsDataProxiesView(0)
{
	PrefsDataProxiesView *fep = NULL;

	fep = new PrefsDataProxiesView;
	memset(fep, 0, sizeof(PrefsDataProxiesView));
	m_prefsDataProxiesView = fep;
	
	Widget     form;
	Widget     kids[100];
	Arg        av[50];
	int        ac;
	int        i;

	form = XtVaCreateWidget("form", xmFormWidgetClass, m_chrome,
							XmNmarginWidth, 8,
							XmNtopAttachment, XmATTACH_FORM,
							XmNleftAttachment, XmATTACH_FORM,
							XmNrightAttachment, XmATTACH_FORM,
							XmNbottomAttachment, XmATTACH_FORM,
							NULL);
	XtManageChild (form);

	Widget     ftp_proxy_label;
	Widget     ftp_proxy_text;
	Widget     ftp_port_label;
	Widget     ftp_port_text;
	Widget     gopher_proxy_label;
	Widget     gopher_proxy_text;
	Widget     gopher_port_label;
	Widget     gopher_port_text;
	Widget     http_proxy_label;
	Widget     http_proxy_text;
	Widget     http_port_label;
	Widget     http_port_text;
	Widget     https_proxy_label;
	Widget     https_proxy_text;
	Widget     https_port_label;
	Widget     https_port_text;
	Widget     wais_proxy_label;
	Widget     wais_proxy_text;
	Widget     wais_port_label;
	Widget     wais_port_text;
	Widget     no_proxy_label;
	Widget     no_proxy_text;
	Widget     socks_host_label;
	Widget     socks_host_text;
	Widget     socks_port_label;
	Widget     socks_port_text;
	Widget     label1;
	Widget     label2;

	ac = 0;
	i = 0;

	kids[i++] = label1 = 
		XmCreateLabelGadget(form, "proxyViewLabel1", av, ac);
	kids[i++] = label2 = 
		XmCreateLabelGadget(form, "proxyViewLabel2", av, ac);

	kids[i++] = ftp_proxy_label = 
		XmCreateLabelGadget(form, "ftpProxyLabel", av, ac);
	kids[i++] = gopher_proxy_label = 
		XmCreateLabelGadget(form, "gopherProxyLabel", av, ac);
	kids[i++] = http_proxy_label = 
		XmCreateLabelGadget(form, "httpProxyLabel", av, ac);
	kids[i++] = https_proxy_label = 
		XmCreateLabelGadget(form, "httpsProxyLabel", av, ac);
	kids[i++] = wais_proxy_label = 
		XmCreateLabelGadget(form, "waisProxyLabel", av, ac);
	kids[i++] = no_proxy_label = 
		XmCreateLabelGadget(form, "noProxyLabel", av, ac);
	kids[i++] = socks_host_label = 
		XmCreateLabelGadget(form, "socksHostLabel", av, ac);

	kids[i++] = ftp_port_label = 
		XmCreateLabelGadget(form, "ftpPortLabel", av, ac);
	kids[i++] = gopher_port_label = 
		XmCreateLabelGadget(form, "gopherPortLabel", av, ac);
	kids[i++] = http_port_label = 
		XmCreateLabelGadget(form, "httpPortLabel", av, ac);
	kids[i++] = https_port_label = 
		XmCreateLabelGadget(form, "httpsPortLabel", av, ac);
	kids[i++] = wais_port_label = 
		XmCreateLabelGadget(form, "waisPortLabel", av, ac);
	kids[i++] = socks_port_label = 
		XmCreateLabelGadget(form, "socksPortLabel", av, ac);

	kids[i++] = ftp_proxy_text = 
		fe_CreateTextField(form, "ftpProxyText", av, ac);
	kids[i++] = gopher_proxy_text = 
		fe_CreateTextField(form, "gopherProxyText", av, ac);
	kids[i++] = http_proxy_text = 
		fe_CreateTextField(form, "httpProxyText", av, ac);
	kids[i++] = https_proxy_text = 
		fe_CreateTextField(form, "httpsProxyText", av, ac);
	kids[i++] = wais_proxy_text = 
		fe_CreateTextField(form, "waisProxyText", av, ac);
	kids[i++] = no_proxy_text = 
		fe_CreateTextField(form, "noProxyText", av, ac);
	kids[i++] = socks_host_text = 
		fe_CreateTextField(form, "socksHostText", av, ac);

	kids[i++] = ftp_port_text = 
		fe_CreateTextField(form, "ftpPortText", av, ac);
	kids[i++] = gopher_port_text = 
		fe_CreateTextField(form, "gopherPortText", av, ac);
	kids[i++] = http_port_text = 
		fe_CreateTextField(form, "httpPortText", av, ac);
	kids[i++] = https_port_text = 
		fe_CreateTextField(form, "httpsPortText", av, ac);
	kids[i++] = wais_port_text = 
		fe_CreateTextField(form, "waisPortText", av, ac);
	kids[i++] = socks_port_text = 
		fe_CreateTextField(form, "socksPortText", av, ac);

	
	int labels_width;
	labels_width = XfeVaGetWidestWidget(ftp_proxy_label,
										gopher_proxy_label,
										http_proxy_label,
										https_proxy_label,
										wais_proxy_label,
										no_proxy_label,
										socks_host_label,
										NULL);
	Dimension margin_width;
	XtVaGetValues(form, 
				  XmNmarginWidth, &margin_width,
				  NULL);
	labels_width+= margin_width;

	int labels_height;
	labels_height = XfeVaGetTallestWidget(ftp_proxy_label,
										  ftp_proxy_text,
										  NULL);

	XtVaSetValues(label1,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNtopAttachment, XmATTACH_FORM,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(ftp_proxy_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(ftp_proxy_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, label1,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(gopher_proxy_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(gopher_proxy_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, ftp_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(http_proxy_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(http_proxy_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, gopher_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(https_proxy_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(https_proxy_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, http_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(wais_proxy_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(wais_proxy_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, https_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(label2,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, wais_proxy_label,
				  XmNtopOffset, 8,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(no_proxy_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(no_proxy_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, label2,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(socks_host_label,
				  XmNheight, labels_height,
				  RIGHT_JUSTIFY_VA_ARGS(socks_host_label,labels_width),
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, no_proxy_label,
				  XmNtopOffset, 8,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(ftp_proxy_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, ftp_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(gopher_proxy_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, gopher_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(http_proxy_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, http_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(https_proxy_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, https_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(wais_proxy_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, wais_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(no_proxy_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, no_proxy_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(socks_host_text,
				  XmNcolumns, 20,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNleftOffset, labels_width,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, socks_host_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(ftp_port_label,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, ftp_proxy_text,
				  XmNleftOffset, 10,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, ftp_proxy_text,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(gopher_port_label,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, gopher_proxy_text,
				  XmNleftOffset, 10,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, gopher_proxy_text,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(http_port_label,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, http_proxy_text,
				  XmNleftOffset, 10,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, http_proxy_text,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(https_port_label,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, https_proxy_text,
				  XmNleftOffset, 10,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, https_proxy_text,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(wais_port_label,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, wais_proxy_text,
				  XmNleftOffset, 10,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, wais_proxy_text,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(socks_port_label,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, socks_host_text,
				  XmNleftOffset, 10,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, socks_host_text,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(ftp_port_text,
				  XmNcolumns, 5,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, ftp_port_label,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, ftp_port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(gopher_port_text,
				  XmNcolumns, 5,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, gopher_port_label,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, gopher_port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(http_port_text,
				  XmNcolumns, 5,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, http_port_label,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, http_port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(https_port_text,
				  XmNcolumns, 5,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, https_port_label,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, https_port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(wais_port_text,
				  XmNcolumns, 5,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, wais_port_label,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, wais_port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(socks_port_text,
				  XmNcolumns, 5,
				  XmNheight, labels_height,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, socks_port_label,
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, socks_port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);

	if (fe_globalData.nonterminal_text_translations) {
		XtOverrideTranslations (ftp_proxy_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (ftp_port_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (gopher_proxy_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (gopher_port_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (http_proxy_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (http_port_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (https_proxy_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (https_port_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (wais_proxy_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (wais_port_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (no_proxy_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (socks_host_text,
								fe_globalData.nonterminal_text_translations);
		XtOverrideTranslations (socks_port_text,
								fe_globalData.nonterminal_text_translations);
    }

	fep->ftp_proxy_text = ftp_proxy_text;
	fep->ftp_port_text = ftp_port_text;
	fep->gopher_proxy_text = gopher_proxy_text;
	fep->gopher_port_text = gopher_port_text;
	fep->http_proxy_text = http_proxy_text;
	fep->http_port_text = http_port_text;
	fep->https_proxy_text = https_proxy_text;
	fep->https_port_text = https_port_text;
	fep->wais_proxy_text = wais_proxy_text;
	fep->wais_port_text = wais_port_text;
	fep->no_proxy_text = no_proxy_text;
	fep->socks_host_text = socks_host_text;
	fep->socks_port_text = socks_port_text;

	// Add callbacks

	XtAddCallback(m_chrome, XmNokCallback, prefsProxiesViewCb_ok, this);
	XtAddCallback(m_chrome, XmNcancelCallback, prefsProxiesViewCb_cancel, this);

	XtManageChildren(kids, i);
}
Exemplo n.º 2
0
XFE_PrefsLdapPropDialog::XFE_PrefsLdapPropDialog(XFE_PrefsDialog *prefsDialog,
        XFE_PrefsPageMailNewsAddrBook *addrBookPage,
        Widget     parent,      // dialog parent
        char      *name,        // dialog name
        Boolean    modal)       // modal dialog?
    : XFE_Dialog(parent,
                 name,
                 TRUE,     // ok
                 TRUE,     // cancel
                 FALSE,    // help
                 FALSE,    // apply
                 FALSE,    // separator
                 modal     // modal
                ),
      m_prefsDialog(prefsDialog),
      m_addrBookPage(addrBookPage),
      m_prefsDataLdapProp(0)
{
    PrefsDataLdapProp *fep = NULL;

    fep = new PrefsDataLdapProp;
    memset(fep, 0, sizeof(PrefsDataLdapProp));
    m_prefsDataLdapProp = fep;

    Widget     kids[100];
    Arg        av[50];
    int        ac;
    int        i;

    Widget     form;
    form = XtVaCreateWidget("form", xmFormWidgetClass, m_chrome,
                            XmNmarginWidth, 8,
                            XmNtopAttachment, XmATTACH_FORM,
                            XmNleftAttachment, XmATTACH_FORM,
                            XmNrightAttachment, XmATTACH_FORM,
                            XmNbottomAttachment, XmATTACH_FORM,
                            NULL);
    XtManageChild (form);

    Widget   desc_label;
    Widget   server_label;
    Widget   root_label;
    Widget   port_number_label;
    Widget   number_of_hit_label;
    Widget   desc_text;
    Widget   server_text;
    Widget   root_text;
    Widget   port_number_text;
    Widget   number_of_hit_text;
    Widget   secure_toggle;
#if 0
    Widget   save_passwd_toggle;
#endif

    ac = 0;
    i = 0;

    kids[i++] = desc_label =
                    XmCreateLabelGadget(form, "descLabel", av, ac);

    kids[i++] = server_label =
                    XmCreateLabelGadget(form, "serverLabel", av, ac);

    kids[i++] = root_label =
                    XmCreateLabelGadget(form, "rootLabel", av, ac);

    kids[i++] = port_number_label =
                    XmCreateLabelGadget(form, "portNumberLabel", av, ac);

    kids[i++] = number_of_hit_label =
                    XmCreateLabelGadget(form, "numHitLabel", av, ac);

    kids[i++] = desc_text =
                    fe_CreateTextField(form, "descText", av, ac);

    kids[i++] = server_text =
                    fe_CreateTextField(form, "serverText", av, ac);

    kids[i++] = root_text =
                    fe_CreateTextField(form, "rootText", av, ac);

    kids[i++] = port_number_text =
                    fe_CreateTextField(form, "portNumberText", av, ac);

    kids[i++] = number_of_hit_text =
                    fe_CreateTextField(form, "numberOfHitText", av, ac);

    kids[i++] = secure_toggle =
                    XmCreateToggleButtonGadget(form, "secure", av, ac);

#if 0
    kids[i++] = save_passwd_toggle =
                    XmCreateToggleButtonGadget(form, "savePasswd", av, ac);
#endif

    fep->desc_text = desc_text;
    fep->server_text = server_text;
    fep->root_text = root_text;
    fep->port_number_text = port_number_text;
    fep->number_of_hit_text = number_of_hit_text;
    fep->secure_toggle = secure_toggle;
#if 0
    fep->save_passwd_toggle = save_passwd_toggle;
#endif

    int labels_width;
    labels_width = XfeVaGetWidestWidget(desc_label,
                                        server_label,
                                        root_label,
                                        port_number_label,
                                        number_of_hit_label,
                                        NULL);

    int labels_height;
    labels_height = XfeVaGetTallestWidget(desc_label,
                                          desc_text,
                                          secure_toggle,
                                          NULL);

    XtVaSetValues(desc_label,
                  XmNheight, labels_height,
                  RIGHT_JUSTIFY_VA_ARGS(desc_label,labels_width),
                  XmNtopAttachment, XmATTACH_FORM,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(desc_text,
                  XmNcolumns, 35,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_FORM,
                  XmNleftAttachment, XmATTACH_FORM,
                  XmNleftOffset, labels_width,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(server_label,
                  XmNheight, labels_height,
                  RIGHT_JUSTIFY_VA_ARGS(server_label,labels_width),
                  XmNtopAttachment, XmATTACH_WIDGET,
                  XmNtopWidget, desc_label,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(server_text,
                  XmNcolumns, 35,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNtopWidget, server_label,
                  XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNleftWidget, desc_text,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(root_label,
                  XmNheight, labels_height,
                  RIGHT_JUSTIFY_VA_ARGS(root_label,labels_width),
                  XmNtopAttachment, XmATTACH_WIDGET,
                  XmNtopWidget, server_label,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(root_text,
                  XmNcolumns, 35,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNtopWidget, root_label,
                  XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNleftWidget, desc_text,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(port_number_label,
                  XmNheight, labels_height,
                  RIGHT_JUSTIFY_VA_ARGS(port_number_label,labels_width),
                  XmNtopAttachment, XmATTACH_WIDGET,
                  XmNtopWidget, root_label,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(port_number_text,
                  XmNcolumns, 6,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNtopWidget, port_number_label,
                  XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNleftWidget, desc_text,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(number_of_hit_label,
                  XmNheight, labels_height,
                  RIGHT_JUSTIFY_VA_ARGS(number_of_hit_label,labels_width),
                  XmNtopAttachment, XmATTACH_WIDGET,
                  XmNtopWidget, port_number_label,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(number_of_hit_text,
                  XmNcolumns, 6,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNtopWidget, number_of_hit_label,
                  XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNleftWidget, desc_text,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

    XtVaSetValues(secure_toggle,
                  XmNindicatorType, XmONE_OF_MANY,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNtopWidget, port_number_text,
                  XmNleftAttachment, XmATTACH_WIDGET,
                  XmNleftWidget, port_number_text,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);

#if 0
    XtVaSetValues(save_passwd_toggle,
                  XmNindicatorType, XmONE_OF_MANY,
                  XmNheight, labels_height,
                  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNtopWidget, number_of_hit_text,
                  XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
                  XmNleftWidget, secure_toggle,
                  XmNrightAttachment, XmATTACH_NONE,
                  XmNbottomAttachment, XmATTACH_NONE,
                  NULL);
#endif

    // Add callbacks

    XtAddCallback(m_chrome, XmNokCallback, cb_ok, this);
    XtAddCallback(m_chrome, XmNcancelCallback, cb_cancel, this);

    XtManageChildren(kids, i);
    XtManageChild(form);
}
Exemplo n.º 3
0
XFE_NewsServerPropGeneralTab::XFE_NewsServerPropGeneralTab(XFE_Component *top,
														   XFE_View *view,
														   MSG_NewsHost *host)
	: XFE_PropertyTabView(top, view, XFE_GENERAL)
{
	int widest_width;
	char buf[100];
	XmString str;

	Widget top_form, middle_form;
	Widget sep1;

	Widget name_label, name_value;
	Widget port_label, port_value;
	Widget security_label, security_value;
	Widget desc_label, desc_value;

	m_newshost = host;

	top_form = XtCreateManagedWidget("top_form",
									 xmFormWidgetClass,
									 getBaseWidget(),
									 NULL, 0);
	middle_form = XtCreateManagedWidget("middle_form",
										xmFormWidgetClass,
										getBaseWidget(),
										NULL, 0);

	sep1 = XtCreateManagedWidget("sep1",
								 xmSeparatorGadgetClass,
								 getBaseWidget(),
								 NULL, 0);

	name_label = XtCreateManagedWidget("name_label",
									   xmLabelGadgetClass,
									   top_form,
									   NULL, 0);

	str = XmStringCreate((char*)MSG_GetNewsHostName(m_newshost),
						 XmFONTLIST_DEFAULT_TAG);
	name_value = XtVaCreateManagedWidget("name_value",
										 xmLabelGadgetClass,
										 top_form,
										 XmNlabelString, str,
										 NULL);
	XmStringFree(str);

	port_label = XtCreateManagedWidget("port_label",
									   xmLabelGadgetClass,
									   top_form,
									   NULL, 0);

	PR_snprintf(buf, sizeof(buf), "%d", MSG_GetNewsHostPort(m_newshost));
	str = XmStringCreate(buf, XmFONTLIST_DEFAULT_TAG);
	port_value = XtVaCreateManagedWidget("port_value",
										 xmLabelGadgetClass,
										 top_form,
										 XmNlabelString, str,
										 NULL);
	XmStringFree(str);

	security_label = XtCreateManagedWidget("security_label",
										   xmLabelGadgetClass,
										   top_form,
										   NULL, 0);
	str = XmStringCreate(MSG_IsNewsHostSecure(m_newshost)
						 ? XP_GetString(XFE_SEC_ENCRYPTED)
						 : XP_GetString(XFE_SEC_NONE),
						 XmFONTLIST_DEFAULT_TAG);
	security_value = XtVaCreateManagedWidget("security_value",
											 xmLabelGadgetClass,
											 top_form,
											 XmNlabelString, str,
											 NULL);
	XmStringFree(str);
	desc_label = XtCreateManagedWidget("desc_label",
									   xmLabelGadgetClass,
									   top_form,
									   NULL, 0);

	str = XmStringCreate("", XmFONTLIST_DEFAULT_TAG); // XXXX 
	desc_value = XtVaCreateManagedWidget("desc_value",
										 xmLabelGadgetClass,
										 top_form,
										 XmNlabelString, str,
										 NULL);
	XmStringFree(str);

	m_prompt_toggle = XtCreateManagedWidget("prompt_toggle",
                                            xmToggleButtonWidgetClass,
                                            middle_form,
                                            NULL, 0);
	m_anonymous_toggle = XtCreateManagedWidget("anonymous_toggle",
                                               xmToggleButtonWidgetClass,
                                               middle_form,
                                               NULL, 0);
	XtVaSetValues(m_prompt_toggle,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNindicatorType, XmONE_OF_MANY,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_FORM,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_FORM,
				  NULL);
	XtVaSetValues(m_anonymous_toggle,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNindicatorType, XmONE_OF_MANY,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, m_prompt_toggle,
				  XmNbottomAttachment, XmATTACH_FORM,
				  XmNrightAttachment, XmATTACH_FORM,
				  NULL);

	widest_width = XfeVaGetWidestWidget(name_label, port_label, security_label, desc_label, NULL);

	XtVaSetValues(name_label,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_FORM,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(port_label,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, name_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(security_label,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_NONE,
				  NULL);
	XtVaSetValues(desc_label,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, security_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_NONE,
				  NULL);

	XtVaSetValues(name_value,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, name_label,
				  XmNleftOffset, widest_width - XfeWidth(name_label),
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, name_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_FORM,
				  NULL);
	XtVaSetValues(port_value,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, port_label,
				  XmNleftOffset, widest_width - XfeWidth(port_label),
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, port_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_FORM,
				  NULL);
	XtVaSetValues(security_value,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, security_label,
				  XmNleftOffset, widest_width - XfeWidth(security_label),
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, security_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_FORM,
				  NULL);
	XtVaSetValues(desc_value,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_WIDGET,
				  XmNleftWidget, desc_label,
				  XmNleftOffset, widest_width - XfeWidth(desc_label),
				  XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
				  XmNtopWidget, desc_label,
				  XmNbottomAttachment, XmATTACH_NONE,
				  XmNrightAttachment, XmATTACH_FORM,
				  NULL);

	XtVaSetValues(top_form,
				  XmNalignment, XmALIGNMENT_BEGINNING,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNrightAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_FORM,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);

	XtVaSetValues(sep1,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNrightAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, top_form,
				  XmNbottomAttachment, XmATTACH_NONE,
				  NULL);

	XtVaSetValues(middle_form,
				  XmNleftAttachment, XmATTACH_FORM,
				  XmNrightAttachment, XmATTACH_FORM,
				  XmNtopAttachment, XmATTACH_WIDGET,
				  XmNtopWidget, sep1,
				  XmNbottomAttachment, XmATTACH_FORM,
				  NULL);

#define setPromptToggle() \
    if (MSG_GetNewsHostPushAuth(m_newshost)) { \
        XmToggleButtonSetState(m_prompt_toggle, True, False); \
        XmToggleButtonSetState(m_anonymous_toggle, False, False); \
    } else { \
        XmToggleButtonSetState(m_prompt_toggle, False, False); \
        XmToggleButtonSetState(m_anonymous_toggle, True, False); \
    }

    setPromptToggle();

    XtAddCallback(m_prompt_toggle, XmNvalueChangedCallback,
                  promptForPasswd_cb, this);
    XtAddCallback(m_anonymous_toggle, XmNvalueChangedCallback,
                  promptForPasswd_cb, this);
}