mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
Added window titlebar GSTheme hooks.
This commit is contained in:
parent
a9f33627f1
commit
07f1b8759a
4 changed files with 47 additions and 19 deletions
|
@ -1244,6 +1244,13 @@ APPKIT_EXPORT_CLASS
|
|||
state: (int)inputState
|
||||
andTitle: (NSString*)title;
|
||||
|
||||
- (void) setFrameForCloseButton: (NSButton *)closeButton
|
||||
viewSize: (NSSize)viewSize;
|
||||
|
||||
- (NSRect) miniaturizeButtonFrameForBounds: (NSRect)bounds;
|
||||
|
||||
- (NSRect) closeButtonFrameForBounds: (NSRect)bounds;
|
||||
|
||||
- (NSColor *) browserHeaderTextColor;
|
||||
|
||||
- (void) drawBrowserHeaderCell: (NSTableHeaderCell*)cell
|
||||
|
|
|
@ -108,11 +108,9 @@
|
|||
}
|
||||
if (hasCloseButton)
|
||||
{
|
||||
closeButtonRect = NSMakeRect([self bounds].size.width - [theme titlebarButtonSize] -
|
||||
[theme titlebarPaddingRight], [self bounds].size.height -
|
||||
[theme titlebarButtonSize] - [theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize], [theme titlebarButtonSize]);
|
||||
[closeButton setFrame: closeButtonRect];
|
||||
NSRect closeButtonFrame = [[GSTheme theme] closeButtonFrameForBounds: [self bounds]];
|
||||
|
||||
[closeButton setFrame: closeButtonFrame];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -121,10 +119,8 @@
|
|||
|
||||
if (hasMiniaturizeButton)
|
||||
{
|
||||
miniaturizeButtonRect = NSMakeRect([theme titlebarPaddingLeft], [self bounds].size.height -
|
||||
[theme titlebarButtonSize] - [theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize], [theme titlebarButtonSize]);
|
||||
[miniaturizeButton setFrame: miniaturizeButtonRect];
|
||||
NSRect miniaturizeButtonFrame = [[GSTheme theme] miniaturizeButtonFrameForBounds: [self bounds]];
|
||||
[miniaturizeButton setFrame: miniaturizeButtonFrame];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -967,13 +967,12 @@
|
|||
// fill oval with background color
|
||||
[backgroundColor set];
|
||||
[oval fill];
|
||||
|
||||
|
||||
// and stroke rounded button
|
||||
[[NSColor shadowColor] set];
|
||||
[oval stroke];
|
||||
}
|
||||
|
||||
|
||||
- (void) drawSwitchInRect: (NSRect)rect
|
||||
forState: (NSControlStateValue)state
|
||||
enabled: (BOOL)enabled
|
||||
|
@ -2073,6 +2072,38 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setFrameForCloseButton: (NSButton *)closeButton
|
||||
viewSize: (NSSize)viewSize
|
||||
{
|
||||
NSSize buttonSize = [[closeButton image] size];
|
||||
buttonSize = NSMakeSize(buttonSize.width + 3, buttonSize.height + 3);
|
||||
|
||||
[closeButton setFrame: NSMakeRect(viewSize.width - buttonSize.width - 4,
|
||||
(viewSize.height - buttonSize.height) / 2,
|
||||
buttonSize.width,
|
||||
buttonSize.height)];
|
||||
}
|
||||
|
||||
- (NSRect) minimizeButtonFrameForBounds: (NSRect)bounds
|
||||
{
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
|
||||
return NSMakeRect(bounds.size.width - [theme titlebarButtonSize] -
|
||||
[theme titlebarPaddingRight], bounds.size.height -
|
||||
[theme titlebarButtonSize] - [theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize], [theme titlebarButtonSize]);
|
||||
}
|
||||
|
||||
- (NSRect) miniaturizeButtonFrameForBounds: (NSRect)bounds
|
||||
{
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
|
||||
return NSMakeRect([theme titlebarPaddingLeft],
|
||||
bounds.size.height - [theme titlebarButtonSize] - [theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize],
|
||||
[theme titlebarButtonSize]);
|
||||
}
|
||||
|
||||
- (NSColor *) browserHeaderTextColor
|
||||
{
|
||||
NSColor *color;
|
||||
|
|
|
@ -440,15 +440,9 @@
|
|||
[closeButton setTarget: _owner];
|
||||
[closeButton setAction: closeAction];
|
||||
|
||||
viewSize = [self frame].size;
|
||||
buttonSize = [[closeButton image] size];
|
||||
buttonSize = NSMakeSize(buttonSize.width + 3, buttonSize.height + 3);
|
||||
|
||||
// Update location
|
||||
[closeButton setFrame:
|
||||
NSMakeRect(viewSize.width - buttonSize.width - 4,
|
||||
(viewSize.height - buttonSize.height) / 2,
|
||||
buttonSize.width, buttonSize.height)];
|
||||
[[GSTheme theme] setFrameForCloseButton: closeButton
|
||||
viewSize: [self frame].size];
|
||||
|
||||
[closeButton setAutoresizingMask: NSViewMinXMargin | NSViewMaxYMargin];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue