-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add arrow key navigation for TreeView;
- Loading branch information
1 parent
688e690
commit 6ab1910
Showing
7 changed files
with
183 additions
and
30 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
using System; | ||
using Veldrid; | ||
using Veldrid; | ||
|
||
namespace ImGui.Forms.Models.IO | ||
{ | ||
public struct KeyCommand | ||
public readonly struct KeyCommand | ||
Check warning on line 5 in ImGui.Forms/Models/IO/KeyCommand.cs GitHub Actions / build
Check warning on line 5 in ImGui.Forms/Models/IO/KeyCommand.cs GitHub Actions / build
Check warning on line 5 in ImGui.Forms/Models/IO/KeyCommand.cs GitHub Actions / build
|
||
{ | ||
public ModifierKeys modifiers; | ||
public Key key; | ||
private readonly ModifierKeys _modifiers; | ||
private readonly Key _key; | ||
|
||
public bool IsEmpty => modifiers == 0 && key == 0; | ||
public bool IsEmpty => _modifiers == 0 && _key == 0; | ||
|
||
public KeyCommand(Key key) : this(ModifierKeys.None, key) | ||
{ } | ||
|
||
public KeyCommand(ModifierKeys modifiers, Key key) | ||
{ | ||
this.modifiers = modifiers; | ||
this.key = key; | ||
_modifiers = modifiers; | ||
_key = key; | ||
} | ||
|
||
public static bool operator ==(KeyCommand a, KeyCommand b) => a.modifiers == b.modifiers && a.key == b.key; | ||
public static bool operator !=(KeyCommand a, KeyCommand b) => a.modifiers != b.modifiers || a.key != b.key; | ||
public static bool operator ==(KeyCommand a, KeyCommand b) => a._modifiers == b._modifiers && a._key == b._key; | ||
public static bool operator !=(KeyCommand a, KeyCommand b) => a._modifiers != b._modifiers || a._key != b._key; | ||
|
||
public override string ToString() | ||
{ | ||
return $"Mod: {_modifiers}, Key: {_key}"; | ||
} | ||
} | ||
} |