/// # Arguments
///
/// * first - `ItemId` of the button that was pressed
-pub type ButtonCb = Box<Fn(&ItemId)>;
+pub type ButtonCb = Box<dyn Fn(&ItemId)>;
/// A callback that is called when the value of a slide on a Touch Bar changes
///
///
/// * first - `ItemId` of the slider that was changed
/// * second - Current value of the slider
-pub type SliderCb = Box<Fn(&ItemId, f64)>;
+pub type SliderCb = Box<dyn Fn(&ItemId, f64)>;
/// A callback that is called when an item is swiped
///
/// * second - `SwipeState` representing the current gesture's lifecycle
/// * third - Horizontal translation of the swipe, in pixels (positive is right,
/// negative is left).
-pub type SwipeCb = Box<Fn(&ItemId, SwipeState, f64)>;
+pub type SwipeCb = Box<dyn Fn(&ItemId, SwipeState, f64)>;
/// An allocated image that can be added to items
///
/// # Returns
///
/// A newly allocated scrubber item
- fn create_text_scrubber(&mut self, data: Rc<TScrubberData>) -> ItemId {0}
+ fn create_text_scrubber(&mut self, data: Rc<dyn TScrubberData>) -> ItemId {0}
/// Selects the given index in a scrubber
///
view: *mut Object,
ident: Ident,
control: Option<*mut Object>,
- scrubber: Option<Rc<TScrubberData>>,
+ scrubber: Option<Rc<dyn TScrubberData>>,
button_cb: Option<ButtonCb>,
slider_cb: Option<SliderCb>,
swipe_cb: Option<SwipeCb>,
None => None,
}
}
- fn find_scrubber_callbacks(&self, scrubber: u64) -> Option<&Rc<TScrubberData>> {
+ fn find_scrubber_callbacks(&self, scrubber: u64) -> Option<&Rc<dyn TScrubberData>> {
match self.item_map.values().into_iter().filter(|x| {
x._type == ItemType::Scrubber && x.control.unwrap() as u64 == scrubber
}).next() {
}
}
- fn create_text_scrubber(&mut self, data: Rc<TScrubberData>) -> ItemId {
+ fn create_text_scrubber(&mut self, data: Rc<dyn TScrubberData>) -> ItemId {
unsafe {
let ident = self.generate_ident();
let cls = RRCustomTouchBarItem::class();