Krotos Modules 3
Loading...
Searching...
No Matches
ResizableComponent.cpp
Go to the documentation of this file.
2
3namespace krotos
4{
5 ResizableComponent::ResizableComponent(String name, int minimumWidth, int minimumHeight) : Component(name)
6 {
7 constrainer.setMinimumSize(minimumWidth, minimumHeight);
8 if (resizableBorder == nullptr)
9 {
10 resizableBorder.reset(new ResizableBorderComponent(this, &constrainer));
11 Component::addAndMakeVisible(resizableBorder.get());
12 resizableBorder->setAlwaysOnTop(true);
13 }
14 }
15
16 void ResizableComponent::paint(Graphics& g)
17 {
18 if (resizableBorder->isVisible())
19 {
20 g.setColour(Colours::lightgrey);
21 g.setOpacity(0.8f);
22 g.drawSingleLineText(String(getWidth()) + " x " + String(getHeight()), 0, getHeight());
23 g.drawRect(getLocalBounds());
24 }
25 }
26
28 {
29 // limit size of perform area guis
30 getConstrainer().setMinimumSize(56, 70);
31 getConstrainer().setMaximumSize(240, 280);
32
33 for (auto c : getChildren())
34 c->setSize(getWidth(), getHeight());
35
36 resizableBorder->setSize(getWidth(), getHeight());
37 }
38} // namespace krotos
ResizableComponent(String name, int minimumWidth=15, int minumumHeight=15)
Definition ResizableComponent.cpp:5
void paint(Graphics &g) override
Definition ResizableComponent.cpp:16
std::unique_ptr< ResizableBorderComponent > resizableBorder
Definition ResizableComponent.h:39
void resized() override
Definition ResizableComponent.cpp:27
ComponentBoundsConstrainer & getConstrainer()
Definition ResizableComponent.h:36
ComponentBoundsConstrainer constrainer
Definition ResizableComponent.h:40
Definition AirAbsorptionFilter.cpp:2