[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSCell drawInterior... positioning bug?
From: |
Richard Frith-Macdonald |
Subject: |
Re: NSCell drawInterior... positioning bug? |
Date: |
Mon, 17 Feb 2003 09:44:34 +0000 |
On Monday, February 17, 2003, at 07:41 am, Willem Rein Oudshoorn wrote:
I am investigation bug
#101846: Refresh progem of dragged image.
And found that the reason is in the the
-[NSCell drawInteriorWithFrame:inView:]
method. The problem is that XGDragView
uses this method to redraw the image in
-[XGDragView drawRect:]
Now XGDragView assumes that the drawInterior...
method will redraw the part specified in the
first argument.
However, in NSCell we do two things,
A - We draw a frame (if needed)
of size approximately the first argument.
B - We try to centre the image in the frame.
This goes wrong if XGDragView passes a rectangle
that is only a part of the image.
Question: Who is correct? is XGDragView
correct in assuming it can pass an arbitrary rect
and the NSCell class will make sure that rect is redraw.
Or is NSCell correct in assuming it will get passed
a rect that is not clipped
I think that NSCell is probably correct and XGDragView wrong.
The NSCell API provides no notion of what the frame
of the cell is, so I think that the drawing methods have to
assume that the frame they are given is the frame in which
the entire cell is to be drawn.
Th only confusing thing is that the documentation says that ...
'cellFrame is the frame of the NSCell or, in some cases, a portion of
it'
If only a portion of the frame is supplied as an argument,
how would the draw method know? Perhaps some NSCell
subclasses implement other behaviors ... but that would seem
to lead to confusion.
Anyway, perhaps the best thing for XGDragView to do would be
to composite the image itself and set clipping rectangle as needed,
rather than asking an NSCell to do the job.