Skip to main content

Module window_toolbar

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 LocationSegment and LocationChoice;
  • leading actions: at most MAX_LEADING icon 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_ACTIONS icon 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§

AdoptedQuery
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. serial tells one such find from the next, so a find already shown never overwrites what the person typed since.
LocationChoice
One row of a location’s picker.
LocationSegment
One level of a location’s hierarchy.
LocationSuggestion
One suggestion under an edited location.
SearchCount
The search’s count: in a document the current match of all of them, in a list the rows shown of all rows.
ToolbarAction
One action button.
ToolbarImage
A location’s picture, as PNG bytes.
ToolbarLocation
Where the window is and can go.
ToolbarNavigation
Back and forward: which of them can go.
ToolbarNotice
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_ACTIONS actions (“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.
ToolbarReaction
Everyone who reacted with one emoji.
ToolbarReactions
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_action of 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.
ToolbarView
One choice of a ToolbarViews.
ToolbarViews
Tabs switching between an app’s views (Month, Week, Day).
WholeRect
A rect in whole logical pixels, as the bar tells an app in its own process where something of the bar stands over it.
WindowOffer
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.
WindowScope
Puts back the enclosing window when dropped: see enter.
WindowToolbar
What an app shows in its window’s bar.

Enums§

HistoryOffer
The window’s History control, as its app offers it.
SearchOffer
What a window’s search acts on in place, as its app offers it.
SearchOpening
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.
ToolbarEvent
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. None keeps 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 notice in the window’s bar, replacing the notice up (None: take it down). Cheap when nothing changed. Whoever shows a notice takes it down with withdraw, 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 declare and notify that 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 reactions at 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 id of 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 notice down 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).