On macOS, add a way to query amount of tabbed windows
This should provide a way to iterate all the tabs and select the last
tab. The tab indicies are now zero based as any other sane index.
Follow-up-to: c5941d105f (add tabbing API)
This commit is contained in:
parent
06fb089633
commit
97434d8d80
3 changed files with 26 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use std::{num::NonZeroUsize, os::raw::c_void};
|
||||
use std::os::raw::c_void;
|
||||
|
||||
use objc2::rc::Id;
|
||||
|
||||
|
|
@ -55,7 +55,10 @@ pub trait WindowExtMacOS {
|
|||
/// Select the tab with the given index.
|
||||
///
|
||||
/// Will no-op when the index is out of bounds.
|
||||
fn select_tab_at_index(&self, index: NonZeroUsize);
|
||||
fn select_tab_at_index(&self, index: usize);
|
||||
|
||||
/// Get the number of tabs in the window tab group.
|
||||
fn num_tabs(&self) -> usize;
|
||||
|
||||
/// Get the window's edit state.
|
||||
///
|
||||
|
|
@ -140,10 +143,15 @@ impl WindowExtMacOS for Window {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn select_tab_at_index(&self, index: NonZeroUsize) {
|
||||
fn select_tab_at_index(&self, index: usize) {
|
||||
self.window.select_tab_at_index(index);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn num_tabs(&self) -> usize {
|
||||
self.window.num_tabs()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_document_edited(&self) -> bool {
|
||||
self.window.is_document_edited()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue