This repository has been archived on 2024-08-06. You can view files and clone it, but cannot push or open issues or pull requests.
linear-app-launcher/Windows/Forms/Tile/TileGroupLabel.cs
2020-05-07 23:31:03 +01:00

101 lines
3.1 KiB
C#

using System.ComponentModel;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public partial class TileGroupLabel : AUserControl
{
protected bool isChecked = true;
public TileGroupLabel() : base()
{
InitializeComponent();
}
[Category("Appearance"), Browsable(true)]
public string TitleText { get => label1.Text; set => label1.Text = value; }
[Category("Appearance"), Browsable(true)]
public bool Checked
{
get => isChecked;
set
{
isChecked = value;
pictureBox1.BackgroundImage = (value) ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16;
if (this.TileGroupPanel != null) this.TileGroupPanel.InvalidateContainer();
}
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public TileLayoutContainer TileGroupPanel { get; set; } = null;
protected void panel_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
this.Checked = !this.Checked;
}
private void topToolStripMenuItem_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.MoveTop();
}
private void bottomToolStripMenuItem_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.MoveBottom();
}
private void upToolStripMenuItem_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.MoveUp();
}
private void downToolStripMenuItem_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.MoveDown();
}
/// <summary>
/// Add group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem2_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.AddGroup();
}
/// <summary>
/// Edit group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem1_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.EditGroup();
}
/// <summary>
/// Remove group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem3_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.Remove();
}
private void toolStripMenuItem5_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.AddRow();
}
}
}