Settable corner resizer size for AudioProcessorEditor and ResizableWindow

AudioProcessorEditor and ResizableWindow both have an independently hard-coded size of 18px for their ResizableCornerComponent, and there seems no straightforward way to change this.

Would it be possible to have these components get their corner size from the LookAndFeel, for example by adding a LookAndFeelMethods::getPreferredCornerSize() to ResizableCornerComponent or something similar?

3 Likes

+1

Agreed, both size and hitTest (eg maybe just square vs triangle) should be configurable.

Old thread, but I recently found a simple trick for this:

In your Editor ctor simply add an instance of this class as a component listener for resizableCorner :

struct ResizableCornerSizeForcer : public juce::ComponentListener {
	ResizableCornerSizeForcer(int s = 18) : size(s) {}

	void componentMovedOrResized(juce::Component& component, bool, bool) override {
		auto* parent = component.getParentComponent();
		if (!parent || component.getWidth() == size) return;
		component.setBounds(parent->getWidth() - size, parent->getHeight() - size, size, size);
	}

	int size;
};
2 Likes

Would be nice if this thread was in the Feature Request category…

I would consider it a Bug rather than a FR.
Just had to add the ComponentWatcher workaround. Using resized() of the Editor doesn’t work for some reason, even though the ResizerCornerComponent is public.

2 Likes