This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4be580c
commit 9664588
Showing
3 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace ScintillaNET | ||
{ | ||
/// <summary> | ||
/// Provides data for the <see cref="Scintilla.HotspotClick" />, <see cref="Scintilla.HotspotDoubleClick" />, | ||
/// and <see cref="Scintilla.HotspotReleaseClick" /> events. | ||
/// </summary> | ||
public class HotspotClickEventArgs : EventArgs | ||
{ | ||
private readonly Scintilla scintilla; | ||
private readonly int bytePosition; | ||
private int? position; | ||
|
||
/// <summary> | ||
/// Gets the modifier keys (SHIFT, CTRL, ALT) held down when clicked. | ||
/// </summary> | ||
/// <returns>A bitwise combination of the Keys enumeration indicating the modifier keys.</returns> | ||
/// <remarks>Only the state of the CTRL key is reported in the <see cref="Scintilla.HotspotReleaseClick" /> event.</remarks> | ||
public Keys Modifiers { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the zero-based document position of the text clicked. | ||
/// </summary> | ||
/// <returns> | ||
/// The zero-based character position within the document of the clicked text; | ||
/// otherwise, -1 if not a document position. | ||
/// </returns> | ||
public int Position | ||
{ | ||
get | ||
{ | ||
if (position == null) | ||
position = scintilla.Lines.ByteToCharPosition(bytePosition); | ||
|
||
return (int)position; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="HotspotClickEventArgs" /> class. | ||
/// </summary> | ||
/// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param> | ||
/// <param name="modifiers">The modifier keys that where held down at the time of the click.</param> | ||
/// <param name="bytePosition">The zero-based byte position of the clicked text.</param> | ||
public HotspotClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition) | ||
{ | ||
this.scintilla = scintilla; | ||
this.bytePosition = bytePosition; | ||
Modifiers = modifiers; | ||
|
||
if (bytePosition == -1) | ||
position = -1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters