mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Added [setDelegate:] method.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10140 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fc284cf51b
commit
1018742868
1 changed files with 24 additions and 1 deletions
|
@ -24,7 +24,11 @@
|
|||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSComboBox.h>
|
||||
#include <AppKit/NSComboBoxCell.h>
|
||||
|
||||
@interface NSObject(MouseUpping)
|
||||
- (NSEvent *)_mouseUpEvent;
|
||||
|
@ -35,6 +39,8 @@
|
|||
*/
|
||||
static Class usedCellClass;
|
||||
static Class comboBoxCellClass;
|
||||
static NSNotificationCenter *nc;
|
||||
|
||||
|
||||
@implementation NSComboBox
|
||||
|
||||
|
@ -45,6 +51,7 @@ static Class comboBoxCellClass;
|
|||
[self setVersion: 1];
|
||||
comboBoxCellClass = [NSComboBoxCell class];
|
||||
usedCellClass = comboBoxCellClass;
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,6 +234,22 @@ static Class comboBoxCellClass;
|
|||
return [_cell completes];
|
||||
}
|
||||
|
||||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
[super setDelegate: anObject];
|
||||
|
||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||
if ([_delegate respondsToSelector: @selector(comboBox##notif_name:)]) \
|
||||
[nc addObserver: _delegate \
|
||||
selector: @selector(comboBox##notif_name:) \
|
||||
name: NSComboBox##notif_name##Notification object: self]
|
||||
|
||||
SET_DELEGATE_NOTIFICATION(SelectionDidChange);
|
||||
SET_DELEGATE_NOTIFICATION(SelectionIsChanging);
|
||||
SET_DELEGATE_NOTIFICATION(WillPopUp);
|
||||
SET_DELEGATE_NOTIFICATION(WillDismiss);
|
||||
}
|
||||
|
||||
// Overridden
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue