popover_menu: Add docs to the trigger_with_tooltip method (#25158)

Felt like this was relevant particularly as we're living with both
`trigger` and `trigger_with_tooltip`. At some point, I believe there
should be only one (`trigger_with_tooltip`) and that should be then
renamed to just `trigger` back again! We're supporting both for now just
for ease of migration/avoiding big changes.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-02-19 12:14:28 -03:00 committed by GitHub
parent 8b98b5c82f
commit 044be72038
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,6 +178,7 @@ impl<M: ManagedView> PopoverMenu<M> {
self self
} }
/// This method prevents the trigger button tooltip from being seen when the menu is open.
pub fn trigger_with_tooltip<T: PopoverTrigger + ButtonCommon>( pub fn trigger_with_tooltip<T: PopoverTrigger + ButtonCommon>(
mut self, mut self,
t: T, t: T,
@ -200,26 +201,26 @@ impl<M: ManagedView> PopoverMenu<M> {
self self
} }
/// anchor defines which corner of the menu to anchor to the attachment point /// Defines which corner of the menu to anchor to the attachment point.
/// (by default the cursor position, but see attach) /// By default, it uses the cursor position. Also see the `attach` method.
pub fn anchor(mut self, anchor: Corner) -> Self { pub fn anchor(mut self, anchor: Corner) -> Self {
self.anchor = anchor; self.anchor = anchor;
self self
} }
/// attach defines which corner of the handle to attach the menu's anchor to /// Defines which corner of the handle to attach the menu's anchor to.
pub fn attach(mut self, attach: Corner) -> Self { pub fn attach(mut self, attach: Corner) -> Self {
self.attach = Some(attach); self.attach = Some(attach);
self self
} }
/// offset offsets the position of the content by that many pixels. /// Offsets the position of the content by that many pixels.
pub fn offset(mut self, offset: Point<Pixels>) -> Self { pub fn offset(mut self, offset: Point<Pixels>) -> Self {
self.offset = Some(offset); self.offset = Some(offset);
self self
} }
/// attach something upon opening the menu /// Attaches something upon opening the menu.
pub fn on_open(mut self, on_open: Rc<dyn Fn(&mut Window, &mut App)>) -> Self { pub fn on_open(mut self, on_open: Rc<dyn Fn(&mut Window, &mut App)>) -> Self {
self.on_open = Some(on_open); self.on_open = Some(on_open);
self self