Rewritten combo box implementation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19418 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
qmathe 2004-05-29 13:17:21 +00:00
parent fd77800e9a
commit 6a2a5d22e2
7 changed files with 863 additions and 417 deletions

View file

@ -1,3 +1,17 @@
2004-05-29 Quentin Mathe <qmathe@lub-internet.fr>
* Source/NSComboBox.m:
* Headers/AppKit/NSComboBox.h:
* Source/NSComboBoxCell.m:
* Headers/AppKit/NSComboBoxCell.h:
* Images/GNUmakefile:
* Images/common_ComboBoxEllipsis.tiff:
New rewritten combo box implementation (which can be called completion
box now).
Everything should work except the completion possibility which needs some
layout manager and text view changes (patches to be commited by Alexander
Malmberg).
2004-05-29 Quentin Mathe <qmathe@lub-internet.fr> 2004-05-29 Quentin Mathe <qmathe@lub-internet.fr>
* Source/NSControl.m: Reverted to the previous version (1.61) because * Source/NSControl.m: Reverted to the previous version (1.61) because

View file

@ -27,9 +27,11 @@
#ifndef _GNUstep_H_NSComboBox #ifndef _GNUstep_H_NSComboBox
#define _GNUstep_H_NSComboBox #define _GNUstep_H_NSComboBox
#include <Foundation/NSNotification.h>
#include <AppKit/NSTextField.h> #include <AppKit/NSTextField.h>
@class NSString;
@class NSNotification;
@interface NSComboBox : NSTextField @interface NSComboBox : NSTextField
{ {
} }
@ -82,7 +84,6 @@
- (void) setCompletes: (BOOL)completes; - (void) setCompletes: (BOOL)completes;
- (BOOL) completes; - (BOOL) completes;
#endif #endif
@end @end
@interface NSObject (NSComboBoxDataSource) @interface NSObject (NSComboBoxDataSource)

View file

@ -27,9 +27,13 @@
#ifndef _GNUstep_H_NSComboBoxCell #ifndef _GNUstep_H_NSComboBoxCell
#define _GNUstep_H_NSComboBoxCell #define _GNUstep_H_NSComboBoxCell
#include <Foundation/NSGeometry.h>
#include <AppKit/NSTextFieldCell.h> #include <AppKit/NSTextFieldCell.h>
@class NSButtonCell, NSScrollView; @class NSButtonCell;
@class NSMutableArray;
@class NSArray;
@class NSString;
@interface NSComboBoxCell : NSTextFieldCell @interface NSComboBoxCell : NSTextFieldCell
{ {
@ -43,6 +47,8 @@
NSSize _intercellSpacing; NSSize _intercellSpacing;
float _itemHeight; float _itemHeight;
int _selectedItem; int _selectedItem;
NSRect _lastValidFrame;
NSRange _prevSelectedRange;
@private @private
id _popup; id _popup;

View file

@ -101,6 +101,7 @@ GNUstep.tiff \
GNUstepMenuImage.tiff \ GNUstepMenuImage.tiff \
nsmapping.strings \ nsmapping.strings \
NSComboArrow.tiff \ NSComboArrow.tiff \
common_ComboBoxEllipsis.tiff \
common_RightTabStop.tiff \ common_RightTabStop.tiff \
common_CenterTabStop.tiff \ common_CenterTabStop.tiff \
common_LeftTabStop.tiff \ common_LeftTabStop.tiff \

Binary file not shown.

View file

@ -25,15 +25,9 @@
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include "AppKit/NSApplication.h"
#include "AppKit/NSComboBox.h" #include "AppKit/NSComboBox.h"
#include "AppKit/NSComboBoxCell.h" #include "AppKit/NSComboBoxCell.h"
#include "AppKit/NSEvent.h" #include "AppKit/NSEvent.h"
#include "AppKit/NSWindow.h"
@interface NSObject(MouseUpping)
- (NSEvent *)_mouseUpEvent;
@end
/* /*
* Class variables * Class variables
@ -47,7 +41,7 @@ static NSNotificationCenter *nc;
+ (void) initialize + (void) initialize
{ {
if (self == [NSComboBox class]) if (self == [NSComboBox class]) // Is such test case really needed ?
{ {
[self setVersion: 1]; [self setVersion: 1];
comboBoxCellClass = [NSComboBoxCell class]; comboBoxCellClass = [NSComboBoxCell class];
@ -254,23 +248,15 @@ static NSNotificationCenter *nc;
// Overridden // Overridden
- (void) mouseDown: (NSEvent*)theEvent - (void) mouseDown: (NSEvent*)theEvent
{ {
NSEvent *cEvent; BOOL clicked;
// clicked is set to the value YES when the click occurs in the text cell
// and to the value NO when it occurs in the button cell
[_cell trackMouse: theEvent inRect: [self bounds] clicked = [_cell trackMouse: theEvent inRect: [self bounds]
ofView: self untilMouseUp: YES]; ofView: self untilMouseUp: YES];
if ([_cell respondsToSelector: @selector(_mouseUpEvent)])
cEvent = [_cell _mouseUpEvent]; if (clicked)
else
cEvent = nil;
if ([_cell isSelectable])
{
if (!cEvent)
cEvent = [NSApp currentEvent];
if ([cEvent type] == NSLeftMouseUp &&
([cEvent windowNumber] == [[self window] windowNumber]))
[NSApp postEvent: cEvent atStart: NO];
[super mouseDown: theEvent]; [super mouseDown: theEvent];
} }
}
@end @end

File diff suppressed because it is too large Load diff