changeset 83:4ca44dd25a6a

Merge
author Ivo Smits <Ivo@UCIS.nl>
date Sun, 23 Feb 2014 16:59:47 +0100
parents 0d389692be32 (current diff) 3352f89cf6f5 (diff)
children 146a8d224d86 c9da306e06c9
files FBGUI/FBGUI.cs
diffstat 3 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/FBGUI/FBGUI.cs	Mon Feb 17 22:35:52 2014 +0100
+++ b/FBGUI/FBGUI.cs	Sun Feb 23 16:59:47 2014 +0100
@@ -216,7 +216,7 @@
 		protected List<IFBGControl> controls = new List<IFBGControl>();
 		protected IFBGControl mouseCaptureControl = null;
 		protected IFBGControl keyboardCaptureControl = null;
-		public virtual Rectangle ClientRectangle { get { return Bounds; } }
+		public virtual Rectangle ClientRectangle { get { return new Rectangle(Point.Empty, Bounds.Size); } }
 		public virtual Size ClientSize { get { return ClientRectangle.Size; } set { Bounds = new Rectangle(Bounds.Location, Bounds.Size - ClientRectangle.Size + value); } }
 		public FBGContainerControl(IFBGContainerControl parent) : base(parent) { }
 		void IFBGContainerControl.AddControl(IFBGControl control) { AddControl(control); }
@@ -232,6 +232,7 @@
 				control.Orphaned();
 			}
 		}
+		public IList<IFBGControl> Controls { get { return controls.AsReadOnly(); } }
 		public virtual Point PointToChild(IFBGControl child, Point point) {
 			return point - (Size)child.Bounds.Location - (Size)ClientRectangle.Location;
 		}
@@ -314,7 +315,7 @@
 			else keyboardCaptureControl.HandleEvent(e);
 		}
 		protected virtual void HandleKeyboardCaptureMessage(IFBGControl sender, FBGKeyboardCaptureMessage e) {
-			if (!e.Capture && !(ReferenceEquals(mouseCaptureControl, null) || ReferenceEquals(mouseCaptureControl, sender))) e.Capture = false;
+			if (!e.Capture && !(ReferenceEquals(keyboardCaptureControl, null) || ReferenceEquals(keyboardCaptureControl, sender))) e.Capture = false;
 			else {
 				Parent.HandleMessage(this, e);
 				IFBGControl prev = keyboardCaptureControl;
--- a/UCIS.Core.csproj	Mon Feb 17 22:35:52 2014 +0100
+++ b/UCIS.Core.csproj	Sun Feb 23 16:59:47 2014 +0100
@@ -48,7 +48,6 @@
     <Compile Include="Database.cs" />
     <None Include="DBReader.cs" />
     <Compile Include="FBGUI\FBGUI.cs">
-      <SubType>Component</SubType>
     </Compile>
     <Compile Include="NaCl\APIv2.cs">
       <SubType>Code</SubType>
--- a/Util/ArrayUtil.cs	Mon Feb 17 22:35:52 2014 +0100
+++ b/Util/ArrayUtil.cs	Sun Feb 23 16:59:47 2014 +0100
@@ -122,38 +122,45 @@
 			foreach (T v in array) h ^= v.GetHashCode();
 			return h;
 		}
-		public static void Add<T>(ref T[] array, params T[] items) {
+		public static int Add<T>(ref T[] array, params T[] items) {
 			if (array == null) {
 				array = new T[items.Length];
 				items.CopyTo(array, 0);
+				return 0;
 			} else {
 				int index = array.Length;
 				Array.Resize(ref array, index + items.Length);
 				items.CopyTo(array, index);
+				return index;
 			}
 		}
-		public static void Add<T>(ref T[] array, ICollection<T> items) {
+		public static int Add<T>(ref T[] array, ICollection<T> items) {
 			if (array == null) {
 				array = new T[items.Count];
 				items.CopyTo(array, 0);
+				return 0;
 			} else {
 				int index = array.Length;
 				Array.Resize(ref array, index + items.Count);
 				items.CopyTo(array, index);
+				return index;
 			}
 		}
-		public static void Add<T>(ref T[] array, T item) {
+		public static int Add<T>(ref T[] array, T item) {
 			if (array == null) {
 				array = new T[] { item };
+				return 0;
 			} else {
 				int index = array.Length;
 				Array.Resize(ref array, index + 1);
 				array[index] = item;
+				return index;
 			}
 		}
-		public static void AddUnique<T>(ref T[] array, T item) {
-			if (Array.IndexOf(array, item) != -1) return;
-			Add(ref array, item);
+		public static int AddUnique<T>(ref T[] array, T item) {
+			int index = Array.IndexOf(array, item);
+			if (index == -1) index = Add(ref array, item);
+			return index;
 		}
 	}
 }