• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Stop dragging my <NSWindow> around
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stop dragging my <NSWindow> around


  • Subject: Re: Stop dragging my <NSWindow> around
  • From: Robert Clair <email@hidden>
  • Date: Thu, 3 Feb 2005 19:04:57 -0500

A somewhat sleazy solution. File this under "I think it will work,
but I haven't actually tried it."

Make a transparent window without a title bar that is the same size
as all (including the title bar) of your real window. Make it a child window
of your window ordered NSWindowAbove. Arrange things through
delegation or notifications so that the transparent window resizes appropriately
when the main window resizes. This much is known to work - I do it
all the time as an overlay to draw into for temporary graphics.


Now - the slightly off-color (pardon the pun) part. Set up a view that will
be the content view of the transparent window. In that view draw
a filled region that exactly covers the title bar (you'll have to experiment a
bit to get the corner radius correct). Make the fill gray with an alpha of 0.01. Mouse events
that are the region of the content view of the main window will go through and go
to the main window. Mouse events in the "title bar" should get caught by the
the view in the "transparent" window. You can then do whatever you like.


Most humans will not notice the color change caused by the gray strip.

If you need the traffic lights to work you can try removing them from the
real title strip and putting them on the overlay (requires the private _borderview
method) or keep track of where they are and forward the mouse events
from the overlay view if the user clicks in that region.


Some rather unattractive code involved, but of course you only have to
do it once and then package it as a subclass of NSWindow.

.............Bob Clair

--------------------------------------
The Confusion is the Gradient of the Potential for Confusion.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: *** layout manager 132840 failed to progress beyond index 70 while drawing glyphs -- why?
  • Next by Date: Re: Erasing portion of NSView and custom cursors
  • Previous by thread: Re: Stop dragging my <NSWindow> around
  • Next by thread: Re: Stop dragging my <NSWindow> around
  • Index(es):
    • Date
    • Thread