コード例 #1
0
        /// <summary>
        /// Initialize a new instance of the NavigatorPopupPage class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public NavigatorPopupPages(KryptonNavigator navigator,
                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(navigator != null);
            Debug.Assert(needPaint != null);

            // Remember back reference
            _navigator = navigator;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default values
            _allowPopupPages = PopupPageAllow.OnlyOutlookMiniMode;
            _gap             = DEFAULT_GAP;
            _border          = DEFAULT_GAP;
            _element         = DEFAULT_ELEMENT;
            _position        = DEFAULT_POSITION;
        }
コード例 #2
0
        /// <summary>
        /// Initialize a new instance of the NavigatorPopupPage class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public NavigatorPopupPages(KryptonNavigator navigator,
                                  NeedPaintHandler needPaint)
        {
            Debug.Assert(navigator != null);
            Debug.Assert(needPaint != null);

            // Remember back reference
            _navigator = navigator;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default values
            _allowPopupPages = PopupPageAllow.OnlyOutlookMiniMode;
            _gap = _defaultGap;
            _border = _defaultGap;
            _element = _defaultElement;
            _position = _defaultPosition;
        }
コード例 #3
0
        /// <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();
            }
        }