Skip to content

Instantly share code, notes, and snippets.

@ca0v
Created December 4, 2014 17:35
Show Gist options
  • Save ca0v/1d1a2ae8a43f4e0bc1c7 to your computer and use it in GitHub Desktop.
Save ca0v/1d1a2ae8a43f4e0bc1c7 to your computer and use it in GitHub Desktop.
Typescript Hack to extend ContentPane
import Deferred = require('dojo/Deferred');
import ContentPane = require("dijit/layout/ContentPane");
import _WidgetBase = require("dijit/_WidgetBase");
/*
dijit/layout/ContentPane wrapper as native typescript class
Constructor replaces itself with the underlying ContentPane
*/
class MyContentPane implements ContentPane {
// IDeclared
declaredClass: string;
// _WidgetBase
id: string;
baseClass: string;
domNode: string;
// LayoutContainer
region: string;
layoutAlign: string;
layoutPriority: number;
// BorderContainer
splitter: boolean;
minSize: number;
maxSize: number;
// StackContainer
closable: boolean;
disabled: boolean;
selected: boolean;
showTitle: boolean;
// ContentPaneResizeMixin
doLayout: boolean;
isLayoutContainer: boolean;
// ContentPane
href: string;
content: string;
extractContent: boolean;
parseOnLoad: boolean;
preventCache: boolean;
preload: boolean;
refreshOnShow: boolean;
loadingMessage: string;
errorMessage: string;
isLoaded: boolean;
ioArgs: dojo.IMap;
onLoadDeferred: Deferred<any>;
constructor(props?: any, id?: string);
constructor(props?: any, element?: HTMLElement);
constructor(...args: any[]) {
return new ContentPane(args);
}
// IDeclared
inherited<T>(args: IArguments, params?: any[]): T;
inherited(args: IArguments, params?: any[]): void;
inherited() { return null }
isInstanceOf(constructor: any) { return false }
// Stateful
get(name: string) { return null; }
set(name: string, value: any, raiseChangeEvent?: boolean): void;
set(name: dojo.IMap): void;
set() { }
watch<T>(name: string, callback: (key: string, oldValue: T, newValue: T) => void): dojo.IHandle;
watch(callback: (key: string, oldValue: any, newValue: any) => void): dojo.IHandle;
watch() { return <dojo.IHandle>null; }
// _WidgetBase
buildRendering() { }
destroy(preserveDom?: boolean) { }
destroyDescendants(preserveDom?: boolean) { }
destroyRecursive(preserveDom?: boolean) { }
destroyRendering(preserveDom?: boolean) { }
emit(type: string, event?: any) { return false; }
getChildren() { return <_WidgetBase[]> null; }
getParent() { return <_WidgetBase> null; }
on(type: string, listener: Function);
on(type: dojo.IExtensionEvent, listener: Function);
on() { return <dojo.IHandle>null }
own(...args: any[]) { return <dojo.IHandle[]>null }
placeAt(id: string, position?: string): _WidgetBase;
placeAt(id: string, position?: number): _WidgetBase;
placeAt(element: HTMLElement, position?: string): _WidgetBase;
placeAt(element: HTMLElement, position?: number): _WidgetBase;
placeAt(widget: _WidgetBase, position?: string): _WidgetBase;
placeAt(widget: _WidgetBase, position?: number): _WidgetBase;
placeAt() { return <_WidgetBase> null; }
postMixInProperties() { }
postCreate() { }
startup() { }
// Container
addChild(widget: _WidgetBase, insertIndex?: number) { }
getIndexOfChild(child: _WidgetBase) {
return 0;
}
hasChildren() {
return false;
}
removeChild(widget: _WidgetBase): void;
removeChild(index: number): void;
removeChild() { }
// ContentPaneResizeMixin
resize(changeSize?: any, resultSize?: any) { }
// ContentPane
cancel() { }
onContentError(error: Error) { }
onDownloadEnd() { }
onDownloadError(error: Error) { }
onDownloadStart() { }
onLoad(data: any) { }
onUnload() { }
refresh(): Deferred<any> { return null }
}
export = MyContentPane;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment