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

gfx/popup_item.h

One row of a popup menu.

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

Design notes

Its own header for a dull, specific reason: LookAndFeel draws a PopupItem, PopupMenu is built out of widgets, and widgets are drawn by LookAndFeel. Any two of those can include each other; all three cannot.

A forward declaration in lookandfeel.h would break the cycle and leave its popup methods declared but not defined -- which is fine until a translation unit uses a LookAndFeel without ever including popup.h, and then it is a link error about a vtable, in a header-only SDK, which is the least diagnosable thing this could possibly be. A struct with no dependencies but <string> costs nothing to include from both sides.

Types 1

A separator is an item rather than a separate list, so the index a hit-test returns is the index the caller sees. Two parallel lists that have to stay aligned is the shape of that bug.

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