mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-02-02 06:17:34 +00:00
Basics for Advanced App Launcher.
This commit is contained in:
parent
a8583c95d0
commit
fc9b618faf
4 changed files with 210 additions and 22 deletions
|
@ -30,9 +30,9 @@
|
|||
{
|
||||
this.lbupdatetitle = new System.Windows.Forms.Label();
|
||||
this.pnlupdatebar = new System.Windows.Forms.Panel();
|
||||
this.btnclose = new System.Windows.Forms.Button();
|
||||
this.btnaction = new System.Windows.Forms.Button();
|
||||
this.pgdownload = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
|
||||
this.btnaction = new System.Windows.Forms.Button();
|
||||
this.btnclose = new System.Windows.Forms.Button();
|
||||
this.wbstatus = new System.Windows.Forms.WebBrowser();
|
||||
this.pnlupdatebar.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -60,26 +60,6 @@
|
|||
this.pnlupdatebar.Size = new System.Drawing.Size(597, 33);
|
||||
this.pnlupdatebar.TabIndex = 1;
|
||||
//
|
||||
// btnclose
|
||||
//
|
||||
this.btnclose.Location = new System.Drawing.Point(4, 4);
|
||||
this.btnclose.Name = "btnclose";
|
||||
this.btnclose.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnclose.TabIndex = 0;
|
||||
this.btnclose.Text = "{CLOSE}";
|
||||
this.btnclose.UseVisualStyleBackColor = true;
|
||||
this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
|
||||
//
|
||||
// btnaction
|
||||
//
|
||||
this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnaction.Location = new System.Drawing.Point(519, 4);
|
||||
this.btnaction.Name = "btnaction";
|
||||
this.btnaction.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnaction.TabIndex = 1;
|
||||
this.btnaction.Text = "Update";
|
||||
this.btnaction.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pgdownload
|
||||
//
|
||||
this.pgdownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
|
@ -94,6 +74,26 @@
|
|||
this.pgdownload.Text = "Updating...";
|
||||
this.pgdownload.Value = 0;
|
||||
//
|
||||
// btnaction
|
||||
//
|
||||
this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnaction.Location = new System.Drawing.Point(519, 4);
|
||||
this.btnaction.Name = "btnaction";
|
||||
this.btnaction.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnaction.TabIndex = 1;
|
||||
this.btnaction.Text = "Update";
|
||||
this.btnaction.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnclose
|
||||
//
|
||||
this.btnclose.Location = new System.Drawing.Point(4, 4);
|
||||
this.btnclose.Name = "btnclose";
|
||||
this.btnclose.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnclose.TabIndex = 0;
|
||||
this.btnclose.Text = "{CLOSE}";
|
||||
this.btnclose.UseVisualStyleBackColor = true;
|
||||
this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
|
||||
//
|
||||
// wbstatus
|
||||
//
|
||||
this.wbstatus.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
|
|
|
@ -945,6 +945,15 @@
|
|||
Description: "In the shiftorium GUI but dont know what you can spend because you can't see how many code points are on hand? Well shop easy, because with this upgrade that is now possible! You have to restart the shiftorium for it to work."
|
||||
},
|
||||
|
||||
//ADVANCED APP LAUNCHER
|
||||
{
|
||||
Name: "Advanced App Launcher",
|
||||
Cost: 10000,
|
||||
Description: "The app launcher can categorize items and is quite clean, but let's make it even more advanced by adding more than just a traditional menu as the app launcher.",
|
||||
Dependencies: "app_launcher_categories",
|
||||
Category: "GUI"
|
||||
},
|
||||
|
||||
//UPDATE MANAGER
|
||||
{
|
||||
Name: "AL Update Manager",
|
||||
|
|
94
ShiftOS.WinForms/WinformsDesktop.Designer.cs
generated
94
ShiftOS.WinForms/WinformsDesktop.Designer.cs
generated
|
@ -61,10 +61,20 @@ namespace ShiftOS.WinForms
|
|||
this.apps = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pnlscreensaver = new System.Windows.Forms.Panel();
|
||||
this.pnlssicon = new System.Windows.Forms.Panel();
|
||||
this.pnladvancedal = new System.Windows.Forms.Panel();
|
||||
this.pnlalsystemactions = new System.Windows.Forms.Panel();
|
||||
this.btnshutdown = new System.Windows.Forms.Button();
|
||||
this.pnlstatus = new System.Windows.Forms.Panel();
|
||||
this.lbalstatus = new System.Windows.Forms.Label();
|
||||
this.flcategories = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flapps = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.desktoppanel.SuspendLayout();
|
||||
this.sysmenuholder.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.pnlscreensaver.SuspendLayout();
|
||||
this.pnladvancedal.SuspendLayout();
|
||||
this.pnlalsystemactions.SuspendLayout();
|
||||
this.pnlstatus.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// desktoppanel
|
||||
|
@ -108,6 +118,7 @@ namespace ShiftOS.WinForms
|
|||
this.lbtime.TabIndex = 0;
|
||||
this.lbtime.Text = "label1";
|
||||
this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.lbtime.Click += new System.EventHandler(this.lbtime_Click);
|
||||
//
|
||||
// panelbuttonholder
|
||||
//
|
||||
|
@ -146,6 +157,7 @@ namespace ShiftOS.WinForms
|
|||
this.apps.Size = new System.Drawing.Size(58, 20);
|
||||
this.apps.Tag = "applauncherbutton";
|
||||
this.apps.Text = "ShiftOS";
|
||||
this.apps.Click += new System.EventHandler(this.apps_Click);
|
||||
//
|
||||
// pnlscreensaver
|
||||
//
|
||||
|
@ -164,12 +176,83 @@ namespace ShiftOS.WinForms
|
|||
this.pnlssicon.Size = new System.Drawing.Size(200, 100);
|
||||
this.pnlssicon.TabIndex = 0;
|
||||
//
|
||||
// pnladvancedal
|
||||
//
|
||||
this.pnladvancedal.Controls.Add(this.flapps);
|
||||
this.pnladvancedal.Controls.Add(this.flcategories);
|
||||
this.pnladvancedal.Controls.Add(this.pnlalsystemactions);
|
||||
this.pnladvancedal.Controls.Add(this.pnlstatus);
|
||||
this.pnladvancedal.Location = new System.Drawing.Point(0, 24);
|
||||
this.pnladvancedal.Name = "pnladvancedal";
|
||||
this.pnladvancedal.Size = new System.Drawing.Size(433, 417);
|
||||
this.pnladvancedal.TabIndex = 1;
|
||||
this.pnladvancedal.Visible = false;
|
||||
//
|
||||
// pnlalsystemactions
|
||||
//
|
||||
this.pnlalsystemactions.Controls.Add(this.btnshutdown);
|
||||
this.pnlalsystemactions.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pnlalsystemactions.Location = new System.Drawing.Point(0, 386);
|
||||
this.pnlalsystemactions.Name = "pnlalsystemactions";
|
||||
this.pnlalsystemactions.Size = new System.Drawing.Size(433, 31);
|
||||
this.pnlalsystemactions.TabIndex = 1;
|
||||
//
|
||||
// btnshutdown
|
||||
//
|
||||
this.btnshutdown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnshutdown.AutoSize = true;
|
||||
this.btnshutdown.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnshutdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnshutdown.Location = new System.Drawing.Point(355, 3);
|
||||
this.btnshutdown.Name = "btnshutdown";
|
||||
this.btnshutdown.Size = new System.Drawing.Size(75, 26);
|
||||
this.btnshutdown.TabIndex = 0;
|
||||
this.btnshutdown.Text = "Shutdown";
|
||||
this.btnshutdown.UseVisualStyleBackColor = true;
|
||||
this.btnshutdown.Click += new System.EventHandler(this.btnshutdown_Click);
|
||||
//
|
||||
// pnlstatus
|
||||
//
|
||||
this.pnlstatus.Controls.Add(this.lbalstatus);
|
||||
this.pnlstatus.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlstatus.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlstatus.Name = "pnlstatus";
|
||||
this.pnlstatus.Size = new System.Drawing.Size(433, 58);
|
||||
this.pnlstatus.TabIndex = 0;
|
||||
//
|
||||
// lbalstatus
|
||||
//
|
||||
this.lbalstatus.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbalstatus.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbalstatus.Name = "lbalstatus";
|
||||
this.lbalstatus.Size = new System.Drawing.Size(433, 58);
|
||||
this.lbalstatus.TabIndex = 0;
|
||||
this.lbalstatus.Text = "michael@system\r\n0 Codepoints\r\n0 installed, 0 available";
|
||||
this.lbalstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// flcategories
|
||||
//
|
||||
this.flcategories.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.flcategories.Location = new System.Drawing.Point(0, 58);
|
||||
this.flcategories.Name = "flcategories";
|
||||
this.flcategories.Size = new System.Drawing.Size(221, 328);
|
||||
this.flcategories.TabIndex = 2;
|
||||
//
|
||||
// flapps
|
||||
//
|
||||
this.flapps.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flapps.Location = new System.Drawing.Point(221, 58);
|
||||
this.flapps.Name = "flapps";
|
||||
this.flapps.Size = new System.Drawing.Size(212, 328);
|
||||
this.flapps.TabIndex = 3;
|
||||
//
|
||||
// WinformsDesktop
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(1296, 738);
|
||||
this.Controls.Add(this.pnladvancedal);
|
||||
this.Controls.Add(this.pnlscreensaver);
|
||||
this.Controls.Add(this.desktoppanel);
|
||||
this.Font = new System.Drawing.Font("Consolas", 9F);
|
||||
|
@ -185,6 +268,10 @@ namespace ShiftOS.WinForms
|
|||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.pnlscreensaver.ResumeLayout(false);
|
||||
this.pnladvancedal.ResumeLayout(false);
|
||||
this.pnlalsystemactions.ResumeLayout(false);
|
||||
this.pnlalsystemactions.PerformLayout();
|
||||
this.pnlstatus.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -200,6 +287,13 @@ namespace ShiftOS.WinForms
|
|||
private System.Windows.Forms.Button btnnotifications;
|
||||
private System.Windows.Forms.Panel pnlscreensaver;
|
||||
private System.Windows.Forms.Panel pnlssicon;
|
||||
private System.Windows.Forms.Panel pnladvancedal;
|
||||
private System.Windows.Forms.Panel pnlalsystemactions;
|
||||
private System.Windows.Forms.Button btnshutdown;
|
||||
private System.Windows.Forms.Panel pnlstatus;
|
||||
private System.Windows.Forms.Label lbalstatus;
|
||||
private System.Windows.Forms.FlowLayoutPanel flapps;
|
||||
private System.Windows.Forms.FlowLayoutPanel flcategories;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -459,6 +459,8 @@ namespace ShiftOS.WinForms
|
|||
return itm;
|
||||
}
|
||||
|
||||
public Dictionary<string, List<LauncherItem>> LauncherItemList = new Dictionary<string, List<LauncherItem>>();
|
||||
|
||||
/// <summary>
|
||||
/// Populates the app launcher.
|
||||
/// </summary>
|
||||
|
@ -472,6 +474,9 @@ namespace ShiftOS.WinForms
|
|||
|
||||
Dictionary<string, List<ToolStripMenuItem>> sortedItems = new Dictionary<string, List<ToolStripMenuItem>>();
|
||||
|
||||
flcategories.Controls.Clear();
|
||||
|
||||
LauncherItemList.Clear();
|
||||
|
||||
|
||||
foreach (var kv in items)
|
||||
|
@ -495,11 +500,13 @@ namespace ShiftOS.WinForms
|
|||
if (sortedItems.ContainsKey(kv.DisplayData.Category))
|
||||
{
|
||||
sortedItems[kv.DisplayData.Category].Add(item);
|
||||
LauncherItemList[kv.DisplayData.Category].Add(kv);
|
||||
}
|
||||
else
|
||||
{
|
||||
sortedItems.Add(kv.DisplayData.Category, new List<ToolStripMenuItem>());
|
||||
sortedItems[kv.DisplayData.Category].Add(item);
|
||||
LauncherItemList.Add(kv.DisplayData.Category, new List<LauncherItem> { kv });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,6 +521,22 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
cat.DropDownItems.Add(subItem);
|
||||
}
|
||||
if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
|
||||
{
|
||||
var catbtn = new Button();
|
||||
catbtn.FlatStyle = FlatStyle.Flat;
|
||||
catbtn.FlatAppearance.BorderSize = 0;
|
||||
catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
|
||||
catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
|
||||
catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground;
|
||||
catbtn.TextAlign = ContentAlignment.MiddleLeft;
|
||||
catbtn.Text = kv.Key;
|
||||
catbtn.Width = flcategories.Width;
|
||||
catbtn.Height = 24;
|
||||
flcategories.Controls.Add(catbtn);
|
||||
catbtn.Show();
|
||||
catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -545,6 +568,47 @@ namespace ShiftOS.WinForms
|
|||
LuaInterpreter.RaiseEvent("on_al_populate", items);
|
||||
}
|
||||
|
||||
public void SetupAdvancedCategory(string cat)
|
||||
{
|
||||
flapps.Controls.Clear();
|
||||
|
||||
foreach(var app in LauncherItemList[cat])
|
||||
{
|
||||
var catbtn = new Button();
|
||||
catbtn.FlatStyle = FlatStyle.Flat;
|
||||
catbtn.FlatAppearance.BorderSize = 0;
|
||||
catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
|
||||
catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
|
||||
catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground;
|
||||
catbtn.TextAlign = ContentAlignment.MiddleLeft;
|
||||
catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType);
|
||||
catbtn.Width = flapps.Width;
|
||||
catbtn.Height = 24;
|
||||
catbtn.ImageAlign = ContentAlignment.MiddleLeft;
|
||||
catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name);
|
||||
|
||||
flapps.Controls.Add(catbtn);
|
||||
catbtn.Show();
|
||||
catbtn.Click += (o, a) =>
|
||||
{
|
||||
pnladvancedal.Hide();
|
||||
if(app is LuaLauncherItem)
|
||||
{
|
||||
var interp = new LuaInterpreter();
|
||||
interp.ExecuteFile((app as LuaLauncherItem).LaunchPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
IShiftOSWindow win = Activator.CreateInstance(app.LaunchType) as IShiftOSWindow;
|
||||
AppearanceManager.SetupWindow(win);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desktops the load.
|
||||
|
@ -702,6 +766,27 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
}
|
||||
|
||||
private void lbtime_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void apps_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
|
||||
{
|
||||
flapps.Controls.Clear();
|
||||
apps.DropDown.Hide();
|
||||
pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height);
|
||||
pnladvancedal.Visible = !pnladvancedal.Visible;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnshutdown_Click(object sender, EventArgs e)
|
||||
{
|
||||
TerminalBackend.InvokeCommand("sos.shutdown");
|
||||
}
|
||||
}
|
||||
|
||||
[ShiftOS.Engine.Scripting.Exposed("desktop")]
|
||||
|
|
Loading…
Add table
Reference in a new issue