Adding static data member and accessor that keeps track of what the

PhDrawContext_t for Photon was when the program is first started.
r=kedl
This commit is contained in:
Jerry.Kirk%Nexwarecorp.com 1999-11-11 15:19:25 +00:00
parent 80cfda67ae
commit 6f824c9d8e
2 changed files with 30 additions and 24 deletions

View File

@ -21,16 +21,14 @@
*/
#include "nsToolkit.h"
#include "nsWindow.h"
#include "prmon.h"
#include "prtime.h"
#include "nsGUIEvent.h"
#include <Pt.h>
#include "nscore.h"
#include "nsPhWidgetLog.h"
/* Set our static member to NULL */
PhDrawContext_t * nsToolkit::mDefaultPhotonDrawContext = nsnull;
NS_DEFINE_IID(kIToolkitIID, NS_ITOOLKIT_IID);
NS_IMPL_ISUPPORTS(nsToolkit,kIToolkitIID);
NS_IMPL_ISUPPORTS1(nsToolkit,nsIToolkit);
//-------------------------------------------------------------------------
//
@ -39,8 +37,14 @@ NS_IMPL_ISUPPORTS(nsToolkit,kIToolkitIID);
//-------------------------------------------------------------------------
nsToolkit::nsToolkit()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsToolkit::nsToolkit this=<%p>\n", this));
NS_INIT_REFCNT();
mWidget = NULL;
if (mDefaultPhotonDrawContext == nsnull)
{
mDefaultPhotonDrawContext = PhDCGetCurrent();
}
}
@ -51,7 +55,7 @@ nsToolkit::nsToolkit()
//-------------------------------------------------------------------------
nsToolkit::~nsToolkit()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsToolkit::~nsToolkit\n"));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsToolkit::~nsToolkit this=<%p>\n", this));
}
@ -62,14 +66,16 @@ nsToolkit::~nsToolkit()
NS_METHOD nsToolkit::Init(PRThread *aThread)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsToolkit::Init this=<%p> aThread=<%p>\n", this, aThread));
if( aThread )
{
/* No idea what this is for */
}
else
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsToolkit::Init - ERROR: Wants to create a thread!\n"));
}
return NS_OK;
}
PhDrawContext_t *nsToolkit::GetDefaultPhotonDrawContext()
{
if (mDefaultPhotonDrawContext == NULL)
{
NS_ASSERTION(mDefaultPhotonDrawContext, "nsToolkit::GetDefaultPhotonDrawContext mDefaultPhotonDrawContext is NULL");
abort();
}
return mDefaultPhotonDrawContext;
}

View File

@ -30,18 +30,18 @@ class nsToolkit : public nsIToolkit
{
public:
nsToolkit();
virtual ~nsToolkit();
NS_DECL_ISUPPORTS
nsToolkit();
NS_IMETHOD Init( PRThread *aThread );
PhDrawContext_t *GetDefaultPhotonDrawContext();
private:
~nsToolkit();
PtWidget_t* mWidget;
protected:
static PhDrawContext_t *mDefaultPhotonDrawContext;
};