How to create a LGrafPortView?

How to create a LGrafPortView?

Post by jjgitte » Fri, 07 Nov 2003 11:32:06


I am writing a Netscape CFM plugin in CW, and I would like to draw a
LGrafPortView from a PPob resource. I'm having trouble getting
anything showing.

Basically, I am having trouble understanding where the LGrafPortView
ties to the available plugin area. I do have a CGrafPtr from the
netscape window (NP_Port * npport = (NP_Port *) mWindow->window), but
this pointer has not proved useful yet...

Here's the two methods I've tried:

void init();

//Create a LGrafPortView dynamically
void Method1()
{
init();

GrafPtr savePort;
::GetPort(&savePort);
LGrafPortView * GraphPortP = new LGrafPortView(savePort);
GraphPortP->Show();
}

void Method2()
{
init();
LGrafPortView * GraphPortP =
LGrafPortView::CreateGrafPortView(window_MainView, nil);
GraphPortP->Show();

}

void init()
{
SetDebugThrow_(debugAction_Alert);
SetDebugSignal_(debugAction_Alert);

InitializeHeap(3); // Initialize Memory Manager
// Initialize standard Toolbox managers
UQDGlobals::InitializeToolbox();

RegisterClass_(LCaption);
RegisterClass_(LBorderAttachment);
RegisterClass_(LGrafPortView);
}


Any help is appreciated for this PP newbie. Examples are also greatly
appreciated.


jg
 
 
 

How to create a LGrafPortView?

Post by jjgitte » Sun, 09 Nov 2003 06:44:49

Ok, I figured it out. For prodigy, here is the appropriate way to
initialize your graphics space for PowerPlant in a Netscape Plugin:


// Set the QD Globals
UQDGlobals::InitializeToolbox();

//Set the flag indicating if the machine has color QuickDraw
SInt32 qdVersion = gestaltOriginalQD;
Gestalt(gestaltQuickdrawVersion, &qdVersion);
UEnvironment::SetFeature(env_SupportsColor, (qdVersion >
gestaltOriginalQD));