// John Sohn jsohn@columbus.rr.com
//
-// COMPLETE
-
#undef DebugRecreate
+#undef DebugFocus
using System;
using System.ComponentModel;
namespace System.Windows.Forms
{
+#if NET_2_0
+ [ComVisible(true)]
+ [ClassInterface (ClassInterfaceType.AutoDispatch)]
+#endif
[Designer("System.Windows.Forms.Design.ControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
[DefaultProperty("Text")]
[DefaultEvent("Click")]
[DesignerSerializer("System.Windows.Forms.Design.ControlCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
[ToolboxItemFilter("System.Windows.Forms")]
public class Control : Component, ISynchronizeInvoke, IWin32Window
- {
+#if NET_2_0
+ , IBindableComponent, IDropTarget
+#endif
+ {
#region Local Variables
// Basic
internal Rectangle bounds; // bounding rectangle for control (client area + decorations)
+ Rectangle explicit_bounds; // explicitly set bounds
internal object creator_thread; // thread that created the control
- internal ControlNativeWindow window; // object for native window handle
- internal string name; // for object naming
+ internal ControlNativeWindow window; // object for native window handle
+ string name; // for object naming
// State
- internal bool is_created; // true if OnCreateControl has been sent
- internal bool has_focus; // true if control has focus
- internal bool is_visible; // true if control is visible
- internal bool is_entered; // is the mouse inside the control?
- internal bool is_enabled; // true if control is enabled (usable/not grayed out)
- internal bool is_accessible; // true if the control is visible to accessibility applications
- internal bool is_captured; // tracks if the control has captured the mouse
+ bool is_created; // true if OnCreateControl has been sent
+ internal bool has_focus; // true if control has focus
+ internal bool is_visible; // true if control is visible
+ internal bool is_entered; // is the mouse inside the control?
+ internal bool is_enabled; // true if control is enabled (usable/not grayed out)
+ bool is_accessible; // true if the control is visible to accessibility applications
+ bool is_captured; // tracks if the control has captured the mouse
internal bool is_toplevel; // tracks if the control is a toplevel window
- internal bool is_recreating; // tracks if the handle for the control is being recreated
- internal bool causes_validation; // tracks if validation is executed on changes
- internal bool is_focusing; // tracks if Focus has been called on the control and has not yet finished
- internal int tab_index; // position in tab order of siblings
- internal bool tab_stop = true; // is the control a tab stop?
- internal bool is_disposed; // has the window already been disposed?
- internal Size client_size; // size of the client area (window excluding decorations)
- internal Rectangle client_rect; // rectangle with the client area (window excluding decorations)
- internal ControlStyles control_style; // rather win32-specific, style bits for control
- internal ImeMode ime_mode = ImeMode.Inherit;
- internal bool layout_pending; // true if our parent needs to re-layout us
- internal object control_tag; // object that contains data about our control
+ bool is_recreating; // tracks if the handle for the control is being recreated
+ bool causes_validation; // tracks if validation is executed on changes
+ bool is_focusing; // tracks if Focus has been called on the control and has not yet finished
+ bool container_selected; // true if Select() or Focus() is called on a container, to prevent child controls from raising their GotFocus event
+ int tab_index; // position in tab order of siblings
+ bool tab_stop; // is the control a tab stop?
+ bool is_disposed; // has the window already been disposed?
+ Size client_size; // size of the client area (window excluding decorations)
+ Rectangle client_rect; // rectangle with the client area (window excluding decorations)
+ ControlStyles control_style; // rather win32-specific, style bits for control
+ ImeMode ime_mode;
+ object control_tag; // object that contains data about our control
internal int mouse_clicks; // Counter for mouse clicks
- internal Cursor cursor; // Cursor for the window
+ Cursor cursor; // Cursor for the window
internal bool allow_drop; // true if the control accepts droping objects on it
- internal Region clip_region; // User-specified clip region for the window
+ Region clip_region; // User-specified clip region for the window
// Visuals
internal Color foreground_color; // foreground color for control
internal Color background_color; // background color for control
- internal Image background_image; // background image for control
+ Image background_image; // background image for control
internal Font font; // font for control
- internal string text; // window/title text for control
- internal BorderStyle border_style; // Border style of control
+ string text; // window/title text for control
+ internal BorderStyle border_style; // Border style of control
// Layout
- internal AnchorStyles anchor_style; // anchoring requirements for our control
- internal DockStyle dock_style; // docking requirements for our control (supercedes anchoring)
- internal int dist_left; // distance to the left border of the parent
- internal int dist_top; // distance to the top border of the parent
- internal int dist_right; // distance to the right border of the parent
- internal int dist_bottom; // distance to the bottom border of the parent
+ internal enum LayoutType {
+ Anchor,
+ Dock
+ }
+ Layout.LayoutEngine layout_engine;
+ int layout_suspended;
+ bool layout_pending; // true if our parent needs to re-layout us
+ internal AnchorStyles anchor_style; // anchoring requirements for our control
+ internal DockStyle dock_style; // docking requirements for our control
+ LayoutType layout_type;
- // to be categorized...
- static internal ArrayList controls = new ArrayList(); // All of the application's controls, in a flat list
- internal ControlCollection child_controls; // our children
- internal Control parent; // our parent control
- internal AccessibleObject accessibility_object; // object that contains accessibility information about our control
- internal BindingContext binding_context; // TODO
- internal RightToLeft right_to_left; // drawing direction for control
- internal int layout_suspended;
- internal ContextMenu context_menu; // Context menu associated with the control
+ // Please leave the next 2 as internal until DefaultLayout (2.0) is rewritten
+ internal int dist_right; // distance to the right border of the parent
+ internal int dist_bottom; // distance to the bottom border of the parent
- private Graphics dc_mem; // Graphics context for double buffering
- private Bitmap bmp_mem; // Bitmap for double buffering control
- private Region invalid_region;
+ // to be categorized...
+ ControlCollection child_controls; // our children
+ Control parent; // our parent control
+ AccessibleObject accessibility_object; // object that contains accessibility information about our control
+ BindingContext binding_context;
+ RightToLeft right_to_left; // drawing direction for control
+ ContextMenu context_menu; // Context menu associated with the control
+
+ // double buffering
+ DoubleBuffer backbuffer;
+
+ // to implement DeviceContext without depending on double buffering
+ Bitmap bmp;
+ Graphics bmp_g;
- private ControlBindingsCollection data_bindings;
+ ControlBindingsCollection data_bindings;
#if NET_2_0
- internal bool use_compatible_text_rendering;
- static internal bool verify_thread_handle;
- private Padding padding;
- private Size maximum_size;
- private Size minimum_size;
- private Size preferred_size;
- private Padding margin;
- internal Layout.LayoutEngine layout_engine;
+ internal bool use_compatible_text_rendering;
+ static bool verify_thread_handle;
+ Padding padding;
+ ImageLayout backgroundimage_layout;
+ Size maximum_size;
+ Size minimum_size;
+ Size preferred_size;
+ Padding margin;
+ private ContextMenuStrip context_menu_strip;
#endif
#endregion // Local Variables
#region Public Classes
[ComVisible(true)]
- public class ControlAccessibleObject : AccessibleObject {
+ public class ControlAccessibleObject : AccessibleObject {
+ Control owner;
+
#region ControlAccessibleObject Constructors
- public ControlAccessibleObject(Control ownerControl) {
+ public ControlAccessibleObject(Control ownerControl)
+ : base (ownerControl)
+ {
this.owner = ownerControl;
}
#endregion // ControlAccessibleObject Constructors
#endregion // ControlAccessibleObject Public Instance Methods
}
+ private class DoubleBuffer : IDisposable
+ {
+ public Region InvalidRegion;
+ private Stack real_graphics;
+ private object back_buffer;
+ private Control parent;
+ private bool pending_disposal;
+
+ public DoubleBuffer (Control parent)
+ {
+ this.parent = parent;
+ real_graphics = new Stack ();
+ int width = parent.Width;
+ int height = parent.Height;
+
+ if (width < 1) width = 1;
+ if (height < 1) height = 1;
+
+ XplatUI.CreateOffscreenDrawable (parent.Handle, width, height, out back_buffer);
+ Invalidate ();
+ }
+
+ public void Blit (PaintEventArgs pe)
+ {
+ Graphics buffered_graphics;
+ buffered_graphics = XplatUI.GetOffscreenGraphics (back_buffer);
+ XplatUI.BlitFromOffscreen (parent.Handle, pe.Graphics, back_buffer, buffered_graphics, pe.ClipRectangle);
+ buffered_graphics.Dispose ();
+ }
+
+ public void Start (PaintEventArgs pe)
+ {
+ // We need to get the graphics for every paint.
+ real_graphics.Push(pe.SetGraphics (XplatUI.GetOffscreenGraphics (back_buffer)));
+ }
+
+ public void End (PaintEventArgs pe)
+ {
+ Graphics buffered_graphics;
+ buffered_graphics = pe.SetGraphics ((Graphics) real_graphics.Pop ());
+
+ if (pending_disposal)
+ Dispose ();
+ else {
+ XplatUI.BlitFromOffscreen (parent.Handle, pe.Graphics, back_buffer, buffered_graphics, pe.ClipRectangle);
+ InvalidRegion.Exclude (pe.ClipRectangle);
+ }
+ buffered_graphics.Dispose ();
+ }
+
+ public void Invalidate ()
+ {
+ if (InvalidRegion != null)
+ InvalidRegion.Dispose ();
+ InvalidRegion = new Region (parent.ClientRectangle);
+ }
+
+ public void Dispose ()
+ {
+ if (real_graphics.Count > 0) {
+ pending_disposal = true;
+ return;
+ }
+
+ XplatUI.DestroyOffscreenDrawable (back_buffer);
+
+ if (InvalidRegion != null)
+ InvalidRegion.Dispose ();
+ InvalidRegion = null;
+ back_buffer = null;
+ GC.SuppressFinalize (this);
+ }
+
+ #region IDisposable Members
+ void IDisposable.Dispose ()
+ {
+ Dispose ();
+ }
+ #endregion
+
+ ~DoubleBuffer ()
+ {
+ Dispose ();
+ }
+ }
+
+ [ListBindable (false)]
+#if NET_2_0
+ [ComVisible (false)]
+ public class ControlCollection : Layout.ArrangedElementCollection, IList, ICollection, ICloneable, IEnumerable {
+#else
[DesignerSerializer("System.Windows.Forms.Design.ControlCollectionCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
- [ListBindable(false)]
public class ControlCollection : IList, ICollection, ICloneable, IEnumerable {
+#endif
#region ControlCollection Local Variables
- private ArrayList list;
- internal ArrayList impl_list;
- private Control [] all_controls;
- internal Control owner;
+#if !NET_2_0
+ ArrayList list;
+#endif
+ ArrayList impl_list;
+ Control[] all_controls;
+ Control owner;
#endregion // ControlCollection Local Variables
#region ControlCollection Public Constructor
public ControlCollection(Control owner) {
this.owner=owner;
+#if !NET_2_0
this.list=new ArrayList();
+#endif
}
#endregion
#region ControlCollection Public Instance Properties
+ int ICollection.Count {
+ get { return Count; }
+ }
+
+
+#if !NET_2_0
public int Count {
- get {
- return list.Count;
- }
+ get { return list.Count; }
}
+#endif
- public bool IsReadOnly {
+#if NET_2_0
+ bool IList.IsReadOnly
+#else
+ public bool IsReadOnly
+#endif
+ {
get {
return list.IsReadOnly;
}
}
+#if NET_2_0
+ public Control Owner { get { return this.owner; } }
+
+ public virtual Control this[string key] {
+ get {
+ int index = IndexOfKey (key);
+
+ if (index >= 0)
+ return this[index];
+
+ return null;
+ }
+ }
+
+ new
+#endif
public virtual Control this[int index] {
get {
if (index < 0 || index >= list.Count) {
}
return (Control)list[index];
}
+
+
}
#endregion // ControlCollection Public Instance Properties
- #region ControlCollection Private Instance Methods
+ #region ControlCollection Instance Methods
public virtual void Add (Control value)
{
if (value == null)
return;
- if (Contains (value)) {
+ if (Contains (value)) {
owner.PerformLayout();
- return;
+ return;
}
if (value.tab_index == -1) {
owner.PerformLayout (control, "Parent");
owner.OnControlAdded (new ControlEventArgs (control));
}
-
+#if NET_2_0
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+#endif
public virtual void AddRange (Control[] controls)
{
if (controls == null)
}
}
+#if NET_2_0
+ new
+#endif
public virtual void Clear ()
{
all_controls = null;
return Contains (value) || ImplicitContains (value);
}
+#if NET_2_0
+ public virtual bool ContainsKey (string key)
+ {
+ return IndexOfKey (key) >= 0;
+ }
+#endif
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ CopyTo (array, index);
+ }
+
+#if !NET_2_0
public void CopyTo (Array array, int index)
{
list.CopyTo(array, index);
}
- public override bool Equals(object other) {
+ public override bool Equals (object other)
+ {
if (other is ControlCollection && (((ControlCollection)other).owner==this.owner)) {
return(true);
} else {
return(false);
}
}
+#endif
+
+#if NET_2_0
+ // LAMESPEC: MSDN says AE, MS implementation throws ANE
+ public Control[] Find (string key, bool searchAllChildren)
+ {
+ if (string.IsNullOrEmpty (key))
+ throw new ArgumentNullException ("key");
+
+ ArrayList al = new ArrayList ();
+
+ foreach (Control c in list) {
+ if (c.Name.Equals (key, StringComparison.CurrentCultureIgnoreCase))
+ al.Add (c);
+
+ if (searchAllChildren)
+ al.AddRange (c.Controls.Find (key, true));
+ }
+
+ return (Control[])al.ToArray (typeof (Control));
+ }
+#endif
public int GetChildIndex(Control child) {
return GetChildIndex(child, false);
}
- public int GetChildIndex(Control child, bool throwException) {
+#if NET_2_0
+ public virtual int
+#else
+ public int
+#endif
+ GetChildIndex(Control child, bool throwException) {
int index;
index=list.IndexOf(child);
return index;
}
- public IEnumerator GetEnumerator() {
+#if NET_2_0
+ public override IEnumerator
+#else
+ public IEnumerator
+#endif
+ GetEnumerator ()
+ {
return list.GetEnumerator();
}
return all_controls;
}
- public override int GetHashCode() {
+#if !NET_2_0
+ public override int GetHashCode()
+ {
return base.GetHashCode();
}
+#endif
- public int IndexOf(Control control) {
+ public int IndexOf(Control control)
+ {
return list.IndexOf(control);
}
- public virtual void Remove(Control value) {
+#if NET_2_0
+ public virtual int IndexOfKey (string key)
+ {
+ if (string.IsNullOrEmpty (key))
+ return -1;
+
+ for (int i = 0; i < list.Count; i++)
+ if (((Control)list[i]).Name.Equals (key, StringComparison.CurrentCultureIgnoreCase))
+ return i;
+
+ return -1;
+ }
+#endif
+
+ public virtual void Remove(Control value)
+ {
+ if (value == null)
+ return;
+
owner.PerformLayout(value, "Parent");
owner.OnControlRemoved(new ControlEventArgs(value));
owner.UpdateChildrenZOrder ();
}
- public void RemoveAt(int index) {
+#if NET_2_0
+ new
+#endif
+ public void RemoveAt(int index)
+ {
if (index < 0 || index >= list.Count) {
throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
}
Remove ((Control)list[index]);
}
- public void SetChildIndex(Control child, int newIndex) {
+#if NET_2_0
+ public virtual void RemoveByKey (string key)
+ {
+ int index = IndexOfKey (key);
+
+ if (index >= 0)
+ RemoveAt (index);
+ }
+
+ public virtual void
+#else
+ public void
+#endif
+ SetChildIndex(Control child, int newIndex)
+ {
+ if (child == null)
+ throw new ArgumentNullException ("child");
+
int old_index;
old_index=list.IndexOf(child);
#endregion // ControlCollection Class
#region Public Constructors
- public Control() {
-
+ public Control()
+ {
+ layout_type = LayoutType.Anchor;
anchor_style = AnchorStyles.Top | AnchorStyles.Left;
is_created = false;
is_toplevel = false;
causes_validation = true;
has_focus = false;
- layout_suspended = 0;
+ layout_suspended = 0;
mouse_clicks = 1;
tab_index = -1;
cursor = null;
right_to_left = RightToLeft.Inherit;
border_style = BorderStyle.None;
background_color = Color.Empty;
- dist_left = 0;
dist_right = 0;
- dist_top = 0;
dist_bottom = 0;
+ tab_stop = true;
+ ime_mode = ImeMode.Inherit;
#if NET_2_0
+ backgroundimage_layout = ImageLayout.Tile;
use_compatible_text_rendering = Application.use_compatible_text_rendering;
padding = new Padding(0);
maximum_size = new Size();
minimum_size = new Size();
- preferred_size = new Size();
+ preferred_size = this.DefaultSize;
margin = this.DefaultMargin;
- layout_engine = new Layout.DefaultLayout();
#endif
control_style = ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
ControlStyles.Selectable | ControlStyles.StandardClick |
ControlStyles.StandardDoubleClick;
+#if NET_2_0
+ control_style |= ControlStyles.UseTextForAccessibility;
+#endif
parent = null;
background_image = null;
text = string.Empty;
- name = string.Empty;
+ name = string.Empty;
window = new ControlNativeWindow(this);
child_controls = CreateControlsInstance();
client_size = new Size(DefaultSize.Width, DefaultSize.Height);
client_rect = new Rectangle(0, 0, DefaultSize.Width, DefaultSize.Height);
- XplatUI.CalculateWindowRect(ref client_rect, CreateParams.Style, CreateParams.ExStyle, null, out bounds);
+ bounds.Size = SizeFromClientSize (client_size);
+
if ((CreateParams.Style & (int)WindowStyles.WS_CHILD) == 0) {
bounds.X=-1;
bounds.Y=-1;
if (!is_disposed && disposing) {
Capture = false;
- if (dc_mem!=null) {
- dc_mem.Dispose();
- dc_mem=null;
- }
+ DisposeBackBuffer ();
- if (bmp_mem!=null) {
- bmp_mem.Dispose();
- bmp_mem=null;
+ if (bmp != null) {
+ bmp.Dispose ();
+ bmp = null;
}
-
- if (invalid_region!=null) {
- invalid_region.Dispose();
- invalid_region=null;
+ if (bmp_g != null) {
+ bmp_g.Dispose ();
+ bmp_g = null;
}
+
if (this.InvokeRequired) {
if (Application.MessageLoop) {
this.BeginInvokeInternal(new MethodInvoker(DestroyHandle), null, true);
- this.BeginInvokeInternal(new RemoveDelegate(controls.Remove), new object[] {this}, true);
}
} else {
DestroyHandle();
- lock (Control.controls) {
- Control.controls.Remove(this);
- }
}
-
if (parent != null) {
parent.Controls.Remove(this);
}
#endregion // Public Constructors
#region Internal Properties
+ internal bool VisibleInternal {
+ get { return is_visible; }
+ }
+
+ internal LayoutType ControlLayoutType {
+ get { return layout_type; }
+ }
+
internal BorderStyle InternalBorderStyle {
get {
return border_style;
border_style = value;
if (IsHandleCreated) {
- XplatUI.SetBorderStyle(window.Handle, (FormBorderStyle)border_style);
- Refresh();
+ XplatUI.SetBorderStyle (window.Handle, (FormBorderStyle)border_style);
+ RecreateHandle ();
+ Refresh ();
}
}
}
#endregion // Internal Properties
#region Private & Internal Methods
+
+#if NET_2_0
+ void IDropTarget.OnDragDrop (DragEventArgs e)
+ {
+ OnDragDrop (e);
+ }
+
+ void IDropTarget.OnDragEnter (DragEventArgs e)
+ {
+ OnDragEnter (e);
+ }
+
+ void IDropTarget.OnDragLeave (EventArgs e)
+ {
+ OnDragLeave (e);
+ }
+
+ void IDropTarget.OnDragOver (DragEventArgs e)
+ {
+ OnDragOver (e);
+ }
+#endif
+
internal IAsyncResult BeginInvokeInternal (Delegate method, object [] args, bool disposing) {
AsyncMethodResult result;
AsyncMethodData data;
if (!disposing) {
- Control p;
-
- p = this;
+ Control p = this;
do {
if (!p.IsHandleCreated) {
throw new InvalidOperationException("Cannot call Invoke or InvokeAsync on a control until the window handle is created");
}
internal Graphics DeviceContext {
- get {
- if (dc_mem == null) {
- CreateBuffers(this.Width, this.Height);
- }
- return dc_mem;
- }
- }
-
- private void ImageBufferNeedsRedraw () {
- if (invalid_region != null)
- invalid_region.Dispose();
- invalid_region = new Region (ClientRectangle);
- }
-
- private Bitmap ImageBuffer {
get {
- if (bmp_mem==null) {
- CreateBuffers(this.Width, this.Height);
+ if (bmp_g == null) {
+ bmp = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ bmp_g = Graphics.FromImage (bmp);
}
- return bmp_mem;
+ return bmp_g;
}
}
- internal void CreateBuffers (int width, int height) {
- if (width < 1) {
- width = 1;
- }
-
- if (height < 1) {
- height = 1;
- }
+ private void InvalidateBackBuffer ()
+ {
+ if (backbuffer != null)
+ backbuffer.Invalidate ();
+ }
- bmp_mem = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
- dc_mem = Graphics.FromImage (bmp_mem);
- ImageBufferNeedsRedraw ();
+ private DoubleBuffer GetBackBuffer ()
+ {
+ if (backbuffer == null)
+ backbuffer = new DoubleBuffer (this);
+ return backbuffer;
}
- internal void InvalidateBuffers ()
+ private void DisposeBackBuffer ()
{
- if (dc_mem != null) {
- dc_mem.Dispose ();
+ if (backbuffer != null) {
+ backbuffer.Dispose ();
+ backbuffer = null;
}
-
- dc_mem = null;
- bmp_mem = null;
- ImageBufferNeedsRedraw ();
}
internal static void SetChildColor(Control parent) {
SetChildColor(child);
}
}
-
}
internal bool Select(Control control) {
}
container = GetContainerControl();
- if (container != null) {
+ if (container != null && (Control)container != control) {
container.ActiveControl = control;
}
if (control.IsHandleCreated) {
// Only here to be overriden by our actual controls; this is needed by the accessibility class
}
+ internal static IntPtr MakeParam (int low, int high){
+ return new IntPtr (high << 16 | low & 0xffff);
+ }
+
internal static int LowOrder (int param) {
return ((int)(short)(param & 0xffff));
}
void DrawBackgroundImage (Graphics g)
{
+#if NET_2_0
+ Rectangle drawing_rectangle = new Rectangle ();
+ g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), ClientRectangle);
+
+ switch (backgroundimage_layout)
+ {
+ case ImageLayout.Tile:
+ using (TextureBrush b = new TextureBrush (background_image, WrapMode.Tile)) {
+ g.FillRectangle (b, ClientRectangle);
+ }
+ return;
+ case ImageLayout.Center:
+ drawing_rectangle.Location = new Point (ClientSize.Width / 2 - background_image.Width / 2, ClientSize.Height / 2 - background_image.Height / 2);
+ drawing_rectangle.Size = background_image.Size;
+ break;
+ case ImageLayout.None:
+ drawing_rectangle.Location = Point.Empty;
+ drawing_rectangle.Size = background_image.Size;
+ break;
+ case ImageLayout.Stretch:
+ drawing_rectangle = ClientRectangle;
+ break;
+ case ImageLayout.Zoom:
+ drawing_rectangle = ClientRectangle;
+ if ((float)background_image.Width / (float)background_image.Height < (float)drawing_rectangle.Width / (float) drawing_rectangle.Height) {
+ drawing_rectangle.Width = (int) (background_image.Width * ((float)drawing_rectangle.Height / (float)background_image.Height));
+ drawing_rectangle.X = (ClientRectangle.Width - drawing_rectangle.Width) / 2;
+ } else {
+ drawing_rectangle.Height = (int) (background_image.Height * ((float)drawing_rectangle.Width / (float)background_image.Width));
+ drawing_rectangle.Y = (ClientRectangle.Height - drawing_rectangle.Height) / 2;
+ }
+ break;
+ default:
+ return;
+ }
+
+ g.DrawImage (background_image, drawing_rectangle);
+
+#else
using (TextureBrush b = new TextureBrush (background_image, WrapMode.Tile)) {
g.FillRectangle (b, ClientRectangle);
}
+#endif
}
internal virtual void DndEnter (DragEventArgs e)
buttons |= MouseButtons.Middle;
if ((param & (int) MsgButtons.MK_RBUTTON) != 0)
- buttons |= MouseButtons.Right;
+ buttons |= MouseButtons.Right;
return buttons;
index = -1;
}
-
for (int i = 0, pos = -1; i < end; i++) {
if (start == container.child_controls[i]) {
pos = i;
private static Control FindControlForward(Control container, Control start) {
Control found;
- Control p;
found = null;
- if (start != null) {
- if (start.child_controls != null && start.child_controls.Count > 0 &&
- !((start is IContainerControl) && start.GetStyle(ControlStyles.ContainerControl))) {
- found = FindControlForward(start, null);
- if (found != null) {
- return found;
- }
- }
+ if (start == null) {
+ return FindFlatForward(container, start);
+ }
- p = start.parent;
- while (p != container) {
- found = FindFlatForward(p, start);
+ if (start.child_controls != null && start.child_controls.Count > 0 &&
+ (start == container || !((start is IContainerControl) && start.GetStyle(ControlStyles.ContainerControl)))) {
+ return FindControlForward(start, null);
+ }
+ else {
+ while (start != container) {
+ found = FindFlatForward(start.parent, start);
if (found != null) {
return found;
}
- start = p;
- p = p.parent;
+ start = start.parent;
}
}
- return FindFlatForward(container, start);
+ return null;
}
private static Control FindFlatBackward(Control container, Control start) {
index++;
}
- for (int i = end-1, pos = -1; i >= 0; i--) {
+ bool hit = false;
+
+ for (int i = end - 1; i >= 0; i--) {
if (start == container.child_controls[i]) {
- pos = i;
+ hit = true;
continue;
}
- if (found == null) {
- if (container.child_controls[i].tab_index < index ||
- (pos > -1 && pos > i && container.child_controls[i].tab_index == index)) {
- found = container.child_controls[i];
- }
- } else if (found.tab_index < container.child_controls[i].tab_index) {
- if (container.child_controls[i].tab_index < index) {
+ if (found == null || found.tab_index < container.child_controls[i].tab_index) {
+ if (container.child_controls[i].tab_index < index || (hit && container.child_controls[i].tab_index == index))
found = container.child_controls[i];
- }
+
}
}
return found;
}
private static Control FindControlBackward(Control container, Control start) {
+
+ Control found = null;
+
+ if (start == null) {
+ found = FindFlatBackward(container, start);
+ }
+ else if (start != container) {
+ if (start.parent != null) {
+ found = FindFlatBackward(start.parent, start);
+
+ if (found == null) {
+ if (start.parent != container)
+ return start.parent;
+ return null;
+ }
+ }
+ }
+
+ if (found == null || start.parent == null)
+ found = start;
+
+ while (found != null && (found == container || (!((found is IContainerControl) && found.GetStyle(ControlStyles.ContainerControl))) &&
+ found.child_controls != null && found.child_controls.Count > 0)) {
+// while (ctl.child_controls != null && ctl.child_controls.Count > 0 &&
+// (ctl == this || (!((ctl is IContainerControl) && ctl.GetStyle(ControlStyles.ContainerControl))))) {
+ found = FindFlatBackward(found, null);
+ }
+
+ return found;
+
+/*
Control found;
found = null;
}
}
}
-
return found;
+*/
}
internal virtual void HandleClick(int clicks, MouseEventArgs me) {
}
}
}
+
+ internal void CaptureWithConfine (Control ConfineWindow)
+ {
+ if (this.IsHandleCreated && !is_captured) {
+ is_captured = true;
+ XplatUI.GrabWindow (this.window.Handle, ConfineWindow.Handle);
+ }
+ }
private void CheckDataBindings ()
{
}
}
-
private void ChangeParent(Control new_parent) {
bool pre_enabled;
bool pre_visible;
OnRightToLeftChanged(EventArgs.Empty);
}
- if ((new_parent != null) && new_parent.Created && !Created) {
+ if ((new_parent != null) && new_parent.Created && is_visible && !Created) {
CreateControl();
}
}
private void UpdateDistances() {
- if ((parent != null) && (parent.layout_suspended == 0)) {
- dist_left = bounds.X;
- dist_top = bounds.Y;
- dist_right = parent.ClientSize.Width - bounds.X - bounds.Width;
- dist_bottom = parent.ClientSize.Height - bounds.Y - bounds.Height;
+ if (parent != null) {
+ if (bounds.Width > 0)
+ dist_right = parent.ClientSize.Width - bounds.X - bounds.Width;
+ if (bounds.Height > 0)
+ dist_bottom = parent.ClientSize.Height - bounds.Y - bounds.Height;
+ }
+ }
+
+ private bool UseDoubleBuffering {
+ get {
+ if (!ThemeEngine.Current.DoubleBufferingSupported)
+ return false;
+
+#if NET_2_0
+ if (DoubleBuffered)
+ return true;
+#endif
+ return (control_style & ControlStyles.DoubleBuffer) != 0;
}
}
#endregion // Private & Internal Methods
}
#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
[MonoTODO]
public static bool CheckForIllegalCrossThreadCalls
{
}
set {
+ layout_type = LayoutType.Anchor;
+
anchor_style=value;
- if (parent != null) {
- parent.PerformLayout(this, "Parent");
- }
+ UpdateDistances ();
+
+ if (parent != null)
+ parent.PerformLayout(this, "Anchor");
}
}
#if NET_2_0
// XXX: Implement me!
bool auto_size;
-
+
+ [RefreshProperties (RefreshProperties.All)]
+ [Localizable (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [DefaultValue (false)]
+ [MonoTODO("This method currently does nothing")]
public virtual bool AutoSize {
- get {
- //Console.Error.WriteLine("Unimplemented: Control::get_AutoSize()");
- return auto_size;
- }
+ get { return auto_size; }
set {
- Console.Error.WriteLine("Unimplemented: Control::set_AutoSize(bool)");
- auto_size = value;
+ if (this.auto_size != value) {
+ auto_size = value;
+ OnAutoSizeChanged (EventArgs.Empty);
+ }
}
}
-
+
+#if NET_2_0
+ [AmbientValue ("{Width=0, Height=0}")]
+#else
+ [AmbientValue (typeof(Size), "0, 0")]
+#endif
public virtual Size MaximumSize {
get {
return maximum_size;
return minimum_size;
}
set {
- minimum_size = value;
+ if (minimum_size != value) {
+ minimum_size = value;
+ PerformLayout ();
+ }
}
}
#endif // NET_2_0
if (background_image!=value) {
background_image=value;
OnBackgroundImageChanged(EventArgs.Empty);
+ Invalidate ();
}
}
}
+#if NET_2_0
+ [DefaultValue (ImageLayout.Tile)]
+ [Localizable (true)]
+ public virtual ImageLayout BackgroundImageLayout {
+ get {
+ return backgroundimage_layout;
+ }
+ set {
+ if (Array.IndexOf (Enum.GetValues (typeof (ImageLayout)), value) == -1)
+ throw new InvalidEnumArgumentException ("value", (int) value, typeof(ImageLayout));
+
+ if (value != backgroundimage_layout) {
+ backgroundimage_layout = value;
+ Invalidate ();
+ OnBackgroundImageLayoutChanged (EventArgs.Empty);
+ }
+
+ }
+ }
+#endif
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
set {
this.SetClientSizeCore(value.Width, value.Height);
+#if NET_2_0
+ this.OnClientSizeChanged (EventArgs.Empty);
+#endif
}
}
}
}
+ internal bool ContainerSelected {
+ get { return container_selected; }
+ set { container_selected = value; }
+ }
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool ContainsFocus {
get {
- IntPtr focused_window;
+ IntPtr focused_window;
focused_window = XplatUI.GetFocus();
if (IsHandleCreated) {
return false;
}
}
-
+#if NET_2_0
+ [Browsable (false)]
+#endif
[DefaultValue(null)]
[MWFCategory("Behavior")]
public virtual ContextMenu ContextMenu {
get {
- return context_menu;
+ return GetContextMenuInternal ();
}
set {
}
}
+ internal virtual ContextMenu GetContextMenuInternal ()
+ {
+ return context_menu;
+ }
+
+#if NET_2_0
+ [DefaultValue (null)]
+ public virtual ContextMenuStrip ContextMenuStrip {
+ get { return this.context_menu_strip; }
+ set {
+ if (this.context_menu_strip != value) {
+ this.context_menu_strip = value;
+ OnContextMenuStripChanged (EventArgs.Empty);
+ }
+ }
+ }
+#endif
+
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ControlCollection Controls {
set {
if (cursor != value) {
- Point pt;
+ Point pt;
cursor = value;
}
set {
+ layout_type = LayoutType.Dock;
+
if (dock_style == value) {
return;
}
+ if (!Enum.IsDefined (typeof (DockStyle), value)) {
+ throw new InvalidEnumArgumentException ("value", (int) value,
+ typeof (DockStyle));
+ }
+
dock_style = value;
+ if (dock_style == DockStyle.None) {
+ if (explicit_bounds == Rectangle.Empty)
+ Bounds = new Rectangle (new Point (0, 0), DefaultSize);
+ else
+ Bounds = explicit_bounds;
+ }
+
if (parent != null) {
- parent.PerformLayout(this, "Parent");
+ parent.PerformLayout(this, "Dock");
}
OnDockChanged(EventArgs.Empty);
}
}
+#if NET_2_0
+ protected virtual bool DoubleBuffered {
+ get {
+ return (control_style & ControlStyles.OptimizedDoubleBuffer) != 0;
+ }
+
+ set {
+ if (value == DoubleBuffered)
+ return;
+ if (value) {
+ SetStyle (ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
+ } else {
+ SetStyle (ControlStyles.OptimizedDoubleBuffer, false);
+ }
+
+ }
+ }
+#endif
+
[DispId(-514)]
[Localizable(true)]
[MWFCategory("Behavior")]
}
set {
- if (Enabled == value) {
- is_enabled = value;
- return;
- }
-
- is_enabled = value;
+ if (this.is_enabled != value) {
+ bool old_value = is_enabled;
- // FIXME - we need to switch focus to next control if we're disabling the focused control
+ is_enabled = value;
+ if (old_value != value && !value && this.has_focus)
+ SelectNextControl(this, true, true, true, true);
- OnEnabledChanged (EventArgs.Empty);
+ OnEnabledChanged (EventArgs.Empty);
+ }
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
+ [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual bool Focused {
get {
}
[DispId(-512)]
- [AmbientValue(null)]
+ [AmbientValue(null)]
[Localizable(true)]
[MWFCategory("Appearance")]
public virtual Font Font {
return;
}
- font = value;
+ font = value;
Invalidate();
- OnFontChanged (EventArgs.Empty);
+ OnFontChanged (EventArgs.Empty);
+ PerformLayout ();
}
}
[MWFCategory("Behavior")]
public ImeMode ImeMode {
get {
- if (ime_mode == DefaultImeMode) {
- if (parent != null)
- return parent.ImeMode;
- else
- return ImeMode.NoControl; // default value
- }
+ if (ime_mode == ImeMode.Inherit) {
+ if (parent != null)
+ return parent.ImeMode;
+ else
+ return ImeMode.NoControl; // default value
+ }
return ime_mode;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
+ [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool InvokeRequired { // ISynchronizeInvoke
get {
}
}
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
#if NET_2_0
- public virtual Layout.LayoutEngine LayoutEngine {
- get { return this.layout_engine; }
- }
+ public virtual
#endif
+ Layout.LayoutEngine LayoutEngine {
+ get {
+ if (layout_engine == null)
+ layout_engine = new Layout.DefaultLayout ();
+ return layout_engine;
+ }
+ }
[EditorBrowsable(EditorBrowsableState.Always)]
[Browsable(false)]
[Localizable (true)]
public Padding Margin {
get { return this.margin; }
- set { this.margin = value; }
+ set {
+ if (this.margin != value) {
+ this.margin = value;
+ OnMarginChanged (EventArgs.Empty);
+ }
+ }
}
#endif
}
set {
- padding = value;
+ if (padding != value) {
+ padding = value;
+ OnPaddingChanged (EventArgs.Empty);
+ PerformLayout ();
+ }
}
}
#endif
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ProductName {
get {
- Type t = typeof (AssemblyProductAttribute);
- Assembly assembly = GetType().Module.Assembly;
- object [] attrs = assembly.GetCustomAttributes (t, false);
- AssemblyProductAttribute a = null;
- // On MS we get a NullRefException if product attribute is not
- // set.
- if (attrs != null && attrs.Length > 0)
+ Type t = typeof (AssemblyProductAttribute);
+ Assembly assembly = GetType().Module.Assembly;
+ object [] attrs = assembly.GetCustomAttributes (t, false);
+ AssemblyProductAttribute a = null;
+ // On MS we get a NullRefException if product attribute is not
+ // set.
+ if (attrs != null && attrs.Length > 0)
a = (AssemblyProductAttribute) attrs [0];
return a.Product;
}
}
set {
- if (IsHandleCreated) {
- XplatUI.SetClipRegion(Handle, value);
+ if (clip_region != value) {
+ if (value != null && IsHandleCreated)
+ XplatUI.SetClipRegion(Handle, value);
+
+ clip_region = value;
+#if NET_2_0
+ OnRegionChanged (EventArgs.Empty);
+#endif
}
- clip_region = value;
}
}
if (value != right_to_left) {
right_to_left = value;
OnRightToLeftChanged(EventArgs.Empty);
+ PerformLayout ();
}
}
}
set {
base.Site = value;
- AmbientProperties ap = (AmbientProperties) value.GetService (typeof (AmbientProperties));
- if (ap != null) {
- BackColor = ap.BackColor;
- ForeColor = ap.ForeColor;
- Cursor = ap.Cursor;
- Font = ap.Font;
+ if (value != null) {
+ AmbientProperties ap = (AmbientProperties) value.GetService (typeof (AmbientProperties));
+ if (ap != null) {
+ BackColor = ap.BackColor;
+ ForeColor = ap.ForeColor;
+ Cursor = ap.Cursor;
+ Font = ap.Font;
+ }
}
}
}
}
}
+#if NET_2_0
+ protected virtual Cursor DefaultCursor { get { return Cursors.Default; } }
+#endif
+
protected virtual ImeMode DefaultImeMode {
get {
return ImeMode.Inherit;
protected virtual Padding DefaultMargin {
get { return new Padding (3); }
}
+
+ protected virtual Size DefaultMaximumSize { get { return new Size (); } }
+ protected virtual Size DefaultMinimumSize { get { return new Size (); } }
+ protected virtual Padding DefaultPadding { get { return new Padding (); } }
#endif
protected virtual Size DefaultSize {
;; // Nothing to do
}
}
-
+#if NET_2_0
+ [Obsolete ()]
+#endif
protected bool RenderRightToLeft {
get {
return (this.right_to_left == RightToLeft.Yes);
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+#if NET_2_0
+ internal virtual
+#endif
protected bool ShowKeyboardCues {
get {
return true;
}
public static bool IsMnemonic(char charCode, string text) {
- int amp;
+ int amp;
amp = text.IndexOf('&');
return false;
}
- public void CreateControl() {
+ public void CreateControl ()
+ {
if (is_disposed) {
throw new ObjectDisposedException(GetType().FullName.ToString());
}
Control [] controls = child_controls.GetAllControls ();
for (int i=0; i<controls.Length; i++) {
- controls [i].CreateControl ();
+ if (controls [i].is_visible)
+ controls [i].CreateControl ();
}
UpdateChildrenZOrder();
}
return null;
}
-
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+#endif
public bool Focus() {
if (CanFocus && IsHandleCreated && !has_focus && !is_focusing) {
is_focusing = true;
public Control GetNextControl(Control ctl, bool forward) {
- if (ctl != null && this != ctl) {
- if (!ctl.CanSelect ||
- ((parent == null) && (ctl is IContainerControl) && ctl.GetStyle(ControlStyles.ContainerControl))
- ) {
- if (forward) {
- return FindFlatForward(this, ctl);
- } else {
- return FindFlatBackward(this, ctl);
- }
- }
- }
-
- // If ctl is not contained by this, we start at the first child of this
if (!this.Contains(ctl)) {
- ctl = null;
+ ctl = this;
}
- // Search through our controls, starting at ctl, stepping into children as we encounter them
- // try to find the control with the tabindex closest to our own, or, if we're looking into
- // child controls, the one with the smallest tabindex
if (forward) {
- return FindControlForward(this, ctl);
+ ctl = FindControlForward(this, ctl);
+ }
+ else {
+ ctl = FindControlBackward(this, ctl);
+ }
+
+ if (ctl != this) {
+ return ctl;
}
- return FindControlBackward(this, ctl);
+ return null;
}
#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
public virtual Size GetPreferredSize (Size proposedSize) {
return preferred_size;
}
}
public void Invalidate(System.Drawing.Rectangle rc, bool invalidateChildren) {
- if (!IsHandleCreated || !Visible || rc.Width == 0 || rc.Height == 0) {
+ // Win32 invalidates control including when Width and Height is equal 0
+ // or is not visible, only Paint event must be care about this.
+ if (!IsHandleCreated)
return;
- }
- NotifyInvalidate(rc);
+ if (rc.Width > 0 && rc.Height > 0) {
- XplatUI.Invalidate(Handle, rc, false);
+ NotifyInvalidate(rc);
- if (invalidateChildren) {
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i<controls.Length; i++)
- controls [i].Invalidate ();
+ XplatUI.Invalidate(Handle, rc, false);
+
+ if (invalidateChildren) {
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i=0; i<controls.Length; i++)
+ controls [i].Invalidate ();
+ }
}
OnInvalidated(new InvalidateEventArgs(rc));
}
PerformLayout(null, null);
}
+ internal void SetImplicitBounds (int x, int y, int width, int height)
+ {
+ Rectangle saved_bounds = explicit_bounds;
+ SetBounds (x, y, width, height);
+ explicit_bounds = saved_bounds;
+ }
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
public void PerformLayout(Control affectedControl, string affectedProperty) {
LayoutEventArgs levent = new LayoutEventArgs(affectedControl, affectedProperty);
// Perform all Dock and Anchor calculations
try {
-
-#if NET_2_0
- this.layout_engine.Layout(this, levent);
-#else
- // This has been moved to Layout/DefaultLayout.cs for 2.0, please duplicate any changes/fixes there.
- Control child;
- AnchorStyles anchor;
- Rectangle space;
-
- space = DisplayRectangle;
-
- // Deal with docking; go through in reverse, MS docs say that lowest Z-order is closest to edge
- Control [] controls = child_controls.GetAllControls ();
- for (int i = controls.Length - 1; i >= 0; i--) {
- child = controls [i];
-
- if (!child.Visible) {
- continue;
- }
-
- switch (child.Dock) {
- case DockStyle.None: {
- // Do nothing
- break;
- }
-
- case DockStyle.Left: {
- child.SetBounds(space.Left, space.Y, child.Width, space.Height);
- space.X+=child.Width;
- space.Width-=child.Width;
- break;
- }
-
- case DockStyle.Top: {
- child.SetBounds(space.Left, space.Y, space.Width, child.Height);
- space.Y+=child.Height;
- space.Height-=child.Height;
- break;
- }
-
- case DockStyle.Right: {
- child.SetBounds(space.Right-child.Width, space.Y, child.Width, space.Height);
- space.Width-=child.Width;
- break;
- }
-
- case DockStyle.Bottom: {
- child.SetBounds(space.Left, space.Bottom-child.Height, space.Width, child.Height);
- space.Height-=child.Height;
- break;
- }
- }
- }
-
- for (int i = controls.Length - 1; i >= 0; i--) {
- child=controls[i];
-
- //if (child.Visible && (child.Dock == DockStyle.Fill)) {
- if (child.Dock == DockStyle.Fill) {
- child.SetBounds(space.Left, space.Top, space.Width, space.Height);
- }
- }
-
- space = DisplayRectangle;
-
- for (int i=0; i < controls.Length; i++) {
- int left;
- int top;
- int width;
- int height;
-
- child = controls[i];
-
- // If the control is docked we don't need to do anything
- if (child.Dock != DockStyle.None) {
- continue;
- }
-
- anchor = child.Anchor;
-
- left = child.Left;
- top = child.Top;
- width = child.Width;
- height = child.Height;
-
- if ((anchor & AnchorStyles.Left) !=0 ) {
- if ((anchor & AnchorStyles.Right) != 0) {
- width = space.Width - child.dist_right - left;
- } else {
- ; // Left anchored only, nothing to be done
- }
- } else if ((anchor & AnchorStyles.Right) != 0) {
- left = space.Width - child.dist_right - width;
- } else {
- // left+=diff_width/2 will introduce rounding errors (diff_width removed from svn after r51780)
- // This calculates from scratch every time:
- left = child.dist_left + (space.Width - (child.dist_left + width + child.dist_right)) / 2;
- }
-
- if ((anchor & AnchorStyles.Top) !=0 ) {
- if ((anchor & AnchorStyles.Bottom) != 0) {
- height = space.Height - child.dist_bottom - top;
- } else {
- ; // Top anchored only, nothing to be done
- }
- } else if ((anchor & AnchorStyles.Bottom) != 0) {
- top = space.Height - child.dist_bottom - height;
- } else {
- // top += diff_height/2 will introduce rounding errors (diff_height removed from after r51780)
- // This calculates from scratch every time:
- top = child.dist_top + (space.Height - (child.dist_top + height + child.dist_bottom)) / 2;
- }
-
- // Sanity
- if (width < 0) {
- width=0;
- }
-
- if (height < 0) {
- height=0;
- }
-
- child.SetBounds(left, top, width, height);
- }
-#endif
-
- // Let everyone know
OnLayout(levent);
}
return new Rectangle(PointToScreen(r.Location), r.Size);
}
- public virtual void Refresh() {
- if (IsHandleCreated == true) {
+ public virtual void Refresh() {
+ if (IsHandleCreated) {
Invalidate();
XplatUI.UpdateWindow(window.Handle);
BackColor = Color.Empty;
}
- [EditorBrowsable(EditorBrowsableState.Never)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public void ResetBindings() {
data_bindings.Clear();
}
}
if (layout_suspended == 0) {
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i<controls.Length; i++) {
- controls [i].UpdateDistances ();
- }
-
if (performLayout && layout_pending) {
PerformLayout();
}
}
}
-
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Obsolete ()]
+#endif
public void Scale(float ratio) {
ScaleCore(ratio, ratio);
}
-
+
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Obsolete ()]
+#endif
public void Scale(float dx, float dy) {
ScaleCore(dx, dy);
}
#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
public void Scale(SizeF factor) {
ScaleCore(factor.Width, factor.Height);
}
#endif
public void Select() {
- Select(false, false);
+ if (this is ContainerControl)
+ ContainerSelected = true;
+ else {
+ Control c = this.Parent;
+ while (c != null) {
+ c.ContainerSelected = false;
+ c = c.Parent;
+ }
+ }
+ Select(false, false);
}
+#if DebugFocus
+ private void printTree(Control c, string t) {
+ foreach(Control i in c.child_controls) {
+ Console.WriteLine("{2}{0}.TabIndex={1}", i, i.tab_index, t);
+ printTree(i, t+"\t");
+ }
+ }
+#endif
public bool SelectNextControl(Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) {
Control c;
+#if DebugFocus
+ Console.WriteLine("{0}", this.FindForm());
+ printTree(this, "\t");
+#endif
+
+ if (!this.Contains(ctl) || (!nested && (ctl.parent != this))) {
+ ctl = null;
+ }
c = ctl;
do {
c = GetNextControl(c, forward);
c.Select (true, true);
return true;
}
- } while (c != ctl); // If we wrap back to ourselves we stop
+ } while (c != ctl); // If we wrap back to ourselves we stop
return false;
}
}
}
- public void Show() {
+ public void Show ()
+ {
if (!is_created) {
this.CreateControl();
}
window.CreateHandle(CreateParams);
if (window.Handle != IntPtr.Zero) {
- lock (Control.controls) {
- if (!Control.controls.Contains(window.Handle)) {
- Control.controls.Add(this);
- }
- }
-
creator_thread = Thread.CurrentThread;
XplatUI.EnableWindow(window.Handle, is_enabled);
}
}
- protected bool GetStyle(ControlStyles flag) {
+#if NET_2_0
+ protected virtual AccessibleObject GetAccessibilityObjectById (int objectId)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
+ protected internal bool GetStyle(ControlStyles flag) {
return (control_style & flag) != 0;
}
return RtlTranslateAlignment(align);
}
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Never)]
+#else
[EditorBrowsable(EditorBrowsableState.Advanced)]
+#endif
protected virtual void ScaleCore(float dx, float dy) {
Point location;
Size size;
IContainerControl container;
container = GetContainerControl();
- if (container != null)
- container.ActiveControl = this;
+ if (container != null && (Control)container != this)
+ if (!this.Parent.ContainerSelected)
+ container.ActiveControl = this;
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
// SetBoundsCore updates the Win32 control itself. UpdateBounds updates the controls variables and fires events, I'm guessing - pdb
if (IsHandleCreated) {
XplatUI.SetWindowPos(Handle, x, y, width, height);
+
+ // Win32 automatically changes negative width/height to 0.
+ // The control has already been sent a WM_WINDOWPOSCHANGED message and it has the correct
+ // data, but it'll be overwritten when we call UpdateBounds unless we get the updated
+ // size.
+ if (width < 0 || height < 0) {
+ int cw, ch, ix, iy;
+ XplatUI.GetWindowPos(Handle, this is Form, out ix, out iy, out width, out height, out cw, out ch);
+ }
}
UpdateBounds(x, y, width, height);
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void SetClientSizeCore(int x, int y) {
- // Calculate the actual window size from the client size (it usually stays the same or grows)
- Rectangle ClientRect;
- Rectangle WindowRect;
- CreateParams cp;
-
- ClientRect = new Rectangle(0, 0, x, y);
- cp = this.CreateParams;
-
- if (XplatUI.CalculateWindowRect(ref ClientRect, cp.Style, cp.ExStyle, null, out WindowRect)==false) {
- return;
- }
-
- SetBounds(bounds.X, bounds.Y, WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
+ Size NewSize = SizeFromClientSize (new Size (x, y));
+
+ if (NewSize != Size.Empty)
+ SetBounds (bounds.X, bounds.Y, NewSize.Width, NewSize.Height, BoundsSpecified.Size);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void SetStyle(ControlStyles flag, bool value) {
+ protected internal void SetStyle(ControlStyles flag, bool value) {
if (value) {
control_style |= flag;
} else {
protected void SetTopLevel(bool value) {
if ((GetTopLevel() != value) && (parent != null)) {
- throw new Exception();
+ throw new ArgumentException ("Cannot change toplevel style of a parented control.");
}
if (this is Form) {
}
} else {
if (Visible) {
- Visible = false;
+ Visible = false;
}
}
}
protected virtual void SetVisibleCore(bool value) {
if (value!=is_visible) {
- if (value && (window.Handle == IntPtr.Zero) || !is_created) {
+ if (value && ((window.Handle == IntPtr.Zero) || !is_created)) {
CreateControl();
}
if (parent != null) {
parent.PerformLayout(this, "visible");
} else {
- PerformLayout(this, "visible");
+ if (is_visible)
+ PerformLayout(this, "visible");
}
}
}
-
+
+#if NET_2_0
+ protected
+#else
+ internal
+#endif
+ virtual Size SizeFromClientSize (Size clientSize)
+ {
+ Rectangle ClientRect;
+ Rectangle WindowRect;
+ CreateParams cp;
+
+ ClientRect = new Rectangle (0, 0, clientSize.Width, clientSize.Height);
+ cp = this.CreateParams;
+
+ if (XplatUI.CalculateWindowRect (ref ClientRect, cp.Style, cp.ExStyle, null, out WindowRect))
+ return new Size (WindowRect.Width, WindowRect.Height);
+
+ return Size.Empty;
+ }
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected void UpdateBounds() {
int x;
bounds.Width=width;
bounds.Height=height;
+ // Assume explicit bounds set. SetImplicitBounds will restore old bounds
+ explicit_bounds = bounds;
+
client_size.Width=clientWidth;
client_size.Height=clientHeight;
if (resized) {
OnSizeChanged(EventArgs.Empty);
+#if NET_2_0
+ OnClientSizeChanged (EventArgs.Empty);
+#endif
}
}
if (index > 0) {
XplatUI.SetZOrder(child.Handle, child_controls[index - 1].Handle, false, false);
} else {
- XplatUI.SetZOrder(child.Handle, IntPtr.Zero, true, false);
+ IntPtr after = AfterTopMostControl ();
+ if (after != IntPtr.Zero)
+ XplatUI.SetZOrder (child.Handle, after, false, false);
+ else
+ XplatUI.SetZOrder (child.Handle, IntPtr.Zero, true, false);
}
}
}
+
+ // Override this if there is a control that shall always remain on
+ // top of other controls (such as scrollbars). If there are several
+ // of these controls, the bottom-most should be returned.
+ internal virtual IntPtr AfterTopMostControl ()
+ {
+ return IntPtr.Zero;
+ }
private void UpdateChildrenZOrder() {
Control [] controls;
protected virtual void WndProc(ref Message m) {
#if debug
- Console.WriteLine("Control {0} received message {1}", window.Handle == IntPtr.Zero ? this.Text : XplatUI.Window(window.Handle), (Msg)m.Msg);
+ Console.WriteLine("Control {0} received message {1}", window.Handle == IntPtr.Zero ? this.Text : XplatUI.Window(window.Handle), m.ToString ());
#endif
if ((this.control_style & ControlStyles.EnableNotifyMessage) != 0) {
OnNotifyMessage(m);
}
switch((Msg)m.Msg) {
- case Msg.WM_DESTROY: {
- OnHandleDestroyed(EventArgs.Empty);
+ case Msg.WM_DESTROY: {
+ OnHandleDestroyed(EventArgs.Empty);
#if DebugRecreate
- IntPtr handle = window.Handle;
+ IntPtr handle = window.Handle;
#endif
- window.InvalidateHandle();
+ window.InvalidateHandle();
- if (is_recreating) {
+ if (is_recreating) {
#if DebugRecreate
- Console.WriteLine ("Creating handle for {0:X}", handle.ToInt32());
+ Console.WriteLine ("Creating handle for {0:X}", handle.ToInt32());
#endif
- CreateHandle();
+ CreateHandle();
#if DebugRecreate
- Console.WriteLine (" + new handle = {0:X}", Handle.ToInt32());
+ Console.WriteLine (" + new handle = {0:X}", Handle.ToInt32());
#endif
- is_recreating = false;
- }
- return;
+ is_recreating = false;
}
+ return;
+ }
- case Msg.WM_WINDOWPOSCHANGED: {
- if (Visible) {
- UpdateBounds();
- if (GetStyle(ControlStyles.ResizeRedraw)) {
- Invalidate();
- }
+ case Msg.WM_WINDOWPOSCHANGED: {
+ if (Visible) {
+ Rectangle save_bounds = explicit_bounds;
+ UpdateBounds();
+ explicit_bounds = save_bounds;
+ if (GetStyle(ControlStyles.ResizeRedraw)) {
+ Invalidate();
}
- return;
}
+ return;
+ }
- // Nice description of what should happen when handling WM_PAINT
- // can be found here: http://pluralsight.com/wiki/default.aspx/Craig/FlickerFreeControlDrawing.html
- // and here http://msdn.microsoft.com/msdnmag/issues/06/03/WindowsFormsPerformance/
- case Msg.WM_PAINT: {
- PaintEventArgs paint_event;
-
- paint_event = XplatUI.PaintEventStart(Handle, true);
+ // Nice description of what should happen when handling WM_PAINT
+ // can be found here: http://pluralsight.com/wiki/default.aspx/Craig/FlickerFreeControlDrawing.html
+ // and here http://msdn.microsoft.com/msdnmag/issues/06/03/WindowsFormsPerformance/
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
- if (paint_event == null) {
- return;
- }
+ paint_event = XplatUI.PaintEventStart(Handle, true);
- if (invalid_region != null && !invalid_region.IsVisible (paint_event.ClipRectangle)) {
+ if (paint_event == null) {
+ return;
+ }
+ DoubleBuffer current_buffer = null;
+ if (UseDoubleBuffering) {
+ current_buffer = GetBackBuffer ();
+ if (!current_buffer.InvalidRegion.IsVisible (paint_event.ClipRectangle)) {
// Just blit the previous image
- paint_event.Graphics.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
- XplatUI.PaintEventEnd(Handle, true);
+ current_buffer.Blit (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
return;
}
+ current_buffer.Start (paint_event);
+ }
+
+ if (!GetStyle(ControlStyles.Opaque)) {
+ OnPaintBackground(paint_event);
+ }
- Graphics dc = null;
- Graphics back_dc = null;
- Bitmap backbuffer = null;
- if (ThemeEngine.Current.DoubleBufferingSupported) {
- if ((control_style & ControlStyles.DoubleBuffer) != 0) {
- backbuffer = ImageBuffer;
- back_dc = Graphics.FromImage (backbuffer);
- dc = paint_event.SetGraphics (back_dc);
- }
- }
-
- if (!GetStyle(ControlStyles.Opaque)) {
- OnPaintBackground(paint_event);
- }
+ // Button-derived controls choose to ignore their Opaque style, give them a chance to draw their background anyways
+ OnPaintBackgroundInternal(paint_event);
- // Button-derived controls choose to ignore their Opaque style, give them a chance to draw their background anyways
- OnPaintBackgroundInternal(paint_event);
+ OnPaintInternal(paint_event);
+ if (!paint_event.Handled) {
+ OnPaint(paint_event);
+ }
- OnPaintInternal(paint_event);
- if (!paint_event.Handled) {
- OnPaint(paint_event);
- }
+ if (current_buffer != null) {
+ current_buffer.End (paint_event);
+ }
- if (ThemeEngine.Current.DoubleBufferingSupported)
- if ((control_style & ControlStyles.DoubleBuffer) != 0) {
- dc.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
- paint_event.SetGraphics (dc);
- invalid_region.Exclude (paint_event.ClipRectangle);
- back_dc.Dispose ();
- if (backbuffer != bmp_mem)
- backbuffer.Dispose();
- }
- XplatUI.PaintEventEnd(Handle, true);
+ XplatUI.PaintEventEnd(Handle, true);
- return;
- }
+ return;
+ }
- case Msg.WM_ERASEBKGND: {
- // The DefWndProc will never have to handle this, we always paint the background in managed code
- // In theory this code would look at ControlStyles.AllPaintingInWmPaint and and call OnPaintBackground
- // here but it just makes things more complicated...
- m.Result = (IntPtr)1;
- return;
- }
+ case Msg.WM_ERASEBKGND: {
+ // The DefWndProc will never have to handle this, we always paint the background in managed code
+ // In theory this code would look at ControlStyles.AllPaintingInWmPaint and and call OnPaintBackground
+ // here but it just makes things more complicated...
+ m.Result = (IntPtr)1;
+ return;
+ }
- case Msg.WM_LBUTTONUP: {
- MouseEventArgs me;
+ case Msg.WM_LBUTTONUP: {
+ MouseEventArgs me;
- me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Left,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0);
+ me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Left,
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0);
- HandleClick(mouse_clicks, me);
- OnMouseUp (me);
+ HandleClick(mouse_clicks, me);
+ OnMouseUp (me);
- if (InternalCapture) {
- InternalCapture = false;
- }
+ if (InternalCapture) {
+ InternalCapture = false;
+ }
- if (mouse_clicks > 1) {
- mouse_clicks = 1;
- }
- return;
+ if (mouse_clicks > 1) {
+ mouse_clicks = 1;
}
+ return;
+ }
- case Msg.WM_LBUTTONDOWN: {
- if (CanSelect) {
- Select (true, true);
- }
- InternalCapture = true;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
-
- return;
- }
-
- case Msg.WM_LBUTTONDBLCLK: {
- InternalCapture = true;
- mouse_clicks++;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
+ case Msg.WM_LBUTTONDOWN: {
+ if (CanSelect) {
+ Select (true, true);
+ }
+ InternalCapture = true;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+
+ return;
+ }
- return;
- }
+ case Msg.WM_LBUTTONDBLCLK: {
+ InternalCapture = true;
+ mouse_clicks++;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
- case Msg.WM_MBUTTONUP: {
- MouseEventArgs me;
+ case Msg.WM_MBUTTONUP: {
+ MouseEventArgs me;
- me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Middle,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0);
+ me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Middle,
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0);
- HandleClick(mouse_clicks, me);
- OnMouseUp (me);
- if (InternalCapture) {
- InternalCapture = false;
- }
- if (mouse_clicks > 1) {
- mouse_clicks = 1;
- }
- return;
+ HandleClick(mouse_clicks, me);
+ OnMouseUp (me);
+ if (InternalCapture) {
+ InternalCapture = false;
}
-
- case Msg.WM_MBUTTONDOWN: {
- InternalCapture = true;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
-
- return;
+ if (mouse_clicks > 1) {
+ mouse_clicks = 1;
}
+ return;
+ }
+
+ case Msg.WM_MBUTTONDOWN: {
+ InternalCapture = true;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
- case Msg.WM_MBUTTONDBLCLK: {
- InternalCapture = true;
- mouse_clicks++;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
+ case Msg.WM_MBUTTONDBLCLK: {
+ InternalCapture = true;
+ mouse_clicks++;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
- case Msg.WM_RBUTTONUP: {
- MouseEventArgs me;
- Point pt;
+ case Msg.WM_RBUTTONUP: {
+ MouseEventArgs me;
+ Point pt;
- pt = new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()));
- pt = PointToScreen(pt);
+ pt = new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()));
+ pt = PointToScreen(pt);
- XplatUI.SendMessage(m.HWnd, Msg.WM_CONTEXTMENU, m.HWnd, (IntPtr)(pt.X + (pt.Y << 16)));
+ XplatUI.SendMessage(m.HWnd, Msg.WM_CONTEXTMENU, m.HWnd, (IntPtr)(pt.X + (pt.Y << 16)));
- me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Right,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0);
+ me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Right,
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0);
- HandleClick(mouse_clicks, me);
- OnMouseUp (me);
+ HandleClick(mouse_clicks, me);
+ OnMouseUp (me);
- if (InternalCapture) {
- InternalCapture = false;
- }
+ if (InternalCapture) {
+ InternalCapture = false;
+ }
- if (mouse_clicks > 1) {
- mouse_clicks = 1;
- }
- return;
+ if (mouse_clicks > 1) {
+ mouse_clicks = 1;
}
+ return;
+ }
- case Msg.WM_RBUTTONDOWN: {
- InternalCapture = true;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
+ case Msg.WM_RBUTTONDOWN: {
+ InternalCapture = true;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
- case Msg.WM_RBUTTONDBLCLK: {
- InternalCapture = true;
- mouse_clicks++;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
+ case Msg.WM_RBUTTONDBLCLK: {
+ InternalCapture = true;
+ mouse_clicks++;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
- case Msg.WM_CONTEXTMENU: {
- if (context_menu != null) {
- Point pt;
+ case Msg.WM_CONTEXTMENU: {
+ if (context_menu != null) {
+ Point pt;
- pt = new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()));
- context_menu.Show(this, PointToClient(pt));
- return;
- }
+ pt = new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()));
- DefWndProc(ref m);
+ if (pt.X == -1 || pt.Y == -1) {
+ pt.X = (this.Width / 2) + this.Left;
+ pt.Y = (this.Height / 2) + this.Top;
+ pt = this.PointToScreen (pt);
+ }
+
+ context_menu.Show (this, PointToClient (pt));
return;
}
- case Msg.WM_MOUSEWHEEL: {
- DefWndProc(ref m);
- OnMouseWheel (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- HighOrder(m.WParam.ToInt32())));
- return;
- }
+#if NET_2_0
+ // If there isn't a regular context menu, show the Strip version
+ if (context_menu == null && context_menu_strip != null) {
+ Point pt;
+ pt = new Point (LowOrder ((int)m.LParam.ToInt32 ()), HighOrder ((int)m.LParam.ToInt32 ()));
- case Msg.WM_MOUSEMOVE: {
- OnMouseMove (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
-
- case Msg.WM_MOUSE_ENTER: {
- if (is_entered) {
- return;
+ if (pt.X == -1 || pt.Y == -1) {
+ pt.X = (this.Width / 2) + this.Left;
+ pt.Y = (this.Height /2) + this.Top;
+ pt = this.PointToScreen (pt);
}
- is_entered = true;
- OnMouseEnter(EventArgs.Empty);
+
+ context_menu_strip.Show (this, PointToClient (pt));
return;
}
+#endif
+ DefWndProc(ref m);
+ return;
+ }
- case Msg.WM_MOUSE_LEAVE: {
- is_entered=false;
- OnMouseLeave(EventArgs.Empty);
- return;
- }
+ case Msg.WM_MOUSEWHEEL: {
+ DefWndProc(ref m);
+ OnMouseWheel (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ HighOrder(m.WParam.ToInt32())));
+ return;
+ }
- case Msg.WM_MOUSEHOVER: {
- OnMouseHover(EventArgs.Empty);
+
+ case Msg.WM_MOUSEMOVE: {
+ OnMouseMove (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
+
+ case Msg.WM_MOUSE_ENTER: {
+ if (is_entered) {
return;
}
+ is_entered = true;
+ OnMouseEnter(EventArgs.Empty);
+ return;
+ }
- case Msg.WM_SYSKEYUP: {
- if (ProcessKeyMessage(ref m)) {
- m.Result = IntPtr.Zero;
- return;
- }
-
- if ((m.WParam.ToInt32() & (int)Keys.KeyCode) == (int)Keys.Menu) {
- Form form;
+ case Msg.WM_MOUSE_LEAVE: {
+ is_entered=false;
+ OnMouseLeave(EventArgs.Empty);
+ return;
+ }
- form = FindForm();
- if (form != null && form.ActiveMenu != null) {
- form.ActiveMenu.ProcessCmdKey(ref m, (Keys)m.WParam.ToInt32());
- }
- }
+ case Msg.WM_MOUSEHOVER: {
+ OnMouseHover(EventArgs.Empty);
+ return;
+ }
- DefWndProc (ref m);
+ case Msg.WM_SYSKEYUP: {
+ if (ProcessKeyMessage(ref m)) {
+ m.Result = IntPtr.Zero;
return;
}
- case Msg.WM_SYSKEYDOWN:
- case Msg.WM_KEYDOWN:
- case Msg.WM_KEYUP:
- case Msg.WM_SYSCHAR:
- case Msg.WM_CHAR: {
- if (ProcessKeyMessage(ref m)) {
- m.Result = IntPtr.Zero;
- return;
+ if ((m.WParam.ToInt32() & (int)Keys.KeyCode) == (int)Keys.Menu) {
+ Form form;
+
+ form = FindForm();
+ if (form != null && form.ActiveMenu != null) {
+ form.ActiveMenu.ProcessCmdKey(ref m, (Keys)m.WParam.ToInt32());
}
- DefWndProc (ref m);
- return;
}
- case Msg.WM_HELP: {
- Point mouse_pos;
- if (m.LParam != IntPtr.Zero) {
- HELPINFO hi;
-
- hi = new HELPINFO();
+ DefWndProc (ref m);
+ return;
+ }
- hi = (HELPINFO) Marshal.PtrToStructure (m.LParam, typeof (HELPINFO));
- mouse_pos = new Point(hi.MousePos.x, hi.MousePos.y);
- } else {
- mouse_pos = Control.MousePosition;
- }
- OnHelpRequested(new HelpEventArgs(mouse_pos));
- m.Result = (IntPtr)1;
+ case Msg.WM_SYSKEYDOWN:
+ case Msg.WM_KEYDOWN:
+ case Msg.WM_KEYUP:
+ case Msg.WM_SYSCHAR:
+ case Msg.WM_CHAR: {
+ if (ProcessKeyMessage(ref m)) {
+ m.Result = IntPtr.Zero;
return;
}
+ DefWndProc (ref m);
+ return;
+ }
- case Msg.WM_KILLFOCUS: {
- this.has_focus = false;
- OnLostFocusInternal (EventArgs.Empty);
- return;
+ case Msg.WM_HELP: {
+ Point mouse_pos;
+ if (m.LParam != IntPtr.Zero) {
+ HELPINFO hi;
+
+ hi = new HELPINFO();
+
+ hi = (HELPINFO) Marshal.PtrToStructure (m.LParam, typeof (HELPINFO));
+ mouse_pos = new Point(hi.MousePos.x, hi.MousePos.y);
+ } else {
+ mouse_pos = Control.MousePosition;
}
+ OnHelpRequested(new HelpEventArgs(mouse_pos));
+ m.Result = (IntPtr)1;
+ return;
+ }
- case Msg.WM_SETFOCUS: {
- if (!has_focus) {
- this.has_focus = true;
- OnGotFocusInternal (EventArgs.Empty);
- }
- return;
+ case Msg.WM_KILLFOCUS: {
+ this.has_focus = false;
+ OnLostFocusInternal (EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_SETFOCUS: {
+ if (!has_focus) {
+ if (this.Parent != null && this.Parent.ContainerSelected)
+ return;
+ this.has_focus = true;
+ OnGotFocusInternal (EventArgs.Empty);
}
+ return;
+ }
+ case Msg.WM_SYSCOLORCHANGE: {
+ ThemeEngine.Current.ResetDefaults();
+ OnSystemColorsChanged(EventArgs.Empty);
+ return;
+ }
- case Msg.WM_SYSCOLORCHANGE: {
- ThemeEngine.Current.ResetDefaults();
- OnSystemColorsChanged(EventArgs.Empty);
+ case Msg.WM_SETCURSOR: {
+ if ((cursor == null) || ((HitTest)(m.LParam.ToInt32() & 0xffff) != HitTest.HTCLIENT)) {
+ DefWndProc(ref m);
return;
}
-
- case Msg.WM_SETCURSOR: {
- if ((cursor == null) || ((HitTest)(m.LParam.ToInt32() & 0xffff) != HitTest.HTCLIENT)) {
- DefWndProc(ref m);
- return;
- }
-
- XplatUI.SetCursor(window.Handle, cursor.handle);
- m.Result = (IntPtr)1;
+ XplatUI.SetCursor(window.Handle, cursor.handle);
+ m.Result = (IntPtr)1;
- return;
- }
+ return;
+ }
- default: {
- DefWndProc(ref m);
- return;
- }
+ default:
+ DefWndProc(ref m);
+ return;
}
}
#endregion // Public Instance Methods
#region OnXXX methods
- [EditorBrowsable(EditorBrowsableState.Advanced)]
+#if NET_2_0
+ protected virtual void OnAutoSizeChanged (EventArgs e)
+ {
+ EventHandler eh = (EventHandler)(Events[AutoSizeChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endif
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
protected virtual void OnBackColorChanged(EventArgs e) {
- if (BackColorChanged!=null) BackColorChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [BackColorChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBackColorChanged(e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnBackgroundImageChanged(EventArgs e) {
- if (BackgroundImageChanged!=null) BackgroundImageChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [BackgroundImageChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBackgroundImageChanged(e);
}
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnBackgroundImageLayoutChanged (EventArgs e)
+ {
+ EventHandler eh = (EventHandler)(Events[BackgroundImageLayoutChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endif
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnBindingContextChanged(EventArgs e) {
CheckDataBindings ();
- if (BindingContextChanged!=null) {
- BindingContextChanged(this, e);
- }
+ EventHandler eh = (EventHandler)(Events [BindingContextChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBindingContextChanged(e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnCausesValidationChanged(EventArgs e) {
- if (CausesValidationChanged!=null) CausesValidationChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [CausesValidationChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnChangeUICues(UICuesEventArgs e) {
- if (ChangeUICues!=null) ChangeUICues(this, e);
+ UICuesEventHandler eh = (UICuesEventHandler)(Events [ChangeUICuesEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnClick(EventArgs e) {
- if (Click!=null) Click(this, e);
+ EventHandler eh = (EventHandler)(Events [ClickEvent]);
+ if (eh != null)
+ eh (this, e);
}
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnClientSizeChanged (EventArgs e)
+ {
+ EventHandler eh = (EventHandler)(Events[ClientSizeChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endif
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnContextMenuChanged(EventArgs e) {
- if (ContextMenuChanged!=null) ContextMenuChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [ContextMenuChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnContextMenuStripChanged (EventArgs e) {
+ EventHandler eh = (EventHandler)(Events [ContextMenuStripChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endif
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnControlAdded(ControlEventArgs e) {
- if (ControlAdded!=null) ControlAdded(this, e);
+ ControlEventHandler eh = (ControlEventHandler)(Events [ControlAddedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnControlRemoved(ControlEventArgs e) {
- if (ControlRemoved!=null) ControlRemoved(this, e);
+ ControlEventHandler eh = (ControlEventHandler)(Events [ControlRemovedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnCursorChanged(EventArgs e) {
- if (CursorChanged!=null) CursorChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [CursorChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnDockChanged(EventArgs e) {
- if (DockChanged!=null) DockChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [DockChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnDoubleClick(EventArgs e) {
- if (DoubleClick!=null) DoubleClick(this, e);
+ EventHandler eh = (EventHandler)(Events [DoubleClickEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnDragDrop(DragEventArgs drgevent) {
- if (DragDrop!=null) DragDrop(this, drgevent);
+ DragEventHandler eh = (DragEventHandler)(Events [DragDropEvent]);
+ if (eh != null)
+ eh (this, drgevent);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnDragEnter(DragEventArgs drgevent) {
- if (DragEnter!=null) DragEnter(this, drgevent);
+ DragEventHandler eh = (DragEventHandler)(Events [DragEnterEvent]);
+ if (eh != null)
+ eh (this, drgevent);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnDragLeave(EventArgs e) {
- if (DragLeave!=null) DragLeave(this, e);
+ EventHandler eh = (EventHandler)(Events [DragLeaveEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnDragOver(DragEventArgs drgevent) {
- if (DragOver!=null) DragOver(this, drgevent);
+ DragEventHandler eh = (DragEventHandler)(Events [DragOverEvent]);
+ if (eh != null)
+ eh (this, drgevent);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
Refresh();
}
- if (EnabledChanged != null) {
- EnabledChanged(this, e);
- }
+ EventHandler eh = (EventHandler)(Events [EnabledChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) {
child_controls[i].OnParentEnabledChanged(e);
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnEnter(EventArgs e) {
- if (Enter!=null) Enter(this, e);
+ EventHandler eh = (EventHandler)(Events [EnterEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnFontChanged(EventArgs e) {
- if (FontChanged!=null) FontChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [FontChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentFontChanged(e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnForeColorChanged(EventArgs e) {
- if (ForeColorChanged!=null) ForeColorChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [ForeColorChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentForeColorChanged(e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnGiveFeedback(GiveFeedbackEventArgs gfbevent) {
- if (GiveFeedback!=null) GiveFeedback(this, gfbevent);
+ GiveFeedbackEventHandler eh = (GiveFeedbackEventHandler)(Events [GiveFeedbackEvent]);
+ if (eh != null)
+ eh (this, gfbevent);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnGotFocus(EventArgs e) {
- if (GotFocus!=null) GotFocus(this, e);
+ EventHandler eh = (EventHandler)(Events [GotFocusEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnHandleCreated(EventArgs e) {
- if (HandleCreated!=null) HandleCreated(this, e);
+ EventHandler eh = (EventHandler)(Events [HandleCreatedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnHandleDestroyed(EventArgs e) {
- if (HandleDestroyed!=null) HandleDestroyed(this, e);
+ EventHandler eh = (EventHandler)(Events [HandleDestroyedEvent]);
+ if (eh != null)
+ eh (this, e);
}
+ internal void RaiseHelpRequested (HelpEventArgs hevent)
+ {
+ OnHelpRequested (hevent);
+ }
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnHelpRequested(HelpEventArgs hevent) {
- if (HelpRequested!=null) HelpRequested(this, hevent);
+ HelpEventHandler eh = (HelpEventHandler)(Events [HelpRequestedEvent]);
+ if (eh != null)
+ eh (this, hevent);
}
protected virtual void OnImeModeChanged(EventArgs e) {
- if (ImeModeChanged!=null) ImeModeChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [ImeModeChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnInvalidated(InvalidateEventArgs e) {
- if (ThemeEngine.Current.DoubleBufferingSupported)
- if ((control_style & ControlStyles.DoubleBuffer) != 0) {
- // should this block be here? seems like it
- // would be more at home in
- // NotifyInvalidated..
- if (e.InvalidRect == ClientRectangle) {
- ImageBufferNeedsRedraw ();
- }
- else {
- // we need this Inflate call here so
- // that the border of the rectangle is
- // considered Visible (the
- // invalid_region.IsVisible call) in
- // the WM_PAINT handling below.
- Rectangle r = Rectangle.Inflate(e.InvalidRect, 1,1);
- if (invalid_region == null)
- invalid_region = new Region (r);
- else
- invalid_region.Union (r);
- }
+ if (UseDoubleBuffering) {
+ // should this block be here? seems like it
+ // would be more at home in
+ // NotifyInvalidated..
+ if (e.InvalidRect == ClientRectangle) {
+ InvalidateBackBuffer ();
+ } else if (backbuffer != null){
+ // we need this Inflate call here so
+ // that the border of the rectangle is
+ // considered Visible (the
+ // invalid_region.IsVisible call) in
+ // the WM_PAINT handling below.
+ Rectangle r = Rectangle.Inflate(e.InvalidRect, 1,1);
+ backbuffer.InvalidRegion.Union (r);
}
- if (Invalidated!=null) Invalidated(this, e);
+ }
+
+ InvalidateEventHandler eh = (InvalidateEventHandler)(Events [InvalidatedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnKeyDown(KeyEventArgs e) {
- if (KeyDown!=null) KeyDown(this, e);
+ protected virtual void OnKeyDown(KeyEventArgs e) {
+ KeyEventHandler eh = (KeyEventHandler)(Events [KeyDownEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnKeyPress(KeyPressEventArgs e) {
- if (KeyPress!=null) KeyPress(this, e);
+ KeyPressEventHandler eh = (KeyPressEventHandler)(Events [KeyPressEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnKeyUp(KeyEventArgs e) {
- if (KeyUp!=null) KeyUp(this, e);
+ KeyEventHandler eh = (KeyEventHandler)(Events [KeyUpEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnLayout(LayoutEventArgs levent) {
- if (Layout!=null) Layout(this, levent);
+ LayoutEventHandler eh = (LayoutEventHandler)(Events [LayoutEvent]);
+ if (eh != null)
+ eh (this, levent);
+
+ LayoutEngine.Layout (this, levent);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnLeave(EventArgs e) {
- if (Leave!=null) Leave(this, e);
+ EventHandler eh = (EventHandler)(Events [LeaveEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnLocationChanged(EventArgs e) {
OnMove(e);
- if (LocationChanged!=null) LocationChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [LocationChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnLostFocus(EventArgs e) {
- if (LostFocus!=null) LostFocus(this, e);
+ EventHandler eh = (EventHandler)(Events [LostFocusEvent]);
+ if (eh != null)
+ eh (this, e);
}
+#if NET_2_0
+ protected virtual void OnMarginChanged (EventArgs e)
+ {
+ EventHandler eh = (EventHandler)(Events[MarginChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseCaptureChanged (EventArgs e)
+ {
+ EventHandler eh = (EventHandler)(Events [MouseCaptureChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseClick (MouseEventArgs e)
+ {
+ MouseEventHandler eh = (MouseEventHandler)(Events [MouseClickEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseDoubleClick (MouseEventArgs e)
+ {
+ MouseEventHandler eh = (MouseEventHandler)(Events [MouseDoubleClickEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endif
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseDown(MouseEventArgs e) {
- if (MouseDown!=null) MouseDown(this, e);
+ MouseEventHandler eh = (MouseEventHandler)(Events [MouseDownEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseEnter(EventArgs e) {
- if (MouseEnter!=null) MouseEnter(this, e);
+ EventHandler eh = (EventHandler)(Events [MouseEnterEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseHover(EventArgs e) {
- if (MouseHover!=null) MouseHover(this, e);
+ EventHandler eh = (EventHandler)(Events [MouseHoverEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseLeave(EventArgs e) {
- if (MouseLeave!=null) MouseLeave(this, e);
+ EventHandler eh = (EventHandler)(Events [MouseLeaveEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseMove(MouseEventArgs e) {
- if (MouseMove!=null) MouseMove(this, e);
+ protected virtual void OnMouseMove(MouseEventArgs e) {
+ MouseEventHandler eh = (MouseEventHandler)(Events [MouseMoveEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseUp(MouseEventArgs e) {
- if (MouseUp!=null) MouseUp(this, e);
+ MouseEventHandler eh = (MouseEventHandler)(Events [MouseUpEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseWheel(MouseEventArgs e) {
- if (MouseWheel!=null) MouseWheel(this, e);
+ MouseEventHandler eh = (MouseEventHandler)(Events [MouseWheelEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMove(EventArgs e) {
- if (Move!=null) Move(this, e);
+ EventHandler eh = (EventHandler)(Events [MoveEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
// Override me!
}
+#if NET_2_0
+ protected virtual void OnPaddingChanged (EventArgs e) {
+ EventHandler eh = (EventHandler) (Events [PaddingChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endif
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnPaint(PaintEventArgs e) {
- if (Paint!=null) Paint(this, e);
+ PaintEventHandler eh = (PaintEventHandler)(Events [PaintEvent]);
+ if (eh != null)
+ eh (this, e);
}
internal virtual void OnPaintBackgroundInternal(PaintEventArgs e) {
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnParentChanged(EventArgs e) {
- if (ParentChanged!=null) ParentChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [ParentChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e) {
- if (QueryContinueDrag!=null) QueryContinueDrag(this, e);
+ QueryContinueDragEventHandler eh = (QueryContinueDragEventHandler)(Events [QueryContinueDragEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected virtual void OnRegionChanged (EventArgs e)
+ {
+ EventHandler eh = (EventHandler)(Events[RegionChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
+#endif
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnResize(EventArgs e) {
- if (Resize!=null) Resize(this, e);
-
- PerformLayout(this, "bounds");
+ PerformLayout(this, "Bounds");
- if (parent != null) {
- parent.PerformLayout();
- }
+ EventHandler eh = (EventHandler)(Events [ResizeEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnRightToLeftChanged(EventArgs e) {
- if (RightToLeftChanged!=null) RightToLeftChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [RightToLeftChangedEvent]);
+ if (eh != null)
+ eh (this, e);
for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentRightToLeftChanged(e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnSizeChanged(EventArgs e) {
- InvalidateBuffers ();
+ DisposeBackBuffer ();
OnResize(e);
- if (SizeChanged!=null) SizeChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [SizeChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnStyleChanged(EventArgs e) {
- if (StyleChanged!=null) StyleChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [StyleChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnSystemColorsChanged(EventArgs e) {
- if (SystemColorsChanged!=null) SystemColorsChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [SystemColorsChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnTabIndexChanged(EventArgs e) {
- if (TabIndexChanged!=null) TabIndexChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [TabIndexChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnTabStopChanged(EventArgs e) {
- if (TabStopChanged!=null) TabStopChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [TabStopChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnTextChanged(EventArgs e) {
- if (TextChanged!=null) TextChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [TextChangedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnValidated(EventArgs e) {
- if (Validated!=null) Validated(this, e);
+ EventHandler eh = (EventHandler)(Events [ValidatedEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnValidating(System.ComponentModel.CancelEventArgs e) {
- if (Validating!=null) Validating(this, e);
+ CancelEventHandler eh = (CancelEventHandler)(Events [ValidatingEvent]);
+ if (eh != null)
+ eh (this, e);
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
}
}
- if (VisibleChanged!=null) VisibleChanged(this, e);
+ EventHandler eh = (EventHandler)(Events [VisibleChangedEvent]);
+ if (eh != null)
+ eh (this, e);
// We need to tell our kids
for (int i=0; i<child_controls.Count; i++) {
#endregion // OnXXX methods
#region Events
- public event EventHandler BackColorChanged;
- public event EventHandler BackgroundImageChanged;
- public event EventHandler BindingContextChanged;
- public event EventHandler CausesValidationChanged;
- public event UICuesEventHandler ChangeUICues;
- public event EventHandler Click;
- public event EventHandler ContextMenuChanged;
+#if NET_2_0
+ static object AutoSizeChangedEvent = new object ();
+#endif
+ static object BackColorChangedEvent = new object ();
+ static object BackgroundImageChangedEvent = new object ();
+#if NET_2_0
+ static object BackgroundImageLayoutChangedEvent = new object ();
+#endif
+ static object BindingContextChangedEvent = new object ();
+ static object CausesValidationChangedEvent = new object ();
+ static object ChangeUICuesEvent = new object ();
+ static object ClickEvent = new object ();
+#if NET_2_0
+ static object ClientSizeChangedEvent = new object ();
+#endif
+ static object ContextMenuChangedEvent = new object ();
+#if NET_2_0
+ static object ContextMenuStripChangedEvent = new object ();
+#endif
+ static object ControlAddedEvent = new object ();
+ static object ControlRemovedEvent = new object ();
+ static object CursorChangedEvent = new object ();
+ static object DockChangedEvent = new object ();
+ static object DoubleClickEvent = new object ();
+ static object DragDropEvent = new object ();
+ static object DragEnterEvent = new object ();
+ static object DragLeaveEvent = new object ();
+ static object DragOverEvent = new object ();
+ static object EnabledChangedEvent = new object ();
+ static object EnterEvent = new object ();
+ static object FontChangedEvent = new object ();
+ static object ForeColorChangedEvent = new object ();
+ static object GiveFeedbackEvent = new object ();
+ static object GotFocusEvent = new object ();
+ static object HandleCreatedEvent = new object ();
+ static object HandleDestroyedEvent = new object ();
+ static object HelpRequestedEvent = new object ();
+ static object ImeModeChangedEvent = new object ();
+ static object InvalidatedEvent = new object ();
+ static object KeyDownEvent = new object ();
+ static object KeyPressEvent = new object ();
+ static object KeyUpEvent = new object ();
+ static object LayoutEvent = new object ();
+ static object LeaveEvent = new object ();
+ static object LocationChangedEvent = new object ();
+ static object LostFocusEvent = new object ();
+#if NET_2_0
+ static object MarginChangedEvent = new object ();
+ static object MouseCaptureChangedEvent = new object ();
+ static object MouseClickEvent = new object ();
+ static object MouseDoubleClickEvent = new object ();
+#endif
+ static object MouseDownEvent = new object ();
+ static object MouseEnterEvent = new object ();
+ static object MouseHoverEvent = new object ();
+ static object MouseLeaveEvent = new object ();
+ static object MouseMoveEvent = new object ();
+ static object MouseUpEvent = new object ();
+ static object MouseWheelEvent = new object ();
+ static object MoveEvent = new object ();
+#if NET_2_0
+ static object PaddingChangedEvent = new object ();
+#endif
+ static object PaintEvent = new object ();
+ static object ParentChangedEvent = new object ();
+#if NET_2_0
+ static object PreviewKeyDownEvent = new object ();
+#endif
+ static object QueryAccessibilityHelpEvent = new object ();
+ static object QueryContinueDragEvent = new object ();
+#if NET_2_0
+ static object RegionChangedEvent = new object ();
+#endif
+ static object ResizeEvent = new object ();
+ static object RightToLeftChangedEvent = new object ();
+ static object SizeChangedEvent = new object ();
+ static object StyleChangedEvent = new object ();
+ static object SystemColorsChangedEvent = new object ();
+ static object TabIndexChangedEvent = new object ();
+ static object TabStopChangedEvent = new object ();
+ static object TextChangedEvent = new object ();
+ static object ValidatedEvent = new object ();
+ static object ValidatingEvent = new object ();
+ static object VisibleChangedEvent = new object ();
+
+#if NET_2_0
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler AutoSizeChanged {
+ add { Events.AddHandler (AutoSizeChangedEvent, value);}
+ remove {Events.RemoveHandler (AutoSizeChangedEvent, value);}
+ }
+#endif
+ public event EventHandler BackColorChanged {
+ add { Events.AddHandler (BackColorChangedEvent, value); }
+ remove { Events.RemoveHandler (BackColorChangedEvent, value); }
+ }
+
+ public event EventHandler BackgroundImageChanged {
+ add { Events.AddHandler (BackgroundImageChangedEvent, value); }
+ remove { Events.RemoveHandler (BackgroundImageChangedEvent, value); }
+ }
+
+#if NET_2_0
+ public event EventHandler BackgroundImageLayoutChanged {
+ add {Events.AddHandler (BackgroundImageLayoutChangedEvent, value);}
+ remove {Events.RemoveHandler (BackgroundImageLayoutChangedEvent, value);}
+ }
+#endif
+
+ public event EventHandler BindingContextChanged {
+ add { Events.AddHandler (BindingContextChangedEvent, value); }
+ remove { Events.RemoveHandler (BindingContextChangedEvent, value); }
+ }
+
+ public event EventHandler CausesValidationChanged {
+ add { Events.AddHandler (CausesValidationChangedEvent, value); }
+ remove { Events.RemoveHandler (CausesValidationChangedEvent, value); }
+ }
+
+ public event UICuesEventHandler ChangeUICues {
+ add { Events.AddHandler (ChangeUICuesEvent, value); }
+ remove { Events.RemoveHandler (ChangeUICuesEvent, value); }
+ }
+
+ public event EventHandler Click {
+ add { Events.AddHandler (ClickEvent, value); }
+ remove { Events.RemoveHandler (ClickEvent, value); }
+ }
+
+#if NET_2_0
+ public event EventHandler ClientSizeChanged {
+ add {Events.AddHandler (ClientSizeChangedEvent, value);}
+ remove {Events.RemoveHandler (ClientSizeChangedEvent, value);}
+ }
+#endif
+
+#if NET_2_0
+ [Browsable (false)]
+#endif
+ public event EventHandler ContextMenuChanged {
+ add { Events.AddHandler (ContextMenuChangedEvent, value); }
+ remove { Events.RemoveHandler (ContextMenuChangedEvent, value); }
+ }
+
+#if NET_2_0
+ public event EventHandler ContextMenuStripChanged {
+ add { Events.AddHandler (ContextMenuStripChangedEvent, value); }
+ remove { Events.RemoveHandler (ContextMenuStripChangedEvent, value);}
+ }
+#endif
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
+#if NET_2_0
+ [Browsable(true)]
+#else
[Browsable(false)]
- public event ControlEventHandler ControlAdded;
+#endif
+ public event ControlEventHandler ControlAdded {
+ add { Events.AddHandler (ControlAddedEvent, value); }
+ remove { Events.RemoveHandler (ControlAddedEvent, value); }
+ }
[EditorBrowsable(EditorBrowsableState.Advanced)]
+#if NET_2_0
+ [Browsable(true)]
+#else
[Browsable(false)]
- public event ControlEventHandler ControlRemoved;
+#endif
+ public event ControlEventHandler ControlRemoved {
+ add { Events.AddHandler (ControlRemovedEvent, value); }
+ remove { Events.RemoveHandler (ControlRemovedEvent, value); }
+ }
[MWFDescription("Fired when the cursor for the control has been changed"), MWFCategory("PropertyChanged")]
- public event EventHandler CursorChanged;
- public event EventHandler DockChanged;
- public event EventHandler DoubleClick;
- public event DragEventHandler DragDrop;
- public event DragEventHandler DragEnter;
- public event EventHandler DragLeave;
- public event DragEventHandler DragOver;
- public event EventHandler EnabledChanged;
- public event EventHandler Enter;
- public event EventHandler FontChanged;
- public event EventHandler ForeColorChanged;
- public event GiveFeedbackEventHandler GiveFeedback;
+ public event EventHandler CursorChanged {
+ add { Events.AddHandler (CursorChangedEvent, value); }
+ remove { Events.RemoveHandler (CursorChangedEvent, value); }
+ }
+ public event EventHandler DockChanged {
+ add { Events.AddHandler (DockChangedEvent, value); }
+ remove { Events.RemoveHandler (DockChangedEvent, value); }
+ }
+
+ public event EventHandler DoubleClick {
+ add { Events.AddHandler (DoubleClickEvent, value); }
+ remove { Events.RemoveHandler (DoubleClickEvent, value); }
+ }
+
+ public event DragEventHandler DragDrop {
+ add { Events.AddHandler (DragDropEvent, value); }
+ remove { Events.RemoveHandler (DragDropEvent, value); }
+ }
+
+ public event DragEventHandler DragEnter {
+ add { Events.AddHandler (DragEnterEvent, value); }
+ remove { Events.RemoveHandler (DragEnterEvent, value); }
+ }
+
+ public event EventHandler DragLeave {
+ add { Events.AddHandler (DragLeaveEvent, value); }
+ remove { Events.RemoveHandler (DragLeaveEvent, value); }
+ }
+
+ public event DragEventHandler DragOver {
+ add { Events.AddHandler (DragOverEvent, value); }
+ remove { Events.RemoveHandler (DragOverEvent, value); }
+ }
+
+ public event EventHandler EnabledChanged {
+ add { Events.AddHandler (EnabledChangedEvent, value); }
+ remove { Events.RemoveHandler (EnabledChangedEvent, value); }
+ }
+
+ public event EventHandler Enter {
+ add { Events.AddHandler (EnterEvent, value); }
+ remove { Events.RemoveHandler (EnterEvent, value); }
+ }
+
+ public event EventHandler FontChanged {
+ add { Events.AddHandler (FontChangedEvent, value); }
+ remove { Events.RemoveHandler (FontChangedEvent, value); }
+ }
+
+ public event EventHandler ForeColorChanged {
+ add { Events.AddHandler (ForeColorChangedEvent, value); }
+ remove { Events.RemoveHandler (ForeColorChangedEvent, value); }
+ }
+
+ public event GiveFeedbackEventHandler GiveFeedback {
+ add { Events.AddHandler (GiveFeedbackEvent, value); }
+ remove { Events.RemoveHandler (GiveFeedbackEvent, value); }
+ }
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
- public event EventHandler GotFocus;
+ public event EventHandler GotFocus {
+ add { Events.AddHandler (GotFocusEvent, value); }
+ remove { Events.RemoveHandler (GotFocusEvent, value); }
+ }
+
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
- public event EventHandler HandleCreated;
+ public event EventHandler HandleCreated {
+ add { Events.AddHandler (HandleCreatedEvent, value); }
+ remove { Events.RemoveHandler (HandleCreatedEvent, value); }
+ }
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
- public event EventHandler HandleDestroyed;
+ public event EventHandler HandleDestroyed {
+ add { Events.AddHandler (HandleDestroyedEvent, value); }
+ remove { Events.RemoveHandler (HandleDestroyedEvent, value); }
+ }
- public event HelpEventHandler HelpRequested;
- public event EventHandler ImeModeChanged;
+ public event HelpEventHandler HelpRequested {
+ add { Events.AddHandler (HelpRequestedEvent, value); }
+ remove { Events.RemoveHandler (HelpRequestedEvent, value); }
+ }
+
+ public event EventHandler ImeModeChanged {
+ add { Events.AddHandler (ImeModeChangedEvent, value); }
+ remove { Events.RemoveHandler (ImeModeChangedEvent, value); }
+ }
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
- public event InvalidateEventHandler Invalidated;
+ public event InvalidateEventHandler Invalidated {
+ add { Events.AddHandler (InvalidatedEvent, value); }
+ remove { Events.RemoveHandler (InvalidatedEvent, value); }
+ }
+
+ public event KeyEventHandler KeyDown {
+ add { Events.AddHandler (KeyDownEvent, value); }
+ remove { Events.RemoveHandler (KeyDownEvent, value); }
+ }
- public event KeyEventHandler KeyDown;
- public event KeyPressEventHandler KeyPress;
- public event KeyEventHandler KeyUp;
- public event LayoutEventHandler Layout;
- public event EventHandler Leave;
- public event EventHandler LocationChanged;
+ public event KeyPressEventHandler KeyPress {
+ add { Events.AddHandler (KeyPressEvent, value); }
+ remove { Events.RemoveHandler (KeyPressEvent, value); }
+ }
+
+ public event KeyEventHandler KeyUp {
+ add { Events.AddHandler (KeyUpEvent, value); }
+ remove { Events.RemoveHandler (KeyUpEvent, value); }
+ }
+
+ public event LayoutEventHandler Layout {
+ add { Events.AddHandler (LayoutEvent, value); }
+ remove { Events.RemoveHandler (LayoutEvent, value); }
+ }
+
+ public event EventHandler Leave {
+ add { Events.AddHandler (LeaveEvent, value); }
+ remove { Events.RemoveHandler (LeaveEvent, value); }
+ }
+
+ public event EventHandler LocationChanged {
+ add { Events.AddHandler (LocationChangedEvent, value); }
+ remove { Events.RemoveHandler (LocationChangedEvent, value); }
+ }
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
- public event EventHandler LostFocus;
+ public event EventHandler LostFocus {
+ add { Events.AddHandler (LostFocusEvent, value); }
+ remove { Events.RemoveHandler (LostFocusEvent, value); }
+ }
+
+#if NET_2_0
+ public event EventHandler MarginChanged {
+ add { Events.AddHandler (MarginChangedEvent, value); }
+ remove {Events.RemoveHandler (MarginChangedEvent, value); }
+ }
+
+ public event EventHandler MouseCaptureChanged {
+ add { Events.AddHandler (MouseCaptureChangedEvent, value); }
+ remove { Events.RemoveHandler (MouseCaptureChangedEvent, value); }
+ }
+
+ public event MouseEventHandler MouseClick
+ {
+ add { Events.AddHandler (MouseClickEvent, value); }
+ remove { Events.RemoveHandler (MouseClickEvent, value); }
+ }
+ public event MouseEventHandler MouseDoubleClick
+ {
+ add { Events.AddHandler (MouseDoubleClickEvent, value); }
+ remove { Events.RemoveHandler (MouseDoubleClickEvent, value); }
+ }
+#endif
+ public event MouseEventHandler MouseDown {
+ add { Events.AddHandler (MouseDownEvent, value); }
+ remove { Events.RemoveHandler (MouseDownEvent, value); }
+ }
- public event MouseEventHandler MouseDown;
- public event EventHandler MouseEnter;
- public event EventHandler MouseHover;
- public event EventHandler MouseLeave;
- public event MouseEventHandler MouseMove;
- public event MouseEventHandler MouseUp;
+ public event EventHandler MouseEnter {
+ add { Events.AddHandler (MouseEnterEvent, value); }
+ remove { Events.RemoveHandler (MouseEnterEvent, value); }
+ }
+
+ public event EventHandler MouseHover {
+ add { Events.AddHandler (MouseHoverEvent, value); }
+ remove { Events.RemoveHandler (MouseHoverEvent, value); }
+ }
+
+ public event EventHandler MouseLeave {
+ add { Events.AddHandler (MouseLeaveEvent, value); }
+ remove { Events.RemoveHandler (MouseLeaveEvent, value); }
+ }
+
+ public event MouseEventHandler MouseMove {
+ add { Events.AddHandler (MouseMoveEvent, value); }
+ remove { Events.RemoveHandler (MouseMoveEvent, value); }
+ }
+
+ public event MouseEventHandler MouseUp {
+ add { Events.AddHandler (MouseUpEvent, value); }
+ remove { Events.RemoveHandler (MouseUpEvent, value); }
+ }
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
- public event MouseEventHandler MouseWheel;
-
- public event EventHandler Move;
- public event PaintEventHandler Paint;
- public event EventHandler ParentChanged;
- public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
- public event QueryContinueDragEventHandler QueryContinueDrag;
- public event EventHandler Resize;
- public event EventHandler RightToLeftChanged;
- public event EventHandler SizeChanged;
- public event EventHandler StyleChanged;
- public event EventHandler SystemColorsChanged;
- public event EventHandler TabIndexChanged;
- public event EventHandler TabStopChanged;
- public event EventHandler TextChanged;
- public event EventHandler Validated;
- public event CancelEventHandler Validating;
- public event EventHandler VisibleChanged;
+ public event MouseEventHandler MouseWheel {
+ add { Events.AddHandler (MouseWheelEvent, value); }
+ remove { Events.RemoveHandler (MouseWheelEvent, value); }
+ }
+
+ public event EventHandler Move {
+ add { Events.AddHandler (MoveEvent, value); }
+ remove { Events.RemoveHandler (MoveEvent, value); }
+ }
+#if NET_2_0
+ public event EventHandler PaddingChanged
+ {
+ add { Events.AddHandler (PaddingChangedEvent, value); }
+ remove { Events.RemoveHandler (PaddingChangedEvent, value); }
+ }
+#endif
+ public event PaintEventHandler Paint {
+ add { Events.AddHandler (PaintEvent, value); }
+ remove { Events.RemoveHandler (PaintEvent, value); }
+ }
+
+ public event EventHandler ParentChanged {
+ add { Events.AddHandler (ParentChangedEvent, value); }
+ remove { Events.RemoveHandler (ParentChangedEvent, value); }
+ }
+
+#if NET_2_0
+ public event PreviewKeyDownEventHandler PreviewKeyDown {
+ add { Events.AddHandler (PreviewKeyDownEvent, value); }
+ remove { Events.RemoveHandler (PreviewKeyDownEvent, value); }
+ }
+#endif
+
+ public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp {
+ add { Events.AddHandler (QueryAccessibilityHelpEvent, value); }
+ remove { Events.RemoveHandler (QueryAccessibilityHelpEvent, value); }
+ }
+
+ public event QueryContinueDragEventHandler QueryContinueDrag {
+ add { Events.AddHandler (QueryContinueDragEvent, value); }
+ remove { Events.RemoveHandler (QueryContinueDragEvent, value); }
+ }
+
+#if NET_2_0
+ public event EventHandler RegionChanged {
+ add { Events.AddHandler (RegionChangedEvent, value); }
+ remove { Events.RemoveHandler (RegionChangedEvent, value); }
+ }
+#endif
+
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+#endif
+ public event EventHandler Resize {
+ add { Events.AddHandler (ResizeEvent, value); }
+ remove { Events.RemoveHandler (ResizeEvent, value); }
+ }
+
+ public event EventHandler RightToLeftChanged {
+ add { Events.AddHandler (RightToLeftChangedEvent, value); }
+ remove { Events.RemoveHandler (RightToLeftChangedEvent, value); }
+ }
+
+ public event EventHandler SizeChanged {
+ add { Events.AddHandler (SizeChangedEvent, value); }
+ remove { Events.RemoveHandler (SizeChangedEvent, value); }
+ }
+
+ public event EventHandler StyleChanged {
+ add { Events.AddHandler (StyleChangedEvent, value); }
+ remove { Events.RemoveHandler (StyleChangedEvent, value); }
+ }
+
+ public event EventHandler SystemColorsChanged {
+ add { Events.AddHandler (SystemColorsChangedEvent, value); }
+ remove { Events.RemoveHandler (SystemColorsChangedEvent, value); }
+ }
+
+ public event EventHandler TabIndexChanged {
+ add { Events.AddHandler (TabIndexChangedEvent, value); }
+ remove { Events.RemoveHandler (TabIndexChangedEvent, value); }
+ }
+
+ public event EventHandler TabStopChanged {
+ add { Events.AddHandler (TabStopChangedEvent, value); }
+ remove { Events.RemoveHandler (TabStopChangedEvent, value); }
+ }
+
+ public event EventHandler TextChanged {
+ add { Events.AddHandler (TextChangedEvent, value); }
+ remove { Events.RemoveHandler (TextChangedEvent, value); }
+ }
+
+ public event EventHandler Validated {
+ add { Events.AddHandler (ValidatedEvent, value); }
+ remove { Events.RemoveHandler (ValidatedEvent, value); }
+ }
+
+ public event CancelEventHandler Validating {
+ add { Events.AddHandler (ValidatingEvent, value); }
+ remove { Events.RemoveHandler (ValidatingEvent, value); }
+ }
+
+ public event EventHandler VisibleChanged {
+ add { Events.AddHandler (VisibleChangedEvent, value); }
+ remove { Events.RemoveHandler (VisibleChangedEvent, value); }
+ }
+
#endregion // Events
}
}