30 : factory (tbf), toolbar (bar)
38 for (
auto& i : allIds)
49void ToolbarItemPalette::addComponent (
const int itemId,
const int index)
51 if (
auto* tc = Toolbar::createItem (factory, itemId))
53 items.insert (index, tc);
63void ToolbarItemPalette::replaceComponent (ToolbarItemComponent& comp)
65 auto index = items.indexOf (&comp);
67 items.removeObject (&comp,
false);
69 addComponent (comp.getItemId(), index);
86 for (
auto* tc : items)
90 int preferredSize = 1, minSize = 1, maxSize = 1;
92 if (tc->getToolbarItemSizes (height,
false, preferredSize, minSize, maxSize))
94 if (x + preferredSize > preferredWidth && x > indent)
100 tc->setBounds (x, y, preferredSize, height);
102 x += preferredSize + 8;
103 maxX =
jmax (maxX, x);
107 itemHolder->setSize (maxX, y + height + 8);
Holds a resizable array of primitive or copy-by-value objects.
Specifies a set of gaps to be left around the sides of a rectangle.
void setBoundsInset(BorderSize< int > borders)
Changes the component's position and size based on the amount of space to leave around it.
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
Component() noexcept
Creates a component.
int getWidth() const noexcept
Returns the component's width in pixels.
Component * getViewedComponent() const noexcept
Returns the component that's currently being used inside the Viewport.
int getScrollBarThickness() const
Returns the thickness of the scrollbars.
void setViewedComponent(Component *newViewedComponent, bool deleteComponentWhenNoLongerNeeded=true)
Sets the component that this viewport will contain and scroll around.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.