MCPcopy Create free account
hub / github.com/christophhart/HISE / setup

Method setup

hi_scripting/scripting/api/ScriptTableListModel.cpp:482–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482void ScriptTableListModel::setup(juce::TableListBox* t)
483{
484 auto& header = t->getHeader();
485
486 t->setLookAndFeel(&fallback);
487
488 tableRepainters.add(new TableRepainter(t, *this));
489
490 int idx = 1;
491
492 if (auto a = columnMetadata.getArray())
493 {
494 for (auto c : *a)
495 {
496 auto id = c[scriptnode::PropertyIds::ID].toString();
497 auto label = c.getProperty("Label", id);
498
499 auto w = (int)c["Width"];
500 auto min = jmax(1, (int)c["MinWidth"]);
501 auto max = (int)c.getProperty("MaxWidth", -1);
502
503 if (max != -1)
504 {
505 auto r = Range<int>(min, max);
506 w = r.clipValue(w);
507 }
508 else
509 w = jmax(min, w);
510
511 int flag = TableHeaderComponent::ColumnPropertyFlags::visible;
512
513 if(tableMetadata.getProperty("Sortable", false))
514 flag |= TableHeaderComponent::ColumnPropertyFlags::sortable;
515
516 header.addColumn(label, idx, w, min, max, flag);
517 idx++;
518 }
519 }
520
521 t->setAutoSizeMenuOptionShown(false);
522 t->setHeaderHeight(tableMetadata.getProperty("HeaderHeight", 24));
523 t->setRowHeight(tableMetadata.getProperty("RowHeight", 20));
524 t->setMultipleSelectionEnabled(tableMetadata.getProperty("MultiSelection", false));
525 t->getViewport()->setScrollOnDragEnabled(tableMetadata.getProperty("ScrollOnDrag", false));
526
527 t->setModel(this);
528}
529
530
531ScriptTableListModel::LookAndFeelMethods::~LookAndFeelMethods()

Callers 5

SliderWrapperMethod · 0.45
ComboBoxWrapperMethod · 0.45
ButtonWrapperMethod · 0.45
ViewportWrapperMethod · 0.45
initPanelMethod · 0.45

Calls 11

jmaxFunction · 0.85
clipValueMethod · 0.80
addColumnMethod · 0.80
getHeaderMethod · 0.45
setLookAndFeelMethod · 0.45
addMethod · 0.45
getArrayMethod · 0.45
toStringMethod · 0.45
getPropertyMethod · 0.45
setModelMethod · 0.45

Tested by

no test coverage detected