//============================================================ // Methods //============================================================ /// /// <summary> /// Notifies server controls that use composition-based implementation to create any child controls /// they contain in preparation for posting back or rendering. /// </summary> /// <remarks> /// If you override this method in a derived class, make sure you call this method as part of your /// base class's CreateChildControls. /// </remarks> /// protected override void CreateChildControls() { _realField = null; base.CreateChildControls(); _initialPage = new Uri(RTConstants.DefaultInitialPage); if (HttpContext.Current != null) { base.TextMode = TextBoxMode.MultiLine; if (EnableClientScript) { HttpBrowserCapabilities browserType = HttpContext.Current.Request.Browser; _realField = RichTextFieldFactory.GetField(this, browserType); } } if (_realField == null) { _realField = new DesignerRTField(this); } base.Width = RTConstants.MinimumControlWidth; base.Height = RTConstants.MinimumControlHeight; return; }
public static DefaultRTField GetField(RichTextBox richTextBox, HttpBrowserCapabilities browserCapabilities) { DefaultRTField field; BrowserType browserType = _parser.Parse(browserCapabilities); switch (browserType) { case BrowserType.IE5Up: case BrowserType.IE6Up: field = new IE5RTField(richTextBox); break; case BrowserType.IE7Up: field = new IE7RTField(richTextBox); break; case BrowserType.Mozilla: field = new MozRTField(richTextBox); break; case BrowserType.FireFox2: field = new Firefox2RTField(richTextBox); break; case BrowserType.WebKit: field = new WebKitRTField(richTextBox); break; default: field = new DefaultRTField(richTextBox); break; } return(field); }