mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Fix issue with pull down/pop up. Refresh the button
This commit is contained in:
parent
0f2d8b63b7
commit
40020e9016
5 changed files with 18 additions and 34 deletions
|
@ -4,6 +4,7 @@
|
|||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
"_prototypePopUp"
|
||||
);
|
||||
Super = IBPalette;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -31,6 +31,9 @@
|
|||
#include "GormNSPopUpButton.h"
|
||||
|
||||
@interface ControlsPalette: IBPalette <IBViewResourceDraggingDelegates>
|
||||
{
|
||||
IBOutlet NSPopUpButton *_prototypePopUp;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
@ -62,18 +65,9 @@
|
|||
|
||||
- (void) finishInstantiate
|
||||
{
|
||||
/*
|
||||
NSView *contents;
|
||||
id v;
|
||||
|
||||
contents = [originalWindow contentView];
|
||||
v = [[GormNSPopUpButton alloc] initWithFrame: NSMakeRect(70, 159, 75, 22)];
|
||||
[v addItemWithTitle: @"Item 1"];
|
||||
[v addItemWithTitle: @"Item 2"];
|
||||
[v addItemWithTitle: @"Item 3"];
|
||||
[contents addSubview: v];
|
||||
RELEASE(v);
|
||||
*/
|
||||
[_prototypePopUp addItemWithTitle: @"Item #0"];
|
||||
[_prototypePopUp addItemWithTitle: @"Item #1"];
|
||||
[_prototypePopUp addItemWithTitle: @"Item #2"];
|
||||
}
|
||||
|
||||
- (void) willInspectObject: (NSNotification *)notification
|
||||
|
|
|
@ -65,6 +65,7 @@ Class _gormnspopupbuttonCellClass = 0;
|
|||
* Override this here, since themes may override it.
|
||||
* Always want to show the menu view since it's editable.
|
||||
*/
|
||||
/*
|
||||
- (void) attachPopUpWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
{
|
||||
|
@ -127,4 +128,6 @@ Class _gormnspopupbuttonCellClass = 0;
|
|||
name: NSMenuDidSendActionNotification
|
||||
object: _menu];
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
|
|
@ -70,31 +70,17 @@
|
|||
if (sender == typeMatrix)
|
||||
{
|
||||
BOOL pullsDown = [[sender selectedCell] tag] == YES ? YES : NO;
|
||||
id selectedItem;
|
||||
id cell = [object cell];
|
||||
|
||||
NSLog(@"pullDown = %d", pullsDown);
|
||||
NSLog(@"cell = %@", cell);
|
||||
NSArray *itemArray = [[object itemArray] copy];
|
||||
NSEnumerator *en = [itemArray objectEnumerator];
|
||||
id o = nil;
|
||||
|
||||
[object removeAllItems];
|
||||
[object setPullsDown: pullsDown];
|
||||
selectedItem = [object selectedItem];
|
||||
[object selectItem: nil];
|
||||
[object selectItem: selectedItem];
|
||||
[cell setUsesItemFromMenu: YES];
|
||||
|
||||
// Set up the form...
|
||||
[pullDownTitleForm setEnabled: pullsDown];
|
||||
[[pullDownTitleForm cellAtIndex: 0]
|
||||
setStringValue: pullsDown ? [object title] : @""];
|
||||
[pullDownArrowPopUp setEnabled: pullsDown];
|
||||
|
||||
if (pullsDown)
|
||||
while ((o = [en nextObject]) != nil)
|
||||
{
|
||||
// TODO: This should be configurable in the future
|
||||
[cell setPreferredEdge: NSMaxYEdge];
|
||||
[cell setMenuItem: nil];
|
||||
[cell setMenuItem: selectedItem];
|
||||
}
|
||||
NSLog(@"o = %@", o);
|
||||
[object addItemWithTitle: [o title]];
|
||||
}
|
||||
}
|
||||
else if (sender == autoenableSwitch)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue