зеркало из https://github.com/mozilla/pjs.git
added some coordinate conversion
This commit is contained in:
Родитель
a7b5554328
Коммит
f61e9f2efa
|
@ -499,6 +499,8 @@ class nsIWidget : public nsISupports {
|
|||
*/
|
||||
|
||||
virtual void EndResizingChildren(void) = 0;
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
|
|
|
@ -496,6 +496,7 @@ Rect macrect;
|
|||
GetBounds(therect);
|
||||
nsRectToMacRect(therect,macrect);
|
||||
::ClipRect(¯ect);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1443,6 +1444,22 @@ void nsWindow::RemoveTooltips()
|
|||
{
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
/* Convert the coordinates to some device coordinates so GFX can draw.
|
||||
* @update dc 09/16/98
|
||||
* @param nscoord -- X coordinate to convert
|
||||
* @param nscoord -- Y coordinate to convert
|
||||
* @return NONE
|
||||
*/
|
||||
void nsWindow::ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY)
|
||||
{
|
||||
nsRect rect;
|
||||
|
||||
this->GetBounds(rect);
|
||||
aX +=rect.x;
|
||||
aY +=rect.y;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -127,6 +127,8 @@ public:
|
|||
|
||||
virtual PRUint32 GetYCoord(PRUint32 aNewY);
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY);
|
||||
|
||||
|
||||
// Resize event management
|
||||
void SetResizeRect(nsRect& aRect);
|
||||
|
|
|
@ -121,9 +121,33 @@ public:
|
|||
virtual void BeginResizingChildren(void);
|
||||
virtual void EndResizingChildren(void);
|
||||
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
virtual PRBool DispatchEvent(nsGUIEvent* event);
|
||||
virtual PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
|
||||
virtual void OnDestroy();
|
||||
virtual PRBool OnPaint(nsPaintEvent &event);
|
||||
virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
virtual PRBool OnKey(PRUint32 aEventType, PRUint32 aKeyCode, nsKeyEvent* aEvent);
|
||||
|
||||
virtual PRBool DispatchFocus(nsGUIEvent &aEvent);
|
||||
virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos);
|
||||
|
||||
<<<<<<< nsWindow.h
|
||||
virtual void SetIgnoreResize(PRBool aIgnore);
|
||||
virtual PRBool IgnoreResize();
|
||||
=======
|
||||
virtual PRBool IsChild() { return(PR_FALSE); };
|
||||
>>>>>>> 1.32
|
||||
|
||||
<<<<<<< nsWindow.h
|
||||
virtual PRUint32 GetYCoord(PRUint32 aNewY);
|
||||
=======
|
||||
>>>>>>> 1.32
|
||||
|
||||
<<<<<<< nsWindow.h
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||
=======
|
||||
// Utility methods
|
||||
void SetBounds(const nsRect &aRect);
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
|
@ -138,6 +162,7 @@ public:
|
|||
PRUint32 GetYCoord(PRUint32 aNewY);
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
PRBool OnResize(nsSizeEvent &aEvent);
|
||||
>>>>>>> 1.32
|
||||
|
||||
|
||||
// Resize event management
|
||||
|
|
|
@ -121,6 +121,8 @@ public:
|
|||
virtual void EndResizingChildren(void);
|
||||
|
||||
virtual void SetUpForPaint(HDC aHDC);
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||
|
||||
|
||||
// nsSwitchToUIThread interface
|
||||
virtual BOOL CallMethod(MethodInfo *info);
|
||||
|
|
|
@ -764,11 +764,10 @@ MyObserver::Notify(nsIImageRequest *aImageRequest,
|
|||
|
||||
if (gImage)
|
||||
{
|
||||
nsRect rect;
|
||||
scribbleData.drawPane->GetBounds(rect);
|
||||
nscoord x = rect.x;
|
||||
nscoord y = rect.y;
|
||||
nscoord x = 0;
|
||||
nscoord y = 0;
|
||||
|
||||
scribbleData.drawPane->ConvertToDeviceCoordinates(x,y);
|
||||
drawCtx->DrawImage(gImage,x, y, gImage->GetWidth(), gImage->GetHeight());
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче