Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/group.h

A titled box around a set of controls.

#include <sonore/gfx/group.h>
On this page

Design notes

Why a component rather than a painted rectangle

Because the alternative is what every editor without one does: draw a line, draw a caption, and then lay the controls out to coordinates that have to agree with where the line was drawn. Two places holding the same number, and the second one is inside a paint() nobody re-reads.

A GroupComponent owns the inside. Its children are positioned relative to it, contentBounds() says where they may go, and moving the group moves everything in it -- which is the difference between a decoration and a container.

The gap in the outline

The border is drawn with a gap where the caption sits, rather than the caption being drawn over a complete border. Over a solid background those look identical; over a gradient, a texture, or anything a LookAndFeel puts behind the panel, drawing the caption over the line leaves a rectangle of panel colour with the line visible through the letters' gaps.

Types 1

class GroupComponent : public Widget

A titled outline around a set of controls -- the reference's GroupComponent. The file comment says why it is a container rather than a painted rectangle.

Add the controls as children and lay them out inside contentBounds(), which already leaves room for the caption. Children are not owned, like any Component's, and clicks fall through the group to them. Message thread only.

↑↓ to move↵ to openEvery public name in the headers, and every guide