Added methods to retrieve dimensions for titlebar buttons and padding dimensions in a theme specific way rather than having them hard-coded.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38681 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2015-06-25 18:18:41 +00:00
parent 8031e43fbc
commit 0ff0a07742
4 changed files with 47 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2015-06-25 14:17-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h: Declarations for new theme
methods.
* Source/GSStandardWindowDecorationView.m Changes to use new methods.
* Source/GSThemeDrawing.m: Add methods to allow retrieving dimensions
for window decorations in a theme specific manner.
2015-06-14 17:47-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSAnimationContext.h

View file

@ -1163,6 +1163,14 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
- (float) resizebarHeight;
- (float) titlebarButtonSize;
- (float) titlebarPaddingRight;
- (float) titlebarPaddingTop;
- (float) titlebarPaddingLeft;
- (void) drawWindowBorder: (NSRect)rect
withFrame: (NSRect)frame
forStyleMask: (unsigned int)styleMask

View file

@ -108,15 +108,18 @@
}
if (hasCloseButton)
{
closeButtonRect = NSMakeRect(
[self bounds].size.width - 15 - 4, [self bounds].size.height - 15 - 4, 15, 15);
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];
}
if (hasMiniaturizeButton)
{
miniaturizeButtonRect = NSMakeRect(
4, [self bounds].size.height - 15 - 4, 15, 15);
miniaturizeButtonRect = NSMakeRect([theme titlebarPaddingLeft], [self bounds].size.height -
[theme titlebarButtonSize] - [theme titlebarPaddingTop],
[theme titlebarButtonSize], [theme titlebarButtonSize]);
[miniaturizeButton setFrame: miniaturizeButtonRect];
}
}

View file

@ -1495,6 +1495,10 @@ static NSImage *spinningImages[MaxCount];
/* These include the black border. */
#define TITLE_HEIGHT 23.0
#define RESIZE_HEIGHT 9.0
#define TITLEBAR_BUTTON_SIZE 15.0
#define TITLEBAR_PADDING_TOP 4.0
#define TITLEBAR_PADDING_RIGHT 4.0
#define TITLEBAR_PADDING_LEFT 4.0
- (float) titlebarHeight
{
@ -1506,6 +1510,26 @@ static NSImage *spinningImages[MaxCount];
return RESIZE_HEIGHT;
}
- (float) titlebarButtonSize
{
return TITLEBAR_BUTTON_SIZE;
}
- (float) titlebarPaddingRight
{
return TITLEBAR_PADDING_RIGHT;
}
- (float) titlebarPaddingTop
{
return TITLEBAR_PADDING_TOP;
}
- (float) titlebarPaddingLeft
{
return TITLEBAR_PADDING_LEFT;
}
static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
- (void) drawTitleBarRect: (NSRect)titleBarRect