Exemple #1
0
            protected override Size OnGetPreferredSize(SizeConstraint widthConstraint, SizeConstraint heightConstraint)
            {
                FrameBox parent = (FrameBox)Parent;
                Size     s      = new Size(parent.Padding.HorizontalSpacing + parent.BorderWidth.HorizontalSpacing, parent.Padding.VerticalSpacing + parent.BorderWidth.VerticalSpacing);

                if (child != null)
                {
                    s += child.Surface.GetPreferredSize(widthConstraint - s.Width, heightConstraint - s.Height, true);
                }
                return(s);
            }
Exemple #2
0
 protected override void OnReallocate()
 {
     if (child != null)
     {
         FrameBox  parent  = (FrameBox)Parent;
         Rectangle rect    = Bounds;
         var       padding = parent.padding;
         var       border  = parent.borderWidth;
         rect.X      += padding.Left + border.Left;
         rect.Y      += padding.Top + border.Top;
         rect.Width  -= padding.HorizontalSpacing + border.HorizontalSpacing;
         rect.Height -= padding.VerticalSpacing + border.VerticalSpacing;
         rect         = child.Surface.GetPlacementInRect(rect);
         SetChildBounds(child, rect);
     }
 }
Exemple #3
0
            protected override void OnDraw(Context ctx, Rectangle dirtyRect)
            {
                base.OnDraw(ctx, dirtyRect);

                FrameBox parent = (FrameBox)Parent;
                var      border = parent.borderWidth;
                var      r      = Bounds;

                //ctx.SetLineDash (0);
                ctx.SetColor(parent.borderColor);

                if (border.Top > 0)
                {
                    ctx.MoveTo(r.X, r.Y + border.Top / 2);
                    ctx.RelLineTo(r.Width, 0);
                    ctx.SetLineWidth(border.Top);
                    ctx.Stroke();
                }
                if (border.Bottom > 0)
                {
                    ctx.MoveTo(r.X, r.Bottom - border.Bottom / 2);
                    ctx.RelLineTo(r.Width, 0);
                    ctx.SetLineWidth(border.Bottom);
                    ctx.Stroke();
                }
                if (border.Left > 0)
                {
                    ctx.MoveTo(r.X + border.Left / 2, r.Y + border.Top);
                    ctx.RelLineTo(0, r.Height - border.Top - border.Bottom);
                    ctx.SetLineWidth(border.Left);
                    ctx.Stroke();
                }
                if (border.Right > 0)
                {
                    ctx.MoveTo(r.Right - border.Right / 2, r.Y + border.Top);
                    ctx.RelLineTo(0, r.Height - border.Top - border.Bottom);
                    ctx.SetLineWidth(border.Right);
                    ctx.Stroke();
                }
            }
Exemple #4
0
        public Frames()
        {
            Frame f = new Frame();
            f.Label = "Simple widget box";
            f.Content = new SimpleBox(50);

            PackStart(f);

            f = new Frame();
            f.Content = new Label("No label");
            PackStart(f);

            var fb = new FrameBox();
            fb.BorderWidthLeft = 1;
            fb.BorderWidthTop = 2;
            fb.BorderWidthRight = 3;
            fb.BorderWidthBottom = 4;
            fb.BorderColor = new Color(0, 0, 1);
            fb.Content = new Label("Custom");
            PackStart(fb);

            fb = new FrameBox();
            fb.BorderWidth = 2;
            fb.PaddingLeft = 10;
            fb.PaddingTop = 20;
            fb.PaddingRight = 30;
            fb.PaddingBottom = 40;
            fb.Content = new SimpleBox(50);
            PackStart(fb);

            fb = new FrameBox();
            fb.BorderWidth = 2;
            fb.Padding = 10;
            fb.Content = new Label("With red background");
            fb.BackgroundColor = new Color(1, 0, 0);
            PackStart(fb);
        }
		void Build ()
		{
			Title = Catalog.GetString ("Add Packages");
			Width = 820;
			Height = 520;
			Padding = new WidgetSpacing ();

			// Top part of dialog:
			// Package sources and search.
			var topHBox = new HBox ();
			topHBox.Margin = new WidgetSpacing (8, 5, 6, 5);

			packageSourceComboBox = new ComboBox ();
			packageSourceComboBox.MinWidth = 200;
			topHBox.PackStart (packageSourceComboBox);

			packageSearchEntry = new SearchTextEntry ();
			packageSearchEntry.WidthRequest = 187;
			topHBox.PackEnd (packageSearchEntry);

			this.HeaderContent = topHBox;

			// Middle of dialog:
			// Packages and package information.
			var mainVBox = new VBox ();
			Content = mainVBox;

			var middleHBox = new HBox ();
			middleHBox.Spacing = 0;
			var middleFrame = new FrameBox ();
			middleFrame.Content = middleHBox;
			middleFrame.BorderWidth = new WidgetSpacing (0, 0, 0, 1);
			middleFrame.BorderColor = lineBorderColor;
			mainVBox.PackStart (middleFrame, true, true);

			// Error information.
			var packagesListVBox = new VBox ();
			packagesListVBox.Spacing = 0;
			errorMessageHBox = new HBox ();
			errorMessageHBox.Margin = new WidgetSpacing ();
			errorMessageHBox.BackgroundColor = Colors.Orange;
			errorMessageHBox.Visible = false;
			var errorImage = new ImageView ();
			errorImage.Margin = new WidgetSpacing (10, 0, 0, 0);
			errorImage.Image = ImageService.GetIcon (Stock.Warning, Gtk.IconSize.Menu);
			errorImage.HorizontalPlacement = WidgetPlacement.End;
			errorMessageHBox.PackStart (errorImage);
			errorMessageLabel = new Label ();
			errorMessageLabel.TextColor = Colors.White;
			errorMessageLabel.Margin = new WidgetSpacing (5, 5, 5, 5);
			errorMessageLabel.Wrap = WrapMode.Word;
			errorMessageHBox.PackStart (errorMessageLabel, true);
			packagesListVBox.PackStart (errorMessageHBox);

			// Packages list.
			middleHBox.PackStart (packagesListVBox, true, true);
			packagesListView = new ListView ();
			packagesListView.BorderVisible = false;
			packagesListView.HeadersVisible = false;
			packagesListVBox.PackStart (packagesListView, true, true);

			// Loading spinner.
			var loadingSpinnerHBox = new HBox ();
			loadingSpinnerHBox.HorizontalPlacement = WidgetPlacement.Center;
			var loadingSpinner = new Spinner ();
			loadingSpinner.Animate = true;
			loadingSpinner.MinWidth = 20;
			loadingSpinnerHBox.PackStart (loadingSpinner);

			loadingSpinnerLabel = new Label ();
			loadingSpinnerLabel.Text = Catalog.GetString ("Loading package list...");
			loadingSpinnerHBox.PackEnd (loadingSpinnerLabel);

			loadingSpinnerFrame = new FrameBox ();
			loadingSpinnerFrame.Visible = false;
			loadingSpinnerFrame.BackgroundColor = Colors.White;
			loadingSpinnerFrame.Content = loadingSpinnerHBox;
			loadingSpinnerFrame.BorderWidth = new WidgetSpacing ();
			packagesListVBox.PackStart (loadingSpinnerFrame, true, true);

			// No packages found label.
			var noPackagesFoundHBox = new HBox ();
			noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

			var noPackagesFoundLabel = new Label ();
			noPackagesFoundLabel.Text = Catalog.GetString ("No matching packages found.");
			noPackagesFoundHBox.PackEnd (noPackagesFoundLabel);

			noPackagesFoundFrame = new FrameBox ();
			noPackagesFoundFrame.Visible = false;
			noPackagesFoundFrame.BackgroundColor = Colors.White;
			noPackagesFoundFrame.Content = noPackagesFoundHBox;
			noPackagesFoundFrame.BorderWidth = new WidgetSpacing ();
			packagesListVBox.PackStart (noPackagesFoundFrame, true, true);

			// Package information
			packageInfoVBox = new VBox ();
			var packageInfoFrame = new FrameBox ();
			packageInfoFrame.BackgroundColor = packageInfoBackgroundColor;
			packageInfoFrame.BorderWidth = new WidgetSpacing ();
			packageInfoFrame.Content = packageInfoVBox;
			packageInfoVBox.Margin = new WidgetSpacing (15, 12, 15, 12);
			var packageInfoContainerVBox = new VBox ();
			packageInfoContainerVBox.WidthRequest = 240;
			packageInfoContainerVBox.PackStart (packageInfoFrame, true, true);

			var packageInfoScrollView = new ScrollView ();
			packageInfoScrollView.BorderVisible = false;
			packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
			packageInfoScrollView.Content = packageInfoContainerVBox;
			packageInfoScrollView.BackgroundColor = packageInfoBackgroundColor;
			var packageInfoScrollViewFrame = new FrameBox ();
			packageInfoScrollViewFrame.BackgroundColor = packageInfoBackgroundColor;
			packageInfoScrollViewFrame.BorderWidth = new WidgetSpacing (1, 0, 0, 0);
			packageInfoScrollViewFrame.BorderColor = lineBorderColor;
			packageInfoScrollViewFrame.Content = packageInfoScrollView;
			middleHBox.PackEnd (packageInfoScrollViewFrame);

			// Package name and version.
			var packageNameHBox = new HBox ();
			packageInfoVBox.PackStart (packageNameHBox);

			packageNameLabel = new Label ();
			packageNameLabel.Ellipsize = EllipsizeMode.End;
			Font packageInfoSmallFont = packageNameLabel.Font.WithScaledSize (0.8);
			packageNameHBox.PackStart (packageNameLabel, true);

			packageVersionLabel = new Label ();
			packageVersionLabel.TextAlignment = Alignment.End;
			packageNameHBox.PackEnd (packageVersionLabel);

			// Package description.
			packageDescription = new Label ();
			packageDescription.Wrap = WrapMode.Word;
			packageDescription.Font = packageNameLabel.Font.WithScaledSize (0.9);
			packageDescription.BackgroundColor = packageInfoBackgroundColor;
			packageInfoVBox.PackStart (packageDescription);

			// Package id.
			var packageIdHBox = new HBox ();
			packageIdHBox.MarginTop = 7;
			packageInfoVBox.PackStart (packageIdHBox);

			var packageIdLabel = new Label ();
			packageIdLabel.Font = packageInfoSmallFont;
			packageIdLabel.Markup = Catalog.GetString ("<b>Id</b>");
			packageIdHBox.PackStart (packageIdLabel);

			packageId = new Label ();
			packageId.Ellipsize = EllipsizeMode.End;
			packageId.TextAlignment = Alignment.End;
			packageId.Font = packageInfoSmallFont;
			packageIdLink = new LinkLabel ();
			packageIdLink.Ellipsize = EllipsizeMode.End;
			packageIdLink.TextAlignment = Alignment.End;
			packageIdLink.Font = packageInfoSmallFont;
			packageIdHBox.PackEnd (packageIdLink, true);
			packageIdHBox.PackEnd (packageId, true);

			// Package author
			var packageAuthorHBox = new HBox ();
			packageInfoVBox.PackStart (packageAuthorHBox);

			var packageAuthorLabel = new Label ();
			packageAuthorLabel.Markup = Catalog.GetString ("<b>Author</b>");
			packageAuthorLabel.Font = packageInfoSmallFont;
			packageAuthorHBox.PackStart (packageAuthorLabel);

			packageAuthor = new Label ();
			packageAuthor.TextAlignment = Alignment.End;
			packageAuthor.Ellipsize = EllipsizeMode.End;
			packageAuthor.Font = packageInfoSmallFont;
			packageAuthorHBox.PackEnd (packageAuthor, true);

			// Package published
			var packagePublishedHBox = new HBox ();
			packageInfoVBox.PackStart (packagePublishedHBox);

			var packagePublishedLabel = new Label ();
			packagePublishedLabel.Markup = Catalog.GetString ("<b>Published</b>");
			packagePublishedLabel.Font = packageInfoSmallFont;
			packagePublishedHBox.PackStart (packagePublishedLabel);

			packagePublishedDate = new Label ();
			packagePublishedDate.Font = packageInfoSmallFont;
			packagePublishedHBox.PackEnd (packagePublishedDate);

			// Package downloads
			var packageDownloadsHBox = new HBox ();
			packageInfoVBox.PackStart (packageDownloadsHBox);

			var packageDownloadsLabel = new Label ();
			packageDownloadsLabel.Markup = Catalog.GetString ("<b>Downloads</b>");
			packageDownloadsLabel.Font = packageInfoSmallFont;
			packageDownloadsHBox.PackStart (packageDownloadsLabel);

			packageDownloads = new Label ();
			packageDownloads.Font = packageInfoSmallFont;
			packageDownloadsHBox.PackEnd (packageDownloads);

			// Package license.
			var packageLicenseHBox = new HBox ();
			packageInfoVBox.PackStart (packageLicenseHBox);

			var packageLicenseLabel = new Label ();
			packageLicenseLabel.Markup = Catalog.GetString ("<b>License</b>");
			packageLicenseLabel.Font = packageInfoSmallFont;
			packageLicenseHBox.PackStart (packageLicenseLabel);

			packageLicenseLink = new LinkLabel ();
			packageLicenseLink.Text = Catalog.GetString ("View License");
			packageLicenseLink.Font = packageInfoSmallFont;
			packageLicenseHBox.PackEnd (packageLicenseLink);

			// Package project page.
			var packageProjectPageHBox = new HBox ();
			packageInfoVBox.PackStart (packageProjectPageHBox);

			var packageProjectPageLabel = new Label ();
			packageProjectPageLabel.Markup = Catalog.GetString ("<b>Project Page</b>");
			packageProjectPageLabel.Font = packageInfoSmallFont;
			packageProjectPageHBox.PackStart (packageProjectPageLabel);

			packageProjectPageLink = new LinkLabel ();
			packageProjectPageLink.Text = Catalog.GetString ("Visit Page");
			packageProjectPageLink.Font = packageInfoSmallFont;
			packageProjectPageHBox.PackEnd (packageProjectPageLink);

			// Package dependencies
			var packageDependenciesHBox = new HBox ();
			packageInfoVBox.PackStart (packageDependenciesHBox);

			var packageDependenciesLabel = new Label ();
			packageDependenciesLabel.Markup = Catalog.GetString ("<b>Dependencies</b>");
			packageDependenciesLabel.Font = packageInfoSmallFont;
			packageDependenciesHBox.PackStart (packageDependenciesLabel);

			packageDependenciesNoneLabel = new Label ();
			packageDependenciesNoneLabel.Text = Catalog.GetString ("None");
			packageDependenciesNoneLabel.Font = packageInfoSmallFont;
			packageDependenciesHBox.PackEnd (packageDependenciesNoneLabel);

			// Package dependencies list.
			packageDependenciesListHBox = new HBox ();
			packageDependenciesListHBox.Visible = false;
			packageInfoVBox.PackStart (packageDependenciesListHBox);

			packageDependenciesList = new Label ();
			packageDependenciesList.Wrap = WrapMode.WordAndCharacter;
			packageDependenciesList.Margin = new WidgetSpacing (5);
			packageDependenciesList.Font = packageInfoSmallFont;
			packageDependenciesListHBox.PackStart (packageDependenciesList, true);

			// Bottom part of dialog:
			// Show pre-release packages and Close/Add to Project buttons.
			var bottomHBox = new HBox ();
			bottomHBox.Margin = new WidgetSpacing (8, 5, 14, 10);
			bottomHBox.Spacing = 5;
			mainVBox.PackStart (bottomHBox);

			showPrereleaseCheckBox = new CheckBox ();
			showPrereleaseCheckBox.Label = Catalog.GetString ("Show pre-release packages");
			bottomHBox.PackStart (showPrereleaseCheckBox);

			addPackagesButton = new Button ();
			addPackagesButton.MinWidth = 120;
			addPackagesButton.MinHeight = 25;
			addPackagesButton.Label = Catalog.GetString ("Add Package");
			bottomHBox.PackEnd (addPackagesButton);

			var closeButton = new Button ();
			closeButton.MinWidth = 120;
			closeButton.MinHeight = 25;
			closeButton.Label = Catalog.GetString ("Close");
			closeButton.Clicked += (sender, e) => Close ();
			bottomHBox.PackEnd (closeButton);

			packageSearchEntry.SetFocus ();
			packageInfoVBox.Visible = false;
		}
		public ExtendedHeaderBox (string title, string subtitle = null, Image image = null)
		{
			var headerBox = new HBox ();
			headerBox.Spacing = 0;

			headerTitle = new Label ();
			var font = headerTitle.Font;
			headerTitle.Font = font.WithSize (16);

			headerSeparator = new Label (" – ") {
				TextColor = Styles.SecondaryTextColor,
				Font = font.WithSize (14),
			};

			headerSubtitle = new Label {
				TextColor = Styles.SecondaryTextColor,
				Font = font.WithSize (14),
			};

			backButton = new Button ();
			backButton.Style = ButtonStyle.Flat;
			backButton.MarginRight = 6;
			backButton.Visible = false;
			backButton.Clicked += (sender, e) => BackButtonClicked?.Invoke (this, EventArgs.Empty);


			headerBox.PackStart (backButton);
			headerBox.PackStart (headerTitle);
			headerBox.PackStart (headerSeparator);
			headerBox.PackStart (headerSubtitle);

			frame = new FrameBox {
				Content = headerBox,
			};

			Title = title;
			Image = image;
			Subtitle = subtitle;

			BackgroundColor = Styles.BaseBackgroundColor;
			BorderColor = Styles.ThinSplitterColor;
			Padding = 15;
			BorderWidthBottom = 1;

			Content = frame;
		}
		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 ();
			var frame = new FrameBox {
				Content = img1,
				BorderColor = Xwt.Drawing.Colors.Gray,
				BorderWidth = 1
			};
			table.Add (frame, 0, 2, hexpand:true, vexpand:true, hpos:WidgetPlacement.Center, vpos:WidgetPlacement.Center);
			
			imgDiff = new ImageView ();
			frame = new FrameBox {
				Content = imgDiff,
				BorderColor = Xwt.Drawing.Colors.Gray,
				BorderWidth = 1
			};
			table.Add (frame, 1, 2, hexpand:true, vexpand:true, hpos:WidgetPlacement.Center, vpos:WidgetPlacement.Center);

			img2 = new ImageView ();
			frame = new FrameBox {
				Content = img2,
				BorderColor = Xwt.Drawing.Colors.Gray,
				BorderWidth = 1
			};
			table.Add (frame, 2, 2, hexpand:true, vexpand:true, hpos:WidgetPlacement.Center, vpos:WidgetPlacement.Center);

			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 ();
		}
Exemple #8
0
		public TextEntries ()
		{
			TextEntry te1 = new TextEntry ();
			PackStart (te1);
			te1.BackgroundColor = Xwt.Drawing.Colors.Red;
			
			Label la = new Label ();
			PackStart (la);
			te1.Changed += delegate {
				la.Text = "Text: " + te1.Text;
			};

			HBox selBox = new HBox ();

			Label las = new Label ("Selection:");
			selBox.PackStart (las);
			Button selReplace = new Button ("Replace");
			selReplace.Clicked += delegate {
				te1.SelectedText = "[TEST]";
			};
			selBox.PackEnd (selReplace);
			Button selAll = new Button ("Select all");
			selAll.Clicked += delegate {
				te1.SelectionStart = 0;
				te1.SelectionLength = te1.Text.Length;
			};
			selBox.PackEnd (selAll);
			Button selPlus = new Button ("+");
			selPlus.Clicked += delegate {
				te1.SelectionLength++;
			};
			selBox.PackEnd (selPlus);
			Button selRight = new Button (">");
			selRight.Clicked += delegate {
				te1.SelectionStart++;
			};
			selBox.PackEnd (selRight);
			PackStart (selBox);

			te1.SelectionChanged += delegate {
				las.Text = "Selection: (" + te1.CursorPosition + " <-> " + te1.SelectionStart + " + " + te1.SelectionLength + ") " + te1.SelectedText;
			};
			
			PackStart (new Label ("Entry with small font"));
			TextEntry te2 = new TextEntry ();
			te2.Font = te2.Font.WithScaledSize (0.5);
			te2.PlaceholderText = "Placeholder text";
			PackStart (te2);

			PackStart (new TextEntry { Text = "Entry with custom height", MinHeight = 50 });

			PackStart (new TextEntry { Text = "Readonly text", ReadOnly = true });
			
			PackStart (new Label ("Entry with placeholder text"));
			TextEntry te3 = new TextEntry ();
			te3.PlaceholderText = "Placeholder text";
			PackStart (te3);

			PackStart (new Label ("Entry with no frame"));
			TextEntry te4 = new TextEntry();
			te4.ShowFrame = false;
			PackStart (te4);

			PackStart (new Label ("Entry with custom frame"));
			FrameBox teFrame = new FrameBox ();
			teFrame.BorderColor = Xwt.Drawing.Colors.Red;
			teFrame.BorderWidth = 1;
			teFrame.Content = new TextEntry () { ShowFrame = false };
			PackStart (teFrame);

			TextEntry te5 = new TextEntry ();
			te5.Text = "I should be centered!";
			te5.TextAlignment = Alignment.Center;
			te5.PlaceholderText = "Placeholder text";
			PackStart (te5);

			TextEntry te6 = new TextEntry ();
			te6.Text = "I should have" + Environment.NewLine + "multiple lines!";
			te6.PlaceholderText = "Placeholder text";
			te6.MultiLine = true;
			te6.MinHeight = 40;
			PackStart (te6);

			try {
				SearchTextEntry te7 = new SearchTextEntry ();
				te7.PlaceholderText = "Type to search ...";
				PackStart (te7);

				SearchTextEntry te8 = new SearchTextEntry ();
				te8.PlaceholderText = "I should have no frame";
				te8.ShowFrame = false;
				PackStart (te8);
			} catch (InvalidOperationException ex) {
				Console.WriteLine (ex);
			}
		}
Exemple #9
0
        /// <summary>
        /// Initializes the control bars.
        /// </summary>
        void InitializeControllerbar()
        {
            HBox controllbar = new HBox();
            controllbar.Spacing = 0;

            playButton = new ControllButton(Image.FromResource("Baimp.Resources.icoExecute-Normal.png"));
            playButton.Size = new Size(24, 24);
            playButton.TooltipText = "Execute pipeline";

            playButton.ButtonPressed += delegate {
                if (currentPipeline.Execute(project)) {
                    playButton.Disable();
                    stopButton.Enable();
                }
            };

            stopButton = new ControllButton(Image.FromResource("Baimp.Resources.icoStop-Normal.png"));
            stopButton.Size = playButton.Size;
            stopButton.TooltipText = "Stop pipeline execution";
            stopButton.ButtonPressed += delegate {
                currentPipeline.StopExecution();
                stopButton.Disable();
            };

            playStopButtonPlacement = new FrameBox();
            playStopButtonPlacement.Content = playButton;

            controllbar.PackStart(
                playStopButtonPlacement, false, WidgetPlacement.Center, WidgetPlacement.Center, 8);

            // tab bar
            tabHost = new CustomTabHost();
            tabHost.Closeable = true;
            tabHost.HeightRequest = 24;

            tabHost.TabClose += OnTabClose;

            controllbar.PackStart(tabHost, false, WidgetPlacement.End, WidgetPlacement.Start);

            // tab add worksheet
            ImageView addWorksheet = new ImageView();
            addWorksheet.Image = Image.FromResource("Baimp.Resources.btAdd.png").WithBoxSize(14);
            addWorksheet.MouseEntered += delegate {
                addWorksheet.Image = addWorksheet.Image.WithAlpha(0.8);
            };
            addWorksheet.MouseExited += delegate {
                addWorksheet.Image = addWorksheet.Image.WithAlpha(1.0);
            };
            addWorksheet.ButtonPressed += OnWorksheetAdd;

            controllbar.PackStart(addWorksheet, false, WidgetPlacement.Center, WidgetPlacement.Start);

            splitControllTab_pipelineScroller = new VBox();
            splitControllTab_pipelineScroller.Spacing = 0;
            splitControllTab_pipelineScroller.PackStart(controllbar, false, margin: 0.0);

            ReloadProjectMap();
        }
		public XwtSourcePageWidget (XwtSourceWizardPage page)
		{
			Page = page;

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

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

			CheckBox chkGitSubmodule = null;

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

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

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

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

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

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


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

			tblSource.Add (tblGithubRepo, 0, 1);

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

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

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

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

			PackStart (rightFrame, false, false);
			UpdateForks ();
			UpdateBranches ("mono/xwt");
		}
Exemple #11
0
		public WizardDialog (IWizardDialogController controller)
		{
			Controller = controller;
			Dialog = new Dialog ();

			Dialog.Name = "wizard_dialog";
			Dialog.Resizable = false;
			Dialog.Padding = 0;

			if (string.IsNullOrEmpty (controller.Title))
				Dialog.Title = BrandingService.ApplicationName;
			else
				Dialog.Title = controller.Title;

			// FIXME: Gtk dialogs don't support ThemedImage
			//if (controller.Image != null)
			//	Dialog.Icon = controller.Image.WithSize (IconSize.Large);
			
			Dialog.ShowInTaskbar = false;
			Dialog.Shown += HandleDialogShown;
			Dialog.CloseRequested += HandleDialogCloseRequested;

			container = new VBox ();
			container.Spacing = 0;

			header = new MonoDevelop.Components.ExtendedHeaderBox (controller.Title, null, controller.Icon);
			header.BackgroundColor = Styles.Wizard.BannerBackgroundColor;
			header.TitleColor = Styles.Wizard.BannerForegroundColor;
			header.SubtitleColor = Styles.Wizard.BannerSecondaryForegroundColor;
			header.BorderColor = Styles.Wizard.BannerShadowColor;

			buttonBox = new HBox ();
			var buttonFrame = new FrameBox (buttonBox);
			buttonFrame.Padding = 20;
			buttonFrame.PaddingRight = 0;

			cancelButton = new Button (GettextCatalog.GetString ("Cancel"));
			cancelButton.Clicked += HandleCancelButtonClicked;
			backButton = new Button (GettextCatalog.GetString ("Back"));
			backButton.Clicked += HandleBackButtonClicked;
			nextButton = new Button (GettextCatalog.GetString ("Next"));
			nextButton.Clicked += HandleNextButtonClicked;
			statusImage = new ImageView (ImageService.GetIcon ("md-empty", Gtk.IconSize.Button));

			if (Toolkit.CurrentEngine.Type == ToolkitType.XamMac) {
				var s = cancelButton.Surface.GetPreferredSize ();
				cancelButton.MinWidth = Math.Max (s.Width + 16, 100);
				s = backButton.Surface.GetPreferredSize ();
				backButton.MinWidth = Math.Max (s.Width + 16, 100);
				s = nextButton.Surface.GetPreferredSize ();
				nextButton.MinWidth = Math.Max (s.Width + 16, 100);
				buttonBox.Spacing = 0;
				statusImage.MarginRight = 6;
				#if MAC
				var nativeNext = nextButton.Surface.NativeWidget as AppKit.NSButton;
				nativeNext.KeyEquivalent = "\r";
				#endif
			} else {
				cancelButton.MinWidth = 70;
				backButton.MinWidth = 70;
				nextButton.MinWidth = 70;
				statusImage.MarginRight = 3;
			}

			if (ImageService.IsAnimation ("md-spinner-18", Gtk.IconSize.Button)) {
				animatedStatusIcon = ImageService.GetAnimatedIcon ("md-spinner-18", Gtk.IconSize.Button);
			}

			buttonBox.PackStart (cancelButton, false, false);
			buttonBox.PackEnd (statusImage, false, false);
			buttonBox.PackEnd (nextButton, false, false);
			buttonBox.PackEnd (backButton, false, false);
			statusImage.VerticalPlacement = cancelButton.VerticalPlacement = nextButton.VerticalPlacement = backButton.VerticalPlacement = WidgetPlacement.Center;

			container.PackStart (header);

			var contentHBox = new HBox ();
			contentHBox.Spacing = 0;

			currentPageFrame = new FrameBox ();
			currentPageFrame.BackgroundColor = Styles.Wizard.PageBackgroundColor;
			contentHBox.PackStart (currentPageFrame, true, true);

			rightSideFrame = new FrameBox () { Visible = false };
			//rightSideFrame.BorderColor = Styles.Wizard.ContentSeparatorColor;
			//rightSideFrame.BorderWidthLeft = 1;
			rightSideFrame.WidthRequest = RightSideWidgetWidth;
			rightSideFrame.BackgroundColor = Styles.Wizard.RightSideBackgroundColor;
			contentHBox.PackEnd (rightSideFrame, false, true);
			rightSideFrame.VerticalPlacement = rightSideFrame.HorizontalPlacement = WidgetPlacement.Fill;

			var contentFrame = new FrameBox (contentHBox);
			contentFrame.Padding = 0;
			contentFrame.BorderColor = Styles.Wizard.ContentShadowColor;
			contentFrame.BorderWidth = 0;
			contentFrame.BorderWidthBottom = 1;

			container.PackStart (contentFrame, true, true);
			container.PackEnd (buttonFrame);

			Dialog.Content = container;

			if (Toolkit.CurrentEngine.Type == ToolkitType.Gtk) {
				var nativeNext = nextButton.Surface.NativeWidget as Gtk.Button;
				nativeNext.CanDefault = true;
				nativeNext.GrabDefault ();
			}

			CurrentPage = controller.CurrentPage;

			controller.PropertyChanged += HandleControllerPropertyChanged;
			controller.Completed += HandleControllerCompleted;
		}
Exemple #12
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();
            var frame = new FrameBox {
                Content     = img1,
                BorderColor = Xwt.Drawing.Colors.Gray,
                BorderWidth = 1
            };

            table.Add(frame, 0, 2, hexpand: true, vexpand: true, hpos: WidgetPlacement.Center, vpos: WidgetPlacement.Center);

            imgDiff = new ImageView();
            frame   = new FrameBox {
                Content     = imgDiff,
                BorderColor = Xwt.Drawing.Colors.Gray,
                BorderWidth = 1
            };
            table.Add(frame, 1, 2, hexpand: true, vexpand: true, hpos: WidgetPlacement.Center, vpos: WidgetPlacement.Center);

            img2  = new ImageView();
            frame = new FrameBox {
                Content     = img2,
                BorderColor = Xwt.Drawing.Colors.Gray,
                BorderWidth = 1
            };
            table.Add(frame, 2, 2, hexpand: true, vexpand: true, hpos: WidgetPlacement.Center, vpos: WidgetPlacement.Center);

            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();
        }