41 lines
1.9 KiB
C++
41 lines
1.9 KiB
C++
#pragma once
|
|
#include "core/ui/rect.h"
|
|
// overflow_menu — layout for the bank_panel top toolbar's "..." overflow-menu button: the rare
|
|
// capture variants (Batch Items / Batch Razor / Capture RT) live in a popup opened by a small
|
|
// square button right-anchored in the top toolbar band. Owns the button's placement and the
|
|
// horizontal reserve action_bar must leave so its buttons never run under it. The popup itself
|
|
// (TrackPopupMenu) and command dispatch are shell concerns.
|
|
|
|
namespace reasampler::ui {
|
|
|
|
// The toolbar band the button draws into, top-left origin.
|
|
using MenuBarRect = Rect;
|
|
|
|
// The More button's rect. Zero-area means "no button" — the three variants stay reachable via
|
|
// their bindable commands regardless.
|
|
using MenuButtonRect = Rect;
|
|
|
|
// Layout inputs, in pixels; defaults match the bank_panel top-toolbar metrics.
|
|
// * minLeftInset — button's left edge must stay at least this far from the band's left edge;
|
|
// otherwise computeMenuButton suppresses it (empty rect).
|
|
struct MenuButtonSpec {
|
|
int buttonWidth = 28;
|
|
int rightInset = 6;
|
|
int verticalInset = 3;
|
|
int minLeftInset = 40;
|
|
};
|
|
|
|
// Horizontal reserve (px) action_bar must leave at the band's right: button width + both insets.
|
|
// 0 for a degenerate band.
|
|
int menuButtonReserve(const MenuBarRect& bar, const MenuButtonSpec& spec);
|
|
|
|
// The More button's rect within `bar`, right-anchored, vertically centred by verticalInset.
|
|
// Empty when the band is degenerate, buttonWidth <= 0, or the left edge would fall closer to the
|
|
// band's left than minLeftInset. A thin band clamps height to the band's own rather than negative.
|
|
MenuButtonRect computeMenuButton(const MenuBarRect& bar, const MenuButtonSpec& spec);
|
|
|
|
// Half-open bounds, matching computeMenuButton. Empty button claims nothing.
|
|
bool hitTestMenuButton(int px, int py, const MenuButtonRect& button);
|
|
|
|
} // namespace reasampler::ui
|