PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFYBoxControl
Abstract base class of a responder which represents a box control.
#include <SFYBoxControl.h.hpp>
class SFYBoxControl : public SFYControl;
SFMTYPEDEFCLASS(SFYBoxControl)

Inheritance diagram

 Inheritance diagram of SFYBoxControlClass

Collaboration diagram

 Collaboration diagram of SFYBoxControlClass

Description

How to use

SFYBoxControl is the abstract base class to define and implement a user-defined box control.

In SFYBoxControl, functions to draw the box and manage the operation key are implemented by default. Several handlers with default behaviour are also implemented as virtual functions.

The operation key is set with the SFYBoxControl::SetOperateKey function. By default, the operation key is set to the SELECT key.

Structure of the box control

  1. Outer frame drawn in the bevel color to make the box control 3D looking.
  2. Middle frame("frame") reduced from the outer frame by 1 pixel each from the top, bottom, left, and right edges.
  3. Inner frame("focus frame") reduced from the middle frame by 1 pixel each from the top, bottom, left, and right edges. [drawn only in the "focus" state]
  4. Content region surrounded by the inner frame("focus frame").

In the default implementation, the box control is drawn as below depending on its state.

Figure 271. Expanded figure of the box control in the "active" or "enable" state


Expanded figure of the box control in the "active" or "enable" state

The outer frame is drawn in the bevel color(SFXBevelColor) set with the SFYBoxControl::SetBevelColor function.

The middle frame("frame") is drawn in the color (SFXRGBColor) set with the SFYBoxControl::SetFrameColor function.

The inner frame("focus frame") is drawn in the color set with the SFYWidget::SetBackgroundColor function(same with that of the content region).

The content region is filled in the color set with the SFYWidget::SetBackgroundColor function.

Figure 272. Expanded figure of the box control in the "inactive" state


Expanded figure of the box control in the "inactive" state

The outer frame is drawn in the bevel color(SFXBevelColor) which is calculated for the the "inactive" state using the bevel color set with the SFYBoxControl::SetBevelColor function.

The middle frame("frame") is drawn in the color(SFXRGBColor) which is calculated for the "inactive" state using the color set with the SFYBoxControl::SetFrameColor function.

In the "inactive" state, the outer frame is drawn only in the base color of bevel color set with the SFYBoxControl::SetBevelColor function. As a result, it looks 2 dimensional.

The inner frame("focus frame") is drawn in the color set with the SFYWidget::SetBackgroundColor function(same with that of the content region).

The content region is filled in the color set with the SFYWidget::SetBackgroundColor function.

Figure 273. Expanded figure of the box control in the "focus" state


Expanded figure of the box control in the "focus" state

The outer frame is drawn in the bevel color which is calculated for the the "focus" state using the bevel color set with the SFYBoxControl::SetBevelColor function.

The middle frame("frame") is drawn in the color which is calculated for the "focus" state using the color set with the SFYBoxControl::SetFocusColor function.

The inner frame("focus frame") is drawn in the color set with the SFYBoxControl::SetFocusColor function.

The content region is filled in the color set with the SFYWidget::SetBackgroundColor function.

[Caution] Color of the frame in the "focus" state

In the focused state, the middle frame("frame") is drawn in the color which is calculated using the brightness of color set with the SFYBoxControl::SetFocusColor function. Therefore, it will not be drawn in the color set with the SFYBoxControl::SetFrameColor function.

Events and their handlers

In SFYBoxControl, the following handlers(virtual functions) are registered for the key event[SFEVT_KEY] on the operation key, the region event[SFEVT_RESPONDER_BOUND], and the drawing event[SFEVT_RESPONDER_RENDER].

In a box control inheriting from SFYBoxControl, the following handlers(virtual functions) are booted up first.

Table 201. Events and their Handlers

Event Handler(Virtual function) Default behaviour Override
SFEVT_KEY event of the operation key set with SFYBoxControl::SetOperateKey SFYBoxControl::HandleOperateKey Send the result event *1 Optional
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_REQUEST) event SFYWidget::HandleBoundRequest - Recommended
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_OPTIMIZE) event SFYWidget::HandleBoundOptimize - Recommended
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_REAL) event SFYControl::HandleBoundReal Equalize the virtual region with the real region*2 Optional
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_VIRTUAL) event SFYWidget::HandleBoundVirtual - Optional
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_GLOBAL) event SFYWidget::HandleBoundGlobal - Optional
(SFEVT_RESPONDER_RENDER, SFP16_RENDER_REQUEST) event SFYWidget::HandleRenderRequest - Optional

* "-" in the default behaviour column represents that nothing is implemented.

[Note] NOTE

*1. Execute SFYResponder::InvokeForward(SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, GetCurrentValue()), false).

*2. Execute SFYResponder::SetVirtualBound(SFXRectangle(SFXGrid::ZeroInstance(), GetRealBound().GetSize())). In other words, equalize the virtual region with the real region.

The code to make a user-defined box control is as follows:

Example 856. Declaration

SFMTYPEDEFRESPONDER(USRBoxControl)
class USRBoxControl: public SFYBoxControl {
    SFMSEALRESPONDER(USRBoxControl)
    SFMRESPONDERINSTANTIATEFOUR(USRBoxControl, SFYBoxControl, SFYControl, SFYWidget, SFYResponder)
public:

    // define responder type
    // small alphabet and symbol must not be used since they are reserved for SophiaFramework UNIVERSE
    enum CodeEnum {
        CODE_TYPE = four_char_code('U', 'B', 'O', 'X')
    };
    SFMTYPEDEFTYPE(CodeEnum)

public:
    static USRBoxControlSmp NewInstance(SFCErrorPtr exception = null);
protected:
    explicit USRBoxControl(Void) static_throws;
    virtual ~USRBoxControl(Void);

    // virtual functions defined in the parent class and recommended to be implemented
    virtual Void HandleBoundRequest(SFXRectanglePtr rectangle) const;
    virtual Void HandleBoundOptimize(SFXRectanglePtr rectangle) const;
    virtual Void HandleBoundVirtual(Void);
    virtual Void HandleRenderRequest(SFXGraphicsPtr graphics) const;
};

Example 857. Implementation

USRBoxControl::USRBoxControl(Void) static_throws
{
    if (static_try()) {

        // set the responder type
 SetType(CODE_TYPE);

        // here describe the initialization
    }
}

USRBoxControl::~USRBoxControl(Void)
{
    // here describe the finalization
}

USRBoxControlSmp USRBoxControl::NewInstance(SFCErrorPtr exception)
{
    return static_pointer_cast<USRBoxControl>(Factory(::new USRBoxControl, exception));
}

Void USRBoxControl::HandleBoundRequest(SFXRectanglePtr rectangle) const
{
    // in case of using function of SFYBoxControl class to draw box [i.e., SFYBoxControl::DrawBox()],
    // deflate rectangle by size of box
    rectangle->Deflate(GetBoxMargin());

    // calculate the suitable box size
    // set the rectangle argument to the calculated suitable box size
    // for the rectangle argument, it is recommended to set only its size and not to change its origin in this function

    // in case of using function of SFYBoxControl class to draw box [i.e., SFYBoxControl::DrawBox()],
    // inflate rectangle by size of box
    rectangle->Inflate(GetBoxMargin());

    return;
}

Void USRBoxControl::HandleBoundOptimize(SFXRectanglePtr rectangle) const
{
    // in case of using function of SFYBoxControl class to draw box [i.e., SFYBoxControl::DrawBox()],
    // deflate rectangle by size of box
    rectangle->Deflate(GetBoxMargin());

    // calculate the suitable box size within rectangular region given by the rectangle argument
    // set the rectangle argument to the calculated suitable box size
    // for the rectangle argument, it is recommended to set only its size and not to change its origin in this function

    // in case of using function of SFYBoxControl class to draw box [i.e., SFYBoxControl::DrawBox()],
    // inflate rectangle by size of box
    rectangle->Inflate(GetBoxMargin());

    return;
}

Void USRBoxControl::HandleBoundVirtual(Void)
{
    // here describe the size recalculation if necessary when the virtual region is changed
    return;
}

Void USRBoxControl::HandleRenderRequest(SFXGraphicsPtr graphics) const
{
    // in case of using function of SFYBoxControl class to draw box [i.e., SFYBoxControl::DrawBox()],
    // draw box as below
    DrawBox(graphics, GetLocalBound());

    // draw inside box

    return;
}

Reference

Abstract Class that Represents a Box Control[SFYBoxControl] | State | SFYControl | SFZSingleTextBoxControl | SFZSingleEditBoxControl | SFZMultipleTextBoxControl | SFZMultipleEditBoxControl | SFZImageBoxControl | Key Event[SFEVT_KEY] | Region Event[SFEVT_RESPONDER_BOUND] | Drawing Event[SFEVT_RESPONDER_RENDER]

Member

Constructor/Destructor
SFYBoxControl( Void )
Constructor of the SFYBoxControl class.
~SFYBoxControl( Void )
Destructor of the SFYBoxControl class.
Public Functions
SFXBevelColorConstRef GetBevelColor( Void )
Get the bevel color of the outer frame of this box control.
SFXRGBColorConstRef GetFocusColor( Void )
Get the color of the inner frame region of this box control in the "focus" state.
SFXRGBColorConstRef GetFrameColor( Void )
Get the color of the middle frame of this box control.
AVKType GetOperateKey( Void )
Get the operation key of the box control.
Void SetBevelColor( SFXBevelColorConstRef param )
Set the bevel color of the outer frame of this box control to the specified value.
Void SetFocusColor( SFXRGBColorConstRef param )
Set the color of the inner frame region of this box control in the "focus" state to the specified value.
Void SetFrameColor( SFXRGBColorConstRef param )
Set the color of the middle frame of this box control to the specified value.
Void SetOperateKey( AVKType param )
Set the operation key of this box control to the specified value.
Void ClearHandler( Void ) (inherits from SFYResponder)
Unregister all handlers from this responder.
Void ClearTracer( Void ) (inherits from SFYResponder)
Unregister all dispatching rules from the tracer of this responder.
SFCError Distribute( SFXEventConstRef event , BoolPtr result = null ) (inherits from SFYResponder)
Distribute the specified event.
SFXRGBColorConstRef GetBackgroundColor( Void ) (inherits from SFYWidget)
Get the background color.
SFYResponderSmp GetChildBack( Void ) (inherits from SFYResponder)
Get the backmost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildBack( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the backmost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildBack( UInt32 id ) (inherits from SFYResponder)
Get the backmost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildBack( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the backmost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildBackward( SInt32 index ) (inherits from SFYResponder)
Get the child responder of this responder 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 ) (inherits from SFYResponder)
Get the child responder of this responder at the specified position from the back side, which matches the specified search condition.
SFYResponderSmp GetChildBackward( SInt32 index , UInt32 id ) (inherits from SFYResponder)
Get the child responder of this responder 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 ) (inherits from SFYResponder)
Get the child responder of this responder at the specified position from the back side, which matches the specified search condition.
SInt32 GetChildCount( Void ) (inherits from SFYResponder)
Get the number of child responders of this responder, which match the specified search condition.
SInt32 GetChildCount( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the number of child responders of this responder, which match the specified search condition.
SInt32 GetChildCount( UInt32 id ) (inherits from SFYResponder)
Get the number of child responders of this responder, which match the specified search condition.
SInt32 GetChildCount( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the number of child responders of this responder, which match the specified search condition.
SFYResponderSmp GetChildForward( SInt32 index ) (inherits from SFYResponder)
Get the child responder of this responder 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 ) (inherits from SFYResponder)
Get the child responder of this responder at the specified position from the front side, which matches the specified search condition.
SFYResponderSmp GetChildForward( SInt32 index , UInt32 id ) (inherits from SFYResponder)
Get the child responder of this responder 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 ) (inherits from SFYResponder)
Get the child responder of this responder at the specified position from the front side, which matches the specified search condition.
SFYResponderSmp GetChildFront( Void ) (inherits from SFYResponder)
Get the foremost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildFront( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the foremost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildFront( UInt32 id ) (inherits from SFYResponder)
Get the foremost child responder of this responder, which matches the specified search condition.
SFYResponderSmp GetChildFront( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the foremost child responder of this responder, which matches the specified search condition.
SInt32 GetCurrentValue( Void ) (inherits from SFYControl)
Get the current value of this control.
SFYDistributerPtr GetDistributer( Void ) (inherits from SFYResponder)
Get the distributer bound with this responder.
SFYResponderSmp GetFrame( Void ) (inherits from SFYResponder)
Get the frame which has been attached to this responder.
SFXRectangle GetGlobalBound( Void ) (inherits from SFYResponder)
Get the globle region of this responder.
UInt32 GetID( Void ) (inherits from SFYResponder)
Get the ID of this responder instance.
SFXRectangle GetLocalBound( Void ) (inherits from SFYResponder)
Get the local region of this responder.
SInt32 GetMaximumValue( Void ) (inherits from SFYControl)
Get the maximum value of this control.
SInt32 GetMinimumValue( Void ) (inherits from SFYControl)
Get the minimum value of this control.
SInt32 GetNthBackward( Void ) (inherits from SFYResponder)
Get the position counted from the back side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthBackward( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the position counted from the back side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthBackward( UInt32 id ) (inherits from SFYResponder)
Get the position counted from the back side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthBackward( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the position counted from the back side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthForward( Void ) (inherits from SFYResponder)
Get the position counted from the front side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthForward( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the position counted from the front side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthForward( UInt32 id ) (inherits from SFYResponder)
Get the position counted from the front side of this responder among a group of sibling responders, which match the specified search condition.
SInt32 GetNthForward( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Get the position counted from the front side of this responder among a group of sibling responders, which match the specified search condition.
SFYResponderSmp GetParent( Void ) (inherits from SFYResponder)
Get the parent responder of this responder.
Bool GetPropertyTransparent( Void ) (inherits from SFYResponder)
Get the transparency attribute of this responder.
SFXRectangleConstRef GetRealBound( Void ) (inherits from SFYResponder)
Get the real region of this responder.
VoidPtr GetReference( Void ) (inherits from SFYResponder)
Get the reference of this responder.
SFYRendererPtr GetRenderer( Void ) (inherits from SFYResponder)
Get the renderer bound with this responder.
SFYResponderSmp GetRoot( Void ) (inherits from SFYResponder)
Get the root responder.
Bool GetStateActive( Bool inherit = false ) (inherits from SFYResponder)
Get the active state of this responder.
Bool GetStateEnable( Bool inherit = false ) (inherits from SFYResponder)
Get the enable state of this responder.
Bool GetStateFocus( Bool inherit = false ) (inherits from SFYResponder)
Get the focus state of this responder.
Bool GetStateValid( Bool inherit = false ) (inherits from SFYResponder)
Get the valid state of this responder.
Bool GetStateVisible( Bool inherit = false ) (inherits from SFYResponder)
Get the visible state of this responder.
SFXRectangle GetSuitableBound( Void ) (inherits from SFYResponder)
Get the suitable region of this responder.
SFXRectangle GetSuitableBound( SFXRectangleConstRef rectangle ) (inherits from SFYResponder)
Get the suitable region of this responder.
SFXRectangle GetSuitableBound( SFXRectangleConstRef param , HorizontalEnum horizontal , VerticalEnum vertical ) (inherits from SFYResponder)
Get the suitable region of this responder.
SFXMargin GetSuitableMargin( Void ) (inherits from SFYResponder)
Get the suitable frame margin region of this responder.
SFCType GetType( Void ) (inherits from SFYResponder)
Get the type of this responder class.
SFXRectangleConstRef GetVirtualBound( Void ) (inherits from SFYResponder)
Get the virtual region of this responder.
Bool HasFrame( Void ) (inherits from SFYResponder)
Check whether or not this responder is a content-responder.
Void Initialize( Void ) (inherits from SFYResponder)
Initialize this responder.
Bool IsBack( Void ) (inherits from SFYResponder)
Check whether or not this responder is the backmost responder among a group of the sibling responders which match the specified search condition.
Bool IsBack( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is the backmost responder among a group of the sibling responders which match the specified search condition.
Bool IsBack( UInt32 id ) (inherits from SFYResponder)
Check whether or not this responder is the backmost responder among a group of the sibling responders which match the specified search condition.
Bool IsBack( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is the backmost responder among a group of the sibling responders which match the specified search condition.
Bool IsFrame( Void ) (inherits from SFYResponder)
Check whether or not this responder is an attachment-frame.
Bool IsFront( Void ) (inherits from SFYResponder)
Check whether or not this responder is the foremost responder among a group of the sibling responders which match the specified search condition.
Bool IsFront( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is the foremost responder among a group of the sibling responders which match the specified search condition.
Bool IsFront( UInt32 id ) (inherits from SFYResponder)
Check whether or not this responder is the foremost responder among a group of the sibling responders which match the specified search condition.
Bool IsFront( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is the foremost responder among a group of the sibling responders which match the specified search condition.
Bool IsNthBackward( SInt32 index ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the back side among a group of the sibling responders which match the specified search condition.
Bool IsNthBackward( SInt32 index , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the back side among a group of the sibling responders which match the specified search condition.
Bool IsNthBackward( SInt32 index , UInt32 id ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the back side among a group of the sibling responders which match the specified search condition.
Bool IsNthBackward( SInt32 index , UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the back side among a group of the sibling responders which match the specified search condition.
Bool IsNthForward( SInt32 index ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the front side among a group of the sibling responders which match the specified search condition.
Bool IsNthForward( SInt32 index , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the front side among a group of the sibling responders which match the specified search condition.
Bool IsNthForward( SInt32 index , UInt32 id ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the front side among a group of the sibling responders which match the specified search condition.
Bool IsNthForward( SInt32 index , UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Check whether or not this responder is at the specified position from the front side among a group of the sibling responders which match the specified search condition.
Bool IsRoot( Void ) (inherits from SFYResponder)
Check whether or not this responder is the root responder.
SFCError Recover( Void ) (inherits from SFYResponder)
Recover the intersection region between this responder and the responder space by using the saved bitmap to restore the device bitmap.
SFCError RegisterHandler( SFXEventRangeConstRef range , SFYHandler::RuleRecConstRef rule ) (inherits from SFYResponder)
Register specified handlers into this responder.
SFCError RegisterHandler( SFXEventRangeConstRef range , SFYHandler::HandlerSPP spp , VoidPtr reference ) (inherits from SFYResponder)
Register specified handlers into this responder.
SFCError RegisterHandler( SFXEventRangeConstPtr range , SFYHandler::RuleRecConstPtr rule , SInt32 length ) (inherits from SFYResponder)
Register specified handlers into this responder.
SFCError RegisterHandler( SFXEventRangeConstPtr range , SFYHandler::HandlerSPPConstPtr spp , VoidPtrConstPtr reference , SInt32 length ) (inherits from SFYResponder)
Register specified handlers into this responder.
SFCError RegisterTracer( SFXEventRangeConstRef range , SFYTracer::RuleRecConstRef rule ) (inherits from SFYResponder)
Register specified dispatching rules into the tracer of this responder.
SFCError RegisterTracer( SFXEventRangeConstRef range , SFYTracer::OrderEnum order , SFYTracer::StateEnum state , Bool overload ) (inherits from SFYResponder)
Register specified dispatching rules into the tracer of this responder.
SFCError RegisterTracer( SFXEventRangeConstPtr range , SFYTracer::RuleRecConstPtr rule , SInt32 length ) (inherits from SFYResponder)
Register specified dispatching rules into the tracer of this responder.
SFCError RegisterTracer( SFXEventRangeConstPtr range , SFYTracer::OrderEnumConstPtr order , SFYTracer::StateEnumConstPtr state , BoolConstPtr overload , SInt32 length ) (inherits from SFYResponder)
Register specified dispatching rules into the tracer of this responder.
SFCError Render( Bool force = false ) (inherits from SFYResponder)
Boot up the renderer for redrawing this responder and its descendant responders.
Void SetBackgroundColor( SFXRGBColorConstRef param ) (inherits from SFYWidget)
Set the background color to the specified value.
Void SetCurrentValue( SInt32 param ) (inherits from SFYControl)
Set the current value of this control to the specified value.
Void SetDistributer( SFYDistributerPtr param ) (inherits from SFYResponder)
Bind this responder with the specified distributer.
SFCError SetFrame( SFYResponderSmpConstRef param ) (inherits from SFYResponder)
Attach the specified frame to this frame.
Void SetID( UInt32 param ) (inherits from SFYResponder)
Set the ID value of this responder to the specified value.
Void SetMaximumValue( SInt32 param ) (inherits from SFYControl)
Set the maximum value of the control to the specified value.
Void SetMinimumValue( SInt32 param ) (inherits from SFYControl)
Set the minimum value of the control to the specified value.
SFCError SetParent( SFYResponderSmpConstRef param ) (inherits from SFYResponder)
Set the parent responder of this responder to the specified responder.
Void SetProperty( Bool transparent ) (inherits from SFYResponder)
Set the property of this responder to the specified value.
Void SetPropertyTransparent( Bool param ) (inherits from SFYResponder)
Set the transparency attribute of this responder to the specified value.
Void SetRealBound( SFXRectangleConstRef param ) (inherits from SFYResponder)
Set the real region of this responder to the specified region.
Void SetReference( VoidPtr param ) (inherits from SFYResponder)
Set the reference value of this responder to the specified value.
Void SetRenderer( SFYRendererPtr param ) (inherits from SFYResponder)
Bind this responder with the specified renderer.
Void SetState( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Set all states of this responder to specified values together.
Void SetStateActive( Bool param ) (inherits from SFYResponder)
Set the active state of this responder to the specified value.
Void SetStateEnable( Bool param ) (inherits from SFYResponder)
Set the enable state of this responder to the specified value.
Void SetStateFocus( Bool param ) (inherits from SFYResponder)
Set the focus state of this responder to the specified value.
Void SetStateVisible( Bool param ) (inherits from SFYResponder)
Set the visible state of this responder to the specified value.
Void SetVirtualBound( SFXRectangleConstRef param ) (inherits from SFYResponder)
Set the virtual region of this responder to the specified value.
SFCError Snapshot( SFBBitmapSmpConstRef bitmap ) (inherits from SFYResponder)
Get a snapshot image of the intersection region between this responder and the responder space by using the saved bitmap.
Void Terminate( Void ) (inherits from SFYResponder)
Terminate this responder.
Void ToBack( Void ) (inherits from SFYResponder)
Move this responder to the backmost position among a group of the sibling responders which match the specified search condition.
Void ToBack( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the backmost position among a group of the sibling responders which match the specified search condition.
Void ToBack( UInt32 id ) (inherits from SFYResponder)
Move this responder to the backmost position among a group of the sibling responders which match the specified search condition.
Void ToBack( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the backmost position among a group of the sibling responders which match the specified search condition.
Void ToFront( Void ) (inherits from SFYResponder)
Move this responder to the foremost position among a group of the sibling responders which match the specified search condition.
Void ToFront( Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the foremost position among a group of the sibling responders which match the specified search condition.
Void ToFront( UInt32 id ) (inherits from SFYResponder)
Move this responder to the foremost position among a group of the sibling responders which match the specified search condition.
Void ToFront( UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the foremost position among a group of the sibling responders which match the specified search condition.
Void ToNthBackward( SInt32 index ) (inherits from SFYResponder)
Move this responder to the specified position from the back side among a group of the sibling responders which match the specified search condition.
Void ToNthBackward( SInt32 index , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the specified position from the back side among a group of the sibling responders which match the specified search condition.
Void ToNthBackward( SInt32 index , UInt32 id ) (inherits from SFYResponder)
Move this responder to the specified position from the back side among a group of the sibling responders which match the specified search condition.
Void ToNthBackward( SInt32 index , UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the specified position from the back side among a group of the sibling responders which match the specified search condition.
Void ToNthForward( SInt32 index ) (inherits from SFYResponder)
Move this responder to the specified position from the front side among a group of the sibling responders which match the specified search condition.
Void ToNthForward( SInt32 index , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the specified position from the front side among a group of the sibling responders which match the specified search condition.
Void ToNthForward( SInt32 index , UInt32 id ) (inherits from SFYResponder)
Move this responder to the specified position from the front side among a group of the sibling responders which match the specified search condition.
Void ToNthForward( SInt32 index , UInt32 id , Bool visible , Bool active , Bool enable , Bool focus ) (inherits from SFYResponder)
Move this responder to the specified position from the front side among a group of the sibling responders which match the specified search condition.
Void UnregisterHandler( SFXEventRangeConstRef range , SFYHandler::RuleRecConstRef rule ) (inherits from SFYResponder)
Unregister the handler from this responder which matches the specified condition.
Void UnregisterHandler( SFXEventRangeConstRef range , SFYHandler::HandlerSPP spp , VoidPtr reference ) (inherits from SFYResponder)
Unregister the handler from this responder which matches the specified condition.
Void UnregisterHandler( SFXEventRangeConstPtr range , SFYHandler::RuleRecConstPtr rule , SInt32 length ) (inherits from SFYResponder)
Unregister the handler from this responder which matches the specified condition.
Void UnregisterHandler( SFXEventRangeConstPtr range , SFYHandler::HandlerSPPConstPtr spp , VoidPtrConstPtr reference , SInt32 length ) (inherits from SFYResponder)
Unregister the handler from this responder which matches the specified condition.
Void UnregisterTracer( SFXEventRangeConstRef range ) (inherits from SFYResponder)
Unregister the dispatching rule from the tracer of this responder which matches the specified condition.
Void UnregisterTracer( SFXEventRangeConstPtr range , SInt32 length ) (inherits from SFYResponder)
Unregister the dispatching rule from the tracer of this responder which matches the specified condition.
T const & static_catch( Void ) (inherits from static_exception)
Get the current exception.
Protected Functions
Void DrawBox( SFXGraphicsPtr graphics , SFXRectangleConstRef rectangle )
Draw this box control.
static
SFXMarginConstRef
GetBoxMargin( Void )
Get the margin region of this box control.
Void HandleOperateKey( Void )
This function will be called when the SFEVT_KEY event of the operation key is received.
static
SFYResponderSmp
Factory( SFYResponderPtr responder , SFCErrorPtr exception = null ) (inherits from SFYResponder)
This function is used to implement the NewInstance function.
SFYResponderSmp GetThis( Void ) (inherits from SFYResponder)
Get the smart pointer of this responder.
Void HandleBoundGlobal( SFXRectangleConstRef rectangle ) (inherits from SFYWidget)
This function will be called when the global region is changed.
Void HandleBoundOptimize( SFXRectanglePtr rectangle ) (inherits from SFYWidget)
This function will be called when the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_OPTIMIZE) event is received. [Calculate the suitable rectangle size of this responder within the specified hint rectangle.]
Void HandleBoundReal( Void ) (inherits from SFYControl)
This function will be called when the real region is changed.
Void HandleBoundRequest( SFXRectanglePtr rectangle ) (inherits from SFYWidget)
This function will be called when the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_REQUEST) event is received. [Calculate the suitable rectangle size of this responder.]
Void HandleBoundVirtual( Void ) (inherits from SFYWidget)
This function will be called when the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_VIRTUAL) event is received. [Perform the processing when the virtual region is changed.]
Void HandleRenderRequest( SFXGraphicsPtr graphics ) (inherits from SFYWidget)
This function will be called when the (SFEVT_RESPONDER_RENDER, SFP16_RENDER_REQUEST) event is received. [Draw this responder.]
Void Invalidate( Void ) (inherits from SFYResponder)
Register the specified redraw region of this responder.
Void Invalidate( SFXRectangleConstRef param ) (inherits from SFYResponder)
Register the specified redraw region of this responder.
Void InvokeBackward( SFXEventConstRef event , Bool overload , BoolPtr result = null ) (inherits from SFYResponder)
Call the handlers for the specified event from the end of the handler list registered into this responder.
Void InvokeForward( SFXEventConstRef event , Bool overload , BoolPtr result = null ) (inherits from SFYResponder)
Call the handlers for the specified event from the head of the handler list registered into this responder.
Void SetType( SFCType param ) (inherits from SFYResponder)
Set the Type value of this responder to the specified 4-character value.
Void static_throw( static_exception< T > const & param ) (inherits from static_exception)
Set an exception.
Void static_throw( T const & param ) (inherits from static_exception)
Set an exception.
Bool static_try( Void ) (inherits from static_exception)
Confirm whether or not the exception is retained.
Types
CodeEnum
Constant that represents the SFYBoxControl class.
HorizontalEnum (inherits from SFYResponder)
Constants that represent the horizontal alignment.
VerticalEnum (inherits from SFYResponder)
Constants that represent the vertical alignment.

SFYBoxControl::SFYBoxControl
Constructor of the SFYBoxControl class.
[ protected, explicit ]
SFYBoxControl(Void);

Description

This constructor performs the initializations as follows:

  1. Set the type of this responder to ".box".
  2. Set the color of the inner frame region of this box control in the "focus" state to SFXRGBColor(0xAA, 0xAA, 0xAA, 0x00)[gray color].
  3. Set the color of the middle frame of this box control to SFXRGBColor(0x00, 0x00, 0x00, 0x00)[black color].
  4. Set the bevel color of the outer frame of this box control to SFXBevelColor(SFXRGBColor(0x99, 0x99, 0x99, 0x00), SFXRGBColor(0xEE, 0xEE, 0xEE, 0x00), SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00)).
  5. Set the operation key of this box to AVK_SELECT.
  6. Register the event handler in the table below into this responder.

Table 202. Event handler

Event Content of the handler
SFEVT_KEY event of the operation key set with SFYBoxControl::SetOperateKey Call the SFYBoxControl::HandleOperateKey function.
[Note] Note
In a responder inheriting from SFYBoxControl, the corresponding handler will be called when one of the above events occurs.

Reference

SFYResponder::SetType | SFYBoxControl::CodeEnum | SFYBoxControl::SetFocusColor | SFYBoxControl::SetFrameColor | SFYBoxControl::SetBevelColor | SFYBoxControl::HandleOperateKey | SFXEvent | SFXBevelColor | SFXRGBColor | Type | Event | Key Event[SFEVT_KEY]


SFYBoxControl::~SFYBoxControl
Destructor of the SFYBoxControl class.
[ protected, virtual ]
virtual ~SFYBoxControl(Void);

Description

This destructor does nothing.


SFYBoxControl::DrawBox
Draw this box control.
[ protected, const ]
Void DrawBox(
    SFXGraphicsPtr graphics          // graphics object
    SFXRectangleConstRef rectangle   // drawing region
);

Description

This function draws this box control in case you want to perform your own drawing.

In case you want to perform your own processing, override this function.

[Tip] Tip
This function will be called in the HandleRender() function of the concrete class inheriting from SFYBoxControl.

The default implementation is as follows:

In the default implementation, this box control is drawn as below depending on its state.

Structure of the box control

  1. Outer frame drawn in the bevel color to make the box control 3D looking.
  2. Middle frame("frame") reduced from the outer frame by 1 pixel each from the top, bottom, left, and right edges.
  3. Inner frame("focus frame") reduced from the middle frame by 1 pixel each from the top, bottom, left, and right edges. [drawn only in the "focus" state]
  4. Content region surrounded by the inner frame("focus frame").

Figure 274. Expanded figure of the box control in the "active" or "enable" state


Expanded figure of the box control in the "active" or "enable" state

The outer frame is drawn in the bevel color(SFXBevelColor) set with the SFYBoxControl::SetBevelColor function.

The middle frame("frame") is drawn in the color (SFXRGBColor) set with the SFYBoxControl::SetFrameColor function.

The inner frame("focus frame") is drawn in the color set with the SFYWidget::SetBackgroundColor function(same with that of the content region).

The content region is filled in the color set with the SFYWidget::SetBackgroundColor function.

Figure 275. Expanded figure of the box control in the "inactive" state


Expanded figure of the box control in the "inactive" state

The outer frame is drawn in the bevel color(SFXBevelColor) which is calculated for the the "inactive" state using the bevel color set with the SFYBoxControl::SetBevelColor function.

The middle frame("frame") is drawn in the color(SFXRGBColor) which is calculated for the "inactive" state using the color set with the SFYBoxControl::SetFrameColor function.

In the "inactive" state, the outer frame is drawn only in the base color of bevel color set with the SFYBoxControl::SetBevelColor function. As a result, it looks 2 dimensional.

The inner frame("focus frame") is drawn in the color set with the SFYWidget::SetBackgroundColor function(same with that of the content region).

The content region is filled in the color set with the SFYWidget::SetBackgroundColor function.

Figure 276. Expanded figure of the box control in the "focus" state


Expanded figure of the box control in the "focus" state

The outer frame is drawn in the bevel color which is calculated for the the "focus" state using the bevel color set with the SFYBoxControl::SetBevelColor function.

The middle frame("frame") is drawn in the color which is calculated for the "focus" state using the color set with the SFYBoxControl::SetFocusColor function.

The inner frame("focus frame") is drawn in the color set with the SFYBoxControl::SetFocusColor function.

The content region is filled in the color set with the SFYWidget::SetBackgroundColor function.

[Caution] Color of the frame in the "focus" state

In the focused state, the middle frame("frame") is drawn in the color which is calculated using the brightness of color set with the SFYBoxControl::SetFocusColor function. Therefore, it will not be drawn in the color set with the SFYBoxControl::SetFrameColor function.

Internal Implementation

Internal implementation of the SFYBoxControl::DrawBox function is as follows:

/*protected */Void SFYBoxControl::DrawBox(SFXGraphicsPtr graphics, SFXRectangleConstRef rectangle) const
{
    SFXRectangle                                lx;
    SFXBevelColor                               bevel;
    SFXRGBColor                                 rgb;

    lx.Set(rectangle);
    bevel.Set(_color.bevel);
    if (!GetStateActive(true)) {
        bevel.SetLight(bevel.GetBase());
        bevel.SetDark(bevel.GetBase());
    }
    graphics->DrawBevelRectangle(lx, bevel);
    lx.Deflate(1, 1);
    if (GetStateFocus(true)) {
        rgb.Set(_color.focus);
        if (GetStateActive(true)) {
            if (rgb.GetBrightness() > 0x7F) {
                rgb.SubRGB(0x55);
            }
            else {
                rgb.AddRGB(0x55);
            }
        }
        graphics->DrawRectangle(lx, rgb);
        lx.Deflate(1, 1);
        graphics->DrawRectangle(lx, _color.focus);
    }
    else {
        rgb.Set(_color.frame);
        if (!GetStateActive(true)) {
            if (rgb.GetBrightness() > 0x7F) {
                rgb.SubRGB(0x44);
            }
            else {
                rgb.AddRGB(0x44);
            }
        }
        graphics->DrawRectangle(lx, rgb);
        lx.Deflate(1, 1);
        graphics->DrawRectangle(lx, GetBackgroundColor());
    }
    lx.Deflate(1, 1);
    graphics->FillRectangle(lx, GetBackgroundColor());
    return;
}// SFYBoxControl::DrawBox //

Reference

SFYBoxControl::GetBoxMargin | SFYBoxControl::SetBevelColor | SFYBoxControl::SetFrameColor | SFYBoxControl::SetFocusColor | SFYWidget::SetBackgroundColor | SFXBevelColor | SFXRGBColor | State


SFYBoxControl::GetBevelColor
Get the bevel color of the outer frame of this box control.
[ public, const ]
SFXBevelColorConstRef GetBevelColor(Void);

Return value

Bevel color(SFXBevelColor) of outer frame of this box control.

Reference

SFYBoxControl::SetBevelColor | SFXBevelColor | SFXRGBColor


SFYBoxControl::GetBoxMargin
Get the margin region of this box control.
[ protected, static ]
SFXMarginConstRef GetBoxMargin(Void);

Return value

Margin region of this box control [SFXMargin(3, 3, 3, 3)].

Description

The margin region of the box control is the frame margin of 3 pixels width, which surrounds the content region where to draw a text or an image. Concretely, it is the margin region [left, top, right, and bottom edges of 3 pixels width, i.e., SFXMargin(3, 3, 3, 3)], which is the local region of the box control.

Figure 277. Frame region of the box control in the "focus" state: Expanded Figure


Frame region of the box control in the "focus" state: Expanded Figure

The margin region of the box control is the frame margin of 3 pixels width, which consists of the outer frame, the middle frame, and the inner frame.

The content region of the box control is the region which is surrounded by this frame region.

A text or an image is drawn in this content region.

For more details, refer to SFYBoxControl::DrawBox.

Reference

SFXMargin | SFYBoxControl::DrawBox | Local Region


SFYBoxControl::GetFocusColor
Get the color of the inner frame region of this box control in the "focus" state.
[ public, const ]
SFXRGBColorConstRef GetFocusColor(Void);

Return value

Color (SFXRGBColor) of inner frame region("focus frame") of this box control in the "focus" state.

Reference

SFYBoxControl::SetFocusColor


SFYBoxControl::GetFrameColor
Get the color of the middle frame of this box control.
[ public, const ]
SFXRGBColorConstRef GetFrameColor(Void);

Return value

Color(SFXRGBColor) of middle frame("frame") of this box control.

Reference

SFYBoxControl::SetFrameColor


SFYBoxControl::GetOperateKey
Get the operation key of the box control.
[ public, const ]
AVKType GetOperateKey(Void);

Return value

Operation key of the box control.

Reference

SFYBoxControl::SetOperateKey


SFYBoxControl::HandleOperateKey
This function will be called when the SFEVT_KEY event of the operation key is received.
[ protected, virtual ]
Void HandleOperateKey(Void);

Description

This function will be called when the SFEVT_KEY event(key event[SFEVT_KEY]) of the operaion key set with the SFYBoxControl::SetOperateKey function is received.

In case you want to perform your own processing, override this function.

The default implementation is to send the result event [SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, SFYControl::GetCurrentValue())] to itself.

Internal Implementation

Internal implementation of the SFYBoxControl::HandleOperateKey function is as follows:

/*protected virtual */Void SFYBoxControl::HandleOperateKey(Void)
{
    InvokeForward(SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, GetCurrentValue()), false);
    return;
}// SFYBoxControl::HandleOperateKey //

Reference

SFYBoxControl::SetOperateKey | SFYControl::GetCurrentValue | SFXEvent | Key Event[SFEVT_KEY] | Result Event[SFEVT_RESPONDER_RESULT]


SFYBoxControl::SetBevelColor
Set the bevel color of the outer frame of this box control to the specified value.
[ public ]
Void SetBevelColor(
    SFXBevelColorConstRef param   // value to set
);

Description

This function sets the bevel color (SFXBevelColor) to the specified value in which to draw the outer frame of this box control, which looks three dimensional.

Default: SFXBevelColor(SFXRGBColor(0x99, 0x99, 0x99, 0x00), SFXRGBColor(0xEE, 0xEE, 0xEE, 0x00), SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00))

For more details, refer to SFYBoxControl::DrawBox.

[Note] Outer frame of the box control in the "active", "enable", or "focus" state

The left edge and top edge are drawn in the light color of this bevel color, the right edge and bottom edge are drawn in the dark color, and the left-top vertex and right-bottom vertex is drawn in the base color. As a result, the looking of this box control is 3D.

[Note] Box control in the "inactive" state

The light color and the dark color is set to the base color of bevel color(SFXBevelColor). All the outer frame of the box control is drawn only in the base color. As a result, the looking of this box control is 2D.

Reference

SFYBoxControl::GetBevelColor | SFYBoxControl::DrawBox | SFYBoxControl::SetFocusColor SFYBoxControl::DrawBox | SFXBevelColor | SFXRGBColor | State


SFYBoxControl::SetFocusColor
Set the color of the inner frame region of this box control in the "focus" state to the specified value.
[ public ]
Void SetFocusColor(
    SFXRGBColorConstRef param   // value to set
);

Description

This function sets the color(SFXRGBColor) of inner frame region("focus frame") of this box control in the "focus" state to the specified value.

Default: SFXRGBColor(0xAA, 0xAA, 0xAA, 0x00)[gray color]

For more details, refer to SFYBoxControl::DrawBox.

[Caution] Color of the middle farme("frame") in the "focus" state

In the focused state, the middle frame("frame") is drawn in the color which is calculated using the brightness of color set with the SFYBoxControl::SetFocusColor function. Therefore, it will not be drawn in the color set with the SFYBoxControl::SetFrameColor function.

Concretely, it will be drawn in the inner frame's color of which each RGB value is subtracted 0x55 from the color set with this function if the brightness of color is greater than 0x7F. Otherwise it will be drawn in the color of which each RGB value is added 0x55 on the color set with this function.

The outer frame is drawn in the bevel color(SFXBevelColor) set with the SFYBoxControl::SetBevelColor function.

The color of inner frame is set with this function.

The brightness of color can be obtained by calling the SFXRGBColor::GetBrightness function.

Reference

SFYBoxControl::GetFocusColor | SFYBoxControl::DrawBox | SFYBoxControl::SetFrameColor | SFYBoxControl::SetBevelColor | SFXRGBColor::GetBrightness | SFXBevelColor | SFXRGBColor | State


SFYBoxControl::SetFrameColor
Set the color of the middle frame of this box control to the specified value.
[ public ]
Void SetFrameColor(
    SFXRGBColorConstRef param   // value to set
);

Description

This function sets the color(SFXRGBColor) of middle frame("frame") of this box control to the specified value.

Default: SFXRGBColor(0x00, 0x00, 0x00, 0x00)[black color]

For more details, refer to SFYBoxControl::DrawBox.

[Caution] Color of the middle farme("frame") in the "inactive" state

In the "inactive" state, the middle frame("frame") is drawn in the color which is calculated using the brightness of color set with the SFYBoxControl::SetFrameColor function.

Concretely, it will be drawn in the color of which each RGB value is subtracted 0x44 from the color set with this function if the brightness of color is greater than 0x7F. Otherwise it will be drawn in the color of which each RGB value is added 0x44 on the color set with this function.

The brightness of color can be obtained by calling the SFXRGBColor::GetBrightness function.

[Caution] Color of the middle farme("frame") in the "focus" state

In the focused state, the middle frame("frame") is drawn in the color which is calculated using the brightness of color set with the SFYBoxControl::SetFocusColor function. Therefore, it will not be drawn in the color set with the SFYBoxControl::SetFrameColor function.

Concretely, it will be drawn in the inner frame's color of which each RGB value is subtracted 0x55 from the color set with this function if the brightness of color is greater than 0x7F. Otherwise it will be drawn in the color of which each RGB value is added 0x55 on the color set with this function.

The outer frame is drawn in the bevel color(SFXBevelColor) set with the SFYBoxControl::SetBevelColor function.

The color of inner frame is set with this function.

The brightness of color can be obtained by calling the SFXRGBColor::GetBrightness function.

Reference

SFYBoxControl::GetFrameColor | SFYBoxControl::DrawBox | SFYBoxControl::SetFocusColor | SFYBoxControl::SetFrameColor | SFYBoxControl::DrawBox | SFXRGBColor::GetBrightness | SFXRGBColor | State


SFYBoxControl::SetOperateKey
Set the operation key of this box control to the specified value.
[ public ]
Void SetOperateKey(
    AVKType param   // key to set
);

Description

This function sets the operation key of this box control to the specified value.

The SFYBoxControl::HandleOperateKey function will be called when this key is pressed.

Default: AVK_SELECT

Reference

SFYBoxControl::GetOperateKey | SFYBoxControl::HandleOperateKey


SFYBoxControl::CodeEnum
Constant that represents the SFYBoxControl class.
enum CodeEnum {
    CODE_TYPE = four_char_code('.', 'b', 'o', 'x')
};
SFMTYPEDEFTYPE(CodeEnum)

Reference

SFYResponder::GetType | SFYResponder::SetType