Casio ClassPad 300 Programming Manual page 32

Sdk programming guide
Hide thumbs Also See for ClassPad 300:
Table of Contents

Advertisement

First we will look at the creation of the CPMainFrame in PegAppInitialize. The
mainframe is created by passing in a peg rectangle that is the size of the mainframe.
void PegAppInitialize(PegPresentationManager *pPresentation)
{
PegRect Rect;
Rect.Set(MAINFRAME_LEFT,MAINFRAME_TOP,
MAINFRAME_RIGHT,MAINFRAME_BOTTOM);
CPMainFrame *mw = new CPMainFrame(Rect);
Next, we want to add an ExampleWindow to the mainframe. Remember that only
CPModuleWindows can be added to a CPMainFrame. Therefore, ExampleWindow must
be, and in fact is, derived from a CPModuleWindow. Here is the code that creates an
instance of ExampleWindow that is the size of a full screen application in the mainframe:
PegRect ChildRect = mw->FullAppRectangle();
ExampleWindow *ex_win = new ExampleWindow(ChildRect,mw);
Now let's jump out of PegAppInitialize for a moment, to see what ExampleWindow's
constructor does.
ExampleWindow::ExampleWindow(PegRect rect, CPMainFrame
*frame) :CPModuleWindow(rect,0,0,frame)
{
HasLines = false;
SetScrollMode(WSM_AUTOSCROLL);
PegRect r = mClient;
r -= 20; // make the pan window a bit smaller
m_panWin = new PanWindow(r);
Add(m_panWin);
}
You can see that ExampleWindow has a reference to a PanWindow. PanWindow is
based on the CPWindow class. The constructor creates a new PanWindow and adds it to
ExampleWindow.
Finally if we jump back to PegAppInitialize we see that the ExampleWindow gets added
to the CPMainFrame, and the CPMainFrame gets added to the PegPresentationManager.
mw->SetTopWindow(ex_win);
mw->SetMainWindow(ex_win);
pPresentation->Add(mw);
};
32

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents