use std::rc::Rc;
pub type BarId = u64;
pub type ItemId = u64;
pub type ButtonCb = Box<dyn Fn(&ItemId)>;
pub type SliderCb = Box<dyn Fn(&ItemId, f64)>;
pub type SwipeCb = Box<dyn Fn(&ItemId, SwipeState, f64)>;
pub type TouchbarImage = u64;
#[derive(PartialEq, Debug)]
pub enum SwipeState {
Began,
Changed,
Ended,
Cancelled,
Failed,
Unknown,
}
#[allow(missing_docs)]
pub enum ImageTemplate {
AddDetailTemplate,
AddTemplate,
AlarmTemplate,
AudioInputMuteTemplate,
AudioInputTemplate,
AudioOutputMuteTemplate,
AudioOutputVolumeHighTemplate,
AudioOutputVolumeLowTemplate,
AudioOutputVolumeMediumTemplate,
AudioOutputVolumeOffTemplate,
BookmarksTemplate,
ColorPickerFill,
ColorPickerFont,
ColorPickerStroke,
CommunicationAudioTemplate,
CommunicationVideoTemplate,
ComposeTemplate,
DeleteTemplate,
DownloadTemplate,
EnterFullScreenTemplate,
ExitFullScreenTemplate,
FastForwardTemplate,
FolderCopyToTemplate,
FolderMoveToTemplate,
FolderTemplate,
GetInfoTemplate,
GoBackTemplate,
GoDownTemplate,
GoForwardTemplate,
GoUpTemplate,
HistoryTemplate,
IconViewTemplate,
ListViewTemplate,
MailTemplate,
NewFolderTemplate,
NewMessageTemplate,
OpenInBrowserTemplate,
PauseTemplate,
PlayheadTemplate,
PlayPauseTemplate,
PlayTemplate,
QuickLookTemplate,
RecordStartTemplate,
RecordStopTemplate,
RefreshTemplate,
RewindTemplate,
RotateLeftTemplate,
RotateRightTemplate,
SearchTemplate,
ShareTemplate,
SidebarTemplate,
SkipAhead15SecondsTemplate,
SkipAhead30SecondsTemplate,
SkipAheadTemplate,
SkipBack15SecondsTemplate,
SkipBack30SecondsTemplate,
SkipBackTemplate,
SkipToEndTemplate,
SkipToStartTemplate,
SlideshowTemplate,
TagIconTemplate,
TextBoldTemplate,
TextBoxTemplate,
TextCenterAlignTemplate,
TextItalicTemplate,
TextJustifiedAlignTemplate,
TextLeftAlignTemplate,
TextListTemplate,
TextRightAlignTemplate,
TextStrikethroughTemplate,
TextUnderlineTemplate,
UserAddTemplate,
UserGroupTemplate,
UserTemplate
}
pub enum SpacerType {
Small,
Large,
Flexible
}
pub trait TScrubberData {
fn count(&self, item: ItemId) -> u32;
fn text(&self, item: ItemId, idx: u32) -> String;
fn width(&self, item: ItemId, idx: u32) -> u32;
fn touch(&self, item: ItemId, idx: u32);
}
pub trait TTouchbar {
type T: TTouchbar;
fn alloc(title: &str) -> Self::T;
fn set_icon(&self, image: &str) {}
fn create_bar(&mut self) -> BarId { 0 }
fn add_items_to_bar(&mut self, bar_id: &BarId, items: Vec<ItemId>) {}
fn set_bar_as_root(&mut self, bar_id: BarId) {}
fn create_popover_item(&mut self, image: Option<&TouchbarImage>,
text: Option<&str>, bar_id: &BarId) -> ItemId {0}
fn create_label(&mut self, text: &str) -> ItemId {0}
fn update_label(&mut self, label_id: &ItemId, text: &str) {}
fn update_label_width(&mut self, label_id: &ItemId, width: u32) {}
fn create_text_scrubber(&mut self, data: Rc<dyn TScrubberData>) -> ItemId {0}
fn select_scrubber_item(&mut self, scrub_id: &ItemId, index: u32) {}
fn refresh_scrubber(&mut self, scrub_id: &ItemId) {}
fn add_item_tap_gesture(&mut self, item_id: &ItemId, taps: u32,
fingers: u32, cb: ButtonCb) {}
fn add_item_swipe_gesture(&mut self, item: &ItemId, cb: SwipeCb) {}
fn create_spacer(&mut self, space: SpacerType) -> ItemId {0}
fn create_image_from_path(&mut self, path: &str) -> TouchbarImage {0}
fn create_image_from_template(&mut self, template: ImageTemplate) -> TouchbarImage {0}
fn create_button(&mut self, image: Option<&TouchbarImage>, text: Option<&str>, cb: ButtonCb) -> ItemId {0}
fn update_button(&mut self, item: &ItemId, image: Option<&TouchbarImage>, text: Option<&str>) {}
fn update_button_width(&mut self, button_id: &ItemId, width: u32) {}
fn create_slider(&mut self, min: f64, max: f64,
label: Option<&str>,
continuous: bool, cb: SliderCb) -> ItemId {0}
fn update_slider(&mut self, id: &ItemId, value: f64) {}
}