import { InteractiveObject } from "../display/InteractiveObject"; import { TextFormat } from "./TextFormat"; import { DisplaySymbol, SymbolData } from "../symbol"; import { Bounds } from "../../base/utilities"; import { DisplayObject } from "../display/DisplayObject"; import { DataBuffer } from "@awayjs/graphics"; import { Rectangle } from "../geom/Rectangle"; import { TextLineMetrics } from "./TextLineMetrics"; import { ISecurityDomain } from "../../avm2/nat/ISecurityDomain"; import { ASArray } from "../../avm2/nat/ASArray"; import { LoaderInfo } from "../display/LoaderInfo"; /** * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export declare class TextField extends InteractiveObject { static classSymbols: string[]; static instanceSymbols: string[]; static classInitializer: any; _symbol: TextSymbol; applySymbol(): void; constructor(); protected _initializeFields(): void; _setFillAndLineBoundsFromSymbol(symbol: DisplaySymbol): void; _setFillAndLineBoundsFromWidthAndHeight(width: number, height: number): void; _canHaveTextContent(): boolean; _getTextContent(): any; _getContentBounds(includeStrokes?: boolean): Bounds; _containsPointDirectly(localX: number, localY: number, globalX: number, globalY: number): boolean; private _invalidateContent; _textContent: any; _lineMetricsData: DataBuffer; static isFontCompatible(fontName: string, fontStyle: string): boolean; _alwaysShowSelection: boolean; _antiAliasType: string; _autoSize: string; _background: boolean; _backgroundColor: number; _border: boolean; _borderColor: number; _bottomScrollV: number; _caretIndex: number; _condenseWhite: boolean; _embedFonts: boolean; _gridFitType: string; _htmlText: string; _length: number; _textInteractionMode: string; _maxChars: number; _maxScrollH: number; _maxScrollV: number; _mouseWheelEnabled: boolean; _multiline: boolean; _numLines: number; _displayAsPassword: boolean; _restrict: string; _scrollH: number; _scrollV: number; _selectable: boolean; _selectedText: string; _selectionBeginIndex: number; _selectionEndIndex: number; _sharpness: number; _styleSheet: StyleSheet; _textColor: number; _textHeight: number; _textWidth: number; _thickness: number; _type: string; _wordWrap: boolean; _useRichTextClipboard: boolean; get alwaysShowSelection(): boolean; set alwaysShowSelection(value: boolean); get antiAliasType(): string; set antiAliasType(antiAliasType: string); get autoSize(): string; set autoSize(value: string); get background(): boolean; set background(value: boolean); get backgroundColor(): number; set backgroundColor(value: number); get border(): boolean; set border(value: boolean); get borderColor(): number; set borderColor(value: number); get bottomScrollV(): number; get caretIndex(): number; get condenseWhite(): boolean; set condenseWhite(value: boolean); get defaultTextFormat(): TextFormat; set defaultTextFormat(format: TextFormat); get embedFonts(): boolean; set embedFonts(value: boolean); get gridFitType(): string; set gridFitType(gridFitType: string); get htmlText(): string; set htmlText(value: string); get length(): number; get textInteractionMode(): string; get maxChars(): number; set maxChars(value: number); get maxScrollH(): number; get maxScrollV(): number; get mouseWheelEnabled(): boolean; set mouseWheelEnabled(value: boolean); get multiline(): boolean; set multiline(value: boolean); get numLines(): number; get displayAsPassword(): boolean; set displayAsPassword(value: boolean); get restrict(): string; set restrict(value: string); get scrollH(): number; set scrollH(value: number); get scrollV(): number; set scrollV(value: number); get selectable(): boolean; set selectable(value: boolean); get selectedText(): string; get selectionBeginIndex(): number; get selectionEndIndex(): number; get sharpness(): number; set sharpness(value: number); get styleSheet(): StyleSheet; set styleSheet(value: StyleSheet); get text(): string; set text(value: string); get textColor(): number; set textColor(value: number); get textHeight(): number; get textWidth(): number; get thickness(): number; set thickness(value: number); get type(): string; set type(value: string); get wordWrap(): boolean; set wordWrap(value: boolean); get useRichTextClipboard(): boolean; set useRichTextClipboard(value: boolean); copyRichText(): void; pasteRichText(richText: string): void; getXMLText(beginIndex: number, endIndex?: number): string; insertXMLText(beginIndex: number, endIndex: number, richText: String, pasting: Boolean): void; private _ensureLineMetrics; appendText(newText: string): void; getCharBoundaries(charIndex: number): Rectangle; getCharIndexAtPoint(x: number, y: number): number; getFirstCharInParagraph(charIndex: number): number; getLineIndexAtPoint(x: number, y: number): number; getLineIndexOfChar(charIndex: number): number; getLineLength(lineIndex: number): number; getLineMetrics(lineIndex: number): TextLineMetrics; getLineOffset(lineIndex: number): number; getLineText(lineIndex: number): string; getParagraphLength(charIndex: number): number; /** * Returns a TextFormat object that contains the intersection of formatting information for the * range of text between |beginIndex| and |endIndex|. */ getTextFormat(beginIndex?: number, endIndex?: number): TextFormat; getTextRuns(beginIndex?: number, endIndex?: number): ASArray; getRawText(): string; replaceSelectedText(value: string): void; replaceText(beginIndex: number, endIndex: number, newText: string): void; setSelection(beginIndex: number, endIndex: number): void; setTextFormat(format: TextFormat, beginIndex?: number, endIndex?: number): void; getImageReference(id: string): DisplayObject; } export declare class TextSymbol extends DisplaySymbol { color: number; size: number; face: string; bold: boolean; italic: boolean; align: string; leftMargin: number; rightMargin: number; indent: number; leading: number; multiline: boolean; wordWrap: boolean; embedFonts: boolean; selectable: boolean; border: boolean; initialText: string; html: boolean; displayAsPassword: boolean; type: string; maxChars: number; autoSize: string; variableName: string; textContent: any; constructor(data: SymbolData, sec: ISecurityDomain); static FromTextData(data: any, loaderInfo: LoaderInfo): TextSymbol; /** * Turns raw DefineLabel tag data into an object that's consumable as a text symbol and then * passes that into `FromTextData`, returning the resulting TextSymbol. * * This has to be done outside the SWF parser because it relies on any used fonts being * available as symbols, which isn't the case in the SWF parser. */ static FromLabelData(data: any, loaderInfo: LoaderInfo): TextSymbol; }