зеркало из https://github.com/mozilla/pjs.git
Added the creation of the device context.
This commit is contained in:
Родитель
125a0c023a
Коммит
32176b4a74
|
@ -154,12 +154,15 @@ void nsWindow::Create(nsNativeWidget aParent,
|
||||||
void
|
void
|
||||||
nsWindow::InitToolkit(nsIToolkit *aToolkit,nsIWidget *aWidgetParent)
|
nsWindow::InitToolkit(nsIToolkit *aToolkit,nsIWidget *aWidgetParent)
|
||||||
{
|
{
|
||||||
if (nsnull == mToolkit) {
|
if (nsnull == mToolkit)
|
||||||
if (nsnull != aToolkit) {
|
{
|
||||||
|
if (nsnull != aToolkit)
|
||||||
|
{
|
||||||
mToolkit = (nsToolkit*)aToolkit;
|
mToolkit = (nsToolkit*)aToolkit;
|
||||||
mToolkit->AddRef();
|
mToolkit->AddRef();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (nsnull != aWidgetParent)
|
if (nsnull != aWidgetParent)
|
||||||
{
|
{
|
||||||
mToolkit = (nsToolkit*)(aWidgetParent->GetToolkit()); // the call AddRef's, we don't have to
|
mToolkit = (nsToolkit*)(aWidgetParent->GetToolkit()); // the call AddRef's, we don't have to
|
||||||
|
@ -213,7 +216,7 @@ Rect bounds;
|
||||||
mWindowPtr = NewCWindow(mWindowRecord,&bounds,"\ptestwindow",TRUE,0,(GrafPort*)-1,TRUE,(long)this);
|
mWindowPtr = NewCWindow(mWindowRecord,&bounds,"\ptestwindow",TRUE,0,(GrafPort*)-1,TRUE,(long)this);
|
||||||
|
|
||||||
mWindowRegion = NewRgn();
|
mWindowRegion = NewRgn();
|
||||||
SetRectRgn(mWindowRegion,bounds.left,bounds.top,bounds.right,bounds.bottom);
|
SetRectRgn(mWindowRegion,0,0,bounds.right,bounds.bottom);
|
||||||
|
|
||||||
mWindowMadeHere = PR_TRUE;
|
mWindowMadeHere = PR_TRUE;
|
||||||
mIsMainWindow = PR_TRUE;
|
mIsMainWindow = PR_TRUE;
|
||||||
|
@ -226,7 +229,7 @@ Rect bounds;
|
||||||
mIsMainWindow = PR_TRUE;
|
mIsMainWindow = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//InitDeviceContext(aContext, (Widget) aAppShell->GetNativeData(NS_NATIVE_SHELL));
|
InitDeviceContext(aContext, (nsNativeWidget)mWindowPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -263,7 +266,7 @@ void nsWindow::CreateChildWindow(nsNativeWidget aNativeParent,
|
||||||
mWindowPtr = (WindowPtr)aNativeParent;
|
mWindowPtr = (WindowPtr)aNativeParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
//InitDeviceContext(aContext, (Widget)aNativeParent);
|
InitDeviceContext(aContext,aNativeParent);
|
||||||
|
|
||||||
// Force cursor to default setting
|
// Force cursor to default setting
|
||||||
mCursor = eCursor_select;
|
mCursor = eCursor_select;
|
||||||
|
@ -271,6 +274,37 @@ void nsWindow::CreateChildWindow(nsNativeWidget aNativeParent,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
void nsWindow::InitDeviceContext(nsIDeviceContext *aContext,nsNativeWidget aParentWidget)
|
||||||
|
{
|
||||||
|
|
||||||
|
// keep a reference to the toolkit object
|
||||||
|
if (aContext) {
|
||||||
|
mContext = aContext;
|
||||||
|
mContext->AddRef();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nsresult res;
|
||||||
|
|
||||||
|
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
||||||
|
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
|
||||||
|
|
||||||
|
res = NSRepository::CreateInstance(kDeviceContextCID,
|
||||||
|
nsnull,
|
||||||
|
kDeviceContextIID,
|
||||||
|
(void **)&mContext);
|
||||||
|
if (NS_OK == res)
|
||||||
|
{
|
||||||
|
mContext->Init(aParentWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Close this nsWindow
|
// Close this nsWindow
|
||||||
|
|
|
@ -141,7 +141,6 @@ public:
|
||||||
nsWindow* FindWidgetHit(Point aThePoint);
|
nsWindow* FindWidgetHit(Point aThePoint);
|
||||||
ptInWindow(PRInt32 aX,PRInt32 aY);
|
ptInWindow(PRInt32 aX,PRInt32 aY);
|
||||||
|
|
||||||
|
|
||||||
char gInstanceClassName[256];
|
char gInstanceClassName[256];
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -259,6 +258,8 @@ private:
|
||||||
PRBool mIsMainWindow; // top level Mac window
|
PRBool mIsMainWindow; // top level Mac window
|
||||||
RgnHandle mWindowRegion; // the region defining this window
|
RgnHandle mWindowRegion; // the region defining this window
|
||||||
|
|
||||||
|
void InitDeviceContext(nsIDeviceContext *aContext,nsNativeWidget aParentWidget);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
Загрузка…
Ссылка в новой задаче