IKImageView delegate

  • The documentation (updated this morning) says: "An IKImageView object’s delegate [...] is informed of various actions by the image view through delegation messages."

    This begs the question: What are these "delegation messages" and where are they documented?

    Also: IKImageView seems to understand the cut:, copy:, paste: etc. messages. But I can't find any documentation about this (neither in IKImageView nor in it's superclasses).
    According to the documentation cut: seems to be implemented only by NSText and WebView.

    Another thing: IKImageView can mark a region (IKToolModeSelect). How to get this region from IKImageView? (Clumsy workaround: send it a copy: message and look at the pasteboard).

    A link to the appropiate documentation would be most welcome.

    Kind regards,

    Gerriet.
  • On Apr 10, 2010, at 2:13 AM, Gerriet M. Denkmann wrote:

    > The documentation (updated this morning) says: "An IKImageView object’s delegate [...] is informed of various actions by the image view through delegation messages."
    >

    Why do you say that the documentation has been edited? When I look at it, it says it was edited in February...

    The answer to most of your questions seems to be "The IKImageView documentation is lousy and buggy" (they mention that you can but an NSImage into an IKImageView, but there is no documented method for this for example...)

    > This begs the question: What are these "delegation messages" and where are they documented?
    >
    > Also: IKImageView seems to understand the cut:, copy:, paste: etc. messages. But I can't find any documentation about this (neither in IKImageView nor in it's superclasses).

    I wrote my own using the get the region method described below. It's not elegant, but it seems to work... I also just used the code from IKImageViewDemo and trusted that it would work... Note that it uses undocumented methods!

    > According to the documentation cut: seems to be implemented only by NSText and WebView.
    >

    I'm not sure what you want cut to do in an IKImageView, make the area grey?

    > Another thing: IKImageView can mark a region (IKToolModeSelect). How to get this region from IKImageView? (Clumsy workaround: send it a copy: message and look at the pasteboard).

    There is an *UNDOCUMENTED* method (CGRect)selectionRect which returns the selection rectangle in view coordinates. I use a separate version of the image and do: (full is the CGImageref of the whole image)

        CGRect selection;
    selection = flipCGRect( CGImageGetHeight(full), [imageView selectionRect]);

        CGImageRef selectedImage;

    if (selection.size.width == 0 || selection.size.height == 0)
      selectedImage =full;
    else
      selectedImage = CGImageCreateWithImageInRect( full, selection);

    it's not elegant, but it seems to work.

    Again, selectionRect is UNDOCUMENTED so use it at your own risk!

    Brian Postow
    Senior Software Engineer
    Acordex Imaging Systems
  • On 12 Apr 2010, at 21:39, Brian Postow wrote:

    >
    > On Apr 10, 2010, at 2:13 AM, Gerriet M. Denkmann wrote:
    >
    >> The documentation (updated this morning) says: "An IKImageView object’s delegate [...] is informed of various actions by the image view through delegation messages."
    >>
    > Why do you say that the documentation has been edited? When I look at it, it says it was edited in February...
    No. I just wanted to say that I am using the current documentation.
    >
    > I'm not sure what you want cut to do in an IKImageView, make the area grey?
    [ myIkImageView cut: nil] seems to replace the image with the stuff in the selected range.

    >
    >> Another thing: IKImageView can mark a region (IKToolModeSelect). How to get this region from IKImageView? (Clumsy workaround: send it a copy: message and look at the pasteboard).
    >
    > There is an *UNDOCUMENTED* method (CGRect)selectionRect which returns the selection rectangle in view coordinates.
    >
    Thanks a lot. This works perfectly.
    How did you find this undocumented method? Maybe there is more useful stuff to be found?

    Kind regards,

    Gerriet.
previous month april 2010 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today