mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-23 06:20:47 +00:00
* Palettes/2Controls/ControlsPalette.m: implement adding "Prototype" mode to Inspector's popup button for objects with prototype aavailable (mainly NSMatrix).
This commit is contained in:
parent
a0702cd9cd
commit
cdb2814a8a
1 changed files with 25 additions and 0 deletions
|
@ -30,6 +30,8 @@
|
|||
#include <AppKit/NSPasteboard.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSSound.h>
|
||||
#include <InterfaceBuilder/IBInspectorManager.h>
|
||||
#include <InterfaceBuilder/IBInspectorMode.h>
|
||||
#include "GormNSPopUpButton.h"
|
||||
|
||||
@interface ControlsPalette: IBPalette <IBViewResourceDraggingDelegates>
|
||||
|
@ -44,6 +46,13 @@
|
|||
// Make ourselves a delegate, so that when the sound/image is dragged in,
|
||||
// this code is called...
|
||||
[NSView registerViewResourceDraggingDelegate: self];
|
||||
|
||||
// subscribe to the notification...
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(willInspectObject:)
|
||||
name: IBWillInspectObjectNotification
|
||||
object: nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -69,6 +78,22 @@
|
|||
RELEASE(v);
|
||||
}
|
||||
|
||||
- (void) willInspectObject: (NSNotification *)notification
|
||||
{
|
||||
id o = [notification object];
|
||||
if ([o respondsToSelector: @selector(prototype)])
|
||||
{
|
||||
id prototype = [o prototype];
|
||||
NSString *ident = NSStringFromClass([prototype class]);
|
||||
[[IBInspectorManager sharedInspectorManager]
|
||||
addInspectorModeWithIdentifier: ident
|
||||
forObject: o
|
||||
localizedLabel: _(@"Prototype")
|
||||
inspectorClassName: [prototype inspectorClassName]
|
||||
ordering: -1.0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask if the view accepts the object.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue