MonoScene(3X) manual page
Table of Contents
MonoScene - scene containing only one interactor
#include
<ivplus/scene.h>
MonoScene is derived from the Scene abstract
class. It is a scene that can contain only one interactor. MonoScene is
an abstract base class.
MonoScene->Scene->Interactor
Creates
a new monoscene. No parameters are needed. Since MonoScene is an abstract
base class, this constructor is protected.
This function first draws the monoscene, then if the interior interactor
is not nil, it calls the interactor’s Draw().
Constructs an array of pointers to the interactor
contained within the monoscene. The first and second parameters specify
an array of interactors that is already allocated. This array is used if
it is large enough to hold the results, otherwise a new array is allocated
from free store. The third and fourth parameters return which array was
used and the actual number of components.
Inserts
an interactor into the monoscene. If the monoscene already contains an interactor,
it is deleted and the passed interactor is inserted.
Inserts an interactor into
the monoscene with specific alignment to <x, y>. If the monoscene already
contains an interactor, it is deleted and the passed interactor is inserted.
See Alignment(3X)
for valid alignment values.
Removes
an interactor from the scene. When called in monoscene, it will set the
monoscene’s interior to nil.
Resize() notifies the
monoscene that its canvas has been created or modified. The monoscene redraws
the canvas background and places the interior interactor at <0, 0, xmax,
ymax>.
This calls
Reconfig() on the monoscene.
Inserts the given interactor, with alignment relative
to the passed x and y IntCoords. If the monoscene already contains an interactor,
it is deleted and the new interactor becomes the interior of the monoscene.
Sets the interior interactor pointer
to nil.
Returns a pointer to the current interior
interactor.
Sets the interior interactor pointer
to the given interactor.
Sets the shape of the monoscene
to the shape of the interior interactor.
None.
// MonoScene Example
#include <ivplus/box.h>
#include <ivplus/button.h>
#include <ivplus/frame.h>
#include <ivplus/glue.h>
#include <ivplus/scene.h>
#include <ivplus/world.h>
// Create a MyApp class derived from MonoScene.
// The Interior construction is defined in member function Init.
class MyApp : public MonoScene {
public:
MyApp()
{
Init();
};
private:
void Init();
ButtonState* bState;
};
void MyApp::Init()
{
bState = new ButtonState(0);
// MyApp consists of three push buttons in a hbox.
Insert(new HBox(new PushButton("OK", bState, 1),
new HGlue(), new PushButton("Cancel", bState, 2),
new HGlue(), new PushButton("Help", bState, 3)
)
);
};
int main(int argc, char **argv)
{
// Create the world to get the connection with the display.
World* world = new World("MyApp", argc, argv);
// Create an instance of MyApp which is derived from MonoScene.
MyApp* myapp = new MyApp();
// Map the window.
world->InsertApplication(new Frame(myapp, 1, BevelOut));
// Enter the event loop.
world->Run();
return 0;
}
scene.h
Canvas(3X)
, Interactor(3X)
, Scene(3X)
.
Table of Contents