mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
MacPDF: Give sidebar the more modern look
This Just Works with NSToolbarSidebarTrackingSeparatorItemIdentifier, as long as your window is has NSWindowStyleMaskFullSizeContentView in its style mask. If it doesn't, things behave pretty weirdly and at least in the docs I looked at, this requirement wasn't documented at all :/ Anyways, switch MacPDFView to use safeAreaRect instead of bounds now that we use NSWindowStyleMaskFullSizeContentView so that we don't draw parts of the PDF under the title bar. Also be careful to invalidate the PDF view if safeAreaRect changes, so that the page is redrawn when toolbar visibility gets toggled.
This commit is contained in:
parent
b1e9c419a6
commit
f02b84d34d
2 changed files with 25 additions and 4 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
- (instancetype)initWithDocument:(MacPDFDocument*)document
|
||||
{
|
||||
auto const style_mask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable;
|
||||
auto const style_mask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable | NSWindowStyleMaskFullSizeContentView;
|
||||
NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 600, 800)
|
||||
styleMask:style_mask
|
||||
backing:NSBackingStoreBuffered
|
||||
|
@ -123,7 +123,10 @@
|
|||
{
|
||||
// NSToolbarToggleSidebarItemIdentifier sends toggleSidebar: along the responder chain,
|
||||
// which NSSplitViewController conveniently implements.
|
||||
return @[ NSToolbarToggleSidebarItemIdentifier ];
|
||||
return @[
|
||||
NSToolbarToggleSidebarItemIdentifier,
|
||||
NSToolbarSidebarTrackingSeparatorItemIdentifier,
|
||||
];
|
||||
}
|
||||
|
||||
- (NSToolbarItem*)toolbar:(NSToolbar*)toolbar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue