apps-gorm/Palettes/2Controls/GormPopUpButtonEditor.m
Pierre-Yves Rivaille f9ad0e9a14 * Gorm.m: fixes segfault when leaving test mode.
* GormDocument.m: fixes bad reactivating of editors.
* GormBoxEditor.m: commented unused drag'n'drop code.
* GormCustomView.m: added GormTestCustomView class to deal with unknown
  class name without raising an exception.
* GormInspectorsManager.m: fix to deal with new NSBrowser behaviour.
* GormObjectEditor.m: ([GormObjectEditor -rectForObject:]):
  Corrected returned rect.
* GormInternalViewEditor.m:
* GormViewEditor.m:
  updated drag'n'drop support.
* GormWindowEditor.m: commented unused code.
* GormButtonEditor.m:
  inline editing of button's title.

* Palettes/0Menus/GormMenuEditor.m
* Palettes/0Menus/GormMenuInspectors.m
* Palettes/0Menus/GormNSMenu.h
* Palettes/0Menus/GormNSMenu.m
* Palettes/0Menus/main.m
  Updated menu editing to support NSPopUpButton.
  Basic tag editing added.

* Palettes/2Controls/GormPopUpButtonEditor.m
* Palettes/2Controls/GNUmakefile
* Palettes/2Controls/inspectors.m
* Palettes/2Controls/main.m
* GormDocument.m
* Gorm.m
  Added support for NSPopUpButton.

* Palettes/3Containers/GormTableViewEditor.m
  Updated drag'n'drop for object connectiion.

* Palettes/4Data/main.m
  updated NSTextView initialization so that it resizes properly.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14502 72102866-910b-0410-8b05-ffd578937521
2002-09-21 15:24:59 +00:00

137 lines
2.5 KiB
Objective-C

#import <AppKit/AppKit.h>
#import "../../GormPrivate.h"
#import "../../GormControlEditor.h"
#import "../../GormViewWithSubviewsEditor.h"
#define _EO ((NSPopUpButton *)_editedObject)
@class GormNSPopUpButtonCell;
Class _gormnspopupbuttonCellClass = 0;
@interface GormNSPopUpButton : NSPopUpButton
@end
@implementation GormNSPopUpButton
/*
* Class methods
*/
+ (void) initialize
{
if (self == [GormNSPopUpButton class])
{
// Initial version
[self setVersion: 1];
[self setCellClass: [GormNSPopUpButtonCell class]];
}
}
+ (Class) cellClass
{
return _gormnspopupbuttonCellClass;
}
+ (void) setCellClass: (Class)classId
{
_gormnspopupbuttonCellClass = classId;
}
- (NSString*) editorClassName
{
return @"GormPopUpButtonEditor";
}
@end
@interface GormNSPopUpButtonCell : NSPopUpButtonCell
{
}
@end
@implementation NSPopUpButtonCell (DirtyHack)
- (id) _gormInitTextCell: (NSString *) string
{
return [super initTextCell: string];
}
@end
@implementation GormNSPopUpButtonCell
- (id) initTextCell: (NSString*) stringValue
pullsDown: (BOOL) pullDown
{
[super _gormInitTextCell: stringValue];
_pbcFlags.pullsDown = pullDown;
_pbcFlags.usesItemFromMenu = YES;
_pbcFlags.altersStateOfSelectedItem = YES;
if ([stringValue length] > 0)
{
[self addItemWithTitle: stringValue];
}
_menu = [(id)[NSMenu allocSubstitute] initWithTitle: @""];
[_menu _setOwnedByPopUp: self];
return self;
}
@end
// @interface GormPopUpNSMenu : NSMenu
// - (BOOL)canBecomeMainWindow
// {
// return YES;
// }
// - (BOOL)canBecomeKeyWindow
// {
// return YES;
// }
// - (void) sendEvent: (NSEvent*)theEvent
// {
// NSEventType type;
// type = [theEvent type];
// if (type == NSLeftMouseDown)
// {
// NSLog(@"here");
// if (_f.is_main == YES)
// {
// NSLog(@"already main %@", [NSApp mainWindow]);
// }
// [self makeMainWindow];
// [self makeKeyWindow];
// }
// [super sendEvent: theEvent];
// }
// @end
// @implementation GormPopUpNSMenu
// @end
@interface GormPopUpButtonEditor : GormControlEditor
{
}
@end
@implementation GormPopUpButtonEditor
- (void) mouseDown: (NSEvent *)theEvent
{
if (([theEvent clickCount] == 2) && [parent isOpened])
// double-clicked -> let's edit
{
[[_EO cell]
attachPopUpWithFrame: [_EO bounds]
inView: _editedObject];
NSLog(@"attach down");
[[document openEditorForObject: [[_EO cell] menu]] activate];
}
else
{
[super mouseDown: theEvent];
}
}
@end