# HG changeset patch # User Ivo Smits # Date 1393171002 -3600 # Node ID 3352f89cf6f513aabecfd5bcc6f5d8f86b53708f # Parent 4714531734b364e24928eaee22c94313acff2e7f FBGUI ContainerControl fixes (client area, keyboard capture) diff -r 4714531734b3 -r 3352f89cf6f5 FBGUI/FBGUI.cs --- a/FBGUI/FBGUI.cs Sun Feb 16 15:05:31 2014 +0100 +++ b/FBGUI/FBGUI.cs Sun Feb 23 16:56:42 2014 +0100 @@ -216,7 +216,7 @@ protected List controls = new List(); 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 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; diff -r 4714531734b3 -r 3352f89cf6f5 UCIS.Core.csproj --- a/UCIS.Core.csproj Sun Feb 16 15:05:31 2014 +0100 +++ b/UCIS.Core.csproj Sun Feb 23 16:56:42 2014 +0100 @@ -48,7 +48,6 @@ - Component Code diff -r 4714531734b3 -r 3352f89cf6f5 Util/ArrayUtil.cs --- a/Util/ArrayUtil.cs Sun Feb 16 15:05:31 2014 +0100 +++ b/Util/ArrayUtil.cs Sun Feb 23 16:56:42 2014 +0100 @@ -122,38 +122,45 @@ foreach (T v in array) h ^= v.GetHashCode(); return h; } - public static void Add(ref T[] array, params T[] items) { + public static int Add(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(ref T[] array, ICollection items) { + public static int Add(ref T[] array, ICollection 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(ref T[] array, T item) { + public static int Add(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(ref T[] array, T item) { - if (Array.IndexOf(array, item) != -1) return; - Add(ref array, item); + public static int AddUnique(ref T[] array, T item) { + int index = Array.IndexOf(array, item); + if (index == -1) index = Add(ref array, item); + return index; } } }