PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFYRenderer
Class which draws a responder tree.
#include <SFYRenderer.h.hpp>
class SFYRenderer;
SFMTYPEDEFCLASS(SFYRenderer)

Collaboration diagram

 Collaboration diagram of SFYRendererClass

Description

This class draws the responder tree on the device screen. Some private functions of this class are used only in the SFYResponder class and the SFYDistributer class and will not be used directly in the applet development.

Since the SFYApplication class contains an instance of this class by default and automatically performs all the calling and setting necessary for the application, you don't have to operate on this class.

In case of contructing another responder tree, developer needs to use this class directly as the code below. At this time, in order to draw the responder tree on the device screen, the instance of this class needs to be bound with the root responder of the responder tree.

Moreover, the region(responder space) to draw the responder tree needs to be specified in the argument of the SFYRenderer::Initialize function.

Example 875. Construct the responder tree space

SFYRenderer _renderer;
SFZRootSmp _root;
SFCError error;

// initialize the SFYRenderer instance with specifying the responder space in the argument
if ((error = _renderer.Initialize(SFXGraphics::GetDeviceRectangle())) == SFERR_NO_ERROR) {

    // create the root of the responder tree
    if ((_root = SFZRoot::NewInstance(&error)) != null) {

        // bind the root of the responder tree with the SFYRenderer instance
        _root->SetRenderer(&_renderer);

        // here describe other initialization
        _root->SetRealBound(_root->GetSuitableBound());
        _root->SetStateVisible(true);
        ...
    }
}

Example 876. Release the responder tree space

SFYRenderer _renderer;
SFZRootSmp _root;

...

// release the SFYRenderer instance after the responder tree
_root.Release();
_renderer.Terminate();

Example 877. draw the new responder tree space

SFZRootSmp _root;
SFCError error;

...

// to draw the responder tree, call the Render function of the root responder
error = _root->Render();

Reference

Renderer | Responder Tree | Root Responder | Responder Space | Root(Basic) | SFYResponder | SFYDistributer | SFYApplication SFZRoot

Member

Constructor/Destructor
SFYRenderer( Void )
Constructor of the SFYRenderer class.
~SFYRenderer( Void )
Destructor of the SFYRenderer class.
Public Functions
SFXRectangleConstRef GetGlobalBound( Void )
Get the responder space.
SFCError Initialize( Void )
Initialize this renderer.
Bool IsRendering( Void )
Check whether or not this renderer is drawing.
Void Terminate( Void )
Terminate this renderer.

SFYRenderer::SFYRenderer
Constructor of the SFYRenderer class.
[ public, explicit ]
SFYRenderer(Void);

SFYRenderer::~SFYRenderer
Destructor of the SFYRenderer class.
[ public ]
~SFYRenderer(Void);

SFYRenderer::GetGlobalBound
Get the responder space.
[ public, const ]
SFXRectangleConstRef GetGlobalBound(Void);

Description

This function gets the rectangular region(responder space) to draw the responder tree on the device screen, which is set with the SFYRenderer::Initialize function.

Reference

SFYRenderer::Initialize | Responder Space | Responder Tree


SFYRenderer::Initialize
Initialize this renderer.
[ public ]
SFCError Initialize(Void);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed: SFERR_FAILED

Description

This function initializes all the resources necessary to draw the responder tree on the device screen.

Before binding this renderer with the root responder of the responder tree, it needs to be initialized by calling this function.

When this function is called, the rectangular region called "Responder Space" to draw the responder tree will be set to the device screen.

Reference

SFYRenderer::Terminate | Responder Tree | Responder Space | Renderer | Root(Basic)


SFYRenderer::IsRendering
Check whether or not this renderer is drawing.
[ public, const ]
Bool IsRendering(Void);

Return value

  • When the renderer is drawing: true
  • Otherwise: false

Description

This function checks whether the renderer is drawing now.


SFYRenderer::Terminate
Terminate this renderer.
[ public ]
Void Terminate(Void);

Description

This function releases all the resources necessary for drawing the responder tree and terminates this renderer itself.

In case this renderer is bound with the responder tree, it is necessary to terminate all responders of the responder tree before calling this function.

Reference

SFYRenderer::Initialize | Responder Tree | Responder Space | Renderer | Root(Basic)