Map button spec tooltip value to content values.
Inheritance: IContentValues
コード例 #1
0
 private void OnShowToolTip(object sender, ToolTipEventArgs e)
 {
     if (!base.IsDisposed)
     {
         Form form = base.FindForm();
         if (((form == null) || form.ContainsFocus) && !base.DesignMode)
         {
             IContentValues contentValues = null;
             LabelStyle     toolTip       = LabelStyle.ToolTip;
             ButtonSpec     buttonSpec    = this._buttonManager.ButtonSpecFromView(e.Target);
             if ((buttonSpec != null) && this.AllowButtonSpecToolTips)
             {
                 ButtonSpecToContent content = new ButtonSpecToContent(base.Redirector, buttonSpec);
                 if (content.HasContent)
                 {
                     contentValues = content;
                     toolTip       = buttonSpec.ToolTipStyle;
                 }
             }
             if (contentValues != null)
             {
                 if (this._visualPopupToolTip != null)
                 {
                     this._visualPopupToolTip.Dispose();
                 }
                 this._visualPopupToolTip           = new VisualPopupToolTip(base.Redirector, contentValues, base.Renderer, PaletteBackStyle.ControlToolTip, PaletteBorderStyle.ControlToolTip, CommonHelper.ContentStyleFromLabelStyle(toolTip));
                 this._visualPopupToolTip.Disposed += new EventHandler(this.OnVisualPopupToolTipDisposed);
                 this._visualPopupToolTip.ShowCalculatingSize(base.RectangleToScreen(e.Target.ClientRectangle));
             }
         }
     }
 }
コード例 #2
0
        private void OnShowToolTip(object sender, ToolTipEventArgs e)
        {
            if (!IsDisposed)
            {
                // Do not show tooltips when the form we are in does not have focus
                Form topForm = _calendar.CalendarControl.FindForm();
                if ((topForm != null) && !topForm.ContainsFocus)
                {
                    return;
                }

                // Never show tooltips are design time
                if (!_calendar.InDesignMode)
                {
                    IContentValues sourceContent = null;
                    LabelStyle     toolTipStyle  = LabelStyle.ToolTip;

                    // Find the button spec associated with the tooltip request
                    ButtonSpec buttonSpec = _buttonManager.ButtonSpecFromView(e.Target);

                    // If the tooltip is for a button spec
                    if (buttonSpec != null)
                    {
                        // Are we allowed to show page related tooltips
                        if (AllowButtonSpecToolTips)
                        {
                            // Create a helper object to provide tooltip values
                            ButtonSpecToContent buttonSpecMapping = new ButtonSpecToContent(_redirector, buttonSpec);

                            // Is there actually anything to show for the tooltip
                            if (buttonSpecMapping.HasContent)
                            {
                                sourceContent = buttonSpecMapping;
                                toolTipStyle  = buttonSpec.ToolTipStyle;
                            }
                        }
                    }

                    if (sourceContent != null)
                    {
                        // Remove any currently showing tooltip
                        _visualPopupToolTip?.Dispose();

                        // Create the actual tooltip popup object
                        _visualPopupToolTip = new VisualPopupToolTip(_redirector,
                                                                     sourceContent,
                                                                     _calendar.GetRenderer(),
                                                                     PaletteBackStyle.ControlToolTip,
                                                                     PaletteBorderStyle.ControlToolTip,
                                                                     CommonHelper.ContentStyleFromLabelStyle(toolTipStyle));

                        _visualPopupToolTip.Disposed += new EventHandler(OnVisualPopupToolTipDisposed);

                        // Show relative to the provided screen rectangle
                        _visualPopupToolTip.ShowCalculatingSize(_calendar.CalendarControl.RectangleToScreen(e.Target.ClientRectangle));
                    }
                }
            }
        }
コード例 #3
0
        private void OnShowToolTip(object sender, ToolTipEventArgs e)
        {
            if (!IsDisposed)
            {
                // Do not show tooltips when the form we are in does not have focus
                Form topForm = _calendar.CalendarControl.FindForm();
                if ((topForm != null) && !topForm.ContainsFocus)
                    return;

                // Never show tooltips are design time
                if (!_calendar.InDesignMode)
                {
                    IContentValues sourceContent = null;
                    LabelStyle toolTipStyle = LabelStyle.ToolTip;

                    // Find the button spec associated with the tooltip request
                    ButtonSpec buttonSpec = _buttonManager.ButtonSpecFromView(e.Target);

                    // If the tooltip is for a button spec
                    if (buttonSpec != null)
                    {
                        // Are we allowed to show page related tooltips
                        if (AllowButtonSpecToolTips)
                        {
                            // Create a helper object to provide tooltip values
                            ButtonSpecToContent buttonSpecMapping = new ButtonSpecToContent(_redirector, buttonSpec);

                            // Is there actually anything to show for the tooltip
                            if (buttonSpecMapping.HasContent)
                            {
                                sourceContent = buttonSpecMapping;
                                toolTipStyle = buttonSpec.ToolTipStyle;
                            }
                        }
                    }

                    if (sourceContent != null)
                    {
                        // Remove any currently showing tooltip
                        if (_visualPopupToolTip != null)
                            _visualPopupToolTip.Dispose();

                        // Create the actual tooltip popup object
                        _visualPopupToolTip = new VisualPopupToolTip(_redirector,
                                                                     sourceContent,
                                                                     _calendar.GetRenderer(),
                                                                     PaletteBackStyle.ControlToolTip,
                                                                     PaletteBorderStyle.ControlToolTip,
                                                                     CommonHelper.ContentStyleFromLabelStyle(toolTipStyle));

                        _visualPopupToolTip.Disposed += new EventHandler(OnVisualPopupToolTipDisposed);

                        // Show relative to the provided screen rectangle
                        _visualPopupToolTip.ShowCalculatingSize(_calendar.CalendarControl.RectangleToScreen(e.Target.ClientRectangle));
                    }
                }
            }
        }
コード例 #4
0
ファイル: KryptonNavigator.cs プロジェクト: xdarke/Krypton
        private void OnShowToolTip(object sender, ToolTipEventArgs e)
        {
            if (!IsDisposed && (_viewBuilder != null))
            {
                // Do not show tooltips when the form we are in does not have focus
                Form topForm = FindForm();
                if ((topForm != null) && !topForm.ContainsFocus)
                    return;

                // Never show tooltips are design time
                if (!DesignMode)
                {
                    IContentValues sourceContent = null;
                    LabelStyle toolTipStyle = LabelStyle.ToolTip;

                    // Find the page associated with the tooltip request
                    KryptonPage toolTipPage = _viewBuilder.PageFromView(e.Target);

                    // If the tooltip is for a krypton page header
                    if (toolTipPage != null)
                    {
                        // Are we allowed to show page related tooltips
                        if (_toolTips.AllowPageToolTips)
                        {
                            // Create a helper object to provide tooltip values
                            PageToToolTipMapping pageMapping = new PageToToolTipMapping(toolTipPage,
                                                                                       _toolTips.MapImage,
                                                                                       _toolTips.MapText,
                                                                                       _toolTips.MapExtraText);

                            // Is there actually anything to show for the tooltip
                            if (pageMapping.HasContent)
                            {
                                sourceContent = pageMapping;
                                toolTipStyle = toolTipPage.ToolTipStyle;
                            }
                        }
                    }
                    else
                    {
                        // Find the button spec associated with the tooltip request
                        ButtonSpec buttonSpec = _viewBuilder.ButtonSpecFromView(e.Target);

                        // If the tooltip is for a button spec
                        if (buttonSpec != null)
                        {
                            // Are we allowed to show page related tooltips
                            if (_toolTips.AllowButtonSpecToolTips)
                            {
                                // Create a helper object to provide tooltip values
                                ButtonSpecToContent buttonSpecMapping = new ButtonSpecToContent(Redirector, buttonSpec);

                                // Is there actually anything to show for the tooltip
                                if (buttonSpecMapping.HasContent)
                                {
                                    sourceContent = buttonSpecMapping;
                                    toolTipStyle = buttonSpec.ToolTipStyle;
                                }
                            }
                        }
                    }

                    if (sourceContent != null)
                    {
                        // Remove any currently showing tooltip
                        if (_visualPopupToolTip != null)
                            _visualPopupToolTip.Dispose();

                        // Create the actual tooltip popup object
                        _visualPopupToolTip = new VisualPopupToolTip(Redirector,
                                                                     sourceContent,
                                                                     Renderer,
                                                                     PaletteBackStyle.ControlToolTip,
                                                                     PaletteBorderStyle.ControlToolTip,
                                                                     CommonHelper.ContentStyleFromLabelStyle(toolTipStyle));

                        _visualPopupToolTip.Disposed += new EventHandler(OnVisualPopupToolTipDisposed);

                        // Show relative to the provided screen point
                        _visualPopupToolTip.ShowCalculatingSize(e.ScreenPt);
                    }
                }
            }
        }