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:
gcasa 2015-06-25 18:18:41 +00:00
parent 052fcd5eab
commit a2db2de101
4 changed files with 47 additions and 4 deletions

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