Implement methods for resizing subviews.

Some minor bug fixes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@1637 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gnustep 1996-06-21 15:08:08 +00:00
parent f5813d015b
commit d4848b7da2
6 changed files with 65 additions and 9 deletions

View file

@ -1,3 +1,15 @@
Wed Jun 19 14:25:46 1996 Scott Christley <scottc@net-community.com>
* Source/NSView.m (resizeSubviewsWithOldSize:): Implement method.
(setFrame:): Notify subviews that size has changed.
(initWithFrame:): Automatically resize subviews.
* Source/Makefile.sed.nt: Have the library automatically contain
COFF debugging information.
* Source/NSButton.m (mouseDown:): Ignore the mouse if the button
is not enabled.
* Source/NSFont.m (MB_USER_FIXED_FONT, MB_USER_FONT): Rename
global variables to correspond with coding standards.
Thu Jun 6 09:20:51 1996 GNUstep Development <gnustep@duncan.ocbi.com> Thu Jun 6 09:20:51 1996 GNUstep Development <gnustep@duncan.ocbi.com>
* Headers/gnustep/gui/NSApplication.h (-context): New method. * Headers/gnustep/gui/NSApplication.h (-context): New method.

View file

@ -20,7 +20,7 @@ s/INIT_FILE =/INIT_FILE = gnustep_gui_init_runtime/
s/@LDFLAGS@/-align:0x1000 -entry:WinMainCRTStartup -stack:1000000,1000000/ s/@LDFLAGS@/-align:0x1000 -entry:WinMainCRTStartup -stack:1000000,1000000/
s/LD = ld/LD = ld -subsystem:windows/ s/LD = ld/LD = ld -subsystem:windows/
s/LDOUT =/LDOUT = -out:/ s/LDOUT =/LDOUT = -out:/
s/LIB = ar/LIB = lib/ s/LIB = ar/LIB = lib -debugtype:coff/
s/LIBFLAGS = rc/LIBFLAGS =/ s/LIBFLAGS = rc/LIBFLAGS =/
s/LIBOUT =/LIBOUT = -out:/ s/LIBOUT =/LIBOUT = -out:/
s/@RANLIB@/touch/ s/@RANLIB@/touch/

View file

@ -102,6 +102,14 @@ id MB_NSBUTTON_CLASS;
[self display]; [self display];
} }
//
// Identifying the Selected Cell
//
- (id)selectedCell
{
return cell;
}
// //
// Setting the State // Setting the State
// //
@ -257,6 +265,10 @@ id MB_NSBUTTON_CLASS;
NSDebugLog(@"NSButton mouseDown\n"); NSDebugLog(@"NSButton mouseDown\n");
// If we are not enabled then ignore the mouse
if (![self isEnabled])
return;
// capture mouse // capture mouse
[[self window] captureMouse: self]; [[self window] captureMouse: self];

View file

@ -31,8 +31,8 @@
#include <gnustep/gui/NSFont.h> #include <gnustep/gui/NSFont.h>
#include <gnustep/gui/NSFontManager.h> #include <gnustep/gui/NSFontManager.h>
NSFont *MB_USER_FIXED_FONT; NSFont *gnustep_gui_user_fixed_font;
NSFont *MB_USER_FONT; NSFont *gnustep_gui_user_font;
// Global Strings // Global Strings
NSString *NSAFMAscender; NSString *NSAFMAscender;
@ -110,13 +110,13 @@ NSString *NSAFMXHeight;
+ (NSFont *)userFixedPitchFontOfSize:(float)fontSize + (NSFont *)userFixedPitchFontOfSize:(float)fontSize
{ {
NSFontManager *fm = [NSFontManager sharedFontManager]; NSFontManager *fm = [NSFontManager sharedFontManager];
return [fm convertFont:MB_USER_FIXED_FONT toSize:fontSize]; return [fm convertFont:gnustep_gui_user_fixed_font toSize:fontSize];
} }
+ (NSFont *)userFontOfSize:(float)fontSize + (NSFont *)userFontOfSize:(float)fontSize
{ {
NSFontManager *fm = [NSFontManager sharedFontManager]; NSFontManager *fm = [NSFontManager sharedFontManager];
return [fm convertFont:MB_USER_FONT toSize:fontSize]; return [fm convertFont:gnustep_gui_user_font toSize:fontSize];
} }
// //
@ -124,12 +124,12 @@ NSString *NSAFMXHeight;
// //
+ (void)setUserFixedPitchFont:(NSFont *)aFont + (void)setUserFixedPitchFont:(NSFont *)aFont
{ {
MB_USER_FIXED_FONT = aFont; gnustep_gui_user_fixed_font = aFont;
} }
+ (void)setUserFont:(NSFont *)aFont + (void)setUserFont:(NSFont *)aFont
{ {
MB_USER_FONT = aFont; gnustep_gui_user_font = aFont;
} }
+ (void)useFont:(NSString *)fontName + (void)useFont:(NSString *)fontName

View file

@ -154,7 +154,7 @@ NSString *NSViewFocusChangedNotification;
disable_autodisplay = NO; disable_autodisplay = NO;
needs_display = YES; needs_display = YES;
post_frame_changes = NO; post_frame_changes = NO;
autoresize_subviews = NO; autoresize_subviews = YES;
return self; return self;
} }
@ -365,8 +365,13 @@ NSString *NSViewFocusChangedNotification;
- (void)setFrame:(NSRect)frameRect - (void)setFrame:(NSRect)frameRect
{ {
NSSize old_size = bounds.size;
frame = frameRect; frame = frameRect;
bounds.size = frame.size; bounds.size = frame.size;
// Resize subviews
[self resizeSubviewsWithOldSize: old_size];
} }
- (void)setFrameOrigin:(NSPoint)newOrigin - (void)setFrameOrigin:(NSPoint)newOrigin
@ -379,8 +384,13 @@ NSString *NSViewFocusChangedNotification;
- (void)setFrameSize:(NSSize)newSize - (void)setFrameSize:(NSSize)newSize
{ {
NSSize old_size = bounds.size;
frame.size = newSize; frame.size = newSize;
bounds.size = newSize; bounds.size = newSize;
// Resize subviews
[self resizeSubviewsWithOldSize: old_size];
} }
// //
@ -524,7 +534,27 @@ NSString *NSViewFocusChangedNotification;
// Resizing Subviews // Resizing Subviews
// //
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize - (void)resizeSubviewsWithOldSize:(NSSize)oldSize
{} {
id e, o;
// Are we suppose to resize our subviews?
if (![self autoresizesSubviews])
return;
e = [sub_views objectEnumerator];
o = [e nextObject];
while (o)
{
NSRect b = [o bounds];
NSSize old_size = b.size;
// Resize the subview
// Then tell it to resize its subviews
[o resizeWithOldSuperviewSize: oldSize];
[o resizeSubviewsWithOldSize: old_size];
o = [e nextObject];
}
}
- (void)setAutoresizesSubviews:(BOOL)flag - (void)setAutoresizesSubviews:(BOOL)flag
{ {

View file

@ -1270,6 +1270,8 @@ pasteboard:(NSPasteboard *)pboard
[aDecoder decodeValueOfObjCType:@encode(BOOL) at: &menu_exclude]; [aDecoder decodeValueOfObjCType:@encode(BOOL) at: &menu_exclude];
// Register ourselves with the Application object // Register ourselves with the Application object
// +++ we shouldn't do this because coding may not be done?
// better to do it in the awakeFromCoder method
theApp = [NSApplication sharedApplication]; theApp = [NSApplication sharedApplication];
[theApp addWindowsItem:self title:nil filename:NO]; [theApp addWindowsItem:self title:nil filename:NO];
NSLog(@"NSWindow: finish decoding\n"); NSLog(@"NSWindow: finish decoding\n");