{
  "name": "Toolbar",
  "platform": [
    "macOS"
  ],
  "component": "gui",
  "header": "nativeui/toolbar.h",
  "type": "Class",
  "namespace": "nu",
  "description": "Window toolbar.",
  "detail": "This view is only implemented for macOS by wrapping\n[`NSToolbar`](https://developer.apple.com/documentation/appkit/nstoolbar).\nThe API is still experimental and will be changed in future. Currently certain\nitems are not aligned correctly in toolbar.\n\nThe toolbar items are not added manually like the normal views, instead you\nhave to implement the `get_item` delegate which creates items on request, and\nthen call `SetDefaultItemIdentifiers` to specify the default items to show.\n\n```js\nconst toolbar = gui.Toolbar.create('my-toolbar')\ntoolbar.getItem = (toolbar, identifier) => {\n  switch (identifier) {\n    case 'entry':\n      const entry = gui.Entry.create()\n      const minSize = entry.getMinimumSize()\n      minSize.width = 200\n      const maxSize = { width: 2 << 30 - 1, height: minSize.height }\n      return { label: 'Address', view: entry, minSize, maxSize }\n    case 'button':\n      const button = gui.Button.create('GO')\n      button.setImage(gui.Image.createFromPath('go.png'))\n      return {\n        label: 'GO',\n        minSize: {width: 30, height: 35},\n        view: button\n      }\n  }\n}\ntoolbar.setDefaultItemIdentifiers(['entry', 'button'])\ntoolbar.setDisplayMode('icon')\nwindow.setToolbar(toolbar)\n```\n",
  "class_methods": [
    {
      "signature": {
        "returnType": {
          "name": "Toolbar",
          "id": "toolbar"
        },
        "name": "create",
        "parameters": [
          {
            "type": {
              "name": "string"
            },
            "name": "identifier"
          }
        ],
        "shortStr": "create(identifier)",
        "str": "create(identifier)"
      },
      "description": "Create a new `Toolbar` view with `identifier`.\n\nWithin the application all toolbars with the same identifier are\nsynchronized to maintain the same state, including for example, the\ndisplay mode and item order. The identifier is used as the autosave name\nfor toolbars that save their configuration.\n",
      "id": "create-identifier"
    }
  ],
  "methods": [
    {
      "signature": {
        "name": "setdefaultitemidentifiers",
        "parameters": [
          {
            "type": {
              "name": "table"
            },
            "name": "identifiers",
            "description": "An array of toolbar items' identifiers."
          }
        ],
        "shortStr": "setdefaultitemidentifiers(identifiers)",
        "str": "setdefaultitemidentifiers(identifiers)"
      },
      "description": "Set the identifiers of default items that would show in toolbar.\n",
      "id": "setdefaultitemidentifiers-identifiers"
    },
    {
      "signature": {
        "name": "setalloweditemidentifiers",
        "parameters": [
          {
            "type": {
              "name": "table"
            },
            "name": "identifiers",
            "description": "An array of toolbar items' identifiers."
          }
        ],
        "shortStr": "setalloweditemidentifiers(identifiers)",
        "str": "setalloweditemidentifiers(identifiers)"
      },
      "description": "Set the identifiers of the items that are allowed to show in toolbar.\n",
      "id": "setalloweditemidentifiers-identifiers"
    },
    {
      "signature": {
        "name": "setallowcustomization",
        "parameters": [
          {
            "type": {
              "name": "boolean"
            },
            "name": "allow"
          }
        ],
        "shortStr": "setallowcustomization(allow)",
        "str": "setallowcustomization(allow)"
      },
      "description": "Set whether users are allowed to customize the toolbar.\n",
      "id": "setallowcustomization-allow"
    },
    {
      "signature": {
        "name": "setdisplaymode",
        "parameters": [
          {
            "type": {
              "name": "Toolbar::DisplayMode",
              "id": "toolbar_displaymode"
            },
            "name": "mode"
          }
        ],
        "shortStr": "setdisplaymode(mode)",
        "str": "setdisplaymode(mode)"
      },
      "description": "Set the display mode of the toolbar items.",
      "id": "setdisplaymode-mode"
    },
    {
      "signature": {
        "name": "setvisible",
        "parameters": [
          {
            "type": {
              "name": "boolean"
            },
            "name": "visible"
          }
        ],
        "shortStr": "setvisible(visible)",
        "str": "setvisible(visible)"
      },
      "description": "Set whether toolbar is visible.",
      "id": "setvisible-visible"
    },
    {
      "signature": {
        "returnType": {
          "name": "boolean"
        },
        "name": "isvisible",
        "parameters": [],
        "shortStr": "isvisible()",
        "str": "isvisible()"
      },
      "description": "Return whether toolbar is visible.",
      "id": "isvisible"
    },
    {
      "signature": {
        "returnType": {
          "name": "string"
        },
        "name": "getidentifier",
        "parameters": [],
        "shortStr": "getidentifier()",
        "str": "getidentifier()"
      },
      "description": "Return the identifier of the toolbar.",
      "id": "getidentifier"
    }
  ],
  "delegates": [
    {
      "signature": {
        "returnType": {
          "name": "Toolbar::Item",
          "id": "toolbar_item"
        },
        "name": "getitem",
        "parameters": [
          {
            "type": {
              "name": "Toolbar",
              "id": "toolbar"
            },
            "name": "toolbar"
          },
          {
            "type": {
              "name": "string"
            },
            "name": "identifier"
          }
        ],
        "shortStr": "getitem(toolbar, identifier)",
        "str": "getitem(toolbar, identifier)"
      },
      "description": "Called lazily when the toolbar is going to get the item with `identifier`.\n\nYou should not cache the item to be returned.\n",
      "id": "getitem-toolbar-identifier"
    }
  ],
  "module": "yue.gui",
  "id": "toolbar"
}