Inheritance: Xwt.Widget
Beispiel #1
0
        public FileSelectorSample()
        {
            FileSelector fsel;
            Label label;
            PackStart (new Label("An open file selector:"));
            PackStart (fsel = new FileSelector ());
            PackStart (label = new Label ());
            fsel.FileChanged += (sender, e) => { label.Text = "File changed: " + fsel.FileName; };

            FileSelector fsel2;
            Label label2;
            PackStart (new Label ("An save file selector:") { MarginTop = 12 });
            PackStart (fsel2 = new FileSelector { FileSelectionMode = FileSelectionMode.Save });
            PackStart (label2 = new Label ());
            fsel2.FileChanged += (sender, e) => label2.Text = "File changed: " + fsel2.FileName;
        }
Beispiel #2
0
        public DotNetRunConfigurationEditorWidget(bool includeAdvancedTab)
        {
            VBox mainBox = new VBox();

            mainBox.Margin = 12;
            var startActionlabel = new Label {
                Markup = GettextCatalog.GetString("Start Action")
            };

            mainBox.PackStart(startActionlabel);
            var table = new Table();

            table.Add(radioStartProject = new RadioButton(GettextCatalog.GetString("Start project")), 0, 0);
            table.Add(radioStartApp     = new RadioButton(GettextCatalog.GetString("Start external program:")), 0, 1);
            table.Add(appEntry          = new Xwt.FileSelector(), 1, 1, hexpand: true);
            table.Add(appEntryInfoIcon  = new InformationPopoverWidget(), 2, 1);
            appEntryInfoIcon.Hide();
            radioStartProject.Group = radioStartApp.Group;
            table.MarginLeft        = 12;
            mainBox.PackStart(table);

            radioStartProject.Accessible.LabelWidget = startActionlabel;
            radioStartApp.Accessible.LabelWidget     = startActionlabel;

            appEntry.Accessible.Label = GettextCatalog.GetString("External Program");

            mainBox.PackStart(new HSeparator()
            {
                MarginTop = 8, MarginBottom = 8
            });
            table = new Table();

            var argumentsLabel = new Label(GettextCatalog.GetString("Arguments:"));

            table.Add(argumentsLabel, 0, 0);
            table.Add(argumentsEntry = new TextEntry(), 1, 0, hexpand: true);
            argumentsEntry.Accessible.LabelWidget = argumentsLabel;

            var workingDirLabel = new Label(GettextCatalog.GetString("Run in directory:"));

            table.Add(workingDirLabel, 0, 1);
            table.Add(workingDir = new FolderSelector(), 1, 1, hexpand: true);
            workingDir.Accessible.LabelWidget = workingDirLabel;

            mainBox.PackStart(table);

            mainBox.PackStart(new HSeparator()
            {
                MarginTop = 8, MarginBottom = 8
            });

            var envVarsLabel = new Label(GettextCatalog.GetString("Environment Variables"));

            mainBox.PackStart(envVarsLabel);
            envVars = new EnvironmentVariableCollectionEditor();
            envVars.Accessible.LabelWidget = envVarsLabel;

            mainBox.PackStart(envVars, true);

            mainBox.PackStart(new HSeparator()
            {
                MarginTop = 8, MarginBottom = 8
            });

            HBox cbox = new HBox();

            cbox.PackStart(externalConsole = new CheckBox(GettextCatalog.GetString("Run on external console")));
            cbox.PackStart(pauseConsole    = new CheckBox(GettextCatalog.GetString("Pause console output")));
            mainBox.PackStart(cbox);

            Add(mainBox, GettextCatalog.GetString("General"));

            var adBox = new VBox();

            adBox.Margin = 12;

            table = new Table();
            table.Add(new Label(GettextCatalog.GetString("Execute in .NET Runtime:")), 0, 0);
            table.Add(runtimesCombo        = new ComboBox(), 1, 0, hexpand: true);
            runtimesCombo.Accessible.Label = GettextCatalog.GetString(".NET Runtime");

            var monoLabel = new Label(GettextCatalog.GetString("Mono runtime settings:"));

            table.Add(monoLabel, 0, 1);

            var    box = new HBox();
            Button monoSettingsButton = new Button(GettextCatalog.GetString("\u2026"));

            box.PackStart(monoSettingsEntry = new TextEntry {
                PlaceholderText = GettextCatalog.GetString("Default settings")
            }, true);
            box.PackStart(monoSettingsButton);
            monoSettingsEntry.ReadOnly = true;
            table.Add(box, 1, 1, hexpand: true);
            adBox.PackStart(table);

            monoSettingsButton.Accessible.LabelWidget = monoLabel;

            if (includeAdvancedTab)
            {
                Add(adBox, GettextCatalog.GetString("Advanced"));
            }

            monoSettingsButton.Clicked      += EditRuntimeClicked;
            radioStartProject.ActiveChanged += (sender, e) => UpdateStatus();
            externalConsole.Toggled         += (sender, e) => UpdateStatus();

            LoadRuntimes();

            appEntry.FileChanged           += (sender, e) => NotifyChanged();
            argumentsEntry.Changed         += (sender, e) => NotifyChanged();
            workingDir.FolderChanged       += (sender, e) => NotifyChanged();
            envVars.Changed                += (sender, e) => NotifyChanged();
            externalConsole.Toggled        += (sender, e) => NotifyChanged();
            pauseConsole.Toggled           += (sender, e) => NotifyChanged();
            runtimesCombo.SelectionChanged += (sender, e) => NotifyChanged();
            monoSettingsEntry.Changed      += (sender, e) => NotifyChanged();
        }
		public DotNetRunConfigurationEditorWidget ()
		{
			VBox mainBox = new VBox ();

			mainBox.Margin = 12;
			mainBox.PackStart (new Label { Markup = GettextCatalog.GetString ("Start Action") });
			var table = new Table ();
			
			table.Add (radioStartProject = new RadioButton (GettextCatalog.GetString ("Start project")), 0, 0);
			table.Add (radioStartApp = new RadioButton (GettextCatalog.GetString ("Start external program:")), 0, 1);
			table.Add (appEntry = new Xwt.FileSelector (), 1, 1, hexpand: true);
			table.Add (appEntryInfoIcon = new InformationPopoverWidget (), 2, 1);
			appEntryInfoIcon.Hide ();
			radioStartProject.Group = radioStartApp.Group;
			table.MarginLeft = 12;
			mainBox.PackStart (table);

			mainBox.PackStart (new HSeparator () { MarginTop = 8, MarginBottom = 8 });
			table = new Table ();

			table.Add (new Label (GettextCatalog.GetString ("Arguments:")), 0, 0);
			table.Add (argumentsEntry = new TextEntry (), 1, 0, hexpand:true);

			table.Add (new Label (GettextCatalog.GetString ("Run in directory:")), 0, 1);
			table.Add (workingDir = new FolderSelector (), 1, 1, hexpand: true);
		
			mainBox.PackStart (table);

			mainBox.PackStart (new HSeparator () { MarginTop = 8, MarginBottom = 8 });

			mainBox.PackStart (new Label (GettextCatalog.GetString ("Environment Variables")));
			envVars = new EnvironmentVariableCollectionEditor ();

			mainBox.PackStart (envVars, true);

			mainBox.PackStart (new HSeparator () { MarginTop = 8, MarginBottom = 8 });

			HBox cbox = new HBox ();
			cbox.PackStart (externalConsole = new CheckBox (GettextCatalog.GetString ("Run on external console")));
			cbox.PackStart (pauseConsole = new CheckBox (GettextCatalog.GetString ("Pause console output")));
			mainBox.PackStart (cbox);

			Add (mainBox, GettextCatalog.GetString ("General"));

			var adBox = new VBox ();
			adBox.Margin = 12;

			table = new Table ();
			table.Add (new Label (GettextCatalog.GetString ("Execute in .NET Runtime:")), 0, 0);
			table.Add (runtimesCombo = new ComboBox (), 1, 0, hexpand:true);

			table.Add (new Label (GettextCatalog.GetString ("Mono runtime settings:")), 0, 1);

			var box = new HBox ();
			Button monoSettingsButton = new Button (GettextCatalog.GetString ("..."));
			box.PackStart (monoSettingsEntry = new TextEntry { PlaceholderText = GettextCatalog.GetString ("Default settings")}, true);
			box.PackStart (monoSettingsButton);
			monoSettingsEntry.ReadOnly = true;
			table.Add (box, 1, 1, hexpand: true);
			adBox.PackStart (table);

			Add (adBox, GettextCatalog.GetString ("Advanced"));

			monoSettingsButton.Clicked += EditRuntimeClicked;
			radioStartProject.ActiveChanged += (sender, e) => UpdateStatus ();
			externalConsole.Toggled += (sender, e) => UpdateStatus ();

			LoadRuntimes ();

			appEntry.FileChanged += (sender, e) => NotifyChanged ();
			argumentsEntry.Changed += (sender, e) => NotifyChanged ();
			workingDir.FolderChanged += (sender, e) => NotifyChanged ();
			envVars.Changed += (sender, e) => NotifyChanged ();
			externalConsole.Toggled += (sender, e) => NotifyChanged ();
			pauseConsole.Toggled += (sender, e) => NotifyChanged ();
			runtimesCombo.SelectionChanged += (sender, e) => NotifyChanged ();
			monoSettingsEntry.Changed += (sender, e) => NotifyChanged ();

		}