[Roam-commit] SF.net SVN: roam: [102] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2007-11-03 21:23:50
|
Revision: 102
http://roam.svn.sourceforge.net/roam/?rev=102&view=rev
Author: jonfroehlich
Date: 2007-11-03 14:23:49 -0700 (Sat, 03 Nov 2007)
Log Message:
-----------
updated Border to have default constructor
Modified Paths:
--------------
Trunk/Source/Roam.UI/Controls/Border.Designer.cs
Trunk/Source/Roam.UI/Controls/Border.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.UI/Controls/Border.Designer.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/Border.Designer.cs 2007-10-23 05:45:56 UTC (rev 101)
+++ Trunk/Source/Roam.UI/Controls/Border.Designer.cs 2007-11-03 21:23:49 UTC (rev 102)
@@ -12,6 +12,7 @@
// this source code distribution.
//
#endregion Copyright & License
+using System;
namespace Roam.UI.Controls
{
/// <summary>
@@ -34,6 +35,12 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ _control.GotFocus -= new EventHandler(OnControlGotFocus);
+ _control.LostFocus -= new EventHandler(OnControlLostFocus);
+ }
+
if (disposing && (components != null))
{
components.Dispose();
Modified: Trunk/Source/Roam.UI/Controls/Border.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/Border.cs 2007-10-23 05:45:56 UTC (rev 101)
+++ Trunk/Source/Roam.UI/Controls/Border.cs 2007-11-03 21:23:49 UTC (rev 102)
@@ -50,22 +50,30 @@
/// <author>Jon Froehlich</author>
public partial class Border : Control
{
+ #region Fields
private Control _control;
private int _borderThickness = 1;
private BorderBehavior _borderBehavior = BorderBehavior.DrawBorderWhenNotFocused;
private bool _autoResizeControlOnFocus = false;
+ #endregion Fields
+ #region Constructors
+ public Border()
+ {
+ }
+
public Border(Control control)
{
_control = control;
InitializeComponent();
this.Controls.Add(_control);
- //jeffixme do we need to explicitly unhook these on disposal?
_control.GotFocus += new EventHandler(OnControlGotFocus);
_control.LostFocus += new EventHandler(OnControlLostFocus);
}
+ #endregion Constructors
+ #region Properties
public bool AutoResizeControlOnFocus
{
get { return _autoResizeControlOnFocus; }
@@ -92,6 +100,24 @@
}
}
+ public Control Control
+ {
+ get { return _control; }
+ set
+ {
+ if (_control != null)
+ {
+ _control.GotFocus -= new EventHandler(OnControlGotFocus);
+ _control.LostFocus -= new EventHandler(OnControlLostFocus);
+ }
+ _control = value;
+ _control.GotFocus += new EventHandler(OnControlGotFocus);
+ _control.LostFocus += new EventHandler(OnControlLostFocus);
+ }
+ }
+ #endregion Properties
+
+ #region Methods
protected virtual void OnControlLostFocus(object sender, EventArgs e)
{
this.TabStop = true;
@@ -110,11 +136,6 @@
this.Refresh();
}
- public Control Control
- {
- get { return _control; }
- }
-
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
@@ -123,10 +144,16 @@
switch (_borderBehavior)
{
case BorderBehavior.DrawBorderWhenFocused:
- bDrawBorder = _control.Focused;
+ if (_control != null)
+ {
+ bDrawBorder = _control.Focused;
+ }
break;
case BorderBehavior.DrawBorderWhenNotFocused:
- bDrawBorder = !_control.Focused;
+ if (_control != null)
+ {
+ bDrawBorder = !_control.Focused;
+ }
break;
case BorderBehavior.AlwaysDrawBorder:
bDrawBorder = true;
@@ -174,16 +201,18 @@
protected override void OnResize(EventArgs e)
{
+ if (_control == null) { return; }
UpdateLayout();
base.OnResize(e);
}
protected override void OnGotFocus(EventArgs e)
{
+ if (_control == null) { return; }
//this.TabStop = false;
_control.Focus();
base.OnGotFocus(e);
}
-
+ #endregion Methods
}
}
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|