Exemple #1
0
        void Init()
        {
            _colorBox = new FrameBox
            {
                BorderColor   = Colors.Black,
                HeightRequest = 220,
                WidthRequest  = 100
            };

            _hexTextEntry = new TextEntry
            {
                ReadOnly = true
            };

            _rgbBox = new HBox();

            _rTextEntry = new TextEntry
            {
                ReadOnly = true
            };

            _gTextEntry = new TextEntry
            {
                ReadOnly = true
            };

            _bTextEntry = new TextEntry
            {
                ReadOnly = true
            };
        }
        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),
            };
            headerSeparator.Accessible.IsAccessible = false;

            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;
        }
Exemple #3
0
        public ScaffolderWizard(DotNetProject project, FilePath parentFolder) : base("Add New Scaffolded Item", StockIcons.Information, new ScaffolderTemplateSelectPage(args), args)
        {
            this.DefaultPageSize = new Size(500, 400);

            var rightSideImage  = new Xwt.ImageView(Image.FromResource("aspnet-wizard-page.png"));
            var rightSideWidget = new FrameBox(rightSideImage);

            rightSideWidget.BackgroundColor = Styles.Wizard.PageBackgroundColor;
            this.RightSideWidget            = new XwtControl(rightSideWidget);
            this.Completed   += (sender, e) => Task.Run(() => OnCompletedAsync());
            this.project      = project;
            this.parentFolder = parentFolder;
            args.Project      = project;
            args.ParentFolder = parentFolder;
        }
Exemple #4
0
        public ScaffolderWizard(DotNetProject project, FilePath parentFolder, ScaffolderTemplateSelectPage selectPage, ScaffolderArgs args) : base(GettextCatalog.GetString("Add New Scaffolding"), selectPage, args)
        {
            this.DefaultPageSize = new Size(500, 400);

            var rightSideImage  = new Xwt.ImageView(Image.FromResource("aspnet-wizard-page.png"));
            var rightSideWidget = new FrameBox(rightSideImage);

            rightSideWidget.BackgroundColor = Styles.Wizard.PageBackgroundColor;
            this.RightSideWidget            = new XwtControl(rightSideWidget);
            this.project      = project;
            this.parentFolder = parentFolder;
            this.args         = args;
            args.Project      = project;
            args.ParentFolder = parentFolder;

            this.Completed += (_, __) => Task.Run(() => OnCompletedAsync());
            selectPage.ScaffolderSelected -= ScaffolderSelected;
            selectPage.ScaffolderSelected += ScaffolderSelected;
        }
        private void scroll_ValueChanged(object sender, EventArgs e)
        {
            int   squareDimension = 50;
            int   y     = pictureBox.Height;
            int   x     = pictureBox.Width / 2;
            Color temp  = getScrollColor();
            Brush brush = new SolidBrush(temp);

            g.FillRectangle(brush, x - squareDimension / 2, y - squareDimension, squareDimension, squareDimension);
            updateScreen();
            if (isNewFrame == false)
            {
                Frame temp1 = new Frame(numberOfPixels);
                temp1.frameName = FrameBox.GetItemText(FrameBox.SelectedItem);
                frames.Add(temp1);
                frame                  = temp1;
                isNewFrame             = true;
                FrameBox.DropDownStyle = ComboBoxStyle.DropDown;
                FrameBox.Items.Add("NewFrame" + FrameBox.Items.Count.ToString());
                FrameBox.SelectedIndex = FrameBox.Items.Count - 1;
            }
        }
Exemple #6
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);
        }
    private void Update()
    {
        if (!isAvatar)
        {
            return;
        }

        FrameDuration += Time.deltaTime;

        if (FrameDuration >= DestDuration)
        {
            FrameDuration = 0;

            if (framePool.Count > 0)
            {
                DestDuration = playTime / (framePool.Count <= ThresholdFrame ? 1 : framePool.Count / ThresholdFrame);

                var framedata = framePool.Dequeue();

                TSVector movement = TSVector.zero;
                bool     space    = false;

                foreach (var item in framedata.Value.operation)
                {
                    if (item.cmd_type != (UInt32)CMD.BOX)
                    {
                        continue;
                    }

                    FrameBox msg = FrameProto.decode(item) as FrameBox;
                    movement = msg.movement;
                    space    = msg.space;
                }
                //KBEngine.Event.fireOut("recieveFrameTick", new object[] {entity.id, movement, space });
            }
        }
    }
        void Build()
        {
            Title   = GettextCatalog.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 = GettextCatalog.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 = GettextCatalog.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 = GettextCatalog.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 = GettextCatalog.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 = GettextCatalog.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 = GettextCatalog.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 = GettextCatalog.GetString("<b>License</b>");
            packageLicenseLabel.Font   = packageInfoSmallFont;
            packageLicenseHBox.PackStart(packageLicenseLabel);

            packageLicenseLink      = new LinkLabel();
            packageLicenseLink.Text = GettextCatalog.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 = GettextCatalog.GetString("<b>Project Page</b>");
            packageProjectPageLabel.Font   = packageInfoSmallFont;
            packageProjectPageHBox.PackStart(packageProjectPageLabel);

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

            // Package dependencies
            var packageDependenciesHBox = new HBox();

            packageInfoVBox.PackStart(packageDependenciesHBox);

            var packageDependenciesLabel = new Label();

            packageDependenciesLabel.Markup = GettextCatalog.GetString("<b>Dependencies</b>");
            packageDependenciesLabel.Font   = packageInfoSmallFont;
            packageDependenciesHBox.PackStart(packageDependenciesLabel);

            packageDependenciesNoneLabel      = new Label();
            packageDependenciesNoneLabel.Text = GettextCatalog.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 = GettextCatalog.GetString("Show pre-release packages");
            bottomHBox.PackStart(showPrereleaseCheckBox);

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

            var closeButton = new Button();

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

            packageSearchEntry.SetFocus();
            packageInfoVBox.Visible = false;
        }
Exemple #9
0
        void Build(string description, params InfoBarItem[] items)
        {
            var mainBox = new HBox {
                BackgroundColor = Styles.NotificationBar.BarBackgroundColor,
            };

            mainBox.PackStart(new ImageView(ImageService.GetIcon(Stock.Information, Gtk.IconSize.Menu)), marginLeft: 11);
            mainBox.PackStart(new Label(description));

            if (items.Length > 0)
            {
                mainBox.PackStart(new Label("–"));
            }

            var closeButton = new InfoBarCloseButton {
                Image       = closeImageInactive,
                MarginRight = 9,
            };

            closeButton.AddAction(() => Dispose());

            foreach (var item in items)
            {
                // TODO: abstract this into a factory.
                Widget toAdd = null;
                switch (item.Kind)
                {
                case InfoBarItem.InfoBarItemKind.Button:
                    var btn = new InfoBarButton {
                        Label      = item.Title,
                        LabelColor = Styles.NotificationBar.ButtonLabelColor,
                        Style      = ButtonStyle.Normal,

                        MinWidth = 77,
                    };

                    btn.AddAction(item.Action);
                    if (item.CloseAfter)
                    {
                        btn.AddAction(() => Dispose());
                    }
                    toAdd = btn;
                    break;

                // Creates a clickable hyperlink
                case InfoBarItem.InfoBarItemKind.Hyperlink:
                    var link = new InfoBarLink {
                        Text = item.Title,
                    };
                    link.AddAction(item.Action);
                    if (item.CloseAfter)
                    {
                        link.AddAction(() => Dispose());
                    }
                    toAdd = link;
                    break;

                // We only have 1 close button, we attach all close actions to it
                case InfoBarItem.InfoBarItemKind.Close:
                    closeButton.AddAction(item.Action);
                    break;
                }

                if (toAdd != null)
                {
                    mainBox.PackStart(toAdd);
                }
            }

            mainBox.PackEnd(closeButton);

            if (IdeApp.Preferences == null || IdeApp.Preferences.UserInterfaceTheme == Theme.Light)
            {
                Content = new FrameBox(mainBox)
                {
                    BorderWidthBottom = 1,
                    BorderColor       = Styles.NotificationBar.BarBorderColor,
                };
            }
            else
            {
                Content = mainBox;
            }
        }
    // Update is called once per frame
    void UpdateOrigin()
    {
        if (!isAvatar)
        {
            return;
        }

        FP dis       = TSVector.Distance(Position, destPosition);
        FP currSpeed = DestDuration <= 0 ? Speed : (Speed * playTime / DestDuration);

        if (dis <= currSpeed * Time.deltaTime)
        {
            Position = destPosition;
//           Debug.LogError("----------diff time------------------:" + (playTime - FrameDuration));
        }
        else
        {
            TSVector tempDirection = destPosition - Position;

            Position += tempDirection.normalized * currSpeed * Time.deltaTime;
        }



        FrameDuration += Time.deltaTime;

        if (FrameDuration >= DestDuration)
        {
            Position = destPosition;

            if (framePool.Count > 0)
            {
                DestDuration = playTime / (framePool.Count <= ThresholdFrame ? 1: framePool.Count / ThresholdFrame);

//                 if(framePool.Count > 8)
//                     Debug.LogError("framePool.Count too big:" + +framePool.Count);

                var framedata = framePool.Dequeue();



                emptyFramesTime = 0.0f;
                //               ThresholdFrame -= 1;

                //               Debug.Log("frame.id:"+ framedata.Key + " framePool.Count" + framePool.Count );

                TSVector movement = TSVector.zero;
                bool     space    = false;

                foreach (var item in framedata.Value.operation)
                {
                    if (item.cmd_type != (UInt32)CMD.BOX)
                    {
                        continue;
                    }

                    FrameBox msg = FrameProto.decode(item) as FrameBox;
                    movement = msg.movement;
                    space    = msg.space;
                }


                //               Debug.Log("d_point:" + point);

                destPosition += Speed * movement * playTime;

                FrameDuration = 0.0f;
            }
            else if (lastFrameData != null)
            {
//                Debug.Log("emptyFramesTime," + emptyFramesTime);

                emptyFramesTime += Time.deltaTime;

                if (emptyFramesTime >= playTime)
                {
//                    ThresholdFrame = (int)(emptyFramesTime / playTime);

                    //                   Debug.LogError("one frame time out,emptyFramesTime:" + emptyFramesTime + ",ThresholdFrame:"+ ThresholdFrame);
                }
            }
        }
    }
Exemple #11
0
        public XwtInfoBar(string description, Action onDispose, params InfoBarItem[] items)
        {
            items ??= Array.Empty <InfoBarItem> ();

            this.onDispose = onDispose;

            var mainBox = new HBox {
                BackgroundColor = Styles.NotificationBar.BarBackgroundColor,
                MinHeight       = 30
            };

            mainBox.PackStart(new ImageView(ImageService.GetIcon(Stock.Information, Gtk.IconSize.Menu)), marginLeft: 11);
            mainBox.PackStart(descriptionLabel = new Label(description));

            int firstItem = 0;

            if (items.Length > 0 && items[0].Kind == InfoBarItemKind.Hyperlink)
            {
                firstItem = 1;
                var link = new InfoBarLink {
                    Text = items [0].Title,
                };
                link.AddAction(items [0].Action);
                if (items [0].CloseAfter)
                {
                    link.AddAction(() => Dispose());
                }
                mainBox.PackStart(new Label("–"));
                mainBox.PackStart(link);
            }

            var closeButton = new InfoBarCloseButton {
                Image       = closeImageInactive,
                MarginRight = 9,
            };

            closeButton.AddAction(() => Dispose());

            var widgets = new List <Widget> (items.Length);

            for (int i = items.Length - 1; i >= firstItem; i--)
            {
                var item = items [i];
                // TODO: abstract this into a factory.
                Widget toAdd = null;
                switch (item.Kind)
                {
                case InfoBarItemKind.Button:
                    var btn = new InfoBarButton {
                        Label      = item.Title,
                        LabelColor = Styles.NotificationBar.ButtonLabelColor,
                        Style      = ButtonStyle.Normal,

                        MinWidth = 77,
                    };

                    btn.AddAction(item.Action);
                    if (item.CloseAfter)
                    {
                        btn.AddAction(() => Dispose());
                    }
                    toAdd = btn;
                    break;

                // Creates a clickable hyperlink
                case InfoBarItemKind.Hyperlink:
                    var link = new InfoBarLink {
                        Text = item.Title,
                    };
                    link.AddAction(item.Action);
                    if (item.CloseAfter)
                    {
                        link.AddAction(() => Dispose());
                    }
                    toAdd = link;
                    break;

                // We only have 1 close button, we attach all close actions to it
                case InfoBarItemKind.Close:
                    closeButton.AddAction(item.Action);
                    break;
                }

                if (toAdd != null)
                {
                    widgets.Add(toAdd);
                }
            }

            mainBox.PackEnd(closeButton);
            foreach (var widget in widgets)
            {
                mainBox.PackEnd(widget);
            }

            if (IdeApp.Preferences == null || IdeApp.Preferences.UserInterfaceTheme == Theme.Light)
            {
                Content = new FrameBox(mainBox)
                {
                    BorderWidthBottom = 1,
                    BorderColor       = Styles.NotificationBar.BarBorderColor,
                };
            }
            else
            {
                Content = mainBox;
            }
        }
Exemple #12
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;
        }
        void Build()
        {
            Title   = GettextCatalog.GetString("Manage NuGet Packages – Solution");
            Width   = 840;
            Height  = 528;
            Padding = new WidgetSpacing();

            if (Platform.IsWindows)
            {
                packageInfoFontSize = 9;
            }

            // Top part of dialog:
            // Package sources and search.
            var topHBox = new HBox();

            topHBox.Margin = new WidgetSpacing(8, 5, 6, 5);

            // HACK: VoiceOver does not work when using Accessible.Label so workaround this by using
            // Accessible.LabelWidget and hide the label since we do not need it.
            var packageSourceLabel = new Label();

            packageSourceLabel.Text    = GettextCatalog.GetString("Package source");
            packageSourceLabel.Visible = false;
            topHBox.PackStart(packageSourceLabel);

            packageSourceComboBox          = new ComboBox();
            packageSourceComboBox.Name     = "packageSourceComboBox";
            packageSourceComboBox.MinWidth = 200;
            // Does not work:
            //packageSourceComboBox.Accessible.Label = GettextCatalog.GetString ("Package source");
            packageSourceComboBox.Accessible.LabelWidget = packageSourceLabel;
            topHBox.PackStart(packageSourceComboBox);

            tabGroup = new HBox();

            int tabLabelMinWidth = 60;

            browseLabel            = new CustomButtonLabel();
            browseLabel.Text       = GettextCatalog.GetString("Browse");
            browseLabel.Tag        = browseLabel.Text;
            browseLabel.MinWidth   = tabLabelMinWidth;
            browseLabel.MarginLeft = 10;
            tabGroup.PackStart(browseLabel);

            installedLabel          = new CustomButtonLabel();
            installedLabel.Text     = GettextCatalog.GetString("Installed");
            installedLabel.Tag      = installedLabel.Text;
            installedLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(installedLabel);

            updatesLabel          = new CustomButtonLabel();
            updatesLabel.Text     = GettextCatalog.GetString("Updates");
            updatesLabel.Tag      = updatesLabel.Text;
            updatesLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(updatesLabel);

            consolidateLabel          = new CustomButtonLabel();
            consolidateLabel.Text     = GettextCatalog.GetString("Consolidate");
            consolidateLabel.Tag      = consolidateLabel.Text;
            consolidateLabel.MinWidth = tabLabelMinWidth;
            tabGroup.PackStart(consolidateLabel);

            topHBox.PackStart(tabGroup);

            packageSearchEntry                  = new SearchTextEntry();
            packageSearchEntry.Name             = "managePackagesDialogSearchEntry";
            packageSearchEntry.WidthRequest     = 187;
            packageSearchEntry.PlaceholderText  = GettextCatalog.GetString("Search");
            packageSearchEntry.Accessible.Label = GettextCatalog.GetString("Package Search");
            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 = Styles.LineBorderColor;
            mainVBox.PackStart(middleFrame, true, true);

            // Error information.
            var packagesListVBox = new VBox();

            packagesListVBox.Spacing         = 0;
            errorMessageHBox                 = new HBox();
            errorMessageHBox.Margin          = new WidgetSpacing();
            errorMessageHBox.BackgroundColor = Styles.ErrorBackgroundColor;
            errorMessageHBox.Visible         = false;
            var errorImage = new ImageView();

            errorImage.Margin = new WidgetSpacing(10, 0, 0, 0);
            errorImage.Image  = ImageService.GetIcon(MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            errorImage.HorizontalPlacement = WidgetPlacement.End;
            errorMessageHBox.PackStart(errorImage);
            errorMessageLabel           = new Label();
            errorMessageLabel.TextColor = Styles.ErrorForegroundColor;
            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;
            packagesListView.Accessible.Label = GettextCatalog.GetString("Packages");
            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 = GettextCatalog.GetString("Loading package list...");
            loadingSpinnerHBox.PackEnd(loadingSpinnerLabel);

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

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

            noPackagesFoundHBox.HorizontalPlacement = WidgetPlacement.Center;

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

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

            // Package information
            packageInfoVBox = new VBox();
            var packageInfoFrame = new FrameBox();

            packageInfoFrame.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoFrame.BorderWidth     = new WidgetSpacing();
            packageInfoFrame.Content         = packageInfoVBox;
            packageInfoVBox.Margin           = new WidgetSpacing(15, 12, 15, 12);
            var packageInfoContainerVBox = new VBox();

            packageInfoContainerVBox.WidthRequest = 328;
            packageInfoContainerVBox.PackStart(packageInfoFrame, true, true);

            var packageInfoScrollView = new ScrollView();

            packageInfoScrollView.BorderVisible          = false;
            packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
            packageInfoScrollView.Content         = packageInfoContainerVBox;
            packageInfoScrollView.BackgroundColor = Styles.PackageInfoBackgroundColor;
            var packageInfoScrollViewFrame = new FrameBox();

            packageInfoScrollViewFrame.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoScrollViewFrame.BorderWidth     = new WidgetSpacing(1, 0, 0, 0);
            packageInfoScrollViewFrame.BorderColor     = Styles.LineBorderColor;
            packageInfoScrollViewFrame.Content         = packageInfoScrollView;

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

            packageNameLabel           = new Label();
            packageNameLabel.Ellipsize = EllipsizeMode.End;
            Font packageInfoSmallFont = packageNameLabel.Font.WithSize(packageInfoFontSize);
            Font packageInfoBoldFont  = packageInfoSmallFont.WithWeight(FontWeight.Bold);

            packageNameLabel.Font = packageInfoSmallFont;
            packageNameHBox.PackStart(packageNameLabel, true);

            // Projects list view label.
            projectsListViewLabel                 = new Label();
            projectsListViewLabel.Wrap            = WrapMode.Word;
            projectsListViewLabel.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoVBox.PackStart(projectsListViewLabel);

            // Projects list view.
            projectsListViewVBox        = new VBox();
            projectsListViewVBox.Margin = new WidgetSpacing();
            packageInfoVBox.PackStart(projectsListViewVBox, true, true);

            // Package description.
            packageDescription                 = new Label();
            packageDescription.Wrap            = WrapMode.Word;
            packageDescription.Font            = packageNameLabel.Font.WithSize(packageInfoFontSize);
            packageDescription.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoVBox.PackStart(packageDescription);

            // Package id.
            var packageIdHBox = new HBox();

            packageIdHBox.MarginTop = 7;
            packageInfoVBox.PackStart(packageIdHBox);

            var packageIdLabel = new Label();

            packageIdLabel.Font = packageInfoBoldFont;
            packageIdLabel.Text = GettextCatalog.GetString("ID");
            packageIdHBox.PackStart(packageIdLabel);

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

            // Package author
            var packageAuthorHBox = new HBox();

            packageInfoVBox.PackStart(packageAuthorHBox);

            var packageAuthorLabel = new Label();

            packageAuthorLabel.Text = GettextCatalog.GetString("Author");
            packageAuthorLabel.Font = packageInfoBoldFont;
            packageAuthorHBox.PackStart(packageAuthorLabel);

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

            // Package published
            var packagePublishedHBox = new HBox();

            packageInfoVBox.PackStart(packagePublishedHBox);

            var packagePublishedLabel = new Label();

            packagePublishedLabel.Text = GettextCatalog.GetString("Published");
            packagePublishedLabel.Font = packageInfoBoldFont;
            packagePublishedHBox.PackStart(packagePublishedLabel);

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

            // Package downloads
            var packageDownloadsHBox = new HBox();

            packageInfoVBox.PackStart(packageDownloadsHBox);

            var packageDownloadsLabel = new Label();

            packageDownloadsLabel.Text = GettextCatalog.GetString("Downloads");
            packageDownloadsLabel.Font = packageInfoBoldFont;
            packageDownloadsHBox.PackStart(packageDownloadsLabel);

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

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

            packageInfoVBox.PackStart(packageLicenseHBox);

            var packageLicenseLabel = new Label();

            packageLicenseLabel.Text = GettextCatalog.GetString("License");
            packageLicenseLabel.Font = packageInfoBoldFont;
            packageLicenseHBox.PackStart(packageLicenseLabel);

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

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

            packageInfoVBox.PackStart(packageProjectPageHBox);

            var packageProjectPageLabel = new Label();

            packageProjectPageLabel.Text = GettextCatalog.GetString("Project Page");
            packageProjectPageLabel.Font = packageInfoBoldFont;
            packageProjectPageHBox.PackStart(packageProjectPageLabel);

            packageProjectPageLink                  = new LinkLabel();
            packageProjectPageLink.Text             = GettextCatalog.GetString("Visit Page");
            packageProjectPageLink.Font             = packageInfoSmallFont;
            packageProjectPageLink.Accessible.Label = GettextCatalog.GetString("Visit Project Page");
            packageProjectPageHBox.PackEnd(packageProjectPageLink);

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

            var packageDependenciesLabel = new Label();

            packageDependenciesLabel.Text = GettextCatalog.GetString("Dependencies");
            packageDependenciesLabel.Font = packageInfoBoldFont;
            packageDependenciesHBox.PackStart(packageDependenciesLabel);

            packageDependenciesNoneLabel      = new Label();
            packageDependenciesNoneLabel.Text = GettextCatalog.GetString("None");
            packageDependenciesNoneLabel.Font = packageInfoSmallFont;
            packageDependenciesNoneLabel.Accessible.LabelWidget = packageDependenciesLabel;
            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;
            packageDependenciesList.Accessible.LabelWidget = packageDependenciesLabel;
            packageDependenciesListHBox.PackStart(packageDependenciesList, true);

            // Current package version.
            currentPackageVersionHBox                 = new HBox();
            currentPackageVersionHBox.Spacing         = 15;
            currentPackageVersionHBox.Visible         = false;
            currentPackageVersionHBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            currentPackageVersionHBox.Margin          = new WidgetSpacing(15, 0, 15, 0);
            currentPackageVersionLabel                = new Label();
            currentPackageVersionLabel.BoundsChanged += PackageVersionLabelBoundsChanged;
            currentPackageVersionLabel.Font           = packageInfoSmallFont;
            currentPackageVersionLabel.Text           = GettextCatalog.GetString("Current Version:");
            currentPackageVersionLabel.TextAlignment  = Alignment.End;
            currentPackageVersionHBox.PackStart(currentPackageVersionLabel);

            var currentPackageVersionWithInfoPopoverHBox = new HBox();

            currentPackageVersionWithInfoPopoverHBox.Margin  = new WidgetSpacing();
            currentPackageVersionWithInfoPopoverHBox.Spacing = 0;

            currentPackageVersion      = new Label();
            currentPackageVersion.Font = packageInfoSmallFont;
            currentPackageVersion.Accessible.LabelWidget = currentPackageVersionLabel;
            currentPackageVersionWithInfoPopoverHBox.PackStart(currentPackageVersion);

            currentPackageVersionInfoPopoverWidget          = new InformationPopoverWidget();
            currentPackageVersionInfoPopoverWidget.Severity = Ide.Tasks.TaskSeverity.Information;
            currentPackageVersionInfoPopoverWidget.Margin   = new WidgetSpacing(5, 0, 0, 2);
            currentPackageVersionInfoPopoverWidget.Accessible.LabelWidget = currentPackageVersionLabel;
            currentPackageVersionWithInfoPopoverHBox.PackStart(currentPackageVersionInfoPopoverWidget);

            currentPackageVersionHBox.PackStart(currentPackageVersionWithInfoPopoverHBox);

            // Package versions.
            packageVersionsHBox                 = new HBox();
            packageVersionsHBox.Visible         = false;
            packageVersionsHBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageVersionsHBox.Margin          = new WidgetSpacing(15, 0, 15, 12);
            packageVersionsLabel                = new Label();
            packageVersionsLabel.Font           = packageInfoSmallFont;
            packageVersionsLabel.Text           = GettextCatalog.GetString("New Version:");
            packageVersionsLabel.TextAlignment  = Alignment.End;
            packageVersionsHBox.PackStart(packageVersionsLabel);

            packageVersionComboBox      = new ComboBox();
            packageVersionComboBox.Name = "packageVersionComboBox";
            packageVersionComboBox.Accessible.LabelWidget = packageVersionsLabel;
            packageVersionsHBox.Spacing = 15;
            packageVersionsHBox.PackStart(packageVersionComboBox, true, true);

            var packageInfoAndVersionsVBox = new VBox();

            packageInfoAndVersionsVBox.Margin          = new WidgetSpacing();
            packageInfoAndVersionsVBox.BackgroundColor = Styles.PackageInfoBackgroundColor;
            packageInfoAndVersionsVBox.PackStart(packageInfoScrollViewFrame, true, true);
            packageInfoAndVersionsVBox.PackStart(currentPackageVersionHBox, false, false);
            packageInfoAndVersionsVBox.PackStart(packageVersionsHBox, false, false);
            middleHBox.PackEnd(packageInfoAndVersionsVBox);

            // 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.Name  = "managePackagesDialogShowPreReleaseCheckBox";
            showPrereleaseCheckBox.Label = GettextCatalog.GetString("Show pre-release packages");
            bottomHBox.PackStart(showPrereleaseCheckBox);

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

            closeButton           = new Button();
            closeButton.Name      = "managePackagesDialogCloseButton";
            closeButton.MinWidth  = 120;
            closeButton.MinHeight = 25;
            closeButton.Label     = GettextCatalog.GetString("Close");
            bottomHBox.PackEnd(closeButton);

            packageSearchEntry.SetFocus();
            packageInfoVBox.Visible = false;
        }
Exemple #14
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);
            }
        }