Inheritance: ComponentFactory.Krypton.Toolkit.VisualPopup
Beispiel #1
0
        private void OnVisualPopupPageDisposed(object sender, EventArgs e)
        {
            // Unhook events from the specific instance that generated event
            VisualPopupPage popupPage = (VisualPopupPage)sender;
            popupPage.Disposed -= new EventHandler(OnVisualPopupPageDisposed);

            // Not showing a popup page any more
            _visualPopupPage = null;
        }
Beispiel #2
0
        internal void ShowPopupPage(KryptonPage page,
                                    ViewBase relative,
                                    EventHandler finishDelegate)
        {
            Debug.Assert(page != null);
            Debug.Assert(relative != null);

            bool delayDelegate = false;

            // We must have a page and relative element in order to show popup
            if (!DesignMode && (page != null) && (relative != null))
            {
                // Do not show if in the 'Never' show mode
                if (_popupPages.AllowPopupPages != PopupPageAllow.Never)
                {
                    // Check other allow options
                    if ((_popupPages.AllowPopupPages != PopupPageAllow.OnlyOutlookMiniMode) ||
                        (NavigatorMode == NavigatorMode.OutlookMini))
                    {
                        // Do not need to fire delegate until popup page is dismissed
                        delayDelegate = true;

                        // Create the popup window for the group
                        _visualPopupPage = new VisualPopupPage(this, page, Renderer);

                        // We need to know when disposed so the pressed state can be reversed
                        _visualPopupPage.DismissedDelegate = finishDelegate;
                        _visualPopupPage.Disposed += new EventHandler(OnVisualPopupPageDisposed);

                        // Get the client rectangle for the appropriate relative element
                        Rectangle clientRect = (PopupPages.Element == PopupPageElement.Item ?
                                                relative.ClientRectangle : ClientRectangle);

                        // Ask the popup to show itself relative to ourself
                        _visualPopupPage.ShowCalculatingSize(RectangleToScreen(clientRect));
                    }
                }
            }

            if (!delayDelegate && (finishDelegate != null))
                finishDelegate(this, EventArgs.Empty);
        }