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

Inheritance diagram

 Inheritance diagram of SFYButtonControlClass

Collaboration diagram

 Collaboration diagram of SFYButtonControlClass

Description

How to use

SFYButtonControl is the abstract base class to define and implement a user-defined button control.

In SFYButtonControl, functions to draw the button 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 SFYButtonControl::SetOperateKey function. By default, the operation key is set to the SELECT key.

Structure of the button control

  1. Bevel region of the 3D rectangle.
  2. Content region surrounded by the frame("focus frame") of 2 pixels width within the bevel region.
  3. Shadow region: the left edge and the top edge if the button control is pressed, or the right edge and the bottom edge if the button control is not pressed.

The button control consists of the bevel region, the content region, and the shadow region.

The content region is the one surrounded by the frame("focus frame") of 2 pixels width within the bevel region.

* In case of the radio button control, it consists of not rectangular but circular regions.

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

Figure 278. Expanded figure of the button control in the "active" or "enable" state


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

The bevel region is drawn in the bevel color(SFXBevelColor) set with the SFYButtonControl::SetButtonColor function. The shadow region is drawn in the color(SFXRGBColor) set with the SFYButtonControl::SetShadowColor function.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

In the "inactive" or "focus" state, the colors of the frame("focus frame"), the content region, and the shadow region change.

Figure 279. Expanded figure of the button control in the "inactive" state


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

In the "inactive" state, the light color and the dark color of the bevel region is set to the base color of bevel color(SFXBevelColor). As a result, the bevel region within the button control looks 2 dimensional.

The shadow region is drawn in the color which is calculated for the "inactive" state using the color set with the SFYButtonControl::SetShadowColor function.

For more details, refer to SFYButtonControl::SetShadowColor.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

Figure 280. Expanded figure of the button control in the "focus" state when not pressed


Expanded figure of the button control in the "focus" state when not pressed

In the focused state, the frame region("focus frame") of 2 pixels width of the bevel region is drawn in the bevel color set with the SFYButtonControl::SetFocusColor function.

The content region surrounded by this frame("focus frame") is filled in the base color of the bevel color set with the SFYButtonControl::SetButtonColor function.

Since the operation key set with the SFYButtonControl::SetOperateKey function is not pressed, the bottom edge and the right edge is drawn in the color set with the SFYButtonControl::SetShadowColor function.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

Figure 281. Expanded figure of the button control in the "focus" state when pressed


Expanded figure of the button control in the "focus" state when pressed

In the "focus" and "pressed" state, the frame region("focus frame") of 2 pixels width of the bevel region is drawn in the bevel color which is calculated for the "focus" and "pressed" state using the bevel color set with the SFYButtonControl::SetFocusColor function.

The content region surrounded by this frame("focus frame") is filled in the color which is calculated for the "focus" and "pressed" state using the base color of the bevel color set with the SFYButtonControl::SetButtonColor function.

Since the operation key set with the SFYButtonControl::SetOperateKey function is pressed, the top edge and the left edge is drawn in the color set with the SFYButtonControl::SetShadowColor function.

For more details, refer to SFYButtonControl::SetFocusColor and SFYButtonControl::SetButtonColor.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

Events and their handlers

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

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

Table 203. Events and their Handlers

Event Handler(Virtual function) Default behaviour Override
SFEVT_KEY event of the operation key set with SFYButtonControl::SetOperateKey SFYButtonControl::HandleOperateKey - Optional
SFEVT_KEY_PRESS event of the operation key set with SFYButtonControl::SetOperateKey SFYButtonControl::HandleOperateKeyPress - Optional
SFEVT_KEY_RELEASE event of the operation key set with SFYButtonControl::SetOperateKey SFYButtonControl::HandleOperateKeyRelease 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 button control is as follows:

Example 858. Declaration

SFMTYPEDEFRESPONDER(USRButtonControl)
class USRButtonControl: public SFYButtonControl {
    SFMSEALRESPONDER(USRButtonControl)
    SFMRESPONDERINSTANTIATEFOUR(USRButtonControl, SFYButtonControl, 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', 'T', 'N')
    };
    SFMTYPEDEFTYPE(CodeEnum)

public:
    static USRButtonControlSmp NewInstance(SFCErrorPtr exception = null);
protected:
    explicit USRButtonControl(Void) static_throws;
    virtual ~USRButtonControl(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 859. Implementation

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

        // set the responder type
 SetType(CODE_TYPE);

        // here describe the initialization
    }
}

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

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

Void USRButtonControl::HandleBoundRequest(SFXRectanglePtr rectangle) const
{
    // in case of using function of SFYButtonControl class to draw button and shadow [i.e., SFYButtonControl::DrawButton()/DrawShadow()],
    // deflate rectangle by size of button and shadow
    rectangle->Deflate(GetShadowMargin());
    rectangle->Deflate(GetButtonMargin());

    // calculate the suitable button size
    // set the rectangle argument to the calculated suitable button 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 SFYButtonControl class to draw button and shadow [i.e., SFYButtonControl::DrawButton()/DrawShadow()],
    // inflate rectangle by size of button and shadow
    rectangle->Inflate(GetButtonMargin());
    rectangle->Inflate(GetShadowMargin());

    return;
}

Void USRButtonControl::HandleBoundOptimize(SFXRectanglePtr rectangle) const
{
    // in case of using function of SFYButtonControl class to draw button and shadow [i.e., SFYButtonControl::DrawButton()/DrawShadow()],
    // deflate rectangle by size of button and shadow
    rectangle->Deflate(GetShadowMargin());
    rectangle->Deflate(GetButtonMargin());

    // calculate the suitable button size within rectangular region given by the rectangle argument
    // set the rectangle argument to the calculated suitable button 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 SFYButtonControl class to draw button and shadow [i.e., SFYButtonControl::DrawButton()/DrawShadow()],
    // inflate rectangle by size of button and shadow
    rectangle->Inflate(GetButtonMargin());
    rectangle->Inflate(GetShadowMargin());

    return;
}

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

Void USRButtonControl::HandleRenderRequest(SFXGraphicsPtr graphics) const
{
    // in case of using function of SFYButtonControl class to draw button and shadow [i.e., SFYButtonControl::DrawButton()/DrawShadow()],
    // draw button and shadow as below
    DrawButton(graphics, DrawShadow(graphics, GetLocalBound()));

    // draw inside button

    return;
}

Reference

Abstract Class that Represents a Button Control[SFYButtonControl] | State | SFYControl | SFYCheckboxControl | SFYRadiobuttonControl | SFZCheckboxControl | SFZRadiobuttonControl | SFZTextButtonControl | SFZImageButtonControl | SFZComboBoxControl | Key Event[SFEVT_KEY/SFEVT_KEY_PRESS/SFEVT_KEY_RELEASE] | Region Event[SFEVT_RESPONDER_BOUND] | Drawing Event[SFEVT_RESPONDER_RENDER]

Member

Constructor/Destructor
SFYButtonControl( Void )
Constructor of the SFYButtonControl class.
~SFYButtonControl( Void )
Destructor of the SFYButtonControl class.
Public Functions
SFXBevelColorConstRef GetButtonColor( Void )
Get the bevel color of bevel region within this button.
SFXBevelColorConstRef GetFocusColor( Void )
Get the bevel color of frame margin of this button control in the "focus" state.
AVKType GetOperateKey( Void )
Get the operation key of the button control.
SFXRGBColorConstRef GetShadowColor( Void )
Get the shadow color of this button control.
Bool GetStatePress( Void )
Get the value of flag indicating whether or not this button is pressed.
Void SetButtonColor( SFXBevelColorConstRef param )
Set the bevel color of bevel region within this button to the specified value.
Void SetFocusColor( SFXBevelColorConstRef param )
Set the bevel color of frame margin of this button control in the "focus" state to the specified value.
Void SetOperateKey( AVKType param )
Set the operation key of this button control to the specified value.
Void SetShadowColor( SFXRGBColorConstRef param )
Set the shadow color of this button control to the specified value.
Void SetStatePress( Bool param )
Set the flag indicating whether or not this button is pressed 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 DrawButton( SFXGraphicsPtr graphics , SFXRectangleConstRef rectangle )
Draw the bevel region of this button control.
SFXRectangle DrawShadow( SFXGraphicsPtr graphics , SFXRectangleConstRef rectangle )
Draw the shadow region of this button control.
static
SFXMarginConstRef
GetButtonMargin( Void )
Get the margin region of this button control.
static
SFXGridConstRef
GetPressOffset( Void )
Get the press offset of this button control.
static
SFXMarginConstRef
GetShadowMargin( Void )
Get the margin of shadow region of this button control.
Void HandleOperateKey( Void )
This function will be called when the SFEVT_KEY event of the operation key is received.
Void HandleOperateKeyPress( Void )
This function will be called when the SFEVT_KEY_PRESS event of the operation key is received.
Void HandleOperateKeyRelease( Void )
This function will be called when the SFEVT_KEY_RELEASE 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 SFYButtonControl class.
HorizontalEnum (inherits from SFYResponder)
Constants that represent the horizontal alignment.
VerticalEnum (inherits from SFYResponder)
Constants that represent the vertical alignment.

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

Description

This constructor performs the initializations as follows:

  1. Set the type of this responder to ".btn".
  2. Set the flag indicating whether or not this button is pressed to "false".
  3. Set the bevel color of bevel region within this button to SFXBevelColor(SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00), SFXRGBColor(0xDD, 0xDD, 0xDD, 0x00), SFXRGBColor(0x88, 0x88, 0x88, 0x00)).
  4. Set the bevel color of frame margin of this button control in the "focus" state to SFXBevelColor(SFXRGBColor(0xCC, 0xCC, 0xCC, 0x00), SFXRGBColor(0xAA, 0xAA, 0xAA, 0x00), SFXRGBColor(0x55, 0x55, 0x55, 0x00)).
  5. Set the shadow color of this button control to SFXRGBColor(0x00, 0x00, 0x00, 0x00)[black color].
  6. Set the operation key of this button to AVK_SELECT.
  7. Register the event handlers in the table below into this responder.

Table 204. Event handler

Event Content of the handler
SFEVT_KEY event of the operation key set with SFYButtonControl::SetOperateKey If this button is pressed, call the SFYButtonControl::HandleOperateKey function.
SFEVT_KEY_PRESS event of the operation key set with SFYButtonControl::SetOperateKey If this button is not pressed, set the flag indicating whether or not this button is pressed to "true", call the SFYButtonControl::HandleOperateKeyPress function, and return "true". Otherwise, return "true" only.
SFEVT_KEY_REREASE event of the operation key set with SFYButtonControl::SetOperateKey If this button is pressed, set the flag indicating whether or not this button is pressed to "false", call the SFYButtonControl::HandleOperateKeyRelease function, and return "true". Otherwise, return "true" only.
State event[SFEVT_RESPONDER_STATE] indicating that the focus state has been changed Set the flag indicating whether or not this button is pressed to "false".
Applet-suspend event[SFEVT_APP_SUSPEND] Set the flag indicating whether or not this button is pressed to "false".
[Note] Note
In a responder inheriting from SFYButtonControl, the corresponding handler will be called when one of the above events occurs.

Reference

SFYResponder::SetType | SFYButtonControl::CodeEnum | SFYButtonControl::SetStatePress | SFYButtonControl::SetButtonColor | SFYButtonControl::SetButtonColor | SFYButtonControl::SetFocusColor | SFYButtonControl::SetShadowColor | SFYButtonControl::HandleOperateKey | SFYButtonControl::HandleOperateKeyPress | SFYButtonControl::HandleOperateKeyRelease | SFXEvent | SFXBevelColor | SFXRGBColor | Type | State | Event | Key Event[SFEVT_KEY/SFEVT_KEY_PRESS/SFEVT_KEY_RELEASE] | State Event[SFEVT_RESPONDER_STATE] | Applet-Suspend Event[SFEVT_APP_SUSPEND]


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

Description

This destructor does nothing.


SFYButtonControl::DrawButton
Draw the bevel region of this button control.
[ protected, const ]
Void DrawButton(
    SFXGraphicsPtr graphics          // graphic object
    SFXRectangleConstRef rectangle   // drawing region
);

Description

This function draws the bevel region of this button control which includes the content region.

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

In the default implementation, the bevel region of this button control is drawn as below depending on its state.

Structure of the button control

  1. Bevel region of the 3D rectangle.
  2. Content region surrounded by the frame("focus frame") of 2 pixels width within the bevel region.
  3. Shadow region: the left edge and the top edge if the button control is pressed, or the right edge and the bottom edge if the button control is not pressed.

The button control consists of the bevel region, the content region, and the shadow region.

The content region is the one surrounded by the frame("focus frame") of 2 pixels width within the bevel region.

* In case of the radio button control, it consists of not rectangular but circular regions.

Figure 282. Expanded figure of the button control in the "active" or "enable" state


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

The bevel region is drawn in the bevel color(SFXBevelColor) set with the SFYButtonControl::SetButtonColor function. The shadow region is drawn in the color(SFXRGBColor) set with the SFYButtonControl::SetShadowColor function.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

In the "inactive" or "focus" state, the colors of the frame("focus frame"), the content region, and the shadow region change.

Figure 283. Expanded figure of the button control in the "inactive" state


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

In the "inactive" state, the light color and the dark color of the bevel region is set to the base color of bevel color(SFXBevelColor). As a result, the bevel region within the button control looks 2 dimensional.

The shadow region is drawn in the color which is calculated for the "inactive" state using the color set with the SFYButtonControl::SetShadowColor function.

For more details, refer to SFYButtonControl::SetShadowColor.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

Figure 284. Expanded figure of the button control in the "focus" state when not pressed


Expanded figure of the button control in the "focus" state when not pressed

In the focused state, the frame region("focus frame") of 2 pixels width of the bevel region is drawn in the bevel color set with the SFYButtonControl::SetFocusColor function.

The content region surrounded by this frame("focus frame") is filled in the base color of the bevel color set with the SFYButtonControl::SetButtonColor function.

Since the operation key set with the SFYButtonControl::SetOperateKey function is not pressed, the bottom edge and the right edge is drawn in the color set with the SFYButtonControl::SetShadowColor function.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

Figure 285. Expanded figure of the button control in the "focus" state when pressed


Expanded figure of the button control in the "focus" state when pressed

In the "focus" and "pressed" state, the frame region("focus frame") of 2 pixels width of the bevel region is drawn in the bevel color which is calculated for the "focus" and "pressed" state using the bevel color set with the SFYButtonControl::SetFocusColor function.

The content region surrounded by this frame("focus frame") is filled in the color which is calculated for the "focus" and "pressed" state using the base color of the bevel color set with the SFYButtonControl::SetButtonColor function.

Since the operation key set with the SFYButtonControl::SetOperateKey function is pressed, the top edge and the left edge is drawn in the color set with the SFYButtonControl::SetShadowColor function.

For more details, refer to SFYButtonControl::SetFocusColor and SFYButtonControl::SetButtonColor.

* The background of button control will be never drawn in the color set with the SFYWidget::SetBackgroundColor function.

Internal Implementation

Internal implementation of the SFYButtonControl::DrawButton function is as follows:

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

    lx.Set(rectangle);
    bevel.Set((GetStateFocus(true)) ? (_color.focus) : (_color.button));
    rgb.Set(_color.button.GetBase());
    if (!GetStateActive(true)) {
        bevel.SetLight(bevel.GetBase());
        bevel.SetDark(bevel.GetBase());
    }
    if (GetStatePress()) {
        (bevel.GetBase().GetBrightness() > 0x7F) ? bevel.SubRGB(0x11) : bevel.AddRGB(0x11);
        (rgb.GetBrightness() > 0x7F) ? rgb.SubRGB(0x11) : rgb.AddRGB(0x11);
    }
    graphics->FillBevelRectangle(lx, bevel);
    lx.Deflate(2, 2);
    graphics->FillRectangle(lx, rgb);
    return;
}// SFYButtonControl::DrawButton //

Reference

SFYButtonControl::DrawShadow | SFYButtonControl::SetButtonColor | SFYButtonControl::SetFocusColor | SFYButtonControl::SetShadowColor | SFXRGBColor::GetBrightness | SFYWidget::SetBackgroundColor | SFXBevelColor | SFXRGBColor | State


SFYButtonControl::DrawShadow
Draw the shadow region of this button control.
[ protected, const ]
SFXRectangle DrawShadow(
    SFXGraphicsPtr graphics          // graphic object
    SFXRectangleConstRef rectangle   // drawing region
);

Description

This function draws the shadow region of this button control.

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

The default implementation is as follows:

Figure 286. Expanded figure of the button control when not pressed


Expanded figure of the button control when not pressed

In the "not-pressed" state of the button control, the region of the bottom edge and the right edge is the shadow region, which is drawn in the color(SFXRGBColor) set with the SFYButtonControl::SetShadowColor function.

Figure 287. Expanded figure of the button control in the "focus" state when pressed


Expanded figure of the button control in the "focus" state when pressed

In the "pressed" state of the button control, the region of the top edge and the left edge is the shadow region, which is drawn in the color(SFXRGBColor) set with the SFYButtonControl::SetShadowColor function.

At this time, the bevel region of this button control is moved and drawn by (1, 1) compared with that in the "not-pressed" state.

For the drawing of the bevel region of this button control, refer to SFYButtonControl::DrawButton.

Internal Implementation

Internal implementation of the SFYButtonControl::DrawShadow function is as follows:

/*protected */SFXRectangle SFYButtonControl::DrawShadow(SFXGraphicsPtr graphics, SFXRectangleConstRef rectangle) const
{
    SFXRGBColor                                 rgb;
    SFXRectangle                                result(rectangle);

    rgb.Set(_color.shadow);
    if (!GetStateActive(true)) {
        (rgb.GetBrightness() > 0x7F) ? rgb.SubRGB(0x44) : rgb.AddRGB(0x44);
    }
    graphics->SetForeColor(rgb);
    if (GetStatePress()) {
        graphics->DrawLine(result.GetEdgeLeft());
        graphics->DrawLine(result.GetEdgeTop());
        result.AddLeftTop(1, 1);
    }
    else {
        graphics->DrawLine(result.GetEdgeRight());
        graphics->DrawLine(result.GetEdgeBottom());
        result.SubRightBottom(1, 1);
    }
    return result;
}// SFYButtonControl::DrawShadow //

Reference

SFYButtonControl::SetShadowColor | SFXRGBColor | SFYButtonControl::DrawButton


SFYButtonControl::GetButtonColor
Get the bevel color of bevel region within this button.
[ public, const ]
SFXBevelColorConstRef GetButtonColor(Void);

Description

This function gets the bevel color(SFXBevelColor) to draw the bevel region within this button control.

Reference

SFYButtonControl::SetButtonColor | SFYButtonControl::SetFocusColor | SFXRGBColor::GetBrightness | SFXBevelColor | SFXRGBColor | State


SFYButtonControl::GetButtonMargin
Get the margin region of this button control.
[ protected, static ]
SFXMarginConstRef GetButtonMargin(Void);

Return value

Margin region of this button control [SFXMargin(2, 2, 2, 2)].

Description

The margin region of the button control is the frame margin of 2 pixels width of the bevel region within the button control, 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 2 pixels width, i.e., SFXMargin(2, 2, 2, 2)] of the bevel region, which is the local region of the button control excluded its shadow region.

Figure 288. Frame region of the button control in the "focus" state: Expanded Figure


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

The margin region of the button control is the frame margin of 2 pixels width of the bevel region, which is the region of the button control excluded its shadow region.

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

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

For the drawing of this region, refer to SFYButtonControl::DrawButton.

Reference

SFXMargin | SFYButtonControl::DrawButton | SFYButtonControl::GetShadowMargin | Local Region


SFYButtonControl::GetFocusColor
Get the bevel color of frame margin of this button control in the "focus" state.
[ public, const ]
SFXBevelColorConstRef GetFocusColor(Void);

Reference

SFYButtonControl::SetFocusColor | SFXBevelColor | SFXRGBColor | State


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

Reference

SFYButtonControl::SetOperateKey


SFYButtonControl::GetPressOffset
Get the press offset of this button control.
[ protected, static ]
SFXGridConstRef GetPressOffset(Void);

Return value

Value of the press offset of this button control.

Description

The press offset is the offset value by which the region of this button control excluded its shadow region will be moved when this button is pressed. The concrete value of the press offset is 1 pixel in the X coordinate and 1 pixel in the Y coordinate.

To the contrary, the region of this button control excluded its shadow region will be moved back to the origin when this button is released. In other words, it will be moved by "-1" in the X coordinate and "-1" in the Y coordinate.

Reference

SFYButtonControl::GetButtonMargin | SFYButtonControl::GetShadowMargin


SFYButtonControl::GetShadowColor
Get the shadow color of this button control.
[ public, const ]
SFXRGBColorConstRef GetShadowColor(Void);

Reference

SFYButtonControl::SetShadowColor | SFXRGBColor


SFYButtonControl::GetShadowMargin
Get the margin of shadow region of this button control.
[ protected, static ]
SFXMarginConstRef GetShadowMargin(Void);

Return value

Margin of the shadow region of this button control [SFXMargin(0, 0, 1, 1)].

Description

The button control has the shadow region, which is the margin region of SFXMargin(0, 0, 1, 1), i.e., 0 pixel from left edge, 0 pixel from top edge, 1 pixel from right edge, and 1 pixel from bottom edge of its local region.

Figure 289. The shadow region of the button control when not pressed: Expanded Figure


The shadow region of the button control when not pressed: Expanded Figure

The right edge and the bottom edge of 1 pixel width will be the shadow region when the button control is not pressed.

Figure 290. The shadow region of the button control when pressed: Expanded Figure


The shadow region of the button control when pressed: Expanded Figure

The left edge and the top edge of 1 pixel width will be the shadow region when the button control is pressed.

For more details, refer to SFYButtonControl::DrawShadow function.

Reference

SFXMargin | SFYButtonControl::DrawShadow | SFYButtonControl::GetButtonMargin | SFYButtonControl::GetPressOffset


SFYButtonControl::GetStatePress
Get the value of flag indicating whether or not this button is pressed.
[ public, const ]
Bool GetStatePress(Void);

Reference

SFYButtonControl::SetStatePress


SFYButtonControl::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 SFYButtonControl::SetOperateKey function is received.

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

The default implementation does nothing.

Internal Implementation

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

/*protected virtual */Void SFYButtonControl::HandleOperateKey(Void)
{
    return;
}// SFYButtonControl::HandleOperateKey //

Reference

SFYButtonControl::SetOperateKey | Key Event[SFEVT_KEY]


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

Description

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

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

The default implementation does nothing.

Internal Implementation

Internal implementation of the SFYButtonControl::HandleOperateKeyPress function is as follows:

/*protected virtual */Void SFYButtonControl::HandleOperateKeyPress(Void)
{
    return;
}// SFYButtonControl::HandleOperateKeyPress //

Reference

SFYButtonControl::SetOperateKey | Key Event[SFEVT_KEY_PRESS]


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

Description

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

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

The default implementation is to send the SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, current value) event, of which the current value can be obtained by calling the SFYControl::GetCurrentValue function.

Internal Implementation

Internal implementation of the SFYButtonControl::HandleOperateKeyRelease function is as follows:

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

Reference

SFYButtonControl::SetOperateKey | SFYControl::GetCurrentValue | SFXEvent | Key Event[SFEVT_KEY_RELEASE]


SFYButtonControl::SetButtonColor
Set the bevel color of bevel region within this button to the specified value.
[ public ]
Void SetButtonColor(
    SFXBevelColorConstRef param   // value to set
);

Description

This function sets the bevel color(SFXBevelColor) of the bevel region within this button to the specified value.

In the focused state, the margin region [i.e., SFXMargin(2, 2, 2, 2)] of the bevel region within this button control, which is obtained by calling the SFYButtonControl::GetButtonMargin function, that is to say, the frame margin of 2 pixels width is drawn in the bevel color set with the SFYButtonControl::SetFocusColor function.

Default: SFXBevelColor(SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00), SFXRGBColor(0xDD, 0xDD, 0xDD, 0x00), SFXRGBColor(0x88, 0x88, 0x88, 0x00)).

For more details, refer to SFYButtonControl::DrawButton.

Reference

SFYButtonControl::GetButtonColor | SFYButtonControl::GetButtonMargin | SFXMargin | SFYButtonControl::DrawButton | SFYButtonControl::DrawShadow | SFYButtonControl::SetFocusColor | SFYButtonControl::SetShadowColor | SFXRGBColor::GetBrightness | SFXBevelColor | SFXRGBColor | State


SFYButtonControl::SetFocusColor
Set the bevel color of frame margin of this button control in the "focus" state to the specified value.
[ public ]
Void SetFocusColor(
    SFXBevelColorConstRef param   // value to set
);

Description

This function sets the bevel color to draw the frame margin of this button control in the "focus" state to the specified value. The frame region is the frame of 2 pixels width which consists of the left, top, right, and bottom edges of the region of the button control excluded its shadow region.

In the focused state, the margin region [i.e., SFXMargin(2, 2, 2, 2)] of the bevel region within this button control, which is obtained by calling the SFYButtonControl::GetButtonMargin function, that is to say, the frame margin of 2 pixels width is drawn in the bevel color set with this function.

Default: SFXBevelColor(SFXRGBColor(0xCC, 0xCC, 0xCC, 0x00), SFXRGBColor(0xAA, 0xAA, 0xAA, 0x00),

For more details, refer to SFYButtonControl::DrawButton.

Reference

SFYButtonControl::GetFocusColor | SFYButtonControl::GetButtonMargin | SFYButtonControl::DrawButton | SFYButtonControl::SetButtonColor | SFYButtonControl::SetOperateKey | SFXRGBColor::GetBrightness | SFXBevelColor | SFXRGBColor | State


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

Description

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

The SFYButtonControl::HandleOperateKey and SFYButtonControl::HandleOperateKeyPress or SFYButtonControl::HandleOperateKeyRelease function will be called when this key is pressed or released respectively.

Default: AVK_SELECT

Reference

SFYButtonControl::GetOperateKey | SFYButtonControl::HandleOperateKey | SFYButtonControl::HandleOperateKeyPress | SFYButtonControl::HandleOperateKeyRelease


SFYButtonControl::SetShadowColor
Set the shadow color of this button control to the specified value.
[ public ]
Void SetShadowColor(
    SFXRGBColorConstRef param   // value to set
);

Description

This function sets the color(SFXRGBColor) to draw the shadow region of this button control to the specified value.

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

In the "inactive" state, the shadow 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 this 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.

In the focused state, the shadow will be drawn in the left edge and the top edge of this button control when the operation key set with the SFYButtonControl::SetOperateKey function is pressed. Otherwise it will be drawn in the bottom edge and the right edge.

For more details, refer to SFYButtonControl::DrawButton.

Reference

SFYButtonControl::GetShadowColor | SFYButtonControl::DrawShadow | SFYButtonControl::DrawButton | SFYButtonControl::SetButtonColor | SFYButtonControl::SetFocusColor | SFXRGBColor::GetBrightness | SFXRGBColor | State


SFYButtonControl::SetStatePress
Set the flag indicating whether or not this button is pressed to the specified value.
[ public ]
Void SetStatePress(
    Bool param   // value to set(if pressed, set "true"; otherwise "false")
);

Description

This function sets the flag indicating whether or not this button is pressed to the specified value if both of them are different, and sends the state event[SFXEvent(SFEVT_RESPONDER_STATE, SFP16_STATE_PRESS, "value to be set")]. [* Nothing will happen if they are the same.]

Default: false

Reference

SFYButtonControl::GetStatePress | Event | State Event[SFEVT_RESPONDER_STATE]


SFYButtonControl::CodeEnum
Constant that represents the SFYButtonControl class.
enum CodeEnum {
    CODE_TYPE = four_char_code('.', 'b', 't', 'n')
};
SFMTYPEDEFTYPE(CodeEnum)

Reference

SFYResponder::GetType | SFYResponder::SetType