PrevNextUpHome SophiaFramework UNIVERSE 5.1

9.9. Root(Applied)

9.9.1. Method to Customize the Responder Space (Full Screen Mode)

The responder space for drawing a responder tree is specified in the argument of the SFYRenderer::Initialize function, which is called just before the root(SFZRoot) is bound with the renderer.

To draw the responder tree in the full screen region of the mobile phone, specify a rectangular region of the device screen in the argument of the SFYRenderer::Initialize function after setting the full screen mode by the SFBDisplay::SetPrefs function as the sample code below:

Example 9.45. Setting the responder space to the full screen region

SFCError USRApplication::Make(Void)
{
    SFCError error(SFERR_NO_ERROR);

    // initialize distributer
    error = _distributer.Initialize();
    if (error == SFERR_NO_ERROR) {

      // get SFBDisplay intstance
      if ((graphics = SFXGraphics::GetInstance()) != null) {

          display = graphics->GetSFBDisplay();

          // change display-screen size(annunicators: yes, screen height: max)
          if ((error = display->SetPrefs("a:1,w:*,h:*")) == SFERR_NO_ERROR) {

                // reset clipping rectangle for SFBDisplay instance
                // * all drawing performed outside of clipping rectangle will not be displayed
                display->ResetClipRect();

                // initialize renderer
                // set responder space to full screen region set with SFBDisplay::SetPrefs()
                error = _renderer.Initialize(SFXGraphics::GetDeviceRectangle());
                if (error == SFERR_NO_ERROR) {

                    // make root
                    if ((_root = SFZRoot::NewInstance(&error)) != null) {

                        // bind root with distributer
                        _root->SetDistributer(&_distributer);

                        // bind root with renderer
                        _root->SetRenderer(&_renderer);

                        // set root's real region to responder space
                        _root->SetRealBound(_root->GetSuitableBound());

                        // set root's state to "visible" + "active" + "enable" + "focus" together
                        _root->SetState(true, true, true, true);
                    }
                }
            }
        }
    }

    return error;
}
[Note] CAUTION

Difference from the sample code of General Purpose Root to Place a Window, Dialog, Menu or Frame [SFZRoot] is only in bold segments.

[Note] Responder space

Responder space is a rectangular region inside the device screen, where a responder tree bound with a renderer will be drawn.

The responder space is set with the SFYRenderer::Initialize function to initialize the renderer. After this initialization, the responder space cannot be expanded nor reduced dynamically.

By default, the responder space is set to a rectangular region of all device screen.

[Important] Setting of the mif file

To use the SFBDisplay::SetPrefs function, the AEEPRIVID_DISPSETTINGS previledge of the MIF file is needed. This previledge can be obtained by selecting the "dependent file" tab of the MIF editor and adding the external class "DISPSETTINGS (0x0103081D)" included in the include file of BREW SDK.

Full screen mode is not supprted by BREW simulator(as of 2010/1/14). To confirm this behaviour, a mobile phone is required. Some mobile phone may not support the full screen mode.

All sample code is available at this site(fullscreen-en.zip: 40.5kb).

Supporting the full screen mode for the applet with an application class inheriting from SFYApplication

To make the default root(SFZRoot) contained by SFYApplication support the full screen mode, append the code below into the constructor of the application class.

All sample code is available at this site(fullscreen_sfy-en.zip: 40.4kb).

Example 9.46. Supporting the full screen mode for the applet with an application class inheriting from SFYApplication

// constructor of application class
USRApplication::USRApplication(Void) static_throws
{
    SFXGraphicsPtr  graphics;
    SFBDisplaySmp   display;
    SFBBitmapSmp    bitmap;
    AEEBitmapInfo   info = {0};
    SFYRendererPtr  renderer;
    SFZRootSmp     root;
    SFCError       error(SFERR_NO_ERROR);

    // initialize responder system

    // get SFXGraphics instance
    if ((graphics = SFXGraphics::GetInstance()) != null) {

        // get SFBDisplay instance
        display = graphics->GetSFBDisplay();

        // change display-screen size(annunicators: yes, screen height: max)
        if ((error = display->SetPrefs("a:1,w:*,h:*")) == SFERR_NO_ERROR) {

            // reset clipping rectangle for SFBDisplay instance
            // * all drawing performed outside of clipping rectangle will not be displayed
            display->ResetClipRect();

            // get device screen bitmap
            if ((bitmap = display->GetDeviceBitmap()) != null) {

                // get size of device screen bitmap
                bitmap->GetInfo(&info);

                // get renderer
                if ((renderer = GetRenderer()) != null) {

                    // initialize renderer
                    // set responder space to full screen region set with SFBDisplay::SetPrefs()
                    renderer->Initialize(SFXRectangle(0, 0, static_cast<SInt16>(info.cx), static_cast<SInt16>(info.cy)));

                    // get root
                    if ((root = static_pointer_cast<SFZRoot>(GetRoot())) != null) {

                       // set root's real region
                       root->SetRealBound(root->GetSuitableBound());
                    }
                }
            }
        }
    }

    // describe other initialization

    return error;
}