Ejemplo n.º 1
0
        void HandleClicked(object sender, EventArgs e)
        {
            if (popover == null) {
                popover = new Popover ();

                var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
            //					table.Margin.SetAll (60);
                table.Attach (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
                table.Attach (new ComboBox (), 1, 0, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
                table.Attach (new ComboBox (), 1, 1, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
                table.Attach (new ComboBox (), 1, 2, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
                table.Attach (new SpinButton (), 1, 3, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                var b = new Button ("Add more");
                table.Attach (b, 0, 4);
                int next = 5;
                b.Clicked += delegate {
                    table.Attach (new Label ("Row " + next), 0, next++);
                };

                table.Margin = 20;
                popover.Content = table;
            }
            //			popover.Padding.SetAll (20);
            popover.Show (Popover.Position.Top, (Button)sender);
        }
Ejemplo n.º 2
0
        public XwtBoxTooltip(Widget child)
        {
            if (child == null)
            {
                throw new ArgumentNullException(nameof(child));
            }

            Content = child;
            // FIXME: WPF blocks the main Gtk loop and makes TooltipPopoverWindow unusable.
            //        We use the Xwt.Popover as a workaround for now.
            if (Surface.ToolkitEngine.Type == ToolkitType.Wpf)
            {
                xwtPopover = new Popover();
                xwtPopover.BackgroundColor = Styles.PopoverWindow.DefaultBackgroundColor;
                xwtPopover.Content         = new Label {
                    Wrap = WrapMode.Word
                };
                xwtPopover.Padding = 3;
            }
            else
            {
                tooltipWindow           = TooltipPopoverWindow.Create();
                tooltipWindow.ShowArrow = true;
            }
            Position = PopupPosition.Top;
            Severity = TaskSeverity.Information;
        }
Ejemplo n.º 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         HideTooltip();
         hideTooltipTimer?.Dispose();
         tooltipWindow?.Dispose();
         xwtPopover?.Dispose();
     }
     hideTooltipTimer = null;
     tooltipWindow    = null;
     xwtPopover       = null;
     base.Dispose(disposing);
 }
Ejemplo n.º 4
0
		void HandleClicked (object sender, EventArgs e)
		{
			if (popover == null) {
				popover = new Popover ();
				popover.Padding = 20;

				var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
//					table.Margin.SetAll (60);
				table.Add (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
				table.Add (new ComboBox (), 1, 0, vexpand:true);

				table.Add (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
				table.Add (new ComboBox (), 1, 1, vexpand:true);

				var cmbStyle = new ComboBox ();
				cmbStyle.Items.Add ("Normal");
				cmbStyle.Items.Add ("Bold");
				cmbStyle.Items.Add ("Italic");

				table.Add (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
				table.Add (cmbStyle, 1, 2, vexpand:true);

				table.Add (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
				table.Add (new SpinButton (), 1, 3, vexpand:true);

				var b = new Button ("Add more");
				table.Add (b, 0, 4);
				int next = 5;
				b.Clicked += delegate {
					table.Add (new Label ("Row " + next), 0, next++);
				};

				table.Margin = 20;
				popover.Content = table;
			}
//			popover.Padding.SetAll (20);
			popover.BackgroundColor = Xwt.Drawing.Colors.Yellow.WithAlpha(0.9);
			popover.Show (Popover.Position.Top, (Button)sender, new Rectangle (50, 10, 5, 5));
		}
Ejemplo n.º 5
0
		void HandleClicked2 (object sender, EventArgs e)
		{
			if (popover2 == null) {
				popover2 = new Popover ();

				var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
				table.Add (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
				table.Add (new ComboBox (), 1, 0, vexpand:true);

				table.Add (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
				table.Add (new ComboBox (), 1, 1, vexpand:true);

				table.Add (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
				table.Add (new ComboBox (), 1, 2, vexpand:true);

				table.Add (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
				table.Add (new SpinButton (), 1, 3, vexpand:true);

				var b = new Button ("Add more");
				table.Add (b, 0, 4);
				int next = 5;
				b.Clicked += delegate {
					table.Add (new Label ("Row " + next), 0, next++);
				};

				table.Margin = 6;
				popover2.Content = table;
			}

			var newRect = new Rectangle (((Button)sender).Size.Width * 0.66d, 0, 0, 0);
			popover2.Show (Popover.Position.Bottom, (Button)sender, newRect);
		}
Ejemplo n.º 6
0
		public XwtBoxTooltip (Widget child)
		{
			if (child == null)
				throw new ArgumentNullException (nameof (child));
			
			Content = child;
			// FIXME: WPF blocks the main Gtk loop and makes TooltipPopoverWindow unusable.
			//        We use the Xwt.Popover as a workaround for now.
			if (Surface.ToolkitEngine.Type == ToolkitType.Wpf) {
				xwtPopover = new Popover ();
				xwtPopover.BackgroundColor = Styles.PopoverWindow.DefaultBackgroundColor;
				xwtPopover.Content = new Label { Wrap = WrapMode.Word };
				xwtPopover.Padding = 3;
			} else {
				tooltipWindow = new TooltipPopoverWindow ();
				tooltipWindow.ShowArrow = true;
			}
			Position = PopupPosition.Top;
			Severity = TaskSeverity.Information;
		}