Beispiel #1
0
 public virtual void OnSpacingChanged(WidgetSpacing source)
 {
     if (source == Parent.margin)
     {
         Parent.OnPreferredSizeChanged();
     }
 }
Beispiel #2
0
 internal Window(WidgetSpacing initialPadding)
 {
     if (!initialPadding.IsZero)
     {
         Padding = initialPadding;
     }
 }
Beispiel #3
0
        public MainWindow()
        {
            var w = System.Diagnostics.Stopwatch.StartNew();
            Title = "4Plug v2 beta";

            Width = 870;
            Height = 550;

            Padding = new WidgetSpacing();

            //Menu
            //Menu mainMenu = new Menu();
            //var m = new MenuItem("Close");
            //Menu subMenu = new Menu();
            //subMenu.Items.Add(new MenuItem("HAH"));
            //m.SubMenu = subMenu;
            //mainMenu.Items.Add(m);
            //this.MainMenu = mainMenu;

            //Flow Control
            flowControl = new PluginWidgetLayout();
            flowControl.Padding = new WidgetSpacing(16, 0, 8, 16);

            flowControl.AddChild(new PluginTitleWidget(PluginType.Hud));
            flowControl.AddChild(new PluginTitleWidget(PluginType.Unknown));
            flowControl.AddChild(new PluginTitleWidget(PluginType.Vpk));
            flowControl.AddChild(new PluginTitleWidget(PluginType.Hitsound));
            flowControl.AddChild(new PluginTitleWidget(PluginType.Addon));

            //flowControl.AddChild(new AddPluginWidget(PluginType.Hud));
            ////flowControl.AddChild(new AddPluginWidget(PluginType.Unknown));
            //flowControl.AddChild(new AddPluginWidget(PluginType.Vpk));
            //flowControl.AddChild(new AddPluginWidget(PluginType.Hitsound));
            //flowControl.AddChild(new AddPluginWidget(PluginType.Addon));

            scrollView = new ScrollView();
            scrollView.Content = flowControl;
            flowControl.BackgroundColor = Color.FromBytes(240, 240, 240);
            Content = scrollView;

            flowControl.layout = false;
            LoadPlugins();
            flowControl.layout = true;
            flowControl.Layout();

            //new Popover() { Content = new Label("eyyy leute") }.Show(Popover.Position.Top, scrollView);

            //Finish
            CloseRequested += HandleCloseRequested;
            w.Stop();
            Console.WriteLine("MainWindow..ctor(): " + w.ElapsedMilliseconds + "ms");
        }
		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();
		}
		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);
		}
Beispiel #6
0
        public override string ConvertToString(object value, IValueSerializerContext context)
        {
            WidgetSpacing s = (WidgetSpacing)value;

            if (s.Left == s.Right && s.Right == s.Top && s.Top == s.Bottom)
            {
                return(s.Left.ToString(CultureInfo.InvariantCulture));
            }
            if (s.Bottom != 0)
            {
                return(s.Left.ToString(CultureInfo.InvariantCulture) + " " + s.Top.ToString(CultureInfo.InvariantCulture) + " " + s.Right.ToString(CultureInfo.InvariantCulture) + " " + s.Bottom.ToString(CultureInfo.InvariantCulture));
            }
            if (s.Right != 0)
            {
                return(s.Left.ToString(CultureInfo.InvariantCulture) + " " + s.Top.ToString(CultureInfo.InvariantCulture) + " " + s.Right.ToString(CultureInfo.InvariantCulture));
            }
            return(s.Left.ToString(CultureInfo.InvariantCulture) + " " + s.Top.ToString(CultureInfo.InvariantCulture));
        }
Beispiel #7
0
            public override void OnSpacingChanged(WidgetSpacing source)
            {
                Frame f = (Frame)Parent;

                if (source == f.borderWidth)
                {
                    f.Backend.SetBorderSize(source.Left, source.Right, source.Top, source.Bottom);
                    f.OnPreferredSizeChanged();
                }
                else if (source == f.padding)
                {
                    f.Backend.SetPadding(source.Left, source.Right, source.Top, source.Bottom);
                    f.OnPreferredSizeChanged();
                }
                else
                {
                    base.OnSpacingChanged(source);
                }
            }
Beispiel #8
0
        public ImageViewDialog(Image image)
        {
            Decorated = false;
            ShowInTaskbar = false;
            FullScreen = true;
            Padding = new WidgetSpacing();

            table = new Table();
            table.BackgroundColor = Colors.Black;

            Button btnLeft = new Button("<");
            btnLeft.Clicked += (sender, e) => this.Dispose();
            table.Add(btnLeft, 0, 0, vpos: WidgetPlacement.Center);
            var imgCanvas = new ImageCanvas(image);
            imgCanvas.WidthRequest = image.Width;
            imgCanvas.HeightRequest = image.Height;
            table.Add(imgCanvas, 1, 0, 1, 1, true, true,
                WidgetPlacement.Center, WidgetPlacement.Center);
            table.Add(new Button(">"), 2, 0, vpos: WidgetPlacement.Center);

            Content = table;
        }
Beispiel #9
0
        public override object ConvertFromString(string value, IValueSerializerContext context)
        {
            WidgetSpacing c = new WidgetSpacing();

            string[] values = value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (values.Length == 0)
            {
                return(c);
            }

            double v;

            if (double.TryParse(values [0], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
            {
                c.Left = v;
            }

            if (value.Length == 1)
            {
                c.Top = c.Right = c.Bottom = v;
                return(c);
            }

            if (value.Length >= 2 && double.TryParse(values [1], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
            {
                c.Top = v;
            }
            if (value.Length >= 3 && double.TryParse(values [2], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
            {
                c.Right = v;
            }
            if (value.Length >= 4 && double.TryParse(values [3], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
            {
                c.Bottom = v;
            }
            return(c);
        }
Beispiel #10
0
 public virtual void OnSpacingChanged(WidgetSpacing source)
 {
     if (source == Parent.margin)
         Parent.OnPreferredSizeChanged ();
 }
		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;
		}
Beispiel #12
0
		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();
		}
Beispiel #13
0
 public Placement()
 {
     Padding = new WidgetSpacing(this);
 }
Beispiel #14
0
 public GroupContainer()
 {
     Padding = new WidgetSpacing(8, 18, 8, 10);
 }
		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;
		}
Beispiel #16
0
 public Frame()
 {
     borderWidth = new WidgetSpacing (this.WidgetEventSink);
     padding = new WidgetSpacing (this.WidgetEventSink);
 }
Beispiel #17
0
 public void OnSpacingChanged(WidgetSpacing source)
 {
 }
Beispiel #18
0
 public Window(string title)
     : base(title)
 {
     padding = new WidgetSpacing ((EventSink)WindowEventSink);
 }
Beispiel #19
0
 public override void OnSpacingChanged(WidgetSpacing source)
 {
     Frame f = (Frame)Parent;
     if (source == f.borderWidth) {
         f.Backend.SetBorderSize (source.Left, source.Right, source.Top, source.Bottom);
         f.OnPreferredSizeChanged ();
     }
     else if (source == f.padding) {
         f.Backend.SetPadding (source.Left, source.Right, source.Top, source.Bottom);
         f.OnPreferredSizeChanged ();
     }
     else
         base.OnSpacingChanged (source);
 }
Beispiel #20
0
 public Window()
 {
     padding = new WidgetSpacing ((EventSink)WindowEventSink);
     padding.SetAll (6);
 }
Beispiel #21
0
        public HudsTFWidget(string title, string creator, string imgUrl, string hudstfUrl, string download, string website)
        {
            var downloadLower = download.ToLower();

            AddChild(ImageView = new ImageView() { WidthRequest = ImageSize.Width, HeightRequest = ImageSize.Height }, new Rectangle(1, 1, ImageSize.Width, ImageSize.Height));
            AddChild(titleLabel = new Label(title + " by " + creator) { TextColor = Colors.White }, new Rectangle(4, 0, ImageSize.Width, 40));

            titleLabel.Font = titleLabel.Font.WithScaledSize(1.5);
            titleLabel.WidthRequest = ImageSize.Width;
            titleLabel.HeightRequest = 40;
            titleLabel.QueueForReallocate();

            WidthRequest = ImageSize.Width + 2;
            HeightRequest = ImageSize.Height + 39;

            if (hudstfUrl != null)
            {
                hudstfButton = new ImageButton(57, 16, HudsTfLogo);
                hudstfButton.Click += (s, e) => { Desktop.OpenUrl(hudstfUrl); };

                AddChild(hudstfButton, ImageSize.Width - 64, ImageSize.Height + 11);
                //AddChild(hudstfButton, ImageSize.Width - 61, 24);
            }

            if (website != null)
            {
                websiteButton = new ImageButton(16, 16, QuadImageLinkButton.DefaultImage);
                websiteButton.Click += (s, e) => { Desktop.OpenUrl(website); };

                AddChild(websiteButton, ImageSize.Width - 84, ImageSize.Height + 11);
                //AddChild(websiteButton, ImageSize.Width - 81, 24);
            }

            bool hasDirectDownload = true;
            string zipLink = null;

            //string zipLink = download.Contains("github.com") || download.Contains("gitgud.net");
            if (downloadLower.Contains("github.com"))
                zipLink = download.TrimEnd('/') + "/archive/master.zip";
            else if (downloadLower.Contains("gitgud.net"))
                zipLink = download.TrimEnd('/') + "/repository/archive.zip";
            else
                hasDirectDownload = false;

            if (hasDirectDownload)
            {
                githubButton = new ImageButton(16, 16, GithubLogo);
                githubButton.Click += (s, e) => { Desktop.OpenUrl(download); };

                AddChild(githubButton, ImageSize.Width - 104, ImageSize.Height + 11);
            }

            dlButton = new Button();
            dlButton.Label = hasDirectDownload ? "Install" : "Get";
            dlButton.WidthRequest = 120;
            dlButton.HeightRequest = 24;
            //dlButton.Sensitive = downloadIsGithub;
            //https://gitgud.net/JediThug/jedihud/repository/archive.zip

            dlButton.Clicked += (s, e) =>
            {
                if (hasDirectDownload)
                {
                    DownloadHudWidget dl = new DownloadHudWidget("Fetching " + zipLink);

                    dl.DownloadFinished += (s2, e2) =>
                    {
                        try
                        {
                            if (!App.InstallZip(new MemoryStream(e2.Result), title))
                                MessageDialog.ShowError("Installing the Hud failed", "You can try to install it yourself.");
                        }
                        catch { }
                        Application.Invoke(() => { App.MainWindow.RemovePlugin(dl); });//App.MainWindow.Layout.RemoveChild(this));
                        Dispose();
                    };

                    dl.Download(zipLink);

                    App.MainWindow.Present();
                    System.Threading.Thread.Sleep(50);
                    App.MainWindow.Layout.AddChild(dl);
                }
                else
                {
                    Desktop.OpenUrl(download);
                }
            };

            AddChild(dlButton, 7, ImageSize.Height + 7);
            //AddChild(dlButton, 4, 20);

            Margin = new WidgetSpacing(4,4,4,4);

            //OnMouseExited(null);
        }
Beispiel #22
0
        private void CreateComponents()
        {
            Width  = 1150;
            Height = 600;
            Icon = ResourcesManager.GetImage("icon.png");

            Version version = Assembly.GetExecutingAssembly().GetName().Version;
            Title  = string.Format("Deblocus - v{0}.{1}.{2}",
                version.Major, version.Minor, version.Build);

            var menuPanelDivision = new HPaned();
            menuPanelDivision.BackgroundColor = LightBlue;
            menuPanelDivision.Panel1.Content = MakeSidebar();
            menuPanelDivision.Panel2.Content = MakePanel();

            // Set the content
            Padding = new WidgetSpacing();
            Content = mainContent = menuPanelDivision;

            CloseRequested += WindowCloseRequested;
        }
Beispiel #23
0
 public Window()
 {
     padding = new WidgetSpacing((EventSink)WindowEventSink, null);
     padding.SetAll(6);
 }
Beispiel #24
0
 public Popover()
 {
     padding = new WidgetSpacing((PopoverBackendHost)BackendHost);
 }
Beispiel #25
0
        public override object ConvertFromString(string value, IValueSerializerContext context)
        {
            WidgetSpacing c = new WidgetSpacing ();
            string[] values = value.Split (new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (values.Length == 0)
                return c;

            double v;
            if (double.TryParse (values [0], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
                c.Left = v;

            if (value.Length == 1) {
                c.Top = c.Right = c.Bottom = v;
                return c;
            }

            if (value.Length >= 2 && double.TryParse (values [1], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
                c.Top = v;
            if (value.Length >= 3 && double.TryParse (values [2], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
                c.Right = v;
            if (value.Length >= 4 && double.TryParse (values [3], NumberStyles.Any, CultureInfo.InvariantCulture, out v))
                c.Bottom = v;
            return c;
        }
Beispiel #26
0
 public Window()
 {
     padding = 6;
 }
Beispiel #27
0
 public void OnSpacingChanged(WidgetSpacing spacing)
 {
     OnPreferredSizeChanged ();
 }
Beispiel #28
0
            public void OnSpacingChanged(WidgetSpacing source)
            {
                var w = (Window)Parent;

                w.Backend.SetPadding(w.padding.Left, w.padding.Top, w.padding.Right, w.padding.Bottom);
            }
Beispiel #29
0
 public Frame()
 {
     borderWidth = new WidgetSpacing(this.WidgetEventSink);
     padding     = new WidgetSpacing(this.WidgetEventSink);
 }
Beispiel #30
0
 public Window()
 {
     padding = new WidgetSpacing((WindowBackendHost)BackendHost);
     padding.SetAll(6);
 }
Beispiel #31
0
 public void OnSpacingChanged(WidgetSpacing spacing)
 {
     OnPreferredSizeChanged();
 }
Beispiel #32
0
 public Window(string title) : base(title)
 {
     padding = new WidgetSpacing((WindowBackendHost)BackendHost);
 }
Beispiel #33
0
        public MainWindow()
        {
            var w = System.Diagnostics.Stopwatch.StartNew();
            Title = App.WindowTitle;

            this.Icon = App.Icon;

            Width = 870;
            Height = 550;

            Padding = new WidgetSpacing();

            new Task(() => CheckUpdates()).Start();

            //Menu
            Menu mainMenu = new Menu();
            {
                {
                    var sub = new MenuItem("4Plug");

                    Menu subMenu = new Menu();
                    {
                        MenuItem m;

                        subMenu.Items.Add(m = new MenuItem("Reload Plugins") { Image = imgRefresh });
                        m.Clicked += (s, e) => { LoadPlugins(); };

                        subMenu.Items.Add(m = new SeparatorMenuItem());

                        subMenu.Items.Add(m = new MenuItem("Submit Feedback"));
                        m.Clicked += (s, e) => { new SubmitFeedbackWindow("via Main Window").Run(this); };

                        subMenu.Items.Add(m = new MenuItem("Program Folder"));
                        m.Clicked += (s, e) => { Xwt.Desktop.OpenFolder(Environment.CurrentDirectory); };

                        subMenu.Items.Add(m = new MenuItem("Exit"));
                        m.Clicked += (s, e) => { Close(); };
                    }

                    sub.SubMenu = subMenu;
                    mainMenu.Items.Add(sub);
                }

                {
                    var sub = new MenuItem("Games");

                    Menu subMenu = gamesMenu = new Menu();
                    {
                        MenuItem m;
                        subMenu.Items.Add(m = new MenuItem("Manage Games") { Image = imgGear });
                        m.Clicked += (s, e) => { ShowGameSelector(); };

                        subMenu.Items.Add(new SeparatorMenuItem());

                        //subMenu.Items.Add(m = new MenuItem("Team Fortress 2"));
                        //m.Clicked += (s, e) => { Xwt.Desktop.OpenUrl("http://steamcommunity.com/groups/4stuff"); };
                    }

                    sub.SubMenu = subMenu;
                    mainMenu.Items.Add(sub);
                }

                {
                    //var sub = new MenuItem("Current Game");
                    //
                    //CustomGameMenu = sub;
                    //
                    //mainMenu.Items.Add(sub);
                }

                {
                    var sub = new MenuItem("About");

                    Menu subMenu = new Menu();
                    {
                        MenuItem m;
                        subMenu.Items.Add(m = new MenuItem("Steam Group") { Image = imgSteam });
                        m.Clicked += (s, e) => { Xwt.Desktop.OpenUrl(App.SteamGroup); };
                        subMenu.Items.Add(m = new MenuItem("TeamFortress.TV Thread") { Image = imgTFTV });
                        m.Clicked += (s, e) => { Xwt.Desktop.OpenUrl(App.TfTvThread); };

                        subMenu.Items.Add(new SeparatorMenuItem());

                        subMenu.Items.Add(m = new MenuItem("Licenses"));
                        m.Clicked += (s, e) => { new LicensesWindow().Show(); };
                    }

                    sub.SubMenu = subMenu;
                    mainMenu.Items.Add(sub);
                }
            }
            this.MainMenu = mainMenu;

            //if (BackendHost.ToolkitEngine.Type == ToolkitType.Wpf)
            //    mainMenu.Items.Do(item => item.Label = item.Label.ToUpper());

            //Flow Control
            layout = new PluginWidgetLayout();
            layout.Padding = new WidgetSpacing(16, 0, 8, 16);

            scrollView = new ScrollView();
            scrollView.Content = layout;
            //layout.BackgroundColor = Color.FromBytes(240, 240, 240);
            layout.BackgroundColor = Colors.White;
            //layout.BackgroundColor = Color.FromBytes(64, 64, 64);
            Content = scrollView;

            //LoadPlugins();
            //ReloadGames();

            //new Popover() { Content = new Label("eyyy leute") }.Show(Popover.Position.Top, scrollView);

            //Finish
            //CloseRequested += HandleCloseRequested;
            w.Stop();
            Console.WriteLine("MainWindow..ctor(): " + w.ElapsedMilliseconds + "ms");

            if (App.BeforeWindowShown != null)
                App.BeforeWindowShown(BackendHost.Backend);
        }
Beispiel #34
0
 public Window()
 {
     padding = new WidgetSpacing ((WindowBackendHost)BackendHost);
     padding.SetAll (6);
 }
Beispiel #35
0
 public Widget()
 {
     eventSink        = CreateEventSink();
     eventSink.Parent = this;
     margin           = new Xwt.WidgetSpacing(eventSink, null);
 }
Beispiel #36
0
        protected override void OnBoundsChanged()
        {
            base.OnBoundsChanged();

            padding = new WidgetSpacing(padding.Left, (Size.Height - text.GetSize().Height) / 2, padding.Right, 0);
        }
Beispiel #37
0
 public Widget()
 {
     eventSink = CreateEventSink ();
     eventSink.Parent = this;
     margin = new Xwt.WidgetSpacing (eventSink);
 }
Beispiel #38
0
 public Window()
 {
     padding = 6;
 }
Beispiel #39
0
			void UpdateSpacing ()
			{
				Spacing = new WidgetSpacing (
					Math.Max (TopLeft, BottomLeft),
					Math.Max (TopLeft, TopRight),
					Math.Max (TopRight, BottomRight),
					Math.Max (BottomLeft, BottomRight)
				);
			}
Beispiel #40
0
 public Frame()
 {
     borderWidth = new WidgetSpacing(this.BackendHost);
     padding     = new WidgetSpacing(this.BackendHost);
 }
Beispiel #41
0
 public Window(string title) : base(title)
 {
     padding = new WidgetSpacing((EventSink)WindowEventSink, null);
 }
Beispiel #42
0
 public Placement()
 {
     Padding = new WidgetSpacing (this);
 }
Beispiel #43
0
 public void OnSpacingChanged(WidgetSpacing source)
 {
     var w = (Window) Parent;
     w.Backend.SetPadding (w.padding.Left, w.padding.Top, w.padding.Right, w.padding.Bottom);
 }
Beispiel #44
0
 public Tab()
 {
     Padding = new WidgetSpacing();
 }
Beispiel #45
0
 public Window(string title)
     : base(title)
 {
     padding = new WidgetSpacing ((WindowBackendHost)BackendHost);
 }
Beispiel #46
0
 public Frame()
 {
     borderWidth = new WidgetSpacing (this.BackendHost);
     padding = new WidgetSpacing (this.BackendHost);
 }