From 9e167916cb904d555f853ab67c82be99d2371bc7 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 15 May 2020 01:19:09 +0100 Subject: [PATCH] Changed: simplified tile container, removed group label --- LinearAppLauncher.csproj | 31 +--- MainForm.Designer.cs | 19 +-- MainForm.cs | 6 +- Properties/Resources.Designer.cs | 10 ++ Properties/Resources.resx | 3 + Resources/app_icon_24.png | Bin 0 -> 512 bytes Resources/raw/listbox.svg | 112 +++++++++++++- Resources/toggle-left-ea-16.png | Bin 429 -> 506 bytes Resources/toggle-right-ea-16.png | Bin 439 -> 502 bytes .../Forms/{FlatButton.cs => TFlatButton.cs} | 4 +- ...er.cs => THorizontalSeparator.Designer.cs} | 2 +- ...alSeparator.cs => THorizontalSeparator.cs} | 6 +- .../Forms/{ImageBox.cs => TImageBox.cs} | 6 +- .../Windows/ThemedForms/TButtonTextBox.cs | 2 +- .../ThemedForms/TButtonTextBox.designer.cs | 4 +- .../ThemedForms/TDialogForm.Designer.cs | 4 +- .../Windows/ThemedForms/TListBox.designer.cs | 20 +-- Windows/Forms/AForm.cs | 80 +++++++++- Windows/Forms/Tile/AddListTileForm.cs | 4 +- Windows/Forms/Tile/AddTileForm.cs | 8 +- Windows/Forms/Tile/EditListTileForm.cs | 4 +- Windows/Forms/Tile/EditTileForm.cs | 8 +- .../Tile/TileLayoutContainer.Designer.cs | 140 +++++++++++++++--- Windows/Forms/Tile/TileLayoutContainer.cs | 98 +++++++++--- Windows/Forms/Tile/TileLayoutContainer.resx | 3 + 25 files changed, 443 insertions(+), 131 deletions(-) create mode 100644 Resources/app_icon_24.png rename RyzStudio/Windows/Forms/{FlatButton.cs => TFlatButton.cs} (97%) rename RyzStudio/Windows/Forms/{HorizontalSeparator.Designer.cs => THorizontalSeparator.Designer.cs} (96%) rename RyzStudio/Windows/Forms/{HorizontalSeparator.cs => THorizontalSeparator.cs} (85%) rename RyzStudio/Windows/Forms/{ImageBox.cs => TImageBox.cs} (87%) diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index c2ea81a..071451e 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -73,16 +73,16 @@ Resource1.resx - + Component - + UserControl - - HorizontalSeparator.cs + + THorizontalSeparator.cs - + Component @@ -154,12 +154,6 @@ UserControl - - UserControl - - - TileGroupLabel.cs - UserControl @@ -175,12 +169,6 @@ TilePanel.cs - - UserControl - - - TitlePanel.cs - MainForm.cs @@ -225,9 +213,6 @@ EditTileForm.cs - - TileGroupLabel.cs - TileLayoutContainer.cs @@ -237,9 +222,6 @@ TilePanel.cs - - TitlePanel.cs - SettingsSingleFileGenerator @@ -315,5 +297,8 @@ + + + \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 89888e2..de5fcdb 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -29,7 +29,6 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); @@ -42,20 +41,6 @@ this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // - // titlePanel1 - // - this.titlePanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.titlePanel1.BackColor = System.Drawing.Color.Black; - this.titlePanel1.LabelVisible = true; - this.titlePanel1.Location = new System.Drawing.Point(0, 0); - this.titlePanel1.MainMenu = this.contextMenuStrip1; - this.titlePanel1.MinimumSize = new System.Drawing.Size(40, 40); - this.titlePanel1.Name = "titlePanel1"; - this.titlePanel1.Size = new System.Drawing.Size(1088, 40); - this.titlePanel1.TabIndex = 8; - this.titlePanel1.TitleText = "Launcher"; - // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -129,11 +114,10 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93))))); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(254))))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ClientSize = new System.Drawing.Size(1088, 440); this.Controls.Add(this.flowLayoutPanel1); - this.Controls.Add(this.titlePanel1); this.Name = "MainForm"; this.Text = "Form1"; this.contextMenuStrip1.ResumeLayout(false); @@ -142,7 +126,6 @@ } #endregion - private Windows.Forms.TitlePanel titlePanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; diff --git a/MainForm.cs b/MainForm.cs index 4972c09..b994153 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -51,7 +51,7 @@ namespace AppLauncher if (this.Width > collapsedWidth) { flowLayoutPanel1.Visible = false; - titlePanel1.LabelVisible = false; + //titlePanel1.LabelVisible = false; await collapseWindow(collapsedWidth, 6); } @@ -60,7 +60,7 @@ namespace AppLauncher await expandWindow(expandedWidth, 8); flowLayoutPanel1.Visible = true; - titlePanel1.LabelVisible = true; + //titlePanel1.LabelVisible = true; } } @@ -199,7 +199,7 @@ namespace AppLauncher flowLayoutPanel1.Width = maxWidth + SystemInformation.VerticalScrollBarWidth + 20; //this.Width = flowLayoutPanel1.Width + (flowLayoutPanel1.Left * 2); - this.Width = flowLayoutPanel1.Width + flowLayoutPanel1.Left; + //##this.Width = flowLayoutPanel1.Width + flowLayoutPanel1.Left; } } diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 825d8b3..79b0177 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ namespace AppLauncher.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap app_icon_24 { + get { + object obj = ResourceManager.GetObject("app_icon_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 4bcc2b3..a92d9ed 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\app_icon_24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\arrow-right-ea-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Resources/app_icon_24.png b/Resources/app_icon_24.png new file mode 100644 index 0000000000000000000000000000000000000000..2d9b51f9f10071df16f16bb1e6c047a8f7ccd4df GIT binary patch literal 512 zcmV+b0{{JqP)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10gXvS zK~zYI?Uk`^n_v`$zk_%grb_M53BN*AVLD*us1i(FTdAqkIa4jQot+E`R+U$XAHpw# zd^!+g0@zsUl&WXp{+DylfBCsOzvheL9+-0)HRfw|yZi<)&x+58FF-g^R|P;aLE=g1 zqO-m@LmVIp0X4B#auBY4ER>6ci$7?cAF4?4l-{`UK?K6$<b` z#K(Ja-H!zkCK__vmg-RG%JA;Ea3g4O-LAy7%*XDSk3sPJwC+oQ(na~{+#_1AmUjS2 zUc5i|h(hBl&M>Y30OUp6*3s&*+H|UyOoMz<+#nG{06hvuOUJfdnE3@6e4OjX8 znj3}fXR#VLMIO0MTeEWjtdEKwPy-L0^}|zc3hO_&u!`wsWp$hY0000 + + + + + + + + + + + + + + diff --git a/Resources/toggle-left-ea-16.png b/Resources/toggle-left-ea-16.png index 94a71376bf0e3865665b76ab2413fe2af00ae2f0..e7895fd54022e74fed851ee550eb693be6ae2aa1 100644 GIT binary patch delta 444 zcmV;t0Ym<+1NsAyNPiB(000ic0Tn1pfB*mik4Z#9R5(x7lD$hpVHC#Cxeh_l6qQ3C zL;rzgDfY1h4RWESInpdNfM z5@V(vBy06gh#SCn zKCIhxdFN-DIEH!b!T5HCxS;9PU|?n(F^*B3aPCjXBQ@(^eU49udbwN)utNRVsO3|x mM%(yEyEExz^xTkY9HI~3bA>Lf-^gD80000PznxG5TTDyT`ld>sZO0D=qNb&0A19g(5(m>1nCR-0Qon&nfNd- z`<=h{MlC<|+^Qf5s#@y~?jE!=>q;}Z&S6ZTg>V;!;W3HpoF|+=q%aQ#wrFxgUR_f#rooqKnkNLFi0{Bp zxPg8~lUpgugSrRIs==oMM+jByA?xqjw!MWvU`iib3YtG+D$?LDEFSnjNCS_l4W_=~ zKXb2FwwdDh;AaIag*+t2Q*j(0P>{?YW`#$Uw`ikn&QgmYeoFisyZ`$e&nb4f*NAO~ zNWSPLaA1?XBW#DQuNU|9eSe$vySO#DmWf43;}`N={@VLYT5>4$12Q#>dkHX+SpWb4 M07*qoM6N<$g7xXB1poj5 diff --git a/Resources/toggle-right-ea-16.png b/Resources/toggle-right-ea-16.png index b8ae67e3f6f54c1ea363b98a10a9285e3a2541b6..aedd7c2f94120ca876963df3b9500d46e6f058f4 100644 GIT binary patch delta 440 zcmV;p0Z0C~1NH-uNPiB(000ic0Tn1pfB*mii%CR5R5(x7lFutdQ546|xfY@<{aUb) zzkp;UY-Xb|Wn-(nG4#fU$jn$M3*}9t*vyQ0v$358k%gVi0vq`QEQInSD}~bB<9pvs z%9~{EQ>Sz8_nv$1>D){IAFg<^rjvcF^gO~rSfeLa^DIIqihpH&C!0Dmf>$6COU#i- znwj>IP!QrLqx)f!Cb%(JSV$J~+0+JGb|Q$4V_}KrGbz{0^f75Cx;4oV3E#ZFT<CMeKqm}$0;P4b~%Obpjb;62m&2=NUkMDbkYZVCvi1`qUUyx;C zUUjohSE+{jA%6_tKfMQp=>Ty+c{zW;f^?uh$;&U5lo)SNn2ecbxV)@JGp)caMeO(` zD=MPeQG09cIc8waoGI44hBm`iEFSev_{e9RZLM?Mq!N6MZ#CS#tq4Rk+<7|F^q%nz^WG|QW0@@rvq2`M0#}qy_ if5y$FF3QqBhv*9-gNhwuUjr2Y0000s5 delta 376 zcmV-;0f+wf1GfW^NPiM@000tm0gNKK2LJ#8Oi4sRR5(x7l08ntKoEs@x5));;{$Ml zP+){00;NF^35r|*DbzqxQ6N#!83`&x!3|Ob5mBT=q%bsyBhdM;P8XYR*9j7_CF(rs zWyZ5_-fYGe%MUq=B8s97DP@;*8``E=Mgm{6EW2@CH_!!Rkbfk}S)S)U=@TY>1hK9! zLMi1C+GtzodbVxfN+vgX7;(^X9Ouy}7r=luLIdM(G=nrvk1=_`uqop>9$_%S?XZyl z1 /// Required designer variable. diff --git a/RyzStudio/Windows/Forms/HorizontalSeparator.cs b/RyzStudio/Windows/Forms/THorizontalSeparator.cs similarity index 85% rename from RyzStudio/Windows/Forms/HorizontalSeparator.cs rename to RyzStudio/Windows/Forms/THorizontalSeparator.cs index 7a4dfee..3311e09 100644 --- a/RyzStudio/Windows/Forms/HorizontalSeparator.cs +++ b/RyzStudio/Windows/Forms/THorizontalSeparator.cs @@ -3,9 +3,9 @@ using System.Windows.Forms; namespace RyzStudio.Windows.Forms { - public partial class HorizontalSeparator : System.Windows.Forms.UserControl + public partial class THorizontalSeparator : System.Windows.Forms.UserControl { - public HorizontalSeparator() + public THorizontalSeparator() { InitializeComponent(); @@ -17,8 +17,10 @@ namespace RyzStudio.Windows.Forms base.OnPaintBackground(e); Graphics g = e.Graphics; + g.FillRectangle(new SolidBrush(Color.FromArgb(213, 223, 229)), new Rectangle(this.DisplayRectangle.Left, 0, this.DisplayRectangle.Width, 1)); g.FillRectangle(new SolidBrush(Color.FromArgb(249, 251, 253)), new Rectangle(this.DisplayRectangle.Left, 1, this.DisplayRectangle.Width, 1)); } + } } diff --git a/RyzStudio/Windows/Forms/ImageBox.cs b/RyzStudio/Windows/Forms/TImageBox.cs similarity index 87% rename from RyzStudio/Windows/Forms/ImageBox.cs rename to RyzStudio/Windows/Forms/TImageBox.cs index eebcc75..f26f2b0 100644 --- a/RyzStudio/Windows/Forms/ImageBox.cs +++ b/RyzStudio/Windows/Forms/TImageBox.cs @@ -4,9 +4,9 @@ using System.Drawing; namespace RyzStudio.Windows.Forms { - public class ImageBox : System.Windows.Forms.PictureBox + public class TImageBox : System.Windows.Forms.PictureBox { - public ImageBox() : base() + public TImageBox() : base() { this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.ErrorImage = null; @@ -22,7 +22,7 @@ namespace RyzStudio.Windows.Forms } [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new Image Image { get => base.Image; set { base.Image = value; } } + public new Image Image { get => base.Image; set => base.Image = value; } [Category("Appearance"), Browsable(true)] public Image NormalImage { get; set; } diff --git a/RyzStudio/Windows/ThemedForms/TButtonTextBox.cs b/RyzStudio/Windows/ThemedForms/TButtonTextBox.cs index f995110..e268403 100644 --- a/RyzStudio/Windows/ThemedForms/TButtonTextBox.cs +++ b/RyzStudio/Windows/ThemedForms/TButtonTextBox.cs @@ -77,7 +77,7 @@ [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] [Category("Appearance")] - public Forms.ImageBox InnerImageBox { get => imageBox1; set => imageBox1 = value; } + public Forms.TImageBox InnerImageBox { get => imageBox1; set => imageBox1 = value; } [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] [Category("Appearance")] diff --git a/RyzStudio/Windows/ThemedForms/TButtonTextBox.designer.cs b/RyzStudio/Windows/ThemedForms/TButtonTextBox.designer.cs index 7859c87..5465caa 100644 --- a/RyzStudio/Windows/ThemedForms/TButtonTextBox.designer.cs +++ b/RyzStudio/Windows/ThemedForms/TButtonTextBox.designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); - this.imageBox1 = new RyzStudio.Windows.Forms.ImageBox(); + this.imageBox1 = new RyzStudio.Windows.Forms.TImageBox(); ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); this.SuspendLayout(); // @@ -76,6 +76,6 @@ #endregion private System.Windows.Forms.TextBox textBox1; - private Forms.ImageBox imageBox1; + private Forms.TImageBox imageBox1; } } diff --git a/RyzStudio/Windows/ThemedForms/TDialogForm.Designer.cs b/RyzStudio/Windows/ThemedForms/TDialogForm.Designer.cs index 592da20..72f906b 100644 --- a/RyzStudio/Windows/ThemedForms/TDialogForm.Designer.cs +++ b/RyzStudio/Windows/ThemedForms/TDialogForm.Designer.cs @@ -30,7 +30,7 @@ { this.lblDescription = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); - this.imgbxClose = new RyzStudio.Windows.Forms.ImageBox(); + this.imgbxClose = new RyzStudio.Windows.Forms.TImageBox(); this.area1 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); this.SuspendLayout(); @@ -115,7 +115,7 @@ } #endregion - protected internal Forms.ImageBox imgbxClose; + protected internal Forms.TImageBox imgbxClose; protected internal System.Windows.Forms.Label lblDescription; protected internal System.Windows.Forms.Panel panel1; protected internal System.Windows.Forms.Panel area1; diff --git a/RyzStudio/Windows/ThemedForms/TListBox.designer.cs b/RyzStudio/Windows/ThemedForms/TListBox.designer.cs index eff99b6..5a03aeb 100644 --- a/RyzStudio/Windows/ThemedForms/TListBox.designer.cs +++ b/RyzStudio/Windows/ThemedForms/TListBox.designer.cs @@ -29,11 +29,11 @@ private void InitializeComponent() { this.listBox1 = new System.Windows.Forms.ListBox(); - this.imageBox5 = new RyzStudio.Windows.Forms.ImageBox(); - this.imageBox4 = new RyzStudio.Windows.Forms.ImageBox(); - this.imageBox3 = new RyzStudio.Windows.Forms.ImageBox(); - this.imageBox2 = new RyzStudio.Windows.Forms.ImageBox(); - this.imageBox1 = new RyzStudio.Windows.Forms.ImageBox(); + this.imageBox5 = new RyzStudio.Windows.Forms.TImageBox(); + this.imageBox4 = new RyzStudio.Windows.Forms.TImageBox(); + this.imageBox3 = new RyzStudio.Windows.Forms.TImageBox(); + this.imageBox2 = new RyzStudio.Windows.Forms.TImageBox(); + this.imageBox1 = new RyzStudio.Windows.Forms.TImageBox(); ((System.ComponentModel.ISupportInitialize)(this.imageBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imageBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit(); @@ -173,10 +173,10 @@ #endregion private System.Windows.Forms.ListBox listBox1; - private Forms.ImageBox imageBox1; - private Forms.ImageBox imageBox2; - private Forms.ImageBox imageBox3; - private Forms.ImageBox imageBox4; - private Forms.ImageBox imageBox5; + private Forms.TImageBox imageBox1; + private Forms.TImageBox imageBox2; + private Forms.TImageBox imageBox3; + private Forms.TImageBox imageBox4; + private Forms.TImageBox imageBox5; } } diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs index 3cfa1c0..3d1772d 100644 --- a/Windows/Forms/AForm.cs +++ b/Windows/Forms/AForm.cs @@ -12,6 +12,9 @@ namespace AppLauncher.Windows.Forms { public class AForm : Form { + protected bool isDragging = false; + protected Point startPosition = new Point(); + public AForm() : base() { if (!this.DesignMode) @@ -19,6 +22,10 @@ namespace AppLauncher.Windows.Forms this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; } + + this.MouseDown += mainForm_MouseDown; + this.MouseUp += mainForm_MouseUp; + this.MouseMove += mainForm_MouseMove; } protected override void OnLoad(EventArgs e) @@ -40,21 +47,48 @@ namespace AppLauncher.Windows.Forms //this.Location = newPosition; } - protected override void OnPaintBackground(PaintEventArgs e) + protected override void OnPaint(PaintEventArgs e) { - base.OnPaintBackground(e); + base.OnPaint(e); Graphics g = e.Graphics; - g.TextRenderingHint = TextRenderingHint.AntiAlias; - g.InterpolationMode = InterpolationMode.HighQualityBilinear; - g.PixelOffsetMode = PixelOffsetMode.HighQuality; - g.SmoothingMode = SmoothingMode.HighQuality; - //g.FillRectangle(new LinearGradientBrush(this.DisplayRectangle, Color.FromArgb(76, 83, 93), Color.FromArgb(255, 255, 255), -30F), this.DisplayRectangle); + Color borderColour = Color.FromArgb(232, 231, 236); + Color menubarColour = Color.FromArgb(237, 240, 247); + Rectangle area = new Rectangle(this.DisplayRectangle.X, this.DisplayRectangle.Y, (this.DisplayRectangle.Width - 1), (this.DisplayRectangle.Height - 1)); + + // border + g.DrawRectangle(new Pen(borderColour, 1), area); + + area.Inflate(-1, -1); + + g.FillRectangle(new SolidBrush(menubarColour), area.X, area.Y, (area.Width + area.X), 56); + g.DrawLine(new Pen(borderColour, 1), area.X, 57, (area.Width + area.X), 57); + + g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17); + + TextRenderer.DrawText(e.Graphics, "Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171)); + + //g.DrawRectangle(new Pen(Color.FromArgb(232, 231, 236), 1), borderArea); + //g.DrawRectangle(new Pen(Color.Red, 1), area); - //g.DrawRectangle(new Pen(new SolidBrush(Color.Red), 1), this.DisplayRectangle); } + //protected override void OnPaintBackground(PaintEventArgs e) + //{ + // base.OnPaintBackground(e); + + //Graphics g = e.Graphics; + //g.TextRenderingHint = TextRenderingHint.AntiAlias; + //g.InterpolationMode = InterpolationMode.HighQualityBilinear; + //g.PixelOffsetMode = PixelOffsetMode.HighQuality; + //g.SmoothingMode = SmoothingMode.HighQuality; + + //g.FillRectangle(new LinearGradientBrush(this.DisplayRectangle, Color.FromArgb(76, 83, 93), Color.FromArgb(255, 255, 255), -30F), this.DisplayRectangle); + + //g.DrawRectangle(new Pen(new SolidBrush(Color.Red), 1), this.DisplayRectangle); + //} + protected Point DefaultLocation { get @@ -70,5 +104,35 @@ namespace AppLauncher.Windows.Forms } } + public override Color BackColor { get => base.BackColor; set => base.BackColor = Color.FromArgb(254, 254, 254); } + + private void mainForm_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + isDragging = true; + startPosition = e.Location; + } + + private void mainForm_MouseUp(object sender, MouseEventArgs e) + { + isDragging = false; + } + + private void mainForm_MouseMove(object sender, MouseEventArgs e) + { + if (isDragging) + { + int x = (this.Location.X + (e.Location.X - startPosition.X)); + int y = (this.Location.Y + (e.Location.Y - startPosition.Y)); + + //this.Location = validateFormLocation(x, y); + this.Location = new Point(x, y); + } + } + } } \ No newline at end of file diff --git a/Windows/Forms/Tile/AddListTileForm.cs b/Windows/Forms/Tile/AddListTileForm.cs index b79d1b6..7dc42ea 100644 --- a/Windows/Forms/Tile/AddListTileForm.cs +++ b/Windows/Forms/Tile/AddListTileForm.cs @@ -14,7 +14,7 @@ namespace AppLauncher.Windows.Forms private System.Windows.Forms.Label label1; private TButton button1; - private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator1; + private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; private TTextBox textBox1; protected TileLayoutPanel parentPanel = null; @@ -39,7 +39,7 @@ namespace AppLauncher.Windows.Forms this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); - this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator(); + this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); this.SuspendLayout(); // diff --git a/Windows/Forms/Tile/AddTileForm.cs b/Windows/Forms/Tile/AddTileForm.cs index 46d52f4..3e7c90f 100644 --- a/Windows/Forms/Tile/AddTileForm.cs +++ b/Windows/Forms/Tile/AddTileForm.cs @@ -29,8 +29,8 @@ namespace AppLauncher.Windows.Forms private TButton button1; private TPickerBox pickerBox1; private TPickerBox pickerBox2; - private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator1; - private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator2; + private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; + private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private TTextBox textBox1; protected TileLayoutPanel parentPanel = null; @@ -67,8 +67,8 @@ namespace AppLauncher.Windows.Forms this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox(); this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TPickerBox(); - this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator(); - this.horizontalSeparator2 = new RyzStudio.Windows.Forms.HorizontalSeparator(); + this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); + this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); this.SuspendLayout(); // diff --git a/Windows/Forms/Tile/EditListTileForm.cs b/Windows/Forms/Tile/EditListTileForm.cs index ff12612..f50cbd9 100644 --- a/Windows/Forms/Tile/EditListTileForm.cs +++ b/Windows/Forms/Tile/EditListTileForm.cs @@ -14,7 +14,7 @@ namespace AppLauncher.Windows.Forms private System.Windows.Forms.Label label1; private TButton button1; - private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator2; + private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private TTextBox textBox1; private TListBox tListBox1; private System.Windows.Forms.Label label2; @@ -57,7 +57,7 @@ namespace AppLauncher.Windows.Forms this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); - this.horizontalSeparator2 = new RyzStudio.Windows.Forms.HorizontalSeparator(); + this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.tListBox1 = new RyzStudio.Windows.ThemedForms.TListBox(); this.label2 = new System.Windows.Forms.Label(); this.tButton1 = new RyzStudio.Windows.ThemedForms.TButton(); diff --git a/Windows/Forms/Tile/EditTileForm.cs b/Windows/Forms/Tile/EditTileForm.cs index fa345e0..1940ff6 100644 --- a/Windows/Forms/Tile/EditTileForm.cs +++ b/Windows/Forms/Tile/EditTileForm.cs @@ -25,8 +25,8 @@ namespace AppLauncher.Windows.Forms private TButton button1; private TPickerBox pickerBox1; private TPickerBox pickerBox2; - private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator1; - private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator2; + private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; + private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private TTextBox textBox1; protected TilePanel parentPanel = null; @@ -63,8 +63,8 @@ namespace AppLauncher.Windows.Forms this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox(); this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TPickerBox(); - this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator(); - this.horizontalSeparator2 = new RyzStudio.Windows.Forms.HorizontalSeparator(); + this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); + this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); this.SuspendLayout(); // diff --git a/Windows/Forms/Tile/TileLayoutContainer.Designer.cs b/Windows/Forms/Tile/TileLayoutContainer.Designer.cs index 408b0d8..95290c8 100644 --- a/Windows/Forms/Tile/TileLayoutContainer.Designer.cs +++ b/Windows/Forms/Tile/TileLayoutContainer.Designer.cs @@ -29,28 +29,26 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.label1 = new AppLauncher.Windows.Forms.TileGroupLabel(); this.panel1 = new AppLauncher.Windows.Forms.TileLayoutPanel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); + this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.upToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.downToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.bottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); + this.contextMenuStrip2.SuspendLayout(); this.SuspendLayout(); // - // label1 - // - this.label1.AutoScrollMargin = new System.Drawing.Size(0, 0); - this.label1.AutoScrollMinSize = new System.Drawing.Size(0, 0); - this.label1.Checked = false; - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 3); - this.label1.MinimumSize = new System.Drawing.Size(100, 20); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(223, 20); - this.label1.TabIndex = 11; - this.label1.TileGroupPanel = null; - this.label1.TitleText = "Featured"; - // // panel1 // this.panel1.AllowDrop = true; @@ -69,42 +67,142 @@ this.addToolStripMenuItem, this.addListToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70); + this.contextMenuStrip1.Size = new System.Drawing.Size(139, 48); // // addToolStripMenuItem // this.addToolStripMenuItem.Name = "addToolStripMenuItem"; - this.addToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.addToolStripMenuItem.Text = "&Add Tile"; this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click); // // addListToolStripMenuItem // this.addListToolStripMenuItem.Name = "addListToolStripMenuItem"; - this.addListToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addListToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.addListToolStripMenuItem.Text = "Add &List Tile"; this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click); // + // contextMenuStrip2 + // + this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItem2, + this.toolStripMenuItem5, + this.toolStripMenuItem1, + this.toolStripSeparator2, + this.toolStripMenuItem4, + this.toolStripSeparator1, + this.toolStripMenuItem3}); + this.contextMenuStrip2.Name = "contextMenuStrip1"; + this.contextMenuStrip2.Size = new System.Drawing.Size(133, 126); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem2.Text = "&Add Group"; + this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); + // + // toolStripMenuItem5 + // + this.toolStripMenuItem5.Name = "toolStripMenuItem5"; + this.toolStripMenuItem5.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem5.Text = "Add &Row"; + this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem1.Text = "&Edit"; + this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(129, 6); + // + // toolStripMenuItem4 + // + this.toolStripMenuItem4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.topToolStripMenuItem, + this.upToolStripMenuItem, + this.downToolStripMenuItem, + this.bottomToolStripMenuItem}); + this.toolStripMenuItem4.Name = "toolStripMenuItem4"; + this.toolStripMenuItem4.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem4.Text = "&Move"; + // + // topToolStripMenuItem + // + this.topToolStripMenuItem.Name = "topToolStripMenuItem"; + this.topToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.topToolStripMenuItem.Text = "&Top"; + this.topToolStripMenuItem.Click += new System.EventHandler(this.topToolStripMenuItem_Click); + // + // upToolStripMenuItem + // + this.upToolStripMenuItem.Name = "upToolStripMenuItem"; + this.upToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.upToolStripMenuItem.Text = "&Up"; + this.upToolStripMenuItem.Click += new System.EventHandler(this.upToolStripMenuItem_Click); + // + // downToolStripMenuItem + // + this.downToolStripMenuItem.Name = "downToolStripMenuItem"; + this.downToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.downToolStripMenuItem.Text = "&Down"; + this.downToolStripMenuItem.Click += new System.EventHandler(this.downToolStripMenuItem_Click); + // + // bottomToolStripMenuItem + // + this.bottomToolStripMenuItem.Name = "bottomToolStripMenuItem"; + this.bottomToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.bottomToolStripMenuItem.Text = "&Bottom"; + this.bottomToolStripMenuItem.Click += new System.EventHandler(this.bottomToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(129, 6); + // + // toolStripMenuItem3 + // + this.toolStripMenuItem3.Name = "toolStripMenuItem3"; + this.toolStripMenuItem3.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem3.Text = "&Remove"; + this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click); + // // TileLayoutContainer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.panel1); - this.Controls.Add(this.label1); this.Name = "TileLayoutContainer"; this.Size = new System.Drawing.Size(370, 150); this.contextMenuStrip1.ResumeLayout(false); + this.contextMenuStrip2.ResumeLayout(false); this.ResumeLayout(false); } #endregion - - private TileGroupLabel label1; private TileLayoutPanel panel1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; + private System.Windows.Forms.ToolStripMenuItem topToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; } } diff --git a/Windows/Forms/Tile/TileLayoutContainer.cs b/Windows/Forms/Tile/TileLayoutContainer.cs index 95f6287..e90c9d5 100644 --- a/Windows/Forms/Tile/TileLayoutContainer.cs +++ b/Windows/Forms/Tile/TileLayoutContainer.cs @@ -1,6 +1,7 @@ using AppLauncher.Models; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Drawing; using System.Threading; using System.Threading.Tasks; @@ -10,19 +11,19 @@ namespace AppLauncher.Windows.Forms { public partial class TileLayoutContainer : AUserControl { - protected int collapseIncrement = 6; - protected int expandIncrement = 8; protected TileGroupModel groupInfo = null; + + protected readonly int labelHeight = 20; + protected readonly int collapseIncrement = 6; + protected readonly int expandIncrement = 8; + protected bool isAnimating = false; + protected bool isChecked = true; public TileLayoutContainer(TileGroupModel model) : base() { InitializeComponent(); - this.ContextMenuStrip = contextMenuStrip1; - - label1.TileGroupPanel = this; - this.LoadModel(model); panel1.Resize += panel1_Resize; @@ -32,9 +33,7 @@ namespace AppLauncher.Windows.Forms { base.OnLoad(e); - label1.Width = panel1.Width; - - this.Margin = new Padding(0, 0, 0, 0); + this.Margin = new Padding(0); this.Padding = new Padding(0, 0, 0, 10); //this.MaximumSize = new Size(panel1.Width, ExpandedHeight); //this.MinimumSize = new Size(panel1.Width, label1.Height); @@ -42,16 +41,23 @@ namespace AppLauncher.Windows.Forms this.Size = new Size(panel1.Width, this.ExpandedHeight); } - private async void panel1_Resize(object sender, EventArgs e) + protected override void OnPaint(PaintEventArgs e) { - await this.InvalidateContainer(); + base.OnPaint(e); + + Graphics g = e.Graphics; + + g.DrawImageUnscaled((isChecked ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16), 2, 2); + + TextRenderer.DrawText(g, groupInfo?.Title, new Font(this.Font.FontFamily, 8.25F), new Point(25, 4), Color.FromArgb(99, 105, 119)); + } - public int CollapseHeight => label1.Height + panel1.CollapseHeight; + private async void panel1_Resize(object sender, EventArgs e) => await this.InvalidateContainer(); - public int ExpandedHeight => label1.Height + panel1.ExpandedHeight + this.Padding.Top + this.Padding.Bottom; + public int CollapseHeight => labelHeight + panel1.CollapseHeight; - public bool IsAnimating => isAnimating; + public int ExpandedHeight => labelHeight + panel1.ExpandedHeight + this.Padding.Top + this.Padding.Bottom; public TileGroupModel Model { @@ -59,9 +65,9 @@ namespace AppLauncher.Windows.Forms { TileGroupModel rs = new TileGroupModel() { - Title = label1.TitleText, + Title = groupInfo.Title, GridSize = new Size(panel1.GridSize.X, panel1.GridSize.Y), - IsExpanded = label1.Checked, + IsExpanded = isChecked, IsExclusive = groupInfo.IsExclusive, Items = panel1.Tiles }; @@ -171,12 +177,12 @@ namespace AppLauncher.Windows.Forms public async Task InvalidateContainer(bool animate = true) { - if (this.IsAnimating) + if (isAnimating) { return; } - if (label1.Checked) + if (isChecked) { await this.Expand(); } @@ -222,16 +228,17 @@ namespace AppLauncher.Windows.Forms { groupInfo = model; - label1.TitleText = groupInfo.Title; panel1.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height); this.Width = panel1.Width; - label1.Checked = groupInfo.IsExpanded; + isChecked = groupInfo.IsExpanded; if (loadTiles) { panel1.LoadTiles(model.Items); } + + this.Invalidate(); } public void MoveTop() @@ -300,5 +307,56 @@ namespace AppLauncher.Windows.Forms private void addListTileMenuItem_Click(object sender, EventArgs e) => AddListTileForm.ShowDialog(panel1); + protected override async void OnMouseClick(MouseEventArgs e) + { + base.OnMouseClick(e); + + bool isLabel = ((e.Location.X >= 0) && (e.Location.X <= this.Width) && (e.Location.Y >= 0) && (e.Location.Y <= 20)); + + if (e.Button == MouseButtons.Left) + { + if (isLabel) + { + isChecked = !isChecked; + + this.Invalidate(); + await this.InvalidateContainer(); + } + else + { + + } + } + else if (e.Button == MouseButtons.Right) + { + if (isLabel) + { + contextMenuStrip2.Show(this, e.Location); + } + else + { + contextMenuStrip1.Show(this, e.Location); + } + } + } + + protected override void OnMouseDoubleClick(MouseEventArgs e) => base.OnMouseClick(e); + + private void toolStripMenuItem2_Click(object sender, EventArgs e) => this.AddGroup(); + + private void toolStripMenuItem5_Click(object sender, EventArgs e) => this.AddRow(); + + private void toolStripMenuItem1_Click(object sender, EventArgs e) => this.EditGroup(); + + private void topToolStripMenuItem_Click(object sender, EventArgs e) => this.MoveTop(); + + private void upToolStripMenuItem_Click(object sender, EventArgs e) => this.MoveUp(); + + private void downToolStripMenuItem_Click(object sender, EventArgs e) => this.MoveDown(); + + private void bottomToolStripMenuItem_Click(object sender, EventArgs e) => this.MoveBottom(); + + private void toolStripMenuItem3_Click(object sender, EventArgs e) => this.Remove(); + } } diff --git a/Windows/Forms/Tile/TileLayoutContainer.resx b/Windows/Forms/Tile/TileLayoutContainer.resx index ad53752..8baf68f 100644 --- a/Windows/Forms/Tile/TileLayoutContainer.resx +++ b/Windows/Forms/Tile/TileLayoutContainer.resx @@ -120,4 +120,7 @@ 17, 17 + + 172, 17 + \ No newline at end of file