Mercurial > hg > ucis.core
comparison FBGUI/FBGUI.cs @ 83:4ca44dd25a6a
Merge
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Sun, 23 Feb 2014 16:59:47 +0100 |
parents | 0d389692be32 3352f89cf6f5 |
children | c9da306e06c9 |
comparison
equal
deleted
inserted
replaced
82:0d389692be32 | 83:4ca44dd25a6a |
---|---|
214 } | 214 } |
215 public class FBGContainerControl : FBGControl, IFBGContainerControl { | 215 public class FBGContainerControl : FBGControl, IFBGContainerControl { |
216 protected List<IFBGControl> controls = new List<IFBGControl>(); | 216 protected List<IFBGControl> controls = new List<IFBGControl>(); |
217 protected IFBGControl mouseCaptureControl = null; | 217 protected IFBGControl mouseCaptureControl = null; |
218 protected IFBGControl keyboardCaptureControl = null; | 218 protected IFBGControl keyboardCaptureControl = null; |
219 public virtual Rectangle ClientRectangle { get { return Bounds; } } | 219 public virtual Rectangle ClientRectangle { get { return new Rectangle(Point.Empty, Bounds.Size); } } |
220 public virtual Size ClientSize { get { return ClientRectangle.Size; } set { Bounds = new Rectangle(Bounds.Location, Bounds.Size - ClientRectangle.Size + value); } } | 220 public virtual Size ClientSize { get { return ClientRectangle.Size; } set { Bounds = new Rectangle(Bounds.Location, Bounds.Size - ClientRectangle.Size + value); } } |
221 public FBGContainerControl(IFBGContainerControl parent) : base(parent) { } | 221 public FBGContainerControl(IFBGContainerControl parent) : base(parent) { } |
222 void IFBGContainerControl.AddControl(IFBGControl control) { AddControl(control); } | 222 void IFBGContainerControl.AddControl(IFBGControl control) { AddControl(control); } |
223 protected virtual void AddControl(IFBGControl control) { | 223 protected virtual void AddControl(IFBGControl control) { |
224 controls.Add(control); | 224 controls.Add(control); |
230 HandleMessage(control, new FBGPointingCaptureMessage(control, false)); | 230 HandleMessage(control, new FBGPointingCaptureMessage(control, false)); |
231 HandleMessage(control, new FBGKeyboardCaptureMessage(control, false)); | 231 HandleMessage(control, new FBGKeyboardCaptureMessage(control, false)); |
232 control.Orphaned(); | 232 control.Orphaned(); |
233 } | 233 } |
234 } | 234 } |
235 public IList<IFBGControl> Controls { get { return controls.AsReadOnly(); } } | |
235 public virtual Point PointToChild(IFBGControl child, Point point) { | 236 public virtual Point PointToChild(IFBGControl child, Point point) { |
236 return point - (Size)child.Bounds.Location - (Size)ClientRectangle.Location; | 237 return point - (Size)child.Bounds.Location - (Size)ClientRectangle.Location; |
237 } | 238 } |
238 public virtual Point PointFromChild(IFBGControl child, Point point) { | 239 public virtual Point PointFromChild(IFBGControl child, Point point) { |
239 return point + (Size)child.Bounds.Location + (Size)ClientRectangle.Location; | 240 return point + (Size)child.Bounds.Location + (Size)ClientRectangle.Location; |
312 protected override void HandleKeyboardEvent(FBGKeyboardEvent e) { | 313 protected override void HandleKeyboardEvent(FBGKeyboardEvent e) { |
313 if (ReferenceEquals(keyboardCaptureControl, null)) base.HandleKeyboardEvent(e); | 314 if (ReferenceEquals(keyboardCaptureControl, null)) base.HandleKeyboardEvent(e); |
314 else keyboardCaptureControl.HandleEvent(e); | 315 else keyboardCaptureControl.HandleEvent(e); |
315 } | 316 } |
316 protected virtual void HandleKeyboardCaptureMessage(IFBGControl sender, FBGKeyboardCaptureMessage e) { | 317 protected virtual void HandleKeyboardCaptureMessage(IFBGControl sender, FBGKeyboardCaptureMessage e) { |
317 if (!e.Capture && !(ReferenceEquals(mouseCaptureControl, null) || ReferenceEquals(mouseCaptureControl, sender))) e.Capture = false; | 318 if (!e.Capture && !(ReferenceEquals(keyboardCaptureControl, null) || ReferenceEquals(keyboardCaptureControl, sender))) e.Capture = false; |
318 else { | 319 else { |
319 Parent.HandleMessage(this, e); | 320 Parent.HandleMessage(this, e); |
320 IFBGControl prev = keyboardCaptureControl; | 321 IFBGControl prev = keyboardCaptureControl; |
321 keyboardCaptureControl = e.Capture ? sender : null; | 322 keyboardCaptureControl = e.Capture ? sender : null; |
322 if (prev != null && prev != sender) prev.HandleEvent(new FBGKeyboardCaptureEvent(false)); | 323 if (prev != null && prev != sender) prev.HandleEvent(new FBGKeyboardCaptureEvent(false)); |