Prima::...::Header(3)
π Prima::...::Header(3) π
okay bestie so this little gem is from the User Contributed Perl Documentation section of the Prima family β welcome to the header widget page, you're gonna love it here π«Ά
β¨ NAME β¨
Prima::Widget::Header β the multi-column header widget, and yes she is that girl π
πΈ DESCRIPTION πΈ
So basically this widget class gives you the whole functionality of several button-like caption tabs, and the user can move them around and resize them. That's the whole vibe β draggable, resizable caption tabs, lowkey iconic π
It was implemented to serve as a table header for list and grid widgets, which is honestly exactly what it sounds like: she's the crown on top of your table π iykyk
π¦ API π¦
π Events
Click INDEXβ gets called when the user clicks on the tab sitting pretty at position INDEX. simple as that, no cap β¨DrawItem CANVAS, INDEX, X1, Y1, X2, Y2, TEXT_BASELINEβ this is your callback to draw the tabs. CANVAS is the output object; INDEX is the index of a tab.X1,Y2,X2,Y2are the coordinates of the boundaries of the tab rectangle; TEXT_BASELINE is a pre-calculated vertical position for eventual centered text output. literally handing you the baseline so your text can be centered and slay ππMeasureItem INDEX, RESULTβ stores in the scalar referenced by RESULT the width or height (depending on theverticalproperty value) of the *INDEX*th tab, in pixels. yes, in pixels, always pixels πMoveItem OLD_INDEX, NEW_INDEXβ called when the user moves a tab from its old location, specified by OLD_INDEX, to the NEW_INDEX position. and here's the cute part: by the time of the call, all internal structures are already updated π«Ά so no stale data for you bestieSizeItem INDEX, OLD_EXTENT, NEW_EXTENTβ called when the user resizes a tab in the INDEXth position. OLD_EXTENT and NEW_EXTENT are either the width or height of the tab, depending on theverticalproperty value. glow-up documented πβ¨SizeItemsβ called when more than one tab changes its extent. and ngl this might happen as a result of both user and programmatic actions, so don't assume it's just the human π«‘
π Properties π
clickable BOOLEANβ selects whether the user is allowed to click the tabs. gatekeeping, but consensual πͺ
Default value: 1
dragable BOOLEANβ selects whether the user is allowed to move the tabs. (yes the spelling isdragable, don't come for her, copy it exactly bestie π)
Default value: 1
items ARRAYβ an array of scalars representing the internal data of the tabs. by default, the scalars are treated as text strings. but they're yours to fill with whatever πminTabWidth INTEGERβ a minimal extent in pixels a tab must occupy. no tiny tabs allowed, she has standards π
Default value: 2
offset INTEGERβ an offset on the major axis (depends on theverticalproperty value) that the widget is drawn with. used for the conjunction with list widgets (seePrima::DetailedList), when the list is horizontally or vertically scrolled. yes, this is the scroll-sync glue π§
Default value: 0
pressed INTEGERβ contains the index of the currently pressed tab. a-1value is selected when no tabs are pressed. chill mode =-1π
Default value: -1
scalable BOOLEANβ selects whether the user is allowed to resize the tabs. let her stretch π
Default value: 1
vertical BOOLEANβ if1, the tabs are aligned vertically; theoffset,widthsproperty, and extent parameters of the callback notification assume the heights of the tabs.
If 0, the tabs are aligned horizontally, and the extent properties and parameters assume tab widths.
so like: sideways mode = everything means height, normal mode = everything means width. pick your axis, bestie π
widths ARRAYβ array of integer values, corresponding to the extents of the tabs. the extents are widths ("vertical"is0) or heights ("vertical"is1). yeah it's calledwidthseven when they're heights, she's quirky like that π
π§ Methods π§
tab2offset INDEXβ returns the offset of the *INDEX*th tab (without regard to theoffsetproperty value). note the disclaimer, it's important πtab2rect INDEXβ returns four integers representing the rectangle area occupied by the *INDEX*th tab (without regard to theoffsetproperty value). four integers, one beautiful rectangle π
β AUTHOR β
Dmitry Karasik, <dmitry@karasik.eu.org>. king behavior, we stan π
π₯ SEE ALSO π₯
Prima, Prima::Widget, Prima::DetailedList, examples/sheet.pl. go read those next, they're all friends π
and that's the whole page, bestie β no details left behind, no facts invented π«Ά
signed off with love from the manpage crew: perl v5.42.0, dated 2024-08-20 π β¨π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms