mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
implement suggestion to call validation methods in perform methods.
This commit is contained in:
parent
41484fd5b3
commit
0740fc5f14
2 changed files with 18 additions and 3 deletions
|
@ -41,6 +41,7 @@
|
|||
@protocol NSUserInterfaceValidations
|
||||
|
||||
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem;
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSUserInterfaceValidation
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#import "AppKit/NSTextFinder.h"
|
||||
#import "AppKit/NSTextView.h"
|
||||
#import "AppKit/NSUserInterfaceValidation.h"
|
||||
|
||||
#import "GSTextFinder.h"
|
||||
|
||||
|
@ -114,15 +115,23 @@
|
|||
// Validating and performing
|
||||
- (void) performTextFinderAction: (id)sender
|
||||
{
|
||||
if (_finder == nil)
|
||||
BOOL valid = [self validateUserInterfaceAction: sender];
|
||||
if (valid)
|
||||
{
|
||||
_finder = [[GSTextFinder alloc] init];
|
||||
if (_finder == nil)
|
||||
{
|
||||
_finder = [[GSTextFinder alloc] init];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) performFindPanelAction: (id)sender
|
||||
{
|
||||
[self performAction: [sender tag]];
|
||||
BOOL valid = [self validateUserInterfaceAction: sender];
|
||||
if (valid)
|
||||
{
|
||||
[self performAction: [sender tag]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) performAction: (NSTextFinderAction)op
|
||||
|
@ -174,6 +183,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL) validateUserInterfaceAction: (id<NSValidatedUserInterfaceItem>)item
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) validateAction: (NSTextFinderAction)op
|
||||
{
|
||||
return YES;
|
||||
|
|
Loading…
Reference in a new issue