Trait cacao::listview::ListViewDelegate
source · [−]pub trait ListViewDelegate {
const NAME: &'static str;
Show 17 methods
fn did_load(&mut self, view: ListView);
fn number_of_items(&self) -> usize;
fn item_for(&self, row: usize) -> ListViewRow;
fn subclass_name(&self) -> &'static str { ... }
fn will_display_item(&self, row: usize) { ... }
fn item_selected(&self, row: Option<usize>) { ... }
fn context_menu(&self) -> Vec<MenuItem> { ... }
fn actions_for(&self, row: usize, edge: RowEdge) -> Vec<RowAction> { ... }
fn will_appear(&self, animated: bool) { ... }
fn did_appear(&self, animated: bool) { ... }
fn will_disappear(&self, animated: bool) { ... }
fn did_disappear(&self, animated: bool) { ... }
fn dragging_entered(&self, info: DragInfo) -> DragOperation { ... }
fn prepare_for_drag_operation(&self, info: DragInfo) -> bool { ... }
fn perform_drag_operation(&self, info: DragInfo) -> bool { ... }
fn conclude_drag_operation(&self, info: DragInfo) { ... }
fn dragging_exited(&self, info: DragInfo) { ... }
}
Required Associated Constants
Required Methods
Called when the View is ready to work with. You’re passed a View
- this is safe to
store and use repeatedly, but it’s not thread safe - any UI calls must be made from the
main thread!
fn number_of_items(&self) -> usize
fn number_of_items(&self) -> usize
Returns the number of items in the list view.
fn item_for(&self, row: usize) -> ListViewRow
fn item_for(&self, row: usize) -> ListViewRow
This is temporary and you should not rely on this signature if you choose to try and work with this. NSTableView & such associated delegate patterns are tricky to support in Rust, and while I have a few ideas about them, I haven’t had time to sit down and figure them out properly yet.
Provided Methods
fn subclass_name(&self) -> &'static str
fn subclass_name(&self) -> &'static str
You should rarely (read: probably never) need to implement this yourself.
It simply acts as a getter for the associated NAME
const on this trait.
fn will_display_item(&self, row: usize)
fn will_display_item(&self, row: usize)
Called when an item will be displayed.
fn item_selected(&self, row: Option<usize>)
fn item_selected(&self, row: Option<usize>)
Called when an item has been selected (clicked/tapped on). If the selection was cleared,
then this will be called with None
.
Called when the menu for the tableview is about to be shown. You can update the menu here depending on, say, what the user has context-clicked on. You should avoid any expensive work in here and return the menu as fast as possible.
An optional delegate method; implement this if you’d like swipe-to-reveal to be supported for a given row by returning a vector of actions to show.
fn will_appear(&self, animated: bool)
fn will_appear(&self, animated: bool)
Called when this is about to be added to the view heirarchy.
fn did_appear(&self, animated: bool)
fn did_appear(&self, animated: bool)
Called after this has been added to the view heirarchy.
fn will_disappear(&self, animated: bool)
fn will_disappear(&self, animated: bool)
Called when this is about to be removed from the view heirarchy.
fn did_disappear(&self, animated: bool)
fn did_disappear(&self, animated: bool)
Called when this has been removed from the view heirarchy.
fn dragging_entered(&self, info: DragInfo) -> DragOperation
fn dragging_entered(&self, info: DragInfo) -> DragOperation
Invoked when the dragged image enters destination bounds or frame; returns dragging operation to perform.
fn prepare_for_drag_operation(&self, info: DragInfo) -> bool
fn prepare_for_drag_operation(&self, info: DragInfo) -> bool
Invoked when the image is released, allowing the receiver to agree to or refuse drag operation.
fn perform_drag_operation(&self, info: DragInfo) -> bool
fn perform_drag_operation(&self, info: DragInfo) -> bool
Invoked after the released image has been removed from the screen, signaling the receiver to import the pasteboard data.
fn conclude_drag_operation(&self, info: DragInfo)
fn conclude_drag_operation(&self, info: DragInfo)
Invoked when the dragging operation is complete, signaling the receiver to perform any necessary clean-up.
fn dragging_exited(&self, info: DragInfo)
fn dragging_exited(&self, info: DragInfo)
Invoked when the dragged image exits the destination’s bounds rectangle (in the case of a view) or its frame rectangle (in the case of a window object).