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

101 lines
3.1 KiB
C#
Raw Normal View History

2020-05-02 16:17:10 +00:00
using System.ComponentModel;
2020-04-05 12:36:39 +00:00
using System.Windows.Forms;
2020-03-28 22:48:06 +00:00
namespace AppLauncher.Windows.Forms
{
2020-04-11 17:43:20 +00:00
public partial class TileGroupLabel : AUserControl
2020-03-28 22:48:06 +00:00
{
2020-05-02 16:17:10 +00:00
protected bool isChecked = true;
2020-03-28 22:48:06 +00:00
2020-04-11 17:43:20 +00:00
public TileGroupLabel() : base()
2020-03-28 22:48:06 +00:00
{
InitializeComponent();
}
2020-03-29 14:28:38 +00:00
[Category("Appearance"), Browsable(true)]
2020-03-30 10:48:24 +00:00
public string TitleText { get => label1.Text; set => label1.Text = value; }
2020-03-28 22:48:06 +00:00
2020-03-29 14:28:38 +00:00
[Category("Appearance"), Browsable(true)]
public bool Checked
2020-03-28 22:48:06 +00:00
{
2020-03-29 14:28:38 +00:00
get => isChecked;
set
2020-03-28 22:48:06 +00:00
{
2020-03-29 14:28:38 +00:00
isChecked = value;
2020-03-28 22:48:06 +00:00
2020-03-29 14:28:38 +00:00
pictureBox1.BackgroundImage = (value) ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16;
2020-05-02 16:17:10 +00:00
2020-05-03 18:36:06 +00:00
if (this.TileGroupPanel != null) this.TileGroupPanel.InvalidateContainer();
2020-03-28 22:48:06 +00:00
}
}
2020-04-11 17:43:20 +00:00
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
2020-05-07 22:31:03 +00:00
public TileLayoutContainer TileGroupPanel { get; set; } = null;
2020-04-05 12:36:39 +00:00
2020-05-02 16:17:10 +00:00
protected void panel_MouseClick(object sender, MouseEventArgs e)
2020-04-05 12:36:39 +00:00
{
if (e.Button != MouseButtons.Left)
{
return;
}
this.Checked = !this.Checked;
}
2020-05-03 18:36:06 +00:00
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();
}
2020-05-07 22:31:03 +00:00
private void toolStripMenuItem5_Click(object sender, System.EventArgs e)
{
if (this.TileGroupPanel != null) this.TileGroupPanel.AddRow();
}
2020-03-28 22:48:06 +00:00
}
2020-04-11 17:43:20 +00:00
}