コード例 #1
0
ファイル: PopoverSample.cs プロジェクト: StEvUgnIn/xwt
		void HandleClicked (object sender, EventArgs e)
		{
			if (popover == null) {
				popover = new Popover ();

				var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
//					table.Margin.SetAll (60);
				table.Add (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
				table.Add (new ComboBox (), 1, 0, vexpand:true);

				table.Add (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
				table.Add (new ComboBox (), 1, 1, vexpand:true);

				table.Add (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
				table.Add (new ComboBox (), 1, 2, vexpand:true);

				table.Add (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
				table.Add (new SpinButton (), 1, 3, vexpand:true);

				var b = new Button ("Add more");
				table.Add (b, 0, 4);
				int next = 5;
				b.Clicked += delegate {
					table.Add (new Label ("Row " + next), 0, next++);
				};

				table.Margin = 20;
				popover.Content = table;
			}
//			popover.Padding.SetAll (20);
			popover.Show (Popover.Position.Top, (Button)sender);
		}
コード例 #2
0
		public ProcessRunConfigurationEditorWidget ()
		{
			VBox mainBox = this;

			mainBox.Margin = 12;
			var 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);

			argumentsEntry.Changed += (s, a) => NotifyChanged ();
			workingDir.FolderChanged += (s, a) => NotifyChanged ();
			envVars.Changed += (s, a) => NotifyChanged ();
			externalConsole.Toggled += (s, a) => NotifyChanged ();
			pauseConsole.Toggled += (s, a) => NotifyChanged ();
		}
コード例 #3
0
ファイル: QuestionDialog.cs プロジェクト: pleonex/deblocus
        private void CreateComponents(string field)
        {
            Title = field;
            txtEntry = new TextEntry();

            var table = new Table();
            table.Add(new Label(field + ":"), 0, 0);
            table.Add(txtEntry, 1, 0);
            Content = table;

            Buttons.Add(new DialogButton(Command.Ok));
            Buttons.Add(new DialogButton(Command.Cancel));
        }
コード例 #4
0
ファイル: TableTests.cs プロジェクト: inorton/xwt
        public override Widget CreateWidget()
        {
            var t = new Table();

            t.Add(new Label("Hello Worlds"), 0, 0);
            return(t);
        }
 void BuildGui()
 {
     this.Margin = new WidgetSpacing(5, 5, 5, 5);
     var tableDetails = new Table();
     tableDetails.Add(new Label(GettextCatalog.GetString("Name of connection") + ":"), 0, 0);
     tableDetails.Add(_nameEntry, 1, 0);
     tableDetails.Add(new Label(GettextCatalog.GetString("Visual Studio Online Url") + ":"), 0, 1);
     tableDetails.Add(_urlEntry, 1, 1);
     tableDetails.Add(new Label(GettextCatalog.GetString("https://<<User Name>>.visualstudio.com")), 2, 1);
     tableDetails.Add(new Label(GettextCatalog.GetString("TFS User") + ":"), 0, 2);
     tableDetails.Add(_tfsNameEntry, 1, 2);
     tableDetails.Add(new Label(GettextCatalog.GetString("User name with access to TFS. Usually your Microsoft account.")), 2, 2);
     this.PackStart(tableDetails);
 }
コード例 #6
0
ファイル: PopoverSample.cs プロジェクト: m13253/xwt
		void HandleClicked (object sender, EventArgs e)
		{
			if (popover == null) {
				popover = new Popover ();
				popover.Padding = 20;

				var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
//					table.Margin.SetAll (60);
				table.Add (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
				table.Add (new ComboBox (), 1, 0, vexpand:true);

				table.Add (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
				table.Add (new ComboBox (), 1, 1, vexpand:true);

				var cmbStyle = new ComboBox ();
				cmbStyle.Items.Add ("Normal");
				cmbStyle.Items.Add ("Bold");
				cmbStyle.Items.Add ("Italic");

				table.Add (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
				table.Add (cmbStyle, 1, 2, vexpand:true);

				table.Add (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
				table.Add (new SpinButton (), 1, 3, vexpand:true);

				var b = new Button ("Add more");
				table.Add (b, 0, 4);
				int next = 5;
				b.Clicked += delegate {
					table.Add (new Label ("Row " + next), 0, next++);
				};

				table.Margin = 20;
				popover.Content = table;
			}
//			popover.Padding.SetAll (20);
			popover.BackgroundColor = Xwt.Drawing.Colors.Yellow.WithAlpha(0.9);
			popover.Show (Popover.Position.Top, (Button)sender, new Rectangle (50, 10, 5, 5));
		}
コード例 #7
0
        public ReferenceImageVerifierDialog()
        {
            Width  = 500;
            Height = 300;

            Table table = new Table();

            table.DefaultRowSpacing = table.DefaultColumnSpacing = 6;

            table.Add(nameLabel = new Label(), 0, 0, hexpand: true);
            table.Add(new Label("Reference Image"), 0, 1, hexpand: true);
            table.Add(new Label("Test Image"), 1, 1, hexpand: true);
            nameLabel.Font = nameLabel.Font.WithWeight(Xwt.Drawing.FontWeight.Bold);

            img1 = new ImageView();
            table.Add(img1, 0, 2, hexpand: true, vexpand: true);

            imgDiff = new ImageView();
            table.Add(imgDiff, 1, 2, hexpand: true, vexpand: true);

            img2 = new ImageView();
            table.Add(img2, 2, 2, hexpand: true, vexpand: true);

            var buttonBox = new HBox();

            table.Add(buttonBox, 0, 3, colspan: 2, hexpand: true);

            closeButton = new Button("Close");
            validButton = new Button("Success");
            failButton  = new Button("Failure");

            buttonBox.PackEnd(closeButton);
            buttonBox.PackEnd(failButton);
            buttonBox.PackEnd(validButton);

            closeButton.Clicked += delegate {
                Respond(Command.Ok);
            };

            failButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Fail();
                ShowNextImage();
            };

            validButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Validate();
                ShowNextImage();
            };

            Content = table;
            ShowNextImage();
        }
コード例 #8
0
        void BuildGui()
        {
            this.Title = GettextCatalog.GetString("Merge Tool Config");
            var table = new Table();
            commandNameEntry.Sensitive = false;
            commandNameEntry.WidthRequest = 350;
            table.Add(commandNameEntry, 1, 1);
            var commandSelectButton = new Button(GettextCatalog.GetString("Choose"));
            commandSelectButton.Clicked += (sender, e) => SelectCommand();
            commandSelectButton.WidthRequest = Constants.ButtonWidth;
            table.Add(commandSelectButton, 2, 1);
            StringBuilder argumentsTooltip = new StringBuilder();
            argumentsTooltip.AppendLine("%1 - Local File");
            argumentsTooltip.AppendLine("%2 - Base File");
            argumentsTooltip.AppendLine("%3 - Their File");

            argumentsTooltip.AppendLine("%4 - Local label");
            argumentsTooltip.AppendLine("%5 - Base label");
            argumentsTooltip.Append("%6 - Their label");

            argumentsEntry.TooltipText = argumentsTooltip.ToString();
            argumentsEntry.Text = "%1 %2 %3";
            table.Add(argumentsEntry, 1, 2, 1, 2);

            content.PackStart(table);
            HBox buttonBox = new HBox();

            var buttonOk = new Button(GettextCatalog.GetString("Ok"));
            buttonOk.Clicked += (sender, e) => this.Respond(Command.Ok);
            var buttonCancel = new Button(GettextCatalog.GetString("Cancel"));
            buttonCancel.Clicked += (sender, e) => this.Respond(Command.Cancel);

            buttonOk.WidthRequest = buttonCancel.WidthRequest = Constants.ButtonWidth;
            buttonBox.PackEnd(buttonOk);
            buttonBox.PackEnd(buttonCancel);
            content.PackStart(buttonBox);
            this.Content = content;
            this.Resizable = false;
        }
コード例 #9
0
ファイル: DeviceDialog.cs プロジェクト: orion75/UbntTools
        public DeviceDialog(Device device)
        {
            Title = string.Empty;
            //Icon = Image.FromResource ("UbntTools.Resources.icon-64x64.png");

            Table table = new Table ();

            table.Add (new Label ("HW Address: ") { TextAlignment = Alignment.End }, 0, 0);
            table.Add (new Label (device.FormatedMacAddress), 1, 0);
            table.Add (new Label ("Ip Address: ") { TextAlignment = Alignment.End }, 0, 1);
            table.Add (new Label (device.FirstAddress.ToString ()), 1, 1);
            table.Add (new Label ("Version: ") { TextAlignment = Alignment.End }, 0, 2);
            table.Add (new Label (device.Firmware.Version), 1, 2);
            table.Add (new Label ("Build Number: ") { TextAlignment = Alignment.End }, 0, 3);
            table.Add (new Label (device.Firmware.Build), 1, 3);
            table.Add (new Label ("Uptime: ") { TextAlignment = Alignment.End }, 0, 4);
            table.Add (new Label ( string.Format ("{0:%d} dias {1:hh\\:mm\\:ss}", device.Uptime, device.Uptime)), 1, 4);

            Buttons.Add (new DialogButton ("Close", Command.Close)  );

            Content = table;
        }
コード例 #10
0
ファイル: ImageViewDialog.cs プロジェクト: pleonex/deblocus
        public ImageViewDialog(Image image)
        {
            Decorated = false;
            ShowInTaskbar = false;
            FullScreen = true;
            Padding = new WidgetSpacing();

            table = new Table();
            table.BackgroundColor = Colors.Black;

            Button btnLeft = new Button("<");
            btnLeft.Clicked += (sender, e) => this.Dispose();
            table.Add(btnLeft, 0, 0, vpos: WidgetPlacement.Center);
            var imgCanvas = new ImageCanvas(image);
            imgCanvas.WidthRequest = image.Width;
            imgCanvas.HeightRequest = image.Height;
            table.Add(imgCanvas, 1, 0, 1, 1, true, true,
                WidgetPlacement.Center, WidgetPlacement.Center);
            table.Add(new Button(">"), 2, 0, vpos: WidgetPlacement.Center);

            Content = table;
        }
コード例 #11
0
        private void BuildGui()
        {
            this.Title = GettextCatalog.GetString("Add/Remove Team Foundation Server");

            var table = new Table();

            table.Add(new Label(GettextCatalog.GetString("Team Foundation Server list")), 0, 0, 1, 2);

            serverList.SelectionMode = SelectionMode.Single;
            serverList.MinWidth = 500;
            serverList.MinHeight = 400;
            serverList.Columns.Add(new ListViewColumn("Name", new TextCellView(nameField) { Editable = false }));
            serverList.Columns.Add(new ListViewColumn("Url", new TextCellView(urlField) { Editable = false }));
            serverList.DataSource = serverStore;
            serverList.RowActivated += OnServerClicked;
            table.Add(serverList, 0, 1);

            VBox buttonBox = new VBox();
            var addButton = new Button(GettextCatalog.GetString("Add"));
            addButton.Clicked += OnAddServer;
            addButton.MinWidth = Constants.ButtonWidth;
            buttonBox.PackStart(addButton);

            var removeButton = new Button(GettextCatalog.GetString("Remove"));
            removeButton.MinWidth = Constants.ButtonWidth;
            removeButton.Clicked += OnRemoveServer;
            buttonBox.PackStart(removeButton);

            var closeButton = new Button(GettextCatalog.GetString("Close"));
            closeButton.MinWidth = Constants.ButtonWidth;
            closeButton.Clicked += (sender, e) => this.Respond(Command.Close);
            buttonBox.PackStart(closeButton);

            table.Add(buttonBox, 1, 1);

            this.Content = table;
            this.Resizable = false;
        }
コード例 #12
0
        void BuildGui()
        {
            var table = new Table();
            table.Add(new Label(GettextCatalog.GetString("Domain") + ":"), 0, 0);
            table.Add(domainEntry, 1, 0);
            table.Add(new Label(GettextCatalog.GetString("User Name") + ":"), 0, 1);
            table.Add(userNameEntry, 1, 1);
            table.Add(new Label(GettextCatalog.GetString("Password") + ":"), 0, 2);
            table.Add(passwordEntry, 1, 2);

            this.Buttons.Add(Command.Ok, Command.Cancel);
            this.Content = table;
            AttachEvents();
        }
コード例 #13
0
        public ReferenceImageVerifierDialog()
        {
            Width = 500;
            Height = 300;

            Table table = new Table ();
            table.DefaultRowSpacing = table.DefaultColumnSpacing = 6;

            table.Add (nameLabel = new Label (), 0, 0, hexpand:true);
            table.Add (new Label ("Reference Image"), 0, 1, hexpand:true);
            table.Add (new Label ("Test Image"), 1, 1, hexpand:true);
            nameLabel.Font = nameLabel.Font.WithWeight (Xwt.Drawing.FontWeight.Bold);

            img1 = new ImageView ();
            table.Add (img1, 0, 2, hexpand:true, vexpand:true);

            imgDiff = new ImageView ();
            table.Add (imgDiff, 1, 2, hexpand:true, vexpand:true);

            img2 = new ImageView ();
            table.Add (img2, 2, 2, hexpand:true, vexpand:true);

            var buttonBox = new HBox ();
            table.Add (buttonBox, 0, 3, colspan:2, hexpand:true);

            closeButton = new Button ("Close");
            validButton = new Button ("Success");
            failButton = new Button ("Failure");

            buttonBox.PackEnd (closeButton);
            buttonBox.PackEnd (failButton);
            buttonBox.PackEnd (validButton);

            closeButton.Clicked += delegate {
                Respond (Command.Ok);
            };

            failButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Fail ();
                ShowNextImage ();
            };

            validButton.Clicked += delegate {
                var info = ReferenceImageManager.ImageFailures[currentImage];
                info.Validate ();
                ShowNextImage ();
            };

            Content = table;
            ShowNextImage ();
        }
コード例 #14
0
        public CompilanceTestDialog()
        {
            backgroundWorker = new BackgroundWorker ();
            backgroundWorker.WorkerReportsProgress = false;
            backgroundWorker.WorkerSupportsCancellation = true;
            backgroundWorker.DoWork += BackgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            Icon = Image.FromResource ("UbntTools.Resources.icon-64x64.png");
            Title = string.Empty;
            Table table = new Table ();

            EntryIp = new TextEntry { Text = "192.168.1.20" };
            EntryPasswd = new PasswordEntry { TooltipText = "Device Password" };
            EntryUser = new TextEntry { Text = "ubnt" };

            table.Add (new Label ("Ip Address:: ") { TextAlignment = Alignment.End }, 0, 0);
            table.Add (EntryIp, 1, 0);
            table.Add (new Label ("User: "******"Password: "******"_Connect");
            table.Add (BtnConnect, 2, 0);

            BtnClose = new Button ("_Salir");
            table.Add (BtnClose, 2, 1);

            BtnConnect.Clicked += (sender, e) => {
                this.Content.Sensitive = false;
                this.BtnClose.Sensitive = false;
                this.BtnConnect.Sensitive = false;
                _ip = this.EntryIp.Text;
                _user = this.EntryUser.Text;
                _pwd = this.EntryPasswd.Password;

                if (!backgroundWorker.IsBusy)
                    backgroundWorker.RunWorkerAsync ();
            };

            BtnClose.Clicked += (sender, e) => { Respond (Command.Close);};

            Content = table;
        }
コード例 #15
0
ファイル: Tables.cs プロジェクト: sergueik/xwt_swd
        public Tables()
        {
            Table t = new Table();

            SimpleBox b = new SimpleBox(200, 20);
            t.Add(b, 0, 0);

            b = new SimpleBox(5, 20);
            t.Add(b, 1, 0);

            b = new SimpleBox(250, 20);
            t.Add(b, 0, 1, colspan: 2, hexpand: true, vexpand: true);

            b = new SimpleBox(300, 20);
            t.Add(b, 1, 2, colspan: 2);

            b = new SimpleBox(100, 20);
            t.Add(b, 2, 3);

            b = new SimpleBox(450, 20);
            t.Add(b, 0, 4, colspan: 3);

            PackStart(t);

            HBox box = new HBox();
            PackStart(box);
            t = new Table();
            t.Add(new Label("One:"), 0, 0);
            t.Add(new TextEntry(), 1, 0);
            t.Add(new Label("Two:"), 0, 1);
            t.Add(new TextEntry(), 1, 1);
            t.Add(new Label("Three:"), 0, 2);
            t.Add(new TextEntry(), 1, 2);
            t.InsertRow(1, 2);
            t.Add(new Label("One-and-a-half"), 0, 1);
            t.Add(new TextEntry() { PlaceholderText = "Just inserted" }, 1, 1);
            t.InsertRow(1, 2);
            t.Add(new SimpleBox(300, 20), 0, 1, colspan: 2);
            box.PackStart(t);
        }
コード例 #16
0
ファイル: Login.cs プロジェクト: hamekoz/hamekoz-sharp
        public Login()
        {
            var table = new Table ();
            var image = new ImageView {
                Image = Icons.UserInfo.WithBoxSize (96),
            };
            userEntry = new TextEntry {
                PlaceholderText = Catalog.GetString ("User"),
            };
            passwordEntry = new PasswordEntry {
                PlaceholderText = Catalog.GetString ("Password"),
            };
            var userLabel = new Label {
                Text = Catalog.GetString ("User"),
                TextAlignment = Alignment.Center,
            };
            var passwordLabel = new Label {
                Text = Catalog.GetString ("Password"),
                TextAlignment = Alignment.Center,
            };
            info = new Label {
                TextAlignment = Alignment.Center,
                TextColor = new Color (1, 0, 0),
                Visible = false,
            };
            userEntry.Activated += delegate {
                passwordEntry.SetFocus ();
            };
            passwordEntry.Activated += OnAutenticate;

            table.Add (image, 0, 0, 4);
            table.Add (userLabel, 1, 0);
            table.Add (userEntry, 1, 1);
            table.Add (passwordLabel, 1, 2);
            table.Add (passwordEntry, 1, 3);
            table.Add (info, 0, 4, colspan: 2);

            Content = table;

            userEntry.SetFocus ();
            Resizable = false;
            ShowInTaskbar = false;
            Title = Catalog.GetString ("Login");
            Icon = Image.FromResource (GetType (), Resources.Icon);
        }
コード例 #17
0
ファイル: CardView.cs プロジェクト: pleonex/deblocus
        private Widget CreateButtonsBar()
        {
            var bar = new Table();
            const int colspan = 3;

            btnPass = new Button("Got it!");
            bar.Add(btnPass, 0, 0, colspan: colspan, hexpand: true, vexpand: true);

            btnFail = new Button("Fail");
            bar.Add(btnFail, colspan, 0, colspan: colspan, hexpand: true, vexpand: true);

            btnReturn = new Button("Return");
            bar.Add(btnReturn, colspan * 2, 0, vexpand: true);

            bar.HeightRequest = 50;
            return bar;
        }
コード例 #18
0
        void BuildGui()
        {
            this.PackStart(new Label(GettextCatalog.GetString("Name of connection")));
            _nameEntry.Changed += (sender, e) => _hostEntry.Text = _nameEntry.Text;
            this.PackStart(_nameEntry);

            this.PackStart(new Label(GettextCatalog.GetString("Host or URL of Team Foundation Server")));

            _hostEntry.Text = "";
            _hostEntry.Changed += OnUrlChanged;
            this.PackStart(_hostEntry);

            var tableDetails = new Table();
            tableDetails.Add(new Label(GettextCatalog.GetString("Connection Details")), 0, 0, 1, 2);
            tableDetails.Add(new Label(GettextCatalog.GetString("Path") + ":"), 0, 1);
            _pathEntry.Text = "tfs";
            _pathEntry.Changed += OnUrlChanged;
            tableDetails.Add(_pathEntry, 1, 1);

            tableDetails.Add(new Label(GettextCatalog.GetString("Port number") + ":"), 0, 2);
            _portEntry.MinimumValue = 1;
            _portEntry.MaximumValue = short.MaxValue;
            _portEntry.Value = 8080;
            _portEntry.IncrementValue = 1;
            _portEntry.Digits = 0;
            _portEntry.ValueChanged += OnUrlChanged;
            tableDetails.Add(_portEntry, 1, 2);

            tableDetails.Add(new Label(GettextCatalog.GetString("Protocol") + ":"), 0, 3);

            var protocolBox = new HBox();

            _httpRadio.Group = _protocolGroup;
            _httpRadio.Active = true;
            protocolBox.PackStart(_httpRadio);

            _httpsRadio.Group = _protocolGroup;
            _httpsRadio.Active = false;
            protocolBox.PackStart(_httpsRadio);

            _protocolGroup.ActiveRadioButtonChanged += (sender, e) =>
            {
                if (_protocolGroup.ActiveRadioButton == _httpRadio)
                {
                    _portEntry.Value = 8080;
                }
                else
                {
                    _portEntry.Value = 443;
                }
                BuildUrl();
            };

            tableDetails.Add(protocolBox, 1, 3);

            this.PackStart(tableDetails);

            var previewBox = new HBox();
            previewBox.PackStart(new Label(GettextCatalog.GetString("Preview") + ":"));
            previewBox.Sensitive = false;
            _previewEntry.BackgroundColor = Xwt.Drawing.Colors.LightGray;
            _previewEntry.MinWidth = 400;

            previewBox.PackStart(_previewEntry, true, true);
            this.PackStart(previewBox);

            BuildUrl();
        }
コード例 #19
0
ファイル: PipelineView.cs プロジェクト: jfreax/BAIMP
        /// <summary>
        /// Opens the option window.
        /// </summary>
        /// <param name="pNode">Pipeline node for which the option should be shown.</param>
        void OpenOptionWindow(PipelineNode pNode)
        {
            Dialog d = new Dialog();
            d.Title = String.Format("Option for \"{0}\"", pNode.algorithm);
            Table table = new Table();
            VBox contentBox = new VBox();

            int i = 0;
            Widget[] entries = new Widget[pNode.algorithm.Options.Count];
            foreach (BaseOption option in pNode.algorithm.Options) {
                table.Add(new Label(option.Name), 0, i);

                Widget entry = option.ToWidget();
                entries[i] = entry;
                table.Add(entry, 1, i);
                i++;
            }

            TextEntry commentEntry = new TextEntry();
            commentEntry.PlaceholderText = "Comments...";
            commentEntry.MultiLine = true;
            commentEntry.Text = pNode.userComment;

            contentBox.PackStart(table);
            contentBox.PackEnd(commentEntry);
            d.Content = contentBox;

            d.Buttons.Add(new DialogButton(Command.Cancel));
            d.Buttons.Add(new DialogButton(Command.Apply));

            var r = d.Run(this.ParentWindow);

            if (r != null && r.Id == Command.Apply.Id) {
                i = 0;
                foreach (BaseOption option in pNode.algorithm.Options) {
                    object value = option.ExtractValueFrom(entries[i]);
                    if (value != null) {
                        option.Value = value;
                    }

                    i++;
                }
                pNode.userComment = commentEntry.Text;
            }

            d.Dispose();
        }
コード例 #20
0
ファイル: TableTests.cs プロジェクト: m13253/xwt
		public override Widget CreateWidget ()
		{
			var t = new Table ();
			t.Add (new Label ("Hello Worlds"), 0, 0);
			return t;
		}
コード例 #21
0
ファイル: MultithreadingSample.cs プロジェクト: m13253/xwt
		public MultithreadingSample ()
		{
			int r = 0;
			var tbl = new Table ();
			PackStart (tbl);

			tbl.Add (new Label("Application.Invoke:"), 0, r);
			tbl.Add (l1 = new Label ("0"), 1, r);
			tbl.Add (btn1 = new ToggleButton("Run"), 2, r++);

			Task worker1;
			CancellationTokenSource worker1cancel = new CancellationTokenSource ();;
			btn1.Toggled += delegate {
				if (btn1.Active) {

					worker1cancel = new CancellationTokenSource ();
					worker1 = Task.Factory.StartNew (delegate {

						int cnt = 0;
						while (!worker1cancel.Token.IsCancellationRequested) {
							Thread.Sleep (50);
							cnt++;
							string txt = cnt.ToString ();
							Application.Invoke (() => l1.Text = txt);
						}
					}, worker1cancel.Token, TaskCreationOptions.LongRunning);
				}
				else
					worker1cancel.Cancel();
			};


			tbl.Add (new Label("Application.UITaskScheduler:"), 0, r);
			tbl.Add (l2 = new Label ("0"), 1, r);
			tbl.Add (btn2 = new ToggleButton("Run"), 2, r++);

			Task worker2;
			CancellationTokenSource worker2cancel = new CancellationTokenSource ();;
			btn2.Toggled += delegate {
				if (btn2.Active) {

					worker2cancel = new CancellationTokenSource ();
					worker2 = Task.Factory.StartNew (delegate {

						int cnt = 0;
						while (!worker2cancel.Token.IsCancellationRequested) {
							Thread.Sleep (50);
							cnt++;
							var txt = cnt.ToString ();
							Task.Factory.StartNew(delegate {
								l2.Text = txt;
							}, worker2cancel.Token, TaskCreationOptions.None, Application.UITaskScheduler);
						}
					}, worker2cancel.Token, TaskCreationOptions.LongRunning);
				}
				else
					worker2cancel.Cancel();
			};


			tbl.Add (new Label("BackgroundWorker:\n(XwtSynchronizationContext.Post)"), 0, r);
			tbl.Add (l3 = new Label ("0"), 1, r);
			tbl.Add (btn3 = new ToggleButton("Run"), 2, r++);

			var worker3 = new BackgroundWorker ();
			worker3.WorkerReportsProgress = true;
			worker3.WorkerSupportsCancellation = true;
			worker3.DoWork += BackgroundWorkerDoWork;
			worker3.ProgressChanged += (sender, e) => l3.Text = e.ProgressPercentage.ToString ();

			btn3.Toggled += delegate {
				if (btn3.Active)
					worker3.RunWorkerAsync ();
				else
					worker3.CancelAsync ();
			};


			tbl.Add (new Label("XwtSynchronizationContext.Send:"), 0, r);
			tbl.Add (l4 = new Label ("0"), 1, r);
			tbl.Add (btn4 = new ToggleButton("Run"), 2, r++);

			worker4 = new SampleBGWorker ();
			worker4.SynchronizationContext = SynchronizationContext.Current;
			worker4.InvokeSynchronized = true;
			worker4.Count += HandleCount4;

			btn4.Toggled += delegate {
				if (btn4.Active)
					worker4.Start ();
				else
					worker4.Stop ();
			};


			tbl.Add (new Label("ISynchronizeInvoke.BeginInvoke:"), 0, r);
			tbl.Add (l5 = new Label ("0"), 1, r);
			tbl.Add (btn5 = new ToggleButton("Run"), 2, r++);

			worker5 = new SampleBGWorker ();
			worker5.InvokeSynchronized = false;
			worker5.Count += HandleCount5;

			btn5.Toggled += delegate {
				if (btn5.Active)
					worker5.Start ();
				else
					worker5.Stop ();
			};


			tbl.Add (new Label("ISynchronizeInvoke.Invoke:"), 0, r);
			tbl.Add (l6 = new Label ("0"), 1, r);
			tbl.Add (btn6 = new ToggleButton("Run"), 2, r++);

			worker6 = new SampleBGWorker ();
			worker6.InvokeSynchronized = true;
			worker6.Count += HandleCount6;

			btn6.Toggled += delegate {
				if (btn6.Active)
					worker6.Start ();
				else
					worker6.Stop ();
			};
		}
コード例 #22
0
        private void BuildGui()
        {
            this.Resizable = false;
            _nameEntry.WidthRequest = _ownerEntry.WidthRequest = _computerEntry.WidthRequest = 400;

            VBox content = new VBox();
            Table entryTable = new Table();
            entryTable.Add(new Label(GettextCatalog.GetString("Name") + ":"), 0, 0); 
            entryTable.Add(_nameEntry, 1, 0);

            entryTable.Add(new Label(GettextCatalog.GetString("Owner") + ":"), 0, 1); 
            entryTable.Add(_ownerEntry, 1, 1);

            entryTable.Add(new Label(GettextCatalog.GetString("Computer") + ":"), 0, 2); 
            entryTable.Add(_computerEntry, 1, 2);

//            entryTable.Add(new Label(GettextCatalog.GetString("Permissions") + ":"), 0, 3); 
//            _permissions.Items.Add(0, "Private workspace");
//            _permissions.Items.Add(1, "Public workspace (limited)");
//            _permissions.Items.Add(2, "Public workspace");
//            entryTable.Add(_permissions, 1, 3);

            content.PackStart(entryTable);

            content.PackStart(new Label(GettextCatalog.GetString("Comment") + ":"));
            _commentEntry.MultiLine = true; //Not working yet
            content.PackStart(_commentEntry);

            content.PackStart(new Label(GettextCatalog.GetString("Working folders") + ":"));
            _workingFoldersView.DataSource = _workingFoldersStore;
            _workingFoldersView.MinHeight = 150;
            _workingFoldersView.MinWidth = 300;

            var tfsFolderView = new TextCellView(_tfsFolder);
            tfsFolderView.Editable = true;

            var localFolderView = new TextCellView(_localFolder);

            _workingFoldersView.Columns.Add(new ListViewColumn("Source Control Floder", tfsFolderView));
            _workingFoldersView.Columns.Add(new ListViewColumn("Local Floder", localFolderView));

            content.PackStart(_workingFoldersView);

            HBox buttonBox = new HBox();

            Button addButton = new Button(GettextCatalog.GetString("Add"));
            addButton.MinWidth = Constants.ButtonWidth;
            addButton.Clicked += OnAddWorkingFolder;

            Button removeButton = new Button(GettextCatalog.GetString("Remove"));
            removeButton.MinWidth = Constants.ButtonWidth;
            removeButton.Clicked += OnRemoveWorkingFolder;

            Button okButton = new Button(GettextCatalog.GetString("OK"));
            okButton.MinWidth = Constants.ButtonWidth;
            okButton.Clicked += OnAddEditWorkspace;

            Button cancelButton = new Button(GettextCatalog.GetString("Cancel"));
            cancelButton.MinWidth = Constants.ButtonWidth;
            cancelButton.Clicked += (sender, e) => Respond(Command.Cancel);

            buttonBox.PackStart(addButton);
            buttonBox.PackStart(removeButton);
            buttonBox.PackEnd(okButton);
            buttonBox.PackEnd(cancelButton);

            content.PackStart(buttonBox);

            this.Content = content;

            if (_action == DialogAction.Create)
            {
                this.Title = "Add Workspace" + " - " + projectCollection.Server.Name + " - " + projectCollection.Name;
                FillFieldsDefault();
            }
            else
            {
                this.Title = "Edit Workspace " + _workspace.Name + " - " + projectCollection.Server.Name + " - " + projectCollection.Name;
                FillFields();
                FillWorkingFolders();
            }
        }
コード例 #23
0
        /// <summary>
        /// builds subwidgets and layout
        /// </summary>
        void BuildWidget()
        {
            Table table = new Table ();

            _appNameEntry = BuildRow (table, 0, I18N._ ("Name"), I18N._ ("e.g. Ardour"));
            _appCommandEntry = BuildRow (table, 1, I18N._ ("Command"), I18N._ ("e.g. /usr/bin/ardour3"));
            _appCommandEntry.FileSelector ();
            _appArgumentsEntry = BuildRow (table, 2, I18N._ ("Command Arguments"), I18N._ ("optional"));

            _removeApp = new Button (I18N._ ("Delete")) { Image = Icons.Delete };
            table.Add (_removeApp, 2, 1);
            _up = new Button (Icons.Up) { Visible = false, Style = ButtonStyle.Flat };
            table.Add (_up, 2, 0);
            _down = new Button (Icons.Down) { Visible = false, Style = ButtonStyle.Flat };
            table.Add (_down, 2, 2);
            table.Margin = new WidgetSpacing (4, 8, 4, 8);
            Content = table;
        }
コード例 #24
0
ファイル: Windows.cs プロジェクト: nite2006/xwt
        public Windows()
        {
            Button bp = new Button ("Show borderless window");
            PackStart (bp);
            bp.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = bp.ScreenBounds;
                w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + bp.Size.Height, w.Width, w.Height);
                w.Show ();
            };
            Button b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Add (new Label ("Some field:"), 0, 0);
                t.Add (new TextEntry (), 1, 0);
                t.Add (new Label ("Another field:"), 0, 1);
                t.Add (new TextEntry (), 1, 1);
                d.Content = t;
                d.CloseRequested += delegate(object sender, CloseRequestedEventArgs args) {
                    args.AllowClose = MessageDialog.Confirm ("Really close?", Command.Close);
                };

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + (r != null ? r.Label : "(Closed)");
                d.Dispose ();
            };

            b = new Button ("Show Open File dialog");
            PackStart (b);
            b.Clicked += delegate {
                OpenFileDialog dlg = new OpenFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Save File dialog");
            PackStart (b);
            b.Clicked += delegate {
                SaveFileDialog dlg = new SaveFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Select Folder dialog (Multi select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder");
                dlg.Multiselect = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder");
                dlg.Multiselect = false;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select, allow creation)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select or create a folder");
                dlg.Multiselect = false;
                dlg.CanCreateFolders = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected/created!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Color dialog");
            PackStart (b);
            b.Clicked += delegate {
                SelectColorDialog dlg = new SelectColorDialog ("Select a color");
                dlg.SupportsAlpha = true;
                dlg.Color = Xwt.Drawing.Colors.AliceBlue;
                if (dlg.Run (ParentWindow))
                    MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ());
            };

            b = new Button("Show window shown event");
            PackStart(b);
            b.Clicked += delegate
            {
                Window w = new Window();
                w.Decorated = false;
                Button c = new Button("This is a window with events on");
                w.Content = c;
                c.Clicked += delegate
                {
                    w.Dispose();
                };
                w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown");
                w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden");

                w.Show();

            };

            b = new Button("Show dialog with dynamically updating content");
            PackStart(b);
            b.Clicked += delegate
            {
                var dialog = new Dialog ();
                dialog.Content = new Label ("Hello World");
                Xwt.Application.TimeoutInvoke (TimeSpan.FromSeconds (2), () => {
                    dialog.Content = new Label ("Goodbye World");
                    return false;
                });
                dialog.Run ();
            };
        }
コード例 #25
0
		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 ();

		}
コード例 #26
0
 TextEntry BuildRow(Table table, int index, string labelText, string placeholder)
 {
     Label label = new Label (labelText);
     table.Add (label, 0, index);
     TextEntry entry = new TextEntry {
         MultiLine = false,
               PlaceholderText = placeholder
     };
     table.Add (entry, 1, index);
     label.LinkClicked += (sender, args) => entry.SetFocus ();
     return entry;
 }
コード例 #27
0
ファイル: SFWidget.GUI.cs プロジェクト: cra0zy/SFEditor
        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;
        }
コード例 #28
0
		public XwtColorSchemeEditor (HighlightingPanel panel)
		{
			this.panel = panel;

			this.Buttons.Add (new DialogButton (Command.Cancel));
			this.Buttons.Add (new DialogButton (Command.Ok));

			colorStore = new TreeStore (nameField, styleField, propertyField);

			var mainTable = new Table ();

			var headerTable = new Table ();
			headerTable.Add (new Label () { Text="Name:" }, 0, 0);
			headerTable.Add (entryName, 1, 0);
			headerTable.Add (new Label () { Text="Description:" }, 2, 0);
			headerTable.Add (entryDescription, 3, 0, 1, 1, true);
			mainTable.Add (headerTable, 0, 0, 1, 1, true, false, WidgetPlacement.Fill, WidgetPlacement.Start);

			var table = new Table ();

			var commandHBox = new HBox ();
			commandHBox.PackStart (new Button ("Undo"));
			commandHBox.PackStart (new Button ("Redo"));
			commandHBox.PackStart (new Button ("AutoSet"));
			table.Add (commandHBox, 0, 0);

			var adjustHBox = new HBox ();
			adjustHBox.PackStart (colorbuttonPrimary);
			adjustHBox.PackStart (colorbuttonSecondary);
			adjustHBox.PackStart (colorbuttonBorder);
			adjustHBox.PackStart (togglebuttonBold, false, WidgetPlacement.End);
			adjustHBox.PackStart (togglebuttonItalic, false, WidgetPlacement.End);
			adjustHBox.PackStart (buttonFormat, false, WidgetPlacement.End);
			table.Add (adjustHBox, 0, 1);

			this.colorbuttonPrimary.ColorSet += StyleChanged;
			this.colorbuttonSecondary.ColorSet += StyleChanged;
			this.colorbuttonBorder.ColorSet += StyleChanged;
			this.togglebuttonBold.Toggled += StyleChanged;
			this.togglebuttonItalic.Toggled += StyleChanged;

			this.textEditor = new TextEditor ();
			this.textEditor.Options = DefaultSourceEditorOptions.Instance;
			this.textEditor.ShowAll ();
			var toolkit = Toolkit.CurrentEngine;
			var wrappedTextEditor = toolkit.WrapWidget (textEditor);
			var scrollView = new ScrollView (wrappedTextEditor) {
				HorizontalScrollPolicy=ScrollPolicy.Always,
				VerticalScrollPolicy=ScrollPolicy.Always
			};
			table.Add (scrollView, 0, 2, 1, 1, true, true);

			this.treeviewColors = new TreeView ();
			this.treeviewColors.Columns.Add (GettextCatalog.GetString ("Name"), nameField);
			this.treeviewColors.HeadersVisible = false;
			this.treeviewColors.DataSource = colorStore;
			this.treeviewColors.SelectionChanged += HandleTreeviewColorsSelectionChanged;

			var box = new HPaned ();

			var treeBox = new VBox ();
			treeBox.PackStart (searchEntry);
			treeBox.PackStart (treeviewColors, true);
			box.Panel1.Content = treeBox;
			box.Panel2.Content = table;
			box.Panel2.Resize = true;
			box.Position = 400;
			
			mainTable.Add (box, 0, 1, 1, 1, true, true);
			this.Content = mainTable;

			this.Height = 400;

			HandleTreeviewColorsSelectionChanged (null, null);
		}
コード例 #29
0
ファイル: PopoverSample.cs プロジェクト: m13253/xwt
		void HandleClicked2 (object sender, EventArgs e)
		{
			if (popover2 == null) {
				popover2 = new Popover ();

				var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
				table.Add (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
				table.Add (new ComboBox (), 1, 0, vexpand:true);

				table.Add (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
				table.Add (new ComboBox (), 1, 1, vexpand:true);

				table.Add (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
				table.Add (new ComboBox (), 1, 2, vexpand:true);

				table.Add (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
				table.Add (new SpinButton (), 1, 3, vexpand:true);

				var b = new Button ("Add more");
				table.Add (b, 0, 4);
				int next = 5;
				b.Clicked += delegate {
					table.Add (new Label ("Row " + next), 0, next++);
				};

				table.Margin = 6;
				popover2.Content = table;
			}

			var newRect = new Rectangle (((Button)sender).Size.Width * 0.66d, 0, 0, 0);
			popover2.Show (Popover.Position.Bottom, (Button)sender, newRect);
		}
コード例 #30
0
        public DefaultColorSelectorBackend()
        {
            HBox  box    = new HBox();
            Table selBox = new Table();

            hsBox                   = new HueBox();
            hsBox.Light             = 0.5;
            lightBox                = new LightBox();
            hsBox.SelectionChanged += delegate {
                lightBox.Hue        = hsBox.SelectedColor.Hue;
                lightBox.Saturation = hsBox.SelectedColor.Saturation;
            };

            colorBox = new ColorSelectionBox()
            {
                MinHeight = 20
            };

            selBox.Add(hsBox, 0, 0);
            selBox.Add(lightBox, 1, 0);

            box.PackStart(selBox);

            const int entryWidth = 40;
            VBox      entryBox   = new VBox();
            Table     entryTable = new Table();

            entryTable.Add(new Label("Color:"), 0, 0);
            entryTable.Add(colorBox, 1, 0, colspan: 4);
            entryTable.Add(new HSeparator(), 0, 1, colspan: 5);

            int r = 2;

            entryTable.Add(new Label("Hue:"), 0, r);
            entryTable.Add(hueEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1
            }, 1, r++);

            entryTable.Add(new Label("Saturation:"), 0, r);
            entryTable.Add(satEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1
            }, 1, r++);

            entryTable.Add(new Label("Light:"), 0, r);
            entryTable.Add(lightEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1
            }, 1, r++);

            r = 2;
            entryTable.Add(new Label("Red:"), 3, r);
            entryTable.Add(redEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);

            entryTable.Add(new Label("Green:"), 3, r);
            entryTable.Add(greenEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);

            entryTable.Add(new Label("Blue:"), 3, r);
            entryTable.Add(blueEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);

            Label label;

            entryTable.Add(alphaSeparator = new HSeparator(), 0, r++, colspan: 5);
            entryTable.Add(label          = new Label("Opacity:"), 0, r);
            entryTable.Add(alphaSlider    = new HSlider()
            {
                MinimumValue = 0, MaximumValue = 255,
            }, 1, r, colspan: 3);
            entryTable.Add(alphaEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r);

            alphaControls.Add(alphaSeparator);
            alphaControls.Add(label);
            alphaControls.Add(alphaEntry);

            entryBox.PackStart(entryTable);
            box.PackStart(entryBox);
            Content = box;

            hsBox.SelectionChanged += delegate {
                HandleColorBoxSelectionChanged();
            };
            lightBox.SelectionChanged += delegate {
                HandleColorBoxSelectionChanged();
            };

            hueEntry.ValueChanged    += HandleHslChanged;
            satEntry.ValueChanged    += HandleHslChanged;
            lightEntry.ValueChanged  += HandleHslChanged;
            redEntry.ValueChanged    += HandleRgbChanged;
            greenEntry.ValueChanged  += HandleRgbChanged;
            blueEntry.ValueChanged   += HandleRgbChanged;
            alphaEntry.ValueChanged  += HandleAlphaChanged;
            alphaSlider.ValueChanged += HandleAlphaChanged;

            Color = Colors.White;
        }
コード例 #31
0
        public DefaultColorSelectorBackend()
        {
            HBox  box    = new HBox();
            Table selBox = new Table();

            hsBox                   = new HueBox();
            hsBox.Light             = 0.5;
            lightBox                = new LightBox();
            hsBox.SelectionChanged += delegate {
                lightBox.Hue        = hsBox.SelectedColor.Hue;
                lightBox.Saturation = hsBox.SelectedColor.Saturation;
            };

            colorBox = new ColorSelectionBox()
            {
                MinHeight = 20
            };

            selBox.Add(hsBox, 0, 0);
            selBox.Add(lightBox, 1, 0);

            box.PackStart(selBox);

            const int entryWidth = 40;
            VBox      entryBox   = new VBox();
            Table     entryTable = new Table();

            entryTable.Add(CreateLabel(Application.TranslationCatalog.GetString("Color:")), 0, 0);
            entryTable.Add(colorBox, 1, 0, colspan: 4);
            entryTable.Add(new HSeparator(), 0, 1, colspan: 5);

            int r        = 2;
            var hueLabel = CreateLabel();

            entryTable.Add(hueLabel, 0, r);
            entryTable.Add(hueEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1
            }, 1, r++);
            SetupEntry(hueEntry, hueLabel, Application.TranslationCatalog.GetString("Hue"));

            var satLabel = CreateLabel();

            entryTable.Add(satLabel, 0, r);
            entryTable.Add(satEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1
            }, 1, r++);
            SetupEntry(satEntry, satLabel, Application.TranslationCatalog.GetString("Saturation"));

            var lightLabel = CreateLabel();

            entryTable.Add(lightLabel, 0, r);
            entryTable.Add(lightEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1
            }, 1, r++);
            SetupEntry(lightEntry, lightLabel, Application.TranslationCatalog.GetString("Light"));

            r = 2;
            var redLabel = CreateLabel();

            entryTable.Add(redLabel, 3, r);
            entryTable.Add(redEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);
            SetupEntry(redEntry, redLabel, Application.TranslationCatalog.GetString("Red"));

            var greenLabel = CreateLabel();

            entryTable.Add(greenLabel, 3, r);
            entryTable.Add(greenEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);
            SetupEntry(greenEntry, greenLabel, Application.TranslationCatalog.GetString("Green"));

            var blueLabel = CreateLabel();

            entryTable.Add(blueLabel, 3, r);
            entryTable.Add(blueEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);
            SetupEntry(blueEntry, blueLabel, Application.TranslationCatalog.GetString("Blue"));

            entryTable.Add(alphaSeparator = new HSeparator(), 0, r++, colspan: 5);
            var alphaLabel = CreateLabel();

            entryTable.Add(alphaLabel, 0, r);
            entryTable.Add(alphaSlider = new HSlider()
            {
                MinimumValue = 0, MaximumValue = 255,
            }, 1, r, colspan: 3);
            entryTable.Add(alphaEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r);
            SetupEntry(alphaEntry, alphaLabel, Application.TranslationCatalog.GetString("Opacity"));

            // Don't allow the slider to get keyboard focus, as it doesn't really work with the keyboard and the opacity
            // spin button takes its place
            alphaSlider.CanGetFocus      = false;
            alphaSlider.Accessible.Label = Application.TranslationCatalog.GetString("Opacity");

            alphaControls.Add(alphaSeparator);
            alphaControls.Add(alphaLabel);
            alphaControls.Add(alphaEntry);

            entryBox.PackStart(entryTable);
            box.PackStart(entryBox);
            Content = box;

            hsBox.SelectionChanged    += HandleColorBoxSelectionChanged;
            lightBox.SelectionChanged += HandleColorBoxSelectionChanged;

            hueEntry.ValueChanged    += HandleHslChanged;
            satEntry.ValueChanged    += HandleHslChanged;
            lightEntry.ValueChanged  += HandleHslChanged;
            redEntry.ValueChanged    += HandleRgbChanged;
            greenEntry.ValueChanged  += HandleRgbChanged;
            blueEntry.ValueChanged   += HandleRgbChanged;
            alphaEntry.ValueChanged  += HandleAlphaChanged;
            alphaSlider.ValueChanged += HandleAlphaChanged;

            Color = Colors.White;
        }
コード例 #32
0
ファイル: TMatrix.cs プロジェクト: jfreax/BAIMP
        public Widget ToWidget()
        {
            long coloumns = Width;
            long rows = Height;

            if (widget == null) {
                if (rows <= 16 && coloumns <= 16) {
                    Table t = new Table();

                    if (isSparse) {
                        foreach (int i in sparseMatrix.GetRows()) {
                            foreach (KeyValuePair<int, float> value in sparseMatrix.GetRowData(i)) {
                                t.Add(new Label(value.Value.ToString()), value.Key, i);
                            }
                        }
                    } else {
                        for (int x = 0; x < coloumns; x++) {
                            for (int y = 0; y < rows; y++) {
                                t.Add(new Label(matrix[x, y].ToString()), x, y);
                            }
                        }
                    }

                    widget = t;
                } else {
                    BitmapImage bi;

                    int iScaleFactor = MathExtras.NextPowerOf2(
                        (int) Math.Round((float) Math.Max(coloumns, rows) / BaseType<int>.MaxWidgetSize.Width) + 1
                    );

                    ImageBuilder ib = new ImageBuilder(coloumns / iScaleFactor, rows / iScaleFactor);
                    bi = ib.ToBitmap();

                    if (isSparse) {
                        float max = sparseMatrix.Max();
                        float min = sparseMatrix.Min();

                        const float toMax = 65536.0f;
                        float toMaxLog = (float) Math.Log(toMax);

                        foreach (int y in sparseMatrix.GetRows()) {
                            foreach (KeyValuePair<int, float> v in sparseMatrix.GetRowData(y)) {
                                float toLog = (toMax - 1.0f) * ((v.Value - min) / (max - min)) + 1.0f;
                                byte c = (byte) ((Math.Log(toLog) / toMaxLog) * 255);

                                bi.SetPixel(v.Key / iScaleFactor, y / iScaleFactor, Color.FromBytes(c, c, c));
                            }
                        }
                    } else {

                        float max = 0.0f;
                        float[,] copy = matrix.Scale(1.0f, 65536.0f);

                        for (int x = 0; x < coloumns; x++) {
                            for (int y = 0; y < rows; y++) {
                                if (copy[x, y] > 0) {
                                    copy[x, y] = (float) (Math.Log(copy[x, y]));
                                }

                                if (copy[x, y] > max) {
                                    max = copy[x, y];
                                }
                            }
                        }

                        for (int x = 0; x < coloumns; x++) {
                            for (int y = 0; y < rows; y++) {
                                byte c = (byte) ((copy[x, y] * 255) / max);
                                if (c > 0) {
                                    bi.SetPixel(x / iScaleFactor, y / iScaleFactor, Color.FromBytes(c, c, c));
                                }
                            }
                        }
                    }

                    ib.Dispose();
                    widget = new ImageView(bi.WithBoxSize(BaseType<int>.MaxWidgetSize));
                }
            }

            return widget;
        }
コード例 #33
0
ファイル: ColorSelector.cs プロジェクト: m13253/xwt
		public DefaultColorSelectorBackend ()
		{
			HBox box = new HBox ();
			Table selBox = new Table ();
			hsBox = new HueBox ();
			hsBox.Light = 0.5;
			lightBox = new LightBox ();
			hsBox.SelectionChanged += delegate {
				lightBox.Hue = hsBox.SelectedColor.Hue;
				lightBox.Saturation = hsBox.SelectedColor.Saturation;
			};
			
			colorBox = new ColorSelectionBox () { MinHeight = 20 };
			
			selBox.Add (hsBox, 0, 0);
			selBox.Add (lightBox, 1, 0);
			
			box.PackStart (selBox);
			
			const int entryWidth = 40;
			VBox entryBox = new VBox ();
			Table entryTable = new Table ();
			
			entryTable.Add (new Label ("Color:"), 0, 0);
			entryTable.Add (colorBox, 1, 0, colspan:4);
			entryTable.Add (new HSeparator (), 0, 1, colspan:5);
			
			int r = 2;
			entryTable.Add (new Label ("Hue:"), 0, r);
			entryTable.Add (hueEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1 }, 1, r++);
			
			entryTable.Add (new Label ("Saturation:"), 0, r);
			entryTable.Add (satEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++);
			
			entryTable.Add (new Label ("Light:"), 0, r);
			entryTable.Add (lightEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++);
			
			r = 2;
			entryTable.Add (new Label ("Red:"), 3, r);
			entryTable.Add (redEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++);
			
			entryTable.Add (new Label ("Green:"), 3, r);
			entryTable.Add (greenEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++);
			
			entryTable.Add (new Label ("Blue:"), 3, r);
			entryTable.Add (blueEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++);
			
			Label label;
			entryTable.Add (alphaSeparator = new HSeparator (), 0, r++, colspan:5);
			entryTable.Add (label = new Label ("Opacity:"), 0, r);
			entryTable.Add (alphaSlider = new HSlider () {
				MinimumValue = 0, MaximumValue = 255,  }, 1, r, colspan: 3);
			entryTable.Add (alphaEntry = new SpinButton () { 
				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r);
			
			alphaControls.Add (alphaSeparator);
			alphaControls.Add (label);
			alphaControls.Add (alphaEntry);
			
			entryBox.PackStart (entryTable);
			box.PackStart (entryBox);
			Content = box;
			
			hsBox.SelectionChanged += delegate {
				HandleColorBoxSelectionChanged ();
			};
			lightBox.SelectionChanged += delegate {
				HandleColorBoxSelectionChanged ();
			};
			
			hueEntry.ValueChanged += HandleHslChanged;
			satEntry.ValueChanged += HandleHslChanged;
			lightEntry.ValueChanged += HandleHslChanged;
			redEntry.ValueChanged += HandleRgbChanged;
			greenEntry.ValueChanged += HandleRgbChanged;
			blueEntry.ValueChanged += HandleRgbChanged;
			alphaEntry.ValueChanged += HandleAlphaChanged;
			alphaSlider.ValueChanged += HandleAlphaChanged;
			
			Color = Colors.White;
		}
コード例 #34
0
ファイル: MessageDialogs.cs プロジェクト: m13253/xwt
		public MessageDialogs ()
		{
			Table table = new Table ();

			TextEntry txtPrimay = new TextEntry ();
			TextEntry txtSecondary = new TextEntry ();
			txtSecondary.MultiLine = true;
			ComboBox cmbType = new ComboBox ();
			cmbType.Items.Add ("Message");
			cmbType.Items.Add ("Question");
			cmbType.Items.Add ("Confirmation");
			cmbType.Items.Add ("Warning");
			cmbType.Items.Add ("Error");
			cmbType.SelectedIndex = 0;

			Button btnShowMessage = new Button ("Show Message");

			Label lblResult = new Label ();

			table.Add (new Label ("Primary Text:"), 0, 0);
			table.Add (txtPrimay, 1, 0, hexpand: true);
			table.Add (new Label ("Secondary Text:"), 0, 1);
			table.Add (txtSecondary, 1, 1, hexpand: true);
			table.Add (new Label ("Message Type:"), 0, 2);
			table.Add (cmbType, 1, 2, hexpand: true);

			table.Add (btnShowMessage, 1, 3, hexpand: true);
			table.Add (lblResult, 1, 4, hexpand: true);

			btnShowMessage.Clicked += (sender, e) => {

				switch (cmbType.SelectedText) {
					case "Message":
						MessageDialog.ShowMessage (this.ParentWindow, txtPrimay.Text, txtSecondary.Text);
						lblResult.Text = "Result: dialog closed";
						break;
					case "Question":
						var question = new QuestionMessage(txtPrimay.Text, txtSecondary.Text);
						question.Buttons.Add(new Command("Answer 1"));
						question.Buttons.Add(new Command("Answer 2"));
						question.DefaultButton = 1;
						question.AddOption ("option1", "Option 1", false);
						question.AddOption ("option2", "Option 2", true);
						var result = MessageDialog.AskQuestion (question);
						lblResult.Text = "Result: " + result.Id;
						if (question.GetOptionValue ("option1"))
							lblResult.Text += " + Option 1";
						if (question.GetOptionValue ("option2"))
							lblResult.Text += " + Option 2";
						break;
					case "Confirmation":
						var confirmation = new ConfirmationMessage (txtPrimay.Text, txtSecondary.Text, Command.Apply);
						confirmation.AddOption ("option1", "Option 1", false);
						confirmation.AddOption ("option2", "Option 2", true);
						confirmation.AllowApplyToAll = true;

						var success = MessageDialog.Confirm (confirmation);
						lblResult.Text = "Result: " + success;
						if (confirmation.GetOptionValue ("option1"))
							lblResult.Text += " + Option 1";
						if (confirmation.GetOptionValue ("option2"))
							lblResult.Text += " + Option 2";

						lblResult.Text += " + All: " + confirmation.AllowApplyToAll;
						break;
					case "Warning":
						MessageDialog.ShowWarning (this.ParentWindow, txtPrimay.Text, txtSecondary.Text);
						lblResult.Text = "Result: dialog closed";
						break;
					case "Error":
						MessageDialog.ShowError (this.ParentWindow, txtPrimay.Text, txtSecondary.Text);
						lblResult.Text = "Result: dialog closed";
						break;
				}
			};

			PackStart (table, true);
		}