상속: Xwt.Widget
예제 #1
0
		public RadioButtonSample ()
		{
			var b1 = new RadioButton ("Item 1");
			var b2 = new RadioButton ("Item 2 (red background)");
			b2.BackgroundColor = Xwt.Drawing.Colors.Red;
			var b3 = new RadioButton ("Item 3");
			b2.Group = b3.Group = b1.Group;
			PackStart (b1);
			PackStart (b2);
			PackStart (b3);

			var la = new Label ();
			la.Hide ();
			b1.Group.ActiveRadioButtonChanged += delegate {
				la.Show ();
				la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
			};
			PackStart (la);

			PackStart (new HSeparator ());

			var box = new VBox ();
			box.PackStart (new Label ("First Option"));
			box.PackStart (new Label ("Second line"));

			var b4 = new RadioButton (box);
			var b5 = new RadioButton ("Second Option");
			var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
			PackStart (b4);
			PackStart (b5);
			PackStart (b6);
			b4.Group = b5.Group = b6.Group;
		}
예제 #2
0
		public void GroupSwitching ()
		{
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();
			r2.Group = r3.Group = r1.Group;
			Assert.IsTrue (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsFalse (r3.Active);

			r2.Active = true;
			Assert.IsFalse (r1.Active);
			Assert.IsTrue (r2.Active);
			Assert.IsFalse (r3.Active);
			
			r3.Active = true;
			Assert.IsFalse (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsTrue (r3.Active);
			
			r1.Active = true;
			Assert.IsTrue (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsFalse (r3.Active);
		}
예제 #3
0
        public RadioButtonSample()
        {
            var b1 = new RadioButton ("Item 1");
            var b2 = new RadioButton ("Item 2");
            var b3 = new RadioButton ("Item 3");
            b2.Group = b3.Group = b1.Group;
            PackStart (b1);
            PackStart (b2);
            PackStart (b3);

            var la = new Label ();
            la.Hide ();
            b1.Group.ActiveRadioButtonChanged += delegate {
                la.Show ();
                la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
            };
            PackStart (la);

            PackStart (new HSeparator ());

            var box = new VBox ();
            box.PackStart (new Label ("First Option"));
            box.PackStart (new Label ("Second line"));

            var b4 = new RadioButton (box);
            var b5 = new RadioButton ("Second Option");
            PackStart (b4);
            PackStart (b5);
            b4.Group = b5.Group;
        }
예제 #4
0
		public void ActiveProperty ()
		{
			var r = new RadioButton ();
			Assert.IsTrue (r.Active);
			r.Active = false;
			Assert.IsFalse (r.Active);
			r.Active = true;
			Assert.IsTrue (r.Active);
		}
예제 #5
0
		public void DefaultGroupSelection ()
		{
			// The first item added to a group is active by default
			// Adding a radio to the group, doesn't change the active radio
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();

			Assert.IsTrue (r1.Active);
			Assert.IsTrue (r2.Active);
			Assert.IsTrue (r3.Active);

			r2.Group = r3.Group = r1.Group;

			Assert.IsTrue (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsFalse (r3.Active);
		}
예제 #6
0
		public void DefaultValues ()
		{
			var r = new RadioButton ();
			Assert.IsTrue (r.Active);
			Assert.NotNull (r.Group);
		}
예제 #7
0
		public void GroupClearActive ()
		{
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();
			r2.Group = r3.Group = r1.Group;
			r2.Active = true;
			Assert.IsFalse (r1.Active);
			Assert.IsTrue (r2.Active);
			Assert.IsFalse (r3.Active);

			r1.Group.ClearActive ();
			Assert.IsFalse (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsFalse (r3.Active);
			Assert.IsNull (r1.Group.ActiveRadioButton);
		}
예제 #8
0
		public void GroupActiveChangeEvent ()
		{
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();
			r2.Group = r3.Group = r1.Group;

			int ev = 0;
			RadioButton activeRadio = null;

			r1.Group.ActiveRadioButtonChanged += delegate(object sender, EventArgs e) {
				ev++;
				activeRadio = r1.Group.ActiveRadioButton;
			};

			r1.Active = true;
			Assert.AreEqual (0, ev);

			ev = 0;
			activeRadio = null;
			r2.Active = true;
			Assert.AreEqual (1, ev);
			Assert.AreSame (r2, activeRadio);
			Assert.AreSame (r2, r1.Group.ActiveRadioButton);
			
			ev = 0;
			activeRadio = null;
			r3.Active = true;
			Assert.AreEqual (1, ev);
			Assert.AreSame (r3, activeRadio);
			Assert.AreSame (r3, r1.Group.ActiveRadioButton);
		}
예제 #9
0
		public XwtSourcePageWidget (XwtSourceWizardPage page)
		{
			Page = page;

			cGitHub = new Octokit.GitHubClient (new Octokit.ProductHeaderValue ("xwt_addin")).Repository;

			var optBuiltIn = new RadioButton(GettextCatalog.GetString ("Local Package / GAC")) {
				TooltipText = GettextCatalog.GetString (
					"Xwt must be installed to the GAC (Global Assembly Cache),\n" +
					"otherwise you will have to add a HintPath property manually.")
			};
			var optGithub = new RadioButton(GettextCatalog.GetString ("GitHub:")) {
				TooltipText = GettextCatalog.GetString (
					"A separate solution folder named 'Xwt' will be added to the solution.\n" +
					"If the solution already contains the Xwt project,\nit will be referenced instead " +
					"and the git checkout will be skipped.")
			};
			var linkGithub = new Label {
				Markup = "(<a href='https://github.com/mono/xwt'>Official Repository</a>)",
				TooltipText = "https://github.com/mono/xwt"
			};
			var optNuGet = new RadioButton(GettextCatalog.GetString ("NuGet package")) {
				TooltipText = GettextCatalog.GetString ("All registered NuGet repositories will be searched.")
			};
			                               
			var sourceGroup = optBuiltIn.Group = optGithub.Group = optNuGet.Group;
			sourceGroup.ActiveRadioButtonChanged += (sender, e) => {
				if (sourceGroup.ActiveRadioButton == optGithub)
					Page.XwtReferenceSource = XwtSource.Github;
				else if (sourceGroup.ActiveRadioButton == optNuGet)
					Page.XwtReferenceSource = XwtSource.NuGet;
				else
					Page.XwtReferenceSource = XwtSource.Local;
			};
			optGithub.Active = true;

			CheckBox chkGitSubmodule = null;

			if (page.Wizard.Parameters["CreateSolution"] == true.ToString ()) {
				chkGitSubmodule = new CheckBox(GettextCatalog.GetString ("Register Git Submodule\n(will be committed automatically)")) {
					TooltipText = GettextCatalog.GetString (
						"Only if you enable git version control for the new project in the last creation step.\n" +
						"The Xwt submodule will be registered and initialized during the creation process.")
				};
				chkGitSubmodule.MarginLeft = 30;
				chkGitSubmodule.Toggled += (sender, e) => Page.XwtGitSubmodule = chkGitSubmodule.Active;

				sourceGroup.ActiveRadioButtonChanged += (sender, e) => {
					if (sourceGroup.ActiveRadioButton == optGithub)
						chkGitSubmodule.Sensitive = true;
					else
						chkGitSubmodule.Sensitive = false;
				};
			}

			var tbl = new Table ();
			BackgroundColor = Styles.NewProjectDialog.ProjectConfigurationLeftHandBackgroundColor;

			// use inner table for selection to make it easier to add more options
			var tblSource = new Table ();
			var boxGithub = new HBox ();
			boxGithub.PackStart (optGithub);
			boxGithub.PackStart (linkGithub);
			tblSource.Add (boxGithub, 0, 0);

			var tblGithubRepo = new Table ();
			tblGithubRepo.MarginLeft = 30;

			tblGithubRepo.Add (new Label (GettextCatalog.GetString ("Repository:")), 0, 0);
			cmbGithubRepo = new ComboBox ();
			cmbGithubRepo.Items.Add ("mono/xwt");
			cmbGithubRepo.SelectedIndex = 0;
			cmbGithubRepo.SelectionChanged += (sender, e) => UpdateBranches (cmbGithubRepo.SelectedText);
			tblGithubRepo.Add (cmbGithubRepo, 1, 0);
			spinnerRepo = new Spinner { Visible = false };
			tblGithubRepo.Add (spinnerRepo, 2, 0);


			tblGithubRepo.Add (new Label (GettextCatalog.GetString ("Branch:")), 0, 1);
			cmbGithubBranch = new ComboBox ();
			cmbGithubBranch.Items.Add ("master");
			cmbGithubBranch.SelectedIndex = 0;
			cmbGithubBranch.SelectionChanged += (sender, e) => Page.XwtGithubBranch = cmbGithubBranch.SelectedText;
			tblGithubRepo.Add (cmbGithubBranch, 1, 1);
			spinnerBranches = new Spinner { Visible = false };
			tblGithubRepo.Add (spinnerBranches, 2, 1);

			tblSource.Add (tblGithubRepo, 0, 1);

			if (chkGitSubmodule != null) tblSource.Add (chkGitSubmodule, 0, 2);
			tblSource.Add (optNuGet, 0, 3);
			tblSource.Add (optBuiltIn, 0, 4);

			tbl.Add (new Label (GettextCatalog.GetString ("Xwt reference source:")), 0, 0, vpos: WidgetPlacement.Start, hpos: WidgetPlacement.End);
			tbl.Add (tblSource, 1, 0);

			var rightFrame = new FrameBox ();
			rightFrame.BackgroundColor = Styles.NewProjectDialog.ProjectConfigurationRightHandBackgroundColor; ;
			rightFrame.WidthRequest = 280;

			Spacing = 0;
			PackStart (tbl, true, WidgetPlacement.Center, marginLeft: 30, marginRight: 30);

			PackStart (rightFrame, false, false);
			UpdateForks ();
			UpdateBranches ("mono/xwt");
		}
예제 #10
0
		void SetActive (RadioButton r)
		{
			var old = activeRadioButton;
			activeRadioButton = r;
			if (old != r && activeEvent != null)
				activeEvent (this, EventArgs.Empty);
		}
예제 #11
0
		internal void Add (RadioButton r)
		{
			items.Add (r);
			if (eventsEnabled)
				r.ActiveChanged += HandleActiveChanged;
		}
예제 #12
0
        private void Build()
        {
            if(Toolkit.CurrentEngine.Type == ToolkitType.Wpf)
                this.BackgroundColor = (new Button()).BackgroundColor;

            vbox1 = new VBox();

            label1 = new Label("Select Font:");
            label1.MarginTop = 4;
            label1.MarginRight = 4;
            label1.MarginLeft = 4;
            vbox1.PackStart(label1);

            table1 = new Table();
            table1.MarginRight = 4;
            table1.MarginLeft = 4;

            radioButton1 = new RadioButton("From System: ");
            table1.Add(radioButton1, 0, 0);

            combo_font = new ComboBox();

            List<string> fonts = new List<string>();
            foreach (System.Drawing.FontFamily font in System.Drawing.FontFamily.Families)
                fonts.Add(font.Name);
            fonts.Sort();
            foreach (string font in fonts)
                combo_font.Items.Add(font);

            if(combo_font.Items.Contains("Arial"))
                combo_font.SelectedText = "Arial";
            else if(combo_font.Items.Count > 0)
                combo_font.SelectedIndex = 0;
            combo_font.Font = Xwt.Drawing.Font.FromName(combo_font.SelectedText).WithSize(combo_font.Font.Size);

            table1.Add(combo_font, 1, 0, 1, 1, true);

            radioButton2 = new RadioButton();
            radioButton2.Label = "From File: ";
            radioButton2.Sensitive = true;
            radioButton2.Group = radioButton1.Group;
            table1.Add(radioButton2, 0, 1);

            hbox1 = new HBox();

            entry_font = new TextEntry();
            entry_font.Sensitive = false;
            hbox1.PackStart(entry_font, true);

            button_font = new Button("Browse");
            button_font.Sensitive = false;
            hbox1.PackStart(button_font);

            table1.Add(hbox1, 1, 1);

            vbox1.PackStart(table1);

            notebook1 = new Notebook();
            notebook1.ExpandHorizontal = true;
            notebook1.ExpandVertical = true;

            table2 = new Table();
            table2.Margin = 4;

            label4 = new Label("Style:");
            table2.Add(label4, 0, 0);

            hbox2 = new HBox();

            check_bold = new CheckBox("Bold ");
            check_bold.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            hbox2.PackStart(check_bold);

            check_italic = new CheckBox("Italic ");
            check_italic.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            hbox2.PackStart(check_italic);

            check_kerning = new CheckBox("Kerning ");
            check_kerning.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            hbox2.PackStart(check_kerning);

            table2.Add(hbox2, 0, 1, 1, 1);

            label2 = new Label("Size:");
            table2.Add(label2, 0, 2);

            entry_size = new NumericEntry("0", "WARNING: Size needs to be a number");
            table2.Add(entry_size, 0, 3, 1, 1, true);

            label3 = new Label("Spacing:");
            table2.Add(label3, 0, 4);

            entry_spacing = new NumericEntry("0", "WARNING: Spacing needs to be a number");
            table2.Add(entry_spacing, 0, 5, 1, 1, true);

            check_defchar = new CheckBox("Default Character:");
            check_defchar.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            table2.Add(check_defchar, 0, 6);

            entry_defchar = new TextEntry();
            entry_defchar.Sensitive = false;
            entry_defchar.TextAlignment = Alignment.Center;
            table2.Add(entry_defchar, 0, 7, 1, 1, true);

            notebook1.Add(table2, "Global");

            hbox3 = new HBox();

            listView1 = new ListView();
            hbox3.PackStart(listView1, true);

            vbox2 = new VBox();
            vbox2.MarginRight = 5;
            vbox2.MarginTop = 5;

            label8 = new Label(" Main:");
            vbox2.PackStart(label8);

            button_plus = new Button("Add");
            vbox2.PackStart(button_plus);

            button_minus = new Button("Remove");
            button_minus.Sensitive = false;
            vbox2.PackStart(button_minus);

            button_edit = new Button("Edit");
            button_edit.Sensitive = false;
            vbox2.PackStart(button_edit);

            vbox2.PackStart(new HSeparator());

            label9 = new Label(" Move:");
            vbox2.PackStart(label9);

            button_up  = new Button("Up");
            button_up.Sensitive = false;
            vbox2.PackStart(button_up);

            button_down  = new Button("Down");
            button_down.Sensitive = false;
            vbox2.PackStart(button_down);

            hbox3.PackStart(vbox2);

            notebook1.Add(hbox3, "Characters");

            var pa = new VBox();

            textEditor1 = new TextEditor();
            textEditor1.Document.MimeType = "application/xml";

            pa.PackStart(textEditor1, true);
            notebook1.Add(pa, "Xml");

            vbox3 = new VBox();

            hbox4 = new HBox();
            hbox4.Margin = 5;

            label5 = new Label("Font Color: ");
            hbox4.PackStart(label5);

            color_font = new ColorPicker();
            color_font.Color = Color.FromBytes(0, 0, 0);
            color_font.SupportsAlpha = false;
            hbox4.PackStart(color_font);

            label6 = new Label("Background Color: ");
            hbox4.PackStart(label6);

            color_back = new ColorPicker();
            color_back.Color = Color.FromBytes(224, 224, 209);
            color_back.SupportsAlpha = false;
            hbox4.PackStart(color_back);

            vbox3.PackStart(hbox4);

            hbox5 = new HBox();
            hbox5.MarginLeft = 5;
            hbox5.MarginRight = 5;

            label7 = new Label("Text: ");
            hbox5.PackStart(label7);

            entry_text = new TextEntry();
            entry_text.Text = "The quick brown fox jumps over the lazy dog";
            hbox5.PackStart(entry_text, true);

            button_preview = new Button("Preview");
            hbox5.PackStart(button_preview);

            vbox3.PackStart(hbox5);

            web1 = new WebView();

            scrollView2 = new ScrollView();
            scrollView2.HorizontalScrollPolicy = ScrollPolicy.Automatic;
            scrollView2.VerticalScrollPolicy = ScrollPolicy.Automatic;

            if (Toolkit.CurrentEngine.Type != ToolkitType.Gtk)
                scrollView2.Content = web1;

            vbox3.PackStart(scrollView2, true);

            notebook1.Add(vbox3, "Preview");

            vbox1.PackStart(notebook1, true);

            this.Content = vbox1;
        }
		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 ();

		}
예제 #14
0
        /// <summary>
        /// Init components.
        /// </summary>
        private void _initializeComponents()
        {
            VBox ContentBox = new VBox();

            // First value
            Value = new RadioButton(Director.Properties.Resources.JsonValue);
            ContentBox.PackStart(Value);

            // Horizontal
            HBox ValueBox = new HBox();

            // Options
            ValueType = new ComboBox()
            {
                WidthRequest = 80
            };
            ValueType.Items.Add(DataType.TYPE_STRING, "String");
            ValueType.Items.Add(DataType.TYPE_INT, "Integer");
            ValueType.Items.Add(DataType.TYPE_DOUBLE, "Double");
            ValueType.Items.Add(DataType.TYPE_NULL, "Null");
            ValueType.Items.Add(DataType.TYPE_BOOL, "Boolean");
            ValueType.SelectedIndex = 0;
            ValueBox.PackStart(ValueType, false, false);

            // Value
            ValueText = new TextEntry();
            ValueBox.PackStart(ValueText, true, true);
            ContentBox.PackStart(ValueBox);

            // Guide
            Format = new RadioButton(Director.Properties.Resources.FormatGuide);
            ContentBox.PackStart(Format);
            Value.Group = Format.Group;
            Value.Active = true;
            Value.Group.ActiveRadioButtonChanged += GroupChanged_Event;

            // Type
            ContentBox.PackStart (new Label (Director.Properties.Resources.FormatType) { Font = Font.SystemFont.WithWeight (FontWeight.Bold) }, true, false);

            // Combo box
            FormatTypeSelect = new ComboBox ();

            // Add items
            FormatTypeSelect.Items.Add ("string", "String");
            FormatTypeSelect.Items.Add ("integer", "Integer");
            FormatTypeSelect.Items.Add ("real", "Real");
            FormatTypeSelect.Items.Add ("boolean", "Boolean");
            FormatTypeSelect.SelectionChanged += delegate {
                var selectedItem = FormatOperationsSelect.SelectedItem;

                FormatOperationsSelect.Items.Clear();

                // Always
                FormatOperationsSelect.Items.Add("ip_", Director.Properties.Resources.PresentsTest);
                FormatOperationsSelect.Items.Add("eq", Director.Properties.Resources.OperationEquals);
                FormatOperationsSelect.Items.Add("ne", Director.Properties.Resources.OperationNotEquals);

                if (((String)FormatTypeSelect.SelectedItem) != "boolean") {
                    FormatOperationsSelect.Items.Add ("lt", Director.Properties.Resources.OperationLessThan);
                    FormatOperationsSelect.Items.Add("lte", Director.Properties.Resources.OperationLessThanOrEquals);
                    FormatOperationsSelect.Items.Add("gt", Director.Properties.Resources.OperationGreatherThan);
                    FormatOperationsSelect.Items.Add("gte", Director.Properties.Resources.OperationGreatherThanOrEqual);

                    if (((String)FormatTypeSelect.SelectedItem) == "string")
                        FormatOperationsSelect.Items.Add ("mp", Director.Properties.Resources.OperationMatchingRegex);
                }

                FormatOperationsSelect.SelectedItem = selectedItem;
                if (FormatOperationsSelect.SelectedIndex == -1)
                    FormatOperationsSelect.SelectedIndex = 0;
            };
            ContentBox.PackStart (FormatTypeSelect, true, false);

            // Operations
            ContentBox.PackStart (new Label (Director.Properties.Resources.Operation) { Font = Font.SystemFont.WithWeight (FontWeight.Bold) }, true, false);
            FormatOperationsSelect = new ComboBox ();
            FormatOperationsSelect.Items.Add("ip_", Director.Properties.Resources.PresentsTest);
            FormatOperationsSelect.Items.Add("eq", Director.Properties.Resources.OperationEquals);
            FormatOperationsSelect.Items.Add("ne", Director.Properties.Resources.OperationNotEquals);
            FormatOperationsSelect.Items.Add("lt", Director.Properties.Resources.OperationLessThan);
            FormatOperationsSelect.Items.Add("lte", Director.Properties.Resources.OperationLessThanOrEquals);
            FormatOperationsSelect.Items.Add("gt", Director.Properties.Resources.OperationGreatherThan);
            FormatOperationsSelect.Items.Add("gte", Director.Properties.Resources.OperationGreatherThanOrEqual);
            FormatOperationsSelect.Items.Add("mp", Director.Properties.Resources.OperationMatchingRegex);
            FormatOperationsSelect.SelectedIndex = 0;

            // Select - fill combo box
            FormatTypeSelect.SelectedIndex = 0;

            // Add
            ContentBox.PackStart (FormatOperationsSelect, true, false);

            // Use variable instead of value
            UseVariable = new CheckBox(Director.Properties.Resources.UseVarInsteadOfValue);
            ContentBox.PackStart (UseVariable, true, false);

            // Evaluate this if present
            EvalIfPresent = new CheckBox(Director.Properties.Resources.EvalCondIfParIsPresent);
            ContentBox.PackStart (EvalIfPresent, true, false);

            // Value
            ContentBox.PackStart(new Label(Director.Properties.Resources.ConditionValue) { Font = Font.SystemFont.WithWeight(FontWeight.Bold) }, true, false);
            ConditionValue = new TextEntry ();
            ContentBox.PackStart (ConditionValue, true, false);

            // Save to variable
            ContentBox.PackStart(new Label(Director.Properties.Resources.SaveToVariable) { Font = Font.SystemFont.WithWeight(FontWeight.Bold) }, true, false);
            SaveToVariable = new TextEntry ();
            ContentBox.PackStart (SaveToVariable, true, false);

            // Change selection
            FormatOperationsSelect.SelectionChanged += delegate
            {
                string item = (String)FormatOperationsSelect.SelectedItem;

                if (item == "ip_")
                {
                    UseVariable.Sensitive = false;
                    ConditionValue.Sensitive = false;
                    EvalIfPresent.Sensitive = false;
                }
                else
                {
                    UseVariable.Sensitive = true;
                    ConditionValue.Sensitive = true;
                    EvalIfPresent.Sensitive = true;
                }
            };

            // Content
            Content = ContentBox;
        }
예제 #15
0
        /// <summary>
        /// Init.
        /// </summary>
        void _initializeComponents()
        {
            // Create content box
            VBox ContentBox = new VBox ();

            // Create Item count
            ItemCount = new RadioButton (Director.Properties.Resources.CompareItemCount);
            ContentBox.PackStart (ItemCount);

            // Create All item template
            AllItemsTemplate = new RadioButton (Director.Properties.Resources.CompareAllArrayItem);
            ContentBox.PackStart (AllItemsTemplate);

            // Set group
            ItemCount.Group = AllItemsTemplate.Group;
            ItemCount.Group.ActiveRadioButtonChanged += CompareTypeChanged_Event;

            // Type
            ContentBox.PackStart (new Label (Director.Properties.Resources.FormatType) { Font = Font.SystemFont.WithWeight (FontWeight.Bold) }, true, false);

            // Combo box
            FormatTypeSelect = new ComboBox ();

            // Add items
            FormatTypeSelect.Items.Add ("string", "String");
            FormatTypeSelect.Items.Add ("integer", "Integer");
            FormatTypeSelect.Items.Add ("real", "Real");
            FormatTypeSelect.Items.Add ("boolean", "Boolean");
            FormatTypeSelect.SelectionChanged += FormatTypeSelectionChanged;
            ContentBox.PackStart (FormatTypeSelect, true, false);

            // Operations
            ContentBox.PackStart (new Label (Director.Properties.Resources.Operation) { Font = Font.SystemFont.WithWeight (FontWeight.Bold) }, true, false);
            FormatOperationsSelect = new ComboBox ();
            FormatOperationsSelect.Items.Add("ip_", Director.Properties.Resources.PresentsTest);
            FormatOperationsSelect.Items.Add("eq", Director.Properties.Resources.OperationEquals);
            FormatOperationsSelect.Items.Add("ne", Director.Properties.Resources.OperationNotEquals);
            FormatOperationsSelect.Items.Add("lte", Director.Properties.Resources.OperationLessThanOrEquals);
            FormatOperationsSelect.Items.Add("gt", Director.Properties.Resources.OperationGreatherThan);
            FormatOperationsSelect.Items.Add("gte", Director.Properties.Resources.OperationGreatherThanOrEqual);
            FormatOperationsSelect.Items.Add("mp", Director.Properties.Resources.OperationMatchingRegex);
            FormatOperationsSelect.SelectedIndex = 0;

            // Select - fill combo box
            FormatTypeSelect.SelectedIndex = 0;

            // Add
            ContentBox.PackStart (FormatOperationsSelect, true, false);

            // Create items
            UseVariable = new CheckBox (Director.Properties.Resources.VariableInsteadConditionValue);
            ContentBox.PackStart (UseVariable, true, false);

            // Evaluate this if present
            EvalIfPresent = new CheckBox (Director.Properties.Resources.EvaluateConditionIfParameterIsPresent);
            ContentBox.PackStart (EvalIfPresent, true, false);

            // Value
            ContentBox.PackStart (new Label (Director.Properties.Resources.ConditionValue) { Font = Font.SystemFont.WithWeight (FontWeight.Bold) }, true, false);
            ConditionValue = new TextEntry ();
            ContentBox.PackStart (ConditionValue, true, false);

            // Save to variable
            ContentBox.PackStart (new Label (Director.Properties.Resources.SaveToVariable) { Font = Font.SystemFont.WithWeight (FontWeight.Bold) }, true, false);
            SaveToVariable = new TextEntry ();
            ContentBox.PackStart (SaveToVariable, true, false);

            // Set active
            ItemCount.Active = true;

            // Set content
            Content = ContentBox;
        }
예제 #16
0
		public void AllRadiosDisabled ()
		{
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();
			r2.Group = r3.Group = r1.Group;
			Assert.IsTrue (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsFalse (r3.Active);

			r1.Active = false;
			Assert.IsFalse (r1.Active);
			Assert.IsFalse (r2.Active);
			Assert.IsFalse (r3.Active);
		}
예제 #17
0
		public void ToggleEvent ()
		{
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();
			r2.Group = r3.Group = r1.Group;

			int changed1 = 0;
			int changed2 = 0;
			int ev = 1;

			r1.ActiveChanged += delegate {
				changed1 = ev++;
			};

			r2.ActiveChanged += delegate {
				changed2 = ev++;
			};

			r2.Active = true;

			Assert.IsFalse (r1.Active);
			Assert.IsTrue (r2.Active);
			Assert.AreEqual (1, changed1);
			Assert.AreEqual (2, changed2);
		}
예제 #18
0
		internal void Remove (RadioButton r)
		{
			items.Remove (r);
			if (eventsEnabled)
				r.ActiveChanged -= HandleActiveChanged;
		}
예제 #19
0
		public void GroupActiveRadioButton ()
		{
			var r1 = new RadioButton ();
			var r2 = new RadioButton ();
			var r3 = new RadioButton ();
			r2.Group = r3.Group = r1.Group;
			r2.Active = true;
			Assert.IsFalse (r1.Active);
			Assert.IsTrue (r2.Active);
			Assert.IsFalse (r3.Active);
			Assert.AreSame (r2, r1.Group.ActiveRadioButton);
		}
예제 #20
0
        /// <summary>
        /// Initialize components.
        /// </summary>
        public override void _initializeComponents()
        {
            Frame f = new Frame()
            {
                Label = Director.Properties.Resources.ScenarioLabel,
                Padding = 10
            };
            VBox ScenarioSettings = new VBox();

            // Create scenario name
            ScenarioName = new TextEntry();
            ScenarioName.Changed += ScenarioName_Changed;
            ScenarioSettings.PackStart(new Label(Director.Properties.Resources.ScenarioName));
            ScenarioSettings.PackStart(ScenarioName);
            ScenarioSettings.PackStart(InvalidScenarioName);
            f.Content = ScenarioSettings;
            PackStart(f);

            Frame h = new Frame()
            {
                Label = Director.Properties.Resources.RunningOptionsLabel,
                Padding = 10
            };
            VBox RunningOptionsSettings = new VBox();

            // Select scenario run
            PeriodicityRunning = new RadioButton(Director.Properties.Resources.FrequencyLabel);
            TimeDelayRunning = new RadioButton(Director.Properties.Resources.TimeDelayLabel);
            PeriodicityRunning.Group = TimeDelayRunning.Group;
            RunningOptionsSettings.PackStart(PeriodicityRunning);
            RunningOptionsSettings.PackStart(TimeDelayRunning);
            PeriodicityRunning.Group.ActiveRadioButtonChanged += ChangeFrequencyOption;

            // Frequency settings
            RunningOptionsSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.RunningPeriodicity
            });
            FrequencyRunning = new ComboBox();
            FrequencyHelper.FillComboBox(FrequencyRunning);
            RunningOptionsSettings.PackStart(FrequencyRunning);
            FrequencyRunning.SelectedIndex = 0;
            FrequencyRunning.SelectionChanged += FrequencyRunning_SelectionChanged;

            // Time delay settings
            RunningOptionsSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.TimeDelayInSeconds
            });
            TimeDelay = new TextEntry()
            {
                Text = "0"
            };
            TimeDelay.Changed += delegate
            {
                try
                {
                    ActiveScenario.TimeAfterPrevious = int.Parse(TimeDelay.Text);

                    InvalidTimeDelay.Visible = false;
                }
                catch
                {
                    InvalidTimeDelay.Visible = true;
                }
            };
            RunningOptionsSettings.PackStart(TimeDelay);
            RunningOptionsSettings.PackStart(InvalidTimeDelay);

            // Add to form
            h.Content = RunningOptionsSettings;
            PackStart(h);

            // Scenario information
            ScenarioInformation = new VBox();
            ScrollView ScenarioInformationScrollView = new ScrollView()
            {
                VerticalScrollPolicy = ScrollPolicy.Automatic,
                Content = ScenarioInformation
            };

            Frame si = new Frame()
            {
                Label = Director.Properties.Resources.ScenarioOverview,
                Padding = 10,
                Content = ScenarioInformationScrollView
            };
            PackStart(si, true, true);
        }
예제 #21
0
        /// <summary>
        /// Init components.
        /// </summary>
        private void _initializeComponents()
        {
            VBox ContentBox = new VBox();

            // First value
            Value = new RadioButton(Director.Properties.Resources.JsonValue);
            ContentBox.PackStart(Value);

            // Horizontal
            HBox ValueBox = new HBox();

            // Options
            ValueType = new ComboBox()
            {
                WidthRequest = 80
            };
            ValueType.Items.Add(DataType.TYPE_STRING, "String");
            ValueType.Items.Add(DataType.TYPE_INT, "Integer");
            ValueType.Items.Add(DataType.TYPE_DOUBLE, "Double");
            ValueType.Items.Add(DataType.TYPE_NULL, "Null");
            ValueType.Items.Add(DataType.TYPE_BOOL, "Boolean");
            ValueType.SelectedIndex = 0;
            ValueBox.PackStart(ValueType, false, false);

            // Value
            ValueText = new TextEntry();
            ValueBox.PackStart(ValueText, true, true);
            ContentBox.PackStart(ValueBox);

            // Guide
            FormatGuide = new RadioButton(Director.Properties.Resources.FormatGuide);
            ContentBox.PackStart(FormatGuide);
            Value.Group = FormatGuide.Group;
            Value.Active = true;
            Value.Group.ActiveRadioButtonChanged += Group_ActiveRadioButtonChanged;

            // First line
            HBox FirstLine = new HBox();

            // Value option
            Label Variable = new Label(Director.Properties.Resources.VariableType)
            {
                HorizontalPlacement = WidgetPlacement.Center,
                ExpandHorizontal = true,
                ExpandVertical = false,
                MarginLeft = 10
            };
            Label VariableValue = new Label(Director.Properties.Resources.VariableValue) {
                ExpandHorizontal = true,
                ExpandVertical = false,
                HorizontalPlacement = WidgetPlacement.Center
            };
            NewFormat = new Button(Image.FromResource(DirectorImages.ADD_ICON))
            {
                MinWidth = 30,
                WidthRequest = 30,
                MarginRight = 30
            };
            FirstLine.PackStart(Variable, true, true);
            FirstLine.PackStart(VariableValue, true, true);
            FirstLine.PackStart(NewFormat, false, false);
            ContentBox.PackStart(FirstLine);
            NewFormat.Clicked += NewFormat_Clicked;

            // Variables
            FormatWrapper = new VBox();
            ScrollView FormatWrapperSV = new ScrollView()
            {
                HorizontalScrollPolicy = ScrollPolicy.Never,
                VerticalScrollPolicy = ScrollPolicy.Always,
                Content = FormatWrapper,
                BackgroundColor = Colors.LightGray
            };
            ContentBox.PackStart(FormatWrapperSV, true, true);

            // Example output
            ExampleOutput = new Label()
            {
                ExpandHorizontal = true
            };
            ContentBox.PackStart(ExampleOutput, false, true);

            Content = ContentBox;
        }