void Init() { _titleLabel = new Label("Applications") { Margin = new WidgetSpacing(0, 6, 0, 6) }; _headerBox = new HBox(); _searchEntry = new SearchTextEntry { WidthRequest = 200, PlaceholderText = "Filter..." }; _listView = new ListView { MinHeight = 150, WidthRequest = 400 }; _nameField = new DataField <string>(); _ownerField = new DataField <string>(); _appField = new DataField <Models.Application>(); _listStore = new ListStore(_nameField, _ownerField, _appField); _listView.Columns.Add(new ListViewColumn("Name", new TextCellView(_nameField))); _listView.Columns.Add(new ListViewColumn("Owner", new TextCellView(_ownerField))); _listView.DataSource = _listStore; _buttonBox = new HBox(); _addButton = new Button("Add") { BackgroundColor = MonoDevelop.Ide.Gui.Styles.BaseSelectionBackgroundColor, LabelColor = MonoDevelop.Ide.Gui.Styles.BaseSelectionTextColor }; _editButton = new Button("Edit"); _removeButton = new Button("Remove"); _closeButton = new Button("Close"); _appsSpinner = new MDSpinner(Gtk.IconSize.Dialog) { HeightRequest = 24, WidthRequest = 24, Animate = true, HorizontalPlacement = WidgetPlacement.Center, VerticalPlacement = WidgetPlacement.Center }; }
public ListBoxFilter() { label = new Label { Text = type.Name.Humanize(), }; search = new SearchTextEntry { PlaceholderText = Application.TranslationCatalog.GetString("Filter"), }; search.Activated += FilterActivated; search.Changed += FilterChanged; allCheckBox = new CheckBox { Label = Application.TranslationCatalog.GetString("All"), AllowMixed = false, State = CheckBoxState.Off, Active = false, Visible = false, }; allCheckBox.Clicked += AllCheckBoxClicked; listBox = new ListBox { ExpandHorizontal = true, ExpandVertical = true, HorizontalPlacement = WidgetPlacement.Fill, VerticalPlacement = WidgetPlacement.Fill, }; listBox.SelectionChanged += (sender, e) => OnSelectionItemChanged(e); var box = new HBox(); box.PackStart(label); box.PackEnd(search); box.PackEnd(allCheckBox); PackStart(box, false, true); PackStart(listBox, true, true); ExpandHorizontal = true; ExpandVertical = true; }
public ListBoxFilter() { search = new SearchTextEntry { PlaceholderText = Application.TranslationCatalog.GetString("Filter"), }; search.Activated += FilterActivated; search.Changed += FilterChanged; listBox = new ListBox { ExpandHorizontal = true, ExpandVertical = true, HorizontalPlacement = WidgetPlacement.Fill, VerticalPlacement = WidgetPlacement.Fill, }; listBox.SelectionChanged += (sender, e) => OnSelectionItemChanged(e); PackStart(search); PackStart(listBox, true, true); ExpandHorizontal = true; ExpandVertical = true; }
void Init() { _mainBox = new VBox { BackgroundColor = MonoDevelop.Ide.Gui.Styles.BackgroundColor, HeightRequest = 500, WidthRequest = 800 }; _headerFrameBox = new RoundedFrameBox { CornerRadiusTopLeft = 6, CornerRadiusTopRight = 6, CornerRadiusBottomLeft = 0, CornerRadiusBottomRight = 0, BorderBottom = false, BorderWidth = 2, InnerBackgroundColor = Styles.BackgroundColor }; _headerBox = new HBox { HeightRequest = 36 }; _feedBox = new ComboBox { WidthRequest = 200 }; _searchEntry = new SearchTextEntry { PlaceholderText = "Filter samples", HeightRequest = 24, WidthRequest = 200 }; _contentFrameBox = new RoundedFrameBox { CornerRadius = 0, BorderWidth = 2, InnerBackgroundColor = Styles.BackgroundColor, Margin = new WidgetSpacing(0, -6, 0, 0) }; _contentBox = new HBox(); _samplesView = new TreeView { BackgroundColor = Styles.BackgroundColor, GridLinesVisible = GridLines.None, HeadersVisible = false, BorderVisible = false, UseAlternatingRowColors = true, WidthRequest = 200 }; _nameField = new DataField <string>(); _sampleField = new DataField <Sample>(); _samplesStore = new TreeStore(_nameField, _sampleField); _descriptionBox = new VBox { WidthRequest = 300 }; _titleLabel = new Label("Title") { Font = Font.SystemFont.WithScaledSize(1.25), Margin = new WidgetSpacing(0, 12, 0, 0) }; _titleValueLabel = new Label(); _descriptionLabel = new Label("Description") { Font = Font.SystemFont.WithScaledSize(1.25), Margin = new WidgetSpacing(0, 12, 0, 0) }; _descriptionValueLabel = new Label { Wrap = WrapMode.Word, WidthRequest = 150 }; _platformsLabel = new Label("Platforms") { Font = Font.SystemFont.WithScaledSize(1.25), Margin = new WidgetSpacing(0, 12, 0, 0) }; _platformsBox = new VBox(); _tagsLabel = new Label("Tags") { Font = Font.SystemFont.WithScaledSize(1.25), Margin = new WidgetSpacing(0, 12, 0, 0) }; _tagsBox = new HBox(); _authorTitleLabel = new Label("Author") { Font = Font.SystemFont.WithScaledSize(1.25), Margin = new WidgetSpacing(0, 12, 0, 0) }; _authorLabel = new Label(); _previewBox = new VBox { WidthRequest = 300 }; _previewView = new Xwt.ImageView { BackgroundColor = Colors.Gray, HorizontalPlacement = WidgetPlacement.End, VerticalPlacement = WidgetPlacement.Start, Margin = new WidgetSpacing(2, 2, 2, 2) }; _loadingSpinner = new MDSpinner { Animate = true }; _buttonBox = new HBox(); _cancelButton = new Button("Cancel"); _continueButton = new Button("Continue") { BackgroundColor = Styles.BaseSelectionBackgroundColor, LabelColor = Styles.BaseSelectionTextColor }; }
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; }
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; }
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; }
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); } }
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); } }