FROM : Uli Kusterer
DATE : Sun May 04 15:53:05 2008
Am 04.05.2008 um 13:25 schrieb Daniel:
> Basically I wanted to display a window which modifies "graphically"
> another window. Under graphically I mean for example zooming of some
> parts of the window or change colors and so on and also to preserve
> the funcionality of the original window.
So, basically you're trying to write a GUI editor, like Interface
Builder? In that case, I think what you'd really want to do is build
your view hierarchy slightly differently. It's been a while since I
tried writing a GUI editor in Cocoa, and I did half a dozen in Classic/
Carbon, so I may be mixing up things here, but there are several
approaches, all of which might work depending on what you want to do:
1) Use NSImage and NSBitmapImageRep's -initWithFocusedViewRect: method
to create a snapshot of each view. Then you can create a custom view
for each view that draws such a snapshot, accepts clicks, draws a
selected look, etc.
2) Wrap each view in a container view. I think there was some way to
make a view get clicks before its subviews get them. That way, you can
intercept the clicks and do something special with them when needed,
and also draw a highlight to indicate a selection.
Views are objects just like any other, so you can easily create a new
one using alloc/initWithFrame:, then use addSubview to insert it in
another view etc., and thus dynamically change the view hierarchy or
even build a completely new one, without a NIB. Same applies to
NSWindows.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
DATE : Sun May 04 15:53:05 2008
Am 04.05.2008 um 13:25 schrieb Daniel:
> Basically I wanted to display a window which modifies "graphically"
> another window. Under graphically I mean for example zooming of some
> parts of the window or change colors and so on and also to preserve
> the funcionality of the original window.
So, basically you're trying to write a GUI editor, like Interface
Builder? In that case, I think what you'd really want to do is build
your view hierarchy slightly differently. It's been a while since I
tried writing a GUI editor in Cocoa, and I did half a dozen in Classic/
Carbon, so I may be mixing up things here, but there are several
approaches, all of which might work depending on what you want to do:
1) Use NSImage and NSBitmapImageRep's -initWithFocusedViewRect: method
to create a snapshot of each view. Then you can create a custom view
for each view that draws such a snapshot, accepts clicks, draws a
selected look, etc.
2) Wrap each view in a container view. I think there was some way to
make a view get clicks before its subviews get them. That way, you can
intercept the clicks and do something special with them when needed,
and also draw a highlight to indicate a selection.
Views are objects just like any other, so you can easily create a new
one using alloc/initWithFrame:, then use addSubview to insert it in
another view etc., and thus dynamically change the view hierarchy or
even build a completely new one, without a NIB. Same applies to
NSWindows.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
| Related mails | Author | Date |
|---|---|---|
| Daniel Rampanelli | May 3, 23:45 | |
| Jean-Daniel Dupas | May 4, 00:30 | |
| Jean-Daniel Dupas | May 4, 00:34 | |
| Uli Kusterer | May 4, 01:31 | |
| Daniel | May 4, 13:25 | |
| Uli Kusterer | May 4, 15:53 |






Cocoa mail archive

