Module window_toolbar
Expand description
An app’s toolbar is slots in the window’s bar, never a row it draws.
The desktop draws one bar per window; what an app adds it declares here, as slots the bar lays out and draws with the system’s own controls:
- navigation: the sidebar toggle, back and forward, and whether each can go;
- location: where the window is and can go (a page’s domain, a folder’s
path), editable as a field, a hierarchy’s levels as a breadcrumb and a few
places as a picker: see
LocationSegmentandLocationChoice; - leading actions: at most
MAX_LEADINGicon buttons acting on where it is; - views: tabs switching between the app’s views of the same thing, folding into a views menu where the row has no room;
- actions: at most
MAX_ACTIONSicon buttons, the rest (and those declared for the menu) under the row’s overflow button; one with items is a menu button.
Search is the bar’s own control, never a slot, and the tab label is the location’s,
so a window is named by what it shows. The bar’s own controls reach the app as
ToolbarEvents through WindowOffer: it declares its slots with declare and
reads what the person did with take_events, over its authenticated shell-ui
connection. While the desktop’s bar shows the slots (is_hosted) the app draws no
toolbar of its own; an app its host runs in the host’s own process makes the same
calls for the window the host shows it in (crate::hosted_window::HostedWindow).
Structs§
- Adopted
Query - A find an app’s document ran on its own (an action went to a match) that
the open search took over, for the bar’s field to show.
serialtells one such find from the next, so a find already shown never overwrites what the person typed since. - BarControl
- One control a window’s bar lays out, as the desktop draws it: what it is, what it does and where it stands. The bar’s own controls (its navigation, its overflow, the window’s) and the app’s slots are all controls of one bar, and a screen shows each of them once.
- BarLabel
- A word the bar paints itself, at the place its ink stands: no widget lays it out, so whoever reads the bar reports it — a layout check reads these as text, and finds two labels drawn on top of each other that no widget tree would show.
- BarLayout
- One window’s bar, as it lays itself out across the window: what a person sees in it, and what room it leaves empty.
- Location
Choice - One row of a location’s picker.
- Location
Segment - One level of a location’s hierarchy.
- Location
Suggestion - One suggestion under an edited location.
- Search
Count - The search’s count: in a document the current match of all of them, in a list the rows shown of all rows.
- Toolbar
Action - One action button.
- Toolbar
Image - A location’s picture, as PNG bytes.
- Toolbar
Location - Where the window is and can go.
- Toolbar
Navigation - Back and forward: which of them can go.
- Toolbar
Notice - What just happened, said in the window’s bar for a while: an operation’s
result or failure (“Page 1 captured”). The bar shows it in the
location’s place, its kind’s icon first, and announces it. A notice that
asks the person to act carries what they can do: at most
MAX_NOTICE_ACTIONSactions (“Sync again”, “Open Settings”), standing in order right after its text, each a button that names itself where the row has room and its icon where not (the last first), and never in the overflow menu. Notices replace each other; none stack. A message the person must act on before it goes is not a notice. - Toolbar
Reaction - Everyone who reacted with one emoji.
- Toolbar
Reactions - The reactions to the one thing a window shows (a shared document), as
its bar shows them: a pill per emoji, the person’s own marked, and an
add button where they may react. Pressing a pill sends
reaction_actionof its emoji, which takes the person’s reaction back where they had one and adds it where not; the add button opens the shared emoji picker in the bar, and a pick sends the same. Whoever shows them takes the presses (take_reaction_presses); the app’s slot events never carry them. - Toolbar
View - One choice of a
ToolbarViews. - Toolbar
Views - Tabs switching between an app’s views (Month, Week, Day).
- Whole
Rect - A rect in whole logical pixels, as the bar tells an app in its own process where something of the bar stands over it.
- Window
Offer - What an app’s window offers the bar’s own controls: its search in place and the count of the open search, and its History control. Sent whenever it changes.
- Window
Scope - Puts back the enclosing window when dropped: see
enter. - Window
Toolbar - What an app shows in its window’s bar.
Enums§
- History
Offer - The window’s History control, as its app offers it.
- Search
Offer - What a window’s search acts on in place, as its app offers it.
- Search
Opening - What an app’s chord asks of its window’s search: Find (Ctrl+F, ⌘F), or Find and Replace (Ctrl+H, ⌘⌥F), which opens it with the replacement field holding the keyboard.
- Toolbar
Event - What the person did with the app’s slots in the bar.
Constants§
- MAX_
ACTIONS - The most actions the row shows as buttons; the rest go in its overflow menu.
- MAX_
CHOICES - The most choices a location’s picker lists.
- MAX_
DECLARED_ ACTIONS - The most actions one window declares, buttons and overflow together.
- MAX_
IMAGE_ BYTES - Largest encoded location picture, in bytes. A favicon is a few hundred.
- MAX_
IMAGE_ PIXELS - Largest location picture, in pixels (edge squared).
- MAX_
ITEMS - The most items one menu button lists.
- MAX_
LEADING - The most leading actions the row shows; a declaration’s others are dropped.
- MAX_
NOTICE_ ACTIONS - The most actions a notice carries.
- MAX_
REACTION_ PILLS - The most pills a window’s reactions carry: as many emoji as one thing holds reactions with.
- MAX_
REACTOR_ NAMES - The most names a pill’s tooltip carries; the rest are counted.
- MAX_
SEGMENTS - The most levels a location’s breadcrumb carries.
- MAX_
SUGGESTIONS - The most suggestions the bar lists under an edited location.
- MAX_
TEXT_ BYTES - Longest label, value or name the bar takes, in bytes. Longer text is cut at a character boundary: the bar elides far sooner, and the wire never carries a page’s worth of text per frame.
- MAX_
VIEWS - The most choices a view switcher carries.
- REACTION_
ACTION_ PREFIX - What a press on the pill of an emoji, or a pick of it in the picker,
sends as
ToolbarEvent::Action: a window’s reactions own every id with this prefix.
Functions§
- declare
- Declare the window’s slots (
None: none). Cheap when nothing changed. - declared
- The slots last declared on this thread.
- deliver
- Hand the app what the person did in the bar (the runner, from the shell’s message).
- edit_
location - Ask the bar to turn the window’s editable location into a field, as a click on it does: the app’s Ctrl+L (or F6) while the bar hosts its slots.
- edited
- Whether the window’s bar marks its document as not yet saved
(
show_edited). - enter
- While the returned guard lives, this module’s calls act on
window: the window a host shows the app it is about to run in.Nonekeeps the enclosing window. Guards nest. - is_
hosted - Whether the desktop’s bar shows this window’s slots, so the app draws no toolbar of its own.
- notice
- The notice up in the window’s bar.
- notify
- Show
noticein the window’s bar, replacing the notice up (None: take it down). Cheap when nothing changed. Whoever shows a notice takes it down withwithdraw, so a later notice from elsewhere stays. - open_
search - Ask the bar to open the window’s search, as a click on its control does:
the app’s Ctrl+F (or, for
SearchOpening::Replace, its Ctrl+H) while the bar hosts its window and it has something to search in place. - reaction_
action - The action id a press on
emoji’s pill sends. - reactions
- The reactions shown in the window’s bar.
- revision
- Bumped by every
declareandnotifythat changed something, so a runner sends what the bar shows once. - set_
hosted - Whether a desktop bar shows the slots (the runner, as its shell connection comes and goes). Returns whether that changed.
- show_
edited - Mark the window’s document as having work not yet saved
(
ToolbarLocation::edited), as the window’s framework follows its record’s saves: every window marks its record this one way, and no app marks it from its own copy of the save status. Cheap when nothing changed. - show_
reactions - Show
reactionsat the end of the window’s bar (None: none), as the reactions to the one thing the window shows. Cheap when nothing changed. Whoever shows them takes the presses on them (take_reaction_presses). - show_
view_ only - Say in the window’s bar whether its person may only look at what it
shows (
ToolbarLocation::view_only). Cheap when nothing changed. - shown
- What the window’s bar shows: the slots declared, with the notice up and the reactions shown.
- take_
edit_ request - Whether the app asked to edit its location since the last call (the runner, to tell the shell).
- take_
events - What the person did in the bar since the last call, oldest first.
- take_
notice_ press - Whether the button
idof a notice was pressed in the bar since the last call: the notice’s poster takes it, whatever else the window does with its bar’s events. - take_
reaction_ presses - The emoji pressed (or picked) among the window’s reactions since the last call, oldest first.
- take_
search_ request - How the app asked to open the window’s search since the last call, if it did (the runner, to tell the shell).
- view_
only - Whether the window’s bar says its person may only look.
- withdraw
- Take
noticedown if it is the one up; a notice that replaced it stays. Nothing once the thread is ending: its window is gone with it. - workspace
- The workspace of the window the app runs in, when its host put the
window in one (
crate::hosted_window::HostedWindow::set_workspace).