提交 e4f22a9c 编写于 作者: M Miguel de Icaza

Pass 1 of removing NET_2_0 from winforms

上级 1146f40c
......@@ -34,11 +34,7 @@ using System.Runtime.InteropServices;
namespace System.Windows.Forms {
[ComVisible(true)]
#if NET_2_0
public class AccessibleObject : StandardOleMarshalObject, IReflect, IAccessible {
#else
public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
#endif
#region Private Variables
internal string name;
internal string value;
......
......@@ -91,11 +91,8 @@ namespace System.Windows.Forms {
PageTabList = 60,
Clock = 61,
Default = -1,
#if NET_2_0
SplitButton = 62,
IpAddress = 63,
OutlineButton = 64
#endif
}
}
......@@ -62,12 +62,8 @@ namespace System.Windows.Forms {
AlertMedium = 0x08000000,
AlertHigh = 0x10000000,
Protected = 0x20000000,
#if NET_2_0
[Obsolete]
#endif
Valid = 0x3FFFFFFF,
#if NET_2_0
HasPopup = 0x40000000
#endif
}
}
......@@ -30,9 +30,6 @@ using System.ComponentModel;
namespace System.Windows.Forms {
[Flags]
#if !NET_2_0
[Serializable]
#endif
[Editor("System.Windows.Forms.Design.AnchorEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
public enum AnchorStyles {
None = 0x00000000,
......
......@@ -39,9 +39,7 @@ using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
#if NET_2_0
using System.Text;
#endif
using System.Windows.Forms.VisualStyles;
namespace System.Windows.Forms
......@@ -148,10 +146,8 @@ namespace System.Windows.Forms
private static readonly ArrayList message_filters = new ArrayList();
private static readonly FormCollection forms = new FormCollection ();
#if NET_2_0
private static bool use_wait_cursor;
private static ToolStrip keyboard_capture;
#endif
private static VisualStyleState visual_style_state = VisualStyleState.ClientAndNonClientAreasEnabled;
static bool visual_styles_enabled;
......@@ -160,19 +156,15 @@ namespace System.Windows.Forms
browser_embedded = false;
}
#if NET_2_0
static Application ()
{
// Attempt to load UIA support for winforms
// UIA support requires .NET 2.0
InitializeUIAutomation ();
}
#endif
#region Private Methods
#if NET_2_0
private static void InitializeUIAutomation ()
{
// Initialize the UIAutomationWinforms Global class,
......@@ -210,7 +202,6 @@ namespace System.Windows.Forms
Console.Error.WriteLine ("Error setting up UIA: " + ex);
}
}
#endif
internal static void CloseForms (Thread thread)
{
......@@ -434,7 +425,6 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
public static bool UseWaitCursor {
get {
return use_wait_cursor;
......@@ -448,14 +438,8 @@ namespace System.Windows.Forms
}
}
}
#endif
#if NET_2_0
public
#else
internal
#endif
static bool RenderWithVisualStyles {
public static bool RenderWithVisualStyles {
get {
if (VisualStyleInformation.IsSupportedByOS) {
if (!VisualStyleInformation.IsEnabledByUser)
......@@ -471,12 +455,7 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
public
#else
internal
#endif
static VisualStyleState VisualStyleState {
public static VisualStyleState VisualStyleState {
get { return Application.visual_style_state; }
set { Application.visual_style_state = value; }
}
......@@ -508,13 +487,8 @@ namespace System.Windows.Forms
XplatUI.EnableThemes ();
}
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
public
#else
internal
#endif
static bool FilterMessage (ref Message message)
public static bool FilterMessage (ref Message message)
{
lock (message_filters) {
for (int i = 0; i < message_filters.Count; i++) {
......@@ -526,7 +500,6 @@ namespace System.Windows.Forms
return false;
}
#if NET_2_0
//
// If true, it uses GDI+, performance reasons were quoted
//
......@@ -641,19 +614,12 @@ namespace System.Windows.Forms
Application.Exit ();
Process.Start (procInfo);
}
#endif
public static void Exit ()
{
#if NET_2_0
Exit (new CancelEventArgs ());
#else
XplatUI.PostQuitMessage (0);
CloseForms (null);
#endif
}
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static void Exit (CancelEventArgs e)
{
......@@ -677,7 +643,6 @@ namespace System.Windows.Forms
XplatUI.PostQuitMessage (0);
}
#endif
public static void ExitThread()
{
......@@ -742,31 +707,25 @@ namespace System.Windows.Forms
Run (new ApplicationContext (mainForm));
}
#if NET_2_0
internal static void FirePreRun ()
{
EventHandler handler = PreRun;
if (handler != null)
handler (null, EventArgs.Empty);
}
#endif
public static void Run (ApplicationContext context)
{
#if NET_2_0
// If a sync context hasn't been created by now, create
// a default one
if (SynchronizationContext.Current == null)
SynchronizationContext.SetSynchronizationContext (new SynchronizationContext ());
#endif
RunLoop (false, context);
#if NET_2_0
// Reset the sync context back to the default
if (SynchronizationContext.Current is WindowsFormsSynchronizationContext)
WindowsFormsSynchronizationContext.Uninstall ();
#endif
}
private static void DisableFormsForModalLoop (Queue toplevels, ApplicationContext context)
......@@ -906,7 +865,6 @@ namespace System.Windows.Forms
Control c;
c = Control.FromHandle(msg.hwnd);
#if NET_2_0
// If we have a control with keyboard capture (usually a *Strip)
// give it the message, and then drop the message
if (keyboard_capture != null) {
......@@ -935,14 +893,13 @@ namespace System.Windows.Forms
break;
}
}
#endif
if (((c != null) && c.PreProcessControlMessageInternal (ref m) != PreProcessControlState.MessageProcessed) ||
(c == null)) {
goto default;
}
break;
#if NET_2_0
case Msg.WM_LBUTTONDOWN:
case Msg.WM_MBUTTONDOWN:
case Msg.WM_RBUTTONDOWN:
......@@ -975,7 +932,7 @@ namespace System.Windows.Forms
}
goto default;
#endif
case Msg.WM_QUIT:
quit = true; // make sure we exit
break;
......@@ -1055,7 +1012,6 @@ namespace System.Windows.Forms
public static event EventHandler ThreadExit;
public static event ThreadExceptionEventHandler ThreadException;
#if NET_2_0
// These are used externally by the UIA framework
internal static event EventHandler FormAdded;
internal static event EventHandler PreRun;
......@@ -1065,26 +1021,21 @@ namespace System.Windows.Forms
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static event EventHandler LeaveThreadModal;
#endif
#endregion // Events
#region Public Delegates
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
public delegate bool MessageLoopCallback ();
#endif
#endregion
#region Internal Properties
#if NET_2_0
internal static ToolStrip KeyboardCapture {
get { return keyboard_capture; }
set { keyboard_capture = value; }
}
#endif
internal static bool VisualStylesEnabled {
get { return visual_styles_enabled; }
......@@ -1097,7 +1048,6 @@ namespace System.Windows.Forms
{
lock (forms)
forms.Add (f);
#if NET_2_0
// Signal that a Form has been added to this
// Application. Used by UIA to detect new Forms that
// need a11y support. This event may be fired even if
......@@ -1105,7 +1055,6 @@ namespace System.Windows.Forms
// account for that when handling this signal.
if (FormAdded != null)
FormAdded (f, null);
#endif
}
internal static void RemoveForm (Form f)
......@@ -1114,7 +1063,6 @@ namespace System.Windows.Forms
forms.Remove (f);
}
#if NET_2_0
private static bool ControlOnToolStrip (Control c)
{
Control p = c.Parent;
......@@ -1128,7 +1076,6 @@ namespace System.Windows.Forms
return false;
}
#endif
// Takes a starting path, appends company name, product name, and
// product version. If the directory doesn't exist, create it
......
......@@ -26,16 +26,11 @@
using System.ComponentModel;
namespace System.Windows.Forms {
public class ApplicationContext
#if NET_2_0
: IDisposable
#endif
public class ApplicationContext : IDisposable
{
#region Local Variables
Form main_form;
#if NET_2_0
object tag;
#endif
bool thread_exit_raised;
#endregion // Local Variables
......@@ -74,7 +69,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[BindableAttribute (true)]
[DefaultValue (null)]
[LocalizableAttribute (false)]
......@@ -83,7 +77,6 @@ namespace System.Windows.Forms {
get { return tag; }
set { tag = value; }
}
#endif
#endregion // Public Instance Properties
#region Public Instance Methods
......@@ -100,9 +93,7 @@ namespace System.Windows.Forms {
#region Protected Instance Methods
protected virtual void Dispose(bool disposing) {
MainForm = null;
#if NET_2_0
tag = null;
#endif
}
protected virtual void ExitThreadCore() {
......
......@@ -29,9 +29,7 @@
using System.Runtime.InteropServices;
namespace System.Windows.Forms {
#if NET_2_0
[Flags]
#endif
[ComVisible(true)]
public enum ArrangeDirection {
Left = 0,
......
......@@ -27,9 +27,7 @@
// COMPLETE
namespace System.Windows.Forms {
#if NET_2_0
[Flags]
#endif
public enum ArrangeStartingPosition {
BottomLeft = 0,
BottomRight = 1,
......
......@@ -34,11 +34,7 @@ namespace System.Windows.Forms {
public Delegate Method;
public object [] Args;
public AsyncMethodResult Result;
#if NET_2_0
public ExecutionContext Context;
#else
public CompressedStack Stack;
#endif
}
}
......@@ -26,8 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public enum AutoCompleteMode
......@@ -38,4 +36,3 @@ namespace System.Windows.Forms
SuggestAppend = 3
}
}
#endif
\ No newline at end of file
......@@ -27,7 +27,6 @@
//
#if NET_2_0
namespace System.Windows.Forms
{
public enum AutoCompleteSource
......@@ -43,4 +42,3 @@ namespace System.Windows.Forms
ListItems = 256
}
}
#endif
\ No newline at end of file
......@@ -25,7 +25,6 @@
// Author:
// Daniel Nauck (dna(at)mono-project(dot)de)
#if NET_2_0
using System;
using System.Collections;
......@@ -202,4 +201,3 @@ namespace System.Windows.Forms
#endregion
}
}
#endif
\ No newline at end of file
......@@ -24,9 +24,6 @@
//
//
// COMPLETE
#if NET_2_0
namespace System.Windows.Forms {
public enum AutoScaleMode {
None = 0,
......@@ -35,4 +32,3 @@ namespace System.Windows.Forms {
Inherit = 3
}
}
#endif
......@@ -27,7 +27,6 @@
//
#if NET_2_0
namespace System.Windows.Forms
{
public enum AutoSizeMode
......@@ -36,4 +35,3 @@ namespace System.Windows.Forms
GrowOnly = 1
}
}
#endif
\ No newline at end of file
......@@ -27,7 +27,6 @@
//
#if NET_2_0
namespace System.Windows.Forms
{
public enum AutoValidate
......@@ -38,4 +37,3 @@ namespace System.Windows.Forms
EnableAllowFocusChange = 2
}
}
#endif
\ No newline at end of file
......@@ -37,10 +37,8 @@ namespace System.Windows.Forms {
[Designer("System.Windows.Forms.Design.AxHostDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
[DesignTimeVisible(false)]
[ToolboxItem(false)]
#if NET_2_0
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible (true)]
#endif
public abstract class AxHost : Control, ISupportInitialize, ICustomTypeDescriptor {
#region AxHost Subclasses
#region AxHost.ActiveXInvokeKind Enum
......@@ -52,9 +50,7 @@ namespace System.Windows.Forms {
#endregion // AxHost.ActiveXInvokeKind Enum
#region AxHost.AxComponentEditor Class
#if NET_2_0
[ComVisible (false)]
#endif
public class AxComponentEditor : System.Windows.Forms.Design.WindowsFormsComponentEditor {
public AxComponentEditor ()
{
......@@ -85,9 +81,6 @@ namespace System.Windows.Forms {
#endregion AxHost.ClsidAttribute
#region AxHost.ConnectionPointCookie
#if !NET_2_0
[ComVisible(false)]
#endif
public class ConnectionPointCookie {
public ConnectionPointCookie (object source, object sink, Type eventInterface)
{
......@@ -108,12 +101,10 @@ namespace System.Windows.Forms {
#region AxHost.InvalidActiveXStateException Class
public class InvalidActiveXStateException : Exception {
#if NET_2_0
public InvalidActiveXStateException ()
{
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
#endif
public InvalidActiveXStateException (string name, ActiveXInvokeKind kind)
{
......@@ -136,12 +127,7 @@ namespace System.Windows.Forms {
//throw new NotImplementedException("COM/ActiveX support is not implemented");
}
#if NET_2_0
protected
#else
private
#endif
State (SerializationInfo info, StreamingContext context)
protected State (SerializationInfo info, StreamingContext context)
{
}
......@@ -224,9 +210,7 @@ namespace System.Windows.Forms {
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
#if NET_2_0
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
#endif
public override Image BackgroundImage {
get {
throw new NotImplementedException("COM/ActiveX support is not implemented");
......@@ -237,7 +221,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
......@@ -250,13 +233,10 @@ namespace System.Windows.Forms {
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
}
#endif
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Advanced)]
#if NET_2_0
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
#endif
public ContainerControl ContainingControl {
get {
throw new NotImplementedException("COM/ActiveX support is not implemented");
......@@ -345,7 +325,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[EditorBrowsable (EditorBrowsableState.Never)]
......@@ -357,7 +336,6 @@ namespace System.Windows.Forms {
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
}
#endif
[Browsable (false)]
[DefaultValue (null)]
......@@ -569,12 +547,10 @@ namespace System.Windows.Forms {
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
#if NET_2_0
protected virtual object CreateInstanceCore (Guid clsid)
{
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
#endif
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected virtual void CreateSink ()
......@@ -598,7 +574,6 @@ namespace System.Windows.Forms {
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Never)]
public new void DrawToBitmap (Bitmap bitmap, Rectangle targetBounds)
{
......@@ -610,7 +585,6 @@ namespace System.Windows.Forms {
{
throw new NotImplementedException("COM/ActiveX support is not implemented");
}
#endif
protected override bool IsInputChar (char charCode)
{
......@@ -978,7 +952,6 @@ namespace System.Windows.Forms {
remove { base.StyleChanged -= value; }
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler BackgroundImageLayoutChanged {
......@@ -1002,21 +975,6 @@ namespace System.Windows.Forms {
add { Events.AddHandler (MouseDoubleClickEvent, value); }
remove { Events.RemoveHandler (MouseDoubleClickEvent, value); }
}
#else
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler TabIndexChanged {
add { base.TabIndexChanged += value; }
remove { base.TabIndexChanged -= value; }
}
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler TabStopChanged {
add { base.TabStopChanged += value; }
remove { base.TabStopChanged -= value; }
}
#endif
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
......@@ -1027,9 +985,6 @@ namespace System.Windows.Forms {
#endregion // Events
#region Delegates
#if ONLY_1_1
[Serializable]
#endif
protected delegate void AboutBoxDelegate ();
#endregion // Delegates
......
......@@ -27,7 +27,6 @@
//
#if NET_2_0
namespace System.Windows.Forms
{
[Flags]
......@@ -41,4 +40,3 @@ namespace System.Windows.Forms
Unknown = 255
}
}
#endif
\ No newline at end of file
......@@ -40,11 +40,7 @@ namespace System.Windows.Forms {
private bool checked_isnull;
private BindingMemberInfo binding_member_info;
#if NET_2_0
private IBindableComponent control;
#else
private Control control;
#endif
private BindingManagerBase manager;
private PropertyDescriptor control_property;
......@@ -53,7 +49,6 @@ namespace System.Windows.Forms {
private object data;
private Type data_type;
#if NET_2_0
private DataSourceUpdateMode datasource_update_mode;
private ControlUpdateMode control_update_mode;
private object datasource_null_value = Convert.DBNull;
......@@ -61,9 +56,7 @@ namespace System.Windows.Forms {
private IFormatProvider format_info;
private string format_string;
private bool formatting_enabled;
#endif
#region Public Constructors
#if NET_2_0
public Binding (string propertyName, object dataSource, string dataMember)
: this (propertyName, dataSource, dataMember, false, DataSourceUpdateMode.OnValidation, null, string.Empty, null)
{
......@@ -100,26 +93,16 @@ namespace System.Windows.Forms {
format_string = formatString;
format_info = formatInfo;
}
#else
public Binding (string propertyName, object dataSource, string dataMember)
{
property_name = propertyName;
data_source = dataSource;
data_member = dataMember;
binding_member_info = new BindingMemberInfo (dataMember);
}
#endif
#endregion // Public Constructors
#region Public Instance Properties
#if NET_2_0
[DefaultValue (null)]
public IBindableComponent BindableComponent {
get {
return control;
}
}
#endif
public BindingManagerBase BindingManagerBase {
get {
return manager;
......@@ -135,15 +118,10 @@ namespace System.Windows.Forms {
[DefaultValue (null)]
public Control Control {
get {
#if NET_2_0
return control as Control;
#else
return control;
#endif
}
}
#if NET_2_0
[DefaultValue (ControlUpdateMode.OnPropertyChanged)]
public ControlUpdateMode ControlUpdateMode {
get {
......@@ -153,7 +131,6 @@ namespace System.Windows.Forms {
control_update_mode = value;
}
}
#endif
public object DataSource {
get {
......@@ -161,7 +138,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[DefaultValue (DataSourceUpdateMode.OnValidation)]
public DataSourceUpdateMode DataSourceUpdateMode {
get {
......@@ -225,7 +201,6 @@ namespace System.Windows.Forms {
PushData ();
}
}
#endif
public bool IsBinding {
get {
......@@ -236,7 +211,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
public object NullValue {
get {
return null_value;
......@@ -250,7 +224,6 @@ namespace System.Windows.Forms {
PushData ();
}
}
#endif
[DefaultValue ("")]
public string PropertyName {
......@@ -260,7 +233,6 @@ namespace System.Windows.Forms {
}
#endregion // Public Instance Properties
#if NET_2_0
public void ReadValue ()
{
PushData (true);
......@@ -270,16 +242,13 @@ namespace System.Windows.Forms {
{
PullData (true);
}
#endif
#region Protected Instance Methods
#if NET_2_0
protected virtual void OnBindingComplete (BindingCompleteEventArgs e)
{
if (BindingComplete != null)
BindingComplete (this, e);
}
#endif
protected virtual void OnFormat (ConvertEventArgs cevent)
{
......@@ -298,11 +267,7 @@ namespace System.Windows.Forms {
get { return data_member; }
}
#if NET_2_0
internal void SetControl (IBindableComponent control)
#else
internal void SetControl (Control control)
#endif
{
if (control == this.control)
return;
......@@ -323,11 +288,9 @@ namespace System.Windows.Forms {
ctrl.HandleCreated += new EventHandler (ControlCreatedHandler);
}
#if NET_2_0
EventDescriptor prop_changed_event = GetPropertyChangedEvent (control, property_name);
if (prop_changed_event != null)
prop_changed_event.AddEventHandler (control, new EventHandler (ControlPropertyChangedHandler));
#endif
this.control = control;
UpdateIsBinding ();
}
......@@ -377,33 +340,25 @@ namespace System.Windows.Forms {
{
if (IsBinding == false || manager.Current == null)
return true;
#if NET_2_0
if (!force && datasource_update_mode == DataSourceUpdateMode.Never)
return true;
#endif
data = control_property.GetValue (control);
#if NET_2_0
if (data == null)
data = datasource_null_value;
#endif
try {
SetPropertyValue (data);
} catch (Exception e) {
#if NET_2_0
if (formatting_enabled) {
FireBindingComplete (BindingCompleteContext.DataSourceUpdate, e, e.Message);
return false;
}
#endif
throw e;
}
#if NET_2_0
if (formatting_enabled)
FireBindingComplete (BindingCompleteContext.DataSourceUpdate, null, null);
#endif
return true;
}
......@@ -416,10 +371,8 @@ namespace System.Windows.Forms {
{
if (manager == null || manager.IsSuspended || manager.Count == 0 || manager.Position == -1)
return;
#if NET_2_0
if (!force && control_update_mode == ControlUpdateMode.Never)
return;
#endif
if (is_null_desc != null) {
bool is_null = (bool) is_null_desc.GetValue (manager.Current);
......@@ -436,38 +389,28 @@ namespace System.Windows.Forms {
data = pd.GetValue (manager.Current);
}
#if NET_2_0
if ((data == null || data == DBNull.Value) && null_value != null)
data = null_value;
#endif
try {
data = FormatData (data);
SetControlValue (data);
} catch (Exception e) {
#if NET_2_0
if (formatting_enabled) {
FireBindingComplete (BindingCompleteContext.ControlUpdate, e, e.Message);
return;
}
#endif
throw e;
}
#if NET_2_0
if (formatting_enabled)
FireBindingComplete (BindingCompleteContext.ControlUpdate, null, null);
#endif
}
internal void UpdateIsBinding ()
{
is_binding = false;
#if NET_2_0
if (control == null || (control is Control && !((Control)control).IsHandleCreated))
#else
if (control == null && !control.IsHandleCreated)
#endif
return;
is_binding = true;
......@@ -490,10 +433,8 @@ namespace System.Windows.Forms {
private void ControlValidatingHandler (object sender, CancelEventArgs e)
{
#if NET_2_0
if (datasource_update_mode != DataSourceUpdateMode.OnValidation)
return;
#endif
bool ok = true;
// If the data doesn't seem to be valid (it can't be converted,
......@@ -543,7 +484,6 @@ namespace System.Windows.Forms {
PushData ();
}
#if NET_2_0
void ControlPropertyChangedHandler (object o, EventArgs args)
{
if (datasource_update_mode != DataSourceUpdateMode.OnPropertyChanged)
......@@ -551,7 +491,6 @@ namespace System.Windows.Forms {
PullData ();
}
#endif
private object ParseData (object data, Type data_type)
{
......@@ -562,13 +501,11 @@ namespace System.Windows.Forms {
return e.Value;
if (e.Value == Convert.DBNull)
return e.Value;
#if NET_2_0
if (e.Value == null) {
bool nullable = data_type.IsGenericType && !data_type.ContainsGenericParameters &&
data_type.GetGenericTypeDefinition () == typeof (Nullable<>);
return data_type.IsValueType && !nullable ? Convert.DBNull : null;
}
#endif
return ConvertData (e.Value, data_type);
}
......@@ -581,7 +518,6 @@ namespace System.Windows.Forms {
if (data_type.IsInstanceOfType (e.Value))
return e.Value;
#if NET_2_0
if (formatting_enabled) {
if ((e.Value == null || e.Value == Convert.DBNull) && null_value != null)
return null_value;
......@@ -591,7 +527,7 @@ namespace System.Windows.Forms {
return formattable.ToString (format_string, format_info);
}
}
#endif
if (e.Value == null && data_type == typeof (object))
return Convert.DBNull;
......@@ -619,7 +555,6 @@ namespace System.Windows.Forms {
return null;
}
#if NET_2_0
void FireBindingComplete (BindingCompleteContext context, Exception exc, string error_message)
{
BindingCompleteEventArgs args = new BindingCompleteEventArgs (this,
......@@ -632,14 +567,11 @@ namespace System.Windows.Forms {
OnBindingComplete (args);
}
#endif
#region Events
public event ConvertEventHandler Format;
public event ConvertEventHandler Parse;
#if NET_2_0
public event BindingCompleteEventHandler BindingComplete;
#endif
#endregion // Events
}
}
......@@ -27,7 +27,6 @@
//
#if NET_2_0
namespace System.Windows.Forms
{
public enum BindingCompleteContext
......@@ -36,4 +35,3 @@ namespace System.Windows.Forms
DataSourceUpdate = 1
}
}
#endif
\ No newline at end of file
......@@ -26,8 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
using System.ComponentModel;
namespace System.Windows.Forms
......@@ -100,4 +98,3 @@ namespace System.Windows.Forms
}
}
}
#endif
......@@ -26,9 +26,7 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public delegate void BindingCompleteEventHandler(object sender, BindingCompleteEventArgs e);
}
#endif
\ No newline at end of file
......@@ -83,7 +83,6 @@ namespace System.Windows.Forms {
if (dataMember == null)
dataMember = String.Empty;
#if NET_2_0
ICurrencyManagerProvider cm_provider = dataSource as ICurrencyManagerProvider;
if (cm_provider != null) {
if (dataMember.Length == 0)
......@@ -91,7 +90,6 @@ namespace System.Windows.Forms {
return cm_provider.GetRelatedCurrencyManager (dataMember);
}
#endif
HashKey key = new HashKey (dataSource, dataMember);
BindingManagerBase res = managers [key] as BindingManagerBase;
......
......@@ -46,9 +46,7 @@ namespace System.Windows.Forms
#region Protected Instance Fields
protected EventHandler onCurrentChangedHandler;
protected EventHandler onPositionChangedHandler;
#if NET_2_0
internal EventHandler onCurrentItemChangedHandler;
#endif
#endregion // Protected Instance Fields
#region Public Instance Properties
......@@ -69,13 +67,11 @@ namespace System.Windows.Forms
get;
}
#if NET_2_0
public bool IsBindingSuspended {
get {
return IsSuspended;
}
}
#endif
public abstract int Position {
get; set;
......@@ -89,7 +85,6 @@ namespace System.Windows.Forms
public abstract void EndCurrentEdit();
#if NET_2_0
public virtual PropertyDescriptorCollection GetItemProperties()
{
return GetItemPropertiesInternal ();
......@@ -99,9 +94,6 @@ namespace System.Windows.Forms
{
throw new NotImplementedException ();
}
#else
public abstract PropertyDescriptorCollection GetItemProperties();
#endif
public abstract void RemoveAt(int index);
......@@ -164,7 +156,6 @@ namespace System.Windows.Forms
}
#if NET_2_0
protected void OnBindingComplete (BindingCompleteEventArgs args)
{
if (BindingComplete != null)
......@@ -178,7 +169,6 @@ namespace System.Windows.Forms
if (DataError != null)
DataError (this, new BindingManagerDataErrorEventArgs (e));
}
#endif
protected abstract void UpdateIsBinding();
#endregion // Protected Instance Methods
......@@ -201,7 +191,6 @@ namespace System.Windows.Forms
remove { onPositionChangedHandler -= value; }
}
#if NET_2_0
public event EventHandler CurrentItemChanged {
add { onCurrentItemChangedHandler += value; }
remove { onCurrentItemChangedHandler -= value; }
......@@ -209,7 +198,6 @@ namespace System.Windows.Forms
public event BindingCompleteEventHandler BindingComplete;
public event BindingManagerDataErrorEventHandler DataError;
#endif
#endregion // Events
}
}
......@@ -26,7 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public class BindingManagerDataErrorEventArgs : EventArgs
......@@ -48,4 +47,3 @@ namespace System.Windows.Forms
#endregion // Public Instance Properties
}
}
#endif
\ No newline at end of file
......@@ -26,9 +26,7 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public delegate void BindingManagerDataErrorEventHandler(object sender, BindingManagerDataErrorEventArgs e);
}
#endif
\ No newline at end of file
......@@ -91,7 +91,6 @@ namespace System.Windows.Forms {
#endregion // Public Instance Methods
#region Public Static Methods
#if NET_2_0
public static bool operator == (BindingMemberInfo a, BindingMemberInfo b)
{
return (a.Equals (b));
......@@ -101,7 +100,6 @@ namespace System.Windows.Forms {
{
return !(a.Equals (b));
}
#endif
#endregion // Public Static Methods
}
......
......@@ -24,8 +24,6 @@
// Alan McGovern alan.mcgovern@gmail.com
//
#if NET_2_0
using System;
using System.Collections.Generic;
using System.Text;
......@@ -488,5 +486,3 @@ namespace System.Windows.Forms
#endregion
}
}
#endif
......@@ -20,8 +20,6 @@
// Copyright (c) 2007 Novell, Inc.
//
#if NET_2_0
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
......@@ -1071,5 +1069,3 @@ namespace System.Windows.Forms {
}
}
}
#endif
......@@ -70,9 +70,7 @@ namespace System.Windows.Forms {
protected virtual void AddCore (Binding dataBinding)
{
CollectionChangeEventArgs args = new CollectionChangeEventArgs (CollectionChangeAction.Add, dataBinding);
#if NET_2_0
OnCollectionChanging (args);
#endif
base.List.Add(dataBinding);
OnCollectionChanged (args);
}
......@@ -84,9 +82,7 @@ namespace System.Windows.Forms {
protected virtual void ClearCore()
{
CollectionChangeEventArgs args = new CollectionChangeEventArgs(CollectionChangeAction.Refresh, null);
#if NET_2_0
OnCollectionChanging (args);
#endif
base.List.Clear();
OnCollectionChanged (args);
}
......@@ -95,13 +91,11 @@ namespace System.Windows.Forms {
if (CollectionChanged!=null) CollectionChanged(this, ccevent);
}
#if NET_2_0
protected virtual void OnCollectionChanging (CollectionChangeEventArgs e)
{
if (CollectionChanging != null)
CollectionChanging (this, e);
}
#endif
protected internal void Remove(Binding binding) {
RemoveCore(binding);
......@@ -115,9 +109,7 @@ namespace System.Windows.Forms {
protected virtual void RemoveCore(Binding dataBinding)
{
CollectionChangeEventArgs args = new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataBinding);
#if NET_2_0
OnCollectionChanging (args);
#endif
base.List.Remove(dataBinding);
OnCollectionChanged (args);
}
......@@ -138,9 +130,7 @@ namespace System.Windows.Forms {
#region Events
public event CollectionChangeEventHandler CollectionChanged;
#if NET_2_0
public event CollectionChangeEventHandler CollectionChanging;
#endif
#endregion // Events
}
}
......@@ -30,12 +30,10 @@ using System.Drawing.Text;
using System.Runtime.InteropServices;
namespace System.Windows.Forms {
#if NET_2_0
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible (true)]
[Designer ("System.Windows.Forms.Design.ButtonBaseDesigner, " + Consts.AssemblySystem_Design,
"System.ComponentModel.Design.IDesigner")]
#endif
public class Button : ButtonBase, IButtonControl {
#region Local variables
DialogResult dialog_result;
......@@ -50,7 +48,6 @@ namespace System.Windows.Forms {
#endregion // Public Constructors
#region Public Properties
#if NET_2_0
[Browsable (true)]
[Localizable (true)]
[DefaultValue (AutoSizeMode.GrowOnly)]
......@@ -59,7 +56,6 @@ namespace System.Windows.Forms {
get { return base.GetAutoSizeMode (); }
set { base.SetAutoSizeMode (value); }
}
#endif
[DefaultValue (DialogResult.None)]
[MWFCategory("Behavior")]
......@@ -106,7 +102,6 @@ namespace System.Windows.Forms {
base.OnClick (e);
}
#if NET_2_0
protected override void OnFontChanged (EventArgs e)
{
base.OnFontChanged (e);
......@@ -121,19 +116,16 @@ namespace System.Windows.Forms {
{
base.OnMouseLeave (e);
}
#endif
protected override void OnMouseUp (MouseEventArgs mevent)
{
base.OnMouseUp (mevent);
}
#if NET_2_0
protected override void OnTextChanged (EventArgs e)
{
base.OnTextChanged (e);
}
#endif
protected override bool ProcessMnemonic (char charCode)
{
......@@ -159,18 +151,15 @@ namespace System.Windows.Forms {
remove { base.DoubleClick -= value; }
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public new event MouseEventHandler MouseDoubleClick {
add { base.MouseDoubleClick += value; }
remove { base.MouseDoubleClick -= value; }
}
#endif
#endregion // Events
#region Internal methods
#if NET_2_0
internal override void Draw (PaintEventArgs pevent)
{
// System style does not use any of the new 2.0 stuff
......@@ -204,7 +193,6 @@ namespace System.Windows.Forms {
return base.GetPreferredSizeCore (proposedSize);
}
#endif
#endregion // Internal methods
}
}
......@@ -30,12 +30,10 @@ using System.Drawing.Text;
using System.Runtime.InteropServices;
namespace System.Windows.Forms {
#if NET_2_0
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible (true)]
[Designer ("System.Windows.Forms.Design.ButtonBaseDesigner, " + Consts.AssemblySystem_Design,
"System.ComponentModel.Design.IDesigner")]
#endif
public abstract class ButtonBase : Control
{
#region Local Variables
......@@ -54,9 +52,7 @@ namespace System.Windows.Forms {
// Properties are 2.0, but variables used in 1.1 for common drawing code
private bool auto_ellipsis;
private FlatButtonAppearance flat_button_appearance;
#if NET_2_0
private string image_key;
#endif
private TextImageRelation text_image_relation;
private TextFormatFlags text_format_flags;
private bool use_mnemonic;
......@@ -68,12 +64,10 @@ namespace System.Windows.Forms {
{
flat_style = FlatStyle.Standard;
flat_button_appearance = new FlatButtonAppearance (this);
#if NET_2_0
this.image_key = string.Empty;
this.text_image_relation = TextImageRelation.Overlay;
this.use_mnemonic = true;
use_visual_style_back_color = true;
#endif
image_index = -1;
image = null;
image_list = null;
......@@ -97,11 +91,7 @@ namespace System.Windows.Forms {
ControlStyles.UserMouse |
ControlStyles.SupportsTransparentBackColor |
ControlStyles.CacheText |
#if NET_2_0
ControlStyles.OptimizedDoubleBuffer, true);
#else
ControlStyles.DoubleBuffer, true);
#endif
SetStyle (ControlStyles.StandardClick, false);
}
#endregion // Public Constructors
......@@ -111,12 +101,7 @@ namespace System.Windows.Forms {
[DefaultValue (false)]
[EditorBrowsable (EditorBrowsableState.Always)]
[MWFCategory("Behavior")]
#if NET_2_0
public
#else
internal
#endif
bool AutoEllipsis {
public bool AutoEllipsis {
get { return this.auto_ellipsis; }
set
{
......@@ -138,7 +123,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[Browsable (true)]
[EditorBrowsable (EditorBrowsableState.Always)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)]
......@@ -152,17 +136,11 @@ namespace System.Windows.Forms {
get { return base.BackColor; }
set { base.BackColor = value; }
}
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[Browsable (true)]
[MWFCategory("Appearance")]
#if NET_2_0
public
#else
internal
#endif
FlatButtonAppearance FlatAppearance {
public FlatButtonAppearance FlatAppearance {
get { return flat_button_appearance; }
}
......@@ -193,26 +171,20 @@ namespace System.Windows.Forms {
if (this.image_list != null)
return this.image_list.Images[this.image_index];
#if NET_2_0
if (!string.IsNullOrEmpty (this.image_key))
if (this.image_list != null)
return this.image_list.Images[this.image_key];
#endif
return null;
}
set {
if (this.image != value) {
this.image = value;
this.image_index = -1;
#if NET_2_0
this.image_key = string.Empty;
#endif
this.image_list = null;
#if NET_2_0
if (this.AutoSize && this.Parent != null)
this.Parent.PerformLayout (this, "Image");
#endif
Invalidate ();
}
......@@ -242,9 +214,7 @@ namespace System.Windows.Forms {
[Editor("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
[TypeConverter(typeof(ImageIndexConverter))]
[MWFDescription("Index of image to display, if ImageList is used for button face images"), MWFCategory("Appearance")]
#if NET_2_0
[RefreshProperties (RefreshProperties.Repaint)]
#endif
public int ImageIndex {
get {
if (image_list == null)
......@@ -256,15 +226,12 @@ namespace System.Windows.Forms {
if (this.image_index != value) {
this.image_index = value;
this.image = null;
#if NET_2_0
this.image_key = string.Empty;
#endif
Invalidate ();
}
}
}
#if NET_2_0
[Localizable (true)]
[DefaultValue ("")]
[Editor ("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
......@@ -282,13 +249,10 @@ namespace System.Windows.Forms {
}
}
}
#endif
[DefaultValue(null)]
[MWFDescription("ImageList used for ImageIndex"), MWFCategory("Appearance")]
#if NET_2_0
[RefreshProperties (RefreshProperties.Repaint)]
#endif
public ImageList ImageList {
get { return image_list; }
set {
......@@ -310,7 +274,6 @@ namespace System.Windows.Forms {
set { base.ImeMode = value; }
}
#if NET_2_0
[SettingsBindable (true)]
[Editor ("System.ComponentModel.Design.MultilineStringEditor, " + Consts.AssemblySystem_Design,
"System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
......@@ -318,7 +281,6 @@ namespace System.Windows.Forms {
get { return base.Text; }
set { base.Text = value; }
}
#endif
[Localizable(true)]
[DefaultValue(ContentAlignment.MiddleCenter)]
......@@ -396,15 +358,10 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[Localizable (true)]
[DefaultValue (TextImageRelation.Overlay)]
[MWFCategory("Appearance")]
public
#else
internal
#endif
TextImageRelation TextImageRelation {
public TextImageRelation TextImageRelation {
get { return this.text_image_relation; }
set {
if (!Enum.IsDefined (typeof (TextImageRelation), value))
......@@ -413,10 +370,8 @@ namespace System.Windows.Forms {
if (this.text_image_relation != value) {
this.text_image_relation = value;
#if NET_2_0
if (this.AutoSize && this.Parent != null)
this.Parent.PerformLayout (this, "TextImageRelation");
#endif
this.Invalidate ();
}
......@@ -425,12 +380,7 @@ namespace System.Windows.Forms {
[DefaultValue (false)]
[MWFCategory("Behavior")]
#if NET_2_0
public
#else
internal
#endif
bool UseCompatibleTextRendering {
public bool UseCompatibleTextRendering {
get { return use_compatible_text_rendering; }
set {
if (use_compatible_text_rendering != value) {
......@@ -444,12 +394,7 @@ namespace System.Windows.Forms {
[DefaultValue (true)]
[MWFCategory("Appearance")]
#if NET_2_0
public
#else
internal
#endif
bool UseMnemonic {
public bool UseMnemonic {
get { return this.use_mnemonic; }
set {
if (this.use_mnemonic != value) {
......@@ -466,12 +411,7 @@ namespace System.Windows.Forms {
}
[MWFCategory("Appearance")]
#if NET_2_0
public
#else
internal
#endif
bool UseVisualStyleBackColor {
public bool UseVisualStyleBackColor {
get { return use_visual_style_back_color; }
set {
if (use_visual_style_back_color != value) {
......@@ -507,13 +447,11 @@ namespace System.Windows.Forms {
#endregion // Public Instance Properties
#region Public Methods
#if NET_2_0
// The base calls into GetPreferredSizeCore, which we will override in our subclasses
public override Size GetPreferredSize (Size proposedSize)
{
return base.GetPreferredSize (proposedSize);
}
#endif
#endregion
#region Protected Methods
......@@ -632,9 +570,7 @@ namespace System.Windows.Forms {
if (ClientRectangle.Contains (mevent.Location))
if (!ValidationFailed) {
OnClick (EventArgs.Empty);
#if NET_2_0
OnMouseClick (mevent);
#endif
}
}
......@@ -698,14 +634,12 @@ namespace System.Windows.Forms {
#endregion // Public Instance Properties
#region Public Events
#if NET_2_0
[Browsable (true)]
[EditorBrowsable (EditorBrowsableState.Always)]
public new event EventHandler AutoSizeChanged {
add { base.AutoSizeChanged += value; }
remove { base.AutoSizeChanged -= value; }
}
#endif
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
......@@ -795,11 +729,9 @@ namespace System.Windows.Forms {
#endregion // ButtonBaseAccessibleObject Constructors
#region Public Properties
#if NET_2_0
public override AccessibleStates State {
get { return base.State; }
}
#endif
#endregion
#region ButtonBaseAccessibleObject Methods
......
......@@ -31,10 +31,7 @@ using System.Windows.Forms.VisualStyles;
namespace System.Windows.Forms
{
#if NET_2_0
public
#endif
sealed class ButtonRenderer
public sealed class ButtonRenderer
{
private static bool always_use_visual_styles = false;
......
......@@ -26,7 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public class CacheVirtualItemsEventArgs : EventArgs
......@@ -54,4 +53,3 @@ namespace System.Windows.Forms
#endregion // Public Instance Properties
}
}
#endif
\ No newline at end of file
......@@ -26,9 +26,7 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public delegate void CacheVirtualItemsEventHandler(object sender, CacheVirtualItemsEventArgs e);
}
#endif
\ No newline at end of file
......@@ -32,12 +32,10 @@ using System.Runtime.InteropServices;
namespace System.Windows.Forms {
[DefaultProperty("Checked")]
[DefaultEvent("CheckedChanged")]
#if NET_2_0
[ComVisible (true)]
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[DefaultBindingProperty ("CheckState")]
[ToolboxItem ("System.Windows.Forms.Design.AutoSizeToolboxItem," + Consts.AssemblySystem_Design)]
#endif
public class CheckBox : ButtonBase {
#region Local Variables
internal Appearance appearance;
......@@ -96,14 +94,12 @@ namespace System.Windows.Forms {
}
#endregion // CheckBoxAccessibleObject Properties
#if NET_2_0
#region CheckBoxAccessibleObject Methods
public override void DoDefaultAction ()
{
owner.Checked = !owner.Checked;
}
#endregion // CheckBoxAccessibleObject Methods
#endif
}
#endregion // CheckBoxAccessibleObject Sub-class
......@@ -114,15 +110,12 @@ namespace System.Windows.Forms {
check_alignment = ContentAlignment.MiddleLeft;
TextAlign = ContentAlignment.MiddleLeft;
SetStyle(ControlStyles.StandardDoubleClick, false);
#if NET_2_0
SetAutoSizeMode (AutoSizeMode.GrowAndShrink);
#endif
}
#endregion // Public Constructors
#region Internal Methods
internal override void Draw (PaintEventArgs pe) {
#if NET_2_0
// FIXME: This should be called every time something that can affect it
// is changed, not every paint. Can only change so many things at a time.
......@@ -138,12 +131,8 @@ namespace System.Windows.Forms {
ThemeEngine.Current.DrawCheckBox (pe.Graphics, this, glyph_rectangle, text_rectangle, image_rectangle, pe.ClipRectangle);
else
ThemeEngine.Current.DrawCheckBox (pe.Graphics, this.ClientRectangle, this);
#else
ThemeEngine.Current.DrawCheckBox (pe.Graphics, this.ClientRectangle, this);
#endif
}
#if NET_2_0
internal override Size GetPreferredSizeCore (Size proposedSize)
{
if (this.AutoSize)
......@@ -151,7 +140,6 @@ namespace System.Windows.Forms {
return base.GetPreferredSizeCore (proposedSize);
}
#endif
internal override void HaveDoubleClick() {
if (DoubleClick != null) DoubleClick(this, EventArgs.Empty);
......@@ -210,9 +198,7 @@ namespace System.Windows.Forms {
[Bindable(true)]
[RefreshProperties(RefreshProperties.All)]
[DefaultValue(false)]
#if NET_2_0
[SettingsBindable (true)]
#endif
public bool Checked {
get {
if (check_state != CheckState.Unchecked) {
......@@ -357,12 +343,10 @@ namespace System.Windows.Forms {
base.OnHandleCreated (e);
}
#if NET_2_0
protected override void OnKeyDown (KeyEventArgs e)
{
base.OnKeyDown (e);
}
#endif
protected override void OnMouseUp(MouseEventArgs mevent) {
base.OnMouseUp (mevent);
......@@ -399,14 +383,12 @@ namespace System.Windows.Forms {
remove { Events.RemoveHandler (CheckStateChangedEvent, value); }
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event MouseEventHandler MouseDoubleClick {
add { base.MouseDoubleClick += value; }
remove { base.MouseDoubleClick -= value; }
}
#endif
#endregion // Events
#region Events
......
......@@ -31,10 +31,7 @@ using System.Windows.Forms.VisualStyles;
namespace System.Windows.Forms
{
#if NET_2_0
public
#endif
sealed class CheckBoxRenderer
public sealed class CheckBoxRenderer
{
private static bool always_use_visual_styles = false;
......
......@@ -34,11 +34,9 @@ using System.Runtime.InteropServices;
namespace System.Windows.Forms
{
#if NET_2_0
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible (true)]
[LookupBindingPropertiesAttribute ()]
#endif
public class CheckedListBox : ListBox
{
private CheckedIndexCollection checked_indices;
......@@ -57,13 +55,8 @@ namespace System.Windows.Forms
#region events
static object ItemCheckEvent = new object ();
#if NET_2_0
[Browsable (true)]
[EditorBrowsable (EditorBrowsableState.Always)]
#else
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
#endif
public new event EventHandler Click {
add { base.Click += value; }
remove { base.Click -= value; }
......@@ -109,14 +102,12 @@ namespace System.Windows.Forms
remove { Events.RemoveHandler (ItemCheckEvent, value); }
}
#if NET_2_0
[Browsable (true)]
[EditorBrowsable (EditorBrowsableState.Always)]
public new event MouseEventHandler MouseClick {
add { base.MouseClick += value; }
remove { base.MouseClick -= value; }
}
#endif
#endregion Events
#region Public Properties
......@@ -213,7 +204,6 @@ namespace System.Windows.Forms
set { base.ValueMember = value; }
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
......@@ -221,7 +211,6 @@ namespace System.Windows.Forms
get { return base.Padding; }
set { base.Padding = value; }
}
#endif
#endregion Public Properties
#region Public Methods
......@@ -309,12 +298,11 @@ namespace System.Windows.Forms
base.OnSelectedIndexChanged (e);
}
#if NET_2_0
protected override void RefreshItems ()
{
base.RefreshItems ();
}
#endif
public void SetItemChecked (int index, bool value)
{
SetItemCheckState (index, value ? CheckState.Checked : CheckState.Unchecked);
......@@ -656,14 +644,11 @@ namespace System.Windows.Forms
}
#endregion Private Methods
}
#if NET_2_0
[DefaultValue (false)]
public bool UseCompatibleTextRendering {
get { return use_compatible_text_rendering; }
set { use_compatible_text_rendering = value; }
}
#endif
}
}
......@@ -61,7 +61,6 @@ namespace System.Windows.Forms {
#endregion // Private Methods
#region Public Static Methods
#if NET_2_0
public static void Clear ()
{
IntPtr clipboard_handle;
......@@ -132,14 +131,12 @@ namespace System.Windows.Forms {
return data.GetData (format, true);
}
#endif
public static IDataObject GetDataObject ()
{
return GetDataObject (false);
}
#if NET_2_0
public static StringCollection GetFileDropList ()
{
IDataObject data = GetDataObject ();
......@@ -225,7 +222,6 @@ namespace System.Windows.Forms {
DataObject data_object = new DataObject (format, data);
SetDataObject (data_object);
}
#endif
public static void SetDataObject(object data) {
SetDataObject(data, false); // MSDN says default behavior is to place non-persistent data to clipboard
......@@ -287,12 +283,7 @@ namespace System.Windows.Forms {
return attrs [typeof (SerializableAttribute)] != null;
}
#if NET_2_0
public
#else
internal
#endif
static void SetDataObject(object data, bool copy, int retryTimes, int retryDelay)
public static void SetDataObject(object data, bool copy, int retryTimes, int retryDelay)
{
if (data == null)
throw new ArgumentNullException("data");
......@@ -319,7 +310,6 @@ namespace System.Windows.Forms {
} while (retry && retryTimes > 0);
}
#if NET_2_0
[MonoInternalNote ("Needs additional checks for valid paths, see MSDN")]
public static void SetFileDropList (StringCollection filePaths)
{
......@@ -370,7 +360,6 @@ namespace System.Windows.Forms {
break;
}
}
#endif
#endregion // Public Static Methods
#region Internal Static Methods
......
......@@ -29,10 +29,7 @@
namespace System.Windows.Forms
{
#if NET_2_0
public
#endif
enum CloseReason
public enum CloseReason
{
None = 0,
WindowsShutDown = 1,
......
......@@ -27,9 +27,6 @@
// COMPLETE
namespace System.Windows.Forms {
#if !NET_2_0
[Serializable]
#endif
public enum ColorDepth {
Depth4Bit = 4,
Depth8Bit = 8,
......
......@@ -969,7 +969,6 @@ namespace System.Windows.Forms {
private SmallColorControl selectedSmallColorControl;
#region UIA Framework Property
#if NET_2_0
public SmallColorControl UIASelectedSmallColorControl {
get {
for (int i = 0; i < smallColorControl.Length - 1; ++i)
......@@ -981,7 +980,6 @@ namespace System.Windows.Forms {
return null;
}
}
#endif
#endregion
private int currentlyUsedUserSmallColorControl = 0;
......
......@@ -25,8 +25,5 @@
namespace System.Windows.Forms
{
#if !NET_2_0
[Serializable]
#endif
public delegate void ColumnClickEventHandler (object sender, ColumnClickEventArgs e);
}
......@@ -35,9 +35,7 @@ namespace System.Windows.Forms
[DefaultProperty ("Text")]
[DesignTimeVisible (false)]
[ToolboxItem (false)]
#if NET_2_0
[TypeConverter (typeof (ColumnHeaderConverter))]
#endif
public class ColumnHeader : Component, ICloneable
{
#region Instance Variables
......@@ -45,12 +43,10 @@ namespace System.Windows.Forms
private string text = "ColumnHeader";
private HorizontalAlignment text_alignment = HorizontalAlignment.Left;
private int width = ThemeEngine.Current.ListViewDefaultColumnWidth;
#if NET_2_0
private int image_index = -1;
private string image_key = String.Empty;
private string name = String.Empty;
private object tag;
#endif
private int display_index = -1;
// internal variables
......@@ -70,7 +66,6 @@ namespace System.Windows.Forms
CalcColumnHeader ();
}
#if NET_2_0
internal ColumnHeader (string key, string text, int width, HorizontalAlignment textAlign)
{
Name = key;
......@@ -79,13 +74,11 @@ namespace System.Windows.Forms
this.text_alignment = textAlign;
CalcColumnHeader ();
}
#endif
#endregion // Internal Constructor
#region Public Constructors
public ColumnHeader () { }
#if NET_2_0
public ColumnHeader (int imageIndex)
{
ImageIndex = imageIndex;
......@@ -95,7 +88,6 @@ namespace System.Windows.Forms
{
ImageKey = imageKey;
}
#endif
#endregion // Public Constructors
#region Private Internal Methods Properties
......@@ -188,7 +180,6 @@ namespace System.Windows.Forms
#region Public Instance Properties
#if NET_2_0
[Localizable (true)]
[RefreshProperties (RefreshProperties.Repaint)]
public int DisplayIndex {
......@@ -260,7 +251,6 @@ namespace System.Windows.Forms
return owner.SmallImageList;
}
}
#endif
[Browsable (false)]
public int Index {
......@@ -277,7 +267,6 @@ namespace System.Windows.Forms
get { return owner; }
}
#if NET_2_0
[Browsable (false)]
public string Name {
get {
......@@ -300,7 +289,6 @@ namespace System.Windows.Forms
tag = value;
}
}
#endif
[Localizable (true)]
public string Text {
......@@ -311,10 +299,8 @@ namespace System.Windows.Forms
if (owner != null)
owner.Redraw (true);
#if NET_2_0
// UIA Framework: Raising Value changed event
OnUIATextChanged ();
#endif
}
}
}
......@@ -347,7 +333,6 @@ namespace System.Windows.Forms
#endregion // Public Instance Properties
#region Public Methods
#if NET_2_0
public void AutoResize (ColumnHeaderAutoResizeStyle headerAutoResize)
{
switch (headerAutoResize) {
......@@ -364,7 +349,6 @@ namespace System.Windows.Forms
typeof (ColumnHeaderAutoResizeStyle));
}
}
#endif
public object Clone ()
{
......@@ -391,7 +375,6 @@ namespace System.Windows.Forms
}
#endregion // Protected Methods
#if NET_2_0
#region UIA Framework: Methods, Properties and Events
......@@ -410,7 +393,5 @@ namespace System.Windows.Forms
}
#endregion
#endif
}
}
......@@ -27,7 +27,6 @@
//
#if NET_2_0
namespace System.Windows.Forms
{
public enum ColumnHeaderAutoResizeStyle
......@@ -37,4 +36,3 @@ namespace System.Windows.Forms
ColumnContent = 2
}
}
#endif
\ No newline at end of file
......@@ -26,8 +26,6 @@
// COMPLETE
#if NET_2_0
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Collections;
......@@ -95,5 +93,3 @@ namespace System.Windows.Forms
}
}
}
#endif
\ No newline at end of file
......@@ -26,7 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
using System.ComponentModel;
......@@ -63,4 +62,3 @@ namespace System.Windows.Forms
#endregion // Public Instance Properties
}
}
#endif
\ No newline at end of file
......@@ -26,9 +26,7 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public delegate void ColumnReorderedEventHandler(object sender, ColumnReorderedEventArgs e);
}
#endif
\ No newline at end of file
......@@ -26,7 +26,6 @@
//
// (C) 2004 Novell, Inc.
//
#if NET_2_0
namespace System.Windows.Forms
{
public class ColumnStyle : TableLayoutStyle
......@@ -68,4 +67,3 @@ namespace System.Windows.Forms
}
}
}
#endif
......@@ -26,7 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public class ColumnWidthChangedEventArgs : EventArgs
......@@ -48,4 +47,3 @@ namespace System.Windows.Forms
#endregion // Public Instance Properties
}
}
#endif
\ No newline at end of file
......@@ -26,9 +26,7 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public delegate void ColumnWidthChangedEventHandler (object sender, ColumnWidthChangedEventArgs e);
}
#endif
\ No newline at end of file
......@@ -26,7 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
using System.ComponentModel;
namespace System.Windows.Forms
......@@ -60,4 +59,3 @@ namespace System.Windows.Forms
#endregion // Public Instance Properties
}
}
#endif
\ No newline at end of file
......@@ -26,9 +26,7 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
namespace System.Windows.Forms
{
public delegate void ColumnWidthChangingEventHandler (object sender, ColumnWidthChangingEventArgs e);
}
#endif
\ No newline at end of file
......@@ -39,11 +39,9 @@ namespace System.Windows.Forms
[DefaultProperty("Items")]
[DefaultEvent("SelectedIndexChanged")]
[Designer ("System.Windows.Forms.Design.ComboBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
#if NET_2_0
[DefaultBindingProperty ("Text")]
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
#endif
public class ComboBox : ListControl
{
private DrawMode draw_mode = DrawMode.Normal;
......@@ -72,14 +70,12 @@ namespace System.Windows.Forms
private Rectangle listbox_area;
private const int button_width = 16;
bool drop_down_button_entered;
#if NET_2_0
private AutoCompleteStringCollection auto_complete_custom_source = null;
private AutoCompleteMode auto_complete_mode = AutoCompleteMode.None;
private AutoCompleteSource auto_complete_source = AutoCompleteSource.None;
private FlatStyle flat_style;
private int drop_down_height;
const int default_drop_down_height = 106;
#endif
[ComVisible(true)]
public class ChildAccessibleObject : AccessibleObject {
......@@ -104,10 +100,8 @@ namespace System.Windows.Forms
background_color = ThemeEngine.Current.ColorWindow;
border_style = BorderStyle.None;
#if NET_2_0
drop_down_height = default_drop_down_height;
flat_style = FlatStyle.Standard;
#endif
/* Events */
MouseDown += new MouseEventHandler (OnMouseDownCB);
......@@ -128,8 +122,6 @@ namespace System.Windows.Forms
remove { base.BackgroundImageChanged -= value; }
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler BackgroundImageLayoutChanged
......@@ -145,7 +137,6 @@ namespace System.Windows.Forms
add { base.DoubleClick += value; }
remove { base.DoubleClick -= value; }
}
#endif
static object DrawItemEvent = new object ();
static object DropDownEvent = new object ();
......@@ -153,10 +144,8 @@ namespace System.Windows.Forms
static object MeasureItemEvent = new object ();
static object SelectedIndexChangedEvent = new object ();
static object SelectionChangeCommittedEvent = new object ();
#if NET_2_0
static object DropDownClosedEvent = new object ();
static object TextUpdateEvent = new object ();
#endif
public event DrawItemEventHandler DrawItem {
add { Events.AddHandler (DrawItemEvent, value); }
......@@ -167,13 +156,11 @@ namespace System.Windows.Forms
add { Events.AddHandler (DropDownEvent, value); }
remove { Events.RemoveHandler (DropDownEvent, value); }
}
#if NET_2_0
public event EventHandler DropDownClosed
{
add { Events.AddHandler (DropDownClosedEvent, value); }
remove { Events.RemoveHandler (DropDownClosedEvent, value); }
}
#endif
public event EventHandler DropDownStyleChanged {
add { Events.AddHandler (DropDownStyleChangedEvent, value); }
......@@ -184,7 +171,6 @@ namespace System.Windows.Forms
add { Events.AddHandler (MeasureItemEvent, value); }
remove { Events.RemoveHandler (MeasureItemEvent, value); }
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler PaddingChanged
......@@ -192,7 +178,6 @@ namespace System.Windows.Forms
add { base.PaddingChanged += value; }
remove { base.PaddingChanged -= value; }
}
#endif
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
......@@ -210,18 +195,15 @@ namespace System.Windows.Forms
add { Events.AddHandler (SelectionChangeCommittedEvent, value); }
remove { Events.RemoveHandler (SelectionChangeCommittedEvent, value); }
}
#if NET_2_0
public event EventHandler TextUpdate
{
add { Events.AddHandler (TextUpdateEvent, value); }
remove { Events.RemoveHandler (TextUpdateEvent, value); }
}
#endif
#endregion Events
#region Public Properties
#if NET_2_0
[MonoTODO("AutoCompletion algorithm is currently not implemented.")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[Browsable (true)]
......@@ -306,7 +288,6 @@ namespace System.Windows.Forms
textbox_ctrl.AutoCompleteInternalSource = null;
}
}
#endif
public override Color BackColor {
get { return base.BackColor; }
set {
......@@ -329,20 +310,17 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public override ImageLayout BackgroundImageLayout {
get { return base.BackgroundImageLayout; }
set { base.BackgroundImageLayout = value; }
}
#endif
protected override CreateParams CreateParams {
get { return base.CreateParams;}
}
#if NET_2_0
[DefaultValue ((string)null)]
[AttributeProvider (typeof (IListSource))]
[RefreshProperties (RefreshProperties.Repaint)]
......@@ -351,7 +329,6 @@ namespace System.Windows.Forms
get { return base.DataSource; }
set { base.DataSource = value; }
}
#endif
protected override Size DefaultSize {
get { return new Size (121, 21); }
......@@ -378,7 +355,6 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
[Browsable (true)]
[DefaultValue (106)]
[EditorBrowsable (EditorBrowsableState.Always)]
......@@ -398,7 +374,6 @@ namespace System.Windows.Forms
IntegralHeight = false;
}
}
#endif
[DefaultValue (ComboBoxStyle.DropDown)]
[RefreshProperties(RefreshProperties.Repaint)]
......@@ -461,9 +436,7 @@ namespace System.Windows.Forms
if (IsHandleCreated == true)
Controls.AddImplicit (textbox_ctrl);
#if NET_2_0
SetTextBoxAutoCompleteData ();
#endif
}
ResumeLayout ();
......@@ -488,12 +461,8 @@ namespace System.Windows.Forms
return;
if (value < 1)
#if NET_2_0
throw new ArgumentOutOfRangeException ("DropDownWidth",
"The DropDownWidth value is less than one.");
#else
throw new ArgumentException ("The DropDownWidth value is less than one.");
#endif
dropdown_width = value;
}
......@@ -519,7 +488,6 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
[DefaultValue (FlatStyle.Standard)]
[Localizable (true)]
[MWFCategory("Appearance")]
......@@ -534,7 +502,6 @@ namespace System.Windows.Forms
Invalidate ();
}
}
#endif
public override bool Focused {
get { return base.Focused; }
......@@ -576,12 +543,8 @@ namespace System.Windows.Forms
}
set {
if (value < 1)
#if NET_2_0
throw new ArgumentOutOfRangeException ("ItemHeight",
"The item height value is less than one.");
#else
throw new ArgumentException ("The item height value is less than one.");
#endif
item_height_specified = true;
item_height = value;
......@@ -595,9 +558,7 @@ namespace System.Windows.Forms
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[Localizable (true)]
[Editor ("System.Windows.Forms.Design.ListControlStringCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
#if NET_2_0
[MergableProperty (false)]
#endif
[MWFCategory("Data")]
public ComboBox.ObjectCollection Items {
get { return items; }
......@@ -615,14 +576,12 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
public override Size MaximumSize {
get { return base.MaximumSize; }
set {
base.MaximumSize = new Size (value.Width, 0);
}
}
#endif
[DefaultValue (0)]
[Localizable (true)]
......@@ -644,7 +603,6 @@ namespace System.Windows.Forms
}
}
#if NET_2_0
public override Size MinimumSize {
get { return base.MinimumSize; }
set {
......@@ -659,7 +617,6 @@ namespace System.Windows.Forms
get { return base.Padding; }
set { base.Padding = value; }
}
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
......@@ -702,11 +659,6 @@ namespace System.Windows.Forms
string retval = textbox_ctrl.SelectedText;
#if ONLY_1_1
// On 1.1, the textbox will return null, combobox returns ""
if (retval == null && !textbox_ctrl.IsHandleCreated)
return string.Empty;
#endif
return retval;
}
set {
......@@ -840,9 +792,7 @@ namespace System.Windows.Forms
#endregion UIA Framework Properties
#region Public Methods
#if NET_2_0
[Obsolete ("This method has been deprecated")]
#endif
protected virtual void AddItemsCore (object[] value)
{
......@@ -853,7 +803,6 @@ namespace System.Windows.Forms
suspend_ctrlupdate = true;
}
#if NET_2_0
protected override AccessibleObject CreateAccessibilityInstance ()
{
return base.CreateAccessibilityInstance ();
......@@ -863,7 +812,6 @@ namespace System.Windows.Forms
{
base.CreateHandle ();
}
#endif
protected override void Dispose (bool disposing)
{
......@@ -901,18 +849,12 @@ namespace System.Windows.Forms
if (s == null || Items.Count == 0)
return -1;
#if NET_2_0
if (startIndex < -1 || startIndex >= Items.Count)
#else
if (startIndex < -1 || startIndex >= Items.Count - 1)
#endif
throw new ArgumentOutOfRangeException ("startIndex");
int i = startIndex;
#if NET_2_0
if (i == (Items.Count - 1))
i = -1;
#endif
do {
i++;
if (string.Compare (s, 0, GetItemText (Items [i]), 0, s.Length, true) == 0)
......@@ -939,18 +881,12 @@ namespace System.Windows.Forms
if (s == null || Items.Count == 0)
return -1;
#if NET_2_0
if (startIndex < -1 || startIndex >= Items.Count)
#else
if (startIndex < -1 || startIndex >= Items.Count - 1)
#endif
throw new ArgumentOutOfRangeException ("startIndex");
int i = startIndex;
#if NET_2_0
if (i == (Items.Count - 1))
i = -1;
#endif
do {
i++;
if (string.Compare (s, GetItemText (Items [i]), ignoreCase, CultureInfo.CurrentCulture) == 0)
......@@ -1067,14 +1003,12 @@ namespace System.Windows.Forms
eh (this, e);
}
#if NET_2_0
protected virtual void OnDropDownClosed (EventArgs e)
{
EventHandler eh = (EventHandler) Events [DropDownClosedEvent];
if (eh != null)
eh (this, e);
}
#endif
protected virtual void OnDropDownStyleChanged (EventArgs e)
{
......@@ -1143,9 +1077,7 @@ namespace System.Windows.Forms
textbox_ctrl.ActivateCaret (false);
textbox_ctrl.ShowSelection = false;
textbox_ctrl.SelectionLength = 0;
#if NET_2_0
textbox_ctrl.HideAutoCompleteList ();
#endif
}
base.OnLostFocus (e);
......@@ -1241,7 +1173,6 @@ namespace System.Windows.Forms
item_heights.Remove (Items [index]);
}
#if NET_2_0
protected override void RefreshItems ()
{
for (int i = 0; i < Items.Count; i++) {
......@@ -1283,39 +1214,30 @@ namespace System.Windows.Forms
base.OnTextChanged (e);
}
#if NET_2_0
protected virtual void OnTextUpdate (EventArgs e)
{
EventHandler eh = (EventHandler) Events [TextUpdateEvent];
if (eh != null)
eh (this, e);
}
#endif
protected override void OnMouseLeave (EventArgs e)
{
#if NET_2_0
if (flat_style == FlatStyle.Popup)
Invalidate ();
#endif
base.OnMouseLeave (e);
}
protected override void OnMouseEnter (EventArgs e)
{
#if NET_2_0
if (flat_style == FlatStyle.Popup)
Invalidate ();
#endif
base.OnMouseEnter (e);
}
#endif
#if NET_2_0
protected override void ScaleControl (SizeF factor, BoundsSpecified specified)
{
base.ScaleControl (factor, specified);
}
#endif
public void Select (int start, int length)
{
......@@ -1387,13 +1309,11 @@ namespace System.Windows.Forms
case Msg.WM_KEYUP:
case Msg.WM_KEYDOWN:
Keys keys = (Keys) m.WParam.ToInt32 ();
#if NET_2_0
// Don't pass the message to base if auto complete is being used and available.
if (textbox_ctrl != null && textbox_ctrl.CanNavigateAutoCompleteList) {
XplatUI.SendMessage (textbox_ctrl.Handle, (Msg) m.Msg, m.WParam, m.LParam);
return;
}
#endif
if (keys == Keys.Up || keys == Keys.Down)
break;
goto case Msg.WM_CHAR;
......@@ -1416,13 +1336,11 @@ namespace System.Windows.Forms
#endregion Public Methods
#region Private Methods
#if NET_2_0
void OnAutoCompleteCustomSourceChanged(object sender, CollectionChangeEventArgs e) {
if(auto_complete_source == AutoCompleteSource.CustomSource) {
//FIXME: handle add, remove and refresh events in AutoComplete algorithm.
}
}
#endif
internal override bool InternalCapture {
get { return Capture; }
......@@ -1450,13 +1368,11 @@ namespace System.Windows.Forms
button_area.Y = text_area.Y + border;
button_area.Width = button_width;
button_area.Height = text_area.Height - 2 * border;
#if NET_2_0
if (flat_style == FlatStyle.Popup || flat_style == FlatStyle.Flat) {
button_area.Inflate (1, 1);
button_area.X += 2;
button_area.Width -= 2;
}
#endif
}
if (button_area != prev_button_area) {
......@@ -1492,10 +1408,8 @@ namespace System.Windows.Forms
FlatStyle style = FlatStyle.Standard;
bool is_flat = false;
#if NET_2_0
style = this.FlatStyle;
is_flat = style == FlatStyle.Flat || style == FlatStyle.Popup;
#endif
theme.ComboBoxDrawBackground (this, dc, clip, style);
......@@ -1566,10 +1480,8 @@ namespace System.Windows.Forms
FindMatchOrSetIndex(SelectedIndex);
#if NET_2_0
if (textbox_ctrl != null)
textbox_ctrl.HideAutoCompleteList ();
#endif
if (listbox_ctrl.ShowWindow ())
dropped_down = true;
......@@ -1588,9 +1500,7 @@ namespace System.Windows.Forms
button_state = ButtonState.Normal;
Invalidate (button_area);
dropped_down = false;
#if NET_2_0
OnDropDownClosed (EventArgs.Empty);
#endif
/*
* Apples X11 looses override-redirect when doing a Unmap/Map on a previously mapped window
* this causes the popup to appear under the main form. This is horrible but necessary
......@@ -1602,12 +1512,10 @@ namespace System.Windows.Forms
listbox_ctrl.Dispose ();
listbox_ctrl = null;
}
#if NET_2_0
// The auto complete list could have been shown after the listbox,
// so make sure it's hidden.
if (textbox_ctrl != null)
textbox_ctrl.HideAutoCompleteList ();
#endif
}
private int FindStringCaseInsensitive (string search)
......@@ -2004,7 +1912,6 @@ namespace System.Windows.Forms
#region UIA Framework Events
#if NET_2_0
//NOTE:
// We are using Reflection to add/remove internal events.
// Class ListProvider uses the events.
......@@ -2024,7 +1931,6 @@ namespace System.Windows.Forms
if (eh != null)
eh (owner, args);
}
#endif
#endregion UIA Framework Events
......@@ -2057,17 +1963,13 @@ namespace System.Windows.Forms
if (value == null)
throw new ArgumentNullException ("value");
#if NET_2_0
//UIA Framework event: Item Removed
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, object_items [index]));
#endif
object_items[index] = value;
#if NET_2_0
//UIA Framework event: Item Added
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, value));
#endif
if (owner.listbox_ctrl != null)
owner.listbox_ctrl.InvalidateItem (index);
......@@ -2125,10 +2027,8 @@ namespace System.Windows.Forms
owner.UpdatedItems ();
owner.Refresh ();
#if NET_2_0
//UIA Framework event: Items list cleared
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null));
#endif
}
public bool Contains (object value)
......@@ -2139,7 +2039,6 @@ namespace System.Windows.Forms
return object_items.Contains (value);
}
#if NET_2_0
public void CopyTo (object [] destination, int arrayIndex)
{
object_items.CopyTo (destination, arrayIndex);
......@@ -2149,17 +2048,6 @@ namespace System.Windows.Forms
{
object_items.CopyTo (destination, index);
}
#else
public void CopyTo (object [] dest, int arrayIndex)
{
object_items.CopyTo (dest, arrayIndex);
}
void ICollection.CopyTo (Array dest, int index)
{
object_items.CopyTo (dest, index);
}
#endif
public IEnumerator GetEnumerator ()
{
......@@ -2192,10 +2080,8 @@ namespace System.Windows.Forms
AddItem (item, false);
else {
object_items.Insert (index, item);
#if NET_2_0
//UIA Framework event: Item added
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
#endif
}
owner.EndUpdate (); // Calls UpdatedItems
......@@ -2220,18 +2106,13 @@ namespace System.Windows.Forms
if (index == owner.SelectedIndex)
owner.SelectedIndex = -1;
#if NET_2_0
object removed = object_items [index];
#endif
object_items.RemoveAt (index);
owner.UpdatedItems ();
#if NET_2_0
//UIA Framework event: Item removed
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, removed));
#endif
}
#endregion Public Methods
......@@ -2255,10 +2136,8 @@ namespace System.Windows.Forms
if (index <= owner.selected_index && owner.IsHandleCreated)
owner.selected_index++;
#if NET_2_0
//UIA Framework event: Item added
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
#endif
return index;
}
......@@ -2267,10 +2146,8 @@ namespace System.Windows.Forms
}
object_items.Add (item);
#if NET_2_0
//UIA Framework event: Item added
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
#endif
return object_items.Count - 1;
}
......@@ -2324,9 +2201,7 @@ namespace System.Windows.Forms
this.owner = owner;
ShowSelection = false;
owner.EnabledChanged += OwnerEnabledChangedHandler;
#if NET_2_0
owner.LostFocus += OwnerLostFocusHandler;
#endif
}
void OwnerEnabledChangedHandler (object o, EventArgs args)
......@@ -2334,7 +2209,6 @@ namespace System.Windows.Forms
ShowSelection = owner.Focused && owner.Enabled;
}
#if NET_2_0
void OwnerLostFocusHandler (object o, EventArgs args)
{
if (IsAutoCompleteAvailable)
......@@ -2354,7 +2228,6 @@ namespace System.Windows.Forms
base.OnAutoCompleteValueSelected (args);
owner.Text = Text;
}
#endif
internal void SetSelectable (bool selectable)
{
......@@ -2369,13 +2242,11 @@ namespace System.Windows.Forms
document.CaretLostFocus ();
}
#if NET_2_0
internal override void OnTextUpdate ()
{
base.OnTextUpdate ();
owner.OnTextUpdate (EventArgs.Empty);
}
#endif
protected override void OnGotFocus (EventArgs e)
{
......@@ -2580,7 +2451,6 @@ namespace System.Windows.Forms
show_scrollbar = owner.Items.Count > owner.MaxDropDownItems;
} else {
#if NET_2_0
if (owner.DropDownHeight == default_drop_down_height) { // ignore DropDownHeight
height = owner.ItemHeight * visible_items_count;
show_scrollbar = owner.Items.Count > owner.MaxDropDownItems;
......@@ -2589,10 +2459,6 @@ namespace System.Windows.Forms
height = owner.DropDownHeight;
show_scrollbar = (owner.Items.Count * owner.ItemHeight) > height;
}
#else
height = owner.ItemHeight * visible_items_count;
show_scrollbar = owner.Items.Count > owner.MaxDropDownItems;
#endif
}
}
......@@ -2620,11 +2486,7 @@ namespace System.Windows.Forms
vscrollbar_ctrl.Dock = DockStyle.Right;
vscrollbar_ctrl.Maximum = owner.Items.Count - 1;
#if NET_2_0
int large = page_size;
#else
int large = (dropdown_style == ComboBoxStyle.Simple ? page_size : owner.maxdrop_items) - 1;
#endif
if (large < 1)
large = 1;
vscrollbar_ctrl.LargeChange = large;
......
......@@ -26,7 +26,6 @@
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
using System.Drawing;
using System.Windows.Forms.VisualStyles;
......@@ -123,4 +122,3 @@ namespace System.Windows.Forms
#endregion
}
}
#endif
\ No newline at end of file
......@@ -78,9 +78,7 @@ namespace System.Windows.Forms {
#region Local Variables
internal DialogForm form;
#if NET_2_0
private object tag;
#endif
#endregion Local Variables
#region Public Constructors
......@@ -89,7 +87,6 @@ namespace System.Windows.Forms {
#endregion Public Constructors
#region Public Properties
#if NET_2_0
[Localizable (false)]
[Bindable (true)]
[TypeConverter (typeof (StringConverter))]
......@@ -99,7 +96,6 @@ namespace System.Windows.Forms {
get { return this.tag; }
set { this.tag = value; }
}
#endif
#endregion
#region Internal Methods
......
......@@ -32,10 +32,8 @@ using System.Drawing;
using System.Runtime.InteropServices;
namespace System.Windows.Forms {
#if NET_2_0
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible (true)]
#endif
public class ContainerControl : ScrollableControl, IContainerControl {
private Control active_control;
private Control unvalidated_control;
......@@ -44,13 +42,11 @@ namespace System.Windows.Forms {
// This is an internal hack that allows some container controls
// to not auto select their child when they are activated
internal bool auto_select_child = true;
#if NET_2_0
private SizeF auto_scale_dimensions;
private AutoScaleMode auto_scale_mode;
private bool auto_scale_mode_set;
private bool auto_scale_pending;
private bool is_auto_scaling;
#endif
internal bool validation_failed; //track whether validation was cancelled by a validating control
......@@ -59,10 +55,8 @@ namespace System.Windows.Forms {
active_control = null;
unvalidated_control = null;
ControlRemoved += new ControlEventHandler(OnControlRemoved);
#if NET_2_0
auto_scale_dimensions = SizeF.Empty;
auto_scale_mode = AutoScaleMode.Inherit;
#endif
}
#endregion // Public Constructors
......@@ -333,7 +327,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[EditorBrowsable (EditorBrowsableState.Advanced)]
......@@ -386,7 +379,6 @@ namespace System.Windows.Forms {
}
}
}
#endif // NET_2_0
[Browsable (false)]
public override BindingContext BindingContext {
......@@ -402,7 +394,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public SizeF CurrentAutoScaleDimensions {
......@@ -421,7 +412,6 @@ namespace System.Windows.Forms {
return auto_scale_dimensions;
}
}
#endif
[Browsable (false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
......@@ -444,11 +434,9 @@ namespace System.Windows.Forms {
#endregion // Public Instance Properties
#region Protected Instance Methods
#if NET_2_0
protected override bool CanEnableIme {
get { return false; }
}
#endif
protected override CreateParams CreateParams {
get {
return base.CreateParams;
......@@ -457,7 +445,6 @@ namespace System.Windows.Forms {
#endregion // Public Instance Methods
#region Public Instance Methods
#if NET_2_0
internal void PerformAutoScale (bool called_by_scale)
{
if ((AutoScaleMode == AutoScaleMode.Inherit) && !called_by_scale)
......@@ -502,7 +489,6 @@ namespace System.Windows.Forms {
internal bool IsAutoScaling {
get { return is_auto_scaling; }
}
#endif
[MonoTODO ("Stub, not implemented")]
static bool ValidateWarned;
......@@ -515,7 +501,6 @@ namespace System.Windows.Forms {
return true;
}
#if NET_2_0
public bool Validate (bool checkAutoValidate)
{
if ((checkAutoValidate && (AutoValidate != AutoValidate.Disable)) || !checkAutoValidate)
......@@ -543,7 +528,6 @@ namespace System.Windows.Forms {
return true;
}
#endif
bool IContainerControl.ActivateControl(Control control) {
return Select(control);
......@@ -582,7 +566,6 @@ namespace System.Windows.Forms {
OnBindingContextChanged (EventArgs.Empty);
}
#if NET_2_0
protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
{
if (ToolStripManager.ProcessCmdKey (ref msg, keyData) == true)
......@@ -590,7 +573,6 @@ namespace System.Windows.Forms {
return base.ProcessCmdKey (ref msg, keyData);
}
#endif
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected override bool ProcessDialogChar(char charCode) {
......@@ -701,10 +683,6 @@ namespace System.Windows.Forms {
Select (active_control);
else
base.WndProc (ref m);
#if false
else
SelectNextControl (null, true, true, true, false);
#endif
break;
default:
......@@ -769,7 +747,6 @@ namespace System.Windows.Forms {
// do nothing here, only called if it is a Form
}
#if NET_2_0
private bool ValidateNestedControls (Control c, ValidationConstraints constraints, bool recurse)
{
bool validate_result = true;
......@@ -808,10 +785,8 @@ namespace System.Windows.Forms {
return true;
}
#endif
#endregion // Internal Methods
#if NET_2_0
protected override void OnParentChanged (EventArgs e)
{
base.OnParentChanged (e);
......@@ -870,6 +845,5 @@ namespace System.Windows.Forms {
add { Events.AddHandler (OnValidateChanged, value); }
remove { Events.RemoveHandler (OnValidateChanged, value); }
}
#endif
}
}
......@@ -37,17 +37,13 @@ namespace System.Windows.Forms
private Control src_control;
#region Events
#if NET_2_0
static object CollapseEvent = new object ();
#endif
static object PopupEvent = new object ();
#if NET_2_0
public event EventHandler Collapse {
add { Events.AddHandler (CollapseEvent, value); }
remove { Events.RemoveHandler (CollapseEvent, value); }
}
#endif
public event EventHandler Popup {
add { Events.AddHandler (PopupEvent, value); }
......@@ -71,9 +67,7 @@ namespace System.Windows.Forms
#region Public Properties
[Localizable(true)]
#if NET_2_0
[DefaultValue (RightToLeft.No)]
#endif
public virtual RightToLeft RightToLeft {
get { return right_to_left; }
set { right_to_left = value; }
......@@ -89,7 +83,6 @@ namespace System.Windows.Forms
#region Public Methods
#if NET_2_0
protected internal virtual bool ProcessCmdKey (ref Message msg, Keys keyData, Control control)
{
src_control = control;
......@@ -102,7 +95,6 @@ namespace System.Windows.Forms
if (eh != null)
eh (this, e);
}
#endif
protected internal virtual void OnPopup (EventArgs e)
{
......@@ -121,12 +113,9 @@ namespace System.Windows.Forms
OnPopup (EventArgs.Empty);
pos = control.PointToScreen (pos);
MenuTracker.TrackPopupMenu (this, pos);
#if NET_2_0
OnCollapse (EventArgs.Empty);
#endif
}
#if NET_2_0
public void Show (Control control, Point pos, LeftRightAlignment alignment)
{
Point point;
......@@ -138,7 +127,6 @@ namespace System.Windows.Forms
Show (control, point);
}
#endif
#endregion Public Methods
internal void Hide ()
{
......
......@@ -25,7 +25,6 @@
// Authors:
// Jonathan Pobst (monkey@jpobst.com)
//
#if NET_2_0
using System.ComponentModel;
using System.Runtime.InteropServices;
......@@ -79,4 +78,3 @@ namespace System.Windows.Forms
}
}
}
#endif
......@@ -36,29 +36,23 @@ namespace System.Windows.Forms {
public class ControlBindingsCollection : BindingsCollection {
#region Fields
private Control control;
#if NET_2_0
private IBindableComponent bindable_component;
private DataSourceUpdateMode default_datasource_update_mode;
#endif
#endregion // Fields
#region Constructors
internal ControlBindingsCollection (Control control) {
this.control = control;
#if NET_2_0
bindable_component = control as IBindableComponent;
default_datasource_update_mode = DataSourceUpdateMode.OnValidation;
#endif
}
#if NET_2_0
public ControlBindingsCollection (IBindableComponent control)
{
bindable_component = control;
control = control as Control;
default_datasource_update_mode = DataSourceUpdateMode.OnValidation;
}
#endif
#endregion // Constructors
#region Public Instance Properties
......@@ -79,7 +73,6 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
public IBindableComponent BindableComponent {
get {
return bindable_component;
......@@ -94,7 +87,6 @@ namespace System.Windows.Forms {
default_datasource_update_mode = value;
}
}
#endif
#endregion // Public Instance Properties
#region Public Instance Methods
......@@ -110,14 +102,11 @@ namespace System.Windows.Forms {
throw new ArgumentNullException ("dataSource");
Binding res = new Binding (propertyName, dataSource, dataMember);
#if NET_2_0
res.DataSourceUpdateMode = default_datasource_update_mode;
#endif
Add (res);
return res;
}
#if NET_2_0
public Binding Add (string propertyName, object dataSource, string dataMember, bool formattingEnabled)
{
return Add (propertyName, dataSource, dataMember, formattingEnabled, default_datasource_update_mode, null, String.Empty, null);
......@@ -156,7 +145,6 @@ namespace System.Windows.Forms {
Add (res);
return res;
}
#endif
public new void Clear() {
base.Clear();
......@@ -183,11 +171,7 @@ namespace System.Windows.Forms {
if (dataBinding == null)
throw new ArgumentNullException ("dataBinding");
#if NET_2_0
if (dataBinding.Control != null && dataBinding.BindableComponent != bindable_component)
#else
if (dataBinding.Control != null && dataBinding.Control != control)
#endif
throw new ArgumentException ("dataBinding belongs to another BindingsCollection");
for (int i = 0; i < Count; i++) {
......@@ -201,11 +185,7 @@ namespace System.Windows.Forms {
}
}
#if NET_2_0
dataBinding.SetControl (bindable_component);
#else
dataBinding.SetControl (control);
#endif
dataBinding.Check ();
base.AddCore (dataBinding);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册