SophiaFramework UNIVERSE 5.3 |
#include <SFYApplication.h.hpp>
class SFYApplication : public SFCApplication;
SFMTYPEDEFCLASS(SFYApplication)
How to use
An SFY applet which uses the SFY responder system is required to create one instance of a user-defined application class, which is defined and implemented by inheriting from SFYApplication.
The instance of this application class inheriting from SFYApplication, is the kernel to control the SFY applet execution, which will be created first and destroyed last.
Event Handling [General Processing Flow]
Tip | |
---|---|
The above description is the same with that of the SFCApplication class, from which the SFYApplication class inherits. |
Highest Priority Event Handler | |
---|---|
For more details, see the description of the SFCApplication::RegisterBypass function. |
Hierarchical Structure
The application class is placed at the highest position in the tree structure of responders such as window, dialog, menu, control, or frame.
An application will manage windows, dialogs, and menus. A window or a dialog will manage controls. The following diagram shows this hierarchy relationship.
Root responder which the application class contains | |
---|---|
The SFYApplication class contains one root(SFZRoot) as a root responder by default. GUI(Graphical user interface) of the SFY applet is implemented by constructing the responder tree, where this root(SFZRoot) is located at the top. All responder-related operations on this application class will be delegated to this root(SFZRoot). * Though the SFY applet can have more than one root by constructing another new responder tree explicitly, default root(SFZRoot) is used in the applet development in almost all cases. For more details, refer to root. |
SFYApplication is the abstract base class for all user-defined application classes which uses the SFY responder system.
This class contains the root bound with the distributer and the renderer as a default root responder , and provides the virtual functions below.
Virtual Functions
Table 200. Virtual function name and its default behaviour
Virtual function name | Default behaviour | Override |
---|---|---|
SFYApplication::HandleEvent | Boot up the distributer, and furthermore boot up the renderer if event is handled *1 | Optional |
SFYApplication::HandleRender | Redraw the device screen in white and the responder tree below the root. *1 | Optional |
SFCApplication::HandleError | - | Optional |
NOTE | |
---|---|
*1. Boot up the SFCApplication::HandleError function when fatal error such as memory insufficiency during the bootup of distributer or renderer occurs. |
Make a user-defined application class
The minimum code necessary to make a user-defined application class is as follows:
Example 853. Declaration
SFMTYPEDEFCLASS(USRApplication) class USRApplication: public SFYApplication { SFMSEALCOPY(USRApplication) public: static SFCInvokerPtr Factory(Void); private: explicit USRApplication(Void) static_throws; virtual ~USRApplication(Void); };
Example 854. Implementation
// boot loader: function first executed in BREW applet SFCApplet::FactorySPP SFCApplet::Boot(AEECLSID id, SFXAnsiStringPtr license) { // here place the license code *license = "heap://"; return (id == AEECLSID_USRAPPLICATION) ? (&USRApplication::Factory): (null); } // factory function to create instance of user-defined application class SFCInvokerPtr USRApplication::Factory(Void) { return::new USRApplication; } // constructor USRApplication::USRApplication(Void) static_throws { if (static_try()) { // here describe the initialization } } // destructor USRApplication::~USRApplication(Void) { // here describe the finalization }
The return statement in the constructor or destructor | |
---|---|
In general, the return statement should not be written in the constructor and destructor with C++. The bug has been confirmed in GCC. It is that compiler will freeze if the return statement is written in the constructor or destructor under some particular inheritance relationship. |
Application Class(Basic) | SFY Responder System | Window | Dialog | Menu | Control | Frame | Responder Tree | Root Responder | Root | SFZRoot
Constructor/Destructor |
---|
SFYApplication( Void ) Constructor of the SFYApplication class.
|
SFYApplication(
SFXBaseEditorPtr editor
) Constructor of the SFYApplication class.
|
~SFYApplication( Void ) Destructor of the SFYApplication class.
|
Public Functions | |
---|---|
Void |
ClearHandler( Void ) Unregister all handlers from this application.
|
Void |
ClearTracer( Void ) Unregister all rules from the tracer of this application.
|
SFCError |
Distribute(
SFXEventConstRef event
, BoolPtr result = null
)
[Type 1] Distribute the specified event.
[Type 2] Wrap and call the specified callback function which includes sending events.
|
SFCError |
Distribute(
VoidPtr context
, SFYDistributer::CallbackSPP spp
, VoidPtr reference
, BoolPtr result = null
)
[Type 1] Distribute the specified event.
[Type 2] Wrap and call the specified callback function which includes sending events.
|
SFYResponderSmp |
GetChildBack( Void ) Get the backmost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBack(
Bool visible
, Bool active
, Bool enable
, Bool focus
) Get the backmost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBack(
UInt32 id
) Get the backmost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBack(
UInt32 id
, Bool visible
, Bool active
, Bool enable
, Bool focus
) Get the backmost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBackward(
SInt32 index
)
Get the child responder of this application at the specified position from the back side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBackward(
SInt32 index
, Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the child responder of this application at the specified position from the back side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBackward(
SInt32 index
, UInt32 id
)
Get the child responder of this application at the specified position from the back side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildBackward(
SInt32 index
, UInt32 id
, Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the child responder of this application at the specified position from the back side,
which matches the specified search condition.
|
SInt32 |
GetChildCount( Void )
Get the number of child responders of this application,
which match the specified search condition.
|
SInt32 |
GetChildCount(
Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the number of child responders of this application,
which match the specified search condition.
|
SInt32 |
GetChildCount(
UInt32 id
)
Get the number of child responders of this application,
which match the specified search condition.
|
SInt32 |
GetChildCount(
UInt32 id
, Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the number of child responders of this application,
which match the specified search condition.
|
SFYResponderSmp |
GetChildForward(
SInt32 index
)
Get the child responder of this application at the specified position from the front side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildForward(
SInt32 index
, Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the child responder of this application at the specified position from the front side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildForward(
SInt32 index
, UInt32 id
)
Get the child responder of this application at the specified position from the front side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildForward(
SInt32 index
, UInt32 id
, Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the child responder of this application at the specified position from the front side,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildFront( Void )
Get the foremost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildFront(
Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the foremost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildFront(
UInt32 id
)
Get the foremost child responder of this application,
which matches the specified search condition.
|
SFYResponderSmp |
GetChildFront(
UInt32 id
, Bool visible
, Bool active
, Bool enable
, Bool focus
)
Get the foremost child responder of this application,
which matches the specified search condition.
|
static SFYDistributerPtr |
GetDistributer( Void ) Get the distributer bound with this application.
|
static SFXBaseEditorPtr |
GetEditor( Void ) Get the text input control editor which this application contains internally.
|
SFXRectangle |
GetGlobalBound( Void ) Get the globle region of this application.
|
static SFYApplicationPtr |
GetInstance( Void ) Get the instance of this application.
|
SFXRectangle |
GetLocalBound( Void ) Get the local region of this application.
|
SFXRectangleConstRef |
GetRealBound( Void ) Get the real region of this application.
|
static SFYRendererPtr |
GetRenderer( Void ) Get the renderer bound with this application.
|
static SFZRootSmpConstRef |
GetRoot( Void ) Get the root responder of this application.
|
SFXRectangle |
GetSuitableBound( Void ) Get the most suitable size of the visible rectangular region of this application.
|
SFXRectangle |
GetSuitableBound(
SFXRectangleConstRef param
) Get the most suitable size of the visible rectangular region of this application.
|
SFXRectangleConstRef |
GetVirtualBound( Void ) Get the virtual region of this application.
|
Void |
Invalidate( Void ) Register the specified redraw region of this application.
|
Void |
Invalidate(
SFXRectangleConstRef param
) Register the specified redraw region of this application.
|
Void |
InvokeBackward(
SFXEventConstRef event
, Bool overload
, BoolPtr result = null
) Call the handlers for the specified event from the end of handler list registered into this application[root].
|
Void |
InvokeForward(
SFXEventConstRef event
, Bool overload
, BoolPtr result = null
) Call the handlers for the specified event from the head of the handler list registered into this application[root].
|
Bool |
IsRendererIntermissive( Void ) Check whether or not to terminate the renderer when an applet suspends.
|
SFCError |
RegisterHandler(
SFXEventRangeConstRef range
, SFYHandler::RuleRecConstRef rule
) Register specified handlers into this application.
|
SFCError |
RegisterHandler(
SFXEventRangeConstRef range
, SFYHandler::HandlerSPP spp
, VoidPtr reference
) Register specified handlers into this application.
|
SFCError |
RegisterHandler(
SFXEventRangeConstPtr range
, SFYHandler::RuleRecConstPtr rule
, SInt32 length
) Register specified handlers into this application.
|
SFCError |
RegisterHandler(
SFXEventRangeConstPtr range
, SFYHandler::HandlerSPPConstPtr spp
, VoidPtrConstPtr reference
, SInt32 length
) Register specified handlers into this application.
|
SFCError |
RegisterTracer(
SFXEventRangeConstRef range
, SFYTracer::RuleRecConstRef rule
) Register specified rules into the tracer of this application.
|
SFCError |
RegisterTracer(
SFXEventRangeConstRef range
, SFYTracer::OrderEnum order
, SFYTracer::StateEnum state
, Bool overload
) Register specified rules into the tracer of this application.
|
SFCError |
RegisterTracer(
SFXEventRangeConstPtr range
, SFYTracer::RuleRecConstPtr rule
, SInt32 length
) Register specified rules into the tracer of this application.
|
SFCError |
RegisterTracer(
SFXEventRangeConstPtr range
, SFYTracer::OrderEnumConstPtr order
, SFYTracer::StateEnumConstPtr state
, BoolConstPtr overload
, SInt32 length
) Register specified rules into the tracer of this application.
|
SFCError |
Render(
Bool force = false
) Boot up the renderer for redrawing this application[root] and its descendant responders.
|
Void |
SetRealBound(
SFXRectangleConstRef param
) Set the real region of this application to the specified region.
|
Void |
SetRendererIntermissive(
Bool param
) Set the flag indicating whether or not to terminate the renderer when an applet suspends.
|
Void |
SetVirtualBound(
SFXRectangleConstRef param
) Set the virtual region of this application to the specified region.
|
Void |
UnregisterHandler(
SFXEventRangeConstRef range
, SFYHandler::RuleRecConstRef rule
) Unregister the handler from this application which matches the specified condition.
|
Void |
UnregisterHandler(
SFXEventRangeConstRef range
, SFYHandler::HandlerSPP spp
, VoidPtr reference
) Unregister the handler from this application which matches the specified condition.
|
Void |
UnregisterHandler(
SFXEventRangeConstPtr range
, SFYHandler::RuleRecConstPtr rule
, SInt32 length
) Unregister the handler from this application which matches the specified condition.
|
Void |
UnregisterHandler(
SFXEventRangeConstPtr range
, SFYHandler::HandlerSPPConstPtr spp
, VoidPtrConstPtr reference
, SInt32 length
) Unregister the handler from this application which matches the specified condition.
|
Void |
UnregisterTracer(
SFXEventRangeConstRef range
) Unregister specified rules from the tracer of this application.
|
Void |
UnregisterTracer(
SFXEventRangeConstPtr range
, SInt32 length
) Unregister specified rules from the tracer of this application.
|
static AEECLSID |
GetClassID( Void )
(inherits from SFCApplication)
Get the ClassID of this BREW applet.
|
Bool |
IsHandlingEvent( Void )
(inherits from SFCApplication)
Check whether or not an event is being processed.
|
Bool |
IsRenderable( Void )
(inherits from SFCApplication)
Check whether or not the screen can be drawn.
|
SFCError |
RegisterBypass(
CallbackSPP spp
, VoidPtr reference
)
(inherits from SFCApplication)
Register the highest priority event handler.
|
Bool |
RenderDeviceScreen( Void )
(inherits from SFCApplication)
Redraw the device screen.
|
static SFCError |
Terminate(
Bool idle = false
)
(inherits from SFCApplication)
Terminate this application.
|
Void |
UnregisterBypass(
CallbackSPP spp
, VoidPtr reference
)
(inherits from SFCApplication)
Unregister the highest priority event handler.
|
Protected Functions | |
---|---|
SFYResponderSmp |
GetThis( Void ) Get the root which this application class contains by default.
|
Bool |
HandleEvent(
SFXEventConstRef event
) This is a virtual function that will be called when an event dispatched from the BREW environment needs to be handled.
|
Bool |
HandleRender(
SFXEventConstRef event
) This is a virtual function that will be called when the full screen needs to be redrawn.
|
Bool |
HandleError(
SFXEventConstRef event
, SFCError error
)
(inherits from SFCApplication)
This is a virtual function that will be called when the fatal error occurs.
|
Bool |
Invoke(
SFXEventConstRef event
)
(inherits from SFCApplication)
This is a virtual function that will be called when an event dispatched from the BREW environment needs to be handled.
|
[ protected, explicit ] SFYApplication(Void);
[ protected, explicit ] SFYApplication( SFXBaseEditorPtr editor // text input control editor );
This constructor performs the initializations as follows:
For more details, see the internal implementation code below.
Implementation of this constructor is as follows:
// definition of SFYApplication class class SFYApplication : public SFCApplication { SFMSEALCOPY(SFYApplication) private: SFYDistributer _distributer; // distributer SFYRenderer _renderer; // renderer SFZRootSmp _root; // root SFXBaseEditorPtr _editor; // text input control editor Bool _intermissive; // flag indicating whether or not to release the saved bitmap to restore the device screen at suspend time public: ... }; // implementation of constructor of SFYApplication class /*protected */SFYApplication::SFYApplication(Void) : _editor(null), _intermissive(false) static_throws { // initialization if (static_try()) { // create the text input control editor if ((_editor = ::new SFXEditor) != null) { // initialize the root, the ditributer, and the renderer static_throw(Initialize()); } else { static_throw(SFERR_NO_MEMORY); } } }// SFYApplication::SFYApplication // /*protected */SFYApplication::SFYApplication(SFXBaseEditorPtr editor) : _editor(null), _intermissive(false) static_throws { // initialization if (static_try()) { // if the text input control editor is set if (_editor != null) { // initialize the root, the ditributer, and the renderer static_throw(Initialize()); } else { static_throw(SFERR_INVALID_PARAM); } } }// SFYApplication::SFYApplication // /*private */SFCError SFYApplication::Initialize(Void) { SFCError error; // initialize the distributer if ((error = _distributer.Initialize()) == SFERR_NO_ERROR) { // initialize the renderer // * responder space will be set to the device screen if ((error = _renderer.Initialize() == SFERR_NO_ERROR) { // create the root if ((_root = SFZRoot::NewInstance(&error)) != null) { // bind the root with the distributer _root->SetDistributer(&_distributer); // bind the root with the renderer _root->SetRenderer(&_renderer); // set root's real region to the responder space(i.e., all the device screen) _root->SetRealBound(_root->GetSuitableBound()); // set the root's state to "visible" + "active" + "enable" + "focus" together _root->SetState(true, true, true, true); } } } return error; }// SFYApplication::Initialize //
SFYApplication::SetRendererIntermissive | SFYResponder::SetDistributer | SFZRoot | SFYDistributer | SFYRenderer | SFXEditor | Distributer | Renderer | Responder Space | Root | Root Responder | Real Region | State
[ protected, pure-virtual ] virtual ~SFYApplication(Void);
SFYApplication::~SFYApplication is the destructor of the SFYApplication class. This function performs the processing below.
For more details, see the example code below.
Implementation of this destructor is as follows:
// definition of SFYApplication class class SFYApplication : public SFCApplication { SFMSEALCOPY(SFYApplication) private: SFZRootSmp _root; // root SFYDistributer _distributer; // distributer SFYRenderer _renderer; // renderer SFXBaseEditorPtr _editor; // text input control editor public: ... }; // implementation of destructor of SFYApplication class /*protected virtual */SFYApplication::~SFYApplication(Void) { // finalization: execute these in order below // destroy the text input control editor ::delete _editor; // release the responder tree _root.Release(); // terminate the renderer _renderer.Terminate(); // terminate the distributer _distributer.Terminate(); }// SFYApplication::~SFYApplication //
Reference: SFXResponderPointer::Release | SFYRenderer::Terminate | SFYDistributer::Terminate
SFZRoot | Distributer | Renderer | Root | Root Responder | Responder Tree
[ public ] Void ClearHandler(Void);
This function unregisters all handlers from this application[root(SFZRoot)].
[ public ] Void ClearTracer(Void);
This function unregisters all rules from the tracer of this application[root(SFZRoot)].
[ public ] SFCError Distribute( SFXEventConstRef event // event BoolPtr result = null // processing result );
[ public ] SFCError Distribute( VoidPtr context // context(e.g., error value) SFYDistributer::CallbackSPP spp // callback function VoidPtr reference // reference BoolPtr result = null // processing result );
This function has two distinct types of use cases depending on its arguments as follows:
For both two types, if the return value is "true", it is necessary to call the SFYApplication::Render function for redrawing the screen since the contents of some responders may be changed.
Note | |
---|---|
For more details, see the descrption of the SFYResponder::Distribute function. |
SFYResponder::Distribute | SFZRoot | Root(Basic) | Distribute Type | Callback Type | Event Loop | Event
[ public, const ] SFYResponderSmp GetChildBack(Void);
[ public, const ] SFYResponderSmp GetChildBack( Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
[ public, const ] SFYResponderSmp GetChildBack( UInt32 id // ID );
[ public, const ] SFYResponderSmp GetChildBack( UInt32 id // ID Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
Backmost child responder of this application.
"null" will be returned if it does not exist.
This function gets the backmost child responder of this application[root(SFZRoot)], which matches the specified search condition. If there is no child responder, "null" will be returned.
Tip | |
---|---|
The child responders to be searched can be limited by specifying the ID and the conditions of visible, active, enable, or focus state. |
Tip | |
---|---|
The attachment-frames are not included in the searching. |
SFYResponderSmp child; get the backmost responder among all child responders child = GetChildBack(); get the backmost responder among all child responders with ID = 128 child = GetChildBack(128); get the backmost responder among visible child responders (not care about the enable state and focus state) child = GetChildBack(true, true, false, false); get the backmost responder among visible and enable child responders (not care about the focus state) child = GetChildBack(true, true, true, false);
SFYResponder::GetChildBack | SFYApplication::GetChildFront | SFYApplication::GetChildBackward | SFZRoot | ID | State | Child Responder | Root(Basic)
[ public, const ] SFYResponderSmp GetChildBackward( SInt32 index // order (0-based) );
[ public, const ] SFYResponderSmp GetChildBackward( SInt32 index // order (0-based) Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
[ public, const ] SFYResponderSmp GetChildBackward( SInt32 index // order (0-based) UInt32 id // ID );
[ public, const ] SFYResponderSmp GetChildBackward( SInt32 index // order (0-based) UInt32 id // ID Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
Child responder of this application at the specified position from the back side.
"null" will be returned if it does not exist.
This function gets the child responder of this application[root(SFZRoot)] at the specified position from the back side, which matches the specified search condition. If there is no child responder, "null" will be returned.
Tip | |
---|---|
The child responders to be searched can be limited by specifying the ID and the conditions of visible, active, enable, or focus state. |
Tip | |
---|---|
The attachment-frames are not included in the searching. |
SFYResponderSmp child; get the responder at the 3rd position among all child responders from the back side child = GetChildBackward(2); get the responder at the 3rd position among all child responders with ID = 128 from the back side child = GetChildBackward(2, 128); get the responder at the 3rd position among all visble child responders from the back side (not care about the enable state and focus state) child = GetChildBackward(2, true, true, false, false); get the responder at the 3rd position among all visble and enable child responders from the back side (not care about the focus state) child = GetChildBackward(2, true, true, true, false);
SFYResponder::GetChildBackward | SFYApplication::GetChildForward | SFYApplication::GetChildBack | SFZRoot | ID | State | Child Responder | Root(Basic)
[ public, const ] SInt32 GetChildCount(Void);
[ public, const ] SInt32 GetChildCount( Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
[ public, const ] SInt32 GetChildCount( UInt32 id // ID );
[ public, const ] SInt32 GetChildCount( UInt32 id // ID Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
Number of child responders of this application.
This function gets the number of child responders of this application[root(SFZRoot)], which match the specified search condition. If there is no child responder, 0 will be returned.
Tip | |
---|---|
The child responders to be searched can be limited by specifying the ID and the conditions of visible, active, enable, or focus state. |
Tip | |
---|---|
The attachment-frames are not included in the searching. |
SInt32 count; get the number of all child responders count = GetChildCount(); get the number of all child responders with ID = 128 count = GetChildCount(128); get the number of all visible child responders (not care about the enable state and focus state) count = GetChildCount(true, true, false, false); get the number of all visible and enable child responders (not care about the focus state) count = GetChildCount(true, true, true, false);
SFYResponder::GetChildCount | SFZRoot | ID | State | Child Responder | Root(Basic)
[ public, const ] SFYResponderSmp GetChildForward( SInt32 index // order (0-based) );
[ public, const ] SFYResponderSmp GetChildForward( SInt32 index // order (0-based) Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
[ public, const ] SFYResponderSmp GetChildForward( SInt32 index // order (0-based) UInt32 id // ID );
[ public, const ] SFYResponderSmp GetChildForward( SInt32 index // order (0-based) UInt32 id // ID Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
Child responder of this application at the specified position from the front side.
"null" will be returned if it does not exist.
This function gets the child responder of this application[root(SFZRoot)] at the specified position from the front side, which matches the specified search condition. If there is no child responder, "null" will be returned.
Tip | |
---|---|
The child responders to be searched can be limited by specifying the ID and the conditions of visible, active, enable, or focus state. |
Tip | |
---|---|
The attachment-frames are not included in the searching. |
SFYResponderSmp child; get the responder at the 3rd position among all child responders from the front side child = GetChildForward(2); get the responder at the 3rd position among all child responders with ID = 128 from the front side child = GetChildForward(2, 128); get the responder at the 3rd position among all visble child responders from the front side (not care about the enable state and focus state) child = GetChildForward(2, true, true, false, false); get the responder at the 3rd position among all visble and enable child responders from the front side (not care about the focus state) child = GetChildForward(2, true, true, true, false);
SFYResponder::GetChildForward | SFYApplication::GetChildBackward | SFZRoot | ID | State | Child Responder | Root(Basic)
[ public, const ] SFYResponderSmp GetChildFront(Void);
[ public, const ] SFYResponderSmp GetChildFront( Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
[ public, const ] SFYResponderSmp GetChildFront( UInt32 id // ID );
[ public, const ] SFYResponderSmp GetChildFront( UInt32 id // ID Bool visible // visible condition Bool active // active condition Bool enable // enable condition Bool focus // focus condition );
Foremost child responder of this application.
"null" will be returned if it does not exist.
This function gets the foremost child responder of this application[root(SFZRoot)], which matches the specified search condition. If there is no child responder, "null" will be returned.
Tip | |
---|---|
The child responders to be searched can be limited by specifying the ID and the conditions of visible, active, enable, or focus state. |
Tip | |
---|---|
The attachment-frames are not included in the searching. |
SFYResponderSmp child; get the foremost responder among all child responders child = GetChildFront(); get the foremost responder among all child responders with ID = 128 child = GetChildFront(128); get the foremost responder among all visible child responders (not care about the enable state and focus state) child = GetChildFront(true, true, false, false); get the foremost responder among all visible and enable child responders (not care about the focus state) child = GetChildFront(true, true, true, false);
SFYResponder::GetChildFront | SFYApplication::GetChildBack | SFYApplication::GetChildForward| SFZRoot | ID | State | Child Responder | Root(Basic)
[ public, static ] SFYDistributerPtr GetDistributer(Void);
Distributer bound with this application[root(SFZRoot)].
"null" will be returned if no distributer is bound with this application[root(SFZRoot)].
This function gets the distributer bound with this application[root(SFZRoot)].
SFYResponder::GetDistributer | Distributer | SFZRoot | Root(Basic)
[ public, static ] SFXBaseEditorPtr GetEditor(Void);
Text input control editor which this application contains internally.
"null" will be returned if this application contains no text input control editor internally.
This function gets the text input control editor which this application contains internally.
[ public, const ] SFXRectangle GetGlobalBound(Void);
Global region of this application[i.e., root]
This function gets the global region of this application[root(SFZRoot)].
SFYResponder::GetGlobalBound | SFYApplication::GetLocalBound | SFYApplication::GetRealBound | SFZRoot | Root(Basic) | Global Region
[ public, static ] SFYApplicationPtr GetInstance(Void);
This function gets the instance of this application class, which exists only one per applet.
Global variable | |
---|---|
To access a global variable defined in an application class, call this function as in the below example. |
Example 855. Define and Access the Global Variable
// // helloworld Application class // SFMTYPEDEFCLASS(helloworld) class helloworld : public SFYApplication { SFMSEALCOPY(helloworld) public: static SFCInvokerPtr Factory(Void); private: explicit helloworld(Void) static_throws; virtual ~helloworld(Void); // define global variable "global_something_val" SInt32 global_something_val; public: // declare GetGlobalSomethingVal() to access global variable "global_something_val" SInt32 GetGlobalSomethingVal() const; }; // implement GetGlobalSomethingVal() to access global variable "global_something_val" SInt32 helloworld::GetGlobalSomethingVal(Void) const { return global_something_val; } // get value of global variable "global_something_val" via GetGlobalSomethingVal() static_cast<helloworldPtr>(SFYApplication::GetInstance())->GetGlobalSomethingVal();
[ public, const ] SFXRectangle GetLocalBound(Void);
Local region of this application[i.e., root]
This function gets the local region of this application[root(SFZRoot)].
SFYResponder::GetLocalBound | SFYApplication::GetGlobalBound | SFYApplication::GetVirtualBound SFZRoot | Root(Basic) | Local Region
[ public, const ] SFXRectangleConstRef GetRealBound(Void);
Real region of this application[i.e., root]
This function gets the real region of this application[root(SFZRoot)].
SFYResponder::GetRealBound | SFYApplication::SetRealBound | SFYApplication::GetVirtualBound | SFYApplication::GetGlobalBound | SFZRoot | Root(Basic) | Real Region
[ public, static ] SFYRendererPtr GetRenderer(Void);
Renderer bound with this application[root(SFZRoot)].
"null" will be returned if no renderer is bound with this application[root(SFZRoot)].
SFYResponder::GetRenderer | SFZRoot | Root(Basic) | Renderer
[ public, static ] SFZRootSmpConstRef GetRoot(Void);
This function gets the root(SFZRoot) which this application class contains by default.
This function is used to set the parent of a responder such as a window to the root or set handlers or dispatching rules to the root.
The code to set the parent of a window to the root is as follows:
SFZWindowSmp window; ... window->SetParent(GetRoot());
[ public ] SFXRectangle GetSuitableBound(Void);
[ public ] SFXRectangle GetSuitableBound( SFXRectangleConstRef param // hint region );
This function gets the suitable size for the real region of this application[root(SFZRoot)].
If the argument is not specified, the responder space(device screen) which is set to the renderer will be returned.
If the argument is specified, only the specified rectangular region will be returned just as it is.
Caution | |
---|---|
In general, the argument is not specified when the SFYApplication::GetSuitableBound function is used. |
Tip | |
---|---|
Since the real region of the root(SFZRoot) which this application contains by default has been set in the SFYApplication::SFYApplication constructor, there is no need to use this function. |
SFYResponder::GetSuitableBound | SFYApplication::SetRealBound | SFYApplication::SFYApplication | SFZRoot | Real Region | Responder Space | Renderer | Root(Basic)
[ protected ] SFYResponderSmp GetThis(Void);
Root(SFZRoot) which this application class contains internally by default.
This function gets the root(SFZRoot) which this application class contains as the root responder by default.
SFYResponder::GetThis | SFZRoot | Root(Basic) | Root Responder
[ public, const ] SFXRectangleConstRef GetVirtualBound(Void);
Virtual region of this application[i.e., root]
This function gets the virtual region of this application[root(SFZRoot)].
SFYResponder::GetVirtualBound | SFYApplication::SetVirtualBound | SFYApplication::GetRealBound | SFYApplication::GetLocalBound SFZRoot | Root(Basic) | Virtual Region
[ protected, virtual ] Bool HandleEvent( SFXEventConstRef event // event );
SFYApplication::HandleEvent is a virtual function that will be called when an event dispatched from the BREW environment(BREW-defined event) must be handled.
If the event is handled, "true" will be returned. Otherwise, "false" will be returned.
Default implementation is as follows:
Highest Priority Event Handler | |
---|---|
For more details, see the description of the SFCApplication::RegisterBypass function. |
For more details, see the example code below.
You can override this virtual function for your own processing.
Internal implementation of this function is as follows:
// virtual function that will be called when the event dispatched from the BREW environment needs to be handled /*protected virtual */Bool SFYApplication::HandleEvent(SFXEventConstRef event) { // here describe the handling of the event dispatched from the BREW environment SFCError error; Bool result(false); // boot up the distributer to distribute the event using the tracer // first of all, the SFYDistributer instance bound with the root will receive the event // then, the event will be distributed to the responders in the responder tree according to the dispatching rules of the tracer // * _root is the root(SFZRoot) if ((error = _root->Distribute(event, &result)) == SFERR_NO_ERROR) { if (event.GetType() != SFEVT_APP_STOP && event.GetType() != SFEVT_APP_SUSPEND)) { // if redrawing is necessary if (IsRenderable()) { // if the screen can be redrawn (i.e., if no highest priority event handler is registered) // boot up the renderer to redraw the responder tree below the root error = _root->Render(); } } } if (error != SFERR_NO_ERROR) { // call HandleError() in case the fatal error such as insufficient memory during the initialization of the distributer or the renderer occurs if (HandleError(event, error)) { result = true; } } if ((event.GetType() == SFEVT_APP_SUSPEND) && IsRendererIntermissive()) { // if the back-up bitmap inside the renderer is released when an application suspends // terminate the renderer _renderer.Terminate(); } return result; // return "true" if the event has been handled, otherwise return "false" }// SFYApplication::HandleEvent //
Reference: SFCApplication::HandleEvent | SFCApplication::IsRenderable | SFCApplication::HandleError | SFYApplication::IsRendererIntermissive | SFYResponder::Distribute | SFYResponder::Render | SFYRenderer::Initialize | SFYRenderer::Terminate | SFZRoot | Root | Tracer | Distributer | Renderer Drawing Event | Drawing Handler | Event Loop
SFCApplication::HandleEvent | SFCApplication::RegisterBypass | SFZRoot | BREW-defined event | Distributer | Tracer | Renderer
[ protected, virtual ] Bool HandleRender( SFXEventConstRef event // event );
SFYApplication::HandleRender is a virtual function that will be called when the full screen needs to be redrawn.
If the full screen is redrawn, "true" will be returned. Otherwise, "false" will be returned.
When the HandleRender() function is called | |
---|---|
When an applet starts or resumes, or when a highest priority event handler ends, the full screen needs to be redrawn. The SFYApplication::HandleRender function is automatically called at these times. * The screen needs to be redrawn at the end of the highest priority event handler by calling the SFCApplication::RenderDeviceScreen function. In this case, HandleRender() will be called inside the SFCApplication::RenderDeviceScreen function. |
Highest Priority Event Handler | |
---|---|
For more details, see the description of the SFCApplication::RegisterBypass function. |
For the default implementation of the SFYApplication::HandleRender function, see the example code below.
You can override this virtual function for your own processing.
Internal implementation of this function is as follows:
// virtual function that will be called when the full screen needs to be redrawn /*protected virtual */Bool SFYApplication::HandleRender(SFXEventConstRef event) { // here describe full screen redrawing SFCError error; Bool result(false); if (SFCApplication::HandleRender(event)) { // redraw the device screen // redraw the responder tree below the root // *1. if possible, redraw using the bitmap to restore the device screen // *2. start up the renderer by calling "Render(true)" if the bitmap to restore the device screen is not available in a timing such as receiving the SFEVT_APP_START event // *3. in case of "Render(true)", all visible responders' drawing handlers will be called error = _root->Render((event.GetType() == SFEVT_APP_START) || (_root->Recover() != SFERR_NO_ERROR)); if (error == SFERR_NO_ERROR) { result = true; } else { // call HandleError() when fatal error such as insufficient memory during initialization of renderer HandleError(event, error); } } return result; }// SFYApplication::HandleRender //
Reference: SFCApplication::HandleRender | SFCApplication::HandleError | SFYResponder::Render | SFYResponder::Recover | SFZRoot | Root | Renderer
SFCApplication::HandleRender | SFCApplication::HandleError | SFCApplication::RenderDeviceScreen
[ public ] Void Invalidate(Void);
[ public ] Void Invalidate( SFXRectangleConstRef param // redraw region(if not specified, real region of this application[root] will be passed) );
This function is used to register the specified redraw region when a text or an image inside this application[root(SFZRoot)] is updated. A subset rectangle of root can be specified in the argument. If nothing is specified, all real region of the root is regarded as the redraw region.
Note | |
---|---|
For more details on the Invalidate() function, see the description of the SFYResponder::Invalidate function. |
SFYResponder::Invalidate | Real Region | SFZRoot | Root(Basic)
[ public ] Void InvokeBackward( SFXEventConstRef event // event Bool overload // overloading condition BoolPtr result = null // processing result );
This function sends the specified event of the callback type to this application[root(SFZRoot)].
The handlers are booted up in the order to be registerd into the handler list of the root.
Note | |
---|---|
For more details on the InvokeBackward() function, see the description of the SFYResponder::InvokeBackward function. |
SFYResponder::InvokeBackward | SFYApplication::InvokeForward | SFYApplication::Distribute | Handler | Handler List | SFZRoot | Root(Basic)
[ public ] Void InvokeForward( SFXEventConstRef event // event Bool overload // overloading condition BoolPtr result = null // processing result );
This function sends the specified event of the callback type to this application[root(SFZRoot)].
The handlers are booted up in the reverse order to be registerd into the handler list of the root.
Note | |
---|---|
For more details on the InvokeForward() function, see the description of the SFYResponder::InvokeForward function. |
SFYResponder::InvokeForward | SFYApplication::InvokeBackward | SFYApplication::Distribute | Handler | Handler List | SFZRoot | Root(Basic)
[ public, const ] Bool IsRendererIntermissive(Void);
This function checks whether or not to terminate the renderer when an applet suspends.
Note | |
---|---|
If you want to release resources such as the saved bimap to restore the device screen by terminating the renderer when an applets suspends, specify the param argument to true. In this case, the SFYRenderer::Terminate function will be called automatically when an applets receives the SFEVT_APP_RESUME event. After an applets resumes, the SFYRenderer::Initialize function will be called automatically and the renderer will be initialized when redrawing is performed by calling the SFYResponder::Render function. For more details, refer to the internal implementaion of the SFYApplication::HandleEvent function. |
[ public ] SFCError RegisterHandler( SFXEventRangeConstRef range // event range SFYHandler::RuleRecConstRef rule // handler rule );
[ public ] SFCError RegisterHandler( SFXEventRangeConstRef range // event range SFYHandler::HandlerSPP spp // handler function VoidPtr reference // reference value );
[ public ] SFCError RegisterHandler( SFXEventRangeConstPtr range // array of event range SFYHandler::RuleRecConstPtr rule // array of handler rule SInt32 length // number of the elements of the array );
[ public ] SFCError RegisterHandler( SFXEventRangeConstPtr range // array of event range SFYHandler::HandlerSPPConstPtr spp // array of handler function VoidPtrConstPtr reference // array of reference value SInt32 length // number of the elements of the array );
represents the range of events which the handler will receive
represents the set of handler functions and reference values
This function registers specified handlers into this application[root(SFZRoot)].
Note | |
---|---|
For more details on the RegisterHandler() function, see the description of the SFYResponder::RegisterHandler function. |
SFYResponder::RegisterHandler | SFYApplication::UnregisterHandler | SFYApplication::ClearHandler | SFZRoot | Handler | Root(Basic)
[ public ] SFCError RegisterTracer( SFXEventRangeConstRef range // event range SFYTracer::RuleRecConstRef rule // tracer rule );
[ public ] SFCError RegisterTracer( SFXEventRangeConstRef range // event range SFYTracer::OrderEnum order // processing order SFYTracer::StateEnum state // distributing condition Bool overload // overloading condition );
[ public ] SFCError RegisterTracer( SFXEventRangeConstPtr range // array of event range SFYTracer::RuleRecConstPtr rule // array of tracer rule SInt32 length // number of the elements of the array );
[ public ] SFCError RegisterTracer( SFXEventRangeConstPtr range // array of event range SFYTracer::OrderEnumConstPtr order // array of processing order SFYTracer::StateEnumConstPtr state // array of distributing condition BoolConstPtr overload // array of overloading condition SInt32 length // number of the elements of the array );
represent the event range to which the tracer rules adjust
represents the set of processing order, distributing condition, and overloading condition
This function registers specified rules into the tracer of this application[root(SFZRoot)].
Note | |
---|---|
For more details on the RegisterTracer() function, see the description of the SFYResponder::RegisterTracer function. |
SFYResponder::RegisterTracer | SFYApplication::UnregisterTracer | SFYApplication::ClearTracer | SFZRoot | Root(Basic) | Tracer
This function boots up the renderer for redrawing this application[root(SFZRoot)] and its descendant responders.
Note | |
---|---|
For more details on the Render() function, see the description of the SFYResponder::Render function. |
[ public ] Void SetRealBound( SFXRectangleConstRef param // value to set );
This function sets the real region of this application[root(SFZRoot)] to the specified region.
Default: device screen region obtained by calling the SFXDevice::GetScreenSize function.
Note | |
---|---|
The real region of an application is is the visible region of the root, which is represented in the relative coordinate system with the left-top of the responder space as the origin (0, 0). In the SFYApplication::SFYApplication constructor, this region is by default set to the device screen region obtained by calling the SFXDevice::GetScreenSize function, which is the same with the responder space. In general, since this default setting is enough, there is no need to use the SFYApplication::SetRealBound function. For more details on the SetRealBound() function, see the description of the SFYResponder::SetRealBound function. * In the region outside the responder space, drawing will not be performed. |
SFYResponder::SetRealBound | SFYApplication::GetRealBound | SFYApplication::SetVirtualBound | SFYApplication::SFYApplication | SFXDevice::GetScreenSize | SFXRectangle | SFZRoot | Real Region | Responder Space | Root(Basic)
This function sets the flag indicating whether or not to terminate the renderer when an applet suspends.
Default: false
Note | |
---|---|
If you want to release resources such as the saved bimap to restore the device screen by terminating the renderer when an applets suspends, specify the param argument to true. In this case, the SFYRenderer::Terminate function will be called automatically when an applets receives the SFEVT_APP_RESUME event. After an applets resumes, the SFYRenderer::Initialize function will be called automatically and the renderer will be initialized when redrawing is performed by calling the SFYResponder::Render function. For more details, refer to the internal implementaion of the SFYApplication::HandleEvent function. |
SFYApplication::IsRendererIntermissive | SFYApplication::HandleEvent | SFYResponder::Render | SFYRenderer::Initialize | SFYRenderer::Terminate | SFYRenderer | Renderer
[ public ] Void SetVirtualBound( SFXRectangleConstRef param // value to set );
This function sets the virtual region of this application[root(SFZRoot)] to the specified region.
Note | |
---|---|
The virtual region of an application is is that of the root. This region is by default set to the device screen region obtained by calling the SFXDevice::GetScreenSize function, which is the same with the real region of the root. In general, since this default setting is enough, there is no need to use the SFYApplication::SetVirtualBound function. For more details on the SetVirtualBound() function, see the description of the SFYResponder::SetVirtualBound function. |
SFYResponder::SetVirtualBound | SFYApplication::GetVirtualBound | SFYApplication::SetRealBound | SFXDevice::GetScreenSize | SFXRectangle | SFZRoot | Virtual Region | Real Region | Root(Basic)
[ public ] Void UnregisterHandler( SFXEventRangeConstRef range // event range SFYHandler::RuleRecConstRef rule // handler rule );
[ public ] Void UnregisterHandler( SFXEventRangeConstRef range // event range SFYHandler::HandlerSPP spp // handler function VoidPtr reference // reference value );
[ public ] Void UnregisterHandler( SFXEventRangeConstPtr range // array of event range SFYHandler::RuleRecConstPtr rule // array of handler rule SInt32 length // number of the elements of the array );
[ public ] Void UnregisterHandler( SFXEventRangeConstPtr range // array of event range SFYHandler::HandlerSPPConstPtr spp // array of handler function VoidPtrConstPtr reference // array of reference value SInt32 length // number of the elements of the array );
represents the range of events which the handler will receive
represents the set of handler functions and reference values
This function unregisters the handler registered into this application[root(SFZRoot)] which matches the specified condition.
Note | |
---|---|
For more details on the UnregisterHandler() function, see the description of the SFYResponder::UnregisterHandler function. |
SFYResponder::UnregisterHandler | SFYApplication::RegisterHandler | SFYApplication::ClearHandler | SFZRoot | Handler | Root(Basic)
[ public ] Void UnregisterTracer( SFXEventRangeConstRef range // event range );
[ public ] Void UnregisterTracer( SFXEventRangeConstPtr range // array of event range SInt32 length // number of the elements of the array );
represent the event range to which the tracer rules adjust
This function unregisters specified rules registered into the tracer of this application[root(SFZRoot)].
Note | |
---|---|
For more details on the UnregisterTracer() function, see the description of the SFYResponder::UnregisterTracer function. |
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |