public HtmlEngine(RichTextField box, Graphics g, Rectangle bounds, Font font, Color color) { this.box = box; this.g = g; this.bounds = bounds; context = new Context("", font, color, TextField.TextAlignmentType.Left); }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; if (button == null) { return; } button.onClick.Add(_clickHandler); int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); if (width == 0) { width = button.sourceWidth; } if (height == 0) { height = button.sourceHeight; } button.SetSize(width, height); button.text = element.GetString("value"); }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; if (comboBox == null) { return; } int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); if (width == 0) { width = comboBox.sourceWidth; } if (height == 0) { height = comboBox.sourceHeight; } comboBox.SetSize(width, height); comboBox.items = (string[])element.Get("items"); comboBox.values = (string[])element.Get("values"); comboBox.value = element.GetString("value"); }
public void Release() { _shape.RemoveEventListeners(); _owner = null; _element = null; }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; string type = element.GetString("type"); if (type != null) type = type.ToLower(); _hidden = type == "hidden"; if (!_hidden) { int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); _borderSize = element.GetInt("border", defaultBorderSize); Color borderColor = element.GetColor("border-color", defaultBorderColor); if (width == 0) { width = element.space - _borderSize * 2; if (width > _owner.width / 2 || width < 100) width = (int)_owner.width / 2; } if (height == 0) height = element.format.size + 10 + _borderSize * 2; textInput.textFormat = element.format; textInput.displayAsPassword = type == "password"; textInput.SetSize(width - _borderSize * 2, height - _borderSize * 2); textInput.maxLength = element.GetInt("maxlength", int.MaxValue); _border.size = new Vector2(width, height); _border.DrawRect(_borderSize, borderColor, new Color(0, 0, 0, 0)); } textInput.text = element.GetString("value"); }
public void Release() { textInput.RemoveEventListeners(); textInput.text = null; _owner = null; _element = null; }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; _shape.onClick.Add(_clickHandler); _shape.onRollOver.Add(_rolloverHandler); _shape.onRollOut.Add(_rolloutHandler); _shape.color = _owner.htmlParseOptions.linkBgColor; }
public void Release() { if (button != null) { button.RemoveEventListeners(); } _owner = null; _element = null; }
public void Release() { if (comboBox != null) { comboBox.RemoveEventListeners(); } _owner = null; _element = null; }
public void Remove() { if (button != null && button.displayObject.parent != null) { _owner.RemoveChild(button.displayObject); } _owner = null; _element = null; }
public void Remove() { if (comboBox != null && comboBox.displayObject.parent != null) { _owner.RemoveChild(comboBox.displayObject); } _owner = null; _element = null; }
private static Control CreateRichTextFieldControl(SPField field, SPList list, SPListItem item, SPControlMode mode) { RichTextField rtf = new RichTextField(); rtf.ListId = list.ID; rtf.ItemId = item.ID; rtf.FieldName = field.Title; rtf.ID = field.Title; rtf.ControlMode = mode; return(rtf); }
public virtual IHtmlObject CreateObject(RichTextField owner, HtmlElement element) { IHtmlObject ret = null; if (element.type == HtmlElementType.Image) { if (_imagePool.Count > 0 && Application.isPlaying) ret = _imagePool.Pop(); else ret = new HtmlImage(); } else if (element.type == HtmlElementType.Link) { if (_linkPool.Count > 0 && Application.isPlaying) ret = _linkPool.Pop(); else ret = new HtmlLink(); } else if (element.type == HtmlElementType.Input) { string type = element.GetString("type"); if (type != null) type = type.ToLower(); if (type == "button" || type == "submit") { if (_buttonPool.Count > 0 && Application.isPlaying) ret = _buttonPool.Pop(); else ret = new HtmlButton(); } else { if (_inputPool.Count > 0 && Application.isPlaying) ret = _inputPool.Pop(); else ret = new HtmlInput(); } } else if (element.type == HtmlElementType.Select) { if (_selectPool.Count > 0 && Application.isPlaying) ret = _selectPool.Pop(); else ret = new HtmlSelect(); } if (ret != null) { ret.Create(owner, element); if (ret.displayObject != null) ret.displayObject.home = owner.cachedTransform; } return ret; }
public void Remove() { if (shape.parent != null) { _owner.RemoveChild(shape); } shape.RemoveEventListeners(); _owner = null; _element = null; }
public void Release() { loader.RemoveEventListeners(); if (_externalTexture) { _owner.htmlPageContext.FreeImageTexture(this, loader.texture); } loader.url = null; _owner = null; _element = null; }
public void Remove() { if (!_hidden && textInput.displayObject.parent != null) { _owner.RemoveChild(_border); _owner.RemoveChild(textInput.displayObject); } textInput.text = null; _owner = null; _element = null; }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); NTexture texture = owner.htmlPageContext.GetImageTexture(this); if (texture != null) { if (width == 0) { width = texture.width; } if (height == 0) { height = texture.height; } loader.SetSize(width, height); loader.texture = texture; _externalTexture = true; } else { string src = element.GetString("src"); if (src != null && (width == 0 || height == 0)) { PackageItem pi = UIPackage.GetItemByURL(src); if (pi != null) { width = pi.width; height = pi.height; } } if (width == 0) { width = 5; } if (height == 0) { height = 10; } loader.SetSize(width, height); loader.url = src; _externalTexture = false; } }
public void Remove() { if (loader.displayObject.parent != null) { _owner.RemoveChild(loader.displayObject); } if (_externalTexture) { _owner.htmlPageContext.FreeImageTexture(this, loader.texture); } loader.url = null; _owner = null; _element = null; }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; shape.onClick.Add(_clickHandler); if (!Stage.touchScreen) { shape.onRollOver.Add(_rolloverHandler); shape.onRollOut.Add(_rolloutHandler); } else { shape.onTouchBegin.Add(_rolloverHandler); shape.onTouchEnd.Add(_rolloutHandler); } }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; _shape.onClick.Add(_clickHandler); if (!Stage.touchScreen) { _shape.onRollOver.Add(_rolloverHandler); _shape.onRollOut.Add(_rolloutHandler); } else { _shape.onTouchBegin.Add(_rolloverHandler); _shape.onTouchEnd.Add(_rolloutHandler); } _shape.color = _owner.htmlParseOptions.linkBgColor; }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); NTexture texture = owner.htmlPageContext.GetImageTexture(this); if (texture != null) { if (width == 0) width = texture.width; if (height == 0) height = texture.height; loader.SetSize(width, height); loader.texture = texture; _externalTexture = true; } else { string src = element.GetString("src"); if (src != null && (width == 0 || height == 0)) { PackageItem pi = UIPackage.GetItemByURL(src); if (pi != null) { width = pi.width; height = pi.height; } } if (width == 0) width = 5; if (height == 0) height = 10; loader.SetSize(width, height); loader.url = src; _externalTexture = false; } }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; string type = element.GetString("type"); if (type != null) { type = type.ToLower(); } _hidden = type == "hidden"; if (!_hidden) { int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); _borderSize = element.GetInt("border", defaultBorderSize); Color borderColor = element.GetColor("border-color", defaultBorderColor); if (width == 0) { width = element.space; if (width > _owner.width / 2 || width < 100) { width = (int)_owner.width / 2; } } if (height == 0) { height = element.format.size + 10 + _borderSize * 2; } textInput.textFormat = element.format; textInput.displayAsPassword = type == "password"; textInput.SetSize(width - _borderSize * 2, height - _borderSize * 2); textInput.maxLength = element.GetInt("maxlength", int.MaxValue); _border.SetXY(-_borderSize, -_borderSize); _border.SetSize(width, height); _border.DrawRect(_borderSize, borderColor, new Color(0, 0, 0, 0)); } textInput.text = element.GetString("value"); }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; if (button == null) return; int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); if (width == 0) width = button.sourceWidth; if (height == 0) height = button.sourceHeight; button.SetSize(width, height); button.text = element.GetString("value"); }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; if (comboBox == null) { return; } comboBox.onChanged.Add(_changeHandler); int width = element.GetInt("width", comboBox.sourceWidth); int height = element.GetInt("height", comboBox.sourceHeight); comboBox.SetSize(width, height); comboBox.items = (string[])element.Get("items"); comboBox.values = (string[])element.Get("values"); comboBox.value = element.GetString("value"); }
public void Create(RichTextField owner, HtmlElement element) { _owner = owner; _element = element; if (comboBox == null) return; int width = element.GetInt("width", 0); int height = element.GetInt("height", 0); if (width == 0) width = comboBox.sourceWidth; if (height == 0) height = comboBox.sourceHeight; comboBox.SetSize(width, height); comboBox.items = (string[])element.Get("items"); comboBox.values = (string[])element.Get("values"); comboBox.value = element.GetString("value"); }
virtual public IHtmlObject CreateObject(RichTextField owner, HtmlElement element) { IHtmlObject ret = null; bool fromPool = false; if (element.type == HtmlElementType.Image) { if (_imagePool.Count > 0 && _poolManager != null) { ret = _imagePool.Pop(); fromPool = true; } else { ret = new HtmlImage(); } } else if (element.type == HtmlElementType.Link) { if (_linkPool.Count > 0 && _poolManager != null) { ret = _linkPool.Pop(); fromPool = true; } else { ret = new HtmlLink(); } } else if (element.type == HtmlElementType.Input) { string type = element.GetString("type"); if (type != null) { type = type.ToLower(); } if (type == "button" || type == "submit") { if (_buttonPool.Count > 0 && _poolManager != null) { ret = _buttonPool.Pop(); fromPool = true; } else { ret = new HtmlButton(); } } else { if (_inputPool.Count > 0 && _poolManager != null) { ret = _inputPool.Pop(); fromPool = true; } else { ret = new HtmlInput(); } } } else if (element.type == HtmlElementType.Select) { if (_selectPool.Count > 0 && _poolManager != null) { ret = _selectPool.Pop(); fromPool = true; } else { ret = new HtmlSelect(); } } //Debug.Log("from=" + fromPool); if (ret != null) { //可能已经被GameObject tree deleted了,不再使用 if (fromPool && ret.displayObject != null && ret.displayObject.isDisposed) { ret.Dispose(); return(CreateObject(owner, element)); } ret.Create(owner, element); if (ret.displayObject != null) { ret.displayObject.home = owner.cachedTransform; } } return(ret); }
public void Release() { if (button != null) button.RemoveEventListeners(); _owner = null; _element = null; }
public void Remove() { if (button != null && button.displayObject.parent != null) _owner.RemoveChild(button.displayObject); _owner = null; _element = null; }
public void Release() { loader.RemoveEventListeners(); if (_externalTexture) _owner.htmlPageContext.FreeImageTexture(this, loader.texture); loader.url = null; _owner = null; _element = null; }
public void Remove() { if (loader.displayObject.parent != null) _owner.RemoveChild(loader.displayObject); if (_externalTexture) _owner.htmlPageContext.FreeImageTexture(this, loader.texture); loader.url = null; _owner = null; _element = null; }
public void Release() { if (comboBox != null) comboBox.RemoveEventListeners(); _owner = null; _element = null; }
virtual public IHtmlObject CreateObject(RichTextField owner, HtmlElement element) { IHtmlObject ret = null; if (element.type == HtmlElementType.Image) { if (_imagePool.Count > 0 && Application.isPlaying) { ret = _imagePool.Pop(); } else { ret = new HtmlImage(); } } else if (element.type == HtmlElementType.Input) { string type = element.GetString("type"); if (type != null) { type = type.ToLower(); } if (type == "button" || type == "submit") { if (_buttonPool.Count > 0 && Application.isPlaying) { ret = _buttonPool.Pop(); } else { ret = new HtmlButton(); } } else { if (_inputPool.Count > 0 && Application.isPlaying) { ret = _inputPool.Pop(); } else { ret = new HtmlInput(); } } } else if (element.type == HtmlElementType.Select) { if (_selectPool.Count > 0 && Application.isPlaying) { ret = _selectPool.Pop(); } else { ret = new HtmlSelect(); } } if (ret != null) { ret.Create(owner, element); } return(ret); }
public void Remove() { if (comboBox != null && comboBox.displayObject.parent != null) _owner.RemoveChild(comboBox.displayObject); _owner = null; _element = null; }
virtual public IHtmlObject CreateObject(RichTextField owner, HtmlElement element) { IHtmlObject ret = null; if (element.type == HtmlElementType.Image) { if (_imagePool.Count > 0) { ret = _imagePool.Pop(); } else { ret = new HtmlImage(); } } else if (element.type == HtmlElementType.Link) { if (_linkPool.Count > 0) { ret = _linkPool.Pop(); } else { ret = new HtmlLink(); } } else if (element.type == HtmlElementType.Input) { string type = element.GetString("type"); if (type != null) { type = type.ToLower(); } if (type == "button" || type == "submit") { if (_buttonPool.Count > 0) { ret = _buttonPool.Pop(); } else { ret = new HtmlButton(); } } else { if (_inputPool.Count > 0) { ret = _inputPool.Pop(); } else { ret = new HtmlInput(); } } } else if (element.type == HtmlElementType.Select) { if (_selectPool.Count > 0) { ret = _selectPool.Pop(); } else { ret = new HtmlSelect(); } } if (ret != null) { ret.Create(owner, element); if (ret.displayObject != null) { ret.displayObject.home = owner.cachedTransform; } } return(ret); }