1"use strict";(self.webpackChunkelectronjs=self.webpackChunkelectronjs||[]).push([["1197"],{44673(e,t,r){r.r(t),r.d(t,{metadata:()=>s,default:()=>u,frontMatter:()=>c,contentTitle:()=>i,toc:()=>a,assets:()=>d});var s=JSON.parse('{"id":"latest/api/touch-bar-scrubber","title":"Class: TouchBarScrubber","description":"Create a scrubber (a scrollable selector)","source":"@site/docs/latest/api/touch-bar-scrubber.md","sourceDirName":"latest/api","slug":"/latest/api/touch-bar-scrubber","permalink":"/docs/latest/api/touch-bar-scrubber","draft":false,"unlisted":false,"editUrl":"https://github.com/electron/electron/edit/main/docs/api/touch-bar-scrubber.md","tags":[],"version":"current","frontMatter":{"title":"Class: TouchBarScrubber","description":"Create a scrubber (a scrollable selector)","slug":"touch-bar-scrubber","hide_title":false},"sidebar":"api","previous":{"title":"Class: TouchBarPopover","permalink":"/docs/latest/api/touch-bar-popover"},"next":{"title":"Class: TouchBarSegmentedControl","permalink":"/docs/latest/api/touch-bar-segmented-control"}}'),n=r(74848),o=r(28453),l=r(40329);let c={title:"Class: TouchBarScrubber",description:"Create a scrubber (a scrollable selector)",slug:"touch-bar-scrubber",hide_title:!1},i,d={},a=[{value:"Class: TouchBarScrubber",id:"class-touchbarscrubber",level:2},{value:"<code>new TouchBarScrubber(options)</code>",id:"new-touchbarscrubberoptions",level:3},{value:"Instance Properties",id:"instance-properties",level:3},{value:"<code>touchBarScrubber.items</code>",id:"touchbarscrubberitems",level:4},{value:"<code>touchBarScrubber.selectedStyle</code>",id:"touchbarscrubberselectedstyle",level:4},{value:"<code>touchBarScrubber.overlayStyle</code>",id:"touchbarscrubberoverlaystyle",level:4},{value:"<code>touchBarScrubber.showArrowButtons</code>",id:"touchbarscrubbershowarrowbuttons",level:4},{value:"<code>touchBarScrubber.mode</code>",id:"touchbarscrubbermode",level:4},{value:"<code>touchBarScrubber.continuous</code>",id:"touchbarscrubbercontinuous",level:4}];function h(e){let t={a:"a",blockquote:"blockquote",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h2,{id:"class-touchbarscrubber",children:"Class: TouchBarScrubber"}),"\n",(0,n.jsxs)(t.blockquote,{children:["\n",(0,n.jsx)(t.p,{children:"Create a scrubber (a scrollable selector)"}),"\n"]}),"\n",(0,n.jsxs)(t.p,{children:["Process: ",(0,n.jsx)(t.a,{href:"/docs/latest/glossary#main-process",children:"Main"}),(0,n.jsx)("br",{}),"\n",(0,n.jsxs)(t.em,{children:["This class is not exported from the ",(0,n.jsx)(t.code,{children:"'electron'"})," module. It is only available as a return value of other methods in the Electron API."]})]}),"\n",(0,n.jsx)(t.h3,{id:"new-touchbarscrubberoptions",children:(0,n.jsx)(t.code,{children:"new TouchBarScrubber(options)"})}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{className:"electron-api-options-list",children:[(0,n.jsx)(t.code,{children:"options"})," Object","\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"items"})," ",(0,n.jsx)(l.A,{url:"/docs/latest/api/structures/scrubber-item",title:"ScrubberItem[]",content:'{"type":"root","children":[{"type":"element","tagName":"h1","properties":{},"children":[{"type":"text","value":"ScrubberItem Object"}]},{"type":"text","value":"\\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"label","position":{"start":{"line":10,"column":3,"offset":117},"end":{"line":10,"column":10,"offset":124}}}],"position":{"start":{"line":10,"column":3,"offset":117},"end":{"line":10,"column":10,"offset":124}}},{"type":"text","value":" string (optional) - The text to appear in this item.","position":{"start":{"line":10,"column":10,"offset":124},"end":{"line":10,"column":63,"offset":177}}}],"position":{"start":{"line":10,"column":1,"offset":115},"end":{"line":10,"column":63,"offset":177}}},{"type":"text","value":"\\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"icon","position":{"start":{"line":11,"column":3,"offset":180},"end":{"line":11,"column":9,"offset":186}}}],"position":{"start":{"line":11,"column":3,"offset":180},"end":{"line":11,"column":9,"offset":186}}},{"type":"text","value":" NativeImage (optional) - The image to appear in this item.","position":{"start":{"line":11,"column":9,"offset":186},"end":{"line":11,"column":68,"offset":245}}}],"position":{"start":{"line":11,"column":1,"offset":178},"end":{"line":11,"column":68,"offset":245}}},{"type":"text","value":"\\n"}],"position":{"start":{"line":10,"column":1,"offset":115},"end":{"line":11,"column":68,"offset":245}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":12,"column":1,"offset":246}}}'})," - An array of items to place in this scrubber."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"select"})," Function (optional) - Called when the user taps an item that was not the last tapped item.","\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"selectedIndex"})," Integer - The index of the item the user selected."]}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"highlight"})," Function (optional) - Called when the user taps any item.","\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"highlightedIndex"})," Integer - The index of the item the user touched."]}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"selectedStyle"})," string (optional) - Selected item style. Can be ",(0,n.jsx)(t.code,{children:"background"}),", ",(0,n.jsx)(t.code,{children:"outline"})," or ",(0,n.jsx)(t.code,{children:"none"}),". Defaults to ",(0,n.jsx)(t.code,{children:"none"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"overlayStyle"})," string (optional) - Selected overlay item style. Can be ",(0,n.jsx)(t.code,{children:"background"}),", ",(0,n.jsx)(t.code,{children:"outline"})," or ",(0,n.jsx)(t.code,{children:"none"}),". Defaults to ",(0,n.jsx)(t.code,{children:"none"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"showArrowButtons"})," boolean (optional) - Whether to show arrow buttons. Defaults to ",(0,n.jsx)(t.code,{children:"false"})," and is only shown if ",(0,n.jsx)(t.code,{children:"items"})," is non-empty."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"mode"})," string (optional) - Can be ",(0,n.jsx)(t.code,{children:"fixed"})," or ",(0,n.jsx)(t.code,{children:"free"}),". The default is ",(0,n.jsx)(t.code,{children:"free"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"continuous"})," boolean (optional) - Defaults to ",(0,n.jsx)(t.code,{children:"true"}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,n.jsx)(t.h3,{id:"instance-properties",children:"Instance Properties"}),"\n",(0,n.jsxs)(t.p,{children:["The following properties are available on instances of ",(0,n.jsx)(t.code,{children:"TouchBarScrubber"}),":"]}),"\n",(0,n.jsx)(t.h4,{id:"touchbarscrubberitems",children:(0,n.jsx)(t.code,{children:"touchBarScrubber.items"})}),"\n",(0,n.jsxs)(t.p,{children:["A ",(0,n.jsx)(t.code,{children:"ScrubberItem[]"})," array representing the items in this scrubber. Updating this value immediately\nupdates the control in the touch bar. Updating deep properties inside this array ",(0,n.jsx)(t.strong,{children:"does not update the touch bar"}),"."]}),"\n",(0,n.jsx)(t.h4,{id:"touchbarscrubberselectedstyle",children:(0,n.jsx)(t.code,{children:"touchBarScrubber.selectedStyle"})}),"\n",(0,n.jsxs)(t.p,{children:["A ",(0,n.jsx)(t.code,{children:"string"})," representing the style that selected items in the scrubber should have. Updating this value immediately\nupdates the control in the touch bar. Possible values:"]}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"background"})," - Maps to ",(0,n.jsx)(t.code,{children:"[NSScrubberSelectionStyle roundedBackgroun
1dStyle]"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"outline"})," - Maps to ",(0,n.jsx)(t.code,{children:"[NSScrubberSelectionStyle outlineOverlayStyle]"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"none"})," - Removes all styles."]}),"\n"]}),"\n",(0,n.jsx)(t.h4,{id:"touchbarscrubberoverlaystyle",children:(0,n.jsx)(t.code,{children:"touchBarScrubber.overlayStyle"})}),"\n",(0,n.jsxs)(t.p,{children:["A ",(0,n.jsx)(t.code,{children:"string"})," representing the style that selected items in the scrubber should have. This style is overlaid on top\nof the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the\ntouch bar. Possible values:"]}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"background"})," - Maps to ",(0,n.jsx)(t.code,{children:"[NSScrubberSelectionStyle roundedBackgroundStyle]"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"outline"})," - Maps to ",(0,n.jsx)(t.code,{children:"[NSScrubberSelectionStyle outlineOverlayStyle]"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"none"})," - Removes all styles."]}),"\n"]}),"\n",(0,n.jsx)(t.h4,{id:"touchbarscrubbershowarrowbuttons",children:(0,n.jsx)(t.code,{children:"touchBarScrubber.showArrowButtons"})}),"\n",(0,n.jsxs)(t.p,{children:["A ",(0,n.jsx)(t.code,{children:"boolean"})," representing whether to show the left / right selection arrows in this scrubber. Updating this value\nimmediately updates the control in the touch bar."]}),"\n",(0,n.jsx)(t.h4,{id:"touchbarscrubbermode",children:(0,n.jsx)(t.code,{children:"touchBarScrubber.mode"})}),"\n",(0,n.jsxs)(t.p,{children:["A ",(0,n.jsx)(t.code,{children:"string"})," representing the mode of this scrubber. Updating this value immediately\nupdates the control in the touch bar. Possible values:"]}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"fixed"})," - Maps to ",(0,n.jsx)(t.code,{children:"NSScrubberModeFixed"}),"."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"free"})," - Maps to ",(0,n.jsx)(t.code,{children:"NSScrubberModeFree"}),"."]}),"\n"]}),"\n",(0,n.jsx)(t.h4,{id:"touchbarscrubbercontinuous",children:(0,n.jsx)(t.code,{children:"touchBarScrubber.continuous"})}),"\n",(0,n.jsxs)(t.p,{children:["A ",(0,n.jsx)(t.code,{children:"boolean"})," representing whether this scrubber is continuous or not. Updating this value immediately\nupdates the control in the touch bar."]})]})}function u(e={}){let{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(h,{...e})}):h(e)}},40329(e,t,r){r.d(t,{A:()=>a});var s=r(74848),n=r(20053),o=r(96540),l=r(75392),c=r.n(l),i=r(83561);let d=e=>(0,s.jsx)("article",{ref:e.innerRef,id:"structures-tooltip",role:"tooltip",className:(0,n.A)("alert","alert--info","shadow--md","card_ZoSr"),style:e.position,children:(0,s.jsx)("div",{className:"card__body",dangerouslySetInnerHTML:{__html:(0,i.V)(JSON.parse(e.content))}})}),a=function(e){let{Portal:t}=c()(),r=(0,o.useRef)(null),n=(0,o.useRef)(null),[l,i]=(0,o.useState)(!1),[a,h]=(0,o.useState)(void 0);(0,o.useEffect)(()=>{if(l){let e={x:0,y:0},t=r.current.getBoundingClientRect(),s=window.innerHeight/2<t.y,o=window.innerWidth/2<t.x;s?e.y=n.current.clientHeight+-2:e.y=-t.height- -2,o?e.x=n.current.clientWidth:e.x=0,h({top:r.current.offsetTop-e.y,left:r.current.offsetLeft-e.x})}},[l]);let u=(0,o.useCallback)(()=>{i(!0)},[]),b=(0,o.useCallback)(()=>{i(!1)},[]);return(0,s.jsxs)("a",{"aria-describedby":"structures-tooltip",href:e.url,ref:r,className:"link_nCrB",onMouseEnter:u,onMouseLeave:b,children:[e.title,!!l&&(0,s.jsx)(t,{children:(0,s.jsx)(d,{innerRef:n,position:a,...e})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.