Drawing change on NSBox.

Changed handling of buttons in save and open panel, this was possible after using different values for the run loop constants.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18708 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
FredKiefer 2004-02-29 00:11:51 +00:00
parent 4f6c61328f
commit a22cfc89d0
5 changed files with 37 additions and 24 deletions

View file

@ -1,3 +1,21 @@
2004-02-29 Fred Kiefer <FredKiefer@gmx.de>
* Header/AppKit/NSApplication.h:
Defined values for the constants NSRunStoppedResponse,
NSRunAbortedResponse, NSRunContinuesResponse.
* Source/NSOpenPanel.m: (-ok:)
* Source/NSSavePanel.m: (-cancel:, -ok:) Use stopModalWithCode:
with the approriate button code.
* Source/NSSavePanel.m: (-runModalForDirectory:file:,
-runModalForDirectory:file:relativeToWindow:) Removed the check
for the pressed button and return the value of the model loop
directly.
* Source/NSBox.m: (-drawRect:) Blank out the title rectangle
here and not delegate this to the title cell via the background
colour. (-initWithFrame:) Use an NSCell instead of an
NSTextFieldCell for the title, as setBackgroundColour: is no
longer needed.
2004-02-28 Adam Fedor <fedor@gnu.org> 2004-02-28 Adam Fedor <fedor@gnu.org>
* configure.ac: Don't add CPPFLAGS to ADDITIONAL_INCLUDES, add * configure.ac: Don't add CPPFLAGS to ADDITIONAL_INCLUDES, add
@ -58,7 +76,7 @@
-viewWillStartLiveResize, -viewDidEndLiveResize, -viewWillStartLiveResize, -viewDidEndLiveResize,
-mouseDownCanMoveWindow, -dragPromisedFilesOfTypes:...event:, -mouseDownCanMoveWindow, -dragPromisedFilesOfTypes:...event:,
-canBecomeKeyView) -canBecomeKeyView)
Stups for new MacOSX methods. Stubs for new MacOSX methods.
2004-02-17 00:18 Gregory John Casamento <greg_casamento@yahoo.com> 2004-02-17 00:18 Gregory John Casamento <greg_casamento@yahoo.com>

View file

@ -62,9 +62,9 @@
typedef struct _NSModalSession *NSModalSession; typedef struct _NSModalSession *NSModalSession;
enum { enum {
NSRunStoppedResponse, NSRunStoppedResponse = (-1000),
NSRunAbortedResponse, NSRunAbortedResponse = (-1001),
NSRunContinuesResponse NSRunContinuesResponse = (-1002)
}; };
#ifndef STRICT_OPENSTEP #ifndef STRICT_OPENSTEP

View file

@ -65,12 +65,10 @@
{ {
[super initWithFrame: frameRect]; [super initWithFrame: frameRect];
_cell = [[NSTextFieldCell alloc] initTextCell: @"Title"]; _cell = [[NSCell alloc] initTextCell: @"Title"];
[_cell setAlignment: NSCenterTextAlignment]; [_cell setAlignment: NSCenterTextAlignment];
[_cell setBordered: NO]; [_cell setBordered: NO];
[_cell setEditable: NO]; [_cell setEditable: NO];
[_cell setDrawsBackground: YES];
//[_cell setBackgroundColor: [NSColor controlColor]];
_offsets.width = 5; _offsets.width = 5;
_offsets.height = 5; _offsets.height = 5;
_border_rect = _bounds; _border_rect = _bounds;
@ -381,7 +379,14 @@
// Draw title // Draw title
if (_title_position != NSNoTitle) if (_title_position != NSNoTitle)
{ {
[_cell setBackgroundColor: color]; // If the title is on the border, clip a hole in the later
if ((_border_type != NSNoBorder) &&
((_title_position == NSAtTop) ||
(_title_position == NSAtBottom)))
{
[color set];
NSRectFill(_title_rect);
}
[_cell drawWithFrame: _title_rect inView: self]; [_cell drawWithFrame: _title_rect inView: self];
} }
} }

View file

@ -557,7 +557,7 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
} }
_OKButtonPressed = YES; _OKButtonPressed = YES;
[NSApp stopModal]; [NSApp stopModalWithCode: NSOKButton];
[self close]; [self close];
} }

View file

@ -891,12 +891,7 @@ selectCellWithString: (NSString*)title
- (int) runModalForDirectory: (NSString*)path file: (NSString*)filename - (int) runModalForDirectory: (NSString*)path file: (NSString*)filename
{ {
[self _setupForDirectory: path file: filename]; [self _setupForDirectory: path file: filename];
[NSApp runModalForWindow: self]; return [NSApp runModalForWindow: self];
if (_OKButtonPressed)
return NSOKButton;
else
return NSCancelButton;
} }
- (int) runModalForDirectory: (NSString *)path - (int) runModalForDirectory: (NSString *)path
@ -904,13 +899,8 @@ selectCellWithString: (NSString*)title
relativeToWindow: (NSWindow*)window relativeToWindow: (NSWindow*)window
{ {
[self _setupForDirectory: path file: filename]; [self _setupForDirectory: path file: filename];
[NSApp runModalForWindow: self return [NSApp runModalForWindow: self
relativeToWindow: window]; relativeToWindow: window];
if (_OKButtonPressed)
return NSOKButton;
else
return NSCancelButton;
} }
- (void) beginSheetForDirectory: (NSString *)path - (void) beginSheetForDirectory: (NSString *)path
@ -973,7 +963,7 @@ selectCellWithString: (NSString*)title
{ {
_fullFileName = nil; _fullFileName = nil;
_directory = nil; _directory = nil;
[NSApp stopModal]; [NSApp stopModalWithCode: NSCancelButton];
[self close]; [self close];
} }
@ -1083,7 +1073,7 @@ selectCellWithString: (NSString*)title
return; return;
_OKButtonPressed = YES; _OKButtonPressed = YES;
[NSApp stopModal]; [NSApp stopModalWithCode: NSOKButton];
[self close]; [self close];
} }