Re: Resize transparent windows
Re: Resize transparent windows
- Subject: Re: Resize transparent windows
- From: Stéphane Sudre <email@hidden>
- Date: Wed, 9 Jan 2002 13:23:18 +0100
I am trying to figure out how to resize a transparent window just like
the
one that is found in the roundTransparentWindow example given by Apple.
I am thinking about putting handles (a transparent sensitive area) all
around the window shape, 10 pixels wide, where one could 'click and
drag' to
make the window and the picture inside shrink or grow.
Has anyone ever thought about that and could give me some directions
about
the logic and the objects I should use to achieve it ?
You can do this using your subclass of NSWindow. Since it must be there
you're handling the ability to drag your window, you can complete the
folowing methods to handle resizing:
- (void)mouseDown:(NSEvent *)theEvent
{
if in the drag region then draglocation is this one and the dragged
flag is on
else if in the resize region then resizelocation is this one and
the resize flag is on
}
- (void)mouseUp:(NSEvent *)theEvent
{
all flags off
}
- (void)mouseDragged:(NSEvent *)theEvent
{
if (dragged flag is on) moveWindow according to drag
else if (resize flag is on) resize window according to drag
}
The eventual drawing of the resizing zone can be performed by the View
which defines the frame of your window.
If you're able to have your controls inside your window enabled, I'm
interested.