Using Object Boundaries In Windowsexample; Bounding Rectangles In Drawtext() - Casio ClassPad 300 Programming Manual

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

Advertisement

Notice that the mClient, the area you can draw to, does not extend over the scrollbars.
This means that you cannot draw over the scroll bars and the drawable area in your
window shrinks when scroll bars are added.
mClient can shrink in other ways as well. If you look back at the Draw() function in
ExampleWindow, you will see that there is a call to DrawFrame(). This puts a one pixel
border around ExampleWindow and makes mClient one pixel smaller than mReal on all
sides. The thicker you make this frame, the more mClient will shrink.

Using Object Boundaries in WindowsExample

Bounding rectangles are used in WindowsExample in the functions DrawText() and
OnPointerMove() of PanWindow.cpp. We will first take a look at how they are used in
DrawText(), then in OnPointerMove().

Bounding Rectangles in DrawText()

The DrawText() function adds a new PegPrompt to the bottom of PanWindow each time
it is called. At first this seems simple enough, but what happens when you run out of
room in PanWindow? How do you know when the PegPrompts have grown past the
height of PanWindow?
As mentioned in the previous section, all objects derived from PegThing have a mClient
and an mReal associated with them. To know when we have run out of room in
PanWindow, we need a running rectangle that is the union of the mClients for the
PegPrompts that have been added. To accomplish this we create a class member called
promptRect that is a PegRect. Each time we add a new PegPrompt, we take the union of
the new PegPrompt's mClient and the existing promptRect. The code looks like this:
text = new PegPrompt(4, promptRect.Height()+25,
(PEGCHAR*)"Window Resized!");
promptRect |= text->mReal;
AddR(text);
38

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents