mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 18:30:56 +00:00
* Source/GSWindowDecorationView.[hm]: Addition of ivars to track
if a toolbar or menu is present in the window decorations. Modified code to set these to YES/NO. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29203 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
47422f87d4
commit
2de8faf99a
3 changed files with 49 additions and 52 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2010-01-04 00:25-EST Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
|
* Source/GSWindowDecorationView.[hm]: Addition of ivars to track
|
||||||
|
if a toolbar or menu is present in the window decorations. Modified
|
||||||
|
code to set these to YES/NO.
|
||||||
|
|
||||||
2010-01-04 Riccardo Mottola <rmottola@users.sf.net>
|
2010-01-04 Riccardo Mottola <rmottola@users.sf.net>
|
||||||
|
|
||||||
* Source/GSWindowDecorationView.m: When adding a toolbar take in account
|
* Source/GSWindowDecorationView.m: When adding a toolbar take in account
|
||||||
|
|
|
@ -54,11 +54,11 @@ this, either directly, or indirectly (by using the backend).
|
||||||
{
|
{
|
||||||
NSWindow *window; /* not retained */
|
NSWindow *window; /* not retained */
|
||||||
int windowNumber;
|
int windowNumber;
|
||||||
|
|
||||||
NSRect contentRect;
|
NSRect contentRect;
|
||||||
|
|
||||||
int inputState;
|
int inputState;
|
||||||
BOOL documentEdited;
|
BOOL documentEdited;
|
||||||
|
BOOL hasMenu;
|
||||||
|
BOOL hasToolbar;
|
||||||
}
|
}
|
||||||
+ (id<GSWindowDecorator>) windowDecorator;
|
+ (id<GSWindowDecorator>) windowDecorator;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ Standard OPENSTEP-ish window decorations.
|
||||||
@interface GSStandardWindowDecorationView : GSWindowDecorationView
|
@interface GSStandardWindowDecorationView : GSWindowDecorationView
|
||||||
{
|
{
|
||||||
BOOL hasTitleBar, hasResizeBar, hasCloseButton, hasMiniaturizeButton;
|
BOOL hasTitleBar, hasResizeBar, hasCloseButton, hasMiniaturizeButton;
|
||||||
BOOL isTitled;
|
BOOL isTitled; //, hasToolbar, hasMenu;
|
||||||
NSRect titleBarRect;
|
NSRect titleBarRect;
|
||||||
NSRect resizeBarRect;
|
NSRect resizeBarRect;
|
||||||
NSRect closeButtonRect;
|
NSRect closeButtonRect;
|
||||||
|
|
|
@ -108,6 +108,8 @@
|
||||||
self = [super initWithFrame: frame];
|
self = [super initWithFrame: frame];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
|
hasToolbar = NO;
|
||||||
|
hasMenu = NO;
|
||||||
window = w;
|
window = w;
|
||||||
// Content rect will be everything apart from the border
|
// Content rect will be everything apart from the border
|
||||||
// that is including menu, toolbar and the like.
|
// that is including menu, toolbar and the like.
|
||||||
|
@ -214,7 +216,7 @@
|
||||||
contentViewFrame = [isa contentRectForFrameRect: frame
|
contentViewFrame = [isa contentRectForFrameRect: frame
|
||||||
styleMask: [window styleMask]];
|
styleMask: [window styleMask]];
|
||||||
|
|
||||||
if ([_window menu] != nil)
|
if (hasMenu)
|
||||||
{
|
{
|
||||||
NSMenuView *menuView;
|
NSMenuView *menuView;
|
||||||
float menuBarHeight = [NSMenuView menuBarHeight];
|
float menuBarHeight = [NSMenuView menuBarHeight];
|
||||||
|
@ -228,6 +230,8 @@
|
||||||
contentViewFrame.size.height -= menuBarHeight;
|
contentViewFrame.size.height -= menuBarHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hasToolbar)
|
||||||
|
{
|
||||||
if ([tb isVisible])
|
if ([tb isVisible])
|
||||||
{
|
{
|
||||||
GSToolbarView *tv = [tb _toolbarView];
|
GSToolbarView *tv = [tb _toolbarView];
|
||||||
|
@ -248,6 +252,7 @@
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
contentViewFrame.size.height -= newToolbarViewHeight;
|
contentViewFrame.size.height -= newToolbarViewHeight;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) changeWindowHeight: (float)difference
|
- (void) changeWindowHeight: (float)difference
|
||||||
|
@ -355,6 +360,7 @@
|
||||||
float newToolbarViewHeight;
|
float newToolbarViewHeight;
|
||||||
float contentYOrigin;
|
float contentYOrigin;
|
||||||
|
|
||||||
|
hasToolbar = YES;
|
||||||
[toolbarView setFrameSize: NSMakeSize(contentRect.size.width, 100)];
|
[toolbarView setFrameSize: NSMakeSize(contentRect.size.width, 100)];
|
||||||
// Will recalculate the layout
|
// Will recalculate the layout
|
||||||
[toolbarView _reload];
|
[toolbarView _reload];
|
||||||
|
@ -362,8 +368,10 @@
|
||||||
|
|
||||||
// take in account of the menubar when calculating the origin
|
// take in account of the menubar when calculating the origin
|
||||||
contentYOrigin = NSMaxY(contentRect);
|
contentYOrigin = NSMaxY(contentRect);
|
||||||
if ([_window menu] != nil)
|
if(hasMenu)
|
||||||
|
{
|
||||||
contentYOrigin -= [NSMenuView menuBarHeight];
|
contentYOrigin -= [NSMenuView menuBarHeight];
|
||||||
|
}
|
||||||
|
|
||||||
// Plug the toolbar view
|
// Plug the toolbar view
|
||||||
[toolbarView setFrame: NSMakeRect(
|
[toolbarView setFrame: NSMakeRect(
|
||||||
|
@ -381,6 +389,7 @@
|
||||||
float toolbarViewHeight = [toolbarView frame].size.height;
|
float toolbarViewHeight = [toolbarView frame].size.height;
|
||||||
|
|
||||||
// Unplug the toolbar view
|
// Unplug the toolbar view
|
||||||
|
hasToolbar = NO;
|
||||||
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
|
||||||
[self changeWindowHeight: -toolbarViewHeight];
|
[self changeWindowHeight: -toolbarViewHeight];
|
||||||
|
@ -413,6 +422,7 @@
|
||||||
{
|
{
|
||||||
float menubarHeight = [NSMenuView menuBarHeight];
|
float menubarHeight = [NSMenuView menuBarHeight];
|
||||||
|
|
||||||
|
hasMenu = YES;
|
||||||
// Plug the menu view
|
// Plug the menu view
|
||||||
[menuView setFrame: NSMakeRect(
|
[menuView setFrame: NSMakeRect(
|
||||||
contentRect.origin.x,
|
contentRect.origin.x,
|
||||||
|
@ -433,37 +443,18 @@
|
||||||
{
|
{
|
||||||
if ([v isKindOfClass: [NSMenuView class]] == YES)
|
if ([v isKindOfClass: [NSMenuView class]] == YES)
|
||||||
{
|
{
|
||||||
float menubarHeight = [NSMenuView menuBarHeight];
|
|
||||||
|
|
||||||
/* Unplug the menu view and return it so that it can be
|
/* Unplug the menu view and return it so that it can be
|
||||||
* restored to its original menu if necessary.
|
* restored to its original menu if necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
hasMenu = NO;
|
||||||
[RETAIN(v) removeFromSuperviewWithoutNeedingDisplay];
|
[RETAIN(v) removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
|
||||||
[self changeWindowHeight: -menubarHeight];
|
[self changeWindowHeight: -([NSMenuView menuBarHeight])];
|
||||||
return AUTORELEASE(v);
|
return AUTORELEASE(v);
|
||||||
}
|
}
|
||||||
else if ([v isKindOfClass: [GSToolbarView class]] == YES)
|
}
|
||||||
{
|
|
||||||
GSToolbarView *tv = (GSToolbarView *)v;
|
|
||||||
NSRect toolViewRect;
|
|
||||||
|
|
||||||
if ([[_window toolbar] isVisible])
|
|
||||||
{
|
|
||||||
/* recalculate the origin of the toolbar view */
|
|
||||||
toolViewRect = [tv frame];
|
|
||||||
toolViewRect = NSMakeRect(
|
|
||||||
toolViewRect.origin.x,
|
|
||||||
toolViewRect.origin.y + [NSMenuView menuBarHeight],
|
|
||||||
toolViewRect.size.width,
|
|
||||||
toolViewRect.size.height);
|
|
||||||
|
|
||||||
/* move the toolbar view up of the menubar height */
|
|
||||||
[tv setFrame: toolViewRect];
|
|
||||||
[tv setNeedsDisplay:YES];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue