import Stateful = require("dojo/Stateful"); import Destroyable = require("./Destroyable"); import { ExtensionEvent } from "dojo/on"; import { NodeFragmentOrString, Handle, NodeOrString, WatchHandle } from "dojo/interfaces"; import dojo = require("dojo/_base/kernel"); declare namespace _WidgetBase { interface _WidgetBase extends Stateful, Destroyable { /** * A unique, opaque ID string that can be assigned by users or by the * system. If the developer passes an ID which is known not to be * unique, the specified ID is ignored and the system-generated ID is * used instead. */ id: string; /** * Rarely used. Overrides the default Dojo locale used to render this widget, * as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute. * Value must be among the list of locales specified during by the Dojo bootstrap, * formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us). */ lang: string; /** * Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir) * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's * default direction. */ dir: string; /** * HTML class attribute */ class: string; /** * HTML style attributes as cssText string or name/value hash */ style: string; /** * HTML title attribute. * * For form widgets this specifies a tooltip to display when hovering over * the widget (just like the native HTML title attribute). * * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's * interpreted as HTML. */ title: string; /** * When this widget's title attribute is used to for a tab label, accordion pane title, etc., * this specifies the tooltip to appear when the mouse is hovered over that text. */ tooltip: string; /** * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate * widget state. */ baseClass: string; /** * pointer to original DOM node */ srcNodeRef: HTMLElement; /** * This is our visible representation of the widget! Other DOM * Nodes may by assigned to other properties, usually through the * template system's data-dojo-attach-point syntax, but the domNode * property is the canonical "top level" node in widget UI. */ domNode: HTMLElement; /** * Designates where children of the source DOM node will be placed. * "Children" in this case refers to both DOM nodes and widgets. */ containerNode: HTMLElement; /** * The document this widget belongs to. If not specified to constructor, will default to * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global */ ownerDocument: HTMLElement; /** * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute * for each XXX attribute to be mapped to the DOM. */ attributeMap: { [attribute: string]: any }; /** * Bi-directional support, the main variable which is responsible for the direction of the text. * The text direction can be different than the GUI direction by using this parameter in creation * of a widget. */ textDir: string; /** * Kicks off widget instantiation. See create() for details. */ postscript(params?: any, srcNodeRef?: HTMLElement): void; /** * Kick off the life-cycle of a widget */ create(params?: any, srcNodeRef?: HTMLElement): void; /** * Called after the parameters to the widget have been read-in, * but before the widget template is instantiated. Especially * useful to set properties that are referenced in the widget * template. */ postMixInProperties(): void; /** * Construct the UI for this widget, setting this.domNode. * Most widgets will mixin `dijit._TemplatedMixin`, which implements this method. */ buildRendering(): void; /** * Processing after the DOM fragment is created */ postCreate(): void; /** * Processing after the DOM fragment is added to the document */ startup(): void; /** * Destroy this widget and its descendants */ destroyRecursive(preserveDom?: boolean): void; /** * Destroys the DOM nodes associated with this widget. */ destroyRendering(preserveDom?: boolean): void; /** * Recursively destroy the children of this widget and their * descendants. */ destroyDescendants(preserveDom?: boolean): void; /** * Deprecated. Override destroy() instead to implement custom widget tear-down * behavior. */ uninitialize(): boolean; /** * Used by widgets to signal that a synthetic event occurred, ex: * | myWidget.emit("attrmodified-selectedChildWidget", {}). */ emit(type: string, eventObj?: any, callbackArgs?: any[]): any; /** * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). */ on(type: string | ExtensionEvent, func: EventListener | Function): WatchHandle; /** * Returns a string that represents the widget. */ toString(): string; /** * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent * is this widget. Note that it does not return all descendants, but rather just direct children. */ getChildren(): T[]; /** * Returns the parent widget of this widget. */ getParent(): T; /** * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. */ connect(obj: any, event: string | ExtensionEvent, method: string | EventListener): WatchHandle; /** * Deprecated, will be removed in 2.0, use handle.remove() instead. */ disconnect(handle: WatchHandle): void; /** * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. */ subscribe(t: string, method: EventListener): WatchHandle; /** * Deprecated, will be removed in 2.0, use handle.remove() instead. */ unsubscribe(handle: WatchHandle): void; /** * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) */ isLeftToRight(): boolean; /** * Return true if this widget can currently be focused * and false if not */ isFocusable(): boolean; /** * Place this widget somewhere in the DOM based * on standard domConstruct.place() conventions. */ placeAt(reference: NodeFragmentOrString | T, position?: string | number): this; /** * Wrapper to setTimeout to avoid deferred functions executing * after the originating widget has been destroyed. * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). */ defer(fcn: Function, delay?: number): Handle; } interface _WidgetBaseConstructor extends dojo._base.DeclareConstructor { new(params: Object, srcNodeRef?: NodeOrString): W; } } type _WidgetBase = _WidgetBase._WidgetBase; declare const _WidgetBase: _WidgetBase._WidgetBaseConstructor; export = _WidgetBase;