Skip to content

Commit 5eb08b6

Browse files
committed
Apply colors correctly in RichToolTip...
1 parent d23149b commit 5eb08b6

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎PluginCore/PluginCore/Controls/RichToolTip.cs‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
using System.Runtime.InteropServices;
99
using ScintillaNet;
1010
using PluginCore.BBCode;
11+
using PluginCore.Managers;
1112

1213

1314
namespace PluginCore.Controls
1415
{
1516
/// <summary>
1617
/// RichTextBox-based tooltip
1718
/// </summary>
18-
public class RichToolTip
19+
public class RichToolTip : IEventHandler
1920
{
2021
public delegate void UpdateTipHandler(ScintillaControl sender, Point mousePosition);
2122

@@ -66,6 +67,7 @@ public string Text
6667

6768
public RichToolTip(IMainForm mainForm)
6869
{
70+
EventManager.AddEventHandler(this, EventType.ApplyTheme);
6971
// panel
7072
toolTip = new Panel();
7173
toolTip.Location = new System.Drawing.Point(0,0);
@@ -92,7 +94,21 @@ public RichToolTip(IMainForm mainForm)
9294
rtfCache = new Dictionary<String, String>();
9395
rtfCacheList = new List<String>();
9496
}
95-
97+
98+
99+
public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
100+
{
101+
if (e.Type == EventType.ApplyTheme)
102+
{
103+
Color fore = PluginBase.MainForm.GetThemeColor("RichToolTip.ForeColor");
104+
Color back = PluginBase.MainForm.GetThemeColor("RichToolTip.BackColor");
105+
toolTip.BackColor = back == Color.Empty ? System.Drawing.SystemColors.Info : back;
106+
toolTip.ForeColor = fore == Color.Empty ? System.Drawing.SystemColors.InfoText : fore;
107+
toolTipRTB.ForeColor = fore == Color.Empty ? System.Drawing.SystemColors.InfoText : fore;
108+
toolTipRTB.BackColor = back == Color.Empty ? System.Drawing.SystemColors.Info : back;
109+
}
110+
}
111+
96112
#endregion
97113

98114
#region Tip Methods

0 commit comments

Comments
 (0)