interface RibbonBarType {
    addCategory: (
        name: string,
        title: string,
    ) => Promise<null | RibbonCategoryType>;
    findElementByName: (
        categoryName: string,
        panelName: string,
        btnName: string,
    ) => Promise<null | RibbonElementType>;
    getActiveCategory: () => Promise<null | RibbonCategoryType>;
    getCategoryByIndex: (index: number) => Promise<null | RibbonCategoryType>;
    getCategoryByName: (
        categoryName: string,
    ) => Promise<null | RibbonCategoryType>;
    getCategoryCount: () => Promise<number>;
    reCalcLayout: (reCalcPanels: boolean) => Promise<void>;
    setActiveCategory: (categoryName: string) => Promise<boolean>;
}

Implemented by

Properties

addCategory: (name: string, title: string) => Promise<null | RibbonCategoryType>

Add a category to the ribbon bar.

Type declaration

    • (name: string, title: string): Promise<null | RibbonCategoryType>
    • Parameters

      • name: string

        The name of the category, used to identify a specific category.

      • title: string

        The title of the category, used to display the category.

      Returns Promise<null | RibbonCategoryType>

      The RibbonCategory obj added to the ribbon bar.

const ribbonBar = await app.getRibbonBar(parentWnd);
const ribbonCategory = await ribbonBar.addCategory('categoryName', 'categoryTitle');
findElementByName: (
    categoryName: string,
    panelName: string,
    btnName: string,
) => Promise<null | RibbonElementType>

Find the RibbonElement object by the name of the category, panel, and element.

Type declaration

    • (
          categoryName: string,
          panelName: string,
          btnName: string,
      ): Promise<null | RibbonElementType>
    • Parameters

      • categoryName: string

        The name of the category, used to specify the required category.

      • panelName: string

        The name of the panel, used to specify the required panel.

      • btnName: string

        The name of the element, used to specify the required element.

      Returns Promise<null | RibbonElementType>

      • Get the specified RibbonElement object.
getActiveCategory: () => Promise<null | RibbonCategoryType>

Get the active category.

Type declaration

getCategoryByIndex: (index: number) => Promise<null | RibbonCategoryType>

Get the category object by index.

Type declaration

    • (index: number): Promise<null | RibbonCategoryType>
    • Parameters

      • index: number

        The index of the category. This value can be iterated through from getCategoryCount.

      Returns Promise<null | RibbonCategoryType>

      Get the specified category object.

const parentWnd = await LPVOID.create();
const ribbonBar = await app.getRibbonBar(parentWnd);
const categoryCount = await ribbonBar.getCategoryCount(0);
for (let i = 0; i < categoryCount; i++) {
const ribbonCategory = await ribbonBar.getCategoryByIndex(i);
}
getCategoryByName: (categoryName: string) => Promise<null | RibbonCategoryType>

Get the category object by name.

Type declaration

    • (categoryName: string): Promise<null | RibbonCategoryType>
    • Parameters

      • categoryName: string

        The name of the category.

      Returns Promise<null | RibbonCategoryType>

      • Get the specified category object.
getCategoryCount: () => Promise<number>

Get the number of categories in the ribbon bar.

Type declaration

    • (): Promise<number>
    • Returns Promise<number>

      The number of categories in the ribbon bar.

const parentWnd = await LPVOID.create();
const ribbonBar = await app.getRibbonBar(parentWnd);
const categoryCount = await ribbonBar.getCategoryCount();
reCalcLayout: (reCalcPanels: boolean) => Promise<void>

Recalculate the layout of the ribbon bar.

Type declaration

    • (reCalcPanels: boolean): Promise<void>
    • Parameters

      • reCalcPanels: boolean

        Whether to recalculate the layout of the panel.

      Returns Promise<void>

setActiveCategory: (categoryName: string) => Promise<boolean>

Set the active category by name.

Type declaration

    • (categoryName: string): Promise<boolean>
    • Parameters

      • categoryName: string

        The name of the category that needs to be activated.

      Returns Promise<boolean>

      • Whether the category is activated successfully.