diff --git a/DarkUI.sln b/DarkUI.sln new file mode 100644 index 0000000..b03eda9 --- /dev/null +++ b/DarkUI.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DarkUI", "DarkUI\DarkUI.csproj", "{F19472F5-8C44-4C51-A8A0-B9DE5F555255}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{FA334815-6D78-4E9A-9F4D-6C8A58222A57}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Release|Any CPU.Build.0 = Release|Any CPU + {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DarkUI/Collections/ObservableList.cs b/DarkUI/Collections/ObservableList.cs new file mode 100644 index 0000000..26d683b --- /dev/null +++ b/DarkUI/Collections/ObservableList.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace DarkUI.Collections +{ + public class ObservableList : List, IDisposable + { + #region Field Region + + private bool _disposed; + + #endregion + + #region Event Region + + public event EventHandler> ItemsAdded; + public event EventHandler> ItemsRemoved; + + #endregion + + #region Destructor Region + + ~ObservableList() + { + Dispose(false); + } + + #endregion + + #region Dispose Region + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (ItemsAdded != null) + ItemsAdded = null; + + if (ItemsRemoved != null) + ItemsRemoved = null; + + _disposed = true; + } + } + + #endregion + + #region Method Region + + public new void Add(T item) + { + base.Add(item); + + if (ItemsAdded != null) + ItemsAdded(this, new ObservableListModified(new List { item })); + } + + public new void AddRange(IEnumerable collection) + { + var list = collection.ToList(); + + base.AddRange(list); + + if (ItemsAdded != null) + ItemsAdded(this, new ObservableListModified(list)); + } + + public new void Remove(T item) + { + base.Remove(item); + + if (ItemsRemoved != null) + ItemsRemoved(this, new ObservableListModified(new List { item })); + } + + #endregion + } +} diff --git a/DarkUI/Collections/ObservableListModified.cs b/DarkUI/Collections/ObservableListModified.cs new file mode 100644 index 0000000..dd99bc3 --- /dev/null +++ b/DarkUI/Collections/ObservableListModified.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace DarkUI.Collections +{ + public class ObservableListModified : EventArgs + { + public IEnumerable Items { get; private set; } + + public ObservableListModified(IEnumerable items) + { + Items = items; + } + } +} diff --git a/DarkUI/Config/Colors.cs b/DarkUI/Config/Colors.cs new file mode 100644 index 0000000..6ebda15 --- /dev/null +++ b/DarkUI/Config/Colors.cs @@ -0,0 +1,112 @@ +using System.Drawing; + +namespace DarkUI.Config +{ + public sealed class Colors + { + public static Color GreyBackground + { + get { return Color.FromArgb(60, 63, 65); } + } + + public static Color HeaderBackground + { + get { return Color.FromArgb(57, 60, 62); } + } + + public static Color BlueBackground + { + get { return Color.FromArgb(66, 77, 95); } + } + + public static Color DarkBlueBackground + { + get { return Color.FromArgb(52, 57, 66); } + } + + public static Color DarkBackground + { + get { return Color.FromArgb(43, 43, 43); } + } + + public static Color MediumBackground + { + get { return Color.FromArgb(49, 51, 53); } + } + + public static Color LightBackground + { + get { return Color.FromArgb(69, 73, 74); } + } + + public static Color LighterBackground + { + get { return Color.FromArgb(95, 101, 102); } + } + + public static Color LightestBackground + { + get { return Color.FromArgb(178, 178, 178); } + } + + public static Color LightBorder + { + get { return Color.FromArgb(81, 81, 81); } + } + + public static Color DarkBorder + { + get { return Color.FromArgb(51, 51, 51); } + } + + public static Color LightText + { + get { return Color.FromArgb(220, 220, 220); } + } + + public static Color DisabledText + { + get { return Color.FromArgb(153, 153, 153); } + } + + public static Color BlueHighlight + { + get { return Color.FromArgb(104, 151, 187); } + } + + public static Color BlueSelection + { + get { return Color.FromArgb(75, 110, 175); } + } + + public static Color GreyHighlight + { + get { return Color.FromArgb(122, 128, 132); } + } + + public static Color GreySelection + { + get { return Color.FromArgb(92, 92, 92); } + } + + public static Color DarkGreySelection + { + get { return Color.FromArgb(82, 82, 82); } + } + + public static Color DarkBlueBorder + { + get { return Color.FromArgb(51, 61, 78); } + } + + public static Color LightBlueBorder + { + get { return Color.FromArgb(86, 97, 114); } + } + + public static Color ActiveControl + { + get { return Color.FromArgb(159, 178, 196); } + } + } +} diff --git a/DarkUI/Config/Consts.cs b/DarkUI/Config/Consts.cs new file mode 100644 index 0000000..26a0152 --- /dev/null +++ b/DarkUI/Config/Consts.cs @@ -0,0 +1,18 @@ +namespace DarkUI.Config +{ + public sealed class Consts + { + public static int Padding = 10; + + public static int ScrollBarSize = 15; + public static int ArrowButtonSize = 15; + public static int MinimumThumbSize = 11; + + public static int CheckBoxSize = 12; + public static int RadioButtonSize = 12; + + public const int ToolWindowHeaderSize = 25; + public const int DocumentTabAreaSize = 24; + public const int ToolWindowTabAreaSize = 21; + } +} diff --git a/DarkUI/Controls/DarkButton.cs b/DarkUI/Controls/DarkButton.cs new file mode 100644 index 0000000..6f84d45 --- /dev/null +++ b/DarkUI/Controls/DarkButton.cs @@ -0,0 +1,421 @@ +using DarkUI.Config; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + [ToolboxBitmap(typeof(Button))] + [DefaultEvent("Click")] + public class DarkButton : Button + { + #region Field Region + + private DarkButtonStyle _style = DarkButtonStyle.Normal; + private DarkControlState _buttonState = DarkControlState.Normal; + + private bool _isDefault; + private bool _spacePressed; + + private int _padding = Consts.Padding / 2; + private int _imagePadding = 5; // Consts.Padding / 2 + + #endregion + + #region Designer Property Region + + public new string Text + { + get { return base.Text; } + set + { + base.Text = value; + Invalidate(); + } + } + + public new bool Enabled + { + get { return base.Enabled; } + set + { + base.Enabled = value; + Invalidate(); + } + } + + [Category("Appearance")] + [Description("Determines the style of the button.")] + [DefaultValue(DarkButtonStyle.Normal)] + public DarkButtonStyle ButtonStyle + { + get { return _style; } + set + { + _style = value; + Invalidate(); + } + } + + [Category("Appearance")] + [Description("Determines the amount of padding between the image and text.")] + [DefaultValue(5)] + public int ImagePadding + { + get { return _imagePadding; } + set + { + _imagePadding = value; + Invalidate(); + } + } + + #endregion + + #region Code Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool AutoEllipsis + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkControlState ButtonState + { + get { return _buttonState; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ContentAlignment ImageAlign + { + get { return base.ImageAlign; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool FlatAppearance + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new FlatStyle FlatStyle + { + get { return base.FlatStyle; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ContentAlignment TextAlign + { + get { return base.TextAlign; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool UseCompatibleTextRendering + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool UseVisualStyleBackColor + { + get { return false; } + } + + #endregion + + #region Constructor Region + + public DarkButton() + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + + base.UseVisualStyleBackColor = false; + base.UseCompatibleTextRendering = false; + + SetButtonState(DarkControlState.Normal); + Padding = new Padding(_padding); + } + + #endregion + + #region Method Region + + private void SetButtonState(DarkControlState buttonState) + { + if (_buttonState != buttonState) + { + _buttonState = buttonState; + Invalidate(); + } + } + + #endregion + + #region Event Handler Region + + protected override void OnCreateControl() + { + base.OnCreateControl(); + + var form = FindForm(); + if (form != null) + { + if (form.AcceptButton == this) + _isDefault = true; + } + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (_spacePressed) + return; + + if (e.Button == MouseButtons.Left) + { + if (ClientRectangle.Contains(e.Location)) + SetButtonState(DarkControlState.Pressed); + else + SetButtonState(DarkControlState.Hover); + } + else + { + SetButtonState(DarkControlState.Hover); + } + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (!ClientRectangle.Contains(e.Location)) + return; + + SetButtonState(DarkControlState.Pressed); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + if (_spacePressed) + return; + + SetButtonState(DarkControlState.Normal); + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + if (_spacePressed) + return; + + SetButtonState(DarkControlState.Normal); + } + + protected override void OnMouseCaptureChanged(EventArgs e) + { + base.OnMouseCaptureChanged(e); + + if (_spacePressed) + return; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetButtonState(DarkControlState.Normal); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + + _spacePressed = false; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetButtonState(DarkControlState.Normal); + else + SetButtonState(DarkControlState.Hover); + } + + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + + if (e.KeyCode == Keys.Space) + { + _spacePressed = true; + SetButtonState(DarkControlState.Pressed); + } + } + + protected override void OnKeyUp(KeyEventArgs e) + { + base.OnKeyUp(e); + + if (e.KeyCode == Keys.Space) + { + _spacePressed = false; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetButtonState(DarkControlState.Normal); + else + SetButtonState(DarkControlState.Hover); + } + } + + public override void NotifyDefault(bool value) + { + base.NotifyDefault(value); + + if (!DesignMode) + return; + + _isDefault = value; + Invalidate(); + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height); + + var textColor = Colors.LightText; + var borderColor = Colors.GreySelection; + var fillColor = _isDefault ? Colors.DarkBlueBackground : Colors.LightBackground; + + if (Enabled) + { + if (ButtonStyle == DarkButtonStyle.Normal) + { + if (Focused && TabStop) + borderColor = Colors.BlueHighlight; + + switch (ButtonState) + { + case DarkControlState.Hover: + fillColor = _isDefault ? Colors.BlueBackground : Colors.LighterBackground; + break; + case DarkControlState.Pressed: + fillColor = _isDefault ? Colors.DarkBackground : Colors.DarkBackground; + break; + } + } + else if (ButtonStyle == DarkButtonStyle.Flat) + { + switch (ButtonState) + { + case DarkControlState.Normal: + fillColor = Colors.GreyBackground; + break; + case DarkControlState.Hover: + fillColor = Colors.MediumBackground; + break; + case DarkControlState.Pressed: + fillColor = Colors.DarkBackground; + break; + } + } + } + else + { + textColor = Colors.DisabledText; + fillColor = Colors.DarkGreySelection; + } + + using (var b = new SolidBrush(fillColor)) + { + g.FillRectangle(b, rect); + } + + if (ButtonStyle == DarkButtonStyle.Normal) + { + using (var p = new Pen(borderColor, 1)) + { + var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1); + + g.DrawRectangle(p, modRect); + } + } + + var textOffsetX = 0; + var textOffsetY = 0; + + if (Image != null) + { + var stringSize = g.MeasureString(Text, Font, rect.Size); + + var x = (ClientSize.Width / 2) - (Image.Size.Width / 2); + var y = (ClientSize.Height / 2) - (Image.Size.Height / 2); + + switch (TextImageRelation) + { + case TextImageRelation.ImageAboveText: + textOffsetY = (Image.Size.Height / 2) + (ImagePadding / 2); + y = y - ((int)(stringSize.Height / 2) + (ImagePadding / 2)); + break; + case TextImageRelation.TextAboveImage: + textOffsetY = ((Image.Size.Height / 2) + (ImagePadding / 2)) * -1; + y = y + ((int)(stringSize.Height / 2) + (ImagePadding / 2)); + break; + case TextImageRelation.ImageBeforeText: + textOffsetX = Image.Size.Width + (ImagePadding * 2); + x = ImagePadding; + break; + case TextImageRelation.TextBeforeImage: + x = x + (int)stringSize.Width; + break; + } + + g.DrawImageUnscaled(Image, x, y); + } + + using (var b = new SolidBrush(textColor)) + { + var modRect = new Rectangle(rect.Left + textOffsetX + Padding.Left, + rect.Top + textOffsetY + Padding.Top, rect.Width - Padding.Horizontal, + rect.Height - Padding.Vertical); + + var stringFormat = new StringFormat + { + LineAlignment = StringAlignment.Center, + Alignment = StringAlignment.Center, + Trimming = StringTrimming.EllipsisCharacter + }; + + g.DrawString(Text, Font, b, modRect, stringFormat); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkButtonStyle.cs b/DarkUI/Controls/DarkButtonStyle.cs new file mode 100644 index 0000000..6d8bf6b --- /dev/null +++ b/DarkUI/Controls/DarkButtonStyle.cs @@ -0,0 +1,8 @@ +namespace DarkUI.Controls +{ + public enum DarkButtonStyle + { + Normal, + Flat + } +} diff --git a/DarkUI/Controls/DarkCheckBox.cs b/DarkUI/Controls/DarkCheckBox.cs new file mode 100644 index 0000000..8b47f96 --- /dev/null +++ b/DarkUI/Controls/DarkCheckBox.cs @@ -0,0 +1,350 @@ +using DarkUI.Config; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkCheckBox : CheckBox + { + #region Field Region + + private DarkControlState _controlState = DarkControlState.Normal; + + private bool _spacePressed; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Appearance Appearance + { + get { return base.Appearance; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool AutoEllipsis + { + get { return base.AutoEllipsis; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Image BackgroundImage + { + get { return base.BackgroundImage; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ImageLayout BackgroundImageLayout + { + get { return base.BackgroundImageLayout; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool FlatAppearance + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new FlatStyle FlatStyle + { + get { return base.FlatStyle; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Image Image + { + get { return base.Image; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ContentAlignment ImageAlign + { + get { return base.ImageAlign; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new int ImageIndex + { + get { return base.ImageIndex; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new string ImageKey + { + get { return base.ImageKey; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ImageList ImageList + { + get { return base.ImageList; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ContentAlignment TextAlign + { + get { return base.TextAlign; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new TextImageRelation TextImageRelation + { + get { return base.TextImageRelation; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool ThreeState + { + get { return base.ThreeState; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool UseCompatibleTextRendering + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool UseVisualStyleBackColor + { + get { return false; } + } + + #endregion + + #region Constructor Region + + public DarkCheckBox() + { + SetStyle(ControlStyles.SupportsTransparentBackColor | + ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + } + + #endregion + + #region Method Region + + private void SetControlState(DarkControlState controlState) + { + if (_controlState != controlState) + { + _controlState = controlState; + Invalidate(); + } + } + + #endregion + + #region Event Handler Region + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (_spacePressed) + return; + + if (e.Button == MouseButtons.Left) + { + if (ClientRectangle.Contains(e.Location)) + SetControlState(DarkControlState.Pressed); + else + SetControlState(DarkControlState.Hover); + } + else + { + SetControlState(DarkControlState.Hover); + } + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (!ClientRectangle.Contains(e.Location)) + return; + + SetControlState(DarkControlState.Pressed); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + if (_spacePressed) + return; + + SetControlState(DarkControlState.Normal); + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + if (_spacePressed) + return; + + SetControlState(DarkControlState.Normal); + } + + protected override void OnMouseCaptureChanged(EventArgs e) + { + base.OnMouseCaptureChanged(e); + + if (_spacePressed) + return; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetControlState(DarkControlState.Normal); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + + _spacePressed = false; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetControlState(DarkControlState.Normal); + else + SetControlState(DarkControlState.Hover); + } + + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + + if (e.KeyCode == Keys.Space) + { + _spacePressed = true; + SetControlState(DarkControlState.Pressed); + } + } + + protected override void OnKeyUp(KeyEventArgs e) + { + base.OnKeyUp(e); + + if (e.KeyCode == Keys.Space) + { + _spacePressed = false; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetControlState(DarkControlState.Normal); + else + SetControlState(DarkControlState.Hover); + } + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height); + + var size = Consts.CheckBoxSize; + + var textColor = Colors.LightText; + var borderColor = Colors.LightText; + var fillColor = Colors.LightestBackground; + + if (Enabled) + { + if (Focused) + { + borderColor = Colors.BlueHighlight; + fillColor = Colors.BlueSelection; + } + + if (_controlState == DarkControlState.Hover) + { + borderColor = Colors.BlueHighlight; + fillColor = Colors.BlueSelection; + } + else if (_controlState == DarkControlState.Pressed) + { + borderColor = Colors.GreyHighlight; + fillColor = Colors.GreySelection; + } + } + else + { + textColor = Colors.DisabledText; + borderColor = Colors.GreyHighlight; + fillColor = Colors.GreySelection; + } + + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, rect); + } + + using (var p = new Pen(borderColor)) + { + var boxRect = new Rectangle(0, (rect.Height / 2) - (size / 2), size, size); + g.DrawRectangle(p, boxRect); + } + + if (Checked) + { + using (var b = new SolidBrush(fillColor)) + { + Rectangle boxRect = new Rectangle(2, (rect.Height / 2) - ((size - 4) / 2), size - 3, size - 3); + g.FillRectangle(b, boxRect); + } + } + + using (var b = new SolidBrush(textColor)) + { + var stringFormat = new StringFormat + { + LineAlignment = StringAlignment.Center, + Alignment = StringAlignment.Near + }; + + var modRect = new Rectangle(size + 4, 0, rect.Width - size, rect.Height); + g.DrawString(Text, Font, b, modRect, stringFormat); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkContentAlignment.cs b/DarkUI/Controls/DarkContentAlignment.cs new file mode 100644 index 0000000..378f971 --- /dev/null +++ b/DarkUI/Controls/DarkContentAlignment.cs @@ -0,0 +1,9 @@ +namespace DarkUI.Controls +{ + public enum DarkContentAlignment + { + Center, + Left, + Right + } +} diff --git a/DarkUI/Controls/DarkContextMenu.cs b/DarkUI/Controls/DarkContextMenu.cs new file mode 100644 index 0000000..19d1cae --- /dev/null +++ b/DarkUI/Controls/DarkContextMenu.cs @@ -0,0 +1,17 @@ +using DarkUI.Renderers; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkContextMenu : ContextMenuStrip + { + #region Constructor Region + + public DarkContextMenu() + { + Renderer = new DarkMenuRenderer(); + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkControlState.cs b/DarkUI/Controls/DarkControlState.cs new file mode 100644 index 0000000..8d11cc1 --- /dev/null +++ b/DarkUI/Controls/DarkControlState.cs @@ -0,0 +1,9 @@ +namespace DarkUI.Controls +{ + public enum DarkControlState + { + Normal, + Hover, + Pressed + } +} diff --git a/DarkUI/Controls/DarkLabel.cs b/DarkUI/Controls/DarkLabel.cs new file mode 100644 index 0000000..2ec280b --- /dev/null +++ b/DarkUI/Controls/DarkLabel.cs @@ -0,0 +1,105 @@ +using DarkUI.Config; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkLabel : Label + { + #region Field Region + + private bool _autoUpdateHeight; + private bool _isGrowing; + + #endregion + + #region Property Region + + [Category("Layout")] + [Description("Enables automatic height sizing based on the contents of the label.")] + [DefaultValue(false)] + public bool AutoUpdateHeight + { + get { return _autoUpdateHeight; } + set + { + _autoUpdateHeight = value; + + if (_autoUpdateHeight) + { + AutoSize = false; + ResizeLabel(); + } + } + } + + public new bool AutoSize + { + get { return base.AutoSize; } + set + { + base.AutoSize = value; + + if (AutoSize) + AutoUpdateHeight = false; + } + } + + #endregion + + #region Constructor Region + + public DarkLabel() + { + ForeColor = Colors.LightText; + } + + #endregion + + #region Method Region + + private void ResizeLabel() + { + if (!_autoUpdateHeight || _isGrowing) + return; + + try + { + _isGrowing = true; + var sz = new Size(Width, int.MaxValue); + sz = TextRenderer.MeasureText(Text, Font, sz, TextFormatFlags.WordBreak); + Height = sz.Height + Padding.Vertical; + } + finally + { + _isGrowing = false; + } + } + + #endregion + + #region Event Handler Region + + protected override void OnTextChanged(EventArgs e) + { + base.OnTextChanged(e); + ResizeLabel(); + } + + protected override void OnFontChanged(EventArgs e) + { + base.OnFontChanged(e); + ResizeLabel(); + } + + protected override void OnSizeChanged(EventArgs e) + { + base.OnSizeChanged(e); + ResizeLabel(); + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkListItem.cs b/DarkUI/Controls/DarkListItem.cs new file mode 100644 index 0000000..1070753 --- /dev/null +++ b/DarkUI/Controls/DarkListItem.cs @@ -0,0 +1,61 @@ +using DarkUI.Config; +using System; +using System.Drawing; + +namespace DarkUI.Controls +{ + public class DarkListItem + { + #region Event Region + + public event EventHandler TextChanged; + + #endregion + + #region Field Region + + private string _text; + + #endregion + + #region Property Region + + public string Text + { + get { return _text; } + set + { + _text = value; + + if (TextChanged != null) + TextChanged(this, new EventArgs()); + } + } + + public Rectangle Area { get; set; } + + public Color TextColor { get; set; } + + public FontStyle FontStyle { get; set; } + + public object Tag { get; set; } + + #endregion + + #region Constructor Region + + public DarkListItem() + { + TextColor = Colors.LightText; + FontStyle = FontStyle.Regular; + } + + public DarkListItem(string text) + : this() + { + Text = text; + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkListView.cs b/DarkUI/Controls/DarkListView.cs new file mode 100644 index 0000000..35b71ce --- /dev/null +++ b/DarkUI/Controls/DarkListView.cs @@ -0,0 +1,545 @@ +using DarkUI.Config; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkListView : DarkScrollView + { + #region Event Region + + public event EventHandler SelectedIndicesChanged; + + #endregion + + #region Field Region + + private int _itemHeight = 20; + private bool _multiSelect; + + private ObservableCollection _items; + private List _selectedIndices; + private int _anchoredItemStart = -1; + private int _anchoredItemEnd = -1; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public ObservableCollection Items + { + get { return _items; } + set + { + if (_items != null) + _items.CollectionChanged -= Items_CollectionChanged; + + _items = value; + + _items.CollectionChanged += Items_CollectionChanged; + + UpdateListBox(); + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public List SelectedIndices + { + get { return _selectedIndices; } + } + + [Category("Appearance")] + [Description("Determines the height of the individual list view items.")] + [DefaultValue(20)] + public int ItemHeight + { + get { return _itemHeight; } + set + { + _itemHeight = value; + UpdateListBox(); + } + } + + [Category("Behaviour")] + [Description("Determines whether multiple list view items can be selected at once.")] + [DefaultValue(false)] + public bool MultiSelect + { + get { return _multiSelect; } + set { _multiSelect = value; } + } + + #endregion + + #region Constructor Region + + public DarkListView() + { + Items = new ObservableCollection(); + _selectedIndices = new List(); + } + + #endregion + + #region Event Handler Region + + private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (e.NewItems != null) + { + using (var g = CreateGraphics()) + { + // Set the area size of all new items + foreach (DarkListItem item in e.NewItems) + { + item.TextChanged += Item_TextChanged; + UpdateItemSize(item, g); + } + } + + // Find the starting index of the new item list and update anything past that + if (e.NewStartingIndex < (Items.Count - 1)) + { + for (var i = e.NewStartingIndex; i <= Items.Count - 1; i++) + { + UpdateItemPosition(Items[i], i); + } + } + } + + if (e.OldItems != null) + { + foreach (DarkListItem item in e.OldItems) + item.TextChanged -= Item_TextChanged; + + // Find the starting index of the old item list and update anything past that + if (e.OldStartingIndex < (Items.Count - 1)) + { + for (var i = e.OldStartingIndex; i <= Items.Count - 1; i++) + { + UpdateItemPosition(Items[i], i); + } + } + } + + if (Items.Count == 0) + { + if (_selectedIndices.Count > 0) + { + _selectedIndices.Clear(); + + if (SelectedIndicesChanged != null) + SelectedIndicesChanged(this, null); + } + } + + UpdateContentSize(); + } + + private void Item_TextChanged(object sender, EventArgs e) + { + var item = (DarkListItem)sender; + + UpdateItemSize(item); + UpdateContentSize(item); + Invalidate(); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (Items.Count == 0) + return; + + if (e.Button != MouseButtons.Left && e.Button != MouseButtons.Right) + return; + + var pos = OffsetMousePosition; + + var range = ItemIndexesInView().ToList(); + + var top = range.Min(); + var bottom = range.Max(); + var width = Math.Max(ContentSize.Width, Viewport.Width); + + for (var i = top; i <= bottom; i++) + { + var rect = new Rectangle(0, i * ItemHeight, width, ItemHeight); + + if (rect.Contains(pos)) + { + if (MultiSelect && ModifierKeys == Keys.Shift) + SelectAnchoredRange(i); + else if (MultiSelect && ModifierKeys == Keys.Control) + ToggleItem(i); + else + SelectItem(i); + } + } + } + + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + + if (Items.Count == 0) + return; + + if (e.KeyCode != Keys.Down && e.KeyCode != Keys.Up) + return; + + if (MultiSelect && ModifierKeys == Keys.Shift) + { + if (e.KeyCode == Keys.Up) + { + if (_anchoredItemEnd - 1 >= 0) + { + SelectAnchoredRange(_anchoredItemEnd - 1); + EnsureVisible(); + } + } + else if (e.KeyCode == Keys.Down) + { + if (_anchoredItemEnd + 1 <= Items.Count - 1) + { + SelectAnchoredRange(_anchoredItemEnd + 1); + } + } + } + else + { + if (e.KeyCode == Keys.Up) + { + if (_anchoredItemEnd - 1 >= 0) + SelectItem(_anchoredItemEnd - 1); + } + else if (e.KeyCode == Keys.Down) + { + if (_anchoredItemEnd + 1 <= Items.Count - 1) + SelectItem(_anchoredItemEnd + 1); + } + } + + EnsureVisible(); + } + + #endregion + + #region Method Region + + public int GetItemIndex(DarkListItem item) + { + return Items.IndexOf(item); + } + + public void SelectItem(int index) + { + if (index < 0 || index > Items.Count - 1) + throw new IndexOutOfRangeException($"Value '{index}' is outside of valid range."); + + _selectedIndices.Clear(); + _selectedIndices.Add(index); + + if (SelectedIndicesChanged != null) + SelectedIndicesChanged(this, null); + + _anchoredItemStart = index; + _anchoredItemEnd = index; + + Invalidate(); + } + + public void SelectItems(IEnumerable indexes) + { + _selectedIndices.Clear(); + + var list = indexes.ToList(); + + foreach (var index in list) + { + if (index < 0 || index > Items.Count - 1) + throw new IndexOutOfRangeException($"Value '{index}' is outside of valid range."); + + _selectedIndices.Add(index); + } + + if (SelectedIndicesChanged != null) + SelectedIndicesChanged(this, null); + + _anchoredItemStart = list[list.Count - 1]; + _anchoredItemEnd = list[list.Count - 1]; + + Invalidate(); + } + + public void ToggleItem(int index) + { + if (_selectedIndices.Contains(index)) + { + _selectedIndices.Remove(index); + + // If we just removed both the anchor start AND end then reset them + if (_anchoredItemStart == index && _anchoredItemEnd == index) + { + if (_selectedIndices.Count > 0) + { + _anchoredItemStart = _selectedIndices[0]; + _anchoredItemEnd = _selectedIndices[0]; + } + else + { + _anchoredItemStart = -1; + _anchoredItemEnd = -1; + } + } + + // If we just removed the anchor start then update it accordingly + if (_anchoredItemStart == index) + { + if (_anchoredItemEnd < index) + _anchoredItemStart = index - 1; + else if (_anchoredItemEnd > index) + _anchoredItemStart = index + 1; + else + _anchoredItemStart = _anchoredItemEnd; + } + + // If we just removed the anchor end then update it accordingly + if (_anchoredItemEnd == index) + { + if (_anchoredItemStart < index) + _anchoredItemEnd = index - 1; + else if (_anchoredItemStart > index) + _anchoredItemEnd = index + 1; + else + _anchoredItemEnd = _anchoredItemStart; + } + } + else + { + _selectedIndices.Add(index); + _anchoredItemStart = index; + _anchoredItemEnd = index; + } + + if (SelectedIndicesChanged != null) + SelectedIndicesChanged(this, null); + + Invalidate(); + } + + public void SelectItems(int startRange, int endRange) + { + _selectedIndices.Clear(); + + if (startRange == endRange) + _selectedIndices.Add(startRange); + + if (startRange < endRange) + { + for (var i = startRange; i <= endRange; i++) + _selectedIndices.Add(i); + } + else if (startRange > endRange) + { + for (var i = startRange; i >= endRange; i--) + _selectedIndices.Add(i); + } + + if (SelectedIndicesChanged != null) + SelectedIndicesChanged(this, null); + + Invalidate(); + } + + private void SelectAnchoredRange(int index) + { + _anchoredItemEnd = index; + SelectItems(_anchoredItemStart, index); + } + + private void UpdateListBox() + { + using (var g = CreateGraphics()) + { + for (var i = 0; i <= Items.Count - 1; i++) + { + var item = Items[i]; + UpdateItemSize(item, g); + UpdateItemPosition(item, i); + } + } + + UpdateContentSize(); + } + + private void UpdateItemSize(DarkListItem item) + { + using (var g = CreateGraphics()) + { + UpdateItemSize(item, g); + } + } + + private void UpdateItemSize(DarkListItem item, Graphics g) + { + var size = g.MeasureString(item.Text, Font); + size.Width++; + + item.Area = new Rectangle(item.Area.Left, item.Area.Top, (int)size.Width, item.Area.Height); + } + + private void UpdateItemPosition(DarkListItem item, int index) + { + item.Area = new Rectangle(2, (index * ItemHeight), item.Area.Width, ItemHeight); + } + + private void UpdateContentSize() + { + var highestWidth = 0; + + foreach (var item in Items) + { + if (item.Area.Right + 1 > highestWidth) + highestWidth = item.Area.Right + 1; + } + + var width = highestWidth; + var height = Items.Count * ItemHeight; + + if (ContentSize.Width != width || ContentSize.Height != height) + { + ContentSize = new Size(width, height); + Invalidate(); + } + } + + private void UpdateContentSize(DarkListItem item) + { + var itemWidth = item.Area.Right + 1; + + if (itemWidth == ContentSize.Width) + { + UpdateContentSize(); + return; + } + + if (itemWidth > ContentSize.Width) + { + ContentSize = new Size(itemWidth, ContentSize.Height); + Invalidate(); + } + } + + public void EnsureVisible() + { + if (SelectedIndices.Count == 0) + return; + + var itemTop = -1; + + if (!MultiSelect) + itemTop = SelectedIndices[0] * ItemHeight; + else + itemTop = _anchoredItemEnd * ItemHeight; + + var itemBottom = itemTop + ItemHeight; + + if (itemTop < Viewport.Top) + VScrollTo(itemTop); + + if (itemBottom > Viewport.Bottom) + VScrollTo((itemBottom - Viewport.Height)); + } + + private IEnumerable ItemIndexesInView() + { + var top = (Viewport.Top / ItemHeight) - 1; + + if (top < 0) + top = 0; + + var bottom = ((Viewport.Top + Viewport.Height) / ItemHeight) + 1; + + if (bottom > Items.Count) + bottom = Items.Count; + + var result = Enumerable.Range(top, bottom - top); + return result; + } + + private IEnumerable ItemsInView() + { + var indexes = ItemIndexesInView(); + var result = indexes.Select(index => Items[index]).ToList(); + return result; + } + + #endregion + + #region Paint Region + + protected override void PaintContent(Graphics g) + { + var range = ItemIndexesInView().ToList(); + + if (range.Count == 0) + return; + + var top = range.Min(); + var bottom = range.Max(); + + for (var i = top; i <= bottom; i++) + { + var width = Math.Max(ContentSize.Width, Viewport.Width); + var rect = new Rectangle(0, i * ItemHeight, width, ItemHeight); + + // Background + var odd = i % 2 != 0; + var bgColor = !odd ? Colors.HeaderBackground : Colors.GreyBackground; + + if (SelectedIndices.Count > 0 && SelectedIndices.Contains(i)) + bgColor = Focused ? Colors.BlueSelection : Colors.GreySelection; + + using (var b = new SolidBrush(bgColor)) + { + g.FillRectangle(b, rect); + } + + // DEBUG: Border + /*using (var p = new Pen(Colors.DarkBorder)) + { + g.DrawLine(p, new Point(rect.Left, rect.Bottom - 1), new Point(rect.Right, rect.Bottom - 1)); + }*/ + + // Text + using (var b = new SolidBrush(Items[i].TextColor)) + { + var stringFormat = new StringFormat + { + Alignment = StringAlignment.Near, + LineAlignment = StringAlignment.Center + }; + + var modFont = new Font(Font, Items[i].FontStyle); + + var modRect = new Rectangle(rect.Left + 2, rect.Top, rect.Width, rect.Height); + g.DrawString(Items[i].Text, modFont, b, modRect, stringFormat); + } + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkMenuStrip.cs b/DarkUI/Controls/DarkMenuStrip.cs new file mode 100644 index 0000000..0071b2b --- /dev/null +++ b/DarkUI/Controls/DarkMenuStrip.cs @@ -0,0 +1,18 @@ +using DarkUI.Renderers; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkMenuStrip : MenuStrip + { + #region Constructor Region + + public DarkMenuStrip() + { + Renderer = new DarkMenuRenderer(); + Padding = new Padding(3, 2, 0, 2); + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkRadioButton.cs b/DarkUI/Controls/DarkRadioButton.cs new file mode 100644 index 0000000..bc1b33a --- /dev/null +++ b/DarkUI/Controls/DarkRadioButton.cs @@ -0,0 +1,320 @@ +using DarkUI.Config; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkRadioButton : RadioButton + { + #region Field Region + + private DarkControlState _controlState = DarkControlState.Normal; + + private bool _spacePressed; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Appearance Appearance + { + get { return base.Appearance; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool AutoEllipsis + { + get { return base.AutoEllipsis; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Image BackgroundImage + { + get { return base.BackgroundImage; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ImageLayout BackgroundImageLayout + { + get { return base.BackgroundImageLayout; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool FlatAppearance + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new FlatStyle FlatStyle + { + get { return base.FlatStyle; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Image Image + { + get { return base.Image; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ContentAlignment ImageAlign + { + get { return base.ImageAlign; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new int ImageIndex + { + get { return base.ImageIndex; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new string ImageKey + { + get { return base.ImageKey; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ImageList ImageList + { + get { return base.ImageList; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ContentAlignment TextAlign + { + get { return base.TextAlign; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new TextImageRelation TextImageRelation + { + get { return base.TextImageRelation; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool UseCompatibleTextRendering + { + get { return false; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool UseVisualStyleBackColor + { + get { return false; } + } + + #endregion + + #region Constructor Region + + public DarkRadioButton() + { + SetStyle(ControlStyles.SupportsTransparentBackColor | + ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + } + + #endregion + + #region Method Region + + private void SetControlState(DarkControlState controlState) + { + if (_controlState != controlState) + { + _controlState = controlState; + Invalidate(); + } + } + + #endregion + + #region Event Handler Region + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (_spacePressed) + return; + + if (e.Button == MouseButtons.Left) + { + if (ClientRectangle.Contains(e.Location)) + SetControlState(DarkControlState.Pressed); + else + SetControlState(DarkControlState.Hover); + } + else + { + SetControlState(DarkControlState.Hover); + } + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (!ClientRectangle.Contains(e.Location)) + return; + + SetControlState(DarkControlState.Pressed); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + if (_spacePressed) + return; + + SetControlState(DarkControlState.Normal); + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + if (_spacePressed) + return; + + SetControlState(DarkControlState.Normal); + } + + protected override void OnMouseCaptureChanged(EventArgs e) + { + base.OnMouseCaptureChanged(e); + + if (_spacePressed) + return; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetControlState(DarkControlState.Normal); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + + _spacePressed = false; + + var location = Cursor.Position; + + if (!ClientRectangle.Contains(location)) + SetControlState(DarkControlState.Normal); + else + SetControlState(DarkControlState.Hover); + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height); + + var size = Consts.RadioButtonSize; + + var textColor = Colors.LightText; + var borderColor = Colors.LightText; + var fillColor = Colors.LightestBackground; + + if (Enabled) + { + if (Focused) + { + borderColor = Colors.BlueHighlight; + fillColor = Colors.BlueSelection; + } + + if (_controlState == DarkControlState.Hover) + { + borderColor = Colors.BlueHighlight; + fillColor = Colors.BlueSelection; + } + else if (_controlState == DarkControlState.Pressed) + { + borderColor = Colors.GreyHighlight; + fillColor = Colors.GreySelection; + } + } + else + { + textColor = Colors.DisabledText; + borderColor = Colors.GreyHighlight; + fillColor = Colors.GreySelection; + } + + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, rect); + } + + g.SmoothingMode = SmoothingMode.HighQuality; + + using (var p = new Pen(borderColor)) + { + var boxRect = new Rectangle(0, (rect.Height / 2) - (size / 2), size, size); + g.DrawEllipse(p, boxRect); + } + + if (Checked) + { + using (var b = new SolidBrush(fillColor)) + { + Rectangle boxRect = new Rectangle(3, (rect.Height / 2) - ((size - 7) / 2) - 1, size - 6, size - 6); + g.FillEllipse(b, boxRect); + } + } + + g.SmoothingMode = SmoothingMode.Default; + + using (var b = new SolidBrush(textColor)) + { + var stringFormat = new StringFormat + { + LineAlignment = StringAlignment.Center, + Alignment = StringAlignment.Near + }; + + var modRect = new Rectangle(size + 4, 0, rect.Width - size, rect.Height); + g.DrawString(Text, Font, b, modRect, stringFormat); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkScrollBar.cs b/DarkUI/Controls/DarkScrollBar.cs new file mode 100644 index 0000000..4b9ab16 --- /dev/null +++ b/DarkUI/Controls/DarkScrollBar.cs @@ -0,0 +1,532 @@ +using DarkUI.Config; +using DarkUI.Icons; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkScrollBar : Control + { + #region Event Region + + public event EventHandler ValueChanged; + + #endregion + + #region Field Region + + private DarkScrollOrientation _scrollOrientation; + + private int _value; + private int _minimum = 0; + private int _maximum = 100; + + private int _viewSize; + + private Rectangle _trackArea; + private float _viewContentRatio; + + private Rectangle _thumbArea; + private Rectangle _upArrowArea; + private Rectangle _downArrowArea; + + private bool _thumbHot; + private bool _upArrowHot; + private bool _downArrowHot; + + private bool _thumbClicked; + private bool _upArrowClicked; + private bool _downArrowClicked; + + private bool _isScrolling; + private int _initialValue; + private Point _initialContact; + + private Timer _scrollTimer; + + #endregion + + #region Property Region + + [Category("Behavior")] + [Description("The orientation type of the scrollbar.")] + [DefaultValue(DarkScrollOrientation.Vertical)] + public DarkScrollOrientation ScrollOrientation + { + get { return _scrollOrientation; } + set + { + _scrollOrientation = value; + UpdateScrollBar(); + } + } + + [Category("Behavior")] + [Description("The value that the scroll thumb position represents.")] + [DefaultValue(0)] + public int Value + { + get { return _value; } + set + { + if (value < Minimum) + value = Minimum; + + var maximumValue = Maximum - ViewSize; + if (value > maximumValue) + value = maximumValue; + + if (_value == value) + return; + + _value = value; + + UpdateThumb(true); + + if (ValueChanged != null) + ValueChanged(this, new ScrollValueEventArgs(Value)); + } + } + + [Category("Behavior")] + [Description("The lower limit value of the scrollable range.")] + [DefaultValue(0)] + public int Minimum + { + get { return _minimum; } + set + { + _minimum = value; + UpdateScrollBar(); + } + } + + [Category("Behavior")] + [Description("The upper limit value of the scrollable range.")] + [DefaultValue(100)] + public int Maximum + { + get { return _maximum; } + set + { + _maximum = value; + UpdateScrollBar(); + } + } + + [Category("Behavior")] + [Description("The view size for the scrollable area.")] + [DefaultValue(0)] + public int ViewSize + { + get { return _viewSize; } + set + { + _viewSize = value; + UpdateScrollBar(); + } + } + + public new bool Visible + { + get { return base.Visible; } + set + { + if (base.Visible == value) + return; + + base.Visible = value; + } + } + + #endregion + + #region Constructor Region + + public DarkScrollBar() + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + + SetStyle(ControlStyles.Selectable, false); + + _scrollTimer = new Timer(); + _scrollTimer.Interval = 1; + _scrollTimer.Tick += ScrollTimerTick; + } + + #endregion + + #region Event Handler Region + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + UpdateScrollBar(); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (_thumbArea.Contains(e.Location) && e.Button == MouseButtons.Left) + { + _isScrolling = true; + _initialContact = e.Location; + + if (_scrollOrientation == DarkScrollOrientation.Vertical) + _initialValue = _thumbArea.Top; + else + _initialValue = _thumbArea.Left; + + Invalidate(); + return; + } + + if (_upArrowArea.Contains(e.Location) && e.Button == MouseButtons.Left) + { + _upArrowClicked = true; + _scrollTimer.Enabled = true; + + Invalidate(); + return; + } + + if (_downArrowArea.Contains(e.Location) && e.Button == MouseButtons.Left) + { + _downArrowClicked = true; + _scrollTimer.Enabled = true; + + Invalidate(); + return; + } + + if (_trackArea.Contains(e.Location) && e.Button == MouseButtons.Left) + { + // Step 1. Check if our input is at least aligned with the thumb + if (_scrollOrientation == DarkScrollOrientation.Vertical) + { + var modRect = new Rectangle(_thumbArea.Left, _trackArea.Top, _thumbArea.Width, _trackArea.Height); + if (!modRect.Contains(e.Location)) + return; + } + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) + { + var modRect = new Rectangle(_trackArea.Left, _thumbArea.Top, _trackArea.Width, _thumbArea.Height); + if (!modRect.Contains(e.Location)) + return; + } + + // Step 2. Scroll to the area initially clicked. + if (_scrollOrientation == DarkScrollOrientation.Vertical) + { + var loc = e.Location.Y; + loc -= _upArrowArea.Bottom - 1; + loc -= _thumbArea.Height / 2; + ScrollToPhysical(loc); + } + else + { + var loc = e.Location.X; + loc -= _upArrowArea.Right - 1; + loc -= _thumbArea.Width / 2; + ScrollToPhysical(loc); + } + + // Step 3. Initiate a thumb drag. + _isScrolling = true; + _initialContact = e.Location; + _thumbHot = true; + + if (_scrollOrientation == DarkScrollOrientation.Vertical) + _initialValue = _thumbArea.Top; + else + _initialValue = _thumbArea.Left; + + Invalidate(); + return; + } + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + _isScrolling = false; + + _thumbClicked = false; + _upArrowClicked = false; + _downArrowClicked = false; + + Invalidate(); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (!_isScrolling) + { + var thumbHot = _thumbArea.Contains(e.Location); + if (_thumbHot != thumbHot) + { + _thumbHot = thumbHot; + Invalidate(); + } + + var upArrowHot = _upArrowArea.Contains(e.Location); + if (_upArrowHot != upArrowHot) + { + _upArrowHot = upArrowHot; + Invalidate(); + } + + var downArrowHot = _downArrowArea.Contains(e.Location); + if (_downArrowHot != downArrowHot) + { + _downArrowHot = downArrowHot; + Invalidate(); + } + } + + if (_isScrolling) + { + if (e.Button != MouseButtons.Left) + { + OnMouseUp(null); + return; + } + + var difference = new Point(e.Location.X - _initialContact.X, e.Location.Y - _initialContact.Y); + + if (_scrollOrientation == DarkScrollOrientation.Vertical) + { + var thumbPos = (_initialValue - _trackArea.Top); + var newPosition = thumbPos + difference.Y; + + ScrollToPhysical(newPosition); + } + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) + { + var thumbPos = (_initialValue - _trackArea.Left); + var newPosition = thumbPos + difference.X; + + ScrollToPhysical(newPosition); + } + + UpdateScrollBar(); + } + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + _thumbHot = false; + _upArrowHot = false; + _downArrowHot = false; + + Invalidate(); + } + + private void ScrollTimerTick(object sender, EventArgs e) + { + if (!_upArrowClicked && !_downArrowClicked) + { + _scrollTimer.Enabled = false; + return; + } + + if (_upArrowClicked) + ScrollBy(-1); + else if (_downArrowClicked) + ScrollBy(1); + } + + #endregion + + #region Method Region + + public void ScrollTo(int position) + { + Value = position; + } + + public void ScrollToPhysical(int positionInPixels) + { + var isVert = _scrollOrientation == DarkScrollOrientation.Vertical; + + var trackAreaSize = isVert ? _trackArea.Height - _thumbArea.Height : _trackArea.Width - _thumbArea.Width; + + var positionRatio = (float)positionInPixels / (float)trackAreaSize; + var viewScrollSize = (Maximum - ViewSize); + + var newValue = (int)(positionRatio * viewScrollSize); + Value = newValue; + } + + public void ScrollBy(int offset) + { + var newValue = Value + offset; + ScrollTo(newValue); + } + + public void ScrollByPhysical(int offsetInPixels) + { + var isVert = _scrollOrientation == DarkScrollOrientation.Vertical; + + var thumbPos = isVert ? (_thumbArea.Top - _trackArea.Top) : (_thumbArea.Left - _trackArea.Left); + + var newPosition = thumbPos - offsetInPixels; + + ScrollToPhysical(newPosition); + } + + public void UpdateScrollBar() + { + if (ViewSize >= Maximum) + return; + + var area = ClientRectangle; + + // Cap to maximum value + var maximumValue = Maximum - ViewSize; + if (Value > maximumValue) + Value = maximumValue; + + // Arrow buttons + if (_scrollOrientation == DarkScrollOrientation.Vertical) + { + _upArrowArea = new Rectangle(area.Left, area.Top, Consts.ArrowButtonSize, Consts.ArrowButtonSize); + _downArrowArea = new Rectangle(area.Left, area.Bottom - Consts.ArrowButtonSize, Consts.ArrowButtonSize, Consts.ArrowButtonSize); + } + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) + { + _upArrowArea = new Rectangle(area.Left, area.Top, Consts.ArrowButtonSize, Consts.ArrowButtonSize); + _downArrowArea = new Rectangle(area.Right - Consts.ArrowButtonSize, area.Top, Consts.ArrowButtonSize, Consts.ArrowButtonSize); + } + + // Track + if (_scrollOrientation == DarkScrollOrientation.Vertical) + { + _trackArea = new Rectangle(area.Left, area.Top + Consts.ArrowButtonSize, area.Width, area.Height - (Consts.ArrowButtonSize * 2)); + } + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) + { + _trackArea = new Rectangle(area.Left + Consts.ArrowButtonSize, area.Top, area.Width - (Consts.ArrowButtonSize * 2), area.Height); + } + + // Thumb + UpdateThumb(); + + Invalidate(); + } + + private void UpdateThumb(bool forceRefresh = false) + { + // Calculate size ratio + _viewContentRatio = (float)ViewSize / (float)Maximum; + var viewAreaSize = Maximum - ViewSize; + var positionRatio = (float)Value / (float)viewAreaSize; + + // Update area + if (_scrollOrientation == DarkScrollOrientation.Vertical) + { + var thumbSize = (int)(_trackArea.Height * _viewContentRatio); + + if (thumbSize < Consts.MinimumThumbSize) + thumbSize = Consts.MinimumThumbSize; + + var trackAreaSize = _trackArea.Height - thumbSize; + var thumbPosition = (int)(trackAreaSize * positionRatio); + + _thumbArea = new Rectangle(_trackArea.Left + 3, _trackArea.Top + thumbPosition, Consts.ScrollBarSize - 6, thumbSize); + } + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) + { + var thumbSize = (int)(_trackArea.Width * _viewContentRatio); + + if (thumbSize < Consts.MinimumThumbSize) + thumbSize = Consts.MinimumThumbSize; + + var trackAreaSize = _trackArea.Width - thumbSize; + var thumbPosition = (int)(trackAreaSize * positionRatio); + + _thumbArea = new Rectangle(_trackArea.Left + thumbPosition, _trackArea.Top + 3, thumbSize, Consts.ScrollBarSize - 6); + } + + if (forceRefresh) + { + Invalidate(); + Update(); + } + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + + // DEBUG: Scrollbar bg + /*using (var b = new SolidBrush(Colors.MediumBackground)) + { + g.FillRectangle(b, ClientRectangle); + }*/ + + // DEBUG: Arrow backgrounds + /*using (var b = new SolidBrush(Color.White)) + { + g.FillRectangle(b, _upArrowArea); + g.FillRectangle(b, _downArrowArea); + }*/ + + // Up arrow + var upIcon = _upArrowHot ? ScrollIcons.scrollbar_arrow_hot : ScrollIcons.scrollbar_arrow_standard; + + if (_upArrowClicked) + upIcon = ScrollIcons.scrollbar_arrow_clicked; + + if (_scrollOrientation == DarkScrollOrientation.Vertical) + upIcon.RotateFlip(RotateFlipType.RotateNoneFlipY); + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) + upIcon.RotateFlip(RotateFlipType.Rotate90FlipNone); + + g.DrawImageUnscaled(upIcon, + _upArrowArea.Left + (_upArrowArea.Width / 2) - (upIcon.Width / 2), + _upArrowArea.Top + (_upArrowArea.Height / 2) - (upIcon.Height / 2)); + + // Down arrow + var downIcon = _downArrowHot ? ScrollIcons.scrollbar_arrow_hot : ScrollIcons.scrollbar_arrow_standard; + + if (_downArrowClicked) + downIcon = ScrollIcons.scrollbar_arrow_clicked; + + if (_scrollOrientation == DarkScrollOrientation.Horizontal) + downIcon.RotateFlip(RotateFlipType.Rotate270FlipNone); + + g.DrawImageUnscaled(downIcon, + _downArrowArea.Left + (_downArrowArea.Width / 2) - (downIcon.Width / 2), + _downArrowArea.Top + (_downArrowArea.Height / 2) - (downIcon.Height / 2)); + + // Draw thumb + var scrollColor = _thumbHot ? Colors.GreyHighlight : Colors.GreySelection; + + if (_isScrolling) + scrollColor = Colors.ActiveControl; + + using (var b = new SolidBrush(scrollColor)) + { + g.FillRectangle(b, _thumbArea); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkScrollBase.cs b/DarkUI/Controls/DarkScrollBase.cs new file mode 100644 index 0000000..f0d56c1 --- /dev/null +++ b/DarkUI/Controls/DarkScrollBase.cs @@ -0,0 +1,403 @@ +using DarkUI.Config; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public abstract class DarkScrollBase : Control + { + #region Event Region + + public event EventHandler ViewportChanged; + public event EventHandler ContentSizeChanged; + + #endregion + + #region Field Region + + protected readonly DarkScrollBar _vScrollBar; + protected readonly DarkScrollBar _hScrollBar; + + private Size _visibleSize; + private Size _contentSize; + + private Rectangle _viewport; + + private Point _offsetMousePosition; + + private int _maxDragChange = 0; + private Timer _dragTimer; + + #endregion + + #region Property Region + + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Rectangle Viewport + { + get { return _viewport; } + private set + { + _viewport = value; + + if (ViewportChanged != null) + ViewportChanged(this, null); + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Size ContentSize + { + get { return _contentSize; } + set + { + _contentSize = value; + UpdateScrollBars(); + + if (ContentSizeChanged != null) + ContentSizeChanged(this, null); + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Point OffsetMousePosition + { + get { return _offsetMousePosition; } + } + + [Category("Behavior")] + [Description("Determines the maximum scroll change when dragging.")] + [DefaultValue(0)] + public int MaxDragChange + { + get { return _maxDragChange; } + set + { + _maxDragChange = value; + Invalidate(); + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool IsDragging { get; private set; } + + #endregion + + #region Constructor Region + + protected DarkScrollBase() + { + SetStyle(ControlStyles.Selectable | + ControlStyles.UserMouse, true); + + _vScrollBar = new DarkScrollBar { ScrollOrientation = DarkScrollOrientation.Vertical }; + _hScrollBar = new DarkScrollBar { ScrollOrientation = DarkScrollOrientation.Horizontal }; + + Controls.Add(_vScrollBar); + Controls.Add(_hScrollBar); + + _vScrollBar.ValueChanged += delegate { UpdateViewport(); }; + _hScrollBar.ValueChanged += delegate { UpdateViewport(); }; + + _vScrollBar.MouseDown += delegate { Select(); }; + _hScrollBar.MouseDown += delegate { Select(); }; + + _dragTimer = new Timer(); + _dragTimer.Interval = 1; + _dragTimer.Tick += DragTimer_Tick; + } + + #endregion + + #region Method Region + + private void UpdateScrollBars() + { + if (_vScrollBar.Maximum != ContentSize.Height) + _vScrollBar.Maximum = ContentSize.Height; + + if (_hScrollBar.Maximum != ContentSize.Width) + _hScrollBar.Maximum = ContentSize.Width; + + var scrollSize = Consts.ScrollBarSize; + + _vScrollBar.Location = new Point(ClientSize.Width - scrollSize, 0); + _vScrollBar.Size = new Size(scrollSize, ClientSize.Height); + + _hScrollBar.Location = new Point(0, ClientSize.Height - scrollSize); + _hScrollBar.Size = new Size(ClientSize.Width, scrollSize); + + if (DesignMode) + return; + + // Do this twice in case changing the visibility of the scrollbars + // causes the VisibleSize to change in such a way as to require a second scrollbar. + // Probably a better way to detect that scenario... + SetVisibleSize(); + SetScrollBarVisibility(); + SetVisibleSize(); + SetScrollBarVisibility(); + + if (_vScrollBar.Visible) + _hScrollBar.Width -= scrollSize; + + if (_hScrollBar.Visible) + _vScrollBar.Height -= scrollSize; + + _vScrollBar.ViewSize = _visibleSize.Height; + _hScrollBar.ViewSize = _visibleSize.Width; + + UpdateViewport(); + } + + private void SetScrollBarVisibility() + { + _vScrollBar.Visible = _visibleSize.Height < ContentSize.Height; + _hScrollBar.Visible = _visibleSize.Width < ContentSize.Width; + } + + private void SetVisibleSize() + { + var scrollSize = Consts.ScrollBarSize; + + _visibleSize = new Size(ClientSize.Width, ClientSize.Height); + + if (_vScrollBar.Visible) + _visibleSize.Width -= scrollSize; + + if (_hScrollBar.Visible) + _visibleSize.Height -= scrollSize; + } + + private void UpdateViewport() + { + var left = 0; + var top = 0; + var width = ClientSize.Width; + var height = ClientSize.Height; + + if (_hScrollBar.Visible) + { + left = _hScrollBar.Value; + height -= _hScrollBar.Height; + } + + if (_vScrollBar.Visible) + { + top = _vScrollBar.Value; + width -= _vScrollBar.Width; + } + + Viewport = new Rectangle(left, top, width, height); + + var pos = PointToClient(MousePosition); + _offsetMousePosition = new Point(pos.X + Viewport.Left, pos.Y + Viewport.Top); + + Invalidate(); + } + + public void ScrollTo(Point point) + { + HScrollTo(point.X); + VScrollTo(point.Y); + } + + public void VScrollTo(int value) + { + if (_vScrollBar.Visible) + _vScrollBar.Value = value; + } + + public void HScrollTo(int value) + { + if (_hScrollBar.Visible) + _hScrollBar.Value = value; + } + + protected virtual void StartDrag() + { + IsDragging = true; + _dragTimer.Start(); + } + + protected virtual void StopDrag() + { + IsDragging = false; + _dragTimer.Stop(); + } + + public Point PointToView(Point point) + { + return new Point(point.X - Viewport.Left, point.Y - Viewport.Top); + } + + public Rectangle RectangleToView(Rectangle rect) + { + return new Rectangle(new Point(rect.Left - Viewport.Left, rect.Top - Viewport.Top), rect.Size); + } + + #endregion + + #region Event Handler Region + + protected override void OnCreateControl() + { + base.OnCreateControl(); + + UpdateScrollBars(); + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + + Invalidate(); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + UpdateScrollBars(); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + _offsetMousePosition = new Point(e.X + Viewport.Left, e.Y + Viewport.Top); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (e.Button == MouseButtons.Right) + Select(); + } + + protected override void OnMouseWheel(MouseEventArgs e) + { + base.OnMouseWheel(e); + + var horizontal = false; + + if (_hScrollBar.Visible && ModifierKeys == Keys.Control) + horizontal = true; + + if (_hScrollBar.Visible && !_vScrollBar.Visible) + horizontal = true; + + if (!horizontal) + { + if (e.Delta > 0) + _vScrollBar.ScrollByPhysical(3); + else if (e.Delta < 0) + _vScrollBar.ScrollByPhysical(-3); + } + else + { + if (e.Delta > 0) + _hScrollBar.ScrollByPhysical(3); + else if (e.Delta < 0) + _hScrollBar.ScrollByPhysical(-3); + } + } + + protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e) + { + base.OnPreviewKeyDown(e); + + // Allows arrow keys to trigger OnKeyPress + switch (e.KeyCode) + { + case Keys.Up: + case Keys.Down: + case Keys.Left: + case Keys.Right: + e.IsInputKey = true; + break; + } + } + + private void DragTimer_Tick(object sender, EventArgs e) + { + var pos = PointToClient(MousePosition); + + var right = ClientRectangle.Right; + var bottom = ClientRectangle.Bottom; + + if (_vScrollBar.Visible) + right = _vScrollBar.Left; + + if (_hScrollBar.Visible) + bottom = _hScrollBar.Top; + + if (_vScrollBar.Visible) + { + // Scroll up + if (pos.Y < ClientRectangle.Top) + { + var difference = (pos.Y - ClientRectangle.Top) * -1; + + if (MaxDragChange > 0 && difference > MaxDragChange) + difference = MaxDragChange; + + _vScrollBar.Value = _vScrollBar.Value - difference; + } + + // Scroll down + if (pos.Y > bottom) + { + var difference = pos.Y - bottom; + + if (MaxDragChange > 0 && difference > MaxDragChange) + difference = MaxDragChange; + + _vScrollBar.Value = _vScrollBar.Value + difference; + } + } + + if (_hScrollBar.Visible) + { + // Scroll left + if (pos.X < ClientRectangle.Left) + { + var difference = (pos.X - ClientRectangle.Left) * -1; + + if (MaxDragChange > 0 && difference > MaxDragChange) + difference = MaxDragChange; + + _hScrollBar.Value = _hScrollBar.Value - difference; + } + + // Scroll right + if (pos.X > right) + { + var difference = pos.X - right; + + if (MaxDragChange > 0 && difference > MaxDragChange) + difference = MaxDragChange; + + _hScrollBar.Value = _hScrollBar.Value + difference; + } + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkScrollOrientation.cs b/DarkUI/Controls/DarkScrollOrientation.cs new file mode 100644 index 0000000..36e2c0b --- /dev/null +++ b/DarkUI/Controls/DarkScrollOrientation.cs @@ -0,0 +1,8 @@ +namespace DarkUI.Controls +{ + public enum DarkScrollOrientation + { + Vertical, + Horizontal + } +} diff --git a/DarkUI/Controls/DarkScrollView.cs b/DarkUI/Controls/DarkScrollView.cs new file mode 100644 index 0000000..00f3832 --- /dev/null +++ b/DarkUI/Controls/DarkScrollView.cs @@ -0,0 +1,60 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public abstract class DarkScrollView : DarkScrollBase + { + #region Constructor Region + + protected DarkScrollView() + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + } + + #endregion + + #region Paint Region + + protected abstract void PaintContent(Graphics g); + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + + // Draw background + using (var b = new SolidBrush(BackColor)) + { + g.FillRectangle(b, ClientRectangle); + } + + // Offset the graphics based on the viewport, render the control contents, then reset it. + g.TranslateTransform(Viewport.Left * -1, Viewport.Top * -1); + + PaintContent(g); + + g.TranslateTransform(Viewport.Left, Viewport.Top); + + // Draw the bit where the scrollbars meet + if (_vScrollBar.Visible && _hScrollBar.Visible) + { + using (var b = new SolidBrush(BackColor)) + { + var rect = new Rectangle(_hScrollBar.Right, _vScrollBar.Bottom, _vScrollBar.Width, + _hScrollBar.Height); + + g.FillRectangle(b, rect); + } + } + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + // Absorb event + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkSectionPanel.cs b/DarkUI/Controls/DarkSectionPanel.cs new file mode 100644 index 0000000..e449ec9 --- /dev/null +++ b/DarkUI/Controls/DarkSectionPanel.cs @@ -0,0 +1,146 @@ +using DarkUI.Config; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkSectionPanel : Panel + { + #region Field Region + + private string _sectionHeader; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Padding Padding + { + get { return base.Padding; } + } + + [Category("Appearance")] + [Description("The section header text associated with this control.")] + public string SectionHeader + { + get { return _sectionHeader; } + set + { + _sectionHeader = value; + Invalidate(); + } + } + + #endregion + + #region Constructor Region + + public DarkSectionPanel() + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + + base.Padding = new Padding(1, 25, 1, 1); + } + + #endregion + + #region Event Handler Region + + protected override void OnEnter(System.EventArgs e) + { + base.OnEnter(e); + + Invalidate(); + } + + protected override void OnLeave(System.EventArgs e) + { + base.OnLeave(e); + + Invalidate(); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (Controls.Count > 0) + Controls[0].Focus(); + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + var rect = ClientRectangle; + + // Fill body + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, rect); + } + + // Draw header + var bgColor = ContainsFocus ? Colors.BlueBackground : Colors.HeaderBackground; + var darkColor = ContainsFocus ? Colors.DarkBlueBorder : Colors.DarkBorder; + var lightColor = ContainsFocus ? Colors.LightBlueBorder : Colors.LightBorder; + + using (var b = new SolidBrush(bgColor)) + { + var bgRect = new Rectangle(0, 0, rect.Width, 25); + g.FillRectangle(b, bgRect); + } + + using (var p = new Pen(darkColor)) + { + g.DrawLine(p, rect.Left, 0, rect.Right, 0); + g.DrawLine(p, rect.Left, 25 - 1, rect.Right, 25 - 1); + } + + using (var p = new Pen(lightColor)) + { + g.DrawLine(p, rect.Left, 1, rect.Right, 1); + } + + var xOffset = 3; + + using (var b = new SolidBrush(Colors.LightText)) + { + var textRect = new Rectangle(xOffset, 0, rect.Width - 4 - xOffset, 25); + + var format = new StringFormat + { + Alignment = StringAlignment.Near, + LineAlignment = StringAlignment.Center, + FormatFlags = StringFormatFlags.NoWrap, + Trimming = StringTrimming.EllipsisCharacter + }; + + g.DrawString(SectionHeader, Font, b, textRect, format); + } + + // Draw border + using (var p = new Pen(Colors.DarkBorder, 1)) + { + var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1); + + g.DrawRectangle(p, modRect); + } + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + // Absorb event + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkSeparator.cs b/DarkUI/Controls/DarkSeparator.cs new file mode 100644 index 0000000..adf17ae --- /dev/null +++ b/DarkUI/Controls/DarkSeparator.cs @@ -0,0 +1,45 @@ +using DarkUI.Config; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkSeparator : Control + { + #region Constructor Region + + public DarkSeparator() + { + SetStyle(ControlStyles.Selectable, false); + + Dock = DockStyle.Top; + Size = new Size(1, 2); + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + + using (var p = new Pen(Colors.DarkBorder)) + { + g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Right, 0); + } + + using (var p = new Pen(Colors.LightBorder)) + { + g.DrawLine(p, ClientRectangle.Left, 1, ClientRectangle.Right, 1); + } + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + // Absorb event + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkStatusStrip.cs b/DarkUI/Controls/DarkStatusStrip.cs new file mode 100644 index 0000000..4ba17c9 --- /dev/null +++ b/DarkUI/Controls/DarkStatusStrip.cs @@ -0,0 +1,47 @@ +using DarkUI.Config; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkStatusStrip : StatusStrip + { + #region Constructor Region + + public DarkStatusStrip() + { + AutoSize = false; + BackColor = Colors.GreyBackground; + ForeColor = Colors.LightText; + Padding = new Padding(0, 5, 0, 3); + Size = new Size(Size.Width, 24); + SizingGrip = false; + } + + #endregion + + #region Paint Region + + protected override void OnPaintBackground(PaintEventArgs e) + { + var g = e.Graphics; + + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, ClientRectangle); + } + + using (var p = new Pen(Colors.DarkBorder)) + { + g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Right, 0); + } + + using (var p = new Pen(Colors.LightBorder)) + { + g.DrawLine(p, ClientRectangle.Left, 1, ClientRectangle.Right, 1); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkTextBox.cs b/DarkUI/Controls/DarkTextBox.cs new file mode 100644 index 0000000..d4b2ede --- /dev/null +++ b/DarkUI/Controls/DarkTextBox.cs @@ -0,0 +1,20 @@ +using DarkUI.Config; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkTextBox : TextBox + { + #region Constructor Region + + public DarkTextBox() + { + BackColor = Colors.LightBackground; + ForeColor = Colors.LightText; + Padding = new Padding(2, 2, 2, 2); + BorderStyle = BorderStyle.FixedSingle; + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkTitle.cs b/DarkUI/Controls/DarkTitle.cs new file mode 100644 index 0000000..bb92680 --- /dev/null +++ b/DarkUI/Controls/DarkTitle.cs @@ -0,0 +1,40 @@ +using DarkUI.Config; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkTitle : Label + { + #region Constructor Region + + public DarkTitle() + { } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height); + + var textSize = g.MeasureString(Text, Font); + + using (var b = new SolidBrush(Colors.LightText)) + { + g.DrawString(Text, Font, b, new PointF(-2, 0)); + } + + using (var p = new Pen(Colors.GreyHighlight)) + { + var p1 = new PointF(textSize.Width + 5, textSize.Height / 2); + var p2 = new PointF(rect.Width, textSize.Height / 2); + g.DrawLine(p, p1, p2); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkToolStrip.cs b/DarkUI/Controls/DarkToolStrip.cs new file mode 100644 index 0000000..49586c2 --- /dev/null +++ b/DarkUI/Controls/DarkToolStrip.cs @@ -0,0 +1,21 @@ +using DarkUI.Renderers; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkToolStrip : ToolStrip + { + #region Constructor Region + + public DarkToolStrip() + { + Renderer = new DarkToolStripRenderer(); + Padding = new Padding(5, 0, 1, 0); + AutoSize = false; + Size = new Size(1, 28); + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkTreeNode.cs b/DarkUI/Controls/DarkTreeNode.cs new file mode 100644 index 0000000..56608bb --- /dev/null +++ b/DarkUI/Controls/DarkTreeNode.cs @@ -0,0 +1,259 @@ +using DarkUI.Collections; +using System; +using System.Drawing; + +namespace DarkUI.Controls +{ + public class DarkTreeNode + { + #region Event Region + + public event EventHandler> ItemsAdded; + public event EventHandler> ItemsRemoved; + + public event EventHandler TextChanged; + public event EventHandler NodeExpanded; + public event EventHandler NodeCollapsed; + + #endregion + + #region Field Region + + private string _text; + private bool _isRoot; + private DarkTreeView _parentTree; + private DarkTreeNode _parentNode; + + private ObservableList _nodes; + + private bool _expanded; + + #endregion + + #region Property Region + + public string Text + { + get { return _text; } + set + { + if (_text == value) + return; + + _text = value; + + OnTextChanged(); + } + } + + public Rectangle ExpandArea { get; set; } + + public Rectangle IconArea { get; set; } + + public Rectangle TextArea { get; set; } + + public Rectangle FullArea { get; set; } + + public bool ExpandAreaHot { get; set; } + + public Bitmap Icon { get; set; } + + public Bitmap ExpandedIcon { get; set; } + + public bool Expanded + { + get { return _expanded; } + set + { + if (_expanded == value) + return; + + if (value == true && Nodes.Count == 0) + return; + + _expanded = value; + + if (_expanded) + { + if (NodeExpanded != null) + NodeExpanded(this, null); + } + else + { + if (NodeCollapsed != null) + NodeCollapsed(this, null); + } + } + } + + public ObservableList Nodes + { + get { return _nodes; } + set + { + if (_nodes != null) + { + _nodes.ItemsAdded -= Nodes_ItemsAdded; + _nodes.ItemsRemoved -= Nodes_ItemsRemoved; + } + + _nodes = value; + + _nodes.ItemsAdded += Nodes_ItemsAdded; + _nodes.ItemsRemoved += Nodes_ItemsRemoved; + } + } + + public bool IsRoot + { + get { return _isRoot; } + set { _isRoot = value; } + } + + public DarkTreeView ParentTree + { + get { return _parentTree; } + set + { + if (_parentTree == value) + return; + + _parentTree = value; + + foreach (var node in Nodes) + node.ParentTree = _parentTree; + } + } + + public DarkTreeNode ParentNode + { + get { return _parentNode; } + set { _parentNode = value; } + } + + public bool Odd { get; set; } + + public object NodeType { get; set; } + + public object Tag { get; set; } + + public string FullPath + { + get + { + var parent = ParentNode; + var path = Text; + + while (parent != null) + { + path = string.Format("{0}{1}{2}", parent.Text, "\\", path); + parent = parent.ParentNode; + } + + return path; + } + } + + public DarkTreeNode PrevVisibleNode { get; set; } + + public DarkTreeNode NextVisibleNode { get; set; } + + public int VisibleIndex { get; set; } + + public bool IsNodeAncestor(DarkTreeNode node) + { + var parent = ParentNode; + while (parent != null) + { + if (parent == node) + return true; + + parent = parent.ParentNode; + } + + return false; + } + + #endregion + + #region Constructor Region + + public DarkTreeNode() + { + Nodes = new ObservableList(); + } + + public DarkTreeNode(string text) + : this() + { + Text = text; + } + + #endregion + + #region Method Region + + public void Remove() + { + if (ParentNode != null) + ParentNode.Nodes.Remove(this); + else + ParentTree.Nodes.Remove(this); + } + + public void EnsureVisible() + { + var parent = ParentNode; + + while (parent != null) + { + parent.Expanded = true; + parent = parent.ParentNode; + } + } + + #endregion + + #region Event Handler Region + + private void OnTextChanged() + { + if (ParentTree != null && ParentTree.TreeViewNodeSorter != null) + { + if (ParentNode != null) + ParentNode.Nodes.Sort(ParentTree.TreeViewNodeSorter); + else + ParentTree.Nodes.Sort(ParentTree.TreeViewNodeSorter); + } + + if (TextChanged != null) + TextChanged(this, null); + } + + private void Nodes_ItemsAdded(object sender, ObservableListModified e) + { + foreach (var node in e.Items) + { + node.ParentNode = this; + node.ParentTree = ParentTree; + } + + if (ParentTree != null && ParentTree.TreeViewNodeSorter != null) + Nodes.Sort(ParentTree.TreeViewNodeSorter); + + if (ItemsAdded != null) + ItemsAdded(this, e); + } + + private void Nodes_ItemsRemoved(object sender, ObservableListModified e) + { + if (Nodes.Count == 0) + Expanded = false; + + if (ItemsRemoved != null) + ItemsRemoved(this, e); + } + + #endregion + } +} diff --git a/DarkUI/Controls/DarkTreeView.cs b/DarkUI/Controls/DarkTreeView.cs new file mode 100644 index 0000000..2d748bd --- /dev/null +++ b/DarkUI/Controls/DarkTreeView.cs @@ -0,0 +1,1274 @@ +using DarkUI.Collections; +using DarkUI.Config; +using DarkUI.Extensions; +using DarkUI.Forms; +using DarkUI.Icons; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public class DarkTreeView : DarkScrollView + { + #region Event Region + + public event EventHandler SelectedNodesChanged; + public event EventHandler AfterNodeExpand; + public event EventHandler AfterNodeCollapse; + + #endregion + + #region Field Region + + private bool _disposed; + + private readonly int _expandAreaSize = 16; + private readonly int _iconSize = 16; + + private int _itemHeight = 20; + private int _indent = 20; + + private ObservableList _nodes; + private ObservableCollection _selectedNodes; + + private DarkTreeNode _anchoredNodeStart; + private DarkTreeNode _anchoredNodeEnd; + + private Bitmap _nodeClosed; + private Bitmap _nodeClosedHover; + private Bitmap _nodeClosedHoverSelected; + private Bitmap _nodeOpen; + private Bitmap _nodeOpenHover; + private Bitmap _nodeOpenHoverSelected; + + private DarkTreeNode _provisionalNode; + private DarkTreeNode _dropNode; + private bool _provisionalDragging; + private List _dragNodes; + private Point _dragPos; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public ObservableList Nodes + { + get { return _nodes; } + set + { + if (_nodes != null) + { + _nodes.ItemsAdded -= Nodes_ItemsAdded; + _nodes.ItemsRemoved -= Nodes_ItemsRemoved; + + foreach (var node in _nodes) + UnhookNodeEvents(node); + } + + _nodes = value; + + _nodes.ItemsAdded += Nodes_ItemsAdded; + _nodes.ItemsRemoved += Nodes_ItemsRemoved; + + foreach (var node in _nodes) + HookNodeEvents(node); + + UpdateNodes(); + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public ObservableCollection SelectedNodes + { + get { return _selectedNodes; } + } + + [Category("Appearance")] + [Description("Determines the height of tree nodes.")] + [DefaultValue(20)] + public int ItemHeight + { + get { return _itemHeight; } + set + { + _itemHeight = value; + MaxDragChange = _itemHeight; + UpdateNodes(); + } + } + + [Category("Appearance")] + [Description("Determines the amount of horizontal space given by parent node.")] + [DefaultValue(20)] + public int Indent + { + get { return _indent; } + set + { + _indent = value; + UpdateNodes(); + } + } + + [Category("Behavior")] + [Description("Determines whether multiple tree nodes can be selected at once.")] + [DefaultValue(false)] + public bool MultiSelect { get; set; } + + [Category("Behavior")] + [Description("Determines whether nodes can be moved within this tree view.")] + [DefaultValue(false)] + public bool AllowMoveNodes { get; set; } + + [Category("Appearance")] + [Description("Determines whether icons are rendered with the tree nodes.")] + [DefaultValue(false)] + public bool ShowIcons { get; set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int VisibleNodeCount { get; private set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IComparer TreeViewNodeSorter { get; set; } + + #endregion + + #region Constructor Region + + public DarkTreeView() + { + Nodes = new ObservableList(); + _selectedNodes = new ObservableCollection(); + _selectedNodes.CollectionChanged += SelectedNodes_CollectionChanged; + + MaxDragChange = _itemHeight; + + LoadIcons(); + } + + #endregion + + #region Dispose Region + + protected override void Dispose(bool disposing) + { + if (!_disposed) + { + DisposeIcons(); + + if (SelectedNodesChanged != null) + SelectedNodesChanged = null; + + if (AfterNodeExpand != null) + AfterNodeExpand = null; + + if (AfterNodeCollapse != null) + AfterNodeExpand = null; + + if (_nodes != null) + _nodes.Dispose(); + + if (_selectedNodes != null) + _selectedNodes.CollectionChanged -= SelectedNodes_CollectionChanged; + + _disposed = true; + } + + base.Dispose(disposing); + } + + #endregion + + #region Event Handler Region + + private void Nodes_ItemsAdded(object sender, ObservableListModified e) + { + foreach (var node in e.Items) + { + node.ParentTree = this; + node.IsRoot = true; + + HookNodeEvents(node); + } + + if (TreeViewNodeSorter != null) + Nodes.Sort(TreeViewNodeSorter); + + UpdateNodes(); + } + + private void Nodes_ItemsRemoved(object sender, ObservableListModified e) + { + foreach (var node in e.Items) + { + node.ParentTree = this; + node.IsRoot = true; + + HookNodeEvents(node); + } + + UpdateNodes(); + } + + private void ChildNodes_ItemsAdded(object sender, ObservableListModified e) + { + foreach (var node in e.Items) + HookNodeEvents(node); + + UpdateNodes(); + } + + private void ChildNodes_ItemsRemoved(object sender, ObservableListModified e) + { + foreach (var node in e.Items) + { + if (SelectedNodes.Contains(node)) + SelectedNodes.Remove(node); + + UnhookNodeEvents(node); + } + + UpdateNodes(); + } + + private void SelectedNodes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (SelectedNodesChanged != null) + SelectedNodesChanged(this, null); + } + + private void Nodes_TextChanged(object sender, EventArgs e) + { + UpdateNodes(); + } + + private void Nodes_NodeExpanded(object sender, EventArgs e) + { + UpdateNodes(); + + if (AfterNodeExpand != null) + AfterNodeExpand(this, null); + } + + private void Nodes_NodeCollapsed(object sender, EventArgs e) + { + UpdateNodes(); + + if (AfterNodeCollapse != null) + AfterNodeCollapse(this, null); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + if (_provisionalDragging) + { + if (OffsetMousePosition != _dragPos) + { + StartDrag(); + HandleDrag(); + return; + } + } + + if (IsDragging) + { + if (_dropNode != null) + { + var rect = GetNodeFullRowArea(_dropNode); + if (!rect.Contains(OffsetMousePosition)) + { + _dropNode = null; + Invalidate(); + } + } + } + + CheckHover(); + + if (IsDragging) + { + HandleDrag(); + } + + base.OnMouseMove(e); + } + + protected override void OnMouseWheel(MouseEventArgs e) + { + CheckHover(); + + base.OnMouseWheel(e); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) + { + foreach (var node in Nodes) + CheckNodeClick(node, OffsetMousePosition, e.Button); + } + + base.OnMouseDown(e); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + if (IsDragging) + { + HandleDrop(); + } + + if (_provisionalDragging) + { + + if (_provisionalNode != null) + { + var pos = _dragPos; + if (OffsetMousePosition == pos) + SelectNode(_provisionalNode); + } + + _provisionalDragging = false; + } + + base.OnMouseUp(e); + } + + protected override void OnMouseDoubleClick(MouseEventArgs e) + { + if (ModifierKeys == Keys.Control) + return; + + if (e.Button == MouseButtons.Left) + { + foreach (var node in Nodes) + CheckNodeDoubleClick(node, OffsetMousePosition); + } + + base.OnMouseDoubleClick(e); + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + foreach (var node in Nodes) + NodeMouseLeave(node); + } + + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + + if (IsDragging) + return; + + if (Nodes.Count == 0) + return; + + if (e.KeyCode != Keys.Down && e.KeyCode != Keys.Up && e.KeyCode != Keys.Left && e.KeyCode != Keys.Right) + return; + + if (_anchoredNodeEnd == null) + { + if (Nodes.Count > 0) + SelectNode(Nodes[0]); + return; + } + + if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up) + { + if (MultiSelect && ModifierKeys == Keys.Shift) + { + if (e.KeyCode == Keys.Up) + { + if (_anchoredNodeEnd.PrevVisibleNode != null) + { + SelectAnchoredRange(_anchoredNodeEnd.PrevVisibleNode); + EnsureVisible(); + } + } + else if (e.KeyCode == Keys.Down) + { + if (_anchoredNodeEnd.NextVisibleNode != null) + { + SelectAnchoredRange(_anchoredNodeEnd.NextVisibleNode); + EnsureVisible(); + } + } + } + else + { + if (e.KeyCode == Keys.Up) + { + if (_anchoredNodeEnd.PrevVisibleNode != null) + { + SelectNode(_anchoredNodeEnd.PrevVisibleNode); + EnsureVisible(); + } + } + else if (e.KeyCode == Keys.Down) + { + if (_anchoredNodeEnd.NextVisibleNode != null) + { + SelectNode(_anchoredNodeEnd.NextVisibleNode); + EnsureVisible(); + } + } + } + } + + if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) + { + if (e.KeyCode == Keys.Left) + { + if (_anchoredNodeEnd.Expanded && _anchoredNodeEnd.Nodes.Count > 0) + { + _anchoredNodeEnd.Expanded = false; + } + else + { + if (_anchoredNodeEnd.ParentNode != null) + { + SelectNode(_anchoredNodeEnd.ParentNode); + EnsureVisible(); + } + } + } + else if (e.KeyCode == Keys.Right) + { + if (!_anchoredNodeEnd.Expanded) + { + _anchoredNodeEnd.Expanded = true; + } + else + { + if (_anchoredNodeEnd.Nodes.Count > 0) + { + SelectNode(_anchoredNodeEnd.Nodes[0]); + EnsureVisible(); + } + } + } + } + } + + private void DragTimer_Tick(object sender, EventArgs e) + { + if (!IsDragging) + { + StopDrag(); + return; + } + + if (MouseButtons != MouseButtons.Left) + { + StopDrag(); + return; + } + + var pos = PointToClient(MousePosition); + + if (_vScrollBar.Visible) + { + // Scroll up + if (pos.Y < ClientRectangle.Top) + { + var difference = (pos.Y - ClientRectangle.Top) * -1; + + if (difference > ItemHeight) + difference = ItemHeight; + + _vScrollBar.Value = _vScrollBar.Value - difference; + } + + // Scroll down + if (pos.Y > ClientRectangle.Bottom) + { + var difference = pos.Y - ClientRectangle.Bottom; + + if (difference > ItemHeight) + difference = ItemHeight; + + _vScrollBar.Value = _vScrollBar.Value + difference; + } + } + + if (_hScrollBar.Visible) + { + // Scroll left + if (pos.X < ClientRectangle.Left) + { + var difference = (pos.X - ClientRectangle.Left) * -1; + + if (difference > ItemHeight) + difference = ItemHeight; + + _hScrollBar.Value = _hScrollBar.Value - difference; + } + + // Scroll right + if (pos.X > ClientRectangle.Right) + { + var difference = pos.X - ClientRectangle.Right; + + if (difference > ItemHeight) + difference = ItemHeight; + + _hScrollBar.Value = _hScrollBar.Value + difference; + } + } + } + + #endregion + + #region Method Region + + private void HookNodeEvents(DarkTreeNode node) + { + node.Nodes.ItemsAdded += ChildNodes_ItemsAdded; + node.Nodes.ItemsRemoved += ChildNodes_ItemsRemoved; + + node.TextChanged += Nodes_TextChanged; + node.NodeExpanded += Nodes_NodeExpanded; + node.NodeCollapsed += Nodes_NodeCollapsed; + + foreach (var childNode in node.Nodes) + HookNodeEvents(childNode); + } + + private void UnhookNodeEvents(DarkTreeNode node) + { + node.Nodes.ItemsAdded -= ChildNodes_ItemsAdded; + node.Nodes.ItemsRemoved -= ChildNodes_ItemsRemoved; + + node.TextChanged -= Nodes_TextChanged; + node.NodeExpanded -= Nodes_NodeExpanded; + node.NodeCollapsed -= Nodes_NodeCollapsed; + + foreach (var childNode in node.Nodes) + UnhookNodeEvents(childNode); + } + + private void UpdateNodes() + { + if (IsDragging) + return; + + if (Nodes.Count == 0) + return; + + var yOffset = 0; + var isOdd = false; + var index = 0; + DarkTreeNode prevNode = null; + + ContentSize = new Size(0, 0); + + for (var i = 0; i <= Nodes.Count - 1; i++) + { + var node = Nodes[i]; + UpdateNode(node, ref prevNode, 0, ref yOffset, ref isOdd, ref index); + } + + ContentSize = new Size(ContentSize.Width, yOffset); + + VisibleNodeCount = index; + + Invalidate(); + } + + private void UpdateNode(DarkTreeNode node, ref DarkTreeNode prevNode, int indent, ref int yOffset, + ref bool isOdd, ref int index) + { + UpdateNodeBounds(node, yOffset, indent); + + yOffset += ItemHeight; + + node.Odd = isOdd; + isOdd = !isOdd; + + node.VisibleIndex = index; + index++; + + node.PrevVisibleNode = prevNode; + + if (prevNode != null) + prevNode.NextVisibleNode = node; + + prevNode = node; + + if (node.Expanded) + { + foreach (var childNode in node.Nodes) + UpdateNode(childNode, ref prevNode, indent + Indent, ref yOffset, ref isOdd, ref index); + } + } + + private void UpdateNodeBounds(DarkTreeNode node, int yOffset, int indent) + { + var expandTop = yOffset + (ItemHeight / 2) - (_expandAreaSize / 2); + node.ExpandArea = new Rectangle(indent + 3, expandTop, _expandAreaSize, _expandAreaSize); + + var iconTop = yOffset + (ItemHeight / 2) - (_iconSize / 2); + + if (ShowIcons) + node.IconArea = new Rectangle(node.ExpandArea.Right + 2, iconTop, _iconSize, _iconSize); + else + node.IconArea = new Rectangle(node.ExpandArea.Right, iconTop, 0, 0); + + using (var g = CreateGraphics()) + { + var textSize = (int)(g.MeasureString(node.Text, Font).Width); + node.TextArea = new Rectangle(node.IconArea.Right + 2, yOffset, textSize + 1, ItemHeight); + } + + node.FullArea = new Rectangle(indent, yOffset, (node.TextArea.Right - indent), ItemHeight); + + if (ContentSize.Width < node.TextArea.Right + 2) + ContentSize = new Size(node.TextArea.Right + 2, ContentSize.Height); + } + + private void LoadIcons() + { + DisposeIcons(); + + _nodeClosed = TreeViewIcons.node_closed_empty.SetColor(Colors.LightText); + _nodeClosedHover = TreeViewIcons.node_closed_empty.SetColor(Colors.BlueHighlight); + _nodeClosedHoverSelected = TreeViewIcons.node_closed_full.SetColor(Colors.LightText); + _nodeOpen = TreeViewIcons.node_open.SetColor(Colors.LightText); + _nodeOpenHover = TreeViewIcons.node_open.SetColor(Colors.BlueHighlight); + _nodeOpenHoverSelected = TreeViewIcons.node_open_empty.SetColor(Colors.LightText); + } + + private void DisposeIcons() + { + if (_nodeClosed != null) + _nodeClosed.Dispose(); + + if (_nodeClosedHover != null) + _nodeClosedHover.Dispose(); + + if (_nodeClosedHoverSelected != null) + _nodeClosedHoverSelected.Dispose(); + + if (_nodeOpen != null) + _nodeOpen.Dispose(); + + if (_nodeOpenHover != null) + _nodeOpenHover.Dispose(); + + if (_nodeOpenHoverSelected != null) + _nodeOpenHoverSelected.Dispose(); + } + + private void CheckHover() + { + if (!ClientRectangle.Contains(PointToClient(MousePosition))) + { + if (IsDragging) + { + if (_dropNode != null) + { + _dropNode = null; + Invalidate(); + } + } + + return; + } + + foreach (var node in Nodes) + CheckNodeHover(node, OffsetMousePosition); + } + + private void NodeMouseLeave(DarkTreeNode node) + { + node.ExpandAreaHot = false; + + foreach (var childNode in node.Nodes) + NodeMouseLeave(childNode); + + Invalidate(); + } + + private void CheckNodeHover(DarkTreeNode node, Point location) + { + if (IsDragging) + { + var rect = GetNodeFullRowArea(node); + if (rect.Contains(OffsetMousePosition)) + { + var newDropNode = _dragNodes.Contains(node) ? null : node; + + if (_dropNode != newDropNode) + { + _dropNode = newDropNode; + Invalidate(); + } + } + } + else + { + var hot = node.ExpandArea.Contains(location); + if (node.ExpandAreaHot != hot) + { + node.ExpandAreaHot = hot; + Invalidate(); + } + } + + foreach (var childNode in node.Nodes) + CheckNodeHover(childNode, location); + } + + private void CheckNodeClick(DarkTreeNode node, Point location, MouseButtons button) + { + var rect = GetNodeFullRowArea(node); + if (rect.Contains(location)) + { + if (node.ExpandArea.Contains(location)) + { + if (button == MouseButtons.Left) + node.Expanded = !node.Expanded; + } + else + { + if (button == MouseButtons.Left) + { + if (MultiSelect && ModifierKeys == Keys.Shift) + { + SelectAnchoredRange(node); + } + else if (MultiSelect && ModifierKeys == Keys.Control) + { + ToggleNode(node); + } + else + { + if (!SelectedNodes.Contains(node)) + SelectNode(node); + + _dragPos = OffsetMousePosition; + _provisionalDragging = true; + _provisionalNode = node; + } + + return; + } + else if (button == MouseButtons.Right) + { + if (MultiSelect && ModifierKeys == Keys.Shift) + return; + + if (MultiSelect && ModifierKeys == Keys.Control) + return; + + if (!SelectedNodes.Contains(node)) + SelectNode(node); + + return; + } + } + } + + if (node.Expanded) + { + foreach (var childNode in node.Nodes) + CheckNodeClick(childNode, location, button); + } + } + + private void CheckNodeDoubleClick(DarkTreeNode node, Point location) + { + var rect = GetNodeFullRowArea(node); + if (rect.Contains(location)) + { + if (!node.ExpandArea.Contains(location)) + node.Expanded = !node.Expanded; + + return; + } + + if (node.Expanded) + { + foreach (var childNode in node.Nodes) + CheckNodeDoubleClick(childNode, location); + } + } + + public void SelectNode(DarkTreeNode node) + { + _selectedNodes.Clear(); + _selectedNodes.Add(node); + + _anchoredNodeStart = node; + _anchoredNodeEnd = node; + + Invalidate(); + } + + public void SelectNodes(DarkTreeNode startNode, DarkTreeNode endNode) + { + var nodes = new List(); + + if (startNode == endNode) + nodes.Add(startNode); + + if (startNode.VisibleIndex < endNode.VisibleIndex) + { + var node = startNode; + nodes.Add(node); + while (node != endNode && node != null) + { + node = node.NextVisibleNode; + nodes.Add(node); + } + } + else if (startNode.VisibleIndex > endNode.VisibleIndex) + { + var node = startNode; + nodes.Add(node); + while (node != endNode && node != null) + { + node = node.PrevVisibleNode; + nodes.Add(node); + } + } + + SelectNodes(nodes, false); + } + + public void SelectNodes(List nodes, bool updateAnchors = true) + { + _selectedNodes.Clear(); + + foreach (var node in nodes) + _selectedNodes.Add(node); + + if (updateAnchors && _selectedNodes.Count > 0) + { + _anchoredNodeStart = _selectedNodes[_selectedNodes.Count - 1]; + _anchoredNodeEnd = _selectedNodes[_selectedNodes.Count - 1]; + } + + Invalidate(); + } + + private void SelectAnchoredRange(DarkTreeNode node) + { + _anchoredNodeEnd = node; + SelectNodes(_anchoredNodeStart, _anchoredNodeEnd); + } + + public void ToggleNode(DarkTreeNode node) + { + if (_selectedNodes.Contains(node)) + { + _selectedNodes.Remove(node); + + // If we just removed both the anchor start AND end then reset them + if (_anchoredNodeStart == node && _anchoredNodeEnd == node) + { + if (_selectedNodes.Count > 0) + { + _anchoredNodeStart = _selectedNodes[0]; + _anchoredNodeEnd = _selectedNodes[0]; + } + else + { + _anchoredNodeStart = null; + _anchoredNodeEnd = null; + } + } + + // If we just removed the anchor start then update it accordingly + if (_anchoredNodeStart == node) + { + if (_anchoredNodeEnd.VisibleIndex < node.VisibleIndex) + _anchoredNodeStart = node.PrevVisibleNode; + else if (_anchoredNodeEnd.VisibleIndex > node.VisibleIndex) + _anchoredNodeStart = node.NextVisibleNode; + else + _anchoredNodeStart = _anchoredNodeEnd; + } + + // If we just removed the anchor end then update it accordingly + if (_anchoredNodeEnd == node) + { + if (_anchoredNodeStart.VisibleIndex < node.VisibleIndex) + _anchoredNodeEnd = node.PrevVisibleNode; + else if (_anchoredNodeStart.VisibleIndex > node.VisibleIndex) + _anchoredNodeEnd = node.NextVisibleNode; + else + _anchoredNodeEnd = _anchoredNodeStart; + } + } + else + { + _selectedNodes.Add(node); + + _anchoredNodeStart = node; + _anchoredNodeEnd = node; + } + + Invalidate(); + } + + public Rectangle GetNodeFullRowArea(DarkTreeNode node) + { + if (node.ParentNode != null && !node.ParentNode.Expanded) + return new Rectangle(-1, -1, -1, -1); + + var width = Math.Max(ContentSize.Width, Viewport.Width); + var rect = new Rectangle(0, node.FullArea.Top, width, ItemHeight); + return rect; + } + + public void EnsureVisible() + { + if (SelectedNodes.Count == 0) + return; + + foreach (var node in SelectedNodes) + node.EnsureVisible(); + + var itemTop = -1; + + if (!MultiSelect) + itemTop = SelectedNodes[0].FullArea.Top; + else + itemTop = _anchoredNodeEnd.FullArea.Top; + + var itemBottom = itemTop + ItemHeight; + + if (itemTop < Viewport.Top) + VScrollTo(itemTop); + + if (itemBottom > Viewport.Bottom) + VScrollTo((itemBottom - Viewport.Height)); + } + + public void Sort() + { + if (TreeViewNodeSorter == null) + return; + + Nodes.Sort(TreeViewNodeSorter); + + foreach (var node in Nodes) + SortChildNodes(node); + } + + private void SortChildNodes(DarkTreeNode node) + { + node.Nodes.Sort(TreeViewNodeSorter); + + foreach (var childNode in node.Nodes) + SortChildNodes(childNode); + } + + public DarkTreeNode FindNode(string path) + { + foreach (var node in Nodes) + { + var compNode = FindNode(node, path); + if (compNode != null) + return compNode; + } + + return null; + } + + private DarkTreeNode FindNode(DarkTreeNode parentNode, string path, bool recursive = true) + { + if (parentNode.FullPath == path) + return parentNode; + + foreach (var node in parentNode.Nodes) + { + if (node.FullPath == path) + return node; + + if (recursive) + { + var compNode = FindNode(node, path); + if (compNode != null) + return compNode; + } + } + + return null; + } + + #endregion + + #region Drag & Drop Region + + protected override void StartDrag() + { + if (!AllowMoveNodes) + { + _provisionalDragging = false; + return; + } + + // Create initial list of nodes to drag + _dragNodes = new List(); + foreach (var node in SelectedNodes) + _dragNodes.Add(node); + + // Clear out any nodes with a parent that is being dragged + foreach (var node in _dragNodes.ToList()) + { + if (node.ParentNode == null) + continue; + + if (_dragNodes.Contains(node.ParentNode)) + _dragNodes.Remove(node); + } + + _provisionalDragging = false; + + Cursor = Cursors.SizeAll; + + base.StartDrag(); + } + + private void HandleDrag() + { + if (!AllowMoveNodes) + return; + + var dropNode = _dropNode; + + if (dropNode == null) + { + if (Cursor != Cursors.No) + Cursor = Cursors.No; + + return; + } + + if (ForceDropToParent(dropNode)) + dropNode = dropNode.ParentNode; + + if (!CanMoveNodes(_dragNodes, dropNode)) + { + if (Cursor != Cursors.No) + Cursor = Cursors.No; + + return; + } + + if (Cursor != Cursors.SizeAll) + Cursor = Cursors.SizeAll; + } + + private void HandleDrop() + { + if (!AllowMoveNodes) + return; + + var dropNode = _dropNode; + + if (dropNode == null) + { + StopDrag(); + return; + } + + if (ForceDropToParent(dropNode)) + dropNode = dropNode.ParentNode; + + if (CanMoveNodes(_dragNodes, dropNode, true)) + { + var cachedSelectedNodes = SelectedNodes.ToList(); + + MoveNodes(_dragNodes, dropNode); + + foreach (var node in _dragNodes) + { + if (node.ParentNode == null) + Nodes.Remove(node); + else + node.ParentNode.Nodes.Remove(node); + + dropNode.Nodes.Add(node); + } + + if (TreeViewNodeSorter != null) + dropNode.Nodes.Sort(TreeViewNodeSorter); + + dropNode.Expanded = true; + + NodesMoved(_dragNodes); + + foreach (var node in cachedSelectedNodes) + _selectedNodes.Add(node); + } + + StopDrag(); + UpdateNodes(); + } + + protected override void StopDrag() + { + _dragNodes = null; + _dropNode = null; + + Cursor = Cursors.Default; + + Invalidate(); + + base.StopDrag(); + } + + protected virtual bool ForceDropToParent(DarkTreeNode node) + { + return false; + } + + protected virtual bool CanMoveNodes(List dragNodes, DarkTreeNode dropNode, bool isMoving = false) + { + if (dropNode == null) + return false; + + foreach (var node in dragNodes) + { + if (node == dropNode) + { + if (isMoving) + DarkMessageBox.ShowError($"Cannot move {node.Text}. The destination folder is the same as the source folder.", Application.ProductName); + + return false; + } + + if (node.ParentNode != null && node.ParentNode == dropNode) + { + if (isMoving) + DarkMessageBox.ShowError($"Cannot move {node.Text}. The destination folder is the same as the source folder.", Application.ProductName); + + return false; + } + + var parentNode = dropNode.ParentNode; + while (parentNode != null) + { + if (node == parentNode) + { + if (isMoving) + DarkMessageBox.ShowError($"Cannot move {node.Text}. The destination folder is a subfolder of the source folder.", Application.ProductName); + + return false; + } + + parentNode = parentNode.ParentNode; + } + } + + return true; + } + + protected virtual void MoveNodes(List dragNodes, DarkTreeNode dropNode) + { } + + protected virtual void NodesMoved(List nodesMoved) + { } + + #endregion + + #region Paint Region + + protected override void PaintContent(Graphics g) + { + foreach (var node in Nodes) + { + DrawNode(node, g); + } + } + + private void DrawNode(DarkTreeNode node, Graphics g) + { + var rect = GetNodeFullRowArea(node); + + // 1. Draw background + var bgColor = node.Odd ? Colors.HeaderBackground : Colors.GreyBackground; + + if (SelectedNodes.Count > 0 && SelectedNodes.Contains(node)) + bgColor = Focused ? Colors.BlueSelection : Colors.GreySelection; + + if (IsDragging && _dropNode == node) + bgColor = Focused ? Colors.BlueSelection : Colors.GreySelection; + + using (var b = new SolidBrush(bgColor)) + { + g.FillRectangle(b, rect); + } + + // 2. Draw plus/minus icon + if (node.Nodes.Count > 0) + { + var pos = new Point(node.ExpandArea.Location.X - 1, node.ExpandArea.Location.Y - 1); + + var icon = _nodeOpen; + + if (node.Expanded && !node.ExpandAreaHot) + icon = _nodeOpen; + else if (node.Expanded && node.ExpandAreaHot && !SelectedNodes.Contains(node)) + icon = _nodeOpenHover; + else if (node.Expanded && node.ExpandAreaHot && SelectedNodes.Contains(node)) + icon = _nodeOpenHoverSelected; + else if (!node.Expanded && !node.ExpandAreaHot) + icon = _nodeClosed; + else if (!node.Expanded && node.ExpandAreaHot && !SelectedNodes.Contains(node)) + icon = _nodeClosedHover; + else if (!node.Expanded && node.ExpandAreaHot && SelectedNodes.Contains(node)) + icon = _nodeClosedHoverSelected; + + g.DrawImageUnscaled(icon, pos); + } + + // 3. Draw icon + if (ShowIcons && node.Icon != null) + { + if (node.Expanded && node.ExpandedIcon != null) + g.DrawImageUnscaled(node.ExpandedIcon, node.IconArea.Location); + else + g.DrawImageUnscaled(node.Icon, node.IconArea.Location); + } + + // 4. Draw text + using (var b = new SolidBrush(Colors.LightText)) + { + var stringFormat = new StringFormat + { + Alignment = StringAlignment.Near, + LineAlignment = StringAlignment.Center + }; + + g.DrawString(node.Text, Font, b, node.TextArea, stringFormat); + } + + // 5. Draw child nodes + if (node.Expanded) + { + foreach (var childNode in node.Nodes) + DrawNode(childNode, g); + } + } + + #endregion + } +} diff --git a/DarkUI/Controls/ScrollValueEventArgs.cs b/DarkUI/Controls/ScrollValueEventArgs.cs new file mode 100644 index 0000000..6e9b784 --- /dev/null +++ b/DarkUI/Controls/ScrollValueEventArgs.cs @@ -0,0 +1,14 @@ +using System; + +namespace DarkUI.Controls +{ + public class ScrollValueEventArgs : EventArgs + { + public int Value { get; private set; } + + public ScrollValueEventArgs(int value) + { + Value = value; + } + } +} diff --git a/DarkUI/DarkUI.csproj b/DarkUI/DarkUI.csproj new file mode 100644 index 0000000..6f4914b --- /dev/null +++ b/DarkUI/DarkUI.csproj @@ -0,0 +1,303 @@ + + + + + Debug + AnyCPU + {F19472F5-8C44-4C51-A8A0-B9DE5F555255} + Library + Properties + DarkUI + DarkUI + v4.0 + 512 + Client + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Component + + + + + Component + + + + Component + + + Component + + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + + + + UserControl + + + Component + + + UserControl + + + Component + + + UserControl + + + + UserControl + + + + + + + + + + + + + + + Form + + + DarkDialog.cs + + + + Form + + + Form + + + DarkMessageBox.cs + + + + Form + + + True + True + DockIcons.resx + + + True + True + MenuIcons.resx + + + True + True + MessageBoxIcons.resx + + + True + True + ScrollIcons.resx + + + True + True + TreeViewIcons.resx + + + + + + + + + + + + + DarkDialog.cs + + + DarkMessageBox.cs + + + ResXFileCodeGenerator + DockIcons.Designer.cs + DarkUI + + + PublicResXFileCodeGenerator + MenuIcons.Designer.cs + DarkUI + + + ResXFileCodeGenerator + MessageBoxIcons.Designer.cs + DarkUI + + + ResXFileCodeGenerator + ScrollIcons.Designer.cs + DarkUI + + + ResXFileCodeGenerator + TreeViewIcons.Designer.cs + DarkUI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DarkUI/Docking/DarkDockArea.cs b/DarkUI/Docking/DarkDockArea.cs new file mode 100644 index 0000000..31878b8 --- /dev/null +++ b/DarkUI/Docking/DarkDockArea.cs @@ -0,0 +1,11 @@ +namespace DarkUI.Docking +{ + public enum DarkDockArea + { + None, + Document, + Left, + Right, + Bottom + } +} diff --git a/DarkUI/Docking/DarkDockContent.cs b/DarkUI/Docking/DarkDockContent.cs new file mode 100644 index 0000000..1ee2a09 --- /dev/null +++ b/DarkUI/Docking/DarkDockContent.cs @@ -0,0 +1,118 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Docking +{ + [ToolboxItem(false)] + public class DarkDockContent : UserControl + { + #region Event Handler Region + + public event EventHandler DockTextChanged; + + #endregion + + #region Field Region + + private string _dockText; + private Image _icon; + + #endregion + + #region Property Region + + [Category("Appearance")] + [Description("Determines the text that will appear in the content tabs and headers.")] + public string DockText + { + get { return _dockText; } + set + { + var oldText = _dockText; + + _dockText = value; + + if (DockTextChanged != null) + DockTextChanged(this, null); + + Invalidate(); + } + } + + [Category("Appearance")] + [Description("Determines the icon that will appear in the content tabs and headers.")] + public Image Icon + { + get { return _icon; } + set + { + _icon = value; + Invalidate(); + } + } + + [Category("Layout")] + [Description("Determines the default area of the dock panel this content will be added to.")] + [DefaultValue(DarkDockArea.Document)] + public DarkDockArea DefaultDockArea { get; set; } + + [Category("Behavior")] + [Description("Determines the key used by this content in the dock serialization.")] + public string SerializationKey { get; set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockPanel DockPanel { get; internal set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockRegion DockRegion { get; internal set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockGroup DockGroup { get; internal set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockArea DockArea { get; set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int Order { get; set; } + + #endregion + + #region Constructor Region + + public DarkDockContent() + { } + + #endregion + + #region Method Region + + public virtual void Close() + { + if (DockPanel != null) + DockPanel.RemoveContent(this); + } + + #endregion + + #region Event Handler Region + + protected override void OnEnter(EventArgs e) + { + base.OnEnter(e); + + if (DockPanel == null) + return; + + DockPanel.ActiveContent = this; + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkDockGroup.cs b/DarkUI/Docking/DarkDockGroup.cs new file mode 100644 index 0000000..1d48689 --- /dev/null +++ b/DarkUI/Docking/DarkDockGroup.cs @@ -0,0 +1,796 @@ +using DarkUI.Config; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace DarkUI.Docking +{ + [ToolboxItem(false)] + public class DarkDockGroup : Panel + { + #region Field Region + + private List _contents = new List(); + + private Dictionary _tabs = new Dictionary(); + + private DarkDockTabArea _tabArea; + + private DarkDockTab _dragTab = null; + + #endregion + + #region Property Region + + public DarkDockPanel DockPanel { get; private set; } + + public DarkDockRegion DockRegion { get; private set; } + + public DarkDockArea DockArea { get; private set; } + + public DarkDockContent VisibleContent { get; private set; } + + public int Order { get; set; } + + public int ContentCount { get { return _contents.Count; } } + + #endregion + + #region Constructor Region + + public DarkDockGroup(DarkDockPanel dockPanel, DarkDockRegion dockRegion, int order) + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + + DockPanel = dockPanel; + DockRegion = dockRegion; + DockArea = dockRegion.DockArea; + + Order = order; + + _tabArea = new DarkDockTabArea(DockArea); + + DockPanel.ActiveContentChanged += DockPanel_ActiveContentChanged; + } + + #endregion + + #region Method Region + + public void AddContent(DarkDockContent dockContent) + { + dockContent.DockGroup = this; + dockContent.Dock = DockStyle.Fill; + + dockContent.Order = 0; + + if (_contents.Count > 0) + { + var order = -1; + foreach (var otherContent in _contents) + { + if (otherContent.Order >= order) + order = otherContent.Order + 1; + } + + dockContent.Order = order; + } + + _contents.Add(dockContent); + Controls.Add(dockContent); + + dockContent.DockTextChanged += DockContent_DockTextChanged; + + _tabs.Add(dockContent, new DarkDockTab(dockContent)); + + if (VisibleContent == null) + { + dockContent.Visible = true; + VisibleContent = dockContent; + } + else + { + dockContent.Visible = false; + } + + var menuItem = new ToolStripMenuItem(dockContent.DockText); + menuItem.Tag = dockContent; + menuItem.Click += TabMenuItem_Select; + menuItem.Image = dockContent.Icon; + _tabArea.AddMenuItem(menuItem); + + UpdateTabArea(); + } + + public void RemoveContent(DarkDockContent dockContent) + { + dockContent.DockGroup = null; + + var order = dockContent.Order; + + _contents.Remove(dockContent); + Controls.Remove(dockContent); + + foreach (var otherContent in _contents) + { + if (otherContent.Order > order) + otherContent.Order--; + } + + dockContent.DockTextChanged -= DockContent_DockTextChanged; + + if (_tabs.ContainsKey(dockContent)) + _tabs.Remove(dockContent); + + if (VisibleContent == dockContent) + { + VisibleContent = null; + + if (_contents.Count > 0) + { + var newContent = _contents[0]; + newContent.Visible = true; + VisibleContent = newContent; + } + } + + var menuItem = _tabArea.GetMenuItem(dockContent); + + menuItem.Click -= TabMenuItem_Select; + _tabArea.RemoveMenuItem(menuItem); + + UpdateTabArea(); + } + + public List GetContents() + { + return _contents.OrderBy(c => c.Order).ToList(); + } + + private void UpdateTabArea() + { + if (DockArea == DarkDockArea.Document) + _tabArea.Visible = (_contents.Count > 0); + else + _tabArea.Visible = (_contents.Count > 1); + + var size = 0; + + switch (DockArea) + { + case DarkDockArea.Document: + size = _tabArea.Visible ? Consts.DocumentTabAreaSize : 0; + Padding = new Padding(0, size, 0, 0); + _tabArea.ClientRectangle = new Rectangle(Padding.Left, 0, ClientRectangle.Width - Padding.Horizontal, size); + break; + case DarkDockArea.Left: + case DarkDockArea.Right: + size = _tabArea.Visible ? Consts.ToolWindowTabAreaSize : 0; + Padding = new Padding(0, 0, 0, size); + _tabArea.ClientRectangle = new Rectangle(Padding.Left, ClientRectangle.Bottom - size, ClientRectangle.Width - Padding.Horizontal, size); + break; + case DarkDockArea.Bottom: + size = _tabArea.Visible ? Consts.ToolWindowTabAreaSize : 0; + Padding = new Padding(1, 0, 0, size); + _tabArea.ClientRectangle = new Rectangle(Padding.Left, ClientRectangle.Bottom - size, ClientRectangle.Width - Padding.Horizontal, size); + break; + } + + if (DockArea == DarkDockArea.Document) + { + var dropdownSize = Consts.DocumentTabAreaSize; + _tabArea.DropdownRectangle = new Rectangle(_tabArea.ClientRectangle.Right - dropdownSize, 0, dropdownSize, dropdownSize); + } + + BuildTabs(); + + EnsureVisible(); + } + + private void BuildTabs() + { + if (!_tabArea.Visible) + return; + + SuspendLayout(); + + var closeButtonSize = DockIcons.close.Width; + + // Calculate areas of all tabs + var totalSize = 0; + + var orderedContent = _contents.OrderBy(c => c.Order); + + foreach (var content in orderedContent) + { + int width; + + var tab = _tabs[content]; + + using (var g = CreateGraphics()) + { + width = tab.CalculateWidth(g, Font); + } + + // Add additional width for document tab items + if (DockArea == DarkDockArea.Document) + { + width += 5; + width += closeButtonSize; + + if (tab.DockContent.Icon != null) + width += tab.DockContent.Icon.Width + 5; + } + + // Show separator on all tabs for now + tab.ShowSeparator = true; + width += 1; + + var y = DockArea == DarkDockArea.Document ? 0 : ClientRectangle.Height - Consts.ToolWindowTabAreaSize; + var height = DockArea == DarkDockArea.Document ? Consts.DocumentTabAreaSize : Consts.ToolWindowTabAreaSize; + + var tabRect = new Rectangle(_tabArea.ClientRectangle.Left + totalSize, y, width, height); + tab.ClientRectangle = tabRect; + + totalSize += width; + } + + // Cap the size if too large for the tab area + if (DockArea != DarkDockArea.Document) + { + if (totalSize > _tabArea.ClientRectangle.Width) + { + var difference = totalSize - _tabArea.ClientRectangle.Width; + + // No matter what, we want to slice off the 1 pixel separator from the final tab. + var lastTab = _tabs[orderedContent.Last()]; + var tabRect = lastTab.ClientRectangle; + lastTab.ClientRectangle = new Rectangle(tabRect.Left, tabRect.Top, tabRect.Width - 1, tabRect.Height); + lastTab.ShowSeparator = false; + + var differenceMadeUp = 1; + + // Loop through and progressively resize the larger tabs until the total size fits within the tab area. + while (differenceMadeUp < difference) + { + var largest = _tabs.Values.OrderByDescending(tab => tab.ClientRectangle.Width) + .First() + .ClientRectangle.Width; + + foreach (var content in orderedContent) + { + var tab = _tabs[content]; + + // Check if previous iteration of loop met the difference + if (differenceMadeUp >= difference) + break; + + if (tab.ClientRectangle.Width >= largest) + { + var rect = tab.ClientRectangle; + tab.ClientRectangle = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height); + differenceMadeUp += 1; + } + } + } + + // After resizing the tabs reposition them accordingly. + var xOffset = 0; + foreach (var content in orderedContent) + { + var tab = _tabs[content]; + + var rect = tab.ClientRectangle; + tab.ClientRectangle = new Rectangle(_tabArea.ClientRectangle.Left + xOffset, rect.Top, rect.Width, rect.Height); + + xOffset += rect.Width; + } + } + } + + // Build close button rectangles + if (DockArea == DarkDockArea.Document) + { + foreach (var content in orderedContent) + { + var tab = _tabs[content]; + var closeRect = new Rectangle(tab.ClientRectangle.Right - 7 - closeButtonSize - 1, + tab.ClientRectangle.Top + (tab.ClientRectangle.Height / 2) - (closeButtonSize / 2) - 1, + closeButtonSize, closeButtonSize); + tab.CloseButtonRectangle = closeRect; + } + } + + // Update the tab area with the new total tab width + totalSize = 0; + foreach (var content in orderedContent) + { + var tab = _tabs[content]; + totalSize += tab.ClientRectangle.Width; + } + + _tabArea.TotalTabSize = totalSize; + + ResumeLayout(); + + Invalidate(); + } + + public void EnsureVisible() + { + if (DockArea != DarkDockArea.Document) + return; + + if (VisibleContent == null) + return; + + var width = ClientRectangle.Width - Padding.Horizontal - _tabArea.DropdownRectangle.Width; + var offsetArea = new Rectangle(Padding.Left, 0, width, 0); + + var tab = _tabs[VisibleContent]; + + if (tab.ClientRectangle.IsEmpty) + return; + + if (RectangleToTabArea(tab.ClientRectangle).Left < offsetArea.Left) + _tabArea.Offset = tab.ClientRectangle.Left; + else if (RectangleToTabArea(tab.ClientRectangle).Right > offsetArea.Right) + _tabArea.Offset = tab.ClientRectangle.Right - width; + + if (_tabArea.TotalTabSize < offsetArea.Width) + _tabArea.Offset = 0; + + if (_tabArea.TotalTabSize > offsetArea.Width) + { + var orderedContent = _contents.OrderBy(x => x.Order); + var lastTab = _tabs[orderedContent.Last()]; + if (lastTab != null) + { + if (RectangleToTabArea(lastTab.ClientRectangle).Right < offsetArea.Right) + _tabArea.Offset = lastTab.ClientRectangle.Right - width; + } + } + + Invalidate(); + } + + public void SetVisibleContent(DarkDockContent content) + { + if (!_contents.Contains(content)) + return; + + if (VisibleContent != content) + { + VisibleContent = content; + content.Visible = true; + + foreach (var otherContent in _contents) + { + if (otherContent != content) + otherContent.Visible = false; + } + + Invalidate(); + } + } + + private Point PointToTabArea(Point point) + { + return new Point(point.X - _tabArea.Offset, point.Y); + } + + private Rectangle RectangleToTabArea(Rectangle rectangle) + { + return new Rectangle(PointToTabArea(rectangle.Location), rectangle.Size); + } + + #endregion + + #region Event Handler Region + + protected override void OnResize(EventArgs eventargs) + { + base.OnResize(eventargs); + + UpdateTabArea(); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (_dragTab != null) + { + var offsetX = e.Location.X + _tabArea.Offset; + if (offsetX < _dragTab.ClientRectangle.Left) + { + if (_dragTab.DockContent.Order > 0) + { + var otherTabs = _tabs.Values.Where(t => t.DockContent.Order == _dragTab.DockContent.Order - 1).ToList(); + if (otherTabs.Count == 0) + return; + + var otherTab = otherTabs.First(); + + if (otherTab == null) + return; + + var oldIndex = _dragTab.DockContent.Order; + _dragTab.DockContent.Order = oldIndex - 1; + otherTab.DockContent.Order = oldIndex; + + BuildTabs(); + EnsureVisible(); + + _tabArea.RebuildMenu(); + + return; + } + } + else if (offsetX > _dragTab.ClientRectangle.Right) + { + var maxOrder = _contents.Count; + + if (_dragTab.DockContent.Order < maxOrder) + { + var otherTabs = _tabs.Values.Where(t => t.DockContent.Order == _dragTab.DockContent.Order + 1).ToList(); + if(otherTabs.Count == 0) + return; + + var otherTab = otherTabs.First(); + + if (otherTab == null) + return; + + var oldIndex = _dragTab.DockContent.Order; + _dragTab.DockContent.Order = oldIndex + 1; + otherTab.DockContent.Order = oldIndex; + + BuildTabs(); + EnsureVisible(); + + _tabArea.RebuildMenu(); + + return; + } + } + + return; + } + + if (_tabArea.DropdownRectangle.Contains(e.Location)) + { + _tabArea.DropdownHot = true; + + foreach (var tab in _tabs.Values) + tab.Hot = false; + + Invalidate(); + return; + } + + _tabArea.DropdownHot = false; + + foreach (var tab in _tabs.Values) + { + var rect = RectangleToTabArea(tab.ClientRectangle); + var hot = rect.Contains(e.Location); + + if (tab.Hot != hot) + { + tab.Hot = hot; + Invalidate(); + } + + var closeRect = RectangleToTabArea(tab.CloseButtonRectangle); + var closeHot = closeRect.Contains(e.Location); + + if (tab.CloseButtonHot != closeHot) + { + tab.CloseButtonHot = closeHot; + Invalidate(); + } + } + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (_tabArea.DropdownRectangle.Contains(e.Location)) + { + _tabArea.DropdownHot = true; + return; + } + + foreach (var tab in _tabs.Values) + { + var rect = RectangleToTabArea(tab.ClientRectangle); + if (rect.Contains(e.Location)) + { + if (e.Button == MouseButtons.Middle) + { + tab.DockContent.Close(); + return; + } + + var closeRect = RectangleToTabArea(tab.CloseButtonRectangle); + if (closeRect.Contains(e.Location)) + { + _tabArea.ClickedCloseButton = tab; + return; + } + else + { + DockPanel.ActiveContent = tab.DockContent; + EnsureVisible(); + + _dragTab = tab; + + return; + } + } + } + + if (VisibleContent != null) + DockPanel.ActiveContent = VisibleContent; + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + _dragTab = null; + + if (_tabArea.DropdownRectangle.Contains(e.Location)) + { + if (_tabArea.DropdownHot) + _tabArea.ShowMenu(this, new Point(_tabArea.DropdownRectangle.Left, _tabArea.DropdownRectangle.Bottom - 2)); + + return; + } + + if (_tabArea.ClickedCloseButton == null) + return; + + var closeRect = RectangleToTabArea(_tabArea.ClickedCloseButton.CloseButtonRectangle); + if (closeRect.Contains(e.Location)) + _tabArea.ClickedCloseButton.DockContent.Close(); + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + foreach (var tab in _tabs.Values) + tab.Hot = false; + + Invalidate(); + } + + private void TabMenuItem_Select(object sender, EventArgs e) + { + var menuItem = sender as ToolStripMenuItem; + if (menuItem == null) + return; + + var content = menuItem.Tag as DarkDockContent; + if (content == null) + return; + + DockPanel.ActiveContent = content; + } + + private void DockPanel_ActiveContentChanged(object sender, DockContentEventArgs e) + { + if (!_contents.Contains(e.Content)) + return; + + if (e.Content == VisibleContent) + { + VisibleContent.Focus(); + return; + } + + VisibleContent = e.Content; + + foreach (var content in _contents) + content.Visible = content == VisibleContent; + + VisibleContent.Focus(); + + EnsureVisible(); + Invalidate(); + } + + private void DockContent_DockTextChanged(object sender, EventArgs e) + { + BuildTabs(); + } + + #endregion + + #region Render Region + + public void Redraw() + { + Invalidate(); + + foreach (var content in _contents) + content.Invalidate(); + } + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, ClientRectangle); + } + + if (!_tabArea.Visible) + return; + + using (var b = new SolidBrush(Colors.MediumBackground)) + { + g.FillRectangle(b, _tabArea.ClientRectangle); + } + + foreach (var tab in _tabs.Values) + { + if (DockArea == DarkDockArea.Document) + PaintDocumentTab(g, tab); + else + PaintToolWindowTab(g, tab); + } + + if (DockArea == DarkDockArea.Document) + { + // Color divider + var isActiveGroup = DockPanel.ActiveGroup == this; + var divColor = isActiveGroup ? Colors.BlueSelection : Colors.GreySelection; + using (var b = new SolidBrush(divColor)) + { + var divRect = new Rectangle(_tabArea.ClientRectangle.Left, _tabArea.ClientRectangle.Bottom - 2, _tabArea.ClientRectangle.Width, 2); + g.FillRectangle(b, divRect); + } + + // Content dropdown list + var dropdownRect = new Rectangle(_tabArea.DropdownRectangle.Left, _tabArea.DropdownRectangle.Top, _tabArea.DropdownRectangle.Width, _tabArea.DropdownRectangle.Height - 2); + + using (var b = new SolidBrush(Colors.MediumBackground)) + { + g.FillRectangle(b, dropdownRect); + } + + using (var img = DockIcons.arrow) + { + g.DrawImageUnscaled(img, dropdownRect.Left + (dropdownRect.Width / 2) - (img.Width / 2), dropdownRect.Top + (dropdownRect.Height / 2) - (img.Height / 2) + 1); + } + } + } + + private void PaintDocumentTab(Graphics g, DarkDockTab tab) + { + var tabRect = RectangleToTabArea(tab.ClientRectangle); + + var isVisibleTab = VisibleContent == tab.DockContent; + var isActiveGroup = DockPanel.ActiveGroup == this; + + var bgColor = isVisibleTab ? Colors.BlueSelection : Colors.DarkBackground; + + if (!isActiveGroup) + bgColor = isVisibleTab ? Colors.GreySelection : Colors.DarkBackground; + + if (tab.Hot && !isVisibleTab) + bgColor = Colors.MediumBackground; + + using (var b = new SolidBrush(bgColor)) + { + g.FillRectangle(b, tabRect); + } + + // Draw separators + if (tab.ShowSeparator) + { + using (var p = new Pen(Colors.DarkBorder)) + { + g.DrawLine(p, tabRect.Right - 1, tabRect.Top, tabRect.Right - 1, tabRect.Bottom); + } + } + + var xOffset = 0; + + // Draw icon + if (tab.DockContent.Icon != null) + { + g.DrawImageUnscaled(tab.DockContent.Icon, tabRect.Left + 5, tabRect.Top + 4); + xOffset += tab.DockContent.Icon.Width + 2; + } + + var tabTextFormat = new StringFormat + { + Alignment = StringAlignment.Near, + LineAlignment = StringAlignment.Center, + FormatFlags = StringFormatFlags.NoWrap, + Trimming = StringTrimming.EllipsisCharacter + }; + + // Draw text + var textColor = isVisibleTab ? Colors.LightText : Colors.DisabledText; + using (var b = new SolidBrush(textColor)) + { + var textRect = new Rectangle(tabRect.Left + 5 + xOffset, tabRect.Top, tabRect.Width - tab.CloseButtonRectangle.Width - 7 - 5 - xOffset, tabRect.Height); + g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat); + } + + // Close button + var img = tab.CloseButtonHot ? DockIcons.inactive_close_selected : DockIcons.inactive_close; + + if (isVisibleTab) + { + if (isActiveGroup) + img = tab.CloseButtonHot ? DockIcons.close_selected : DockIcons.close; + else + img = tab.CloseButtonHot ? DockIcons.close_selected : DockIcons.active_inactive_close; + } + + var closeRect = RectangleToTabArea(tab.CloseButtonRectangle); + g.DrawImageUnscaled(img, closeRect.Left, closeRect.Top); + } + + private void PaintToolWindowTab(Graphics g, DarkDockTab tab) + { + var tabRect = tab.ClientRectangle; + + var isVisibleTab = VisibleContent == tab.DockContent; + + var bgColor = isVisibleTab ? Colors.GreyBackground : Colors.DarkBackground; + + if (tab.Hot && !isVisibleTab) + bgColor = Colors.MediumBackground; + + using (var b = new SolidBrush(bgColor)) + { + g.FillRectangle(b, tabRect); + } + + // Draw separators + if (tab.ShowSeparator) + { + using (var p = new Pen(Colors.DarkBorder)) + { + g.DrawLine(p, tabRect.Right - 1, tabRect.Top, tabRect.Right - 1, tabRect.Bottom); + } + } + + var tabTextFormat = new StringFormat + { + Alignment = StringAlignment.Near, + LineAlignment = StringAlignment.Center, + FormatFlags = StringFormatFlags.NoWrap, + Trimming = StringTrimming.EllipsisCharacter + }; + + var textColor = isVisibleTab ? Colors.BlueHighlight : Colors.DisabledText; + using (var b = new SolidBrush(textColor)) + { + var textRect = new Rectangle(tabRect.Left + 5, tabRect.Top, tabRect.Width - 5, tabRect.Height); + g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat); + } + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + // Absorb event + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkDockPanel.cs b/DarkUI/Docking/DarkDockPanel.cs new file mode 100644 index 0000000..3429e65 --- /dev/null +++ b/DarkUI/Docking/DarkDockPanel.cs @@ -0,0 +1,324 @@ +using DarkUI.Config; +using DarkUI.Win32; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Windows.Forms; + +namespace DarkUI.Docking +{ + public class DarkDockPanel : UserControl + { + #region Event Region + + public event EventHandler ActiveContentChanged; + public event EventHandler ContentAdded; + public event EventHandler ContentRemoved; + + #endregion + + #region Field Region + + private List _contents; + private Dictionary _regions; + + private DarkDockContent _activeContent; + private bool _switchingContent = false; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockContent ActiveContent + { + get { return _activeContent; } + set + { + // Don't let content visibility changes re-trigger event + if (_switchingContent) + return; + + _switchingContent = true; + + _activeContent = value; + + ActiveGroup = _activeContent.DockGroup; + ActiveRegion = ActiveGroup.DockRegion; + + foreach (var region in _regions.Values) + region.Redraw(); + + if (ActiveContentChanged != null) + ActiveContentChanged(this, new DockContentEventArgs(_activeContent)); + + _switchingContent = false; + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockRegion ActiveRegion { get; internal set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockGroup ActiveGroup { get; internal set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DarkDockContent ActiveDocument + { + get + { + return _regions[DarkDockArea.Document].ActiveDocument; + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DockContentDragFilter DockContentDragFilter { get; private set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DockResizeFilter DockResizeFilter { get; private set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public List Splitters { get; private set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public MouseButtons MouseButtonState + { + get + { + var buttonState = MouseButtons; + return buttonState; + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Dictionary Regions + { + get + { + return _regions; + } + } + + #endregion + + #region Constructor Region + + public DarkDockPanel() + { + Splitters = new List(); + DockContentDragFilter = new DockContentDragFilter(this); + DockResizeFilter = new DockResizeFilter(this); + + _regions = new Dictionary(); + _contents = new List(); + + BackColor = Colors.GreyBackground; + + CreateRegions(); + } + + #endregion + + #region Method Region + + public void AddContent(DarkDockContent dockContent) + { + AddContent(dockContent, null); + } + + public void AddContent(DarkDockContent dockContent, DarkDockGroup dockGroup) + { + if (_contents.Contains(dockContent)) + RemoveContent(dockContent); + + dockContent.DockPanel = this; + _contents.Add(dockContent); + + if (dockGroup != null) + dockContent.DockArea = dockGroup.DockArea; + + if (dockContent.DockArea == DarkDockArea.None) + dockContent.DockArea = dockContent.DefaultDockArea; + + var region = _regions[dockContent.DockArea]; + region.AddContent(dockContent, dockGroup); + + if (ContentAdded != null) + ContentAdded(this, new DockContentEventArgs(dockContent)); + + dockContent.Select(); + } + + public void InsertContent(DarkDockContent dockContent, DarkDockGroup dockGroup, DockInsertType insertType) + { + if (_contents.Contains(dockContent)) + RemoveContent(dockContent); + + dockContent.DockPanel = this; + _contents.Add(dockContent); + + dockContent.DockArea = dockGroup.DockArea; + + var region = _regions[dockGroup.DockArea]; + region.InsertContent(dockContent, dockGroup, insertType); + + if (ContentAdded != null) + ContentAdded(this, new DockContentEventArgs(dockContent)); + + dockContent.Select(); + } + + public void RemoveContent(DarkDockContent dockContent) + { + if (!_contents.Contains(dockContent)) + return; + + dockContent.DockPanel = null; + _contents.Remove(dockContent); + + var region = _regions[dockContent.DockArea]; + region.RemoveContent(dockContent); + + if (ContentRemoved != null) + ContentRemoved(this, new DockContentEventArgs(dockContent)); + } + + public bool ContainsContent(DarkDockContent dockContent) + { + return _contents.Contains(dockContent); + } + + public List GetDocuments() + { + return _regions[DarkDockArea.Document].GetContents(); + } + + private void CreateRegions() + { + var documentRegion = new DarkDockRegion(this, DarkDockArea.Document); + _regions.Add(DarkDockArea.Document, documentRegion); + + var leftRegion = new DarkDockRegion(this, DarkDockArea.Left); + _regions.Add(DarkDockArea.Left, leftRegion); + + var rightRegion = new DarkDockRegion(this, DarkDockArea.Right); + _regions.Add(DarkDockArea.Right, rightRegion); + + var bottomRegion = new DarkDockRegion(this, DarkDockArea.Bottom); + _regions.Add(DarkDockArea.Bottom, bottomRegion); + + // Add the regions in this order to force the bottom region to be positioned + // between the left and right regions properly. + Controls.Add(documentRegion); + Controls.Add(bottomRegion); + Controls.Add(leftRegion); + Controls.Add(rightRegion); + + // Create tab index for intuitive tabbing order + documentRegion.TabIndex = 0; + rightRegion.TabIndex = 1; + bottomRegion.TabIndex = 2; + leftRegion.TabIndex = 3; + } + + public void DragContent(DarkDockContent content) + { + DockContentDragFilter.StartDrag(content); + } + + #endregion + + #region Serialization Region + + public DockPanelState GetDockPanelState() + { + var state = new DockPanelState(); + + state.Regions.Add(new DockRegionState(DarkDockArea.Document)); + state.Regions.Add(new DockRegionState(DarkDockArea.Left, _regions[DarkDockArea.Left].Size)); + state.Regions.Add(new DockRegionState(DarkDockArea.Right, _regions[DarkDockArea.Right].Size)); + state.Regions.Add(new DockRegionState(DarkDockArea.Bottom, _regions[DarkDockArea.Bottom].Size)); + + var _groupStates = new Dictionary(); + + var orderedContent = _contents.OrderBy(c => c.Order); + foreach (var content in orderedContent) + { + foreach (var region in state.Regions) + { + if (region.Area == content.DockArea) + { + DockGroupState groupState; + + if (_groupStates.ContainsKey(content.DockGroup)) + { + groupState = _groupStates[content.DockGroup]; + } + else + { + groupState = new DockGroupState(); + region.Groups.Add(groupState); + _groupStates.Add(content.DockGroup, groupState); + } + + groupState.Contents.Add(content.SerializationKey); + } + } + } + + return state; + } + + public void RestoreDockPanelState(DockPanelState state, Func getContentBySerializationKey) + { + foreach (var region in state.Regions) + { + switch (region.Area) + { + case DarkDockArea.Left: + _regions[DarkDockArea.Left].Size = region.Size; + break; + case DarkDockArea.Right: + _regions[DarkDockArea.Right].Size = region.Size; + break; + case DarkDockArea.Bottom: + _regions[DarkDockArea.Bottom].Size = region.Size; + break; + } + + foreach (var group in region.Groups) + { + DarkDockContent previousContent = null; + + foreach (var contentKey in group.Contents) + { + var content = getContentBySerializationKey(contentKey); + + if (content == null) + continue; + + if (previousContent == null) + AddContent(content); + else + AddContent(content, previousContent.DockGroup); + + previousContent = content; + } + } + } + } + + #endregion + } +} + \ No newline at end of file diff --git a/DarkUI/Docking/DarkDockRegion.cs b/DarkUI/Docking/DarkDockRegion.cs new file mode 100644 index 0000000..8875346 --- /dev/null +++ b/DarkUI/Docking/DarkDockRegion.cs @@ -0,0 +1,402 @@ +using DarkUI.Config; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace DarkUI.Docking +{ + [ToolboxItem(false)] + public class DarkDockRegion : Panel + { + #region Field Region + + private List _groups; + + private Form _parentForm; + private DarkDockSplitter _splitter; + + #endregion + + #region Property Region + + public DarkDockPanel DockPanel { get; private set; } + + public DarkDockArea DockArea { get; private set; } + + public DarkDockContent ActiveDocument + { + get + { + if (DockArea != DarkDockArea.Document || _groups.Count == 0) + return null; + + return _groups[0].VisibleContent; + } + } + + public List Groups + { + get + { + return _groups.ToList(); + } + } + + #endregion + + #region Constructor Region + + public DarkDockRegion(DarkDockPanel dockPanel, DarkDockArea dockArea) + { + _groups = new List(); + + DockPanel = dockPanel; + DockArea = dockArea; + + BuildProperties(); + } + + #endregion + + #region Method Region + + internal void AddContent(DarkDockContent dockContent) + { + AddContent(dockContent, null); + } + + internal void AddContent(DarkDockContent dockContent, DarkDockGroup dockGroup) + { + // If no existing group is specified then create a new one + if (dockGroup == null) + { + // If this is the document region, then default to first group if it exists + if (DockArea == DarkDockArea.Document && _groups.Count > 0) + dockGroup = _groups[0]; + else + dockGroup = CreateGroup(); + } + + dockContent.DockRegion = this; + dockGroup.AddContent(dockContent); + + if (!Visible) + { + Visible = true; + CreateSplitter(); + } + + PositionGroups(); + } + + internal void InsertContent(DarkDockContent dockContent, DarkDockGroup dockGroup, DockInsertType insertType) + { + var order = dockGroup.Order; + + if (insertType == DockInsertType.After) + order++; + + var newGroup = InsertGroup(order); + + dockContent.DockRegion = this; + newGroup.AddContent(dockContent); + + if (!Visible) + { + Visible = true; + CreateSplitter(); + } + + PositionGroups(); + } + + internal void RemoveContent(DarkDockContent dockContent) + { + dockContent.DockRegion = null; + + var group = dockContent.DockGroup; + group.RemoveContent(dockContent); + + dockContent.DockArea = DarkDockArea.None; + + // If that was the final content in the group then remove the group + if (group.ContentCount == 0) + RemoveGroup(group); + + // If we just removed the final group, and this isn't the document region, then hide + if (_groups.Count == 0 && DockArea != DarkDockArea.Document) + { + Visible = false; + RemoveSplitter(); + } + + PositionGroups(); + } + + public List GetContents() + { + var result = new List(); + + foreach (var group in _groups) + result.AddRange(group.GetContents()); + + return result; + } + + private DarkDockGroup CreateGroup() + { + var order = 0; + + if (_groups.Count >= 1) + { + order = -1; + foreach (var group in _groups) + { + if (group.Order >= order) + order = group.Order + 1; + } + } + + var newGroup = new DarkDockGroup(DockPanel, this, order); + _groups.Add(newGroup); + Controls.Add(newGroup); + + return newGroup; + } + + private DarkDockGroup InsertGroup(int order) + { + foreach (var group in _groups) + { + if (group.Order >= order) + group.Order++; + } + + var newGroup = new DarkDockGroup(DockPanel, this, order); + _groups.Add(newGroup); + Controls.Add(newGroup); + + return newGroup; + } + + private void RemoveGroup(DarkDockGroup group) + { + var lastOrder = group.Order; + + _groups.Remove(group); + Controls.Remove(group); + + foreach (var otherGroup in _groups) + { + if (otherGroup.Order > lastOrder) + otherGroup.Order--; + } + } + + private void PositionGroups() + { + DockStyle dockStyle; + + switch (DockArea) + { + default: + case DarkDockArea.Document: + dockStyle = DockStyle.Fill; + break; + case DarkDockArea.Left: + case DarkDockArea.Right: + dockStyle = DockStyle.Top; + break; + case DarkDockArea.Bottom: + dockStyle = DockStyle.Left; + break; + } + + if (_groups.Count == 1) + { + _groups[0].Dock = DockStyle.Fill; + return; + } + + if (_groups.Count > 1) + { + var lastGroup = _groups.OrderByDescending(g => g.Order).First(); + + foreach (var group in _groups.OrderByDescending(g => g.Order)) + { + group.SendToBack(); + + if (group.Order == lastGroup.Order) + group.Dock = DockStyle.Fill; + else + group.Dock = dockStyle; + } + + SizeGroups(); + } + } + + private void SizeGroups() + { + if (_groups.Count <= 1) + return; + + var size = new Size(0, 0); + + switch (DockArea) + { + default: + case DarkDockArea.Document: + return; + case DarkDockArea.Left: + case DarkDockArea.Right: + size = new Size(ClientRectangle.Width, ClientRectangle.Height / _groups.Count); + break; + case DarkDockArea.Bottom: + size = new Size(ClientRectangle.Width / _groups.Count, ClientRectangle.Height); + break; + } + + foreach (var group in _groups) + group.Size = size; + } + + private void BuildProperties() + { + MinimumSize = new Size(50, 50); + + switch (DockArea) + { + default: + case DarkDockArea.Document: + Dock = DockStyle.Fill; + Padding = new Padding(0, 1, 0, 0); + break; + case DarkDockArea.Left: + Dock = DockStyle.Left; + Padding = new Padding(0, 0, 1, 0); + Visible = false; + break; + case DarkDockArea.Right: + Dock = DockStyle.Right; + Padding = new Padding(1, 0, 0, 0); + Visible = false; + break; + case DarkDockArea.Bottom: + Dock = DockStyle.Bottom; + Padding = new Padding(0, 0, 0, 0); + Visible = false; + break; + } + } + + private void CreateSplitter() + { + if (_splitter != null && DockPanel.Splitters.Contains(_splitter)) + DockPanel.Splitters.Remove(_splitter); + + switch (DockArea) + { + case DarkDockArea.Left: + _splitter = new DarkDockSplitter(DockPanel, this, DarkSplitterType.Right); + break; + case DarkDockArea.Right: + _splitter = new DarkDockSplitter(DockPanel, this, DarkSplitterType.Left); + break; + case DarkDockArea.Bottom: + _splitter = new DarkDockSplitter(DockPanel, this, DarkSplitterType.Top); + break; + default: + return; + } + + DockPanel.Splitters.Add(_splitter); + } + + private void RemoveSplitter() + { + if (DockPanel.Splitters.Contains(_splitter)) + DockPanel.Splitters.Remove(_splitter); + } + + #endregion + + #region Event Handler Region + + protected override void OnCreateControl() + { + base.OnCreateControl(); + + _parentForm = FindForm(); + _parentForm.ResizeEnd += ParentForm_ResizeEnd; + } + + protected override void OnResize(EventArgs eventargs) + { + base.OnResize(eventargs); + + SizeGroups(); + } + + private void ParentForm_ResizeEnd(object sender, EventArgs e) + { + if (_splitter != null) + _splitter.UpdateBounds(); + } + + protected override void OnLayout(LayoutEventArgs e) + { + base.OnLayout(e); + + if (_splitter != null) + _splitter.UpdateBounds(); + } + + #endregion + + #region Paint Region + + public void Redraw() + { + Invalidate(); + + foreach (var group in _groups) + group.Redraw(); + } + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + + if (!Visible) + return; + + // Fill body + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, ClientRectangle); + } + + // Draw border + using (var p = new Pen(Colors.DarkBorder)) + { + // Top border + if (DockArea == DarkDockArea.Document) + g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Right, 0); + + // Left border + if (DockArea == DarkDockArea.Right) + g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Left, ClientRectangle.Height); + + // Right border + if (DockArea == DarkDockArea.Left) + g.DrawLine(p, ClientRectangle.Right - 1, 0, ClientRectangle.Right - 1, ClientRectangle.Height); + } + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkDockSplitter.cs b/DarkUI/Docking/DarkDockSplitter.cs new file mode 100644 index 0000000..aef13b2 --- /dev/null +++ b/DarkUI/Docking/DarkDockSplitter.cs @@ -0,0 +1,160 @@ +using DarkUI.Forms; +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Docking +{ + public class DarkDockSplitter + { + #region Field Region + + private Control _parentControl; + private Control _control; + + private DarkSplitterType _splitterType; + + private int _minimum; + private int _maximum; + private DarkTranslucentForm _overlayForm; + + #endregion + + #region Property Region + + public Rectangle Bounds { get; set; } + + public Cursor ResizeCursor { get; private set; } + + #endregion + + #region Constructor Region + + public DarkDockSplitter(Control parentControl, Control control, DarkSplitterType splitterType) + { + _parentControl = parentControl; + _control = control; + _splitterType = splitterType; + + switch (_splitterType) + { + case DarkSplitterType.Left: + case DarkSplitterType.Right: + ResizeCursor = Cursors.SizeWE; + break; + case DarkSplitterType.Top: + case DarkSplitterType.Bottom: + ResizeCursor = Cursors.SizeNS; + break; + } + } + + #endregion + + #region Method Region + + public void ShowOverlay() + { + _overlayForm = new DarkTranslucentForm(Color.Black); + _overlayForm.Visible = true; + + UpdateOverlay(new Point(0, 0)); + } + + public void HideOverlay() + { + _overlayForm.Visible = false; + } + + public void UpdateOverlay(Point difference) + { + var bounds = new Rectangle(Bounds.Location, Bounds.Size); + + switch (_splitterType) + { + case DarkSplitterType.Left: + var leftX = Math.Max(bounds.Location.X - difference.X, _minimum); + + if (_maximum != 0 && leftX > _maximum) + leftX = _maximum; + + bounds.Location = new Point(leftX, bounds.Location.Y); + break; + case DarkSplitterType.Right: + var rightX = Math.Max(bounds.Location.X - difference.X, _minimum); + + if (_maximum != 0 && rightX > _maximum) + rightX = _maximum; + + bounds.Location = new Point(rightX, bounds.Location.Y); + break; + case DarkSplitterType.Top: + var topY = Math.Max(bounds.Location.Y - difference.Y, _minimum); + + if (_maximum != 0 && topY > _maximum) + topY = _maximum; + + bounds.Location = new Point(bounds.Location.X, topY); + break; + case DarkSplitterType.Bottom: + var bottomY = Math.Max(bounds.Location.Y - difference.Y, _minimum); + + if (_maximum != 0 && bottomY > _maximum) + topY = _maximum; + + bounds.Location = new Point(bounds.Location.X, bottomY); + break; + } + + _overlayForm.Bounds = bounds; + } + + public void Move(Point difference) + { + switch (_splitterType) + { + case DarkSplitterType.Left: + _control.Width += difference.X; + break; + case DarkSplitterType.Right: + _control.Width -= difference.X; + break; + case DarkSplitterType.Top: + _control.Height += difference.Y; + break; + case DarkSplitterType.Bottom: + _control.Height -= difference.Y; + break; + } + + UpdateBounds(); + } + + public void UpdateBounds() + { + var bounds = _parentControl.RectangleToScreen(_control.Bounds); + + switch (_splitterType) + { + case DarkSplitterType.Left: + Bounds = new Rectangle(bounds.Left - 2, bounds.Top, 5, bounds.Height); + _maximum = bounds.Right - 2 - _control.MinimumSize.Width; + break; + case DarkSplitterType.Right: + Bounds = new Rectangle(bounds.Right - 2, bounds.Top, 5, bounds.Height); + _minimum = bounds.Left - 2 + _control.MinimumSize.Width; + break; + case DarkSplitterType.Top: + Bounds = new Rectangle(bounds.Left, bounds.Top - 2, bounds.Width, 5); + _maximum = bounds.Bottom - 2 - _control.MinimumSize.Height; + break; + case DarkSplitterType.Bottom: + Bounds = new Rectangle(bounds.Left, bounds.Bottom - 2, bounds.Width, 5); + _minimum = bounds.Top - 2 + _control.MinimumSize.Height; + break; + } + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkDockTab.cs b/DarkUI/Docking/DarkDockTab.cs new file mode 100644 index 0000000..5aebdd9 --- /dev/null +++ b/DarkUI/Docking/DarkDockTab.cs @@ -0,0 +1,44 @@ +using System.Drawing; + +namespace DarkUI.Docking +{ + internal class DarkDockTab + { + #region Property Region + + public DarkDockContent DockContent { get; set; } + + public Rectangle ClientRectangle { get; set; } + + public Rectangle CloseButtonRectangle { get; set; } + + public bool Hot { get; set; } + + public bool CloseButtonHot { get; set; } + + public bool ShowSeparator { get; set; } + + #endregion + + #region Constructor Region + + public DarkDockTab(DarkDockContent content) + { + DockContent = content; + } + + #endregion + + #region Method Region + + public int CalculateWidth(Graphics g, Font font) + { + var width = (int)g.MeasureString(DockContent.DockText, font).Width; + width += 10; + + return width; + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkDockTabArea.cs b/DarkUI/Docking/DarkDockTabArea.cs new file mode 100644 index 0000000..81b04f4 --- /dev/null +++ b/DarkUI/Docking/DarkDockTabArea.cs @@ -0,0 +1,107 @@ +using DarkUI.Controls; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Docking +{ + internal class DarkDockTabArea + { + #region Field Region + + private Dictionary _tabs = new Dictionary(); + + private List _menuItems = new List(); + private DarkContextMenu _tabMenu = new DarkContextMenu(); + + #endregion + + #region Property Region + + public DarkDockArea DockArea { get; private set; } + + public Rectangle ClientRectangle { get; set; } + + public Rectangle DropdownRectangle { get; set; } + + public bool DropdownHot { get; set; } + + public int Offset { get; set; } + + public int TotalTabSize { get; set; } + + public bool Visible { get; set; } + + public DarkDockTab ClickedCloseButton { get; set; } + + #endregion + + #region Constructor Region + + public DarkDockTabArea(DarkDockArea dockArea) + { + DockArea = dockArea; + } + + #endregion + + #region Method Region + + public void ShowMenu(Control control, Point location) + { + _tabMenu.Show(control, location); + } + + public void AddMenuItem(ToolStripMenuItem menuItem) + { + _menuItems.Add(menuItem); + RebuildMenu(); + } + + public void RemoveMenuItem(ToolStripMenuItem menuItem) + { + _menuItems.Remove(menuItem); + RebuildMenu(); + } + + public ToolStripMenuItem GetMenuItem(DarkDockContent content) + { + ToolStripMenuItem menuItem = null; + foreach (ToolStripMenuItem item in _menuItems) + { + var menuContent = item.Tag as DarkDockContent; + if (menuContent == null) + continue; + + if (menuContent == content) + menuItem = item; + } + + return menuItem; + } + + public void RebuildMenu() + { + _tabMenu.Items.Clear(); + + var orderedItems = new List(); + + var index = 0; + for (var i = 0; i < _menuItems.Count; i++) + { + foreach (var item in _menuItems) + { + var content = (DarkDockContent)item.Tag; + if (content.Order == index) + orderedItems.Add(item); + } + index++; + } + + foreach (var item in orderedItems) + _tabMenu.Items.Add(item); + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkDocument.cs b/DarkUI/Docking/DarkDocument.cs new file mode 100644 index 0000000..3185c12 --- /dev/null +++ b/DarkUI/Docking/DarkDocument.cs @@ -0,0 +1,30 @@ +using DarkUI.Config; +using System.ComponentModel; + +namespace DarkUI.Docking +{ + [ToolboxItem(false)] + public class DarkDocument : DarkDockContent + { + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new DarkDockArea DefaultDockArea + { + get { return base.DefaultDockArea; } + } + + #endregion + + #region Constructor Region + + public DarkDocument() + { + BackColor = Colors.GreyBackground; + base.DefaultDockArea = DarkDockArea.Document; + } + + #endregion + } +} diff --git a/DarkUI/Docking/DarkSplitterType.cs b/DarkUI/Docking/DarkSplitterType.cs new file mode 100644 index 0000000..9a6c349 --- /dev/null +++ b/DarkUI/Docking/DarkSplitterType.cs @@ -0,0 +1,10 @@ +namespace DarkUI.Docking +{ + public enum DarkSplitterType + { + Left, + Right, + Top, + Bottom + } +} diff --git a/DarkUI/Docking/DarkToolWindow.cs b/DarkUI/Docking/DarkToolWindow.cs new file mode 100644 index 0000000..5d7c783 --- /dev/null +++ b/DarkUI/Docking/DarkToolWindow.cs @@ -0,0 +1,231 @@ +using DarkUI.Config; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System; + +namespace DarkUI.Docking +{ + [ToolboxItem(false)] + public class DarkToolWindow : DarkDockContent + { + #region Field Region + + private Rectangle _closeButtonRect; + private bool _closeButtonHot = false; + private bool _closeButtonPressed = false; + + private Rectangle _headerRect; + private bool _shouldDrag; + + #endregion + + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Padding Padding + { + get { return base.Padding; } + } + + #endregion + + #region Constructor Region + + public DarkToolWindow() + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw | + ControlStyles.UserPaint, true); + + BackColor = Colors.GreyBackground; + base.Padding = new Padding(0, Consts.ToolWindowHeaderSize, 0, 0); + + UpdateCloseButton(); + } + + #endregion + + #region Method Region + + private bool IsActive() + { + if (DockPanel == null) + return false; + + return DockPanel.ActiveContent == this; + } + + private void UpdateCloseButton() + { + _headerRect = new Rectangle + { + X = ClientRectangle.Left, + Y = ClientRectangle.Top, + Width = ClientRectangle.Width, + Height = Consts.ToolWindowHeaderSize + }; + + _closeButtonRect = new Rectangle + { + X = ClientRectangle.Right - DockIcons.tw_close.Width - 5 - 3, + Y = ClientRectangle.Top + (Consts.ToolWindowHeaderSize / 2) - (DockIcons.tw_close.Height / 2), + Width = DockIcons.tw_close.Width, + Height = DockIcons.tw_close.Height + }; + } + + #endregion + + #region Event Handler Region + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + UpdateCloseButton(); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (_closeButtonRect.Contains(e.Location) || _closeButtonPressed) + { + if (!_closeButtonHot) + { + _closeButtonHot = true; + Invalidate(); + } + } + else + { + if (_closeButtonHot) + { + _closeButtonHot = false; + Invalidate(); + } + + if (_shouldDrag) + { + DockPanel.DragContent(this); + return; + } + } + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (_closeButtonRect.Contains(e.Location)) + { + _closeButtonPressed = true; + _closeButtonHot = true; + Invalidate(); + return; + } + + if (_headerRect.Contains(e.Location)) + { + _shouldDrag = true; + return; + } + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + if (_closeButtonRect.Contains(e.Location) && _closeButtonPressed) + Close(); + + _closeButtonPressed = false; + _closeButtonHot = false; + + _shouldDrag = false; + + Invalidate(); + } + + #endregion + + #region Paint Region + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + + // Fill body + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, ClientRectangle); + } + + var isActive = IsActive(); + + // Draw header + var bgColor = isActive ? Colors.BlueBackground : Colors.HeaderBackground; + var darkColor = isActive ? Colors.DarkBlueBorder : Colors.DarkBorder; + var lightColor = isActive ? Colors.LightBlueBorder : Colors.LightBorder; + + using (var b = new SolidBrush(bgColor)) + { + var bgRect = new Rectangle(0, 0, ClientRectangle.Width, Consts.ToolWindowHeaderSize); + g.FillRectangle(b, bgRect); + } + + using (var p = new Pen(darkColor)) + { + g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Right, 0); + g.DrawLine(p, ClientRectangle.Left, Consts.ToolWindowHeaderSize - 1, ClientRectangle.Right, Consts.ToolWindowHeaderSize - 1); + } + + using (var p = new Pen(lightColor)) + { + g.DrawLine(p, ClientRectangle.Left, 1, ClientRectangle.Right, 1); + } + + var xOffset = 2; + + // Draw icon + if (Icon != null) + { + g.DrawImageUnscaled(Icon, ClientRectangle.Left + 5, ClientRectangle.Top + (Consts.ToolWindowHeaderSize / 2) - (Icon.Height / 2) + 1); + xOffset = Icon.Width + 8; + } + + // Draw text + using (var b = new SolidBrush(Colors.LightText)) + { + var textRect = new Rectangle(xOffset, 0, ClientRectangle.Width - 4 - xOffset, Consts.ToolWindowHeaderSize); + + var format = new StringFormat + { + Alignment = StringAlignment.Near, + LineAlignment = StringAlignment.Center, + FormatFlags = StringFormatFlags.NoWrap, + Trimming = StringTrimming.EllipsisCharacter + }; + + g.DrawString(DockText, Font, b, textRect, format); + } + + // Close button + var img = _closeButtonHot ? DockIcons.tw_close_selected : DockIcons.tw_close; + + if (isActive) + img = _closeButtonHot ? DockIcons.tw_active_close_selected : DockIcons.tw_active_close; + + g.DrawImageUnscaled(img, _closeButtonRect.Left, _closeButtonRect.Top); + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + // Absorb event + } + + #endregion + } +} diff --git a/DarkUI/Docking/DockContentEventArgs.cs b/DarkUI/Docking/DockContentEventArgs.cs new file mode 100644 index 0000000..13ae74d --- /dev/null +++ b/DarkUI/Docking/DockContentEventArgs.cs @@ -0,0 +1,14 @@ +using System; + +namespace DarkUI.Docking +{ + public class DockContentEventArgs : EventArgs + { + public DarkDockContent Content { get; private set; } + + public DockContentEventArgs(DarkDockContent content) + { + Content = content; + } + } +} diff --git a/DarkUI/Docking/DockDropArea.cs b/DarkUI/Docking/DockDropArea.cs new file mode 100644 index 0000000..dc4a128 --- /dev/null +++ b/DarkUI/Docking/DockDropArea.cs @@ -0,0 +1,204 @@ +using System.Drawing; + +namespace DarkUI.Docking +{ + internal class DockDropArea + { + #region Property Region + + internal DarkDockPanel DockPanel { get; private set; } + + internal Rectangle DropArea { get; private set; } + + internal Rectangle HighlightArea { get; private set; } + + internal DarkDockRegion DockRegion { get; private set; } + + internal DarkDockGroup DockGroup { get; private set; } + + internal DockInsertType InsertType { get; private set; } + + #endregion + + #region Constructor Region + + internal DockDropArea(DarkDockPanel dockPanel, DarkDockRegion region) + { + DockPanel = dockPanel; + DockRegion = region; + InsertType = DockInsertType.None; + + BuildAreas(); + } + + internal DockDropArea(DarkDockPanel dockPanel, DarkDockGroup group, DockInsertType insertType) + { + DockPanel = dockPanel; + DockGroup = group; + InsertType = insertType; + + BuildAreas(); + } + + #endregion + + #region Method Region + + internal void BuildAreas() + { + if (DockRegion != null) + BuildRegionAreas(); + else if (DockGroup != null) + BuildGroupAreas(); + } + + private void BuildRegionAreas() + { + switch (DockRegion.DockArea) + { + case DarkDockArea.Left: + + var leftRect = new Rectangle + { + X = DockPanel.PointToScreen(Point.Empty).X, + Y = DockPanel.PointToScreen(Point.Empty).Y, + Width = 50, + Height = DockPanel.Height + }; + + DropArea = leftRect; + HighlightArea = leftRect; + + break; + + case DarkDockArea.Right: + + var rightRect = new Rectangle + { + X = DockPanel.PointToScreen(Point.Empty).X + DockPanel.Width - 50, + Y = DockPanel.PointToScreen(Point.Empty).Y, + Width = 50, + Height = DockPanel.Height + }; + + DropArea = rightRect; + HighlightArea = rightRect; + + break; + + case DarkDockArea.Bottom: + + var x = DockPanel.PointToScreen(Point.Empty).X; + var width = DockPanel.Width; + + if (DockPanel.Regions[DarkDockArea.Left].Visible) + { + x += DockPanel.Regions[DarkDockArea.Left].Width; + width -= DockPanel.Regions[DarkDockArea.Left].Width; + } + + if (DockPanel.Regions[DarkDockArea.Right].Visible) + { + width -= DockPanel.Regions[DarkDockArea.Right].Width; + } + + var bottomRect = new Rectangle + { + X = x, + Y = DockPanel.PointToScreen(Point.Empty).Y + DockPanel.Height - 50, + Width = width, + Height = 50 + }; + + DropArea = bottomRect; + HighlightArea = bottomRect; + + break; + } + } + + private void BuildGroupAreas() + { + switch (InsertType) + { + case DockInsertType.None: + var dropRect = new Rectangle + { + X = DockGroup.PointToScreen(Point.Empty).X, + Y = DockGroup.PointToScreen(Point.Empty).Y, + Width = DockGroup.Width, + Height = DockGroup.Height + }; + + DropArea = dropRect; + HighlightArea = dropRect; + + break; + + case DockInsertType.Before: + var beforeDropWidth = DockGroup.Width; + var beforeDropHeight = DockGroup.Height; + + switch (DockGroup.DockArea) + { + case DarkDockArea.Left: + case DarkDockArea.Right: + beforeDropHeight = DockGroup.Height / 4; + break; + + case DarkDockArea.Bottom: + beforeDropWidth = DockGroup.Width / 4; + break; + } + + var beforeDropRect = new Rectangle + { + X = DockGroup.PointToScreen(Point.Empty).X, + Y = DockGroup.PointToScreen(Point.Empty).Y, + Width = beforeDropWidth, + Height = beforeDropHeight + }; + + DropArea = beforeDropRect; + HighlightArea = beforeDropRect; + + break; + + case DockInsertType.After: + var afterDropX = DockGroup.PointToScreen(Point.Empty).X; + var afterDropY = DockGroup.PointToScreen(Point.Empty).Y; + var afterDropWidth = DockGroup.Width; + var afterDropHeight = DockGroup.Height; + + switch (DockGroup.DockArea) + { + case DarkDockArea.Left: + case DarkDockArea.Right: + afterDropHeight = DockGroup.Height / 4; + afterDropY = DockGroup.PointToScreen(Point.Empty).Y + DockGroup.Height - afterDropHeight; + break; + + case DarkDockArea.Bottom: + afterDropWidth = DockGroup.Width / 4; + afterDropX = DockGroup.PointToScreen(Point.Empty).X + DockGroup.Width - afterDropWidth; + break; + } + + var afterDropRect = new Rectangle + { + X = afterDropX, + Y = afterDropY, + Width = afterDropWidth, + Height = afterDropHeight + }; + + DropArea = afterDropRect; + HighlightArea = afterDropRect; + + break; + } + } + + #endregion + } +} diff --git a/DarkUI/Docking/DockDropCollection.cs b/DarkUI/Docking/DockDropCollection.cs new file mode 100644 index 0000000..31578fe --- /dev/null +++ b/DarkUI/Docking/DockDropCollection.cs @@ -0,0 +1,26 @@ +namespace DarkUI.Docking +{ + internal class DockDropCollection + { + #region Property Region + + internal DockDropArea DropArea { get; private set; } + + internal DockDropArea InsertBeforeArea { get; private set; } + + internal DockDropArea InsertAfterArea { get; private set; } + + #endregion + + #region Constructor Region + + internal DockDropCollection(DarkDockPanel dockPanel, DarkDockGroup group) + { + DropArea = new DockDropArea(dockPanel, group, DockInsertType.None); + InsertBeforeArea = new DockDropArea(dockPanel, group, DockInsertType.Before); + InsertAfterArea = new DockDropArea(dockPanel, group, DockInsertType.After); + } + + #endregion + } +} diff --git a/DarkUI/Docking/DockGroupState.cs b/DarkUI/Docking/DockGroupState.cs new file mode 100644 index 0000000..861d205 --- /dev/null +++ b/DarkUI/Docking/DockGroupState.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace DarkUI.Docking +{ + public class DockGroupState + { + #region Property Region + + public List Contents { get; set; } + + #endregion + + #region Constructor Region + + public DockGroupState() + { + Contents = new List(); + } + + #endregion + } +} diff --git a/DarkUI/Docking/DockInsertType.cs b/DarkUI/Docking/DockInsertType.cs new file mode 100644 index 0000000..d8e38d3 --- /dev/null +++ b/DarkUI/Docking/DockInsertType.cs @@ -0,0 +1,9 @@ +namespace DarkUI.Docking +{ + public enum DockInsertType + { + None, + Before, + After + } +} diff --git a/DarkUI/Docking/DockPanelState.cs b/DarkUI/Docking/DockPanelState.cs new file mode 100644 index 0000000..d45de8f --- /dev/null +++ b/DarkUI/Docking/DockPanelState.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace DarkUI.Docking +{ + public class DockPanelState + { + #region Property Region + + public List Regions { get; set; } + + #endregion + + #region Constructor Region + + public DockPanelState() + { + Regions = new List(); + } + + #endregion + } +} diff --git a/DarkUI/Docking/DockRegionState.cs b/DarkUI/Docking/DockRegionState.cs new file mode 100644 index 0000000..9c9f6ae --- /dev/null +++ b/DarkUI/Docking/DockRegionState.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Drawing; + +namespace DarkUI.Docking +{ + public class DockRegionState + { + #region Property Region + + public DarkDockArea Area { get; set; } + + public Size Size { get; set; } + + public List Groups { get; set; } + + #endregion + + #region Constructor Region + + public DockRegionState() + { + Groups = new List(); + } + + public DockRegionState(DarkDockArea area) + : this() + { + Area = area; + } + + public DockRegionState(DarkDockArea area, Size size) + : this(area) + { + Size = size; + } + + #endregion + } +} diff --git a/DarkUI/Extensions/BitmapExtensions.cs b/DarkUI/Extensions/BitmapExtensions.cs new file mode 100644 index 0000000..e4e057d --- /dev/null +++ b/DarkUI/Extensions/BitmapExtensions.cs @@ -0,0 +1,37 @@ +using System.Drawing; + +namespace DarkUI.Extensions +{ + internal static class BitmapExtensions + { + internal static Bitmap SetColor(this Bitmap bitmap, Color color) + { + var newBitmap = new Bitmap(bitmap.Width, bitmap.Height); + for (int i = 0; i < bitmap.Width; i++) + { + for (int j = 0; j < bitmap.Height; j++) + { + var pixel = bitmap.GetPixel(i, j); + if (pixel.A > 0) + newBitmap.SetPixel(i, j, color); + } + } + return newBitmap; + } + + internal static Bitmap ChangeColor(this Bitmap bitmap, Color oldColor, Color newColor) + { + var newBitmap = new Bitmap(bitmap.Width, bitmap.Height); + for (int i = 0; i < bitmap.Width; i++) + { + for (int j = 0; j < bitmap.Height; j++) + { + var pixel = bitmap.GetPixel(i, j); + if (pixel == oldColor) + newBitmap.SetPixel(i, j, newColor); + } + } + return newBitmap; + } + } +} diff --git a/DarkUI/Extensions/IEnumerableExtensions.cs b/DarkUI/Extensions/IEnumerableExtensions.cs new file mode 100644 index 0000000..591a99d --- /dev/null +++ b/DarkUI/Extensions/IEnumerableExtensions.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; + +namespace DarkUI.Extensions +{ + internal static class IEnumerableExtensions + { + internal static bool IsLast(this IEnumerable items, T item) + { + var last = items.LastOrDefault(); + if (last == null) + return false; + return item.Equals(last); + } + + internal static bool IsFirst(this IEnumerable items, T item) + { + var first = items.FirstOrDefault(); + if (first == null) + return false; + return item.Equals(first); + } + + internal static bool IsFirstOrLast(this IEnumerable items, T item) + { + return items.IsFirst(item) || items.IsLast(item); + } + } +} diff --git a/DarkUI/Forms/DarkDialog.Designer.cs b/DarkUI/Forms/DarkDialog.Designer.cs new file mode 100644 index 0000000..b8e0ffb --- /dev/null +++ b/DarkUI/Forms/DarkDialog.Designer.cs @@ -0,0 +1,180 @@ +using DarkUI.Controls; + +namespace DarkUI.Forms +{ + partial class DarkDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pnlFooter = new System.Windows.Forms.Panel(); + this.flowInner = new System.Windows.Forms.FlowLayoutPanel(); + this.btnOk = new DarkButton(); + this.btnCancel = new DarkButton(); + this.btnClose = new DarkButton(); + this.btnYes = new DarkButton(); + this.btnNo = new DarkButton(); + this.btnAbort = new DarkButton(); + this.btnRetry = new DarkButton(); + this.btnIgnore = new DarkButton(); + this.pnlFooter.SuspendLayout(); + this.flowInner.SuspendLayout(); + this.SuspendLayout(); + // + // pnlFooter + // + this.pnlFooter.Controls.Add(this.flowInner); + this.pnlFooter.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlFooter.Location = new System.Drawing.Point(0, 357); + this.pnlFooter.Name = "pnlFooter"; + this.pnlFooter.Size = new System.Drawing.Size(767, 45); + this.pnlFooter.TabIndex = 1; + // + // flowInner + // + this.flowInner.Controls.Add(this.btnOk); + this.flowInner.Controls.Add(this.btnCancel); + this.flowInner.Controls.Add(this.btnClose); + this.flowInner.Controls.Add(this.btnYes); + this.flowInner.Controls.Add(this.btnNo); + this.flowInner.Controls.Add(this.btnAbort); + this.flowInner.Controls.Add(this.btnRetry); + this.flowInner.Controls.Add(this.btnIgnore); + this.flowInner.Dock = System.Windows.Forms.DockStyle.Right; + this.flowInner.Location = new System.Drawing.Point(104, 0); + this.flowInner.Name = "flowInner"; + this.flowInner.Padding = new System.Windows.Forms.Padding(10); + this.flowInner.Size = new System.Drawing.Size(663, 45); + this.flowInner.TabIndex = 10014; + // + // btnOk + // + this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOk.Location = new System.Drawing.Point(10, 10); + this.btnOk.Margin = new System.Windows.Forms.Padding(0); + this.btnOk.Name = "btnOk"; + this.btnOk.Padding = new System.Windows.Forms.Padding(5); + this.btnOk.Size = new System.Drawing.Size(75, 26); + this.btnOk.TabIndex = 3; + this.btnOk.Text = "Ok"; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(85, 10); + this.btnCancel.Margin = new System.Windows.Forms.Padding(0); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Padding = new System.Windows.Forms.Padding(5); + this.btnCancel.Size = new System.Drawing.Size(75, 26); + this.btnCancel.TabIndex = 4; + this.btnCancel.Text = "Cancel"; + // + // btnClose + // + this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnClose.Location = new System.Drawing.Point(160, 10); + this.btnClose.Margin = new System.Windows.Forms.Padding(0); + this.btnClose.Name = "btnClose"; + this.btnClose.Padding = new System.Windows.Forms.Padding(5); + this.btnClose.Size = new System.Drawing.Size(75, 26); + this.btnClose.TabIndex = 5; + this.btnClose.Text = "Close"; + // + // btnYes + // + this.btnYes.DialogResult = System.Windows.Forms.DialogResult.Yes; + this.btnYes.Location = new System.Drawing.Point(235, 10); + this.btnYes.Margin = new System.Windows.Forms.Padding(0); + this.btnYes.Name = "btnYes"; + this.btnYes.Padding = new System.Windows.Forms.Padding(5); + this.btnYes.Size = new System.Drawing.Size(75, 26); + this.btnYes.TabIndex = 6; + this.btnYes.Text = "Yes"; + // + // btnNo + // + this.btnNo.DialogResult = System.Windows.Forms.DialogResult.No; + this.btnNo.Location = new System.Drawing.Point(310, 10); + this.btnNo.Margin = new System.Windows.Forms.Padding(0); + this.btnNo.Name = "btnNo"; + this.btnNo.Padding = new System.Windows.Forms.Padding(5); + this.btnNo.Size = new System.Drawing.Size(75, 26); + this.btnNo.TabIndex = 7; + this.btnNo.Text = "No"; + // + // btnAbort + // + this.btnAbort.DialogResult = System.Windows.Forms.DialogResult.Abort; + this.btnAbort.Location = new System.Drawing.Point(385, 10); + this.btnAbort.Margin = new System.Windows.Forms.Padding(0); + this.btnAbort.Name = "btnAbort"; + this.btnAbort.Padding = new System.Windows.Forms.Padding(5); + this.btnAbort.Size = new System.Drawing.Size(75, 26); + this.btnAbort.TabIndex = 8; + this.btnAbort.Text = "Abort"; + // + // btnRetry + // + this.btnRetry.DialogResult = System.Windows.Forms.DialogResult.Retry; + this.btnRetry.Location = new System.Drawing.Point(460, 10); + this.btnRetry.Margin = new System.Windows.Forms.Padding(0); + this.btnRetry.Name = "btnRetry"; + this.btnRetry.Padding = new System.Windows.Forms.Padding(5); + this.btnRetry.Size = new System.Drawing.Size(75, 26); + this.btnRetry.TabIndex = 9; + this.btnRetry.Text = "Retry"; + // + // btnIgnore + // + this.btnIgnore.DialogResult = System.Windows.Forms.DialogResult.Ignore; + this.btnIgnore.Location = new System.Drawing.Point(535, 10); + this.btnIgnore.Margin = new System.Windows.Forms.Padding(0); + this.btnIgnore.Name = "btnIgnore"; + this.btnIgnore.Padding = new System.Windows.Forms.Padding(5); + this.btnIgnore.Size = new System.Drawing.Size(75, 26); + this.btnIgnore.TabIndex = 10; + this.btnIgnore.Text = "Ignore"; + // + // DarkDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(767, 402); + this.Controls.Add(this.pnlFooter); + this.Name = "DarkDialog"; + this.Text = "DarkDialog"; + this.pnlFooter.ResumeLayout(false); + this.flowInner.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlFooter; + private System.Windows.Forms.FlowLayoutPanel flowInner; + } +} \ No newline at end of file diff --git a/DarkUI/Forms/DarkDialog.cs b/DarkUI/Forms/DarkDialog.cs new file mode 100644 index 0000000..c3ee43a --- /dev/null +++ b/DarkUI/Forms/DarkDialog.cs @@ -0,0 +1,176 @@ +using DarkUI.Controls; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; + +namespace DarkUI.Forms +{ + public partial class DarkDialog : DarkForm + { + #region Field Region + + private DarkDialogButton _dialogButtons = DarkDialogButton.Ok; + private List _buttons; + + #endregion + + #region Button Region + + protected DarkButton btnOk; + protected DarkButton btnCancel; + protected DarkButton btnClose; + protected DarkButton btnYes; + protected DarkButton btnNo; + protected DarkButton btnAbort; + protected DarkButton btnRetry; + protected DarkButton btnIgnore; + + #endregion + + #region Property Region + + [Description("Determines the type of the dialog window.")] + [DefaultValue(DarkDialogButton.Ok)] + public DarkDialogButton DialogButtons + { + get { return _dialogButtons; } + set + { + if (_dialogButtons == value) + return; + + _dialogButtons = value; + SetButtons(); + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int TotalButtonSize { get; private set; } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new IButtonControl AcceptButton + { + get { return base.AcceptButton; } + private set { base.AcceptButton = value; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new IButtonControl CancelButton + { + get { return base.CancelButton; } + private set { base.CancelButton = value; } + } + + #endregion + + #region Constructor Region + + public DarkDialog() + { + InitializeComponent(); + + _buttons = new List + { + btnAbort, btnRetry, btnIgnore, btnOk, + btnCancel, btnClose, btnYes, btnNo + }; + } + + #endregion + + #region Event Handler Region + + protected override void OnLoad(System.EventArgs e) + { + base.OnLoad(e); + + SetButtons(); + } + + #endregion + + #region Method Region + + private void SetButtons() + { + foreach (var btn in _buttons) + btn.Visible = false; + + switch (_dialogButtons) + { + case DarkDialogButton.Ok: + ShowButton(btnOk, true); + AcceptButton = btnOk; + break; + case DarkDialogButton.Close: + ShowButton(btnClose, true); + AcceptButton = btnClose; + CancelButton = btnClose; + break; + case DarkDialogButton.OkCancel: + ShowButton(btnOk); + ShowButton(btnCancel, true); + AcceptButton = btnOk; + CancelButton = btnCancel; + break; + case DarkDialogButton.AbortRetryIgnore: + ShowButton(btnAbort); + ShowButton(btnRetry); + ShowButton(btnIgnore, true); + AcceptButton = btnAbort; + CancelButton = btnIgnore; + break; + case DarkDialogButton.RetryCancel: + ShowButton(btnRetry); + ShowButton(btnCancel, true); + AcceptButton = btnRetry; + CancelButton = btnCancel; + break; + case DarkDialogButton.YesNo: + ShowButton(btnYes); + ShowButton(btnNo, true); + AcceptButton = btnYes; + CancelButton = btnNo; + break; + case DarkDialogButton.YesNoCancel: + ShowButton(btnYes); + ShowButton(btnNo); + ShowButton(btnCancel, true); + AcceptButton = btnYes; + CancelButton = btnCancel; + break; + } + + SetFlowSize(); + } + + private void ShowButton(DarkButton button, bool isLast = false) + { + button.SendToBack(); + + if (!isLast) + button.Margin = new Padding(0, 0, 10, 0); + + button.Visible = true; + } + + private void SetFlowSize() + { + var width = flowInner.Padding.Horizontal; + + foreach (var btn in _buttons) + { + if (btn.Visible) + width += btn.Width + btn.Margin.Right; + } + + flowInner.Width = width; + TotalButtonSize = width; + } + + #endregion + } +} diff --git a/DarkUI/Forms/DarkDialog.resx b/DarkUI/Forms/DarkDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DarkUI/Forms/DarkDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DarkUI/Forms/DarkDialogButton.cs b/DarkUI/Forms/DarkDialogButton.cs new file mode 100644 index 0000000..e579bbd --- /dev/null +++ b/DarkUI/Forms/DarkDialogButton.cs @@ -0,0 +1,13 @@ +namespace DarkUI.Forms +{ + public enum DarkDialogButton + { + Ok, + Close, + OkCancel, + YesNo, + YesNoCancel, + AbortRetryIgnore, + RetryCancel + } +} diff --git a/DarkUI/Forms/DarkForm.cs b/DarkUI/Forms/DarkForm.cs new file mode 100644 index 0000000..f135c8a --- /dev/null +++ b/DarkUI/Forms/DarkForm.cs @@ -0,0 +1,62 @@ +using DarkUI.Config; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Forms +{ + public class DarkForm : Form + { + #region Field Region + + private bool _flatBorder; + + #endregion + + #region Property Region + + [Category("Appearance")] + [Description("Determines whether a single pixel border should be rendered around the form.")] + [DefaultValue(false)] + public bool FlatBorder + { + get { return _flatBorder; } + set + { + _flatBorder = value; + Invalidate(); + } + } + + #endregion + + #region Constructor Region + + public DarkForm() + { + BackColor = Colors.GreyBackground; + } + + #endregion + + #region Paint Region + + protected override void OnPaintBackground(PaintEventArgs e) + { + base.OnPaintBackground(e); + + if (!_flatBorder) + return; + + var g = e.Graphics; + + using (var p = new Pen(Colors.DarkBorder)) + { + var modRect = new Rectangle(ClientRectangle.Location, new Size(ClientRectangle.Width - 1, ClientRectangle.Height - 1)); + g.DrawRectangle(p, modRect); + } + } + + #endregion + } +} diff --git a/DarkUI/Forms/DarkMessageBox.Designer.cs b/DarkUI/Forms/DarkMessageBox.Designer.cs new file mode 100644 index 0000000..c794003 --- /dev/null +++ b/DarkUI/Forms/DarkMessageBox.Designer.cs @@ -0,0 +1,83 @@ +using DarkUI.Controls; + +namespace DarkUI.Forms +{ + partial class DarkMessageBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.picIcon = new System.Windows.Forms.PictureBox(); + this.lblText = new DarkLabel(); + ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit(); + this.SuspendLayout(); + // + // picIcon + // + this.picIcon.Location = new System.Drawing.Point(10, 10); + this.picIcon.Name = "picIcon"; + this.picIcon.Size = new System.Drawing.Size(32, 32); + this.picIcon.TabIndex = 3; + this.picIcon.TabStop = false; + // + // lblText + // + this.lblText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.lblText.Location = new System.Drawing.Point(50, 9); + this.lblText.Name = "lblText"; + this.lblText.Size = new System.Drawing.Size(185, 15); + this.lblText.TabIndex = 4; + this.lblText.Text = "Something something something"; + // + // DarkMessageBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(244, 86); + this.Controls.Add(this.lblText); + this.Controls.Add(this.picIcon); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DarkMessageBox"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Message box"; + this.Controls.SetChildIndex(this.picIcon, 0); + this.Controls.SetChildIndex(this.lblText, 0); + ((System.ComponentModel.ISupportInitialize)(this.picIcon)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox picIcon; + private DarkLabel lblText; + } +} \ No newline at end of file diff --git a/DarkUI/Forms/DarkMessageBox.cs b/DarkUI/Forms/DarkMessageBox.cs new file mode 100644 index 0000000..76e2429 --- /dev/null +++ b/DarkUI/Forms/DarkMessageBox.cs @@ -0,0 +1,177 @@ +using DarkUI.Icons; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Forms +{ + public partial class DarkMessageBox : DarkDialog + { + #region Field Region + + private string _message; + private int _maximumWidth = 350; + + #endregion + + #region Property Region + + [Description("Determines the maximum width of the message box when it autosizes around the displayed message.")] + [DefaultValue(350)] + public int MaximumWidth + { + get { return _maximumWidth; } + set + { + _maximumWidth = value; + CalculateSize(); + } + } + + #endregion + + #region Constructor Region + + public DarkMessageBox() + { + InitializeComponent(); + } + + public DarkMessageBox(string message, string title, DarkMessageBoxIcon icon, DarkDialogButton buttons) + : this() + { + Text = title; + _message = message; + + DialogButtons = buttons; + SetIcon(icon); + } + + public DarkMessageBox(string message) + : this(message, null, DarkMessageBoxIcon.None, DarkDialogButton.Ok) + { } + + public DarkMessageBox(string message, string title) + : this(message, title, DarkMessageBoxIcon.None, DarkDialogButton.Ok) + { } + + public DarkMessageBox(string message, string title, DarkDialogButton buttons) + : this(message, title, DarkMessageBoxIcon.None, buttons) + { } + + public DarkMessageBox(string message, string title, DarkMessageBoxIcon icon) + : this(message, title, icon, DarkDialogButton.Ok) + { } + + #endregion + + #region Static Method Region + + public static DialogResult ShowInformation(string message, string caption, DarkDialogButton buttons = DarkDialogButton.Ok) + { + return ShowDialog(message, caption, DarkMessageBoxIcon.Information, buttons); + } + + public static DialogResult ShowWarning(string message, string caption, DarkDialogButton buttons = DarkDialogButton.Ok) + { + return ShowDialog(message, caption, DarkMessageBoxIcon.Warning, buttons); + } + + public static DialogResult ShowError(string message, string caption, DarkDialogButton buttons = DarkDialogButton.Ok) + { + return ShowDialog(message, caption, DarkMessageBoxIcon.Error, buttons); + } + + private static DialogResult ShowDialog(string message, string caption, DarkMessageBoxIcon icon, DarkDialogButton buttons) + { + using (var dlg = new DarkMessageBox(message, caption, icon, buttons)) + { + var result = dlg.ShowDialog(); + return result; + } + } + + #endregion + + #region Method Region + + private void SetIcon(DarkMessageBoxIcon icon) + { + switch (icon) + { + case DarkMessageBoxIcon.None: + picIcon.Visible = false; + lblText.Left = 10; + break; + case DarkMessageBoxIcon.Information: + picIcon.Image = MessageBoxIcons.info; + break; + case DarkMessageBoxIcon.Warning: + picIcon.Image = MessageBoxIcons.warning; + break; + case DarkMessageBoxIcon.Error: + picIcon.Image = MessageBoxIcons.error; + break; + } + } + + private void CalculateSize() + { + var width = 260; var height = 124; + + // Reset form back to original size + Size = new Size(width, height); + + lblText.Text = string.Empty; + lblText.AutoSize = true; + lblText.Text = _message; + + // Set the minimum dialog size to whichever is bigger - the original size or the buttons. + var minWidth = Math.Max(width, TotalButtonSize + 15); + + // Calculate the total size of the message + var totalWidth = lblText.Right + 25; + + // Make sure we're not making the dialog bigger than the maximum size + if (totalWidth < _maximumWidth) + { + // Width is smaller than the maximum width. + // This means we can have a single-line message box. + // Move the label to accomodate this. + width = totalWidth; + lblText.Top = picIcon.Top + (picIcon.Height / 2) - (lblText.Height / 2); + } + else + { + // Width is larger than the maximum width. + // Change the label size and wrap it. + width = _maximumWidth; + var offsetHeight = Height - picIcon.Height; + lblText.AutoUpdateHeight = true; + lblText.Width = width - lblText.Left - 25; + height = offsetHeight + lblText.Height; + } + + // Force the width to the minimum width + if (width < minWidth) + width = minWidth; + + // Set the new size of the dialog + Size = new Size(width, height); + } + + #endregion + + #region Event Handler Region + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + CalculateSize(); + } + + #endregion + } +} diff --git a/DarkUI/Forms/DarkMessageBox.resx b/DarkUI/Forms/DarkMessageBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DarkUI/Forms/DarkMessageBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DarkUI/Forms/DarkMessageBoxIcon.cs b/DarkUI/Forms/DarkMessageBoxIcon.cs new file mode 100644 index 0000000..358d5eb --- /dev/null +++ b/DarkUI/Forms/DarkMessageBoxIcon.cs @@ -0,0 +1,10 @@ +namespace DarkUI.Forms +{ + public enum DarkMessageBoxIcon + { + None, + Information, + Warning, + Error + } +} diff --git a/DarkUI/Forms/DarkTranslucentForm.cs b/DarkUI/Forms/DarkTranslucentForm.cs new file mode 100644 index 0000000..cf00306 --- /dev/null +++ b/DarkUI/Forms/DarkTranslucentForm.cs @@ -0,0 +1,32 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Forms +{ + internal class DarkTranslucentForm : Form + { + #region Property Region + + protected override bool ShowWithoutActivation + { + get { return true; } + } + + #endregion + + #region Constructor Region + + public DarkTranslucentForm(Color backColor, double opacity = 0.6) + { + StartPosition = FormStartPosition.Manual; + FormBorderStyle = FormBorderStyle.None; + Size = new Size(1, 1); + ShowInTaskbar = false; + AllowTransparency = true; + Opacity = opacity; + BackColor = backColor; + } + + #endregion + } +} diff --git a/DarkUI/Icons/DockIcons.Designer.cs b/DarkUI/Icons/DockIcons.Designer.cs new file mode 100644 index 0000000..5390bb8 --- /dev/null +++ b/DarkUI/Icons/DockIcons.Designer.cs @@ -0,0 +1,163 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DarkUI { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class DockIcons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal DockIcons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DarkUI.Icons.DockIcons", typeof(DockIcons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap active_inactive_close { + get { + object obj = ResourceManager.GetObject("active_inactive_close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow { + get { + object obj = ResourceManager.GetObject("arrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap close { + get { + object obj = ResourceManager.GetObject("close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap close_selected { + get { + object obj = ResourceManager.GetObject("close_selected", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap inactive_close { + get { + object obj = ResourceManager.GetObject("inactive_close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap inactive_close_selected { + get { + object obj = ResourceManager.GetObject("inactive_close_selected", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap tw_active_close { + get { + object obj = ResourceManager.GetObject("tw_active_close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap tw_active_close_selected { + get { + object obj = ResourceManager.GetObject("tw_active_close_selected", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap tw_close { + get { + object obj = ResourceManager.GetObject("tw_close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap tw_close_selected { + get { + object obj = ResourceManager.GetObject("tw_close_selected", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DarkUI/Icons/DockIcons.resx b/DarkUI/Icons/DockIcons.resx new file mode 100644 index 0000000..5c896f8 --- /dev/null +++ b/DarkUI/Icons/DockIcons.resx @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\active-inactive-close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\close-selected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\inactive-close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\inactive-close-selected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\tw_active_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\tw_active_close_selected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\tw_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\tw_close_selected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DarkUI/Icons/MenuIcons.Designer.cs b/DarkUI/Icons/MenuIcons.Designer.cs new file mode 100644 index 0000000..ac95917 --- /dev/null +++ b/DarkUI/Icons/MenuIcons.Designer.cs @@ -0,0 +1,83 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DarkUI.Icons { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class MenuIcons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MenuIcons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DarkUI.Icons.MenuIcons", typeof(MenuIcons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap grip { + get { + object obj = ResourceManager.GetObject("grip", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap tick { + get { + object obj = ResourceManager.GetObject("tick", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DarkUI/Icons/MenuIcons.resx b/DarkUI/Icons/MenuIcons.resx new file mode 100644 index 0000000..3c66e3c --- /dev/null +++ b/DarkUI/Icons/MenuIcons.resx @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\grip.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\tick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DarkUI/Icons/MessageBoxIcons.Designer.cs b/DarkUI/Icons/MessageBoxIcons.Designer.cs new file mode 100644 index 0000000..53720f4 --- /dev/null +++ b/DarkUI/Icons/MessageBoxIcons.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DarkUI.Icons { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MessageBoxIcons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MessageBoxIcons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DarkUI.Icons.MessageBoxIcons", typeof(MessageBoxIcons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap error { + get { + object obj = ResourceManager.GetObject("error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap info { + get { + object obj = ResourceManager.GetObject("info", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap warning { + get { + object obj = ResourceManager.GetObject("warning", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DarkUI/Icons/MessageBoxIcons.resx b/DarkUI/Icons/MessageBoxIcons.resx new file mode 100644 index 0000000..3303bd4 --- /dev/null +++ b/DarkUI/Icons/MessageBoxIcons.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\info.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DarkUI/Icons/ScrollIcons.Designer.cs b/DarkUI/Icons/ScrollIcons.Designer.cs new file mode 100644 index 0000000..1d297f4 --- /dev/null +++ b/DarkUI/Icons/ScrollIcons.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DarkUI.Icons { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class ScrollIcons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal ScrollIcons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DarkUI.Icons.ScrollIcons", typeof(ScrollIcons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap scrollbar_arrow { + get { + object obj = ResourceManager.GetObject("scrollbar_arrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap scrollbar_arrow_clicked { + get { + object obj = ResourceManager.GetObject("scrollbar_arrow_clicked", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap scrollbar_arrow_hot { + get { + object obj = ResourceManager.GetObject("scrollbar_arrow_hot", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap scrollbar_arrow_standard { + get { + object obj = ResourceManager.GetObject("scrollbar_arrow_standard", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DarkUI/Icons/ScrollIcons.resx b/DarkUI/Icons/ScrollIcons.resx new file mode 100644 index 0000000..8e8374b --- /dev/null +++ b/DarkUI/Icons/ScrollIcons.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\scrollbar_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\scrollbar_arrow_clicked.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\scrollbar_arrow_hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\scrollbar_arrow_standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DarkUI/Icons/TreeViewIcons.Designer.cs b/DarkUI/Icons/TreeViewIcons.Designer.cs new file mode 100644 index 0000000..4604e37 --- /dev/null +++ b/DarkUI/Icons/TreeViewIcons.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DarkUI.Icons { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class TreeViewIcons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal TreeViewIcons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DarkUI.Icons.TreeViewIcons", typeof(TreeViewIcons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap node_closed_empty { + get { + object obj = ResourceManager.GetObject("node_closed_empty", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap node_closed_full { + get { + object obj = ResourceManager.GetObject("node_closed_full", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap node_open { + get { + object obj = ResourceManager.GetObject("node_open", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap node_open_empty { + get { + object obj = ResourceManager.GetObject("node_open_empty", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DarkUI/Icons/TreeViewIcons.resx b/DarkUI/Icons/TreeViewIcons.resx new file mode 100644 index 0000000..304cb01 --- /dev/null +++ b/DarkUI/Icons/TreeViewIcons.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\node_closed_empty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\node_closed_full.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\node_open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\node_open_empty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DarkUI/Properties/AssemblyInfo.cs b/DarkUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f648242 --- /dev/null +++ b/DarkUI/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dark UI")] +[assembly: AssemblyDescription("Dark themed control and docking library for .NET WinForms.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Robin Perris")] +[assembly: AssemblyProduct("Dark UI")] +[assembly: AssemblyCopyright("Copyright © Robin Perris")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f19472f5-8c44-4c51-a8a0-b9de5f555255")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DarkUI/Renderers/DarkMenuRenderer.cs b/DarkUI/Renderers/DarkMenuRenderer.cs new file mode 100644 index 0000000..9997e66 --- /dev/null +++ b/DarkUI/Renderers/DarkMenuRenderer.cs @@ -0,0 +1,139 @@ +using DarkUI.Config; +using DarkUI.Icons; +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Renderers +{ + public class DarkMenuRenderer : ToolStripRenderer + { + #region Initialisation Region + + protected override void Initialize(ToolStrip toolStrip) + { + base.Initialize(toolStrip); + + toolStrip.BackColor = Colors.GreyBackground; + toolStrip.ForeColor = Colors.LightText; + } + + protected override void InitializeItem(ToolStripItem item) + { + base.InitializeItem(item); + + item.ForeColor = Colors.LightText; + + if (item.GetType() == typeof(ToolStripSeparator)) + { + item.Margin = new Padding(0, 0, 0, 1); + } + } + + #endregion + + #region Render Region + + protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) + { + var g = e.Graphics; + using (var b = new SolidBrush(Colors.GreyBackground)) + { + g.FillRectangle(b, e.AffectedBounds); + } + } + + protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) + { + var g = e.Graphics; + + var rect = new Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1); + + using (var p = new Pen(Colors.LightBorder)) + { + g.DrawRectangle(p, rect); + } + } + + protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) + { + var g = e.Graphics; + + var rect = new Rectangle(e.ImageRectangle.Left - 2, e.ImageRectangle.Top - 2, + e.ImageRectangle.Width + 4, e.ImageRectangle.Height + 4); + + using (var b = new SolidBrush(Colors.LightBorder)) + { + g.FillRectangle(b, rect); + } + + using (var p = new Pen(Colors.BlueHighlight)) + { + var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1); + g.DrawRectangle(p, modRect); + } + + if (e.Item.ImageIndex == -1 && String.IsNullOrEmpty(e.Item.ImageKey) && e.Item.Image == null) + { + g.DrawImageUnscaled(MenuIcons.tick, new Point(e.ImageRectangle.Left, e.ImageRectangle.Top)); + } + } + + protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) + { + var g = e.Graphics; + + var rect = new Rectangle(1, 3, e.Item.Width, 1); + + using (var b = new SolidBrush(Colors.LightBorder)) + { + g.FillRectangle(b, rect); + } + } + + protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) + { + e.ArrowColor = Colors.LightText; + e.ArrowRectangle = new Rectangle(new Point(e.ArrowRectangle.Left, e.ArrowRectangle.Top - 1), e.ArrowRectangle.Size); + + base.OnRenderArrow(e); + } + + protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) + { + var g = e.Graphics; + + e.Item.ForeColor = e.Item.Enabled ? Colors.LightText : Colors.DisabledText; + + if (e.Item.Enabled) + { + // Normal item + if (e.Item.Selected) + { + var rect = new Rectangle(2, 0, e.Item.Width - 3, e.Item.Height); + + using (var b = new SolidBrush(Colors.GreySelection)) + { + g.FillRectangle(b, rect); + } + } + + // Header item on open menu + if (e.Item.GetType() == typeof(ToolStripMenuItem)) + { + if (((ToolStripMenuItem)e.Item).DropDown.Visible && e.Item.IsOnDropDown == false) + { + var rect = new Rectangle(2, 0, e.Item.Width - 3, e.Item.Height); + + using (var b = new SolidBrush(Colors.GreySelection)) + { + g.FillRectangle(b, rect); + } + } + } + } + } + + #endregion + } +} diff --git a/DarkUI/Renderers/DarkToolStripRenderer.cs b/DarkUI/Renderers/DarkToolStripRenderer.cs new file mode 100644 index 0000000..334cfe7 --- /dev/null +++ b/DarkUI/Renderers/DarkToolStripRenderer.cs @@ -0,0 +1,198 @@ +using DarkUI.Config; +using DarkUI.Extensions; +using DarkUI.Icons; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Renderers +{ + public class DarkToolStripRenderer : DarkMenuRenderer + { + #region Initialisation Region + + protected override void InitializeItem(ToolStripItem item) + { + base.InitializeItem(item); + + if (item.GetType() == typeof(ToolStripSeparator)) + { + var castItem = (ToolStripSeparator)item; + if (!castItem.IsOnDropDown) + item.Margin = new Padding(0, 0, 2, 0); + } + + if (item.GetType() == typeof(ToolStripButton)) + { + item.AutoSize = false; + item.Size = new Size(24, 24); + } + } + + #endregion + + #region Render Region + + protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) + { + base.OnRenderToolStripBackground(e); + + var g = e.Graphics; + + if (e.ToolStrip.GetType() == typeof(ToolStripOverflow)) + { + using (var p = new Pen(Colors.GreyBackground)) + { + var rect = new Rectangle(e.AffectedBounds.Left, e.AffectedBounds.Top, e.AffectedBounds.Width - 1, e.AffectedBounds.Height - 1); + g.DrawRectangle(p, rect); + } + } + } + + protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) + { + if (e.ToolStrip.GetType() != typeof(ToolStrip)) + base.OnRenderToolStripBorder(e); + } + + protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e) + { + var g = e.Graphics; + + var rect = new Rectangle(0, 1, e.Item.Width, e.Item.Height - 2); + + if (e.Item.Selected || e.Item.Pressed) + { + using (var b = new SolidBrush(Colors.GreySelection)) + { + g.FillRectangle(b, rect); + } + } + + if (e.Item.GetType() == typeof(ToolStripButton)) + { + var castItem = (ToolStripButton)e.Item; + + if (castItem.Checked) + { + using (var b = new SolidBrush(Colors.GreySelection)) + { + g.FillRectangle(b, rect); + } + } + + if (castItem.Checked && castItem.Selected) + { + var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1); + using (var p = new Pen(Colors.GreyHighlight)) + { + g.DrawRectangle(p, modRect); + } + } + } + } + + protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e) + { + var g = e.Graphics; + + var rect = new Rectangle(0, 1, e.Item.Width, e.Item.Height - 2); + + if (e.Item.Selected || e.Item.Pressed) + { + using (var b = new SolidBrush(Colors.GreySelection)) + { + g.FillRectangle(b, rect); + } + } + } + + protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) + { + if (e.GripStyle == ToolStripGripStyle.Hidden) + return; + + var g = e.Graphics; + + using (var img = MenuIcons.grip.SetColor(Colors.LightBorder)) + { + g.DrawImageUnscaled(img, new Point(e.AffectedBounds.Left, e.AffectedBounds.Top)); + } + } + + protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) + { + var g = e.Graphics; + + var castItem = (ToolStripSeparator)e.Item; + if (castItem.IsOnDropDown) + { + base.OnRenderSeparator(e); + return; + } + + var rect = new Rectangle(3, 3, 2, e.Item.Height - 4); + + using (var p = new Pen(Colors.DarkBorder)) + { + g.DrawLine(p, rect.Left, rect.Top, rect.Left, rect.Height); + } + + using (var p = new Pen(Colors.LightBorder)) + { + g.DrawLine(p, rect.Left + 1, rect.Top, rect.Left + 1, rect.Height); + } + } + + protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) + { + var g = e.Graphics; + + if (e.Image == null) + return; + + if (e.Item.Enabled) + g.DrawImageUnscaled(e.Image, new Point(e.ImageRectangle.Left, e.ImageRectangle.Top)); + else + ControlPaint.DrawImageDisabled(g, e.Image, e.ImageRectangle.Left, e.ImageRectangle.Top, Color.Transparent); + } + + protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e) + { + /*var g = e.Graphics; + + var rect = new Rectangle(1, 0, e.Item.Width - 5, e.Item.Height); + + var castItem = (ToolStripOverflowButton)e.Item; + + var bgColor = BasicColors.White; + if (castItem.Selected) + bgColor = StyleColors.Weak(style); + if (castItem.Pressed) + bgColor = StyleColors.Medium(style); + + using (var b = new SolidBrush(bgColor)) + { + g.FillRectangle(b, rect); + } + + var fgColor = BasicColors.Grey; + if (castItem.Selected) + fgColor = StyleColors.Medium(style); + if (castItem.Pressed) + fgColor = StyleColors.Strong(style); + + using (var p = new Pen(fgColor)) + { + var modRect = new Rectangle(1, 0, e.Item.Width - 6, e.Item.Height - 1); + g.DrawRectangle(p, modRect); + } + + using (var img = MenuIcons.overflow.SetColor(BasicColors.MediumGrey)) + { + g.DrawImageUnscaled(img, e.Item.Width - 13, e.Item.Height - 9); + }*/ + } + + #endregion + } +} \ No newline at end of file diff --git a/DarkUI/Resources/active-inactive-close.png b/DarkUI/Resources/active-inactive-close.png new file mode 100644 index 0000000..3a72b34 Binary files /dev/null and b/DarkUI/Resources/active-inactive-close.png differ diff --git a/DarkUI/Resources/arrow.png b/DarkUI/Resources/arrow.png new file mode 100644 index 0000000..cdd52f8 Binary files /dev/null and b/DarkUI/Resources/arrow.png differ diff --git a/DarkUI/Resources/close-selected.png b/DarkUI/Resources/close-selected.png new file mode 100644 index 0000000..a179c69 Binary files /dev/null and b/DarkUI/Resources/close-selected.png differ diff --git a/DarkUI/Resources/close.png b/DarkUI/Resources/close.png new file mode 100644 index 0000000..4809afa Binary files /dev/null and b/DarkUI/Resources/close.png differ diff --git a/DarkUI/Resources/error.png b/DarkUI/Resources/error.png new file mode 100644 index 0000000..7d96891 Binary files /dev/null and b/DarkUI/Resources/error.png differ diff --git a/DarkUI/Resources/grip.png b/DarkUI/Resources/grip.png new file mode 100644 index 0000000..8ce65f6 Binary files /dev/null and b/DarkUI/Resources/grip.png differ diff --git a/DarkUI/Resources/inactive-close-selected.png b/DarkUI/Resources/inactive-close-selected.png new file mode 100644 index 0000000..2a21b67 Binary files /dev/null and b/DarkUI/Resources/inactive-close-selected.png differ diff --git a/DarkUI/Resources/inactive-close.png b/DarkUI/Resources/inactive-close.png new file mode 100644 index 0000000..d985a14 Binary files /dev/null and b/DarkUI/Resources/inactive-close.png differ diff --git a/DarkUI/Resources/info.png b/DarkUI/Resources/info.png new file mode 100644 index 0000000..0a22e72 Binary files /dev/null and b/DarkUI/Resources/info.png differ diff --git a/DarkUI/Resources/node_closed_empty.png b/DarkUI/Resources/node_closed_empty.png new file mode 100644 index 0000000..5da8192 Binary files /dev/null and b/DarkUI/Resources/node_closed_empty.png differ diff --git a/DarkUI/Resources/node_closed_full.png b/DarkUI/Resources/node_closed_full.png new file mode 100644 index 0000000..21a7062 Binary files /dev/null and b/DarkUI/Resources/node_closed_full.png differ diff --git a/DarkUI/Resources/node_open.png b/DarkUI/Resources/node_open.png new file mode 100644 index 0000000..a9addef Binary files /dev/null and b/DarkUI/Resources/node_open.png differ diff --git a/DarkUI/Resources/node_open_empty.png b/DarkUI/Resources/node_open_empty.png new file mode 100644 index 0000000..b73c8b3 Binary files /dev/null and b/DarkUI/Resources/node_open_empty.png differ diff --git a/DarkUI/Resources/scrollbar_arrow.png b/DarkUI/Resources/scrollbar_arrow.png new file mode 100644 index 0000000..738e01b Binary files /dev/null and b/DarkUI/Resources/scrollbar_arrow.png differ diff --git a/DarkUI/Resources/scrollbar_arrow_clicked.png b/DarkUI/Resources/scrollbar_arrow_clicked.png new file mode 100644 index 0000000..783ddbe Binary files /dev/null and b/DarkUI/Resources/scrollbar_arrow_clicked.png differ diff --git a/DarkUI/Resources/scrollbar_arrow_hot.png b/DarkUI/Resources/scrollbar_arrow_hot.png new file mode 100644 index 0000000..85c99ac Binary files /dev/null and b/DarkUI/Resources/scrollbar_arrow_hot.png differ diff --git a/DarkUI/Resources/scrollbar_arrow_standard.png b/DarkUI/Resources/scrollbar_arrow_standard.png new file mode 100644 index 0000000..6211702 Binary files /dev/null and b/DarkUI/Resources/scrollbar_arrow_standard.png differ diff --git a/DarkUI/Resources/tick.png b/DarkUI/Resources/tick.png new file mode 100644 index 0000000..de9a6f8 Binary files /dev/null and b/DarkUI/Resources/tick.png differ diff --git a/DarkUI/Resources/tw_active_close.png b/DarkUI/Resources/tw_active_close.png new file mode 100644 index 0000000..382e405 Binary files /dev/null and b/DarkUI/Resources/tw_active_close.png differ diff --git a/DarkUI/Resources/tw_active_close_selected.png b/DarkUI/Resources/tw_active_close_selected.png new file mode 100644 index 0000000..894dc69 Binary files /dev/null and b/DarkUI/Resources/tw_active_close_selected.png differ diff --git a/DarkUI/Resources/tw_close.png b/DarkUI/Resources/tw_close.png new file mode 100644 index 0000000..97eda87 Binary files /dev/null and b/DarkUI/Resources/tw_close.png differ diff --git a/DarkUI/Resources/tw_close_selected.png b/DarkUI/Resources/tw_close_selected.png new file mode 100644 index 0000000..f73bbd4 Binary files /dev/null and b/DarkUI/Resources/tw_close_selected.png differ diff --git a/DarkUI/Resources/warning.png b/DarkUI/Resources/warning.png new file mode 100644 index 0000000..6fbf0ef Binary files /dev/null and b/DarkUI/Resources/warning.png differ diff --git a/DarkUI/Win32/ControlScrollFilter.cs b/DarkUI/Win32/ControlScrollFilter.cs new file mode 100644 index 0000000..191bdf9 --- /dev/null +++ b/DarkUI/Win32/ControlScrollFilter.cs @@ -0,0 +1,26 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Win32 +{ + public class ControlScrollFilter : IMessageFilter + { + public bool PreFilterMessage(ref Message m) + { + switch (m.Msg) + { + case (int)WM.MOUSEWHEEL: + case (int)WM.MOUSEHWHEEL: + var hControlUnderMouse = Native.WindowFromPoint(new Point((int)m.LParam)); + + if (hControlUnderMouse == m.HWnd) + return false; + + Native.SendMessage(hControlUnderMouse, (uint)m.Msg, m.WParam, m.LParam); + return true; + } + + return false; + } + } +} diff --git a/DarkUI/Win32/DockContentDragFilter.cs b/DarkUI/Win32/DockContentDragFilter.cs new file mode 100644 index 0000000..c600c06 --- /dev/null +++ b/DarkUI/Win32/DockContentDragFilter.cs @@ -0,0 +1,258 @@ +using DarkUI.Config; +using DarkUI.Docking; +using DarkUI.Forms; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Win32 +{ + public class DockContentDragFilter : IMessageFilter + { + #region Field Region + + private DarkDockPanel _dockPanel; + + private DarkDockContent _dragContent; + + private DarkTranslucentForm _highlightForm; + + private bool _isDragging = false; + private DarkDockRegion _targetRegion; + private DarkDockGroup _targetGroup; + private DockInsertType _insertType = DockInsertType.None; + + private Dictionary _regionDropAreas = new Dictionary(); + private Dictionary _groupDropAreas = new Dictionary(); + + #endregion + + #region Constructor Region + + public DockContentDragFilter(DarkDockPanel dockPanel) + { + _dockPanel = dockPanel; + + _highlightForm = new DarkTranslucentForm(Colors.BlueSelection); + } + + #endregion + + #region IMessageFilter Region + + public bool PreFilterMessage(ref Message m) + { + // Exit out early if we're not dragging any content + if (!_isDragging) + return false; + + // We only care about mouse events + if (!(m.Msg == (int)WM.MOUSEMOVE || + m.Msg == (int)WM.LBUTTONDOWN || m.Msg == (int)WM.LBUTTONUP || m.Msg == (int)WM.LBUTTONDBLCLK || + m.Msg == (int)WM.RBUTTONDOWN || m.Msg == (int)WM.RBUTTONUP || m.Msg == (int)WM.RBUTTONDBLCLK)) + return false; + + // Move content + if (m.Msg == (int)WM.MOUSEMOVE) + { + HandleDrag(); + return false; + } + + // Drop content + if (m.Msg == (int)WM.LBUTTONUP) + { + if (_targetRegion != null) + { + _dockPanel.RemoveContent(_dragContent); + _dragContent.DockArea = _targetRegion.DockArea; + _dockPanel.AddContent(_dragContent); + } + else if (_targetGroup != null) + { + _dockPanel.RemoveContent(_dragContent); + + switch (_insertType) + { + case DockInsertType.None: + _dockPanel.AddContent(_dragContent, _targetGroup); + break; + + case DockInsertType.Before: + case DockInsertType.After: + _dockPanel.InsertContent(_dragContent, _targetGroup, _insertType); + break; + } + } + + StopDrag(); + return false; + } + + return true; + } + + #endregion + + #region Method Region + + public void StartDrag(DarkDockContent content) + { + _regionDropAreas = new Dictionary(); + _groupDropAreas = new Dictionary(); + + // Add all regions and groups to the drop collections + foreach (var region in _dockPanel.Regions.Values) + { + if (region.DockArea == DarkDockArea.Document) + continue; + + // If the region is visible then build drop areas for the groups. + if (region.Visible) + { + foreach (var group in region.Groups) + { + var collection = new DockDropCollection(_dockPanel, group); + _groupDropAreas.Add(group, collection); + } + } + // If the region is NOT visible then build the drop area for the region itself. + else + { + var area = new DockDropArea(_dockPanel, region); + _regionDropAreas.Add(region, area); + } + } + + _dragContent = content; + _isDragging = true; + } + + private void StopDrag() + { + Cursor.Current = Cursors.Default; + + _highlightForm.Hide(); + _dragContent = null; + _isDragging = false; + } + + private void UpdateHighlightForm(Rectangle rect) + { + Cursor.Current = Cursors.SizeAll; + + _highlightForm.SuspendLayout(); + + _highlightForm.Size = new Size(rect.Width, rect.Height); + _highlightForm.Location = new Point(rect.X, rect.Y); + + _highlightForm.ResumeLayout(); + + if (!_highlightForm.Visible) + { + _highlightForm.Show(); + _highlightForm.BringToFront(); + } + } + + private void HandleDrag() + { + var location = Cursor.Position; + + _insertType = DockInsertType.None; + + _targetRegion = null; + _targetGroup = null; + + // Check all region drop areas + foreach (var area in _regionDropAreas.Values) + { + if (area.DropArea.Contains(location)) + { + _insertType = DockInsertType.None; + _targetRegion = area.DockRegion; + UpdateHighlightForm(area.HighlightArea); + return; + } + } + + // Check all group drop areas + foreach (var collection in _groupDropAreas.Values) + { + var sameRegion = false; + var sameGroup = false; + var groupHasOtherContent = false; + + if (collection.DropArea.DockGroup == _dragContent.DockGroup) + sameGroup = true; + + if (collection.DropArea.DockGroup.DockRegion == _dragContent.DockRegion) + sameRegion = true; + + if (_dragContent.DockGroup.ContentCount > 1) + groupHasOtherContent = true; + + // If we're hovering over the group itself, only allow inserting before/after if multiple content is tabbed. + if (!sameGroup || groupHasOtherContent) + { + var skipBefore = false; + var skipAfter = false; + + // Inserting before/after other content might cause the content to be dropped on to its own location. + // Check if the group above/below the hovered group contains our drag content. + if (sameRegion && !groupHasOtherContent) + { + if (collection.InsertBeforeArea.DockGroup.Order == _dragContent.DockGroup.Order + 1) + skipBefore = true; + + if (collection.InsertAfterArea.DockGroup.Order == _dragContent.DockGroup.Order - 1) + skipAfter = true; + } + + if (!skipBefore) + { + if (collection.InsertBeforeArea.DropArea.Contains(location)) + { + _insertType = DockInsertType.Before; + _targetGroup = collection.InsertBeforeArea.DockGroup; + UpdateHighlightForm(collection.InsertBeforeArea.HighlightArea); + return; + } + } + + if (!skipAfter) + { + if (collection.InsertAfterArea.DropArea.Contains(location)) + { + _insertType = DockInsertType.After; + _targetGroup = collection.InsertAfterArea.DockGroup; + UpdateHighlightForm(collection.InsertAfterArea.HighlightArea); + return; + } + } + } + + // Don't allow content to be dragged on to itself + if (!sameGroup) + { + if (collection.DropArea.DropArea.Contains(location)) + { + _insertType = DockInsertType.None; + _targetGroup = collection.DropArea.DockGroup; + UpdateHighlightForm(collection.DropArea.HighlightArea); + return; + } + } + } + + // Not hovering over anything - hide the highlight + if (_highlightForm.Visible) + _highlightForm.Hide(); + + // Show we can't drag here + Cursor.Current = Cursors.No; + } + + #endregion + } +} diff --git a/DarkUI/Win32/DockResizeFilter.cs b/DarkUI/Win32/DockResizeFilter.cs new file mode 100644 index 0000000..2954c43 --- /dev/null +++ b/DarkUI/Win32/DockResizeFilter.cs @@ -0,0 +1,174 @@ +using DarkUI.Docking; +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Win32 +{ + public class DockResizeFilter : IMessageFilter + { + #region Field Region + + private DarkDockPanel _dockPanel; + + private Timer _dragTimer; + private bool _isDragging; + private Point _initialContact; + private DarkDockSplitter _activeSplitter; + + #endregion + + #region Constructor Region + + public DockResizeFilter(DarkDockPanel dockPanel) + { + _dockPanel = dockPanel; + + _dragTimer = new Timer(); + _dragTimer.Interval = 1; + _dragTimer.Tick += DragTimer_Tick; + } + + #endregion + + #region IMessageFilter Region + + public bool PreFilterMessage(ref Message m) + { + // We only care about mouse events + if (!(m.Msg == (int)WM.MOUSEMOVE || + m.Msg == (int)WM.LBUTTONDOWN || m.Msg == (int)WM.LBUTTONUP || m.Msg == (int)WM.LBUTTONDBLCLK || + m.Msg == (int)WM.RBUTTONDOWN || m.Msg == (int)WM.RBUTTONUP || m.Msg == (int)WM.RBUTTONDBLCLK)) + return false; + + // Stop drag. + if (m.Msg == (int)WM.LBUTTONUP) + { + if (_isDragging) + { + StopDrag(); + return true; + } + } + + // Exit out early if we're simply releasing a non-splitter drag over the area + if (m.Msg == (int)WM.LBUTTONUP && !_isDragging) + return false; + + // Force cursor if already dragging. + if (_isDragging) + Cursor.Current = _activeSplitter.ResizeCursor; + + // Return out early if we're dragging something that's not a splitter. + if (m.Msg == (int)WM.MOUSEMOVE && !_isDragging && _dockPanel.MouseButtonState != MouseButtons.None) + return false; + + // Try and create a control from the message handle. + var control = Control.FromHandle(m.HWnd); + + // Exit out if we didn't manage to create a control. + if (control == null) + return false; + + // Exit out if the control is not the dock panel or a child control. + if (!(control == _dockPanel || _dockPanel.Contains(control))) + return false; + + // Update the mouse cursor + CheckCursor(); + + // Start drag. + if (m.Msg == (int)WM.LBUTTONDOWN) + { + var hotSplitter = HotSplitter(); + if (hotSplitter != null) + { + StartDrag(hotSplitter); + return true; + } + } + + // Stop events passing through if we're hovering over a splitter + if (HotSplitter() != null) + return true; + + // Stop all events from going through if we're dragging a splitter. + if (_isDragging) + return true; + + return false; + } + + #endregion + + #region Event Handler Region + + private void DragTimer_Tick(object sender, EventArgs e) + { + if (_dockPanel.MouseButtonState != MouseButtons.Left) + { + StopDrag(); + return; + } + + var difference = new Point(_initialContact.X - Cursor.Position.X, _initialContact.Y - Cursor.Position.Y); + _activeSplitter.UpdateOverlay(difference); + } + + #endregion + + #region Method Region + + private void StartDrag(DarkDockSplitter splitter) + { + _activeSplitter = splitter; + Cursor.Current = _activeSplitter.ResizeCursor; + + _initialContact = Cursor.Position; + _isDragging = true; + + _activeSplitter.ShowOverlay(); + _dragTimer.Start(); + } + + private void StopDrag() + { + _dragTimer.Stop(); + _activeSplitter.HideOverlay(); + + var difference = new Point(_initialContact.X - Cursor.Position.X, _initialContact.Y - Cursor.Position.Y); + _activeSplitter.Move(difference); + + _isDragging = false; + } + + private DarkDockSplitter HotSplitter() + { + foreach (var splitter in _dockPanel.Splitters) + { + if (splitter.Bounds.Contains(Cursor.Position)) + return splitter; + } + + return null; + } + + private void CheckCursor() + { + if (_isDragging) + return; + + var hotSplitter = HotSplitter(); + if (hotSplitter != null) + Cursor.Current = hotSplitter.ResizeCursor; + } + + private void ResetCursor() + { + Cursor.Current = Cursors.Default; + CheckCursor(); + } + + #endregion + } +} \ No newline at end of file diff --git a/DarkUI/Win32/Native.cs b/DarkUI/Win32/Native.cs new file mode 100644 index 0000000..db5517e --- /dev/null +++ b/DarkUI/Win32/Native.cs @@ -0,0 +1,15 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +namespace DarkUI.Win32 +{ + internal sealed class Native + { + [DllImport("user32.dll")] + internal static extern IntPtr WindowFromPoint(Point point); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + internal static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam); + } +} diff --git a/DarkUI/Win32/WindowsMessages.cs b/DarkUI/Win32/WindowsMessages.cs new file mode 100644 index 0000000..3c00948 --- /dev/null +++ b/DarkUI/Win32/WindowsMessages.cs @@ -0,0 +1,1199 @@ +using System; + +namespace DarkUI.Win32 +{ + /// + /// Windows Messages + /// Defined in winuser.h from Windows SDK v6.1 + /// Documentation pulled from MSDN. + /// + internal enum WM : uint + { + /// + /// The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore. + /// + NULL = 0x0000, + + /// + /// The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible. + /// + CREATE = 0x0001, + + /// + /// The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. + /// This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist. + /// /// + DESTROY = 0x0002, + + /// + /// The WM_MOVE message is sent after a window has been moved. + /// + MOVE = 0x0003, + + /// + /// The WM_SIZE message is sent to a window after its size has changed. + /// + SIZE = 0x0005, + + /// + /// The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately. + /// + ACTIVATE = 0x0006, + + /// + /// The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. + /// + SETFOCUS = 0x0007, + + /// + /// The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. + /// + KILLFOCUS = 0x0008, + + /// + /// The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. + /// + ENABLE = 0x000A, + + /// + /// An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn. + /// + SETREDRAW = 0x000B, + + /// + /// An application sends a WM_SETTEXT message to set the text of a window. + /// + SETTEXT = 0x000C, + + /// + /// An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. + /// + GETTEXT = 0x000D, + + /// + /// An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. + /// + GETTEXTLENGTH = 0x000E, + + /// + /// The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function. + /// + PAINT = 0x000F, + + /// + /// The WM_CLOSE message is sent as a signal that a window or an application should terminate. + /// + CLOSE = 0x0010, + + /// + /// The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero. + /// After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message. + /// + QUERYENDSESSION = 0x0011, + + /// + /// The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position. + /// + QUERYOPEN = 0x0013, + + /// + /// The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending. + /// + ENDSESSION = 0x0016, + + /// + /// The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero. + /// + QUIT = 0x0012, + + /// + /// The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting. + /// + ERASEBKGND = 0x0014, + + /// + /// This message is sent to all top-level windows when a change is made to a system color setting. + /// + SYSCOLORCHANGE = 0x0015, + + /// + /// The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. + /// + SHOWWINDOW = 0x0018, + + /// + /// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI. + /// Note The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message. + /// + WININICHANGE = 0x001A, + + /// + /// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI. + /// Note The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message. + /// + SETTINGCHANGE = WININICHANGE, + + /// + /// The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings. + /// + DEVMODECHANGE = 0x001B, + + /// + /// The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated. + /// + ACTIVATEAPP = 0x001C, + + /// + /// An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources. + /// + FONTCHANGE = 0x001D, + + /// + /// A message that is sent whenever there is a change in the system time. + /// + TIMECHANGE = 0x001E, + + /// + /// The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window. + /// + CANCELMODE = 0x001F, + + /// + /// The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured. + /// + SETCURSOR = 0x0020, + + /// + /// The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function. + /// + MOUSEACTIVATE = 0x0021, + + /// + /// The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized. + /// + CHILDACTIVATE = 0x0022, + + /// + /// The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure. + /// + QUEUESYNC = 0x0023, + + /// + /// The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size. + /// + GETMINMAXINFO = 0x0024, + + /// + /// Windows NT 3.51 and earlier: The WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Microsoft Windows, except in unusual circumstances explained in the Remarks. + /// + PAINTICON = 0x0026, + + /// + /// Windows NT 3.51 and earlier: The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows. + /// + ICONERASEBKGND = 0x0027, + + /// + /// The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box. + /// + NEXTDLGCTL = 0x0028, + + /// + /// The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. + /// + SPOOLERSTATUS = 0x002A, + + /// + /// The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed. + /// + DRAWITEM = 0x002B, + + /// + /// The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created. + /// + MEASUREITEM = 0x002C, + + /// + /// Sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data. + /// + DELETEITEM = 0x002D, + + /// + /// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message. + /// + VKEYTOITEM = 0x002E, + + /// + /// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. + /// + CHARTOITEM = 0x002F, + + /// + /// An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text. + /// + SETFONT = 0x0030, + + /// + /// An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text. + /// + GETFONT = 0x0031, + + /// + /// An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window. + /// + SETHOTKEY = 0x0032, + + /// + /// An application sends a WM_GETHOTKEY message to determine the hot key associated with a window. + /// + GETHOTKEY = 0x0033, + + /// + /// The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon. + /// + QUERYDRAGICON = 0x0037, + + /// + /// The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style. + /// + COMPAREITEM = 0x0039, + + /// + /// Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application. + /// Applications never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications handle this message. + /// + GETOBJECT = 0x003D, + + /// + /// The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low. + /// + COMPACTING = 0x0041, + + /// + /// WM_COMMNOTIFY is Obsolete for Win32-Based Applications + /// + [Obsolete] + COMMNOTIFY = 0x0044, + + /// + /// The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function. + /// + WINDOWPOSCHANGING = 0x0046, + + /// + /// The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function. + /// + WINDOWPOSCHANGED = 0x0047, + + /// + /// Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode. + /// Use: POWERBROADCAST + /// + [Obsolete] + POWER = 0x0048, + + /// + /// An application sends the WM_COPYDATA message to pass data to another application. + /// + COPYDATA = 0x004A, + + /// + /// The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle. + /// + CANCELJOURNAL = 0x004B, + + /// + /// Sent by a common control to its parent window when an event has occurred or the control requires some information. + /// + NOTIFY = 0x004E, + + /// + /// The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately. + /// + INPUTLANGCHANGEREQUEST = 0x0050, + + /// + /// The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on. + /// + INPUTLANGCHANGE = 0x0051, + + /// + /// Sent to an application that has initiated a training card with Microsoft Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function. + /// + TCARD = 0x0052, + + /// + /// Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window. + /// + HELP = 0x0053, + + /// + /// The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings. + /// + USERCHANGED = 0x0054, + + /// + /// Determines if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control. + /// + NOTIFYFORMAT = 0x0055, + + /// + /// The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right-clicked) in the window. + /// + CONTEXTMENU = 0x007B, + + /// + /// The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles. + /// + STYLECHANGING = 0x007C, + + /// + /// The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles + /// + STYLECHANGED = 0x007D, + + /// + /// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed. + /// + DISPLAYCHANGE = 0x007E, + + /// + /// The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption. + /// + GETICON = 0x007F, + + /// + /// An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption. + /// + SETICON = 0x0080, + + /// + /// The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created. + /// + NCCREATE = 0x0081, + + /// + /// The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window. + /// The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast, WM_DESTROY is sent before the child windows are destroyed. + /// + NCDESTROY = 0x0082, + + /// + /// The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes. + /// + NCCALCSIZE = 0x0083, + + /// + /// The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse. + /// + NCHITTEST = 0x0084, + + /// + /// The WM_NCPAINT message is sent to a window when its frame must be painted. + /// + NCPAINT = 0x0085, + + /// + /// The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state. + /// + NCACTIVATE = 0x0086, + + /// + /// The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself. + /// + GETDLGCODE = 0x0087, + + /// + /// The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads. + /// + SYNCPAINT = 0x0088, + + /// + /// The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCMOUSEMOVE = 0x00A0, + + /// + /// The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCLBUTTONDOWN = 0x00A1, + + /// + /// The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCLBUTTONUP = 0x00A2, + + /// + /// The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCLBUTTONDBLCLK = 0x00A3, + + /// + /// The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCRBUTTONDOWN = 0x00A4, + + /// + /// The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCRBUTTONUP = 0x00A5, + + /// + /// The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCRBUTTONDBLCLK = 0x00A6, + + /// + /// The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCMBUTTONDOWN = 0x00A7, + + /// + /// The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCMBUTTONUP = 0x00A8, + + /// + /// The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCMBUTTONDBLCLK = 0x00A9, + + /// + /// The WM_NCXBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCXBUTTONDOWN = 0x00AB, + + /// + /// The WM_NCXBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCXBUTTONUP = 0x00AC, + + /// + /// The WM_NCXBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. + /// + NCXBUTTONDBLCLK = 0x00AD, + + /// + /// The WM_INPUT_DEVICE_CHANGE message is sent to the window that registered to receive raw input. A window receives this message through its WindowProc function. + /// + INPUT_DEVICE_CHANGE = 0x00FE, + + /// + /// The WM_INPUT message is sent to the window that is getting raw input. + /// + INPUT = 0x00FF, + + /// + /// This message filters for keyboard messages. + /// + KEYFIRST = 0x0100, + + /// + /// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. + /// + KEYDOWN = 0x0100, + + /// + /// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus. + /// + KEYUP = 0x0101, + + /// + /// The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed. + /// + CHAR = 0x0102, + + /// + /// The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key. + /// + DEADCHAR = 0x0103, + + /// + /// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. + /// + SYSKEYDOWN = 0x0104, + + /// + /// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. + /// + SYSKEYUP = 0x0105, + + /// + /// The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down. + /// + SYSCHAR = 0x0106, + + /// + /// The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key. + /// + SYSDEADCHAR = 0x0107, + + /// + /// The WM_UNICHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_UNICHAR message contains the character code of the key that was pressed. + /// The WM_UNICHAR message is equivalent to WM_CHAR, but it uses Unicode Transformation Format (UTF)-32, whereas WM_CHAR uses UTF-16. It is designed to send or post Unicode characters to ANSI windows and it can can handle Unicode Supplementary Plane characters. + /// + UNICHAR = 0x0109, + + /// + /// This message filters for keyboard messages. + /// + KEYLAST = 0x0109, + + /// + /// Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this message through its WindowProc function. + /// + IME_STARTCOMPOSITION = 0x010D, + + /// + /// Sent to an application when the IME ends composition. A window receives this message through its WindowProc function. + /// + IME_ENDCOMPOSITION = 0x010E, + + /// + /// Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this message through its WindowProc function. + /// + IME_COMPOSITION = 0x010F, + IME_KEYLAST = 0x010F, + + /// + /// The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. + /// + INITDIALOG = 0x0110, + + /// + /// The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. + /// + COMMAND = 0x0111, + + /// + /// A window receives this message when the user chooses a command from the Window menu, clicks the maximize button, minimize button, restore button, close button, or moves the form. You can stop the form from moving by filtering this out. + /// + SYSCOMMAND = 0x0112, + + /// + /// The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function. + /// + TIMER = 0x0113, + + /// + /// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control. + /// + HSCROLL = 0x0114, + + /// + /// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control. + /// + VSCROLL = 0x0115, + + /// + /// The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed. + /// + INITMENU = 0x0116, + + /// + /// The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu. + /// + INITMENUPOPUP = 0x0117, + + /// + /// The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item. + /// + MENUSELECT = 0x011F, + + /// + /// The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu. + /// + MENUCHAR = 0x0120, + + /// + /// The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages. + /// + ENTERIDLE = 0x0121, + + /// + /// The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item. + /// + MENURBUTTONUP = 0x0122, + + /// + /// The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item. + /// + MENUDRAG = 0x0123, + + /// + /// The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item. + /// + MENUGETOBJECT = 0x0124, + + /// + /// The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed. + /// + UNINITMENUPOPUP = 0x0125, + + /// + /// The WM_MENUCOMMAND message is sent when the user makes a selection from a menu. + /// + MENUCOMMAND = 0x0126, + + /// + /// An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed. + /// + CHANGEUISTATE = 0x0127, + + /// + /// An application sends the WM_UPDATEUISTATE message to change the user interface (UI) state for the specified window and all its child windows. + /// + UPDATEUISTATE = 0x0128, + + /// + /// An application sends the WM_QUERYUISTATE message to retrieve the user interface (UI) state for a window. + /// + QUERYUISTATE = 0x0129, + + /// + /// The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle. + /// + CTLCOLORMSGBOX = 0x0132, + + /// + /// An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. + /// + CTLCOLOREDIT = 0x0133, + + /// + /// Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle. + /// + CTLCOLORLISTBOX = 0x0134, + + /// + /// The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message. + /// + CTLCOLORBTN = 0x0135, + + /// + /// The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle. + /// + CTLCOLORDLG = 0x0136, + + /// + /// The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control. + /// + CTLCOLORSCROLLBAR = 0x0137, + + /// + /// A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. + /// + CTLCOLORSTATIC = 0x0138, + + /// + /// Use WM_MOUSEFIRST to specify the first mouse message. Use the PeekMessage() Function. + /// + MOUSEFIRST = 0x0200, + + /// + /// The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + MOUSEMOVE = 0x0200, + + /// + /// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + LBUTTONDOWN = 0x0201, + + /// + /// The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + LBUTTONUP = 0x0202, + + /// + /// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + LBUTTONDBLCLK = 0x0203, + + /// + /// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + RBUTTONDOWN = 0x0204, + + /// + /// The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + RBUTTONUP = 0x0205, + + /// + /// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + RBUTTONDBLCLK = 0x0206, + + /// + /// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + MBUTTONDOWN = 0x0207, + + /// + /// The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + MBUTTONUP = 0x0208, + + /// + /// The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + MBUTTONDBLCLK = 0x0209, + + /// + /// The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it. + /// + MOUSEWHEEL = 0x020A, + + /// + /// The WM_XBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + XBUTTONDOWN = 0x020B, + + /// + /// The WM_XBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + XBUTTONUP = 0x020C, + + /// + /// The WM_XBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + XBUTTONDBLCLK = 0x020D, + + /// + /// The WM_MOUSEHWHEEL message is sent to the focus window when the mouse's horizontal scroll wheel is tilted or rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it. + /// + MOUSEHWHEEL = 0x020E, + + /// + /// Use WM_MOUSELAST to specify the last mouse message. Used with PeekMessage() Function. + /// + MOUSELAST = 0x020E, + + /// + /// The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place. + /// + PARENTNOTIFY = 0x0210, + + /// + /// The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered. + /// + ENTERMENULOOP = 0x0211, + + /// + /// The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited. + /// + EXITMENULOOP = 0x0212, + + /// + /// The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu. + /// + NEXTMENU = 0x0213, + + /// + /// The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position. + /// + SIZING = 0x0214, + + /// + /// The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture. + /// + CAPTURECHANGED = 0x0215, + + /// + /// The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position. + /// + MOVING = 0x0216, + + /// + /// Notifies applications that a power-management event has occurred. + /// + POWERBROADCAST = 0x0218, + + /// + /// Notifies an application of a change to the hardware configuration of a device or the computer. + /// + DEVICECHANGE = 0x0219, + + /// + /// An application sends the WM_MDICREATE message to a multiple-document interface (MDI) client window to create an MDI child window. + /// + MDICREATE = 0x0220, + + /// + /// An application sends the WM_MDIDESTROY message to a multiple-document interface (MDI) client window to close an MDI child window. + /// + MDIDESTROY = 0x0221, + + /// + /// An application sends the WM_MDIACTIVATE message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window. + /// + MDIACTIVATE = 0x0222, + + /// + /// An application sends the WM_MDIRESTORE message to a multiple-document interface (MDI) client window to restore an MDI child window from maximized or minimized size. + /// + MDIRESTORE = 0x0223, + + /// + /// An application sends the WM_MDINEXT message to a multiple-document interface (MDI) client window to activate the next or previous child window. + /// + MDINEXT = 0x0224, + + /// + /// An application sends the WM_MDIMAXIMIZE message to a multiple-document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window. + /// + MDIMAXIMIZE = 0x0225, + + /// + /// An application sends the WM_MDITILE message to a multiple-document interface (MDI) client window to arrange all of its MDI child windows in a tile format. + /// + MDITILE = 0x0226, + + /// + /// An application sends the WM_MDICASCADE message to a multiple-document interface (MDI) client window to arrange all its child windows in a cascade format. + /// + MDICASCADE = 0x0227, + + /// + /// An application sends the WM_MDIICONARRANGE message to a multiple-document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized. + /// + MDIICONARRANGE = 0x0228, + + /// + /// An application sends the WM_MDIGETACTIVE message to a multiple-document interface (MDI) client window to retrieve the handle to the active MDI child window. + /// + MDIGETACTIVE = 0x0229, + + /// + /// An application sends the WM_MDISETMENU message to a multiple-document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both. + /// + MDISETMENU = 0x0230, + + /// + /// The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. + /// The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled. + /// + ENTERSIZEMOVE = 0x0231, + + /// + /// The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. + /// + EXITSIZEMOVE = 0x0232, + + /// + /// Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files. + /// + DROPFILES = 0x0233, + + /// + /// An application sends the WM_MDIREFRESHMENU message to a multiple-document interface (MDI) client window to refresh the window menu of the MDI frame window. + /// + MDIREFRESHMENU = 0x0234, + + /// + /// Sent to an application when a window is activated. A window receives this message through its WindowProc function. + /// + IME_SETCONTEXT = 0x0281, + + /// + /// Sent to an application to notify it of changes to the IME window. A window receives this message through its WindowProc function. + /// + IME_NOTIFY = 0x0282, + + /// + /// Sent by an application to direct the IME window to carry out the requested command. The application uses this message to control the IME window that it has created. To send this message, the application calls the SendMessage function with the following parameters. + /// + IME_CONTROL = 0x0283, + + /// + /// Sent to an application when the IME window finds no space to extend the area for the composition window. A window receives this message through its WindowProc function. + /// + IME_COMPOSITIONFULL = 0x0284, + + /// + /// Sent to an application when the operating system is about to change the current IME. A window receives this message through its WindowProc function. + /// + IME_SELECT = 0x0285, + + /// + /// Sent to an application when the IME gets a character of the conversion result. A window receives this message through its WindowProc function. + /// + IME_CHAR = 0x0286, + + /// + /// Sent to an application to provide commands and request information. A window receives this message through its WindowProc function. + /// + IME_REQUEST = 0x0288, + + /// + /// Sent to an application by the IME to notify the application of a key press and to keep message order. A window receives this message through its WindowProc function. + /// + IME_KEYDOWN = 0x0290, + + /// + /// Sent to an application by the IME to notify the application of a key release and to keep message order. A window receives this message through its WindowProc function. + /// + IME_KEYUP = 0x0291, + + /// + /// The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent. + /// + MOUSEHOVER = 0x02A1, + + /// + /// The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent. + /// + MOUSELEAVE = 0x02A3, + + /// + /// The WM_NCMOUSEHOVER message is posted to a window when the cursor hovers over the nonclient area of the window for the period of time specified in a prior call to TrackMouseEvent. + /// + NCMOUSEHOVER = 0x02A0, + + /// + /// The WM_NCMOUSELEAVE message is posted to a window when the cursor leaves the nonclient area of the window specified in a prior call to TrackMouseEvent. + /// + NCMOUSELEAVE = 0x02A2, + + /// + /// The WM_WTSSESSION_CHANGE message notifies applications of changes in session state. + /// + WTSSESSION_CHANGE = 0x02B1, + TABLET_FIRST = 0x02c0, + TABLET_LAST = 0x02df, + + /// + /// An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format. + /// + CUT = 0x0300, + + /// + /// An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format. + /// + COPY = 0x0301, + + /// + /// An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format. + /// + PASTE = 0x0302, + + /// + /// An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control. + /// + CLEAR = 0x0303, + + /// + /// An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted. + /// + UNDO = 0x0304, + + /// + /// The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function. + /// + RENDERFORMAT = 0x0305, + + /// + /// The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function. + /// + RENDERALLFORMATS = 0x0306, + + /// + /// The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard. + /// + DESTROYCLIPBOARD = 0x0307, + + /// + /// The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard. + /// + DRAWCLIPBOARD = 0x0308, + + /// + /// The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting. + /// + PAINTCLIPBOARD = 0x0309, + + /// + /// The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values. + /// + VSCROLLCLIPBOARD = 0x030A, + + /// + /// The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size. + /// + SIZECLIPBOARD = 0x030B, + + /// + /// The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format. + /// + ASKCBFORMATNAME = 0x030C, + + /// + /// The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain. + /// + CHANGECBCHAIN = 0x030D, + + /// + /// The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values. + /// + HSCROLLCLIPBOARD = 0x030E, + + /// + /// This message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus. + /// + QUERYNEWPALETTE = 0x030F, + + /// + /// The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette. + /// + PALETTEISCHANGING = 0x0310, + + /// + /// This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette. + /// This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas. + /// + PALETTECHANGED = 0x0311, + + /// + /// The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key. + /// + HOTKEY = 0x0312, + + /// + /// The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context. + /// + PRINT = 0x0317, + + /// + /// The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context. + /// + PRINTCLIENT = 0x0318, + + /// + /// The WM_APPCOMMAND message notifies a window that the user generated an application command event, for example, by clicking an application command button using the mouse or typing an application command key on the keyboard. + /// + APPCOMMAND = 0x0319, + + /// + /// The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another. + /// + THEMECHANGED = 0x031A, + + /// + /// Sent when the contents of the clipboard have changed. + /// + CLIPBOARDUPDATE = 0x031D, + + /// + /// The system will send a window the WM_DWMCOMPOSITIONCHANGED message to indicate that the availability of desktop composition has changed. + /// + DWMCOMPOSITIONCHANGED = 0x031E, + + /// + /// WM_DWMNCRENDERINGCHANGED is called when the non-client area rendering status of a window has changed. Only windows that have set the flag DWM_BLURBEHIND.fTransitionOnMaximized to true will get this message. + /// + DWMNCRENDERINGCHANGED = 0x031F, + + /// + /// Sent to all top-level windows when the colorization color has changed. + /// + DWMCOLORIZATIONCOLORCHANGED = 0x0320, + + /// + /// WM_DWMWINDOWMAXIMIZEDCHANGE will let you know when a DWM composed window is maximized. You also have to register for this message as well. You'd have other windowd go opaque when this message is sent. + /// + DWMWINDOWMAXIMIZEDCHANGE = 0x0321, + + /// + /// Sent to request extended title bar information. A window receives this message through its WindowProc function. + /// + GETTITLEBARINFOEX = 0x033F, + HANDHELDFIRST = 0x0358, + HANDHELDLAST = 0x035F, + AFXFIRST = 0x0360, + AFXLAST = 0x037F, + PENWINFIRST = 0x0380, + PENWINLAST = 0x038F, + + /// + /// The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value. + /// + APP = 0x8000, + + /// + /// The WM_USER constant is used by applications to help define private messages for use by private window classes, usually of the form WM_USER+X, where X is an integer value. + /// + USER = 0x0400, + + /// + /// An application sends the WM_CPL_LAUNCH message to Windows Control Panel to request that a Control Panel application be started. + /// + CPL_LAUNCH = USER + 0x1000, + + /// + /// The WM_CPL_LAUNCHED message is sent when a Control Panel application, started by the WM_CPL_LAUNCH message, has closed. The WM_CPL_LAUNCHED message is sent to the window identified by the wParam parameter of the WM_CPL_LAUNCH message that started the application. + /// + CPL_LAUNCHED = USER + 0x1001, + + /// + /// WM_SYSTIMER is a well-known yet still undocumented message. Windows uses WM_SYSTIMER for internal actions like scrolling. + /// + SYSTIMER = 0x118, + + /// + /// The accessibility state has changed. + /// + HSHELL_ACCESSIBILITYSTATE = 11, + + /// + /// The shell should activate its main window. + /// + HSHELL_ACTIVATESHELLWINDOW = 3, + + /// + /// The user completed an input event (for example, pressed an application command button on the mouse or an application command key on the keyboard), and the application did not handle the WM_APPCOMMAND message generated by that input. + /// If the Shell procedure handles the WM_COMMAND message, it should not call CallNextHookEx. See the Return Value section for more information. + /// + HSHELL_APPCOMMAND = 12, + + /// + /// A window is being minimized or maximized. The system needs the coordinates of the minimized rectangle for the window. + /// + HSHELL_GETMINRECT = 5, + + /// + /// Keyboard language was changed or a new keyboard layout was loaded. + /// + HSHELL_LANGUAGE = 8, + + /// + /// The title of a window in the task bar has been redrawn. + /// + HSHELL_REDRAW = 6, + + /// + /// The user has selected the task list. A shell application that provides a task list should return TRUE to prevent Windows from starting its task list. + /// + HSHELL_TASKMAN = 7, + + /// + /// A top-level, unowned window has been created. The window exists when the system calls this hook. + /// + HSHELL_WINDOWCREATED = 1, + + /// + /// A top-level, unowned window is about to be destroyed. The window still exists when the system calls this hook. + /// + HSHELL_WINDOWDESTROYED = 2, + + /// + /// The activation has changed to a different top-level, unowned window. + /// + HSHELL_WINDOWACTIVATED = 4, + + /// + /// A top-level window is being replaced. The window exists when the system calls this hook. + /// + HSHELL_WINDOWREPLACED = 13 + } +} diff --git a/Example/Example.csproj b/Example/Example.csproj new file mode 100644 index 0000000..63bf6be --- /dev/null +++ b/Example/Example.csproj @@ -0,0 +1,213 @@ + + + + + Debug + AnyCPU + {FA334815-6D78-4E9A-9F4D-6C8A58222A57} + WinExe + Properties + Example + Example + v4.0 + 512 + true + Client + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + .\Newtonsoft.Json.dll + + + + + + + + + + Form + + + DialogAbout.cs + + + Form + + + DialogControls.cs + + + UserControl + + + DockDocument.cs + + + UserControl + + + DockConsole.cs + + + UserControl + + + DockHistory.cs + + + UserControl + + + DockLayers.cs + + + UserControl + + + DockProperties.cs + + + UserControl + + + DockProject.cs + + + Form + + + MainForm.cs + + + + True + True + Icons.resx + + + + + DialogAbout.cs + + + DialogControls.cs + + + DockDocument.cs + + + DockConsole.cs + + + DockHistory.cs + + + DockLayers.cs + + + DockProperties.cs + + + DockProject.cs + + + MainForm.cs + + + ResXFileCodeGenerator + Icons.Designer.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {f19472f5-8c44-4c51-a8a0-b9de5f555255} + DarkUI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Example/Forms/Dialogs/DialogAbout.Designer.cs b/Example/Forms/Dialogs/DialogAbout.Designer.cs new file mode 100644 index 0000000..53f5a23 --- /dev/null +++ b/Example/Forms/Dialogs/DialogAbout.Designer.cs @@ -0,0 +1,148 @@ +using DarkUI.Controls; + +namespace Example +{ + partial class DialogAbout + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DialogAbout)); + this.pnlMain = new System.Windows.Forms.Panel(); + this.lblVersion = new DarkLabel(); + this.darkLabel3 = new DarkLabel(); + this.darkLabel2 = new DarkLabel(); + this.darkLabel1 = new DarkLabel(); + this.lblHeader = new DarkLabel(); + this.pnlMain.SuspendLayout(); + this.SuspendLayout(); + // + // pnlMain + // + this.pnlMain.Controls.Add(this.lblVersion); + this.pnlMain.Controls.Add(this.darkLabel3); + this.pnlMain.Controls.Add(this.darkLabel2); + this.pnlMain.Controls.Add(this.darkLabel1); + this.pnlMain.Controls.Add(this.lblHeader); + this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlMain.Location = new System.Drawing.Point(0, 0); + this.pnlMain.Name = "pnlMain"; + this.pnlMain.Padding = new System.Windows.Forms.Padding(15, 15, 15, 5); + this.pnlMain.Size = new System.Drawing.Size(343, 229); + this.pnlMain.TabIndex = 2; + // + // lblVersion + // + this.lblVersion.Dock = System.Windows.Forms.DockStyle.Top; + this.lblVersion.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblVersion.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.lblVersion.Location = new System.Drawing.Point(15, 192); + this.lblVersion.Name = "lblVersion"; + this.lblVersion.Size = new System.Drawing.Size(313, 36); + this.lblVersion.TabIndex = 7; + this.lblVersion.Text = "Version: [version]"; + this.lblVersion.TextAlign = System.Drawing.ContentAlignment.BottomCenter; + // + // darkLabel3 + // + this.darkLabel3.Dock = System.Windows.Forms.DockStyle.Top; + this.darkLabel3.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.darkLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.darkLabel3.Location = new System.Drawing.Point(15, 152); + this.darkLabel3.Name = "darkLabel3"; + this.darkLabel3.Size = new System.Drawing.Size(313, 40); + this.darkLabel3.TabIndex = 6; + this.darkLabel3.Text = "(Also with a hardcoded dark theme because I totally could not figure out a clean " + + "way to have application-wide theme settings... so, you know, if you\'ve got an id" + + "ea, pull request me.)\r\n"; + this.darkLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // darkLabel2 + // + this.darkLabel2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkLabel2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.darkLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.darkLabel2.Location = new System.Drawing.Point(15, 101); + this.darkLabel2.Name = "darkLabel2"; + this.darkLabel2.Size = new System.Drawing.Size(313, 51); + this.darkLabel2.TabIndex = 5; + this.darkLabel2.Text = "Created because of all the little annoyances and issues with the default .NET con" + + "trol library."; + this.darkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // darkLabel1 + // + this.darkLabel1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkLabel1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.darkLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.darkLabel1.Location = new System.Drawing.Point(15, 47); + this.darkLabel1.Name = "darkLabel1"; + this.darkLabel1.Size = new System.Drawing.Size(313, 54); + this.darkLabel1.TabIndex = 4; + this.darkLabel1.Text = "Dark themed control and docking library for .NET WinForms."; + this.darkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblHeader + // + this.lblHeader.Dock = System.Windows.Forms.DockStyle.Top; + this.lblHeader.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.lblHeader.Location = new System.Drawing.Point(15, 15); + this.lblHeader.Name = "lblHeader"; + this.lblHeader.Size = new System.Drawing.Size(313, 32); + this.lblHeader.TabIndex = 3; + this.lblHeader.Text = "Dark UI"; + this.lblHeader.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // DialogAbout + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(343, 274); + this.Controls.Add(this.pnlMain); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DialogAbout"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "About Dark UI"; + this.Controls.SetChildIndex(this.pnlMain, 0); + this.pnlMain.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlMain; + private DarkLabel lblHeader; + private DarkLabel darkLabel1; + private DarkLabel darkLabel3; + private DarkLabel darkLabel2; + private DarkLabel lblVersion; + } +} \ No newline at end of file diff --git a/Example/Forms/Dialogs/DialogAbout.cs b/Example/Forms/Dialogs/DialogAbout.cs new file mode 100644 index 0000000..b33b110 --- /dev/null +++ b/Example/Forms/Dialogs/DialogAbout.cs @@ -0,0 +1,20 @@ +using DarkUI.Forms; +using System.Windows.Forms; + +namespace Example +{ + public partial class DialogAbout : DarkDialog + { + #region Constructor Region + + public DialogAbout() + { + InitializeComponent(); + + lblVersion.Text = $"Version: {Application.ProductVersion.ToString()}"; + btnOk.Text = "Close"; + } + + #endregion + } +} diff --git a/Example/Forms/Dialogs/DialogAbout.resx b/Example/Forms/Dialogs/DialogAbout.resx new file mode 100644 index 0000000..b278dc3 --- /dev/null +++ b/Example/Forms/Dialogs/DialogAbout.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAECAAAAEAIAAuAQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAw0lEQVQ4T92TsQ0C + MQxFswcNm8ECTMA07IF0oqHNDFAhKCKKJGXIOxx08VkgQceXfuP/v+X4fE4j57yOMQ4ppTIlNTSxzVHF + ZTX64XQvq/2lLHbnjtTQ8OCV2BMSDpvDdRbU3B5vNAldE7oiaHODrksTP4Z5F6NpE2ywNDJkHcux3vyJ + ZMgyvmmADZYGyf5Dg3dLbLC01xJ//oygjuKtK2zQ9e6QAGdZC8G6Rk3zlIE0+e5nmoJ3sZxqHLfcSA1N + bALnHokvo216mLOQAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/Example/Forms/Dialogs/DialogControls.Designer.cs b/Example/Forms/Dialogs/DialogControls.Designer.cs new file mode 100644 index 0000000..90598b8 --- /dev/null +++ b/Example/Forms/Dialogs/DialogControls.Designer.cs @@ -0,0 +1,369 @@ +using DarkUI.Controls; + +namespace Example +{ + partial class DialogControls + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DialogControls)); + this.pnlMain = new System.Windows.Forms.Panel(); + this.tblMain = new System.Windows.Forms.TableLayoutPanel(); + this.pnlTreeView = new DarkUI.Controls.DarkSectionPanel(); + this.treeTest = new DarkUI.Controls.DarkTreeView(); + this.pnlListView = new DarkUI.Controls.DarkSectionPanel(); + this.lstTest = new DarkUI.Controls.DarkListView(); + this.pnlMessageBox = new DarkUI.Controls.DarkSectionPanel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel5 = new System.Windows.Forms.Panel(); + this.darkRadioButton3 = new DarkUI.Controls.DarkRadioButton(); + this.darkRadioButton2 = new DarkUI.Controls.DarkRadioButton(); + this.darkRadioButton1 = new DarkUI.Controls.DarkRadioButton(); + this.darkTitle3 = new DarkUI.Controls.DarkTitle(); + this.panel4 = new System.Windows.Forms.Panel(); + this.darkCheckBox2 = new DarkUI.Controls.DarkCheckBox(); + this.darkCheckBox1 = new DarkUI.Controls.DarkCheckBox(); + this.darkTitle2 = new DarkUI.Controls.DarkTitle(); + this.panel3 = new System.Windows.Forms.Panel(); + this.btnMessageBox = new DarkUI.Controls.DarkButton(); + this.panel2 = new System.Windows.Forms.Panel(); + this.btnDialog = new DarkUI.Controls.DarkButton(); + this.darkTitle1 = new DarkUI.Controls.DarkTitle(); + this.pnlMain.SuspendLayout(); + this.tblMain.SuspendLayout(); + this.pnlTreeView.SuspendLayout(); + this.pnlListView.SuspendLayout(); + this.pnlMessageBox.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel5.SuspendLayout(); + this.panel4.SuspendLayout(); + this.panel3.SuspendLayout(); + this.panel2.SuspendLayout(); + this.SuspendLayout(); + // + // pnlMain + // + this.pnlMain.Controls.Add(this.tblMain); + this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlMain.Location = new System.Drawing.Point(0, 0); + this.pnlMain.Name = "pnlMain"; + this.pnlMain.Padding = new System.Windows.Forms.Padding(5, 10, 5, 0); + this.pnlMain.Size = new System.Drawing.Size(708, 410); + this.pnlMain.TabIndex = 2; + // + // tblMain + // + this.tblMain.ColumnCount = 3; + this.tblMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tblMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tblMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tblMain.Controls.Add(this.pnlTreeView, 0, 0); + this.tblMain.Controls.Add(this.pnlListView, 0, 0); + this.tblMain.Controls.Add(this.pnlMessageBox, 0, 0); + this.tblMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.tblMain.Location = new System.Drawing.Point(5, 10); + this.tblMain.Name = "tblMain"; + this.tblMain.RowCount = 1; + this.tblMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tblMain.Size = new System.Drawing.Size(698, 400); + this.tblMain.TabIndex = 0; + // + // pnlTreeView + // + this.pnlTreeView.Controls.Add(this.treeTest); + this.pnlTreeView.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlTreeView.Location = new System.Drawing.Point(469, 0); + this.pnlTreeView.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.pnlTreeView.Name = "pnlTreeView"; + this.pnlTreeView.SectionHeader = "Tree view test"; + this.pnlTreeView.Size = new System.Drawing.Size(224, 400); + this.pnlTreeView.TabIndex = 14; + // + // treeTest + // + this.treeTest.AllowMoveNodes = true; + this.treeTest.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeTest.Location = new System.Drawing.Point(1, 25); + this.treeTest.MaxDragChange = 20; + this.treeTest.MultiSelect = true; + this.treeTest.Name = "treeTest"; + this.treeTest.ShowIcons = true; + this.treeTest.Size = new System.Drawing.Size(222, 374); + this.treeTest.TabIndex = 0; + this.treeTest.Text = "darkTreeView1"; + // + // pnlListView + // + this.pnlListView.Controls.Add(this.lstTest); + this.pnlListView.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlListView.Location = new System.Drawing.Point(237, 0); + this.pnlListView.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.pnlListView.Name = "pnlListView"; + this.pnlListView.SectionHeader = "List view test"; + this.pnlListView.Size = new System.Drawing.Size(222, 400); + this.pnlListView.TabIndex = 13; + // + // lstTest + // + this.lstTest.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstTest.Location = new System.Drawing.Point(1, 25); + this.lstTest.MultiSelect = true; + this.lstTest.Name = "lstTest"; + this.lstTest.Size = new System.Drawing.Size(220, 374); + this.lstTest.TabIndex = 7; + this.lstTest.Text = "darkListView1"; + // + // pnlMessageBox + // + this.pnlMessageBox.Controls.Add(this.panel1); + this.pnlMessageBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlMessageBox.Location = new System.Drawing.Point(5, 0); + this.pnlMessageBox.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.pnlMessageBox.Name = "pnlMessageBox"; + this.pnlMessageBox.SectionHeader = "Controls test"; + this.pnlMessageBox.Size = new System.Drawing.Size(222, 400); + this.pnlMessageBox.TabIndex = 12; + // + // panel1 + // + this.panel1.Controls.Add(this.panel5); + this.panel1.Controls.Add(this.panel4); + this.panel1.Controls.Add(this.panel3); + this.panel1.Controls.Add(this.panel2); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(1, 25); + this.panel1.Name = "panel1"; + this.panel1.Padding = new System.Windows.Forms.Padding(10); + this.panel1.Size = new System.Drawing.Size(220, 374); + this.panel1.TabIndex = 0; + // + // panel5 + // + this.panel5.Controls.Add(this.darkRadioButton3); + this.panel5.Controls.Add(this.darkRadioButton2); + this.panel5.Controls.Add(this.darkRadioButton1); + this.panel5.Controls.Add(this.darkTitle3); + this.panel5.Dock = System.Windows.Forms.DockStyle.Top; + this.panel5.Location = new System.Drawing.Point(10, 185); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(200, 100); + this.panel5.TabIndex = 12; + // + // darkRadioButton3 + // + this.darkRadioButton3.AutoSize = true; + this.darkRadioButton3.Checked = true; + this.darkRadioButton3.Dock = System.Windows.Forms.DockStyle.Top; + this.darkRadioButton3.Enabled = false; + this.darkRadioButton3.Location = new System.Drawing.Point(0, 64); + this.darkRadioButton3.Name = "darkRadioButton3"; + this.darkRadioButton3.Size = new System.Drawing.Size(200, 19); + this.darkRadioButton3.TabIndex = 4; + this.darkRadioButton3.TabStop = true; + this.darkRadioButton3.Text = "Disabled radio button"; + // + // darkRadioButton2 + // + this.darkRadioButton2.AutoSize = true; + this.darkRadioButton2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkRadioButton2.Location = new System.Drawing.Point(0, 45); + this.darkRadioButton2.Name = "darkRadioButton2"; + this.darkRadioButton2.Size = new System.Drawing.Size(200, 19); + this.darkRadioButton2.TabIndex = 3; + this.darkRadioButton2.Text = "Radio button"; + // + // darkRadioButton1 + // + this.darkRadioButton1.AutoSize = true; + this.darkRadioButton1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkRadioButton1.Location = new System.Drawing.Point(0, 26); + this.darkRadioButton1.Name = "darkRadioButton1"; + this.darkRadioButton1.Size = new System.Drawing.Size(200, 19); + this.darkRadioButton1.TabIndex = 2; + this.darkRadioButton1.Text = "Radio button"; + // + // darkTitle3 + // + this.darkTitle3.Dock = System.Windows.Forms.DockStyle.Top; + this.darkTitle3.Location = new System.Drawing.Point(0, 0); + this.darkTitle3.Name = "darkTitle3"; + this.darkTitle3.Size = new System.Drawing.Size(200, 26); + this.darkTitle3.TabIndex = 16; + this.darkTitle3.Text = "Radio buttons"; + // + // panel4 + // + this.panel4.AutoSize = true; + this.panel4.Controls.Add(this.darkCheckBox2); + this.panel4.Controls.Add(this.darkCheckBox1); + this.panel4.Controls.Add(this.darkTitle2); + this.panel4.Dock = System.Windows.Forms.DockStyle.Top; + this.panel4.Location = new System.Drawing.Point(10, 111); + this.panel4.Name = "panel4"; + this.panel4.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); + this.panel4.Size = new System.Drawing.Size(200, 74); + this.panel4.TabIndex = 11; + // + // darkCheckBox2 + // + this.darkCheckBox2.AutoSize = true; + this.darkCheckBox2.Checked = true; + this.darkCheckBox2.CheckState = System.Windows.Forms.CheckState.Checked; + this.darkCheckBox2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkCheckBox2.Enabled = false; + this.darkCheckBox2.Location = new System.Drawing.Point(0, 45); + this.darkCheckBox2.Name = "darkCheckBox2"; + this.darkCheckBox2.Size = new System.Drawing.Size(200, 19); + this.darkCheckBox2.TabIndex = 13; + this.darkCheckBox2.Text = "Disabled checkbox"; + // + // darkCheckBox1 + // + this.darkCheckBox1.AutoSize = true; + this.darkCheckBox1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkCheckBox1.Location = new System.Drawing.Point(0, 26); + this.darkCheckBox1.Name = "darkCheckBox1"; + this.darkCheckBox1.Size = new System.Drawing.Size(200, 19); + this.darkCheckBox1.TabIndex = 12; + this.darkCheckBox1.Text = "Enabled checkbox"; + // + // darkTitle2 + // + this.darkTitle2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkTitle2.Location = new System.Drawing.Point(0, 0); + this.darkTitle2.Name = "darkTitle2"; + this.darkTitle2.Size = new System.Drawing.Size(200, 26); + this.darkTitle2.TabIndex = 15; + this.darkTitle2.Text = "Check boxes"; + // + // panel3 + // + this.panel3.AutoSize = true; + this.panel3.Controls.Add(this.btnMessageBox); + this.panel3.Dock = System.Windows.Forms.DockStyle.Top; + this.panel3.Location = new System.Drawing.Point(10, 71); + this.panel3.Name = "panel3"; + this.panel3.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); + this.panel3.Size = new System.Drawing.Size(200, 40); + this.panel3.TabIndex = 10; + // + // btnMessageBox + // + this.btnMessageBox.Dock = System.Windows.Forms.DockStyle.Top; + this.btnMessageBox.Location = new System.Drawing.Point(0, 0); + this.btnMessageBox.Name = "btnMessageBox"; + this.btnMessageBox.Padding = new System.Windows.Forms.Padding(5); + this.btnMessageBox.Size = new System.Drawing.Size(200, 30); + this.btnMessageBox.TabIndex = 12; + this.btnMessageBox.Text = "Message Box"; + // + // panel2 + // + this.panel2.AutoSize = true; + this.panel2.Controls.Add(this.btnDialog); + this.panel2.Controls.Add(this.darkTitle1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Top; + this.panel2.Location = new System.Drawing.Point(10, 10); + this.panel2.Name = "panel2"; + this.panel2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 5); + this.panel2.Size = new System.Drawing.Size(200, 61); + this.panel2.TabIndex = 5; + // + // btnDialog + // + this.btnDialog.Dock = System.Windows.Forms.DockStyle.Top; + this.btnDialog.Location = new System.Drawing.Point(0, 26); + this.btnDialog.Name = "btnDialog"; + this.btnDialog.Padding = new System.Windows.Forms.Padding(5); + this.btnDialog.Size = new System.Drawing.Size(200, 30); + this.btnDialog.TabIndex = 4; + this.btnDialog.Text = "Dialog"; + // + // darkTitle1 + // + this.darkTitle1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkTitle1.Location = new System.Drawing.Point(0, 0); + this.darkTitle1.Name = "darkTitle1"; + this.darkTitle1.Size = new System.Drawing.Size(200, 26); + this.darkTitle1.TabIndex = 14; + this.darkTitle1.Text = "Dialogs"; + // + // DialogControls + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(708, 455); + this.Controls.Add(this.pnlMain); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "DialogControls"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Controls"; + this.Controls.SetChildIndex(this.pnlMain, 0); + this.pnlMain.ResumeLayout(false); + this.tblMain.ResumeLayout(false); + this.pnlTreeView.ResumeLayout(false); + this.pnlListView.ResumeLayout(false); + this.pnlMessageBox.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel5.ResumeLayout(false); + this.panel5.PerformLayout(); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlMain; + private System.Windows.Forms.TableLayoutPanel tblMain; + private DarkSectionPanel pnlTreeView; + private DarkTreeView treeTest; + private DarkSectionPanel pnlListView; + private DarkListView lstTest; + private DarkSectionPanel pnlMessageBox; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel2; + private DarkButton btnDialog; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Panel panel3; + private DarkButton btnMessageBox; + private DarkCheckBox darkCheckBox2; + private DarkCheckBox darkCheckBox1; + private System.Windows.Forms.Panel panel5; + private DarkRadioButton darkRadioButton2; + private DarkRadioButton darkRadioButton1; + private DarkRadioButton darkRadioButton3; + private DarkTitle darkTitle1; + private DarkTitle darkTitle2; + private DarkTitle darkTitle3; + } +} \ No newline at end of file diff --git a/Example/Forms/Dialogs/DialogControls.cs b/Example/Forms/Dialogs/DialogControls.cs new file mode 100644 index 0000000..a56d7c1 --- /dev/null +++ b/Example/Forms/Dialogs/DialogControls.cs @@ -0,0 +1,50 @@ +using DarkUI.Controls; +using DarkUI.Forms; + +namespace Example +{ + public partial class DialogControls : DarkDialog + { + public DialogControls() + { + InitializeComponent(); + + // Build dummy list data + for (var i = 0; i < 100; i++) + { + var item = new DarkListItem($"List item #{i}"); + lstTest.Items.Add(item); + } + + // Build dummy nodes + var childCount = 0; + for (var i = 0; i < 20; i++) + { + var node = new DarkTreeNode($"Root node #{i}"); + node.ExpandedIcon = Icons.folder_open; + node.Icon = Icons.folder_closed; + + for (var x = 0; x < 10; x++) + { + var childNode = new DarkTreeNode($"Child node #{childCount}"); + childNode.Icon = Icons.files; + childCount++; + node.Nodes.Add(childNode); + } + + treeTest.Nodes.Add(node); + } + + // Hook dialog button events + btnDialog.Click += delegate + { + DarkMessageBox.ShowError("This is an error", "Dark UI - Example"); + }; + + btnMessageBox.Click += delegate + { + DarkMessageBox.ShowInformation("This is some information, except it is much bigger, so there we go. I wonder how this is going to go. I hope it resizes properly. It probably will.", "Dark UI - Example"); + }; + } + } +} diff --git a/Example/Forms/Dialogs/DialogControls.resx b/Example/Forms/Dialogs/DialogControls.resx new file mode 100644 index 0000000..16202c3 --- /dev/null +++ b/Example/Forms/Dialogs/DialogControls.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAECAAAAEAIAA8AQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAA0UlEQVQ4T7WRsQ2D + MBREGSUjZAZ6D0CXUaiYwj1bsAKDUNAYKB0/8j9xsB0pkTjpJPO5O5/t6lIsy9Ku6zoHeuHMbNu2m0jK + COJxGAbfNI2v63qntXYPCQGPryHsglmNsOu6w6xNRJ4CQbzz2axNRJ5imqbs7pA1s7D2Ik9xDtAQNcNi + gHPuzk9jzEdATI5HG7G8IeajZolccHKJJXPchJ0xB90othd405yZ7zCPmX8+hn3f58wzzURWBgG87V9m + oEegBfzJrCCEJpC1jK9GVT0B8ztfSZzDuHAAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/Example/Forms/Docking/DockConsole.Designer.cs b/Example/Forms/Docking/DockConsole.Designer.cs new file mode 100644 index 0000000..96c9e0f --- /dev/null +++ b/Example/Forms/Docking/DockConsole.Designer.cs @@ -0,0 +1,67 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + partial class DockConsole + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lstConsole = new DarkUI.Controls.DarkListView(); + this.SuspendLayout(); + // + // lstConsole + // + this.lstConsole.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstConsole.Location = new System.Drawing.Point(0, 25); + this.lstConsole.MultiSelect = true; + this.lstConsole.Name = "lstConsole"; + this.lstConsole.Size = new System.Drawing.Size(500, 175); + this.lstConsole.TabIndex = 0; + this.lstConsole.Text = "darkListView1"; + // + // DockConsole + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lstConsole); + this.DefaultDockArea = DarkUI.Docking.DarkDockArea.Bottom; + this.DockText = "Console"; + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = global::Example.Icons.Console; + this.Name = "DockConsole"; + this.SerializationKey = "DockConsole"; + this.Size = new System.Drawing.Size(500, 200); + this.ResumeLayout(false); + + } + + #endregion + + private DarkListView lstConsole; + } +} diff --git a/Example/Forms/Docking/DockConsole.cs b/Example/Forms/Docking/DockConsole.cs new file mode 100644 index 0000000..ecf4227 --- /dev/null +++ b/Example/Forms/Docking/DockConsole.cs @@ -0,0 +1,24 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + public partial class DockConsole : DarkToolWindow + { + #region Constructor Region + + public DockConsole() + { + InitializeComponent(); + + // Build dummy list data + for (var i = 0; i < 100; i++) + { + var item = new DarkListItem($"List item #{i}"); + lstConsole.Items.Add(item); + } + } + + #endregion + } +} diff --git a/Example/Forms/Docking/DockConsole.resx b/Example/Forms/Docking/DockConsole.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Example/Forms/Docking/DockConsole.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Forms/Docking/DockDocument.Designer.cs b/Example/Forms/Docking/DockDocument.Designer.cs new file mode 100644 index 0000000..8f6a77d --- /dev/null +++ b/Example/Forms/Docking/DockDocument.Designer.cs @@ -0,0 +1,64 @@ +namespace Example +{ + partial class DockDocument + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtDocument = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // txtDocument + // + this.txtDocument.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43))))); + this.txtDocument.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtDocument.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtDocument.ForeColor = System.Drawing.Color.Gainsboro; + this.txtDocument.Location = new System.Drawing.Point(0, 0); + this.txtDocument.Multiline = true; + this.txtDocument.Name = "txtDocument"; + this.txtDocument.Size = new System.Drawing.Size(175, 173); + this.txtDocument.TabIndex = 1; + this.txtDocument.Text = "This is some example text"; + // + // DockDocument + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.txtDocument); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Name = "DockDocument"; + this.Size = new System.Drawing.Size(175, 173); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtDocument; + } +} diff --git a/Example/Forms/Docking/DockDocument.cs b/Example/Forms/Docking/DockDocument.cs new file mode 100644 index 0000000..1b737ca --- /dev/null +++ b/Example/Forms/Docking/DockDocument.cs @@ -0,0 +1,43 @@ +using DarkUI.Config; +using DarkUI.Docking; +using DarkUI.Forms; +using System.Drawing; +using System.Windows.Forms; + +namespace Example +{ + public partial class DockDocument : DarkDocument + { + #region Constructor Region + + public DockDocument() + { + InitializeComponent(); + + // Workaround to stop the textbox from highlight all text. + txtDocument.SelectionStart = txtDocument.Text.Length; + } + + public DockDocument(string text, Image icon) + : this() + { + DockText = text; + Icon = icon; + } + + #endregion + + #region Event Handler Region + + public override void Close() + { + var result = DarkMessageBox.ShowWarning(@"You will lose any unsaved changes. Continue?", @"Close document", DarkDialogButton.YesNo); + if (result == DialogResult.No) + return; + + base.Close(); + } + + #endregion + } +} diff --git a/Example/Forms/Docking/DockDocument.resx b/Example/Forms/Docking/DockDocument.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Example/Forms/Docking/DockDocument.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Forms/Docking/DockHistory.Designer.cs b/Example/Forms/Docking/DockHistory.Designer.cs new file mode 100644 index 0000000..74fa10e --- /dev/null +++ b/Example/Forms/Docking/DockHistory.Designer.cs @@ -0,0 +1,67 @@ +using DarkUI.Config; +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + partial class DockHistory + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lstHistory = new DarkUI.Controls.DarkListView(); + this.SuspendLayout(); + // + // lstHistory + // + this.lstHistory.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstHistory.Location = new System.Drawing.Point(0, 25); + this.lstHistory.Name = "lstHistory"; + this.lstHistory.Size = new System.Drawing.Size(280, 425); + this.lstHistory.TabIndex = 0; + this.lstHistory.Text = "darkListView1"; + // + // DockHistory + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lstHistory); + this.DefaultDockArea = DarkUI.Docking.DarkDockArea.Right; + this.DockText = "History"; + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = global::Example.Icons.RefactoringLog_12810; + this.Name = "DockHistory"; + this.SerializationKey = "DockHistory"; + this.Size = new System.Drawing.Size(280, 450); + this.ResumeLayout(false); + + } + + #endregion + + private DarkListView lstHistory; + } +} diff --git a/Example/Forms/Docking/DockHistory.cs b/Example/Forms/Docking/DockHistory.cs new file mode 100644 index 0000000..e546654 --- /dev/null +++ b/Example/Forms/Docking/DockHistory.cs @@ -0,0 +1,24 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + public partial class DockHistory : DarkToolWindow + { + #region Constructor Region + + public DockHistory() + { + InitializeComponent(); + + // Build dummy list data + for (var i = 0; i < 100; i++) + { + var item = new DarkListItem($"List item #{i}"); + lstHistory.Items.Add(item); + } + } + + #endregion + } +} diff --git a/Example/Forms/Docking/DockHistory.resx b/Example/Forms/Docking/DockHistory.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Example/Forms/Docking/DockHistory.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Forms/Docking/DockLayers.Designer.cs b/Example/Forms/Docking/DockLayers.Designer.cs new file mode 100644 index 0000000..796dec4 --- /dev/null +++ b/Example/Forms/Docking/DockLayers.Designer.cs @@ -0,0 +1,66 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + partial class DockLayers + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lstLayers = new DarkUI.Controls.DarkListView(); + this.SuspendLayout(); + // + // lstLayers + // + this.lstLayers.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstLayers.Location = new System.Drawing.Point(0, 25); + this.lstLayers.Name = "lstLayers"; + this.lstLayers.Size = new System.Drawing.Size(280, 425); + this.lstLayers.TabIndex = 0; + this.lstLayers.Text = "darkListView1"; + // + // DockLayers + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lstLayers); + this.DefaultDockArea = DarkUI.Docking.DarkDockArea.Right; + this.DockText = "Layers"; + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = global::Example.Icons.Collection_16xLG; + this.Name = "DockLayers"; + this.SerializationKey = "DockLayers"; + this.Size = new System.Drawing.Size(280, 450); + this.ResumeLayout(false); + + } + + #endregion + + private DarkListView lstLayers; + } +} diff --git a/Example/Forms/Docking/DockLayers.cs b/Example/Forms/Docking/DockLayers.cs new file mode 100644 index 0000000..14bf7c4 --- /dev/null +++ b/Example/Forms/Docking/DockLayers.cs @@ -0,0 +1,24 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + public partial class DockLayers : DarkToolWindow + { + #region Constructor Region + + public DockLayers() + { + InitializeComponent(); + + // Build dummy list data + for (var i = 0; i < 100; i++) + { + var item = new DarkListItem($"List item #{i}"); + lstLayers.Items.Add(item); + } + } + + #endregion + } +} diff --git a/Example/Forms/Docking/DockLayers.resx b/Example/Forms/Docking/DockLayers.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Example/Forms/Docking/DockLayers.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Forms/Docking/DockProject.Designer.cs b/Example/Forms/Docking/DockProject.Designer.cs new file mode 100644 index 0000000..ca7679b --- /dev/null +++ b/Example/Forms/Docking/DockProject.Designer.cs @@ -0,0 +1,71 @@ +using DarkUI.Config; +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + partial class DockProject + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.treeProject = new DarkUI.Controls.DarkTreeView(); + this.SuspendLayout(); + // + // treeProject + // + this.treeProject.AllowMoveNodes = true; + this.treeProject.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeProject.Location = new System.Drawing.Point(0, 25); + this.treeProject.MaxDragChange = 20; + this.treeProject.MultiSelect = true; + this.treeProject.Name = "treeProject"; + this.treeProject.ShowIcons = true; + this.treeProject.Size = new System.Drawing.Size(280, 425); + this.treeProject.TabIndex = 0; + this.treeProject.Text = "darkTreeView1"; + // + // DockProject + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.treeProject); + this.DefaultDockArea = DarkUI.Docking.DarkDockArea.Left; + this.DockText = "Project Explorer"; + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = global::Example.Icons.application_16x; + this.Name = "DockProject"; + this.SerializationKey = "DockProject"; + this.Size = new System.Drawing.Size(280, 450); + this.ResumeLayout(false); + + } + + #endregion + + private DarkTreeView treeProject; + } +} diff --git a/Example/Forms/Docking/DockProject.cs b/Example/Forms/Docking/DockProject.cs new file mode 100644 index 0000000..9fb539e --- /dev/null +++ b/Example/Forms/Docking/DockProject.cs @@ -0,0 +1,36 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + public partial class DockProject : DarkToolWindow + { + #region Constructor Region + + public DockProject() + { + InitializeComponent(); + + // Build dummy nodes + var childCount = 0; + for (var i = 0; i < 20; i++) + { + var node = new DarkTreeNode($"Root node #{i}"); + node.ExpandedIcon = Icons.folder_open; + node.Icon = Icons.folder_closed; + + for (var x = 0; x < 10; x++) + { + var childNode = new DarkTreeNode($"Child node #{childCount}"); + childNode.Icon = Icons.files; + childCount++; + node.Nodes.Add(childNode); + } + + treeProject.Nodes.Add(node); + } + } + + #endregion + } +} diff --git a/Example/Forms/Docking/DockProject.resx b/Example/Forms/Docking/DockProject.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Example/Forms/Docking/DockProject.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Forms/Docking/DockProperties.Designer.cs b/Example/Forms/Docking/DockProperties.Designer.cs new file mode 100644 index 0000000..29dd419 --- /dev/null +++ b/Example/Forms/Docking/DockProperties.Designer.cs @@ -0,0 +1,211 @@ +using DarkUI.Config; +using DarkUI.Docking; + +namespace Example +{ + partial class DockProperties + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pnlMain = new System.Windows.Forms.Panel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.darkRadioButton3 = new DarkUI.Controls.DarkRadioButton(); + this.darkRadioButton2 = new DarkUI.Controls.DarkRadioButton(); + this.darkRadioButton1 = new DarkUI.Controls.DarkRadioButton(); + this.darkTitle1 = new DarkUI.Controls.DarkTitle(); + this.panel2 = new System.Windows.Forms.Panel(); + this.darkCheckBox3 = new DarkUI.Controls.DarkCheckBox(); + this.darkCheckBox2 = new DarkUI.Controls.DarkCheckBox(); + this.darkCheckBox1 = new DarkUI.Controls.DarkCheckBox(); + this.darkTitle2 = new DarkUI.Controls.DarkTitle(); + this.pnlMain.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.SuspendLayout(); + // + // pnlMain + // + this.pnlMain.Controls.Add(this.panel1); + this.pnlMain.Controls.Add(this.panel2); + this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlMain.Location = new System.Drawing.Point(0, 25); + this.pnlMain.Name = "pnlMain"; + this.pnlMain.Padding = new System.Windows.Forms.Padding(10); + this.pnlMain.Size = new System.Drawing.Size(280, 425); + this.pnlMain.TabIndex = 0; + // + // panel1 + // + this.panel1.AutoSize = true; + this.panel1.Controls.Add(this.darkRadioButton3); + this.panel1.Controls.Add(this.darkRadioButton2); + this.panel1.Controls.Add(this.darkRadioButton1); + this.panel1.Controls.Add(this.darkTitle1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; + this.panel1.Location = new System.Drawing.Point(10, 103); + this.panel1.Name = "panel1"; + this.panel1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); + this.panel1.Size = new System.Drawing.Size(260, 93); + this.panel1.TabIndex = 2; + // + // darkRadioButton3 + // + this.darkRadioButton3.AutoSize = true; + this.darkRadioButton3.Dock = System.Windows.Forms.DockStyle.Top; + this.darkRadioButton3.Enabled = false; + this.darkRadioButton3.Location = new System.Drawing.Point(0, 64); + this.darkRadioButton3.Name = "darkRadioButton3"; + this.darkRadioButton3.Size = new System.Drawing.Size(260, 19); + this.darkRadioButton3.TabIndex = 6; + this.darkRadioButton3.TabStop = true; + this.darkRadioButton3.Text = "Disabled radiobutton"; + // + // darkRadioButton2 + // + this.darkRadioButton2.AutoSize = true; + this.darkRadioButton2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkRadioButton2.Location = new System.Drawing.Point(0, 45); + this.darkRadioButton2.Name = "darkRadioButton2"; + this.darkRadioButton2.Size = new System.Drawing.Size(260, 19); + this.darkRadioButton2.TabIndex = 5; + this.darkRadioButton2.TabStop = true; + this.darkRadioButton2.Text = "Radiobutton"; + // + // darkRadioButton1 + // + this.darkRadioButton1.AutoSize = true; + this.darkRadioButton1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkRadioButton1.Location = new System.Drawing.Point(0, 26); + this.darkRadioButton1.Name = "darkRadioButton1"; + this.darkRadioButton1.Size = new System.Drawing.Size(260, 19); + this.darkRadioButton1.TabIndex = 4; + this.darkRadioButton1.TabStop = true; + this.darkRadioButton1.Text = "Radiobutton"; + // + // darkTitle1 + // + this.darkTitle1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkTitle1.Location = new System.Drawing.Point(0, 0); + this.darkTitle1.Name = "darkTitle1"; + this.darkTitle1.Size = new System.Drawing.Size(260, 26); + this.darkTitle1.TabIndex = 7; + this.darkTitle1.Text = "Radio buttons"; + // + // panel2 + // + this.panel2.AutoSize = true; + this.panel2.Controls.Add(this.darkCheckBox3); + this.panel2.Controls.Add(this.darkCheckBox2); + this.panel2.Controls.Add(this.darkCheckBox1); + this.panel2.Controls.Add(this.darkTitle2); + this.panel2.Dock = System.Windows.Forms.DockStyle.Top; + this.panel2.Location = new System.Drawing.Point(10, 10); + this.panel2.Name = "panel2"; + this.panel2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); + this.panel2.Size = new System.Drawing.Size(260, 93); + this.panel2.TabIndex = 1; + // + // darkCheckBox3 + // + this.darkCheckBox3.AutoSize = true; + this.darkCheckBox3.Checked = true; + this.darkCheckBox3.CheckState = System.Windows.Forms.CheckState.Checked; + this.darkCheckBox3.Dock = System.Windows.Forms.DockStyle.Top; + this.darkCheckBox3.Enabled = false; + this.darkCheckBox3.Location = new System.Drawing.Point(0, 64); + this.darkCheckBox3.Name = "darkCheckBox3"; + this.darkCheckBox3.Size = new System.Drawing.Size(260, 19); + this.darkCheckBox3.TabIndex = 6; + this.darkCheckBox3.Text = "Disabled checked checkbox"; + // + // darkCheckBox2 + // + this.darkCheckBox2.AutoSize = true; + this.darkCheckBox2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkCheckBox2.Enabled = false; + this.darkCheckBox2.Location = new System.Drawing.Point(0, 45); + this.darkCheckBox2.Name = "darkCheckBox2"; + this.darkCheckBox2.Size = new System.Drawing.Size(260, 19); + this.darkCheckBox2.TabIndex = 5; + this.darkCheckBox2.Text = "Disabled checkbox"; + // + // darkCheckBox1 + // + this.darkCheckBox1.AutoSize = true; + this.darkCheckBox1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkCheckBox1.Location = new System.Drawing.Point(0, 26); + this.darkCheckBox1.Name = "darkCheckBox1"; + this.darkCheckBox1.Size = new System.Drawing.Size(260, 19); + this.darkCheckBox1.TabIndex = 4; + this.darkCheckBox1.Text = "Checkbox"; + // + // darkTitle2 + // + this.darkTitle2.Dock = System.Windows.Forms.DockStyle.Top; + this.darkTitle2.Location = new System.Drawing.Point(0, 0); + this.darkTitle2.Name = "darkTitle2"; + this.darkTitle2.Size = new System.Drawing.Size(260, 26); + this.darkTitle2.TabIndex = 8; + this.darkTitle2.Text = "Check boxes"; + // + // DockProperties + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlMain); + this.DefaultDockArea = DarkUI.Docking.DarkDockArea.Right; + this.DockText = "Properties"; + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = global::Example.Icons.properties_16xLG; + this.Name = "DockProperties"; + this.SerializationKey = "DockProperties"; + this.Size = new System.Drawing.Size(280, 450); + this.pnlMain.ResumeLayout(false); + this.pnlMain.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlMain; + private System.Windows.Forms.Panel panel1; + private DarkUI.Controls.DarkRadioButton darkRadioButton3; + private DarkUI.Controls.DarkRadioButton darkRadioButton2; + private DarkUI.Controls.DarkRadioButton darkRadioButton1; + private DarkUI.Controls.DarkTitle darkTitle1; + private System.Windows.Forms.Panel panel2; + private DarkUI.Controls.DarkCheckBox darkCheckBox3; + private DarkUI.Controls.DarkCheckBox darkCheckBox2; + private DarkUI.Controls.DarkCheckBox darkCheckBox1; + private DarkUI.Controls.DarkTitle darkTitle2; + } +} diff --git a/Example/Forms/Docking/DockProperties.cs b/Example/Forms/Docking/DockProperties.cs new file mode 100644 index 0000000..c32ad3b --- /dev/null +++ b/Example/Forms/Docking/DockProperties.cs @@ -0,0 +1,16 @@ +using DarkUI.Docking; + +namespace Example +{ + public partial class DockProperties : DarkToolWindow + { + #region Constructor Region + + public DockProperties() + { + InitializeComponent(); + } + + #endregion + } +} diff --git a/Example/Forms/Docking/DockProperties.resx b/Example/Forms/Docking/DockProperties.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Example/Forms/Docking/DockProperties.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Forms/MainForm.Designer.cs b/Example/Forms/MainForm.Designer.cs new file mode 100644 index 0000000..839ef61 --- /dev/null +++ b/Example/Forms/MainForm.Designer.cs @@ -0,0 +1,412 @@ +using DarkUI.Controls; +using DarkUI.Docking; + +namespace Example +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.mnuMain = new DarkUI.Controls.DarkMenuStrip(); + this.mnuFile = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuNewFile = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuClose = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuView = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuDialog = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuTools = new System.Windows.Forms.ToolStripMenuItem(); + this.checkableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.checkableWithIconToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.checkedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.checkedWithIconToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuProject = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuProperties = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuConsole = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLayers = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHistory = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); + this.toolMain = new DarkUI.Controls.DarkToolStrip(); + this.btnNewFile = new System.Windows.Forms.ToolStripButton(); + this.stripMain = new DarkUI.Controls.DarkStatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); + this.DockPanel = new DarkUI.Docking.DarkDockPanel(); + this.darkSeparator1 = new DarkUI.Controls.DarkSeparator(); + this.mnuMain.SuspendLayout(); + this.toolMain.SuspendLayout(); + this.stripMain.SuspendLayout(); + this.SuspendLayout(); + // + // mnuMain + // + this.mnuMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); + this.mnuMain.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuFile, + this.mnuView, + this.mnuTools, + this.mnuWindow, + this.mnuHelp}); + this.mnuMain.Location = new System.Drawing.Point(0, 0); + this.mnuMain.Name = "mnuMain"; + this.mnuMain.Padding = new System.Windows.Forms.Padding(3, 2, 0, 2); + this.mnuMain.Size = new System.Drawing.Size(944, 24); + this.mnuMain.TabIndex = 0; + this.mnuMain.Text = "darkMenuStrip1"; + // + // mnuFile + // + this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuNewFile, + this.toolStripSeparator1, + this.mnuClose}); + this.mnuFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuFile.Name = "mnuFile"; + this.mnuFile.Size = new System.Drawing.Size(37, 20); + this.mnuFile.Text = "&File"; + // + // mnuNewFile + // + this.mnuNewFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuNewFile.Image = global::Example.Icons.NewFile_6276; + this.mnuNewFile.Name = "mnuNewFile"; + this.mnuNewFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.mnuNewFile.Size = new System.Drawing.Size(160, 22); + this.mnuNewFile.Text = "&New file"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.toolStripSeparator1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(157, 6); + // + // mnuClose + // + this.mnuClose.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuClose.Image = global::Example.Icons.Close_16xLG; + this.mnuClose.Name = "mnuClose"; + this.mnuClose.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); + this.mnuClose.Size = new System.Drawing.Size(160, 22); + this.mnuClose.Text = "&Close"; + // + // mnuView + // + this.mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuDialog}); + this.mnuView.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuView.Name = "mnuView"; + this.mnuView.Size = new System.Drawing.Size(44, 20); + this.mnuView.Text = "&View"; + // + // mnuDialog + // + this.mnuDialog.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuDialog.Image = global::Example.Icons.properties_16xLG; + this.mnuDialog.Name = "mnuDialog"; + this.mnuDialog.Size = new System.Drawing.Size(130, 22); + this.mnuDialog.Text = "&Dialog test"; + // + // mnuTools + // + this.mnuTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.checkableToolStripMenuItem, + this.checkableWithIconToolStripMenuItem, + this.toolStripSeparator2, + this.checkedToolStripMenuItem, + this.checkedWithIconToolStripMenuItem}); + this.mnuTools.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuTools.Name = "mnuTools"; + this.mnuTools.Size = new System.Drawing.Size(48, 20); + this.mnuTools.Text = "&Tools"; + // + // checkableToolStripMenuItem + // + this.checkableToolStripMenuItem.CheckOnClick = true; + this.checkableToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.checkableToolStripMenuItem.Name = "checkableToolStripMenuItem"; + this.checkableToolStripMenuItem.Size = new System.Drawing.Size(181, 22); + this.checkableToolStripMenuItem.Text = "Checkable"; + // + // checkableWithIconToolStripMenuItem + // + this.checkableWithIconToolStripMenuItem.CheckOnClick = true; + this.checkableWithIconToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.checkableWithIconToolStripMenuItem.Image = global::Example.Icons.properties_16xLG; + this.checkableWithIconToolStripMenuItem.Name = "checkableWithIconToolStripMenuItem"; + this.checkableWithIconToolStripMenuItem.Size = new System.Drawing.Size(181, 22); + this.checkableWithIconToolStripMenuItem.Text = "Checkable with icon"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.toolStripSeparator2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(178, 6); + // + // checkedToolStripMenuItem + // + this.checkedToolStripMenuItem.Checked = true; + this.checkedToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkedToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.checkedToolStripMenuItem.Name = "checkedToolStripMenuItem"; + this.checkedToolStripMenuItem.Size = new System.Drawing.Size(181, 22); + this.checkedToolStripMenuItem.Text = "Checked"; + // + // checkedWithIconToolStripMenuItem + // + this.checkedWithIconToolStripMenuItem.Checked = true; + this.checkedWithIconToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkedWithIconToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.checkedWithIconToolStripMenuItem.Image = global::Example.Icons.properties_16xLG; + this.checkedWithIconToolStripMenuItem.Name = "checkedWithIconToolStripMenuItem"; + this.checkedWithIconToolStripMenuItem.Size = new System.Drawing.Size(181, 22); + this.checkedWithIconToolStripMenuItem.Text = "Checked with icon"; + // + // mnuWindow + // + this.mnuWindow.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuProject, + this.mnuProperties, + this.mnuConsole, + this.mnuLayers, + this.mnuHistory}); + this.mnuWindow.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuWindow.Name = "mnuWindow"; + this.mnuWindow.Size = new System.Drawing.Size(63, 20); + this.mnuWindow.Text = "&Window"; + // + // mnuProject + // + this.mnuProject.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuProject.Image = global::Example.Icons.application_16x; + this.mnuProject.Name = "mnuProject"; + this.mnuProject.Size = new System.Drawing.Size(156, 22); + this.mnuProject.Text = "&Project Explorer"; + // + // mnuProperties + // + this.mnuProperties.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuProperties.Image = global::Example.Icons.properties_16xLG; + this.mnuProperties.Name = "mnuProperties"; + this.mnuProperties.Size = new System.Drawing.Size(156, 22); + this.mnuProperties.Text = "P&roperties"; + // + // mnuConsole + // + this.mnuConsole.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuConsole.Image = global::Example.Icons.Console; + this.mnuConsole.Name = "mnuConsole"; + this.mnuConsole.Size = new System.Drawing.Size(156, 22); + this.mnuConsole.Text = "&Console"; + // + // mnuLayers + // + this.mnuLayers.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuLayers.Image = global::Example.Icons.Collection_16xLG; + this.mnuLayers.Name = "mnuLayers"; + this.mnuLayers.Size = new System.Drawing.Size(156, 22); + this.mnuLayers.Text = "&Layers"; + // + // mnuHistory + // + this.mnuHistory.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuHistory.Image = ((System.Drawing.Image)(resources.GetObject("mnuHistory.Image"))); + this.mnuHistory.Name = "mnuHistory"; + this.mnuHistory.Size = new System.Drawing.Size(156, 22); + this.mnuHistory.Text = "&History"; + // + // mnuHelp + // + this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuAbout}); + this.mnuHelp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuHelp.Name = "mnuHelp"; + this.mnuHelp.Size = new System.Drawing.Size(44, 20); + this.mnuHelp.Text = "&Help"; + // + // mnuAbout + // + this.mnuAbout.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.mnuAbout.Image = global::Example.Icons.StatusAnnotations_Information_16xLG_color; + this.mnuAbout.Name = "mnuAbout"; + this.mnuAbout.Size = new System.Drawing.Size(145, 22); + this.mnuAbout.Text = "&About DarkUI"; + // + // toolMain + // + this.toolMain.AutoSize = false; + this.toolMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); + this.toolMain.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.toolMain.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.toolMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.btnNewFile}); + this.toolMain.Location = new System.Drawing.Point(0, 26); + this.toolMain.Name = "toolMain"; + this.toolMain.Padding = new System.Windows.Forms.Padding(5, 0, 1, 0); + this.toolMain.Size = new System.Drawing.Size(944, 28); + this.toolMain.TabIndex = 1; + this.toolMain.Text = "darkToolStrip1"; + // + // btnNewFile + // + this.btnNewFile.AutoSize = false; + this.btnNewFile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.btnNewFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.btnNewFile.Image = global::Example.Icons.NewFile_6276; + this.btnNewFile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnNewFile.Name = "btnNewFile"; + this.btnNewFile.Size = new System.Drawing.Size(24, 24); + this.btnNewFile.Text = "New file"; + // + // stripMain + // + this.stripMain.AutoSize = false; + this.stripMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); + this.stripMain.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.stripMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.toolStripStatusLabel6, + this.toolStripStatusLabel5}); + this.stripMain.Location = new System.Drawing.Point(0, 618); + this.stripMain.Name = "stripMain"; + this.stripMain.Padding = new System.Windows.Forms.Padding(0, 5, 0, 3); + this.stripMain.Size = new System.Drawing.Size(944, 24); + this.stripMain.SizingGrip = false; + this.stripMain.TabIndex = 2; + this.stripMain.Text = "darkStatusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.AutoSize = false; + this.toolStripStatusLabel1.Margin = new System.Windows.Forms.Padding(1, 0, 50, 0); + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(39, 16); + this.toolStripStatusLabel1.Text = "Ready"; + this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // toolStripStatusLabel6 + // + this.toolStripStatusLabel6.Margin = new System.Windows.Forms.Padding(0, 0, 50, 2); + this.toolStripStatusLabel6.Name = "toolStripStatusLabel6"; + this.toolStripStatusLabel6.Size = new System.Drawing.Size(757, 14); + this.toolStripStatusLabel6.Spring = true; + this.toolStripStatusLabel6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // toolStripStatusLabel5 + // + this.toolStripStatusLabel5.Margin = new System.Windows.Forms.Padding(0, 0, 1, 0); + this.toolStripStatusLabel5.Name = "toolStripStatusLabel5"; + this.toolStripStatusLabel5.Size = new System.Drawing.Size(46, 16); + this.toolStripStatusLabel5.Text = "120 MB"; + this.toolStripStatusLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // DockPanel + // + this.DockPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); + this.DockPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.DockPanel.Location = new System.Drawing.Point(0, 54); + this.DockPanel.Name = "DockPanel"; + this.DockPanel.Size = new System.Drawing.Size(944, 564); + this.DockPanel.TabIndex = 3; + // + // darkSeparator1 + // + this.darkSeparator1.Dock = System.Windows.Forms.DockStyle.Top; + this.darkSeparator1.Location = new System.Drawing.Point(0, 24); + this.darkSeparator1.Name = "darkSeparator1"; + this.darkSeparator1.Size = new System.Drawing.Size(944, 2); + this.darkSeparator1.TabIndex = 4; + this.darkSeparator1.Text = "darkSeparator1"; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(944, 642); + this.Controls.Add(this.DockPanel); + this.Controls.Add(this.stripMain); + this.Controls.Add(this.toolMain); + this.Controls.Add(this.darkSeparator1); + this.Controls.Add(this.mnuMain); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.mnuMain; + this.MinimumSize = new System.Drawing.Size(640, 480); + this.Name = "MainForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Dark UI - Example"; + this.mnuMain.ResumeLayout(false); + this.mnuMain.PerformLayout(); + this.toolMain.ResumeLayout(false); + this.toolMain.PerformLayout(); + this.stripMain.ResumeLayout(false); + this.stripMain.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private DarkMenuStrip mnuMain; + private DarkToolStrip toolMain; + private DarkStatusStrip stripMain; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5; + private System.Windows.Forms.ToolStripMenuItem mnuFile; + private System.Windows.Forms.ToolStripMenuItem mnuView; + private System.Windows.Forms.ToolStripMenuItem mnuDialog; + private System.Windows.Forms.ToolStripMenuItem mnuClose; + private System.Windows.Forms.ToolStripMenuItem mnuTools; + private System.Windows.Forms.ToolStripMenuItem mnuWindow; + private System.Windows.Forms.ToolStripMenuItem mnuHelp; + private System.Windows.Forms.ToolStripMenuItem mnuAbout; + private System.Windows.Forms.ToolStripButton btnNewFile; + private System.Windows.Forms.ToolStripMenuItem mnuNewFile; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private DarkDockPanel DockPanel; + private System.Windows.Forms.ToolStripMenuItem mnuProject; + private System.Windows.Forms.ToolStripMenuItem mnuProperties; + private System.Windows.Forms.ToolStripMenuItem mnuConsole; + private System.Windows.Forms.ToolStripMenuItem mnuLayers; + private System.Windows.Forms.ToolStripMenuItem mnuHistory; + private DarkSeparator darkSeparator1; + private System.Windows.Forms.ToolStripMenuItem checkableToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem checkableWithIconToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem checkedToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem checkedWithIconToolStripMenuItem; + } +} + diff --git a/Example/Forms/MainForm.cs b/Example/Forms/MainForm.cs new file mode 100644 index 0000000..0f9402d --- /dev/null +++ b/Example/Forms/MainForm.cs @@ -0,0 +1,225 @@ +using DarkUI.Docking; +using DarkUI.Forms; +using DarkUI.Win32; +using System; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; + +namespace Example +{ + public partial class MainForm : DarkForm + { + #region Field Region + + private List _toolWindows = new List(); + + private DockProject _dockProject; + private DockProperties _dockProperties; + private DockConsole _dockConsole; + private DockLayers _dockLayers; + private DockHistory _dockHistory; + + #endregion + + #region Constructor Region + + public MainForm() + { + InitializeComponent(); + + // Add the control scroll message filter to re-route all mousewheel events + // to the control the user is currently hovering over with their cursor. + Application.AddMessageFilter(new ControlScrollFilter()); + + // Add the dock content drag message filter to handle moving dock content around. + Application.AddMessageFilter(DockPanel.DockContentDragFilter); + + // Add the dock panel message filter to filter through for dock panel splitter + // input before letting events pass through to the rest of the application. + Application.AddMessageFilter(DockPanel.DockResizeFilter); + + // Hook in all the UI events manually for clarity. + HookEvents(); + + // Build the tool windows and add them to the dock panel + _dockProject = new DockProject(); + _dockProperties = new DockProperties(); + _dockConsole = new DockConsole(); + _dockLayers = new DockLayers(); + _dockHistory = new DockHistory(); + + // Add the tool windows to a list + _toolWindows.Add(_dockProject); + _toolWindows.Add(_dockProperties); + _toolWindows.Add(_dockConsole); + _toolWindows.Add(_dockLayers); + _toolWindows.Add(_dockHistory); + + // Deserialize if a previous state is stored + if (File.Exists("dockpanel.config")) + { + DeserializeDockPanel("dockpanel.config"); + } + else + { + // Add the tool window list contents to the dock panel + foreach (var toolWindow in _toolWindows) + DockPanel.AddContent(toolWindow); + + // Add the history panel to the layer panel group + DockPanel.AddContent(_dockHistory, _dockLayers.DockGroup); + } + + // Check window menu items which are contained in the dock panel + BuildWindowMenu(); + + // Add dummy documents to the main document area of the dock panel + DockPanel.AddContent(new DockDocument("Document 1", Icons.document_16xLG)); + DockPanel.AddContent(new DockDocument("Document 2", Icons.document_16xLG)); + DockPanel.AddContent(new DockDocument("Document 3", Icons.document_16xLG)); + } + + #endregion + + #region Method Region + + private void HookEvents() + { + FormClosing += MainForm_FormClosing; + + DockPanel.ContentAdded += DockPanel_ContentAdded; + DockPanel.ContentRemoved += DockPanel_ContentRemoved; + + mnuNewFile.Click += NewFile_Click; + mnuClose.Click += Close_Click; + + btnNewFile.Click += NewFile_Click; + + mnuDialog.Click += Dialog_Click; + + mnuProject.Click += Project_Click; + mnuProperties.Click += Properties_Click; + mnuConsole.Click += Console_Click; + mnuLayers.Click += Layers_Click; + mnuHistory.Click += History_Click; + + mnuAbout.Click += About_Click; + } + + private void ToggleToolWindow(DarkToolWindow toolWindow) + { + if (toolWindow.DockPanel == null) + DockPanel.AddContent(toolWindow); + else + DockPanel.RemoveContent(toolWindow); + } + + private void BuildWindowMenu() + { + mnuProject.Checked = DockPanel.ContainsContent(_dockProject); + mnuProperties.Checked = DockPanel.ContainsContent(_dockProperties); + mnuConsole.Checked = DockPanel.ContainsContent(_dockConsole); + mnuLayers.Checked = DockPanel.Contains(_dockLayers); + mnuHistory.Checked = DockPanel.Contains(_dockHistory); + } + + #endregion + + #region Event Handler Region + + private void MainForm_FormClosing(object sender, FormClosingEventArgs e) + { + SerializeDockPanel("dockpanel.config"); + } + + private void DockPanel_ContentAdded(object sender, DockContentEventArgs e) + { + if (_toolWindows.Contains(e.Content)) + BuildWindowMenu(); + } + + private void DockPanel_ContentRemoved(object sender, DockContentEventArgs e) + { + if (_toolWindows.Contains(e.Content)) + BuildWindowMenu(); + } + + private void NewFile_Click(object sender, EventArgs e) + { + var newFile = new DockDocument("New document", Icons.document_16xLG); + DockPanel.AddContent(newFile); + } + + private void Close_Click(object sender, EventArgs e) + { + Close(); + } + + private void Dialog_Click(object sender, EventArgs e) + { + var test = new DialogControls(); + test.ShowDialog(); + } + + private void Project_Click(object sender, EventArgs e) + { + ToggleToolWindow(_dockProject); + } + + private void Properties_Click(object sender, EventArgs e) + { + ToggleToolWindow(_dockProperties); + } + + private void Console_Click(object sender, EventArgs e) + { + ToggleToolWindow(_dockConsole); + } + + private void Layers_Click(object sender, EventArgs e) + { + ToggleToolWindow(_dockLayers); + } + + private void History_Click(object sender, EventArgs e) + { + ToggleToolWindow(_dockHistory); + } + + private void About_Click(object sender, EventArgs e) + { + var about = new DialogAbout(); + about.ShowDialog(); + } + + #endregion + + #region Serialization Region + + private void SerializeDockPanel(string path) + { + var state = DockPanel.GetDockPanelState(); + SerializerHelper.Serialize(state, path); + } + + private void DeserializeDockPanel(string path) + { + var state = SerializerHelper.Deserialize(path); + DockPanel.RestoreDockPanelState(state, GetContentBySerializationKey); + } + + private DarkDockContent GetContentBySerializationKey(string key) + { + foreach (var window in _toolWindows) + { + if (window.SerializationKey == key) + return window; + } + + return null; + } + + #endregion + } +} diff --git a/Example/Forms/MainForm.resx b/Example/Forms/MainForm.resx new file mode 100644 index 0000000..b727939 --- /dev/null +++ b/Example/Forms/MainForm.resx @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1 + MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAADsEAAA7BAbiRa+0AADnsaVRYdFhNTDpjb20uYWRvYmUu + eG1wAAAAAAA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/ + Pgo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29y + ZSA1LjYtYzAxNCA3OS4xNTY3OTcsIDIwMTQvMDgvMjAtMDk6NTM6MDIgICAgICAgICI+CiAgIDxyZGY6 + UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+ + CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnhtcD0i + aHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgICAgICAgICAgeG1sbnM6eG1wTU09Imh0dHA6 + Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iCiAgICAgICAgICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8v + bnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICAgICAgICAgIHhtbG5z + OmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6cGhv + dG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgICAgICAgICB4bWxu + czp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhp + Zj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29s + PkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE0IChXaW5kb3dzKTwveG1wOkNyZWF0b3JUb29sPgogICAgICAg + ICA8eG1wOkNyZWF0ZURhdGU+MjAxNS0wOS0xOVQxMzoyMTozOCswMTowMDwveG1wOkNyZWF0ZURhdGU+ + CiAgICAgICAgIDx4bXA6TWV0YWRhdGFEYXRlPjIwMTUtMDktMTlUMTM6MjE6MzgrMDE6MDA8L3htcDpN + ZXRhZGF0YURhdGU+CiAgICAgICAgIDx4bXA6TW9kaWZ5RGF0ZT4yMDE1LTA5LTE5VDEzOjIxOjM4KzAx + OjAwPC94bXA6TW9kaWZ5RGF0ZT4KICAgICAgICAgPHhtcE1NOkluc3RhbmNlSUQ+eG1wLmlpZDphYjNi + MTFjYS1kNGVkLTg1NGEtOWIyOS03YjVjYmU3MThlYzI8L3htcE1NOkluc3RhbmNlSUQ+CiAgICAgICAg + IDx4bXBNTTpEb2N1bWVudElEPmFkb2JlOmRvY2lkOnBob3Rvc2hvcDpmNzk1YTE2Ny01ZWM4LTExZTUt + OGQ5ZS1kNDEyNmVjNWZiMTE8L3htcE1NOkRvY3VtZW50SUQ+CiAgICAgICAgIDx4bXBNTTpPcmlnaW5h + bERvY3VtZW50SUQ+eG1wLmRpZDo1MDYxYzliMi0zMGRkLTcyNGEtYjM3ZS05OTdiYmFmYWYzY2M8L3ht + cE1NOk9yaWdpbmFsRG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkhpc3Rvcnk+CiAgICAgICAgICAg + IDxyZGY6U2VxPgogICAgICAgICAgICAgICA8cmRmOmxpIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4K + ICAgICAgICAgICAgICAgICAgPHN0RXZ0OmFjdGlvbj5jcmVhdGVkPC9zdEV2dDphY3Rpb24+CiAgICAg + ICAgICAgICAgICAgIDxzdEV2dDppbnN0YW5jZUlEPnhtcC5paWQ6NTA2MWM5YjItMzBkZC03MjRhLWIz + N2UtOTk3YmJhZmFmM2NjPC9zdEV2dDppbnN0YW5jZUlEPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6 + d2hlbj4yMDE1LTA5LTE5VDEzOjIxOjM4KzAxOjAwPC9zdEV2dDp3aGVuPgogICAgICAgICAgICAgICAg + ICA8c3RFdnQ6c29mdHdhcmVBZ2VudD5BZG9iZSBQaG90b3Nob3AgQ0MgMjAxNCAoV2luZG93cyk8L3N0 + RXZ0OnNvZnR3YXJlQWdlbnQ+CiAgICAgICAgICAgICAgIDwvcmRmOmxpPgogICAgICAgICAgICAgICA8 + cmRmOmxpIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OmFj + dGlvbj5zYXZlZDwvc3RFdnQ6YWN0aW9uPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6aW5zdGFuY2VJ + RD54bXAuaWlkOmFiM2IxMWNhLWQ0ZWQtODU0YS05YjI5LTdiNWNiZTcxOGVjMjwvc3RFdnQ6aW5zdGFu + Y2VJRD4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OndoZW4+MjAxNS0wOS0xOVQxMzoyMTozOCswMTow + MDwvc3RFdnQ6d2hlbj4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OnNvZnR3YXJlQWdlbnQ+QWRvYmUg + UGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpPC9zdEV2dDpzb2Z0d2FyZUFnZW50PgogICAgICAgICAg + ICAgICAgICA8c3RFdnQ6Y2hhbmdlZD4vPC9zdEV2dDpjaGFuZ2VkPgogICAgICAgICAgICAgICA8L3Jk + ZjpsaT4KICAgICAgICAgICAgPC9yZGY6U2VxPgogICAgICAgICA8L3htcE1NOkhpc3Rvcnk+CiAgICAg + ICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgICAgIDxwaG90b3Nob3A6Q29s + b3JNb2RlPjM8L3Bob3Rvc2hvcDpDb2xvck1vZGU+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8 + L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjk2MDAwMC8xMDAwMDwv + dGlmZjpYUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6WVJlc29sdXRpb24+OTYwMDAwLzEwMDAwPC90 + aWZmOllSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29s + dXRpb25Vbml0PgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjY1NTM1PC9leGlmOkNvbG9yU3BhY2U+ + CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj4xNjwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAg + ICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4xNjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAg + IDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg + ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+iJwASgAA + AFdJREFUOE/tzjEOwCAMQ9GcLfe/S2HJ6oohCKVWCkhsDG8jHwsAMTPsaLc9oKpLPgGPlKf+ogEvs4No + aoEHR2mAPYrSQFyQoYH4S+YuOL1gFl2wqgf2QV5u4jFIagD6hAAAAABJRU5ErkJggg== + + + + 121, 17 + + + 222, 17 + + + + AAABAAEAECAAAAEAIACcAAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAMUlEQVQ4T2OgGHz7 + 9u0/JRhsgJOTE1l4kBnw4f1HkvCoAcPTAHIw3ABKMDRPkgsYGAD4YMZfYsb9cAAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/Example/Helpers/SerializerHelper.cs b/Example/Helpers/SerializerHelper.cs new file mode 100644 index 0000000..c56335c --- /dev/null +++ b/Example/Helpers/SerializerHelper.cs @@ -0,0 +1,33 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.IO; + +namespace Example +{ + public class SerializerHelper + { + public static void Serialize(T obj, string file) + { + using (var fs = File.CreateText(file)) + { + var serializer = new JsonSerializer(); + serializer.Converters.Add(new StringEnumConverter()); + serializer.Formatting = Formatting.Indented; + + serializer.Serialize(fs, obj); + } + } + + public static T Deserialize(string file) where T : class + { + using (var fs = File.OpenText(file)) + { + var serializer = new JsonSerializer(); + serializer.Converters.Add(new StringEnumConverter()); + + var result = serializer.Deserialize(fs, typeof(T)); + return result as T; + } + } + } +} diff --git a/Example/Icons.Designer.cs b/Example/Icons.Designer.cs new file mode 100644 index 0000000..30b99bd --- /dev/null +++ b/Example/Icons.Designer.cs @@ -0,0 +1,193 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Example { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Icons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Icons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Example.Icons", typeof(Icons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap application_16x { + get { + object obj = ResourceManager.GetObject("application_16x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Close_16xLG { + get { + object obj = ResourceManager.GetObject("Close_16xLG", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Collection_16xLG { + get { + object obj = ResourceManager.GetObject("Collection_16xLG", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Console { + get { + object obj = ResourceManager.GetObject("Console", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_16xLG { + get { + object obj = ResourceManager.GetObject("document_16xLG", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap files { + get { + object obj = ResourceManager.GetObject("files", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_closed { + get { + object obj = ResourceManager.GetObject("folder_closed", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_open { + get { + object obj = ResourceManager.GetObject("folder_open", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap NewFile_6276 { + get { + object obj = ResourceManager.GetObject("NewFile_6276", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap properties_16xLG { + get { + object obj = ResourceManager.GetObject("properties_16xLG", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap RefactoringLog_12810 { + get { + object obj = ResourceManager.GetObject("RefactoringLog_12810", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap StatusAnnotations_Information_16xLG_color { + get { + object obj = ResourceManager.GetObject("StatusAnnotations_Information_16xLG_color", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap StatusAnnotations_Information_16xMD_color { + get { + object obj = ResourceManager.GetObject("StatusAnnotations_Information_16xMD_color", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Example/Icons.resx b/Example/Icons.resx new file mode 100644 index 0000000..e803c73 --- /dev/null +++ b/Example/Icons.resx @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\folder_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\StatusAnnotations_Information_16xMD_color.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\folder_Closed_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\StatusAnnotations_Information_16xLG_color.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\application_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Close_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Files_7954.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\NewFile_6276.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\properties_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Console.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Collection_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\RefactoringLog_12810.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\document_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Example/Newtonsoft.Json.dll b/Example/Newtonsoft.Json.dll new file mode 100644 index 0000000..ec774e4 Binary files /dev/null and b/Example/Newtonsoft.Json.dll differ diff --git a/Example/Program.cs b/Example/Program.cs new file mode 100644 index 0000000..7126327 --- /dev/null +++ b/Example/Program.cs @@ -0,0 +1,16 @@ +using System; +using System.Windows.Forms; + +namespace Example +{ + static class Program + { + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/Example/Properties/AssemblyInfo.cs b/Example/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..81f4f65 --- /dev/null +++ b/Example/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dark UI Example")] +[assembly: AssemblyDescription("Example application for Dark UI")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Robin Perris")] +[assembly: AssemblyProduct("Dark UI")] +[assembly: AssemblyCopyright("Copyright © Robin Perris")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fa334815-6d78-4e9a-9f4d-6c8a58222a57")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/Properties/Resources.Designer.cs b/Example/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c6fca64 --- /dev/null +++ b/Example/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Example.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Example.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Example/Properties/Resources.resx b/Example/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Example/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Example/Properties/Settings.Designer.cs b/Example/Properties/Settings.Designer.cs new file mode 100644 index 0000000..b86894c --- /dev/null +++ b/Example/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Example.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Example/Properties/Settings.settings b/Example/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Example/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Example/Resources/Close_16xLG.png b/Example/Resources/Close_16xLG.png new file mode 100644 index 0000000..a9ae49f Binary files /dev/null and b/Example/Resources/Close_16xLG.png differ diff --git a/Example/Resources/Collection_16xLG.png b/Example/Resources/Collection_16xLG.png new file mode 100644 index 0000000..611a8ff Binary files /dev/null and b/Example/Resources/Collection_16xLG.png differ diff --git a/Example/Resources/Console.png b/Example/Resources/Console.png new file mode 100644 index 0000000..406db11 Binary files /dev/null and b/Example/Resources/Console.png differ diff --git a/Example/Resources/Files_7954.png b/Example/Resources/Files_7954.png new file mode 100644 index 0000000..009dde9 Binary files /dev/null and b/Example/Resources/Files_7954.png differ diff --git a/Example/Resources/NewFile_6276.png b/Example/Resources/NewFile_6276.png new file mode 100644 index 0000000..12354ce Binary files /dev/null and b/Example/Resources/NewFile_6276.png differ diff --git a/Example/Resources/RefactoringLog_12810.png b/Example/Resources/RefactoringLog_12810.png new file mode 100644 index 0000000..6a59707 Binary files /dev/null and b/Example/Resources/RefactoringLog_12810.png differ diff --git a/Example/Resources/StatusAnnotations_Information_16xLG_color.png b/Example/Resources/StatusAnnotations_Information_16xLG_color.png new file mode 100644 index 0000000..fc631e2 Binary files /dev/null and b/Example/Resources/StatusAnnotations_Information_16xLG_color.png differ diff --git a/Example/Resources/StatusAnnotations_Information_16xMD_color.png b/Example/Resources/StatusAnnotations_Information_16xMD_color.png new file mode 100644 index 0000000..cfb2d3c Binary files /dev/null and b/Example/Resources/StatusAnnotations_Information_16xMD_color.png differ diff --git a/Example/Resources/application_16x.png b/Example/Resources/application_16x.png new file mode 100644 index 0000000..10711f5 Binary files /dev/null and b/Example/Resources/application_16x.png differ diff --git a/Example/Resources/document_16xLG.png b/Example/Resources/document_16xLG.png new file mode 100644 index 0000000..cb45e88 Binary files /dev/null and b/Example/Resources/document_16xLG.png differ diff --git a/Example/Resources/folder_16x.png b/Example/Resources/folder_16x.png new file mode 100644 index 0000000..bf1195d Binary files /dev/null and b/Example/Resources/folder_16x.png differ diff --git a/Example/Resources/folder_Closed_16xLG.png b/Example/Resources/folder_Closed_16xLG.png new file mode 100644 index 0000000..ffa4210 Binary files /dev/null and b/Example/Resources/folder_Closed_16xLG.png differ diff --git a/Example/Resources/properties_16xLG.png b/Example/Resources/properties_16xLG.png new file mode 100644 index 0000000..e09aa63 Binary files /dev/null and b/Example/Resources/properties_16xLG.png differ diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..ee3cd38 --- /dev/null +++ b/todo.txt @@ -0,0 +1,31 @@ +DarkUI +-- moving nodes within a treeview doesn't re-build the next/prev references +-- Add textbox control +-- Add dropdown control +-- Allow dropdown to show arbitrary control types +-- Add dropdown treeview control +-- Add tooltip control +-- Add split panel control (and serialised version) +-- Add filter/search control +-- Add tabbed panel control +-- Fix DarkButton image align bullshit +-- Fix checkbox and radiobutton CheckAlign support +-- If you collapse a node when a child has focus, focus the parent node +-- arrow keys to scroll around the scrollbase control -- space to pan? +-- standardise the amount you scroll through with the mousewheel. Basing it on the pixels makes it weird. +-- ScrollView not taking in to account size WITHOUT scrollbars causing you to have to overshoot when re-sizing to get rid of them +-- if the final node in a treeview has been previous expanded, pressing 'down' will cause it to re-open +-- create click-through panel +-- dragging treeview nodes doesn't rebuild prev/next references + +Dock panel +-- make it so highlight form doesn't steal focus +-- add splitters between region groups +-- fix max position of splitters - can currently resize a tool window offscreen +-- serialise the visible content for groups and the active content +-- right click tab menu. close all, close all but this etc. etc. +-- stop dragging tabs instantly going to the end of the row +-- stop differently sized toolwindow tabs from vibrating when dragging +-- remove 1 pixel left padding from bottom region +-- add 1 pixel border between groups in bottom region +-- if bottom & left regions are invisible on load, then content is added, the bottom region will expand too far to the left \ No newline at end of file