On macOS, add tabbing APIs
This should let the users control macOS tabbing and allow to create windows in tab. Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
parent
b63164645b
commit
c5941d105f
7 changed files with 295 additions and 2 deletions
|
|
@ -6,7 +6,9 @@ use objc2::rc::{Id, Shared};
|
|||
use objc2::runtime::Object;
|
||||
use objc2::{extern_class, extern_methods, msg_send_id, ClassType};
|
||||
|
||||
use super::{NSButton, NSColor, NSEvent, NSPasteboardType, NSResponder, NSScreen, NSView};
|
||||
use super::{
|
||||
NSButton, NSColor, NSEvent, NSPasteboardType, NSResponder, NSScreen, NSView, NSWindowTabGroup,
|
||||
};
|
||||
|
||||
extern_class!(
|
||||
/// Main-Thread-Only!
|
||||
|
|
@ -171,6 +173,12 @@ extern_methods!(
|
|||
#[sel(setLevel:)]
|
||||
pub fn setLevel(&self, level: NSWindowLevel);
|
||||
|
||||
#[sel(setAllowsAutomaticWindowTabbing:)]
|
||||
pub fn setAllowsAutomaticWindowTabbing(val: bool);
|
||||
|
||||
#[sel(setTabbingIdentifier:)]
|
||||
pub fn setTabbingIdentifier(&self, identifier: &NSString);
|
||||
|
||||
#[sel(setDocumentEdited:)]
|
||||
pub fn setDocumentEdited(&self, val: bool);
|
||||
|
||||
|
|
@ -201,6 +209,20 @@ extern_methods!(
|
|||
#[sel(isZoomed)]
|
||||
pub fn isZoomed(&self) -> bool;
|
||||
|
||||
#[sel(allowsAutomaticWindowTabbing)]
|
||||
pub fn allowsAutomaticWindowTabbing() -> bool;
|
||||
|
||||
#[sel(selectNextTab)]
|
||||
pub fn selectNextTab(&self);
|
||||
|
||||
pub fn tabbingIdentifier(&self) -> Id<NSString, Shared> {
|
||||
unsafe { msg_send_id![self, tabbingIdentifier] }
|
||||
}
|
||||
|
||||
pub fn tabGroup(&self) -> Id<NSWindowTabGroup, Shared> {
|
||||
unsafe { msg_send_id![self, tabGroup] }
|
||||
}
|
||||
|
||||
#[sel(isDocumentEdited)]
|
||||
pub fn isDocumentEdited(&self) -> bool;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue