mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 13:20:47 +00:00
Draw window title bar with image tiles, if available
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29504 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e086eb3dbe
commit
6a8d987dbc
2 changed files with 54 additions and 37 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-02-07 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSThemeDrawing.m
|
||||
(-drawTitleBarRect:forStyleMask:state:andTitle:):
|
||||
Draw window title bar with image tiles, if available
|
||||
|
||||
2010-02-07 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSTheme.m:
|
||||
|
|
|
@ -1140,6 +1140,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
|
|||
{NSWhite, NSWhite, NSDarkGray, NSDarkGray},
|
||||
{NSLightGray, NSLightGray, NSBlack, NSBlack}};
|
||||
NSRect workRect;
|
||||
GSDrawTiles *tiles = nil;
|
||||
|
||||
if (!titleTextAttributes[0])
|
||||
{
|
||||
|
@ -1172,45 +1173,55 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
|
|||
RELEASE(p);
|
||||
}
|
||||
|
||||
/*
|
||||
Draw the black border towards the rest of the window. (The outer black
|
||||
border is drawn in -drawRect: since it might be drawn even if we don't have
|
||||
a title bar.
|
||||
*/
|
||||
[[NSColor blackColor] set];
|
||||
PSmoveto(0, NSMinY(titleBarRect) + 0.5);
|
||||
PSrlineto(titleBarRect.size.width, 0);
|
||||
PSstroke();
|
||||
|
||||
/*
|
||||
Draw the button-like border.
|
||||
*/
|
||||
workRect = titleBarRect;
|
||||
workRect.origin.x += 1;
|
||||
workRect.origin.y += 1;
|
||||
workRect.size.width -= 2;
|
||||
workRect.size.height -= 2;
|
||||
|
||||
workRect = NSDrawTiledRects(workRect, workRect, edges, grays[inputState], 4);
|
||||
|
||||
/*
|
||||
Draw the background.
|
||||
*/
|
||||
switch (inputState)
|
||||
tiles = [self tilesNamed: @"GSWindowTitleBar" state: GSThemeNormalState];
|
||||
if (tiles == nil)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
[[NSColor windowFrameColor] set];
|
||||
break;
|
||||
case 1:
|
||||
[[NSColor lightGrayColor] set];
|
||||
break;
|
||||
case 2:
|
||||
[[NSColor darkGrayColor] set];
|
||||
break;
|
||||
}
|
||||
NSRectFill(workRect);
|
||||
/*
|
||||
Draw the black border towards the rest of the window. (The outer black
|
||||
border is drawn in -drawRect: since it might be drawn even if we don't have
|
||||
a title bar.
|
||||
*/
|
||||
[[NSColor blackColor] set];
|
||||
PSmoveto(0, NSMinY(titleBarRect) + 0.5);
|
||||
PSrlineto(titleBarRect.size.width, 0);
|
||||
PSstroke();
|
||||
|
||||
/*
|
||||
Draw the button-like border.
|
||||
*/
|
||||
workRect = titleBarRect;
|
||||
workRect.origin.x += 1;
|
||||
workRect.origin.y += 1;
|
||||
workRect.size.width -= 2;
|
||||
workRect.size.height -= 2;
|
||||
|
||||
workRect = NSDrawTiledRects(workRect, workRect, edges, grays[inputState], 4);
|
||||
|
||||
/*
|
||||
Draw the background.
|
||||
*/
|
||||
switch (inputState)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
[[NSColor windowFrameColor] set];
|
||||
break;
|
||||
case 1:
|
||||
[[NSColor lightGrayColor] set];
|
||||
break;
|
||||
case 2:
|
||||
[[NSColor darkGrayColor] set];
|
||||
break;
|
||||
}
|
||||
NSRectFill(workRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
[self fillRect: titleBarRect
|
||||
withTiles: tiles
|
||||
background: [NSColor windowFrameColor]];
|
||||
workRect = titleBarRect;
|
||||
}
|
||||
/* Draw the title. */
|
||||
if (styleMask & NSTitledWindowMask)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue