aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-06 18:32:19 -0400
committerMichaelTheShifter <[email protected]>2016-07-06 18:32:19 -0400
commit98fe96c5d3e5ee1bb3b2eaa38c9346977b4ad713 (patch)
treef44609abd833e5a49d117b711455180ca3f86581
parentb20c17f5a45b229edcefb66815ec602ade7dd84b (diff)
downloadshiftos-c-_theultimatehacker-98fe96c5d3e5ee1bb3b2eaa38c9346977b4ad713.tar.gz
shiftos-c-_theultimatehacker-98fe96c5d3e5ee1bb3b2eaa38c9346977b4ad713.tar.bz2
shiftos-c-_theultimatehacker-98fe96c5d3e5ee1bb3b2eaa38c9346977b4ad713.zip
Added DEF events for unity toggle and desktop panel draw.
Also this is the first REAL AppVeyor build test.
-rw-r--r--source/WindowsFormsApplication1/API.cs4
-rw-r--r--source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs12
-rw-r--r--source/WindowsFormsApplication1/Engine/Lua_Interp.cs24
3 files changed, 38 insertions, 2 deletions
diff --git a/source/WindowsFormsApplication1/API.cs b/source/WindowsFormsApplication1/API.cs
index 2fe6126..4199223 100644
--- a/source/WindowsFormsApplication1/API.cs
+++ b/source/WindowsFormsApplication1/API.cs
@@ -83,7 +83,9 @@ namespace ShiftOS
public class API
{
public static Dictionary<Form, string> OpenGUIDs = new Dictionary<Form, string>();
-
+ public static Dictionary<string, Control> DEF_PanelGUIDs = new Dictionary<string, Control>();
+
+
/// <summary>
/// Settings file.
/// </summary>
diff --git a/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs b/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
index 84c9014..19a641d 100644
--- a/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
+++ b/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
@@ -32,6 +32,9 @@ namespace ShiftOS
//Window draw event handler.
public delegate void WindowDrawEventHandler(Form win);
+ //Event handler for passing a single control (e.g, a desktop panel) to the Lua API.
+ public delegate void ControlDrawEventHandler(string ControlGUID);
+
//Lua events.
public event EmptyEventHandler OnDesktopReload;
public event ListEventHandler<ApplauncherItem> OnAppLauncherPopulate;
@@ -45,6 +48,8 @@ namespace ShiftOS
public event WindowDrawEventHandler TitlebarReset;
public event WindowDrawEventHandler BorderReset;
public event ListEventHandler<DesktopIcon> DesktopIconsPopulated;
+ public event EmptyEventHandler OnUnityToggle;
+ public event ControlDrawEventHandler OnDesktopPanelDraw;
public void InvokeWindowOp(string operation, Form win)
{
@@ -104,7 +109,9 @@ namespace ShiftOS
{
UnityEnabled = true;
}
+ OnUnityToggle?.Invoke(); //We want this to be invoked BEFORE the desktop reset in case the user wants to do things with the desktop during reset.
SetupDesktop();
+
}
public void SetUnityMode(bool value)
@@ -596,7 +603,7 @@ namespace ShiftOS
public void SetupPanels(List<Skinning.DesktopPanel> lst)
{
DesktopPanels = new List<Panel>();
-
+ API.DEF_PanelGUIDs.Clear();
foreach (var dp in lst)
{
Panel pnl = new Panel();
@@ -699,6 +706,9 @@ namespace ShiftOS
pnl.Hide();
this.Controls.Remove(pnl);
}
+ string guid = Guid.NewGuid().ToString();
+ API.DEF_PanelGUIDs.Add(guid, pnl);
+ OnDesktopPanelDraw?.Invoke(guid);
}
}
diff --git a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
index 4192acf..813bcd3 100644
--- a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
+++ b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
@@ -119,6 +119,30 @@ namespace ShiftOS
mod(func + "()");
};
});
+ mod.on_unity_set += new Action<ShiftOSDesktop, string>((desktop, func) =>
+ {
+ desktop.OnUnityToggle += () =>
+ {
+ mod(func + "()");
+ };
+ });
+ mod.on_desktop_panel_draw += new Action<ShiftOSDesktop, string>((desktop, func) =>
+ {
+ desktop.OnDesktopPanelDraw += (c) =>
+ {
+ mod(func + $"(get_panel_from_guid(\"{c}\"))");
+ };
+ });
+ mod.get_panel_from_guid = new Func<string, Control>((guid) =>
+ {
+ foreach(var kv in API.DEF_PanelGUIDs)
+ {
+ if (kv.Key == guid)
+ return kv.Value;
+ }
+ return null;
+ });
+
mod.on_desktop_reset += new Action<ShiftOSDesktop, string>((desktop, func) =>
{
desktop.OnDesktopReload += () =>