public override void LoadView() { View = new ContainerView(this); string appearance = EffectiveAppearanceName; NativeChild.RemoveFromSuperview(); View.AddSubview(NativeChild); if (!string.IsNullOrEmpty(appearance) && appearance.IndexOf("Dark", StringComparison.Ordinal) >= 0) { View.Appearance = NSAppearance.GetAppearance(MacSystemInformation.OsVersion < MacSystemInformation.Mojave ? NSAppearance.NameVibrantDark : new NSString("NSAppearanceNameDarkAqua")); } else { View.Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua); } WidgetSpacing padding = 0; if (Backend != null) { padding = Backend.Frontend.Padding; } View.AddConstraints(new NSLayoutConstraint [] { NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, (nfloat)padding.Left), NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, -(nfloat)padding.Right), NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, (nfloat)padding.Top), NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -(nfloat)padding.Bottom), }); }
void CreateContent() { var mainPaned = new HPaned(); var leftPane = new VPaned(); _store = new TreeStore(imgCol, nameCol, tag); _treeView = new TreeView(_store) { HeadersVisible = false, }; _treeView.Columns.Add("Name", imgCol, nameCol); _contentIcon = Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(@"MonoGame.Tools.Pipeline.Icons.blueprint.png")); _folderClosedIcon = Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(@"MonoGame.Tools.Pipeline.Icons.folder_closed.png")); //_folderOpenIcon = Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(@"MonoGame.Tools.Pipeline.Icons.folder_open.png")); _projectIcon = Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(@"MonoGame.Tools.Pipeline.Icons.settings.png")); leftPane.Panel1.Content = _treeView; leftPane.Panel2.Content = new PropertyGrid(); mainPaned.Panel1.Content = leftPane; _outputWindow = new OutputTextView(); mainPaned.Panel2.Content = _outputWindow; Content = mainPaned; // Make the left pane 1/3 of the width by default mainPaned.Position = Width * 0.33; // No padding around the edge of the main window Padding = new WidgetSpacing(); }
void UpdatePadding() { double top, left, bottom, right; top = left = bottom = right = (Theme.Padding + (Core.Platform.IsWindows ? 1 : 2)); if (Theme.ShowArrow) { if ((Theme.TargetPosition & PopupPosition.Top) != 0) { top += Theme.ArrowLength; } else if ((Theme.TargetPosition & PopupPosition.Bottom) != 0) { bottom += Theme.ArrowLength; } else if ((Theme.TargetPosition & PopupPosition.Left) != 0) { left += Theme.ArrowLength; } else if ((Theme.TargetPosition & PopupPosition.Right) != 0) { right += Theme.ArrowLength; } } Padding = new WidgetSpacing(left, top, right, bottom); }
public void WillShow(NSNotification notification) { if (parent != notification.Object) { return; } ChildBackend.SetAutosizeMode(true); Child.Surface.Reallocate(); if (BackgroundColor != null) { if (View.Window.ContentView.Superview.Layer == null) { View.Window.ContentView.Superview.WantsLayer = true; } View.Window.ContentView.Superview.Layer.BackgroundColor = BackgroundColor; } WidgetSpacing padding = 0; if (Backend != null) { padding = Backend.Frontend.Padding; } NativeChild.SetFrameOrigin(new CGPoint((nfloat)padding.Left, (nfloat)padding.Top)); shown = true; }
public SortButton(string label) { Label = label; Margin = new WidgetSpacing(2, 2, 2, 2); HeightRequest = 24; WidthRequest = 24; }
void UpdateSpacing() { Spacing = new WidgetSpacing( Math.Max(TopLeft, BottomLeft), Math.Max(TopLeft, TopRight), Math.Max(TopRight, BottomRight), Math.Max(BottomLeft, BottomRight) ); }
void Build() { Title = GettextCatalog.GetString("Add Platform Implementation"); Width = 420; Height = 220; Padding = new WidgetSpacing(20, 20, 20, 20); var mainVBox = new VBox(); Content = mainVBox; // Platforms selection. var platformsVBox = new VBox(); platformsVBox.Spacing = 0; mainVBox.PackStart(platformsVBox); var platformsLabel = new Label(); platformsLabel.Text = GettextCatalog.GetString("Select the platform implementations you would like to add:"); platformsLabel.MarginBottom = 6; platformsVBox.PackStart(platformsLabel); androidCheckBox = new CheckBox(); androidCheckBox.Label = "Android"; platformsVBox.PackStart(androidCheckBox); iosCheckBox = new CheckBox(); iosCheckBox.Label = "iOS"; platformsVBox.PackStart(iosCheckBox); // Use shared project. var sharedProjectVBox = new VBox(); sharedProjectVBox.Spacing = 0; sharedProjectVBox.MarginTop = 20; mainVBox.PackStart(sharedProjectVBox); var useSharedProjectLabel = new Label(); useSharedProjectLabel.Text = GettextCatalog.GetString("Create a Shared Project from the Portable Class Library:"); useSharedProjectLabel.MarginBottom = 6; sharedProjectVBox.PackStart(useSharedProjectLabel); useSharedProjectCheckBox = new CheckBox(); useSharedProjectCheckBox.Label = GettextCatalog.GetString("Create Shared Project"); sharedProjectVBox.PackStart(useSharedProjectCheckBox); var cancelButton = new DialogButton(Command.Cancel); Buttons.Add(cancelButton); okButton = new DialogButton(Command.Ok); Buttons.Add(okButton); }
public void SetPadding (WidgetSpacing spacing) { alignment.LeftPadding = radius + (uint) spacing.Left; alignment.RightPadding = radius + (uint) spacing.Right; if (arrowPosition == Xwt.Popover.Position.Top) { alignment.TopPadding = radius + arrowPadding + (uint) spacing.Top; alignment.BottomPadding = radius + (uint) spacing.Bottom; } else { alignment.BottomPadding = radius + arrowPadding + (uint) spacing.Bottom; alignment.TopPadding = radius + (uint) spacing.Top; } }
protected override void Compose() { base.Compose(); var margin = new WidgetSpacing(); Widget.Margin = margin; TextEntry = new TextEntry { ShowFrame = true, Margin = margin }; TitleLabel = new Label { WidthRequest = 80, TextColor = SystemColors.GrayText, TextAlignment = Alignment.Start, Font = TextEntry.Font.WithSize(TextEntry.Font.Size * .80), Margin = margin }; var buttonOk = new Button { Image = Iconery.OK, Style = ButtonStyle.Flat, Margin = margin, }; var buttonCancel = new Button { Image = Iconery.Cancel, Style = ButtonStyle.Flat, Margin = margin, }; TextEntry.KeyPressed += (s, e) => { if (e.Key == Key.NumPadEnter || e.Key == Key.Return) { OnFinish(DialogResult.Ok); } else if (e.Key == Key.Escape) { OnFinish(DialogResult.Cancel); } }; buttonOk.Clicked += (s, e) => OnFinish(DialogResult.Ok); buttonCancel.Clicked += (s, e) => OnFinish(DialogResult.Cancel); Widget.PackStart(TitleLabel); Widget.PackEnd(buttonCancel); Widget.PackEnd(buttonOk); Widget.PackStart(TextEntry, true); }
public MainWindow() { Title = "Hello, World!"; InitialLocation = WindowLocation.CenterScreen; Width = 500; Height = 400; Content = textEditor = new TextEditor(); Padding = new WidgetSpacing(); Closed += (sender, e) => Application.Exit(); OpenFile(); }
public void SetPadding(WidgetSpacing spacing) { alignment.LeftPadding = radius + (uint)spacing.Left; alignment.RightPadding = radius + (uint)spacing.Right; if (arrowPosition == Xwt.Popover.Position.Top) { alignment.TopPadding = radius + arrowPadding + (uint)spacing.Top; alignment.BottomPadding = radius + (uint)spacing.Bottom; } else { alignment.BottomPadding = radius + arrowPadding + (uint)spacing.Bottom; alignment.TopPadding = radius + (uint)spacing.Top; } }
public void SetPadding(WidgetSpacing spacing) { this.margin = spacing; this.alignment.LeftPadding = 6U + (uint)spacing.Left; this.alignment.RightPadding = 6U + (uint)spacing.Right; if (this.arrowPosition == Popover.Position.Top) { this.alignment.TopPadding = 16U + (uint)spacing.Top; this.alignment.BottomPadding = 6U + (uint)spacing.Bottom; } else { this.alignment.BottomPadding = 16U + (uint)spacing.Bottom; this.alignment.TopPadding = 6U + (uint)spacing.Top; } }
public Menubar() : base(PopupType.Menu) { Bar = new Toolsbar() { Indent = 0 }; Bar.ItemClick += OnItemClick; Bar.Items.GrowMode = Orientation.Vertical; BackgroundColor = GuiEnvironment.Theme["Window"].BaseColor; Content = Bar; Decorated = false; Padding = new WidgetSpacing(8, 8, 8, 8); Resizable = true; InitialLocation = WindowLocation.Manual; ShowInTaskbar = false; Name = nameof(Menubar); }
public override void LoadView() { View = new ContainerView(this); NativeChild.RemoveFromSuperview(); View.AddSubview(NativeChild); WidgetSpacing padding = 0; if (Backend != null) { padding = Backend.Frontend.Padding; } View.AddConstraints(new NSLayoutConstraint [] { NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, (nfloat)padding.Left), NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, -(nfloat)padding.Right), NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, (nfloat)padding.Top), NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -(nfloat)padding.Bottom), }); }
void Init() { CornerRadiusTopLeft = 6; CornerRadiusTopRight = 6; CornerRadiusBottomLeft = 6; CornerRadiusBottomRight = 6; BorderWidth = 1; InnerBackgroundColor = MonoDevelop.Ide.Gui.Styles.BaseSelectionBackgroundColor; MinWidth = 100; Margin = new WidgetSpacing(0, 0, 6, 0); _tagBox = new HBox(); _textLabel = new Label { Font = Xwt.Drawing.Font.FromName(FontService.SansFontName).WithScaledSize(0.9), TextColor = MonoDevelop.Ide.Gui.Styles.BaseSelectionTextColor, Ellipsize = EllipsizeMode.End }; }
public ResultBox(Party party) { nrOfQuestions = party.Questions.Length; Margin = new WidgetSpacing(3, 3, 3, 3); MinHeight = 2 * Parameter.BorderRadius; // Init Box box = new VBox(); box.BackgroundColor = Parameter.BoxBackgroundColor; // Init Labels labels = new Label[nrOfQuestions + 1]; // Question Labels for (int i = 0; i < nrOfQuestions; i++) { Label l = new Label("Frage " + (i + 1)); l.Margin = new WidgetSpacing(top: i > 0?10:0); l.Font = l.Font.WithSize(Parameter.FontSizeResult); box.PackStart(l); labels[i] = l; } // Result Labels Label label = new Label(String.Format(PointsPattern, 0)); label.Margin = new WidgetSpacing(top: 20); label.Font = label.Font.WithWeight(FontWeight.Bold).WithSize(Parameter.FontSizeResult); box.PackStart(label); labels[nrOfQuestions] = label; AddChild(box, new Rectangle(Parameter.BorderRadius, Parameter.BorderRadius, box.Surface.GetPreferredSize().Width, Math.Min(box.Surface.GetPreferredSize().Height - 2 * Parameter.BorderRadius, Size.Height))); WidthRequest = box.Surface.GetPreferredSize().Width + 2 * Parameter.BorderRadius; QueueDraw(); BoundsChanged += (sender, e) => { SetChildBounds(box, new Rectangle(Parameter.BorderRadius, Parameter.BorderRadius, box.Surface.GetPreferredSize().Width, Math.Min(box.Surface.GetPreferredSize().Height, Size.Height - 2 * Parameter.BorderRadius))); WidthRequest = box.Surface.GetPreferredSize().Width + 2 * Parameter.BorderRadius; QueueDraw(); }; }
internal void AddFrame(BitmapImage bitmap, double scaleFactor) { ImageFrame frame = new ImageFrame { Bitmap = bitmap, ScaleFactor = scaleFactor }; frames.Add(frame); frame.HorizontalSections = CreateSections(frame, Enumerable.Range(1, (int)bitmap.Width - 2).Select(n => bitmap.GetPixel(n, 0))); frame.VerticalSections = CreateSections(frame, Enumerable.Range(1, (int)bitmap.Height - 2).Select(n => bitmap.GetPixel(0, n))); double padLeft = 0, padTop = 0, padRight = 0, padBottom = 0; var hbox = CreateSections(frame, Enumerable.Range(1, (int)bitmap.Width - 1).Select(n => bitmap.GetPixel(n, (int)bitmap.Height - 1))); var sec = hbox.FirstOrDefault(s => s.Mode != RenderMode.Fixed); if (sec != null) { padLeft = sec.Start; padRight = bitmap.Width - 2 - padLeft - sec.Size; } var vbox = CreateSections(frame, Enumerable.Range(1, (int)bitmap.Height - 1).Select(n => bitmap.GetPixel((int)bitmap.Width - 1, n))); sec = vbox.FirstOrDefault(s => s.Mode != RenderMode.Fixed); if (sec != null) { padTop = sec.Start; padBottom = bitmap.Height - 2 - padTop - sec.Size; } Padding = new WidgetSpacing(padLeft, padTop, padRight, padBottom); frame.StretchableWidth = frame.HorizontalSections.Where(s => s.Mode != RenderMode.Fixed).Sum(s => s.Size); frame.StretchableHeight = frame.VerticalSections.Where(s => s.Mode != RenderMode.Fixed).Sum(s => s.Size); }
void CalcBorderSize(double windowWidth, double windowHeight) { if (borderCalculated) { return; } var c = (FrameworkElement)Content; var p = c.PointToScreen(new SW.Point(0, 0)); var left = p.X - Left; var top = p.Y - Top; frameBorder = new WidgetSpacing(left, top, windowWidth - c.ActualWidth - left, windowHeight - c.ActualHeight - top); borderCalculated = true; Left = initialX - left; Top = initialY - top; SetMinSize(minSizeRequested); // Border size calculation done and we can go back to Manual resize mode. // From now on, the content has to adapt to the size of the window. SizeToContent = System.Windows.SizeToContent.Manual; c.Width = double.NaN; c.Height = double.NaN; }
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; }
public MainWindow() { GuiService.Main = this; Helper.ThreadException += OnThreadException; ListEditor.StatusClick += FieldsEditorStatusClick; ListEditor.LogClick += FieldsEditorLogClick; icon = Application.CreateStatusIcon(); openFD = new OpenFileDialog() { Title = "Open File" }; saveFD = new SaveFileDialog() { Title = "Save File" }; menuProjectCreate = new ToolMenuItem { Name = "Create", DropDown = new Menubar { Name = "Create" } }; menuProjectCreate.ItemClick += ToolProjectCreateItemClick; menuProjectOpen = new ToolMenuItem(ToolProjectOpenClick) { Name = "Open" }; menuProjectProps = new ToolMenuItem(ToolProjectPropertiesClick) { Name = "Properties" }; menuProjectSave = new ToolMenuItem(ToolProjectSaveClick) { Name = "Save" }; menuProjectSaveAs = new ToolMenuItem(ToolProjectSaveAsClick) { Name = "SaveAs" }; menuProjectRecent = new ToolMenuItem() { Name = "Recent" }; menuProjectClose = new ToolMenuItem(ToolProjectCloseClick) { Name = "Close" }; menuProjectExit = new ToolMenuItem(ToolExitOnClick) { Name = "Exit" }; menuProject = new ToolDropDown( menuProjectCreate, menuProjectOpen, menuProjectProps, menuProjectSave, menuProjectSaveAs, menuProjectRecent, menuProjectClose, menuProjectExit) { Name = "Project", DisplayStyle = ToolItemDisplayStyle.Text }; menuView = new ToolDropDown( BuildMenuItem(typeof(PropertiesEditor), "Properties"), BuildMenuItem(typeof(LogExplorer), "Logs"), new ToolSeparator()) { Name = "View", DisplayStyle = ToolItemDisplayStyle.Text }; menuEditUIEnvironment = new ToolMenuItem(ToolEditUIEnvironment) { Name = "UI Environment" }; menuEditLocalize = new ToolMenuItem(ToolEditLocalizeClick) { Name = "Localize" }; menuWindowLang = new ToolMenuItem { Name = "Language", DropDown = new Menubar { Name = "Language" } }; foreach (var info in Locale.Instance.Cultures) { menuWindowLang.DropDown.Items.Add(new ToolLangItem(LangItemClick) { Culture = info, Name = info.Name, Text = info.DisplayName, }); } menuWindowTheme = new ToolMenuItem { Name = "Theme", DropDown = new Menubar { Name = "Theme" } }; foreach (var theme in GuiEnvironment.Instance.Themes) { menuWindowTheme.DropDown.Items.Add(new ToolThemeItem(ThemeItemClick) { Theme = theme, Name = theme.Name, Text = theme.Name, }); } menuWindow = new ToolDropDown( menuEditUIEnvironment, menuEditLocalize, new ToolSeparator(), menuWindowLang, menuWindowTheme) { Name = "Window", DisplayStyle = ToolItemDisplayStyle.Text }; menuHelpAbout = new ToolMenuItem() { Name = "About" }; menuHelp = new ToolDropDown(menuHelpAbout) { Name = "Help", DisplayStyle = ToolItemDisplayStyle.Text }; bar = new Toolsbar( new ToolSeparator { FillWidth = true }, menuView, menuWindow, menuHelp) { Name = "MainBar" }; toolTasks = new ToolSplit { DisplayStyle = ToolItemDisplayStyle.Text, Name = "Tasks" }; toolProgress = new ToolProgressBar { Name = "Progress", Visible = false }; toolLabel = new ToolLabel() { Name = "Label", Text = "_" }; statusBar = new Toolsbar( toolTasks, toolProgress, toolLabel) { Name = "StatusBar" }; dock = new DockBox() { Name = "dock" }; dock.ContentFocus += DockOnContentFocus; //icon.Image = Image.FromResource(GetType(), "datawf.ico"); ; var vbox = new VBox() { Spacing = 0 }; vbox.PackStart(bar, false, false); vbox.PackStart(dock, true, true); vbox.PackStart(statusBar, false, false); Padding = new WidgetSpacing(5, 5, 5, 5); Icon = Image.FromResource(typeof(MainWindow), "datawf.png"); Content = vbox; Name = "Main"; InitialLocation = WindowLocation.CenterScreen; Title = "Main Form"; Size = new Size(1024, 768); BackgroundColor = GuiEnvironment.Theme["Window"].BaseColor; }
internal void AddFrame(BitmapImage bitmap, double scaleFactor) { ImageFrame frame = new ImageFrame { Bitmap = bitmap, ScaleFactor = scaleFactor }; frames.Add (frame); frame.HorizontalSections = CreateSections (frame, Enumerable.Range (1, (int)bitmap.Width - 2).Select (n => bitmap.GetPixel (n, 0))); frame.VerticalSections = CreateSections (frame, Enumerable.Range (1, (int)bitmap.Height - 2).Select (n => bitmap.GetPixel (0, n))); double padLeft = 0, padTop = 0, padRight = 0, padBottom = 0; var hbox = CreateSections (frame, Enumerable.Range (1, (int)bitmap.Width - 1).Select (n => bitmap.GetPixel (n, (int)bitmap.Height - 1))); var sec = hbox.FirstOrDefault (s => s.Mode != RenderMode.Fixed); if (sec != null) { padLeft = sec.Start; padRight = bitmap.Width - 2 - padLeft - sec.Size; } var vbox = CreateSections (frame, Enumerable.Range (1, (int)bitmap.Height - 1).Select (n => bitmap.GetPixel ((int)bitmap.Width - 1, n))); sec = vbox.FirstOrDefault (s => s.Mode != RenderMode.Fixed); if (sec != null) { padTop = sec.Start; padBottom = bitmap.Height - 2 - padTop - sec.Size; } Padding = new WidgetSpacing (padLeft, padTop, padRight, padBottom); frame.StretchableWidth = frame.HorizontalSections.Where (s => s.Mode != RenderMode.Fixed).Sum (s => s.Size); frame.StretchableHeight = frame.VerticalSections.Where (s => s.Mode != RenderMode.Fixed).Sum (s => s.Size); }
public MainWindow(string title, string pty) { Title = title; Width = 700; Height = 400; terminal = new TermSharp.Terminal(); Content = terminal; terminal.InnerMargin = new WidgetSpacing(5, 0, 5, 0); Padding = new WidgetSpacing(); terminal.Cursor.Enabled = true; Font.RegisterFontFromFile(Path.Combine(Directory.GetCurrentDirectory(), "External/TermsharpConsole/RobotoMono-Regular.ttf")); var robotoMonoFont = Font.FromName("Roboto Mono"); if (robotoMonoFont.Family.Contains("Roboto")) { terminal.CurrentFont = robotoMonoFont; } var contextMenu = new Menu(); var copyMenuItem = new MenuItem("Copy"); copyMenuItem.Clicked += (sender, e) => Clipboard.SetText(terminal.CollectClipboardData().Text); contextMenu.Items.Add(copyMenuItem); var pasteMenuItem = new MenuItem("Paste"); contextMenu.Items.Add(pasteMenuItem); terminal.ContextMenu = contextMenu; CloseRequested += delegate { Application.Exit(); }; terminal.SetFocus(); var readerThread = new Thread(() => { var stream = new PtyUnixStream(pty); var vt100decoder = new TermSharp.Vt100.Decoder(terminal, stream.WriteByte, new ConsoleDecoderLogger()); var utfDecoder = new ByteUtf8Decoder(vt100decoder.Feed); Application.Invoke(() => { pasteMenuItem.Clicked += delegate { var text = Clipboard.GetText(); var textAsBytes = Encoding.UTF8.GetBytes(text); foreach (var b in textAsBytes) { stream.WriteByte(b); } }; }); var encoder = new TermSharp.Vt100.Encoder(x => { terminal.ClearSelection(); terminal.MoveScrollbarToEnd(); stream.WriteByte(x); }); terminal.KeyPressed += (s, a) => { a.Handled = true; var modifiers = a.Modifiers; if (!Utilities.IsOnOsX) { modifiers &= ~(ModifierKeys.Command); } if (modifiers == ModifierKeys.Shift) { if (a.Key == Key.PageUp) { terminal.PageUp(); return; } if (a.Key == Key.PageDown) { terminal.PageDown(); return; } } encoder.Feed(a.Key, modifiers); }; var buffer = new List <byte>(); var noTimeoutNextTime = true; while (true) { if (noTimeoutNextTime) { noTimeoutNextTime = false; } else { stream.ReadTimeout = 10; } var readByte = buffer.Count > 1024 ? BufferFull : stream.ReadByte(); if (readByte == StreamClosed) { Application.Invoke(Application.Exit); return; } if (readByte >= 0) { buffer.Add((byte)readByte); } else { var bufferToWrite = buffer; Application.Invoke(() => { foreach (var b in bufferToWrite) { utfDecoder.Feed(b); } }); buffer = new List <byte>(); noTimeoutNextTime = true; } } }) { IsBackground = true }; readerThread.Start(); }
public ToolWindow()// : base(PopupType.Menu) { var p = 6; panel = new ScrollView { Name = "panel" }; toolLabel = new ToolLabel { Name = "toolLabel", Text = "Label", FillWidth = true, }; toolClose = new ToolItem(OnCloseClick) { Name = "Close", Text = "Close", DisplayStyle = ToolItemDisplayStyle.Text }; toolAccept = new ToolItem(OnAcceptClick) { Name = "Accept", Text = "Ok", DisplayStyle = ToolItemDisplayStyle.Text }; bar = new Toolsbar( toolLabel, toolClose, toolAccept) { Name = "Bar" }; bar.ButtonPressed += OnContentMouseDown; bar.ButtonReleased += OnContentMouseUp; bar.MouseEntered += OnContentMouseEntered; bar.MouseExited += OnContentMouseExited; bar.MouseMoved += OnContentMouseMove; //hbox.Margin = new WidgetSpacing(padding, 0, padding, padding); vbox = new VBox { //Margin = new WidgetSpacing(padding, padding, padding, padding), Name = "tools" }; vbox.PackStart(panel, true, true); vbox.PackStart(bar, false, false); vbox.KeyPressed += OnContentKeyPress; BackgroundColor = GuiEnvironment.Theme["Window"].BaseColor.WithIncreasedLight(0.1D); Content = vbox; Decorated = false; Name = "ToolWindow"; //Resizable = false; Resizable = true; Size = new Size(360, 320); ShowInTaskbar = false; InitialLocation = WindowLocation.Manual; Padding = new WidgetSpacing(p, p, p, p); timerHide.Interval = 8000; timerHide.Elapsed += TimerHideTick; timerStart.Interval = 500; timerStart.Elapsed += TimerStartTick; }
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 ConfigurationSectionWidget(IConfigurationSection section) { if (section == null) { throw new ArgumentNullException(nameof(section)); } if (section.Service == null) { throw new InvalidOperationException("The service of a section is null"); } Section = section; Service = section.Service; BackgroundColor = Styles.BackgroundColor; InnerBackgroundColor = Styles.BaseBackgroundColor; BorderWidth = 0; Padding = new WidgetSpacing(15, 4, 15, 5); header = new HBox(); header.Spacing = 7; header.MarginLeft = 0; header.MarginRight = 15; header.MinHeight = 36; expanderImage = new ImageView(arrowRight); titleLabel = new Label { Text = this.Section.DisplayName }; statusLabel = new Label(GettextCatalog.GetString("Enabled")); statusLabel.TextColor = Styles.SecondaryTextColor; statusImage = new ImageView(ImageService.GetIcon("md-checkmark").WithSize(IconSize.Small)); statusBox = new HBox(); statusBox.MarginLeft = 10; statusBox.Spacing = 3; statusBox.PackStart(statusImage); statusBox.PackStart(statusLabel); var headerTitle = new HBox(); headerTitle.Spacing = 7; headerTitle.PackStart(expanderImage); headerTitle.PackStart(titleLabel); headerTitle.PackStart(statusBox); header.PackStart(headerTitle); addBtn = new Button(GettextCatalog.GetString("Add to the project")); addBtn.MinWidth = 128; addBtn.MinHeight = 34; header.PackEnd(addBtn); addBtn.VerticalPlacement = WidgetPlacement.Center; addBtn.Clicked += this.AddBtnClicked; var container = new VBox(); sectionWidget = GetSectionWidget(); sectionWidget.MarginLeft = sectionWidget.MarginRight = 15; sectionWidget.MarginBottom = 20; sectionWidget.Visible = false; container.PackStart(header); container.PackStart(sectionWidget); Content = container; UpdateStatus(); Section.StatusChanged += HandleSectionStatusChanged; Service.StatusChanged += HandleServiceStatusChanged; }
void CalcBorderSize (double windowWidth, double windowHeight) { if (borderCalculated) return; double left = 0; double top = 0; double right = 0; double bottom = 0; var c = (FrameworkElement)Content; if(this.WindowStyle != SW.WindowStyle.None) { var p = c.PointToScreenDpiAware (new SW.Point (0, 0)); left = p.X - Left; top = p.Y - Top; right = windowWidth - c.ActualWidth - left; bottom = windowHeight - c.ActualHeight - top; } frameBorder = new WidgetSpacing(left, top, right, bottom); borderCalculated = true; Left = initialX - left; Top = initialY - top; SetMinSize (minSizeRequested); // Border size calculation done and we can go back to Manual resize mode. // From now on, the content has to adapt to the size of the window. SizeToContent = System.Windows.SizeToContent.Manual; c.Width = double.NaN; c.Height = double.NaN; }
void CalcBorderSize (double windowWidth, double windowHeight) { if (borderCalculated) return; var c = (FrameworkElement)Content; var p = c.PointToScreen (new SW.Point (0, 0)); var left = p.X - Left; var top = p.Y - Top; frameBorder = new WidgetSpacing (left, top, windowWidth - c.ActualWidth - left, windowHeight - c.ActualHeight - top); borderCalculated = true; Left = initialX - left; Top = initialY - top; SetMinSize (minSizeRequested); // Border size calculation done and we can go back to Manual resize mode. // From now on, the content has to adapt to the size of the window. SizeToContent = System.Windows.SizeToContent.Manual; c.Width = double.NaN; c.Height = double.NaN; }
void CreateComponents() { Title = "DataBrithm - Game Algorithms DB"; Width = 800; Height = 600; var hpaned = new HPaned(); hpaned.BackgroundColor = Color.FromBytes(149, 167, 185); // In the left we have the list of algorithms var algorithmBox = new VBox(); hpaned.Panel1.Content = algorithmBox; algorithmTree = new TreeView(); algorithmTree.WidthRequest = 150; algorithmTree.HeadersVisible = false; algorithmBox.PackStart(algorithmTree, true, true); viewMode = new ComboBox(); viewMode.Items.Add("Algorithm list"); viewMode.Items.Add("Order by game"); var viewModeBox = new HBox(); viewModeBox.MarginLeft = 10; viewModeBox.PackStart(new Label("View Mode:")); viewModeBox.PackStart(viewMode); algorithmBox.PackStart(viewModeBox); // In the right the info about the algorithm var infoControlBox = new HBox(); hpaned.Panel2.Content = infoControlBox; var infoBox = new VBox(); infoControlBox.PackStart(infoBox, true); // ... first general game info gameInfo = new GameInfoView(); var gameInfoFrame = new Frame(); gameInfoFrame.Label = "Game information"; gameInfoFrame.Content = gameInfo; infoBox.PackStart(gameInfoFrame, false); // ... then the algorithm info algorithmView = new AlgorithmView(); var algorithmInfoFrame = new Frame(); algorithmInfoFrame.Label = "Algorithm information"; algorithmInfoFrame.Content = algorithmView; infoBox.PackStart(algorithmInfoFrame, true); // Create panel buttons bar var buttonBar = new VBox(); infoControlBox.PackStart(buttonBar, false); buttonBar.MarginRight = 5; buttonBar.MarginTop = 5; buttonBar.MarginBottom = 5; btnAdd = new Button(StockIcons.Add); buttonBar.PackEnd(btnAdd); btnEdit = new Button(StockIcons.Information); buttonBar.PackEnd(btnEdit); // Set window content Padding = new WidgetSpacing(); Content = hpaned; CloseRequested += HandleCloseRequested; }