[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    MonoScene(3X) manual page Table of Contents

Name

MonoScene - scene containing only one interactor

Synopsis

#include <ivplus/scene.h>

Description

MonoScene is derived from the Scene abstract class. It is a scene that can contain only one interactor. MonoScene is an abstract base class.

Class Hierarchy

MonoScene->Scene->Interactor

Constructors

MonoScene()

Creates a new monoscene. No parameters are needed. Since MonoScene is an abstract base class, this constructor is protected.

Public Operations

virtual void Draw()

This function first draws the monoscene, then if the interior interactor is not nil, it calls the interactor’s Draw().

virtual void GetComponents(Interactor**, int, Interactor**&, int&)

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.

void Scene::Insert(Interactor*)

Inserts an interactor into the monoscene. If the monoscene already contains an interactor, it is deleted and the passed interactor is inserted.

virtual void Scene::Insert(Interactor*, IntCoord x, IntCoord y, Alignment = BottomLeft)

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.

void Scene::Remove(Interactor*)

Removes an interactor from the scene. When called in monoscene, it will set the monoscene’s interior to nil.

virtual void Resize()

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>.

Protected Operations

virtual void DoChange(Interactor*)

This calls Reconfig() on the monoscene.

virtual void DoInsert(Interactor*, boolean, IntCoord& x, IntCoord& y)

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.

virtual void DoRemove(Interactor*)

Sets the interior interactor pointer to nil.

Interactor* interior()

Returns a pointer to the current interior interactor.

void interior(Interactor*)

Sets the interior interactor pointer to the given interactor.

virtual void Reconfig()

Sets the shape of the monoscene to the shape of the interior interactor.

X Resources

None.

Examples


//                          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;
}

Files


scene.h

See Also

Canvas(3X) , Interactor(3X) , Scene(3X) .


Table of Contents