Got the close button working; now converting from a cached anonymous method to an inherited method. TODO: VOID_ConfigModule.
Got the close button working; now converting from a cached anonymous method to an inherited method. TODO: VOID_ConfigModule.

--- a/API/VOIDCore.cs
+++ b/API/VOIDCore.cs
@@ -35,12 +35,10 @@
 
 namespace VOID
 {
-	public abstract class VOIDCore : VOID_Module, IVOID_Module
+	public abstract class VOIDCore : VOID_WindowModule, IVOID_Module
 	{
 		public const double Constant_G = 6.674e-11;
 		public const int CONFIG_VERSION = 2;
-
-		public static bool useToolbarManager;
 
 		public abstract int configVersion { get; }
 		public virtual bool configNeedsUpdate { get; set; }
@@ -76,8 +74,6 @@
 		{
 			var config = KSP.IO.PluginConfiguration.CreateForType<VOIDCore>(null);
 
-			useToolbarManager = config.GetValue("UseToolbarManager", useToolbarManager);
-
 			base.LoadConfig();
 		}
 
@@ -85,8 +81,6 @@
 
 		public override void _SaveToConfig(KSP.IO.PluginConfiguration config)
 		{
-			config.SetValue("UseToolbarManager", useToolbarManager);
-
 			base._SaveToConfig(config);
 		}
 	}

--- a/API/VOID_Module.cs
+++ b/API/VOID_Module.cs
@@ -407,40 +407,58 @@
 
 	public abstract class VOID_WindowModule : VOID_Module
 	{
-		protected static GUIContent closeButton;
-
-		protected static Dictionary<int, Action<int>> DecoratedWindows;
-
 		[AVOID_SaveValue("WindowPos")]
 		protected Rect WindowPos;
 		protected float defWidth;
 		protected float defHeight;
 
+		protected bool decorateWindow;
+
 		protected string inputLockName;
-
-		protected virtual Action<int> DecoratedWindow
-		{
-			get
-			{
-				return VOID_WindowModule.DecorateWindow(
-					this.ModuleWindow,
-					this.WindowPos,
-					(bool active) => { this.toggleActive = active; }
-				);
-			}
-		}
 
 		public VOID_WindowModule() : base()
 		{
 			this.defWidth = 250f;
 			this.defHeight = 50f;
 
+			this.decorateWindow = true;
+
 			this.inputLockName = string.Concat(this.Name, "_edlock");
 
 			this.WindowPos = new Rect(Screen.width / 2, Screen.height / 2, this.defWidth, this.defHeight);
 		}
 
-		public abstract void ModuleWindow(int _);
+		public virtual void ModuleWindow(int id)
+		{
+			GUIStyle buttonStyle = this.core.Skin.button;
+			RectOffset padding = buttonStyle.padding;
+			RectOffset border = buttonStyle.border;
+
+			Rect closeRect = new Rect(
+				0f,
+				0f,
+				border.left + border.right,
+				border.top + border.bottom
+			);
+
+			closeRect.width = Mathf.Max(closeRect.width, 16f);
+			closeRect.height = Mathf.Max(closeRect.height, 16f);
+
+			closeRect.x = this.WindowPos.width - closeRect.width - 2f;
+			closeRect.y = 2f;
+
+			GUI.Button(closeRect, GUIContent.none, buttonStyle);
+
+			if (Event.current.type == EventType.repaint && Input.GetMouseButtonUp(0))
+			{
+				if (closeRect.Contains(Event.current.mousePosition))
+				{
+					this.toggleActive = false;
+				}
+			}
+
+			GUI.DragWindow();
+		}
 
 		public override void DrawGUI()
 		{
@@ -451,12 +469,10 @@
 			_Pos = GUILayout.Window(
 				this.core.windowID,
 				_Pos,
-				VOID_Tools.GetWindowHandler(this.DecoratedWindow),
+				VOID_Tools.GetWindowHandler(this.ModuleWindow),
 				this.Name,
 				GUILayout.Width(this.defWidth),
-				GUILayout.Height(this.defHeight),
-				GUILayout.ExpandWidth(true),
-				GUILayout.ExpandHeight(true)
+				GUILayout.Height(this.defHeight)
 			);
 
 			bool cursorInWindow = _Pos.Contains(Mouse.screenPos);
@@ -518,70 +534,6 @@
 				this.core.configDirty = true;
 			}
 		}
-
-		public static Action<int> DecorateWindow(Action<int> func, Rect windowRect, Callback<bool> callBack, bool useCache)
-		{
-			if (DecoratedWindows == null)
-			{
-				DecoratedWindows = new Dictionary<int, Action<int>>();
-			}
-
-			int hashCode = func.GetHashCode();
-
-			if (!useCache || !DecoratedWindows.ContainsKey(hashCode))
-			{
-				DecoratedWindows[hashCode] = delegate(int id)
-				{
-					func(id);
-
-					if (closeButton == null)
-					{
-						closeButton = new GUIContent("X");
-					}
-
-					Rect closeRect = GUILayoutUtility.GetRect(
-						closeButton,
-						VOID_Data.Core.Skin.button,
-						GUILayout.ExpandWidth(false)
-					);
-
-					closeRect.x = windowRect.width - closeRect.width - VOID_Data.Core.Skin.button.margin.right;
-					closeRect.y = VOID_Data.Core.Skin.button.margin.top;
-
-					GUI.Button(closeRect, closeButton, VOID_Data.Core.Skin.button);
-
-					if (Event.current.type == EventType.repaint && Input.GetMouseButtonUp(0))
-					{
-						if (closeRect.Contains(Event.current.mousePosition))
-						{
-							callBack(false);
-						}
-					}
-				};
-			}
-
-			return DecoratedWindows[hashCode];
-		}
-
-		public static Action<int> DecorateWindow(Action<int> func, Rect windowRect, Callback<bool> callBack)
-		{
-			return DecorateWindow(func, windowRect, callBack, true);
-		}
-
-		public static void UncacheWindow(Action<int> func)
-		{
-			if (DecoratedWindows != null)
-			{
-				int hashCode = func.GetHashCode();
-
-				if (DecoratedWindows.ContainsKey(hashCode))
-				{
-					VOID_Tools.UncacheWindow(DecoratedWindows[hashCode]);
-
-					DecoratedWindows.Remove(hashCode);
-				}
-			}
-		}
 	}
 }
 

--- a/VOID.csproj
+++ b/VOID.csproj
@@ -112,6 +112,7 @@
     <Compile Include="API\Attributes\AVOID_SaveValue.cs" />
     <Compile Include="API\VOIDMaster.cs" />
     <Compile Include="API\Attributes\VOID_GameModesAttribute.cs" />
+    <Compile Include="VOID_ConfigModule.cs" />
   </ItemGroup>
   <ProjectExtensions>
     <MonoDevelop>

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -119,6 +119,7 @@
 				"ExperimentsDialogSkin",
 				"ExpRecoveryDialogSkin",
 				"KSP window 1",
+				"KSP window 3",
 				"KSP window 5",
 				"KSP window 6",
 				"PartTooltipSkin",
@@ -285,6 +286,8 @@
 			}
 		}
 
+		private bool useToolbarManager;
+
 		protected bool UseToolbarManager
 		{
 			get
@@ -384,6 +387,8 @@
 				this.InitializeToolbarButton();
 			}
 
+			base.DrawGUI();
+/*
 			if (!this.mainGuiMinimized)
 			{
 
@@ -450,7 +455,7 @@
 				{
 					this.configWindowPos = _configWindowPos;
 				}
-			}
+			}*/
 		}
 
 		public virtual void Update()
@@ -593,7 +598,7 @@
 			this.StartGUI();
 		}
 
-		public void VOIDMainWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			GUILayout.BeginVertical();
 
@@ -627,7 +632,8 @@
 			this.configWindowMinimized.value = !GUITools.Toggle(!this.configWindowMinimized, "Configuration");
 
 			GUILayout.EndVertical();
-			GUI.DragWindow();
+
+			base.ModuleWindow(id);
 		}
 
 		public void VOIDConfigWindow(int _)
@@ -1168,6 +1174,8 @@
 		{
 			this.StopGUI();
 
+			this.onSkinChanged(this);
+
 			if (this.AppLauncherButton != null)
 			{
 				ApplicationLauncher.Instance.RemoveModApplication(this.AppLauncherButton);

--- a/VOID_CBInfoBrowser.cs
+++ b/VOID_CBInfoBrowser.cs
@@ -62,7 +62,7 @@
 			this.WindowPos.y = 85;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
 
@@ -277,7 +277,7 @@
 				GUILayout.EndHorizontal();
 			}
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 
 		private void body_OP_show_orbital_info(CelestialBody body)

--- a/VOID_CareerStatus.cs
+++ b/VOID_CareerStatus.cs
@@ -151,7 +151,7 @@
 			base.DrawGUI();
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			GUILayout.BeginVertical();
 
@@ -178,7 +178,7 @@
 
 			GUILayout.EndVertical();
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 
 		// TODO: Update event handlers to do something useful with the new "reasons" parameter.

--- a/VOID_DataLogger.cs
+++ b/VOID_DataLogger.cs
@@ -237,7 +237,7 @@
 			this.logIntervalStr = this.logInterval.value.ToString("#.0##");
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			GUILayout.BeginVertical();
 
@@ -288,7 +288,7 @@
 
 			GUILayout.EndVertical();
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 
 		#endregion

--- a/VOID_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -50,7 +50,7 @@
 			this.WindowPos.y = 250f;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			int idx = 0;
 
@@ -108,7 +108,8 @@
             }
 
             GUILayout.EndVertical();
-            GUI.DragWindow();
+            
+			base.ModuleWindow(id);
 		}
 
 		public override void LoadConfig ()

--- a/VOID_Rendezvous.cs
+++ b/VOID_Rendezvous.cs
@@ -53,7 +53,7 @@
 			this.WindowPos.y = 85;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			Vessel rendezvessel = new Vessel();
 			CelestialBody rendezbody = new CelestialBody();
@@ -134,7 +134,8 @@
 			GUILayout.EndHorizontal();
 
 			GUILayout.EndVertical();
-			GUI.DragWindow();
+
+			base.ModuleWindow(id);
 		}
 
 		private void display_rendezvous_info(Vessel v, CelestialBody cb)

--- a/VOID_StageInfo.cs
+++ b/VOID_StageInfo.cs
@@ -114,7 +114,7 @@
 			}
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			if (this.selectedBody == null)
 			{
@@ -261,7 +261,7 @@
 
 			GUILayout.EndHorizontal();
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 
 		public override void DrawConfigurables()

--- a/VOID_SurfAtmo.cs
+++ b/VOID_SurfAtmo.cs
@@ -47,7 +47,7 @@
 			this.WindowPos.y = 85;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			int idx = 0;
 
@@ -91,7 +91,8 @@
 			VOID_Data.currBiome.DoGUIHorizontal ();
 
 			GUILayout.EndVertical();
-			GUI.DragWindow();
+
+			base.ModuleWindow(id);
 		}
 
 		public override void LoadConfig ()

--- a/VOID_TWR.cs
+++ b/VOID_TWR.cs
@@ -20,7 +20,7 @@
 			this.Name = "IP Thrust-to-Weight Ratios";
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			if (
 				!HighLogic.LoadedSceneIsFlight ||
@@ -60,7 +60,7 @@
 
 			GUILayout.EndVertical();
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 	}
 }

--- a/VOID_Transfer.cs
+++ b/VOID_Transfer.cs
@@ -48,7 +48,7 @@
 			this.defWidth = 315;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			GUILayout.BeginVertical();
 
@@ -140,7 +140,8 @@
 				}
 			}
 			GUILayout.EndVertical();
-			GUI.DragWindow();
+
+			base.ModuleWindow(id);
 		}
 
 		private void tad_targeting(CelestialBody body)

--- a/VOID_VesselInfo.cs
+++ b/VOID_VesselInfo.cs
@@ -46,7 +46,7 @@
 			this.WindowPos.y = 450;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
 			{
@@ -86,7 +86,7 @@
 
 			GUILayout.EndVertical();
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 	}
 }

--- a/VOID_VesselRegister.cs
+++ b/VOID_VesselRegister.cs
@@ -67,7 +67,7 @@
 			this.defHeight = 375;
 		}
 
-		public override void ModuleWindow(int _)
+		public override void ModuleWindow(int id)
 		{
 			if (!this.core.allVesselTypes.Any())
 			{
@@ -157,7 +157,7 @@
 
 			GUILayout.EndVertical();
 
-			GUI.DragWindow();
+			base.ModuleWindow(id);
 		}
 	}
 }