[Drawkit] Notification for change in selection
Graham Cox
graham.cox at bigpond.com
Wed Jun 24 15:53:27 PDT 2009
On 25/06/2009, at 8:15 AM, Brad Larson wrote:
> Is there a notification that fires when the selection changes within
> a drawing? I'm trying to implement an inspector that lets you fine-
> tune the properties of the currently selected element within a
> drawing, but I haven't found an easy way to have than inspector
> update its view in response to the current object being deselected
> and another chosen. The closest I've seen is the
> kDKDrawableDidChangeNotification, but that only lets you know that
> objects have had their properties altered and isn't tied in with
> changes in selection.
Hi Brad,
There is a notification - it comes from the active layer and its name
is kDKLayerSelectionDidChange. There is no user info in the
notification, you can get all you need by querying the layer itself
which is of course [notification object].
For inspectors, there's also some support in the form of
DKDrawkitInspectorBase, which is a window controller that is set up to
listen for document, layer and selection changes, which it feeds into
an overridable method -redisplayContentForSelection: It's fairly easy
to subclass this and use it for different kinds of inspectors - my
current app uses it extensively and it saves the hassle of handling
the various notifications yourself - but the choice is yours.
>
> Also, I happened to run the Clang Static Analyzer on the framework
> the other day and found a few memory leaks. Should I submit patches
> for those or wait for the next beta release?
I have found a small number recently, but it would be good to know
what you found. If patches are the easiest way, then please do,
otherwise a list with a brief description should do it.
--Graham
More information about the Drawkit
mailing list