mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 13:06:24 +00:00
Added some extensions for KeyGroups
This commit is contained in:
1 parent
4e1a1d11bd
commit
ced6c299b0
6 files changed
+86
-30
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Keyboard.Extensions;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Keys
|
||||
{
|
||||
@@ -8,7 +9,7 @@ namespace CUE.NET.Devices.Keyboard.Keys
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
protected CorsairKeyboard Keyboard { get; }
|
||||
internal CorsairKeyboard Keyboard { get; }
|
||||
|
||||
public IEnumerable<CorsairKey> Keys => new ReadOnlyCollection<CorsairKey>(GroupKeys);
|
||||
protected IList<CorsairKey> GroupKeys { get; } = new List<CorsairKey>();
|
||||
@@ -24,18 +25,7 @@ namespace CUE.NET.Devices.Keyboard.Keys
|
||||
this.Keyboard = keyboard;
|
||||
|
||||
if (autoAttach)
|
||||
keyboard.AttachKeyGroup(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void MergeKeys(IKeyGroup groupToMerge)
|
||||
{
|
||||
foreach (CorsairKey key in groupToMerge.Keys)
|
||||
if (!GroupKeys.Contains(key))
|
||||
GroupKeys.Add(key);
|
||||
this.Attach();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -6,18 +6,26 @@ namespace CUE.NET.Devices.Keyboard.Keys
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public SimpleKeyGroup(CorsairKeyboard keyboard)
|
||||
: base(keyboard)
|
||||
public SimpleKeyGroup(CorsairKeyboard keyboard, bool autoAttach = true)
|
||||
: base(keyboard, autoAttach)
|
||||
{ }
|
||||
|
||||
public SimpleKeyGroup(CorsairKeyboard keyboard, params CorsairKey[] keys)
|
||||
: base(keyboard)
|
||||
: this(keyboard, true, keys)
|
||||
{ }
|
||||
|
||||
public SimpleKeyGroup(CorsairKeyboard keyboard, bool autoAttach, params CorsairKey[] keys)
|
||||
: base(keyboard, autoAttach)
|
||||
{
|
||||
AddKey(keys);
|
||||
}
|
||||
|
||||
public SimpleKeyGroup(CorsairKeyboard keyboard, params CorsairKeyboardKeyId[] keys)
|
||||
: base(keyboard)
|
||||
: this(keyboard, true, keys)
|
||||
{ }
|
||||
|
||||
public SimpleKeyGroup(CorsairKeyboard keyboard, bool autoAttach, params CorsairKeyboardKeyId[] keys)
|
||||
: base(keyboard, autoAttach)
|
||||
{
|
||||
AddKey(keys);
|
||||
}
|
||||
@@ -67,6 +75,13 @@ namespace CUE.NET.Devices.Keyboard.Keys
|
||||
return ContainsKey(Keyboard[keyId]);
|
||||
}
|
||||
|
||||
public void MergeKeys(IKeyGroup groupToMerge)
|
||||
{
|
||||
foreach (CorsairKey key in groupToMerge.Keys)
|
||||
if (!GroupKeys.Contains(key))
|
||||
GroupKeys.Add(key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user