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 ();
		}
Пример #2
0
        public Tables()
        {
            Table t = new Table ();

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

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

            b = new SimpleBox (250, 20);
            t.Attach (b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand);

            b = new SimpleBox (300, 20);
            t.Attach (b, 1, 3, 2, 3);

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

            b = new SimpleBox (450, 20);
            t.Attach (b, 0, 3, 4, 5);

            PackStart (t);

            HBox box = new HBox ();
            PackStart (box);
            t = new Table ();
            t.Attach (new Label ("One:"), 0, 1, 0, 1);
            t.Attach (new TextEntry (), 1, 2, 0, 1);
            t.Attach (new Label ("Two:"), 0, 1, 1, 2);
            t.Attach (new TextEntry (), 1, 2, 1, 2);
            t.Attach (new Label ("Three:"), 0, 1, 2, 3);
            t.Attach (new TextEntry (), 1, 2, 2, 3);
            box.PackStart (t);
        }
Пример #3
0
        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.Attach (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
                table.Attach (new ComboBox (), 1, 0, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
                table.Attach (new ComboBox (), 1, 1, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
                table.Attach (new ComboBox (), 1, 2, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
                table.Attach (new SpinButton (), 1, 3, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

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

                table.Margin = 20;
                popover.Content = table;
            }
            //			popover.Padding.SetAll (20);
            popover.Show (Popover.Position.Top, (Button)sender);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Baimp.MetadataView"/> class.
        /// </summary>
        /// <remarks>
        /// Call <see cref="Baimp.MetadataView.Load"></see> to actual see the metadata information/> 
        /// </remarks>
        public MetadataView()
        {
            table = new Table();
            this.PackStart(table, true);

            widgets = new Dictionary<int, Widget>[2];
            widgets[0] = new Dictionary<int, Widget>();
            widgets[1] = new Dictionary<int, Widget>();
        }
Пример #5
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 ();
        }
Пример #6
0
        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));
        }
 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);
 }
        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();
        }
Пример #9
0
        public Windows()
        {
            Button b = new Button ("Show borderless window");
            PackStart (b);
            b.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 = b.ScreenBounds;
                w.Bounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Bounds.Width, w.Bounds.Height);
                w.Show ();
            };
            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.Attach (new Label ("Some field:"), 0, 1, 0, 1);
                t.Attach (new TextEntry (), 1, 2, 0, 1);
                t.Attach (new Label ("Another field:"), 0, 1, 1, 2);
                t.Attach (new TextEntry (), 1, 2, 1, 2);
                d.Content = t;

                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.Label;
                d.Dispose ();
            };
        }
Пример #10
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;
        }
Пример #11
0
        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);
        }
Пример #12
0
        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);
        }
Пример #13
0
        public Tables()
        {
            Table t = new Table ();

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

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

            b = new SimpleBox (250, 20);
            t.Attach (b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand);

            b = new SimpleBox (300, 20);
            t.Attach (b, 1, 3, 2, 3);

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

            b = new SimpleBox (450, 20);
            t.Attach (b, 0, 3, 4, 5);

            PackStart (t);

            HBox box = new HBox ();
            PackStart (box);
            t = new Table ();
            t.Attach (new Label ("One:"), 0, 1, 0, 1);
            t.Attach (new TextEntry (), 1, 2, 0, 1);
            t.Attach (new Label ("Two:"), 0, 1, 1, 2);
            t.Attach (new TextEntry (), 1, 2, 1, 2);
            t.Attach (new Label ("Three:"), 0, 1, 2, 3);
            t.Attach (new TextEntry (), 1, 2, 2, 3);
            t.InsertRow (1, 2);
            t.Attach (new Label ("One-and-a-half"), 0, 1, 1, 2);
            t.Attach (new TextEntry () { PlaceholderText = "Just inserted" }, 1, 2, 1, 2);
            t.InsertRow (1, 2);
            t.Attach (new SimpleBox (300, 20), 0, 2, 1, 2);
            box.PackStart (t);
        }
Пример #14
0
        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;
        }
Пример #15
0
		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));
		}
        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;
        }
Пример #17
0
        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;
        }
        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;
        }
Пример #19
0
        public Windows()
        {
            Button b = new Button ("Show borderless window");
            PackStart (b);
            b.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 = b.ScreenBounds;
                w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Width, w.Height);
                w.Show ();
            };
            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.Attach (new Label ("Some field:"), 0, 1, 0, 1);
                t.Attach (new TextEntry (), 1, 2, 0, 1);
                t.Attach (new Label ("Another field:"), 0, 1, 1, 2);
                t.Attach (new TextEntry (), 1, 2, 1, 2);
                d.Content = t;

                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.Label;
                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 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();

            };
        }
Пример #20
0
		public override Widget CreateWidget ()
		{
			var t = new Table ();
			t.Add (new Label ("Hello Worlds"), 0, 0);
			return t;
		}
Пример #21
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.Attach (hsBox, 0, 0);
            selBox.Attach (lightBox, 1, 0);

            box.PackStart (selBox);

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

            entryTable.Attach (new Label ("Color:"), 0, 0);
            entryTable.Attach (colorBox, 1, 5, 0, 1);
            entryTable.Attach (new HSeparator (), 0, 5, 1, 2);

            int r = 2;
            entryTable.Attach (new Label ("Hue:"), 0, r);
            entryTable.Attach (hueEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++);

            entryTable.Attach (new Label ("Saturation:"), 0, r);
            entryTable.Attach (satEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++);

            entryTable.Attach (new Label ("Light:"), 0, r);
            entryTable.Attach (lightEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++);

            r = 2;
            entryTable.Attach (new Label ("Red:"), 3, r);
            entryTable.Attach (redEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++);

            entryTable.Attach (new Label ("Green:"), 3, r);
            entryTable.Attach (greenEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++);

            entryTable.Attach (new Label ("Blue:"), 3, r);
            entryTable.Attach (blueEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++);

            Label label;
            entryTable.Attach (alphaSeparator = new HSeparator (), 0, 5, r, ++r);
            entryTable.Attach (label = new Label ("Opacity:"), 0, r);
            entryTable.Attach (alphaEntry = new TextEntry () { MinWidth = entryWidth }, 1, 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.Changed += HandleHslChanged;
            satEntry.Changed += HandleHslChanged;
            lightEntry.Changed += HandleHslChanged;
            redEntry.Changed += HandleRgbChanged;
            greenEntry.Changed += HandleRgbChanged;
            blueEntry.Changed += HandleRgbChanged;
            alphaEntry.Changed += HandleAlphaChanged;

            Color = Colors.White;
        }
Пример #22
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;
 }
Пример #23
0
		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);
		}
Пример #24
0
		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);
		}
        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();
        }
Пример #26
0
        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;
        }
Пример #27
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;
        }
Пример #28
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;
        }
Пример #29
0
        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 ();
            };
        }
Пример #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
        /// <summary>
        /// builds dialog window
        /// </summary>
        void BuildContent()
        {
            Table table = new Table ();

            _jackdPathEntry = BuildRow (table, 0, I18N._ ("Jackd Startup Path"), I18N._ ("e.g. /usr/bin/jackd"));
            _jackdPathEntry.FileSelector ();
            _jackdGeneralOptionsEntry = BuildRow (table, 1, I18N._ ("General Options"), I18N._ ("optional"));
            _jackdDriverEntry = BuildRow (table, 2, I18N._ ("Driver Infrastructure"), I18N._ ("e.g. alsa"));
            _jackdDriverOptionsEntry = BuildRow (table, 3, I18N._ ("Driver Options"), I18N._ ("optional"));

            HBox buttonBox = new HBox ();
            _okButton = new Button (I18N._ ("Save")) { Image = Icons.Ok };
            _cancelButton = new Button (I18N._ ("Cancel")) {
                Image = Icons.Cancel,
                      Style = ButtonStyle.Flat
            };
            buttonBox.PackStart (_cancelButton);
            buttonBox.PackEnd (_okButton);

            VBox box = new VBox ();
            box.PackStart (table);
            box.PackEnd (buttonBox);
            Content = box;
        }