mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #1781 from drewnoakes/master
Add declarations for "Dock Spawn" library.
This commit is contained in:
@@ -62,6 +62,7 @@ List of Definitions
|
||||
* [d3.js](http://d3js.org/) (from TypeScript samples)
|
||||
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
|
||||
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
|
||||
* [Dock Spawn](http://dockspawn.com) (by [Drew Noakes](https://drewnoakes.com))
|
||||
* [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton))
|
||||
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
|
||||
* [doT](https://github.com/olado/doT) (by [ZombieHunter](https://github.com/ZombieHunter))
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="dock-spawn.d.ts" />
|
||||
|
||||
var dockManagerDiv = document.createElement('div'),
|
||||
panelDiv1 = document.createElement('div'),
|
||||
panelDiv2 = document.createElement('div'),
|
||||
panelDiv3 = document.createElement('div');
|
||||
|
||||
document.body.appendChild(dockManagerDiv);
|
||||
|
||||
var dockManager = new dockspawn.DockManager(dockManagerDiv);
|
||||
dockManager.initialize();
|
||||
|
||||
var panelContainer1 = new dockspawn.PanelContainer(panelDiv1, dockManager),
|
||||
panelContainer2 = new dockspawn.PanelContainer(panelDiv2, dockManager),
|
||||
panelContainer3 = new dockspawn.PanelContainer(panelDiv3, dockManager);
|
||||
|
||||
var documentNode = dockManager.context.model.documentManagerNode;
|
||||
|
||||
var panelNode1 = dockManager.dockLeft(documentNode, panelContainer1, 0.33),
|
||||
panelNode2 = dockManager.dockRight(documentNode, panelContainer2, 0.33),
|
||||
panelNode3 = dockManager.dockFill(documentNode, panelContainer3);
|
||||
|
||||
Vendored
+180
@@ -0,0 +1,180 @@
|
||||
// Type definitions for Dock Spawn
|
||||
// Project: http://dockspawn.com
|
||||
// https://github.com/coderespawn/dock-spawn
|
||||
// Definitions by: Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped/dock-spawn
|
||||
|
||||
declare module dockspawn
|
||||
{
|
||||
/**
|
||||
* Dock manager manages all the dock panels in a hierarchy, similar to Visual Studio.
|
||||
* It owns an HTMLDivElement inside which all panels are docked.
|
||||
* Initially the document manager takes up the central space and acts as the root node.
|
||||
*/
|
||||
class DockManager
|
||||
{
|
||||
context: DockManagerContext;
|
||||
|
||||
constructor(element: HTMLDivElement);
|
||||
|
||||
initialize(): void;
|
||||
|
||||
rebuildLayout(node: DockNode): void;
|
||||
|
||||
invalidate(): void;
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
|
||||
/**
|
||||
* Reset the dock model. This happens when state is loaded from JSON.
|
||||
*/
|
||||
setModel(model: DockModel): void;
|
||||
|
||||
setRootNode(node: DockNode): void;
|
||||
|
||||
|
||||
/** Dock the [dialog] to the left of the [referenceNode] node */
|
||||
|
||||
dockDialogLeft(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] to the right of the [referenceNode] node */
|
||||
dockDialogRight(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] above the [referenceNode] node */
|
||||
dockDialogUp(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] below the [referenceNode] node */
|
||||
dockDialogDown(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] as a tab inside the [referenceNode] node */
|
||||
dockDialogFill(referenceNode: DockNode, container: PanelContainer): DockNode;
|
||||
|
||||
/** Dock the [container] to the left of the [referenceNode] node */
|
||||
dockLeft(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] to the right of the [referenceNode] node */
|
||||
dockRight(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] above the [referenceNode] node */
|
||||
dockUp(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] below the [referenceNode] node */
|
||||
dockDown(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] as a tab inside the [referenceNode] node */
|
||||
dockFill(referenceNode: DockNode, container: PanelContainer): DockNode;
|
||||
|
||||
suspendLayout(): void;
|
||||
|
||||
resumeLayout(): void;
|
||||
|
||||
saveState(): string;
|
||||
loadState(state: string): void;
|
||||
}
|
||||
|
||||
class DockManagerContext
|
||||
{
|
||||
dockManager: DockManager;
|
||||
model: DockModel;
|
||||
documentManagerView: DocumentManagerContainer;
|
||||
|
||||
constructor(dockManager: DockManager);
|
||||
}
|
||||
|
||||
class DockModel
|
||||
{
|
||||
rootNode: DockNode;
|
||||
documentManagerNode: DockNode;
|
||||
}
|
||||
|
||||
class DockNode
|
||||
{
|
||||
constructor(container: PanelContainer);
|
||||
|
||||
detachFromParent(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab Host control contains tabs known as TabPages.
|
||||
* The tab strip can be aligned in different orientations
|
||||
*/
|
||||
class TabHost
|
||||
{
|
||||
tabStripDirection: TabStripDirection;
|
||||
displayCloseButton: boolean;
|
||||
pages: TabPage[];
|
||||
hostElement: HTMLDivElement;
|
||||
tabListElement: HTMLDivElement;
|
||||
separatorElement: HTMLDivElement;
|
||||
contentElement: HTMLDivElement;
|
||||
|
||||
constructor(tabStripDirection?: TabStripDirection, displayCloseButton?: boolean)
|
||||
|
||||
setActiveTab(container: PanelContainer): void;
|
||||
|
||||
/** Set the selected TabPage. */
|
||||
onTabPageSelected(page: TabPage): void;
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
}
|
||||
|
||||
class TabPage
|
||||
{
|
||||
constructor(host: TabHost, container: PanelContainer);
|
||||
}
|
||||
|
||||
enum TabStripDirection
|
||||
{
|
||||
DIRECTION_TOP = 0,
|
||||
DIRECTION_BOTTOM = 1,
|
||||
DIRECTION_LEFT = 2,
|
||||
DIRECTION_RIGHT = 3
|
||||
}
|
||||
|
||||
class FillDockContainer
|
||||
{
|
||||
tabOrientation: TabStripDirection;
|
||||
element: HTMLDivElement;
|
||||
tabHost: TabHost;
|
||||
dockManager: DockManager;
|
||||
name: string;
|
||||
containerType: string;
|
||||
minimumAllowedChildNodes: number;
|
||||
|
||||
constructor(dockManager: DockManager, tabStripDirection?: TabStripDirection)
|
||||
}
|
||||
|
||||
/**
|
||||
* The document manager is then central area of the dock layout hierarchy.
|
||||
* This is where more important panels are placed (e.g. the text editor in an IDE,
|
||||
* 3D view in a modelling package etc
|
||||
*/
|
||||
class DocumentManagerContainer extends FillDockContainer
|
||||
{
|
||||
selectedTab: TabPage;
|
||||
|
||||
constructor(dockManager: DockManager);
|
||||
|
||||
saveState(state: string): void;
|
||||
}
|
||||
|
||||
class PanelContainer
|
||||
{
|
||||
width: number;
|
||||
height: number;
|
||||
|
||||
constructor(element: HTMLElement, dockManager: DockManager, title?: string);
|
||||
|
||||
setTitle(title: string): void;
|
||||
setTitleIcon(iconName: string): void;
|
||||
}
|
||||
|
||||
class Dialog
|
||||
{
|
||||
static fromElement(id: string, dockManager: DockManager): Dialog;
|
||||
|
||||
constructor(panel: PanelContainer, dockManager: DockManager);
|
||||
|
||||
setPosition(x: number, y: number): void;
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
|
||||
setTitle(title: string): void;
|
||||
|
||||
setTitleIcon(iconName: string): void;
|
||||
|
||||
bringToFront(): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user