2022-06-05 13:49:31 +00:00
|
|
|
// This file Copyright © 2008-2022 Transmission authors and contributors.
|
|
|
|
// It may be used under the MIT (SPDX: MIT) license.
|
|
|
|
// License text can be found in the licenses/ folder.
|
|
|
|
|
|
|
|
#import "MainWindow.h"
|
|
|
|
|
2022-06-13 00:54:52 +00:00
|
|
|
#define TOOL_BAR_HEIGHT 28.0
|
2022-06-05 13:49:31 +00:00
|
|
|
|
|
|
|
@implementation MainWindow
|
|
|
|
|
|
|
|
- (void)toggleToolbarShown:(id)sender
|
|
|
|
{
|
|
|
|
NSRect frame = self.frame;
|
|
|
|
|
2022-06-13 00:54:52 +00:00
|
|
|
//fix window size and origin when toggling toolbar
|
|
|
|
if (self.toolbar.isVisible == YES)
|
2022-06-05 13:49:31 +00:00
|
|
|
{
|
2022-06-13 00:54:52 +00:00
|
|
|
frame.size.height += TOOL_BAR_HEIGHT;
|
|
|
|
frame.origin.y -= TOOL_BAR_HEIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frame.size.height -= TOOL_BAR_HEIGHT;
|
|
|
|
frame.origin.y += TOOL_BAR_HEIGHT;
|
2022-06-05 13:49:31 +00:00
|
|
|
}
|
|
|
|
|
2022-06-13 00:54:52 +00:00
|
|
|
[self setFrame:frame display:YES animate:NO];
|
2022-06-05 13:49:31 +00:00
|
|
|
[super toggleToolbarShown:sender];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|