using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
-#if NET_2_0
using System.Collections.Generic;
using System.Runtime.InteropServices;
-#endif
namespace System.Windows.Forms {
-#if NET_2_0
[ComVisible(true)]
[ClassInterface (ClassInterfaceType.AutoDispatch)]
[Designer ("System.Windows.Forms.Design.TextBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
-#endif
public class TextBox : TextBoxBase {
#region Variables
private ContextMenu menu;
private MenuItem delete;
private MenuItem select_all;
-#if NET_2_0
private bool use_system_password_char;
private AutoCompleteStringCollection auto_complete_custom_source;
private AutoCompleteMode auto_complete_mode = AutoCompleteMode.None;
private int auto_complete_selected_index = -1;
private List<string> auto_complete_matches;
private ComboBox auto_complete_cb_source;
-#endif
#endregion // Variables
#region Public Constructors
alignment = HorizontalAlignment.Left;
this.LostFocus +=new EventHandler(TextBox_LostFocus);
this.RightToLeftChanged += new EventHandler (TextBox_RightToLeftChanged);
-#if NET_2_0
MouseWheel += new MouseEventHandler (TextBox_MouseWheel);
-#endif
BackColor = SystemColors.Window;
ForeColor = SystemColors.WindowText;
private void TextBox_LostFocus (object sender, EventArgs e) {
if (hide_selection)
document.InvalidateSelectionArea ();
-#if NET_2_0
if (auto_complete_listbox != null && auto_complete_listbox.Visible)
auto_complete_listbox.HideListBox (false);
-#endif
}
-#if NET_2_0
private void TextBox_MouseWheel (object o, MouseEventArgs args)
{
if (auto_complete_listbox == null || !auto_complete_listbox.Visible)
internal virtual void OnAutoCompleteValueSelected (EventArgs args)
{
}
-#endif
private void UpdateAlignment ()
{
internal override Color ChangeBackColor (Color backColor)
{
if (backColor == Color.Empty) {
-#if NET_2_0
if (!ReadOnly)
backColor = SystemColors.Window;
-#else
- backColor = SystemColors.Window;
-#endif
+
backcolor_set = false;
}
+
return backColor;
}
-#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
#endregion // Private & Internal Methods
#region Public Instance Properties
-#if NET_2_0
[MonoTODO("AutoCompletion algorithm is currently not implemented.")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[Browsable (true)]
}
}
}
-#endif
[DefaultValue(false)]
[MWFCategory("Behavior")]
[Localizable(true)]
[DefaultValue('\0')]
[MWFCategory("Behavior")]
-#if NET_2_0
[RefreshProperties (RefreshProperties.Repaint)]
-#endif
public char PasswordChar {
get {
-#if NET_2_0
if (use_system_password_char) {
return '*';
}
-#endif
return password_char;
}
}
}
-#if ONLY_1_1
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public override int SelectionLength {
- get {
- return base.SelectionLength;
- }
- set {
- base.SelectionLength = value;
- }
- }
-#endif
-
public override string Text {
get {
return base.Text;
}
#endregion // Public Instance Properties
-#if NET_2_0
public void Paste (string text)
{
document.ReplaceSelection (CaseAdjust (text), false);
ScrollToCaret();
OnTextChanged(EventArgs.Empty);
}
-#endif
#region Protected Instance Methods
protected override CreateParams CreateParams {
get {
}
}
-#if ONLY_1_1
- protected override ImeMode DefaultImeMode {
- get {
- return base.DefaultImeMode;
- }
- }
-#endif
-#if NET_2_0
protected override void Dispose (bool disposing)
{
base.Dispose (disposing);
}
-#endif
protected override bool IsInputKey (Keys keyData)
{
base.OnHandleCreated (e);
}
-#if ONLY_1_1
- protected override void OnMouseUp(MouseEventArgs mevent)
- {
- base.OnMouseUp (mevent);
- }
-#endif
-
protected virtual void OnTextAlignChanged (EventArgs e)
{
EventHandler eh = (EventHandler)(Events [TextAlignChangedEvent]);
protected override void WndProc (ref Message m)
{
switch ((Msg)m.Msg) {
-#if NET_2_0
case Msg.WM_KEYDOWN:
if (!IsAutoCompleteAvailable)
break;
ProcessAutoCompleteInput (ref m, char_value == 8);
return;
-#endif
case Msg.WM_LBUTTONDOWN:
// When the textbox gets focus by LBUTTON (but not by middle or right)
// it does not do the select all / scroll thing.
}
#endregion // Private Methods
-#if NET_2_0
public override bool Multiline {
get {
return base.Multiline;
ThemeEngine.Current.CPDrawSizeGrip (g, SystemColors.Control, resizer_bounds);
}
}
-#endif
}
-#if NET_2_0
internal class TextBoxAutoCompleteSourceConverter : EnumConverter
{
public TextBoxAutoCompleteSourceConverter(Type type)
return new StandardValuesCollection(arr2);
}
}
-#endif
}