aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-04 17:43:04 -0400
committerMichaelTheShifter <[email protected]>2016-07-04 17:43:04 -0400
commit6e40ae80f39c766d611b4ca29aea0f6685db80dc (patch)
treea974377172b1d0e15f21b5c3491b100b2e0ee696 /source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
parent5be773d4f027ac0f00392be80d8cc5dfb67669be (diff)
downloadshiftos-c--6e40ae80f39c766d611b4ca29aea0f6685db80dc.tar.gz
shiftos-c--6e40ae80f39c766d611b4ca29aea0f6685db80dc.tar.bz2
shiftos-c--6e40ae80f39c766d611b4ca29aea0f6685db80dc.zip
Add luatextbox widget and more.
- Syntax highlighting textbox for Lua API - That textbox also supports C# syntax highlighting - Added framework for custom desktop environments in Lua.
Diffstat (limited to 'source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs')
-rw-r--r--source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs93
1 files changed, 88 insertions, 5 deletions
diff --git a/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs b/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
index 9a6818e..84c9014 100644
--- a/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
+++ b/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
@@ -23,6 +23,71 @@ namespace ShiftOS
InitializeComponent();
}
+ //Event handler with no arguments.
+ public delegate void EmptyEventHandler();
+
+ //Event handler that passes a List<T>
+ public delegate void ListEventHandler<T>(List<T> lst);
+
+ //Window draw event handler.
+ public delegate void WindowDrawEventHandler(Form win);
+
+ //Lua events.
+ public event EmptyEventHandler OnDesktopReload;
+ public event ListEventHandler<ApplauncherItem> OnAppLauncherPopulate;
+ public event ListEventHandler<PanelButton> OnPanelButtonPopulate;
+ public event EmptyEventHandler OnClockSkin;
+ public event EmptyEventHandler CtrlTPressed;
+ public event EmptyEventHandler OnUnityCheck;
+ public event WindowDrawEventHandler WindowOpened;
+ public event WindowDrawEventHandler WindowClosed;
+ public event WindowDrawEventHandler WindowSkinReset;
+ public event WindowDrawEventHandler TitlebarReset;
+ public event WindowDrawEventHandler BorderReset;
+ public event ListEventHandler<DesktopIcon> DesktopIconsPopulated;
+
+ public void InvokeWindowOp(string operation, Form win)
+ {
+ switch(operation)
+ {
+ case "open":
+ WindowOpened?.Invoke(win);
+ break;
+ case "close":
+ WindowClosed?.Invoke(win);
+ break;
+ case "tbar_redraw":
+ TitlebarReset?.Invoke(win);
+ break;
+ case "brdr_redraw":
+ BorderReset?.Invoke(win);
+ break;
+ case "redraw":
+ WindowSkinReset?.Invoke(win);
+ break;
+ }
+ }
+
+ public void AllowCtrlTIntercept()
+ {
+ _resetCtrlTEvent();
+ CtrlTLuaIntercept = true;
+ }
+
+ public void DisableCtrlTIntercept()
+ {
+ _resetCtrlTEvent();
+ CtrlTLuaIntercept = false;
+ }
+
+
+ private void _resetCtrlTEvent()
+ {
+ CtrlTPressed = null;
+ }
+
+ private bool CtrlTLuaIntercept = false;
+
public bool UnityEnabled = false;
public ToolStripMenuItem AppLauncher { get { return this.ApplicationsToolStripMenuItem; } }
@@ -80,6 +145,22 @@ namespace ShiftOS
};
}
+
+
+ public void InvokeCTRLT()
+ {
+ if (CtrlTLuaIntercept == true)
+ {
+ CtrlTPressed?.Invoke();
+ }
+ else
+ {
+ //Show terminal on CTRL+T
+
+ API.CreateForm(new Terminal(), API.CurrentSave.TerminalName, Properties.Resources.iconTerminal);
+ }
+ }
+
private void ShiftOSDesktop_Load(object sender, EventArgs e)
{
Viruses.CheckForInfected();
@@ -90,9 +171,7 @@ namespace ShiftOS
{
if (ea.KeyCode == Keys.T && ea.Control)
{
- //Show terminal on CTRL+T
-
- API.CreateForm(new Terminal(), API.CurrentSave.TerminalName, Properties.Resources.iconTerminal);
+ InvokeCTRLT();
}
else if (ea.KeyCode == Keys.D && ea.Control)
{
@@ -269,6 +348,7 @@ namespace ShiftOS
}
}
}
+ OnDesktopReload?.Invoke();
}
public void SetupWidgets()
@@ -459,7 +539,7 @@ namespace ShiftOS
};
flicons.Controls.Add(dl);
}
-
+ DesktopIconsPopulated?.Invoke(DesktopIconManager.Icons);
}
}
@@ -734,6 +814,7 @@ namespace ShiftOS
else {
ApplicationsToolStripMenuItem.Visible = false;
}
+ OnAppLauncherPopulate?.Invoke(API.AppLauncherItems);
}
public void SetupGNOME2Elements()
@@ -836,7 +917,7 @@ namespace ShiftOS
else {
timepanel.Hide();
}
-
+ OnClockSkin?.Invoke();
}
public void CheckUnity()
@@ -864,6 +945,7 @@ namespace ShiftOS
this.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.desktopbackgroundlayout;
}
+ OnUnityCheck?.Invoke();
}
public void CheckForChristmas()
@@ -935,6 +1017,7 @@ namespace ShiftOS
}
pnlpanelbuttonholder.Padding = new Padding(API.CurrentSkin.panelbuttoninitialgap, 0, 0, 0);
}
+ OnPanelButtonPopulate?.Invoke(API.PanelButtons);
}
public void setuppanelbuttonicons(ref PictureBox tbicon, Image image)