mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Improved placement of standalone views and automatically determine the minimum size for the view based on the positions of it's subviews.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23172 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c757b8f0a3
commit
a73cd2aaa2
4 changed files with 52 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-07-16 23:13 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormFunctions.h:
|
||||
* GormCore/GormFunctions.m:
|
||||
* GormCore/GormViewWindow.m: Improved placement of standalone
|
||||
views when being loaded by .gorm files.
|
||||
|
||||
2006-07-15 18:34 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Images/Gorm.tiff: Slightly improved icon. Based on suggestions
|
||||
|
|
|
@ -80,4 +80,6 @@ NSString *formatOutlet(NSString *outlet);
|
|||
NSArray *_GSObjCMethodNamesForClass(Class class, BOOL collect);
|
||||
|
||||
NSArray *_GSObjCVariableNames(Class class, BOOL collect);
|
||||
|
||||
NSRect minimalContainerFrame(NSArray *views);
|
||||
#endif
|
||||
|
|
|
@ -447,3 +447,27 @@ NSArray *_GSObjCVariableNames(Class class, BOOL collect)
|
|||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
NSRect minimalContainerFrame(NSArray *views)
|
||||
{
|
||||
NSEnumerator *en = [views objectEnumerator];
|
||||
id o = nil;
|
||||
float w = 0.0;
|
||||
float h = 0.0;
|
||||
|
||||
while((o = [en nextObject]) != nil)
|
||||
{
|
||||
NSRect frame = [o frame];
|
||||
float nw = frame.origin.x + frame.size.width;
|
||||
float nh = frame.origin.y + frame.size.height;
|
||||
|
||||
if(nw > w)
|
||||
w = nw;
|
||||
|
||||
if(nh > h)
|
||||
h = nh;
|
||||
}
|
||||
|
||||
return NSMakeRect(0,0,w+40,h+70);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <InterfaceBuilder/InterfaceBuilder.h>
|
||||
#include "GormFunctions.h"
|
||||
|
||||
@interface GormViewWindowDelegate : NSObject
|
||||
{
|
||||
|
@ -60,12 +61,25 @@
|
|||
// it's new... give it size.
|
||||
if(NSIsEmptyRect([_view frame]))
|
||||
{
|
||||
NSRect newFrame = windowFrame;
|
||||
NSArray *subs = [_view subviews];
|
||||
NSRect newFrame;
|
||||
|
||||
if([subs count] > 0)
|
||||
{
|
||||
newFrame = minimalContainerFrame(subs);
|
||||
[window setFrame: newFrame display: YES];
|
||||
[_view setPostsFrameChangedNotifications: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
newFrame = windowFrame;
|
||||
|
||||
newFrame.origin.x = 10;
|
||||
newFrame.origin.y = 20;
|
||||
newFrame.size.height -= 70;
|
||||
newFrame.size.width -= 20;
|
||||
}
|
||||
|
||||
newFrame.origin.x = 10;
|
||||
newFrame.origin.y = 20;
|
||||
newFrame.size.height -= 70;
|
||||
newFrame.size.width -= 20;
|
||||
[_view setPostsFrameChangedNotifications: NO];
|
||||
[_view setFrame: newFrame];
|
||||
[_view setPostsFrameChangedNotifications: YES];
|
||||
|
|
Loading…
Reference in a new issue