Skip to content

Commit

Permalink
WatchList - Fixed Linter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stan-Kudri committed Feb 18, 2024
1 parent b15452e commit 2c3b5f3
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 98 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ namespace WatchList.WinForms.Control.CheckComboBox.Component
[ToolboxItem(false)]
public class CheckBoxComboBoxItem : CheckBox
{
/// <summary>
/// Initializes a new instance of the <see cref="CheckBoxComboBoxItem"/> class.
/// Constructor.
/// </summary>
/// <param name="owner">A reference to the CheckBoxComboBox.</param>
/// <param name="comboBoxItem">A reference to the item in the ComboBox.Items that this object is extending.</param>
public CheckBoxComboBoxItem(CheckBoxComboBox owner, object comboBoxItem)
public CheckBoxComboBoxItem(
CheckBoxComboBox owner, object comboBoxItem)
: base()
{
DoubleBuffered = true;
Expand Down
78 changes: 39 additions & 39 deletions WatchList.WinForms/Control/CheckComboBox/Popup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace TestTask.Controls.CheckComboBox
[ToolboxItem(false)]
public partial class Popup : ToolStripDropDown
{
private readonly ToolStripControlHost _host;

private Control content;
private bool _resizableTop;
private bool _resizableRight;
Expand Down Expand Up @@ -110,23 +112,6 @@ public bool UseFadeEffect
/// <value><c>true</c> if resizable; otherwise, <c>false</c>.</value>
public bool Resizable { get; internal set; }

private readonly ToolStripControlHost _host;

/// <summary>
/// Gets parameters of a new window.
/// </summary>
/// <returns>An object of type <see cref="T:System.Windows.Forms.CreateParams" /> used when creating a new window.</returns>
protected override CreateParams CreateParams
{
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= NativeMethods.WS_EX_NOACTIVATE;
return cp;
}
}

public VisualStyleRenderer SizeGripRenderer { get; set; }

public bool Fade { get; set; }
Expand All @@ -149,6 +134,21 @@ protected override CreateParams CreateParams

public Popup ChildPopup { get; set; }

/// <summary>
/// Gets parameters of a new window.
/// </summary>
/// <returns>An object of type <see cref="T:System.Windows.Forms.CreateParams" /> used when creating a new window.</returns>
protected override CreateParams CreateParams
{
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]

Check warning on line 143 in WatchList.WinForms/Control/CheckComboBox/Popup.cs

View workflow job for this annotation

GitHub Actions / build

'SecurityPermissionAttribute' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)

Check warning on line 143 in WatchList.WinForms/Control/CheckComboBox/Popup.cs

View workflow job for this annotation

GitHub Actions / build

'SecurityAction' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)

Check warning on line 143 in WatchList.WinForms/Control/CheckComboBox/Popup.cs

View workflow job for this annotation

GitHub Actions / build

'SecurityPermissionFlag' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)

Check warning on line 143 in WatchList.WinForms/Control/CheckComboBox/Popup.cs

View workflow job for this annotation

GitHub Actions / build

'SecurityPermissionAttribute' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)

Check warning on line 143 in WatchList.WinForms/Control/CheckComboBox/Popup.cs

View workflow job for this annotation

GitHub Actions / build

'SecurityAction' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)

Check warning on line 143 in WatchList.WinForms/Control/CheckComboBox/Popup.cs

View workflow job for this annotation

GitHub Actions / build

'SecurityPermissionFlag' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= NativeMethods.WS_EX_NOACTIVATE;
return cp;
}
}

/// <summary>
/// Shows pop-up window below the specified control.
/// </summary>
Expand Down Expand Up @@ -333,28 +333,6 @@ protected override void OnClosed(ToolStripDropDownClosedEventArgs e)
base.OnClosed(e);
}

private void SetOwnerItem(Control control)
{
if (control == null)
{
return;
}

if (control is Popup)
{
Popup popupControl = control as Popup;
OwnerPopup = popupControl;
OwnerPopup.ChildPopup = this;
OwnerItem = popupControl.Items[0];
return;
}

if (control.Parent != null)
{
SetOwnerItem(control.Parent);
}
}

protected override void OnVisibleChanged(EventArgs e)
{
if (!Visible)
Expand All @@ -380,6 +358,28 @@ protected override void WndProc(ref Message m)
base.WndProc(ref m);
}

private void SetOwnerItem(Control control)
{
if (control == null)
{
return;
}

if (control is Popup)
{
Popup popupControl = control as Popup;
OwnerPopup = popupControl;
OwnerPopup.ChildPopup = this;
OwnerItem = popupControl.Items[0];
return;
}

if (control.Parent != null)
{
SetOwnerItem(control.Parent);
}
}

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
private bool InternalProcessResizing(ref Message m, bool contentControl)
{
Expand Down
114 changes: 57 additions & 57 deletions WatchList.WinForms/Control/CheckComboBox/PopupComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ namespace TestTask.Controls.CheckComboBox
[Description("Displays an editable text box with a drop-down list of permitted values.")]
public partial class PopupComboBox : ComboBox
{
/// <summary>
/// The pop-up wrapper for the dropDownControl.
/// Made PROTECTED instead of PRIVATE so descendent classes can set its Resizable property.
/// Note however the pop-up properties must be set after the dropDownControl is assigned, since this
/// popup wrapper is recreated when the dropDownControl is assigned.
/// </summary>
protected Popup _dropDown = new Popup(new CheckBoxCMBListControlContainer());

private Control dropDownControl;

/// <summary>
/// Initializes a new instance of the <see cref="PopupComboBox"/> class.
/// </summary>
Expand All @@ -23,15 +33,54 @@ public PopupComboBox()
base.IntegralHeight = false;
}

/// <summary>
/// The pop-up wrapper for the dropDownControl.
/// Made PROTECTED instead of PRIVATE so descendent classes can set its Resizable property.
/// Note however the pop-up properties must be set after the dropDownControl is assigned, since this
/// popup wrapper is recreated when the dropDownControl is assigned.
/// </summary>
protected Popup _dropDown = new Popup(new CheckBoxCMBListControlContainer());
/// <summary>Gets or sets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new int DropDownWidth { get; set; }

private Control dropDownControl;
/// <summary>Gets or sets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new int DropDownHeight
{
get => base.DropDownHeight;
set
{
_dropDown.Height = value;
base.DropDownHeight = value;
}
}

/// <summary>Gets or sets a value indicating whether this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new bool IntegralHeight
{
get => base.IntegralHeight;
set => base.IntegralHeight = value;
}

/// <summary>Gets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new ObjectCollection Items
{
get => base.Items;
}

/// <summary>Gets or sets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new int ItemHeight
{
get => base.ItemHeight;
set => base.ItemHeight = value;
}

/// <summary>
/// Gets or sets the drop down control.
Expand Down Expand Up @@ -98,54 +147,5 @@ protected override void WndProc(ref Message m)

base.WndProc(ref m);
}

/// <summary>Gets or sets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new int DropDownWidth { get; set; }

/// <summary>Gets or sets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new int DropDownHeight
{
get => base.DropDownHeight;
set
{
_dropDown.Height = value;
base.DropDownHeight = value;
}
}

/// <summary>Gets or sets a value indicating whether this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new bool IntegralHeight
{
get => base.IntegralHeight;
set => base.IntegralHeight = value;
}

/// <summary>Gets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new ObjectCollection Items
{
get => base.Items;
}

/// <summary>Gets or sets this property is not relevant for this class.</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new int ItemHeight
{
get => base.ItemHeight;
set => base.ItemHeight = value;
}
}
}

0 comments on commit 2c3b5f3

Please sign in to comment.