本文整理匯總了TypeScript中@phosphor/widgets.PanelLayout.insertWidget方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PanelLayout.insertWidget方法的具體用法?TypeScript PanelLayout.insertWidget怎麽用?TypeScript PanelLayout.insertWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@phosphor/widgets.PanelLayout
的用法示例。
在下文中一共展示了PanelLayout.insertWidget方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: insertItem
/**
* Insert an item into the toolbar at the specified index.
*
* @param index - The index at which to insert the item.
*
* @param name - The name of the item.
*
* @param widget - The widget to add.
*
* @returns Whether the item was added to the toolbar. Returns false if
* an item of the same name is already in the toolbar.
*
* #### Notes
* The index will be clamped to the bounds of the items.
*/
insertItem(index: number, name: string, widget: T): boolean {
let existing = find(this.names(), value => value === name);
if (existing) {
return false;
}
widget.addClass(TOOLBAR_ITEM_CLASS);
let layout = this.layout as PanelLayout;
layout.insertWidget(index, widget);
Private.nameProperty.set(widget, name);
return true;
}