Skip to content

Commit

Permalink
Add AlphaEnabled property for ColorPicker control.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kovalenko committed Oct 19, 2014
1 parent d0c105f commit 600181a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/editors/xrSdkControls/Controls/ColorPicker/ColorPicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public sealed partial class ColorPicker : UserControl
private Color color;
private bool hexadecimal;
private bool ignoreOnChanged = false;
private bool alphaEnabled = true;

public ColorPicker()
{
Expand All @@ -29,7 +30,8 @@ public Color Value
return;
color = value;
ignoreOnChanged = true;
nslAlpha.Value = color.A;
if (alphaEnabled)
nslAlpha.Value = color.A;
nslRed.Value = color.R;
nslGreen.Value = color.G;
nslBlue.Value = color.B;
Expand All @@ -43,6 +45,23 @@ public Color Value
public byte Blue { get; private set; }
public byte Alpha { get; private set; }

public bool AlphaEnabled
{
get { return alphaEnabled; }
set
{
if (alphaEnabled == value)
return;
alphaEnabled = value;
ignoreOnChanged = true;
nslAlpha.Value = nslAlpha.Maximum;
ignoreOnChanged = false;
UpdateColor();
lAlpha.Enabled = alphaEnabled;
nslAlpha.Enabled = alphaEnabled;
}
}

public bool Hexadecimal
{
get { return hexadecimal; }
Expand Down

0 comments on commit 600181a

Please sign in to comment.