Skip to content

Commit

Permalink
Complete #46 Add Informational tooltips on the "Additional Commands" …
Browse files Browse the repository at this point in the history
…each button is allowed to use

- Re-use the text from the Command-Line Verbs
- Fix Colours used in Command Buttons
Smurf-IV committed Mar 10, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent c475f52 commit c676b36
Showing 7 changed files with 93 additions and 280 deletions.
9 changes: 4 additions & 5 deletions Elucidate/Elucidate/Elucidate.csproj
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
</AssemblyInfoVersionSettings>
<PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
<AssemblyInfoFilePath>Properties\AssemblyInfo.cs</AssemblyInfoFilePath>
<AssemblyVersion>19.2.952.17</AssemblyVersion>
<AssemblyVersion>19.3.969.10</AssemblyVersion>
<UpdatePackageVersion>False</UpdatePackageVersion>
<AssemblyInfoVersionType>SettingsVersion</AssemblyInfoVersionType>
<InheritWinAppVersionFrom>None</InheritWinAppVersionFrom>
@@ -125,7 +125,6 @@
<DependentUpon>ProtectedDrivesDisplay.cs</DependentUpon>
</Compile>
<Compile Include="ExtendedToolkit\CommandLinkTextValues.cs" />
<Compile Include="ExtendedToolkit\CommandLinkToolTipValues.cs" />
<Compile Include="ExtendedToolkit\ImageValue.cs" />
<Compile Include="ExtendedToolkit\KryptonCommandLinkButtonActionList.cs" />
<Compile Include="ExtendedToolkit\KryptonCommandLinkButtonDesigner.cs" />
@@ -320,13 +319,13 @@
<Version>4.3.2022</Version>
</PackageReference>
<PackageReference Include="KryptonToolkitSuite5472">
<Version>5.472.720</Version>
<Version>5.472.770</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>4.5.11</Version>
<Version>4.6.0-rc2</Version>
</PackageReference>
<PackageReference Include="TaskSchedulerEditor">
<Version>2.8.7</Version>
<Version>2.8.8</Version>
</PackageReference>
</ItemGroup>
<ItemGroup />
56 changes: 0 additions & 56 deletions Elucidate/Elucidate/ExtendedToolkit/CommandLinkToolTipValues.cs

This file was deleted.

90 changes: 2 additions & 88 deletions Elucidate/Elucidate/ExtendedToolkit/KryptonCommandLinkVersion1.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
using System.Windows.Forms;

using ComponentFactory.Krypton.Toolkit;
using Elucidate.ExtendedToolkit;

using ExtendedControls.ExtendedToolkit.Values;
using ExtendedControls.ExtendedToolkit.View_Draw;

@@ -43,10 +43,6 @@ public class KryptonCommandLinkButton : VisualSimpleBase, IButtonControl
private bool _isDefault;
private bool _useMnemonic;
private bool _wasEnabled;
private VisualPopupToolTip _visualPopupToolTip;
private ToolTipManager toolTipManager;
private IMouseController mouseController;

#endregion

#region Events
@@ -78,7 +74,6 @@ public KryptonCommandLinkButton()
// Create content storage
CommandLinkImageValue = new ImageValue(NeedPaintDelegate);
CommandLinkTextValues = new CommandLinkTextValues(NeedPaintDelegate);
CommandLinkToolTipValues = new CommandLinkToolTipValues(NeedPaintDelegate);

// Create the palette storage
StateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
@@ -121,19 +116,11 @@ public KryptonCommandLinkButton()
TestForFocusCues = true
};

// Create the manager for handling tooltips
// ReSharper disable once UseObjectOrCollectionInitializer
toolTipManager = new ToolTipManager();
toolTipManager.ShowToolTip += OnShowToolTip;
toolTipManager.CancelToolTip += OnCancelToolTip;

// Create a button controller to handle button style behaviour
_buttonController = new ButtonController(drawButton, NeedPaintDelegate);
// If associated with a tooltip manager then pass mouse messages onto tooltip manager
mouseController = new ToolTipController(toolTipManager, drawButton, _buttonController);

// Assign the controller to the view element to treat as a button
drawButton.MouseController = mouseController;//_buttonController;
drawButton.MouseController = _buttonController;
drawButton.KeyController = _buttonController;
drawButton.SourceController = _buttonController;

@@ -144,21 +131,6 @@ public KryptonCommandLinkButton()
// Create the view manager instance
ViewManager = new ViewManager(this, drawButton);
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing)
{
// Remove any showing tooltip
OnCancelToolTip(this, EventArgs.Empty);
}

base.Dispose(disposing);
}
#endregion

#region Public
@@ -283,14 +255,6 @@ private void ResetButtonStyle()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public CommandLinkTextValues CommandLinkTextValues { get; }

/// <summary>
/// Gets access to the button content.
/// </summary>
[Category("CommandLink")]
[Description("CommandLink ToolTip Text")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public CommandLinkToolTipValues CommandLinkToolTipValues { get; }

/// <summary>
/// Gets access to the button content.
/// </summary>
@@ -736,57 +700,7 @@ private void OnButtonSelect(object sender, MouseEventArgs e)
Focus();
}
}
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 = FindForm();
if ((topForm != null) && !topForm.ContainsFocus)
{
return;
}

// Never show tooltips are design time
if (!DesignMode
&& CommandLinkToolTipValues.EnableToolTips
)
{
// Remove any currently showing tooltip
_visualPopupToolTip?.Dispose();

// Create the actual tooltip popup object
// ReSharper disable once UseObjectOrCollectionInitializer
_visualPopupToolTip = new VisualPopupToolTip(Redirector,
CommandLinkToolTipValues,
Renderer,
PaletteBackStyle.ControlToolTip,
PaletteBorderStyle.ControlToolTip,
CommonHelper.ContentStyleFromLabelStyle(CommandLinkToolTipValues.ToolTipStyle));

_visualPopupToolTip.Disposed += OnVisualPopupToolTipDisposed;

// Show relative to the provided screen rectangle
_visualPopupToolTip.ShowCalculatingSize(RectangleToScreen(e.Target.ClientRectangle));
}
}
}

private void OnCancelToolTip(object sender, EventArgs e)
{
// Remove any currently showing tooltip
_visualPopupToolTip?.Dispose();
}

private void OnVisualPopupToolTipDisposed(object sender, EventArgs e)
{
// Unhook events from the specific instance that generated event
VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender;
popupToolTip.Disposed -= OnVisualPopupToolTipDisposed;

// Not showing a popup page any more
_visualPopupToolTip = null;
}
#endregion
}

4 changes: 2 additions & 2 deletions Elucidate/Elucidate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -58,8 +58,8 @@
// Build Number - Increment
// Revision - Day
//
[assembly: AssemblyVersion("2019.2.952.17")]
[assembly: AssemblyFileVersion("19.2.952.17")]
[assembly: AssemblyVersion("2019.3.969.10")]
[assembly: AssemblyFileVersion("19.3.969.10")]
[assembly: NeutralResourcesLanguage("en-US")]
// TODO: Add more relevant hints here
[assembly: Dependency("System", LoadHint.Always)]
Loading

0 comments on commit c676b36

Please sign in to comment.