Volian.Base.Library & Baseline
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms.Design;
|
||||
@@ -13,7 +10,6 @@ namespace Volian.Base.Library
|
||||
|
||||
public class FlagCheckedListBox : CheckedListBox
|
||||
{
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public FlagCheckedListBox()
|
||||
{
|
||||
@@ -21,16 +17,6 @@ namespace Volian.Base.Library
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (components != null)
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
private void InitializeComponent()
|
||||
{
|
||||
@@ -124,7 +110,7 @@ namespace Volian.Base.Library
|
||||
|
||||
// If the item has been unchecked, remove its bits from the sum
|
||||
if (cs == CheckState.Unchecked)
|
||||
sum = sum & (~composite.value);
|
||||
sum &= (~composite.value);
|
||||
// If the item has been checked, combine its bits with the sum
|
||||
else
|
||||
sum |= composite.value;
|
||||
@@ -207,27 +193,15 @@ namespace Volian.Base.Library
|
||||
caption = c;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return caption;
|
||||
}
|
||||
public override string ToString() => caption;
|
||||
|
||||
// Returns true if the value corresponds to a single bit being set
|
||||
public bool IsFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((value & (value - 1)) == 0);
|
||||
}
|
||||
}
|
||||
// Returns true if the value corresponds to a single bit being set
|
||||
public bool IsFlag => (value & (value - 1)) == 0;
|
||||
|
||||
// Returns true if this value is a member of the composite bit value
|
||||
public bool IsMemberFlag(FlagCheckedListBoxItem composite)
|
||||
{
|
||||
return (IsFlag && ((value & composite.value) == value));
|
||||
}
|
||||
// Returns true if this value is a member of the composite bit value
|
||||
public bool IsMemberFlag(FlagCheckedListBoxItem composite) => IsFlag && ((value & composite.value) == value);
|
||||
|
||||
public uint value;
|
||||
public uint value;
|
||||
public string caption;
|
||||
}
|
||||
|
||||
@@ -236,13 +210,15 @@ namespace Volian.Base.Library
|
||||
public class FlagEnumUIEditor : UITypeEditor
|
||||
{
|
||||
// The checklistbox
|
||||
private FlagCheckedListBox flagEnumCB;
|
||||
private readonly FlagCheckedListBox flagEnumCB;
|
||||
|
||||
public FlagEnumUIEditor()
|
||||
{
|
||||
flagEnumCB = new FlagCheckedListBox();
|
||||
flagEnumCB.BorderStyle = BorderStyle.None;
|
||||
}
|
||||
flagEnumCB = new FlagCheckedListBox
|
||||
{
|
||||
BorderStyle = BorderStyle.None
|
||||
};
|
||||
}
|
||||
|
||||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||
{
|
||||
@@ -266,12 +242,9 @@ namespace Volian.Base.Library
|
||||
return null;
|
||||
}
|
||||
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
|
||||
{
|
||||
return UITypeEditorEditStyle.DropDown;
|
||||
}
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user