[ClassInterface (ClassInterfaceType.AutoDispatch)]
[Docking (DockingBehavior.Ask)]
[ComVisible (true)]
+ [Designer ("System.Windows.Forms.Design.RichTextBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
#endif
public class RichTextBox : TextBoxBase {
#region Local Variables
private int rtf_cursor_y;
private int rtf_chars;
private int rtf_par_line_left_indent;
+
+#if NET_2_0
+ private bool enable_auto_drag_drop;
+ private RichTextBoxLanguageOptions language_option;
+ private bool rich_text_shortcuts_enabled;
+ private Color selection_back_color;
+#endif
#endregion // Local Variables
#region Public Constructors
BackColor = ThemeEngine.Current.ColorWindow;
#if NET_2_0
backcolor_set = false;
+ language_option = RichTextBoxLanguageOptions.AutoFontSizeAdjust;
+ rich_text_shortcuts_enabled = true;
+ selection_back_color = DefaultBackColor;
#endif
ForeColor = ThemeEngine.Current.ColorWindowText;
set { base.BackgroundImage = value; }
}
+#if NET_2_0
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override ImageLayout BackgroundImageLayout {
+ get { return base.BackgroundImageLayout; }
+ set { base.BackgroundImageLayout = value; }
+ }
+#endif
+
[DefaultValue(0)]
[Localizable(true)]
public int BulletIndent {
}
}
+#if NET_2_0
+ [MonoTODO ("Stub")]
+ [DefaultValue (false)]
+ public bool EnableAutoDragDrop {
+ get { return enable_auto_drag_drop; }
+ set { enable_auto_drag_drop = value; }
+ }
+#endif
+
public override Font Font {
get {
return base.Font;
}
}
+#if NET_2_0
+ [MonoTODO ("Stub")]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public RichTextBoxLanguageOptions LanguageOption {
+ get { return language_option; }
+ set { language_option = value; }
+ }
+#endif
+
[DefaultValue(Int32.MaxValue)]
public override int MaxLength {
get {
}
}
+#if NET_2_0
+ [MonoTODO ("Stub")]
+ [Browsable (false)]
+ [DefaultValue (true)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public bool RichTextShortcutsEnabled {
+ get { return rich_text_shortcuts_enabled; }
+ set { rich_text_shortcuts_enabled = value; }
+ }
+#endif
+
[DefaultValue(0)]
[Localizable(true)]
[MonoTODO("Teach TextControl.RecalculateLine to consider the right margin as well")]
throw new InvalidEnumArgumentException ("value", (int) value,
typeof (RichTextBoxScrollBars));
- scrollbars = value;
+ if (value != scrollbars) {
+ scrollbars = value;
+ CalculateDocument ();
+ }
}
}
}
}
+#if NET_2_0
+ [MonoTODO ("Stub")]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public Color SelectionBackColor {
+ get { return selection_back_color; }
+ set { selection_back_color = value; }
+ }
+#endif
+
[Browsable(false)]
[DefaultValue(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
return Find(str, -1, -1, options);
}
- public
-#if NET_2_0
- override
-#endif
- char GetCharFromPosition(Point pt) {
+
+#if !NET_2_0
+ public char GetCharFromPosition(Point pt) {
LineTag tag;
int pos;
}
return tag.line.text[pos];
-
}
+#else
+ internal override char GetCharFromPositionInternal (Point p)
+ {
+ LineTag tag;
+ int pos;
+
+ PointToTagPos (p, out tag, out pos);
+
+ if (pos >= tag.line.text.Length)
+ return '\n';
+
+ return tag.line.text[pos];
+ }
+#endif
public
#if NET_2_0
// }
}
+#if NET_2_0
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new void DrawToBitmap (Bitmap bitmap, Rectangle clip)
+ {
+ Graphics dc = Graphics.FromImage (bitmap);
+
+ if (backcolor_set || (Enabled && !read_only)) {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), clip);
+ } else {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorControl), clip);
+ }
+
+ // Draw the viewable document
+ document.Draw (dc, clip);
+ }
+#endif
+
#endregion // Public Instance Methods
#region Protected Instance Methods
eh (this, e);
}
+#if !NET_2_0
protected override void OnSystemColorsChanged(EventArgs e) {
base.OnSystemColorsChanged (e);
}
protected override void OnTextChanged(EventArgs e) {
base.OnTextChanged (e);
}
+#endif
protected virtual void OnVScroll(EventArgs e) {
EventHandler eh = (EventHandler)(Events [VScrollEvent]);
protected override void WndProc(ref Message m) {
base.WndProc (ref m);
}
+
+#if NET_2_0
+ protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
+ {
+ return base.ProcessCmdKey (ref msg, keyData);
+ }
+#endif
#endregion // Protected Instance Methods
#region Events
remove { base.BackgroundImageChanged -= value; }
}
+#if NET_2_0
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageLayoutChanged {
+ add { base.BackgroundImageLayoutChanged += value; }
+ remove { base.BackgroundImageLayoutChanged -= value; }
+ }
+#endif
+
public event ContentsResizedEventHandler ContentsResized {
add { Events.AddHandler (ContentsResizedEvent, value); }
remove { Events.RemoveHandler (ContentsResizedEvent, value); }
}
+#if !NET_2_0
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new event EventHandler DoubleClick {
add { base.DoubleClick += value; }
remove { base.DoubleClick -= value; }
}
+#endif
[Browsable(false)]
#if !NET_2_0
rtf_chars += rtf_line.Length;
+
+
if (rtf_cursor_x == 0) {
- document.Add(rtf_cursor_y, rtf_line.ToString(), rtf_rtfalign, font, rtf_color, LineEnding.Wrap);
+ document.Add(rtf_cursor_y, rtf_line.ToString(), rtf_rtfalign, font, rtf_color,
+ newline ? LineEnding.Rich : LineEnding.Wrap);
if (rtf_par_line_left_indent != 0) {
Line line = document.GetLine (rtf_cursor_y);
line.indent = rtf_par_line_left_indent;
line.indent = rtf_par_line_left_indent;
if (rtf_line.Length > 0) {
document.InsertString(line, rtf_cursor_x, rtf_line.ToString());
- document.FormatText(line, rtf_cursor_x + 1, line, rtf_cursor_x + 1 + length, font, rtf_color, null, FormatSpecified.Font | FormatSpecified.Color); // FormatText is 1-based
+ document.FormatText (line, rtf_cursor_x + 1, line, rtf_cursor_x + 1 + length,
+ font, rtf_color, null,
+ FormatSpecified.Font | FormatSpecified.Color);
}
if (newline) {
document.Split(line, rtf_cursor_x + length);
+ line = document.GetLine (rtf_cursor_y);
+ line.ending = LineEnding.Rich;
}
}
}
}
- pos = tag.start + tag.length - 1;
+ pos = tag.start + tag.Length - 1;
tag = tag.next;
}
pos = 0;
// Emit the string itself
if (line_no != end_line.line_no) {
- EmitRTFText(sb, tag.line.text.ToString(pos, tag.start + tag.length - pos - 1));
+ EmitRTFText(sb, tag.line.text.ToString(pos, tag.start + tag.Length - pos - 1));
} else {
- if (end_pos < (tag.start + tag.length - 1)) {
+ if (end_pos < (tag.start + tag.Length - 1)) {
// Emit partial tag only, end_pos is inside this tag
EmitRTFText(sb, tag.line.text.ToString(pos, end_pos - pos));
} else {
- EmitRTFText(sb, tag.line.text.ToString(pos, tag.start + tag.length - pos - 1));
+ EmitRTFText(sb, tag.line.text.ToString(pos, tag.start + tag.Length - pos - 1));
}
}
- pos = tag.start + tag.length - 1;
+ pos = tag.start + tag.Length - 1;
tag = tag.next;
}
if (pos >= line.text.Length) {