/// <summary> /// Raises the DisplayPopupPage event. /// </summary> /// <param name="e">A PopupPageEventArgs containing event data.</param> protected internal virtual void OnDisplayPopupPage(PopupPageEventArgs e) { if (DisplayPopupPage != null) DisplayPopupPage(this, e); }
/// <summary> /// Show the group popup relative to the parent group instance. /// </summary> /// <param name="parentScreenRect">Screen rectangle of the parent.</param> public void ShowCalculatingSize(Rectangle parentScreenRect) { // Get the size the popup would like to be Size popupSize = ViewManager.GetPreferredSize(Renderer, Size.Empty); // Get the resolved position for the popup page PopupPagePosition position = _navigator.ResolvePopupPagePosition(); // Find the size and position relative to the parent screen rect switch (position) { case PopupPagePosition.AboveNear: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Top - _navigator.PopupPages.Gap - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.AboveMatch: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Top - _navigator.PopupPages.Gap - popupSize.Height, parentScreenRect.Width, popupSize.Height); break; case PopupPagePosition.AboveFar: parentScreenRect = new Rectangle(parentScreenRect.Right - popupSize.Width, parentScreenRect.Top - _navigator.PopupPages.Gap - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.BelowNear: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Bottom + _navigator.PopupPages.Gap, popupSize.Width, popupSize.Height); break; case PopupPagePosition.BelowMatch: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Bottom + _navigator.PopupPages.Gap, parentScreenRect.Width, popupSize.Height); break; case PopupPagePosition.BelowFar: parentScreenRect = new Rectangle(parentScreenRect.Right - popupSize.Width, parentScreenRect.Bottom + _navigator.PopupPages.Gap, popupSize.Width, popupSize.Height); break; case PopupPagePosition.FarBottom: parentScreenRect = new Rectangle(parentScreenRect.Right + _navigator.PopupPages.Gap, parentScreenRect.Bottom - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.FarMatch: parentScreenRect = new Rectangle(parentScreenRect.Right + _navigator.PopupPages.Gap, parentScreenRect.Top, popupSize.Width, parentScreenRect.Height); break; case PopupPagePosition.FarTop: parentScreenRect = new Rectangle(parentScreenRect.Right + _navigator.PopupPages.Gap, parentScreenRect.Top, popupSize.Width, popupSize.Height); break; case PopupPagePosition.NearBottom: parentScreenRect = new Rectangle(parentScreenRect.Left - _navigator.PopupPages.Gap - popupSize.Width, parentScreenRect.Bottom - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.NearMatch: parentScreenRect = new Rectangle(parentScreenRect.Left - _navigator.PopupPages.Gap - popupSize.Width, parentScreenRect.Top, popupSize.Width, parentScreenRect.Height); break; case PopupPagePosition.NearTop: parentScreenRect = new Rectangle(parentScreenRect.Left - _navigator.PopupPages.Gap - popupSize.Width, parentScreenRect.Top, popupSize.Width, popupSize.Height); break; } PopupPageEventArgs e = new PopupPageEventArgs(_page, _navigator.Pages.IndexOf(_page), parentScreenRect); // Use event to allow the popup to be cancelled or the position altered _navigator.OnDisplayPopupPage(e); // Do we need to kill ourself if (!e.Cancel) Show(e.ScreenRect); else Dispose(); }
/// <summary> /// Show the group popup relative to the parent group instance. /// </summary> /// <param name="parentScreenRect">Screen rectangle of the parent.</param> public void ShowCalculatingSize(Rectangle parentScreenRect) { // Get the size the popup would like to be Size popupSize = ViewManager.GetPreferredSize(Renderer, Size.Empty); // Get the resolved position for the popup page PopupPagePosition position = _navigator.ResolvePopupPagePosition(); // Find the size and position relative to the parent screen rect switch (position) { case PopupPagePosition.AboveNear: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Top - _navigator.PopupPages.Gap - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.AboveMatch: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Top - _navigator.PopupPages.Gap - popupSize.Height, parentScreenRect.Width, popupSize.Height); break; case PopupPagePosition.AboveFar: parentScreenRect = new Rectangle(parentScreenRect.Right - popupSize.Width, parentScreenRect.Top - _navigator.PopupPages.Gap - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.BelowNear: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Bottom + _navigator.PopupPages.Gap, popupSize.Width, popupSize.Height); break; case PopupPagePosition.BelowMatch: parentScreenRect = new Rectangle(parentScreenRect.Left, parentScreenRect.Bottom + _navigator.PopupPages.Gap, parentScreenRect.Width, popupSize.Height); break; case PopupPagePosition.BelowFar: parentScreenRect = new Rectangle(parentScreenRect.Right - popupSize.Width, parentScreenRect.Bottom + _navigator.PopupPages.Gap, popupSize.Width, popupSize.Height); break; case PopupPagePosition.FarBottom: parentScreenRect = new Rectangle(parentScreenRect.Right + _navigator.PopupPages.Gap, parentScreenRect.Bottom - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.FarMatch: parentScreenRect = new Rectangle(parentScreenRect.Right + _navigator.PopupPages.Gap, parentScreenRect.Top, popupSize.Width, parentScreenRect.Height); break; case PopupPagePosition.FarTop: parentScreenRect = new Rectangle(parentScreenRect.Right + _navigator.PopupPages.Gap, parentScreenRect.Top, popupSize.Width, popupSize.Height); break; case PopupPagePosition.NearBottom: parentScreenRect = new Rectangle(parentScreenRect.Left - _navigator.PopupPages.Gap - popupSize.Width, parentScreenRect.Bottom - popupSize.Height, popupSize.Width, popupSize.Height); break; case PopupPagePosition.NearMatch: parentScreenRect = new Rectangle(parentScreenRect.Left - _navigator.PopupPages.Gap - popupSize.Width, parentScreenRect.Top, popupSize.Width, parentScreenRect.Height); break; case PopupPagePosition.NearTop: parentScreenRect = new Rectangle(parentScreenRect.Left - _navigator.PopupPages.Gap - popupSize.Width, parentScreenRect.Top, popupSize.Width, popupSize.Height); break; } PopupPageEventArgs e = new PopupPageEventArgs(_page, _navigator.Pages.IndexOf(_page), parentScreenRect); // Use event to allow the popup to be cancelled or the position altered _navigator.OnDisplayPopupPage(e); // Do we need to kill ourself if (!e.Cancel) { Show(e.ScreenRect); } else { Dispose(); } }