Popover 弹出窗组件
Inheritance: Tooltip
        private void Dismiss(UIImagePickerController picker, NSAction onDismiss)
        {
            if (this.viewController == null)
            {
                onDismiss();
                tcs = new TaskCompletionSource <MediaFile>();
            }
            else
            {
                NSNotificationCenter.DefaultCenter.RemoveObserver(this.observer);
                UIDevice.CurrentDevice.EndGeneratingDeviceOrientationNotifications();

                this.observer.Dispose();

                if (Popover != null)
                {
                    Popover.Dismiss(animated: true);
                    Popover.Dispose();
                    Popover = null;

                    onDismiss();
                }
                else
                {
                    picker.DismissViewController(true, onDismiss);
                    picker.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Dismisses the specified picker.
        /// </summary>
        /// <param name="picker">The picker.</param>
        /// <param name="onDismiss">The on dismiss.</param>
        private void Dismiss(UIImagePickerController picker, Action onDismiss)
        {
            if (_viewController == null)
            {
                onDismiss();
            }
            else
            {
                NSNotificationCenter.DefaultCenter.RemoveObserver(_observer);
                UIDevice.CurrentDevice.EndGeneratingDeviceOrientationNotifications();

                _observer.Dispose();

                if (Popover != null)
                {
                    Popover.Dismiss(true);
                    Popover.Dispose();
                    Popover = null;

                    onDismiss();
                }
                else
                {
                    picker.DismissViewController(true, onDismiss);
                    picker.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        IControl CreateContent(CreateProject createProject, IDialog <object> dialog, Version fuseVersion)
        {
            var projectList           = new ProjectList(new Shell(), createProject, dialog);
            var openProjectFromDialog =
                Command.Enabled(() => Application.ShowOpenDocumentDialog(DocumentTypes.Project));

            return(Popover.Host(popover =>
                                Layout.Dock()
                                .Top(
                                    CreateDashTopBar(fuseVersion)
                                    )
                                .Top(Separator.Medium)

                                .Right(Layout.StackFromTop(
                                           Layout.Dock()
                                           .Fill(
                                               Layout.SubdivideVertically(
                                                   InfoItem("Learn", "New to Fuse? Explore our Handbook,\r\nTutorials and Examples.", "http://go.fusetools.com/tutorials", "Outracks.Fuse.Icons.Dashboard.Learn.png"),
                                                   InfoItem("Docs", "Need some technical information?\r\nSearch the reference docs.", "https://go.fusetools.com/docs", "Outracks.Fuse.Icons.Dashboard.Docs.png"),
                                                   InfoItem("Community", "Made something cool? Join a thriving\r\ncommunity of Fuse enthusiasts.", "https://go.fusetools.com/community", "Outracks.Fuse.Icons.Dashboard.Community.png"))
                                               .WithPadding(
                                                   left: new Points(32),
                                                   top: new Points(40))
                                               .WithHeight(300)),
                                           Separator.Weak,
                                           CreateOpenButtons(openProjectFromDialog, projectList)
                                           )
                                       .WithWidth(260)
                                       .WithHeight(600)
                                       .WithBackground(Theme.PanelBackground))
                                .Fill(projectList.Page)
                                .WithBackground(Theme.WorkspaceBackground)
                                .WithHeight(608)
                                .WithWidth(970)));
        }
Exemplo n.º 4
0
        public override void OnLoad(EventArgs args)
        {
            popover = new TourPopover(productTour, theme, this.GetTargetBounds(productTour.ActiveItem.Widget));
            this.AddChild(popover);

            this.Focus();

            base.OnLoad(args);
        }
Exemplo n.º 5
0
            public void OnDoneClicked(object sender, EventArgs args)
            {
                //DateValue = timePicker.DateValue;
                Popover.Dismiss(true);

                if (DatePicked != null)
                {
                    DatePicked(this, EventArgs.Empty);
                }
            }
Exemplo n.º 6
0
 internal Accessible(Popover parent)
 {
     if (parent == null)
     {
         throw new ArgumentNullException(nameof(parent));
     }
     parentComponent    = parent;
     backendHost        = new AccessibleBackendHost();
     backendHost.Parent = this;
 }
        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));
        }
Exemplo n.º 8
0
        internal void SetActivePopover(
            Popover popover)
        {
            if ((null != popover) && (this._activePopover != null))
            {
                throw new NotSupportedException("Only one popover at a time is supported.");
            }

            this._activePopover = popover;

            this.OnNavigationComplete();
        }
Exemplo n.º 9
0
        public PopoverRenderer(
            global::Android.Content.Context context,
            Popover popover)
            : base(context, popover)
        {
            this._nativePopoverControl = new AndroidPopover(context)
            {
            };

            this._nativePopoverControl.DismissEvent += _PopoverControl_DismissEvent;

            //this.SetNativeElement(this._nativePopoverControl);
        }
        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);
        }
Exemplo n.º 11
0
        private bool TryClosePopover()
        {
            bool didClose = false;

            var popover = this._activePopover;

            if (null != popover)
            {
                popover.Close();
                this._activePopover = null;
                didClose            = true;
            }

            return(didClose);
        }
Exemplo n.º 12
0
        partial void DisplayPopover(Foundation.NSObject sender)
        {
            var button = sender as NSButton;

            if (PopoverShown)
            {
                Popover.Close();
                PopoverShown = false;
            }
            else
            {
                Popover.Show(button.Bounds, button, NSRectEdge.MaxXEdge);
                PopoverShown = true;
            }
        }
Exemplo n.º 13
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.SetAll(20);
                popover.Content = table;
            }
//			popover.Padding.SetAll (20);
            popover.Show(Popover.Position.Top, (Button)sender);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Displays the popover.
        /// </summary>
        /// <param name="hideFirst">if set to <c>true</c> [hide first].</param>
        public void DisplayPopover(bool hideFirst = false)
        {
            if (Popover == null)
            {
                return;
            }

            var swidth  = UIScreen.MainScreen.Bounds.Width;
            var sheight = UIScreen.MainScreen.Bounds.Height;

            float width  = 400;
            float height = 300;

            if (_orientation == null)
            {
                if (IsValidInterfaceOrientation(UIDevice.CurrentDevice.Orientation))
                {
                    _orientation = UIDevice.CurrentDevice.Orientation;
                }
                else
                {
                    _orientation = GetDeviceOrientation(_viewController.InterfaceOrientation);
                }
            }

            float x, y;

            if (_orientation == UIDeviceOrientation.LandscapeLeft || _orientation == UIDeviceOrientation.LandscapeRight)
            {
                y = (float)(swidth / 2) - (height / 2);
                x = (float)(sheight / 2) - (width / 2);
            }
            else
            {
                x = (float)(swidth / 2) - (width / 2);
                y = (float)(sheight / 2) - (height / 2);
            }

            if (hideFirst && Popover.PopoverVisible)
            {
                Popover.Dismiss(false);
            }
            var rec = new RectangleF(x, y, width, height);

            Popover.PresentFromRect(rec, View, 0, true);
        }
Exemplo n.º 15
0
        public void DisplayPopover(bool hideFirst = false)
        {
            if (Popover == null)
            {
                return;
            }

            var swidth  = UIScreen.MainScreen.Bounds.Width;
            var sheight = UIScreen.MainScreen.Bounds.Height;

            nfloat width  = 400;
            nfloat height = 300;


            if (orientation == null)
            {
                if (IsValidInterfaceOrientation(UIDevice.CurrentDevice.Orientation))
                {
                    orientation = UIDevice.CurrentDevice.Orientation;
                }
                else
                {
                    orientation = GetDeviceOrientation(this.viewController.InterfaceOrientation);
                }
            }

            nfloat x, y;

            if (orientation == UIDeviceOrientation.LandscapeLeft || orientation == UIDeviceOrientation.LandscapeRight)
            {
                y = (swidth / 2) - (height / 2);
                x = (sheight / 2) - (width / 2);
            }
            else
            {
                x = (swidth / 2) - (width / 2);
                y = (sheight / 2) - (height / 2);
            }

            if (hideFirst && Popover.PopoverVisible)
            {
                Popover.Dismiss(animated: false);
            }

            Popover.PresentFromRect(new CGRect(x, y, width, height), View, 0, animated: true);
        }
Exemplo n.º 16
0
            public DockPanelItem(DockItem item)
            {
                Item         = item;
                Pane         = new Paned(Orientation.Vertical);
                ReopenButton = new Button(new Label(item.Label)
                {
                    Angle = 270
                });

                popover          = new Popover(ReopenButton);
                popover.Position = PositionType.Left;

                ReopenButton.Clicked += (o, args) => {
                    popover.ShowAll();
                    popover.Popup();
                };
            }
Exemplo n.º 17
0
        public ItemPicker()
        {
            ReadOnly        = true;
            PlaceholderText = Application.TranslationCatalog.GetString("Click o press Intro or Space to select one item");
            TooltipText     = Application.TranslationCatalog.GetString("Click o press Intro or Space to select one item from the list");

            var popoverBox = new VBox();

            popoverBox.PackStart(listBoxFilter, true, true);
            popoverBox.PackEnd(selectedItemClear, false, true);

            var popover = new Popover {
                Content = popoverBox,
            };

            Activated += delegate {
                if (!DisabledPicker)
                {
                    popover.Show(Popover.Position.Top, this);
                    listBoxFilter.Search.SetFocus();
                }
            };
            ButtonPressed += delegate {
                if (!DisabledPicker)
                {
                    popover.Show(Popover.Position.Top, this);
                    listBoxFilter.Search.SetFocus();
                }
            };

            listBoxFilter.ListBox.RowActivated += delegate {
                if (listBoxFilter.SelectedItem != null)
                {
                    popover.Hide();
                    SelectedItem = listBoxFilter.SelectedItem;
                }
            };

            selectedItemClear.Clicked += delegate {
                listBoxFilter.UnselectAll();
                popover.Hide();
                SelectedItem = default(T);
            };
        }
Exemplo n.º 18
0
        private void Show()
        {
            Popover portal = null;

            Control RenderItem(Item item)
            {
                var children = new List <Control>();

                if (item.Icon != null)
                {
                    var icon = new Control();
                    icon.HtmlElement.InnerHtml = item.Icon;
                    children.Add(icon);
                }

                children.Add(new Span(item.Label));

                var control = new Control("li", children);

                control.Enabled = item.Enabled;
                if (item.Enabled)
                {
                    control.Click += (_, __) =>
                    {
                        portal?.Clear();
                        if (item.OnClick != null)
                        {
                            item.OnClick?.Invoke(item);
                        }
                        else
                        {
                            ItemSelected?.Invoke(this, item);
                        }
                    };
                }
                return(control);
            }

            var menu = new Div(new Control("ul",
                                           _items.Where(e => e != null).Select(RenderItem).ToArray())).SetClass("context-menu");

            portal = _bladeManager.ShowPopover(menu, _target.HtmlElement.ID);
        }
Exemplo n.º 19
0
 public CustomerInformationViewController()
 {
     this.PreferredContentSize = new System.Drawing.SizeF(700, 400);
     this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, async(s, e) => {
         view.DismisKeyboard();
         BigTed.BTProgressHUD.Show();
         bool success = false;
         if (string.IsNullOrEmpty(Customer.CustomerId))
         {
             success = await InsertCustomer();
         }
         else
         {
             success = await UpdateCustomer();
         }
         BigTed.BTProgressHUD.Dismiss();
         if (!success)
         {
             new SimpleAlertView("Error", "There was an error saving the customer. Please try again.").Show();
             return;
         }
         if (Created != null)
         {
             Created(Customer);
         }
         if (!IsCreate)
         {
             Popover.Dismiss(true);
         }
     });
     this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (s, e) => {
         view.DismisKeyboard();
         if (IsCreate)
         {
             NavigationController.PopViewControllerAnimated(true);
         }
         else
         {
             Popover.Dismiss(true);
         }
     });
 }
Exemplo n.º 20
0
        public PopoverRenderer(
            Popover popover)
            : base(popover)
        {
            this._xamlPopupControl = new XamlPopup()
            {
                IsLightDismissEnabled = true,
                VerticalAlignment     = global::Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment   = global::Windows.UI.Xaml.HorizontalAlignment.Center,
                Visibility            = Visibility.Collapsed,
            };

            this._xamlPopupControl.Loaded   += PopupControl_Loaded;
            this._xamlPopupControl.Unloaded += PopupControl_Unloaded;
            this._xamlPopupControl.Opened   += PopupControl_Opened;
            this._xamlPopupControl.Closed   += PopupControl_Closed;

            this.SetNativeElement(this._xamlPopupControl);

            this.CenterPopup();
        }
Exemplo n.º 21
0
            public DatePickerController(DateTime date)
            {
                Title = "Pick a Date";

                View = picker = new UIDatePicker(new RectangleF(PointF.Empty, DatePickerSize))
                {
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                    Mode             = UIDatePickerMode.Date,
                    Date             = date,
                };

                cancel = new UIBarButtonItem(UIBarButtonSystemItem.Cancel);
                NavigationItem.LeftBarButtonItem = cancel;
                cancel.Clicked += (sender, e) => {
                    Popover.Dismiss(true);
                };

                //editTime = new UIBarButtonItem ("Time", UIBarButtonItemStyle.Plain, OnEditClicked);
                //NavigationItem.RightBarButtonItem = editTime;

                done = new UIBarButtonItem(UIBarButtonSystemItem.Done);
                NavigationItem.RightBarButtonItem = done;
                done.Clicked += OnDoneClicked;
            }
Exemplo n.º 22
0
        private void Dismiss(UIImagePickerController picker, NSAction onDismiss)
        {
            if (viewController == null)
            {
                onDismiss();
                tcs = new TaskCompletionSource <MediaFile>();
            }
            else
            {
                if (Popover != null)
                {
                    Popover.Dismiss(animated: true);
                    Popover.Dispose();
                    Popover = null;

                    onDismiss();
                }
                else
                {
                    picker.DismissViewController(true, onDismiss);
                    picker.Dispose();
                }
            }
        }
Exemplo n.º 23
0
		public void InitializeBackend (object frontend, ApplicationContext context)
		{
			this.frontend = (Popover) frontend;
		}
Exemplo n.º 24
0
 public void InitializeBackend(object frontend, ApplicationContext context)
 {
     this.frontend = (Popover)frontend;
 }
Exemplo n.º 25
0
 public void InitializeBackend(object frontend)
 {
     this.frontend = (Popover)frontend;
 }
Exemplo n.º 26
0
 public BootstrapIcon Popover(Popover popover)
 {
     this._popover = popover;
     return(this);
 }
 public BootstrapIcon Popover(Popover popover)
 {
     this._popover = popover;
     return this;
 }
Exemplo n.º 28
0
        public PrototypeWindow Composed()
        {
            Title = "Limada Xwt Prototype";
            var width = 500;

            Width  = width;
            Height = 400;

            try {
                statusIcon      = Application.CreateStatusIcon();
                statusIcon.Menu = new Menu();
                statusIcon.Menu.Items.Add(new MenuItem("Test"));
            } catch {
                Trace.WriteLine("Status icon could not be shown");
            }

            var data = new PrototypeData();

            var imageDisplay = new ImageDisplay {
                Data      = data.Image(ctx => data.FontTest(ctx)),
                BackColor = Colors.White,
                ZoomState = ZoomState.FitToScreen,
            };

            var visualsDisplay = new VisualsDisplay {
                BackColor = Colors.White,
            };

            visualsDisplay.Layout.Dimension = Dimension.Y;
            visualsDisplay.Layout.Distance  = new Xwt.Size(60, 60);
            visualsDisplay.StyleSheet.EdgeStyle.DefaultStyle.PaintData = true;
            visualsDisplay.Data = data.Scene;

            var box = new HPaned();

            box.Panel1.Content = visualsDisplay.WithScrollView();
            box.Panel2.Content = imageDisplay.WithScrollView();
            //box.Panel2.Content = new Label();
            box.Panel2.Resize = true;
            box.Position      = width / 2;
            BoundsChanged    += (s, e) => {
                box.Position = this.Width / 2;
            };

            Content = box;

            CloseRequested += (s, e) => {
                e.AllowClose = MessageDialog.Confirm("Samples will be closed", Command.Ok);
                if (e.AllowClose)
                {
                    Application.Exit();
                }
            };

            Action popover = () => {
                var popV = new Popover(new Label {
                    Text = "hy"
                });
                popV.Show(Popover.Position.Bottom, box.Panel1.Content);
            };
            Action edit = () => {
                var edite = new TextEntry();
                (visualsDisplay.Backend as Canvas).AddChild(edite, new Rectangle(40, 40, 100, 20));
            };
            Action changeView = () => {
                var one = box.Panel1.Content;
                var two = box.Panel2.Content;
                box.Panel1.Content = null;
                box.Panel2.Content = null;
                box.Panel1.Content = two;
                box.Panel2.Content = one;
            };
            Action newImageDisplay = () => {
                imageDisplay = new ImageDisplay {
                    Data      = data.Image(ctx => data.FontTest(ctx)),
                    BackColor = Colors.White
                };
                box.Panel2.Content = imageDisplay.Backend as Widget;
            };
            Action nextImage = () => {
                imageDisplay.Data = data.Image(ctx => data.FontTest(ctx));
            };

            visualsDisplay.SceneFocusChanged += (s, e) => nextImage();
            //(visualsDisplay.Backend as Widget).ButtonPressed += (s, e) => nextImage();

            MainMenu = new Menu(
                new MenuItem("_File", null, null,
                             new MenuItem("_Open"),
                             new MenuItem("_New"),
                             new MenuItem("_Close", null, (s, e) => this.Close())
                             ),
                new MenuItem("_Edit", null, null,
                             new MenuItem("Change View", null, (s, e) => changeView()),
                             new MenuItem("Edit", null, (s, e) => edit())
                             )
                );

            return(this);
        }
Exemplo n.º 29
0
 internal Accessible(Popover parent) : this((XwtComponent)parent)
 {
 }
 public T Popover(Popover popover)
 {
     this._model.popover = popover;
     return((T)this);
 }
Exemplo n.º 31
0
 public IPopoverRenderer CreatePopoverRenderer(
     Popover popover)
 {
     return(new PopoverRenderer(this._androidApplication.ApplicationContext, popover));
 }
Exemplo n.º 32
0
 public void InitializeBackend(object frontend)
 {
     this.frontend = (Popover) frontend;
 }
Exemplo n.º 33
0
 public IPopoverRenderer CreatePopoverRenderer(
     Popover popover)
 {
     return(new PopoverRenderer(popover));
 }