PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFZTextMenu
Responder which represents a text menu.
#include <SFZTextMenu.h.hpp>
class SFZTextMenu : public SFYMenu;
SFMTYPEDEFRESPONDER(SFZTextMenu)

Inheritance diagram

 Inheritance diagram of SFZTextMenuClass

Collaboration diagram

 Collaboration diagram of SFZTextMenuClass

Description

SFZTextMenu is a responder to create, control, update, and destroy a menu in text format(text menu).

There are 2 types of text menus: page style(default) and scroll style.

The design of a text menu can be customized using its various APIs.

A text, an icon character, or an image can be set to an item of the text menu.

To append an item, call the SFZTextMenu::AppendItem function. To delete an item, call the SFZTextMenu::RemoveItem function. When the SFZTextMenu::Clear function is called, all items will be removed.

The selection key is set with the SFYMenu::SetSelectUpKey / SFYMenu::SetSelectDownKey / SFYMenu::SetSelectRightKey / SFYMenu::SetSelectLeftKey functions. By default, selection keys are set to the UP key, the DOWN key, the RIGHT key, the LEFT key respectively.

In the default implementation, the text menu[SFZTextMenu] will receive the following result events[SFEVT_RESPONDER_RESULT].

The developer can register handlers for these events.

If no handler is registered, the default handler will be booted up when one of the above result events is received. The default handler only closes the menu.

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

The access key is set with the SFZTextMenu::SetItemAccessKey function.

The ESCAPE key is set with the SFYMenu::SetEscapeKey function. By default, the ESCAPE key is set to the CLEAR key.

[Note] Note
The timer processing callback scheduled with the SFYMenu::ScheduleTimer function will be canceled automatically when the operation key of the menu or the ESCAPE key is pressed.

Reference: Result Event[SFEVT_RESPONDER_RESULT] | SFZTextMenu::HandleOperateKey | SFZTextMenu::HandleEscapeKey | SFZTextMenu::HandleSelectUpKey | SFZTextMenu::HandleSelectDownKey | SFZTextMenu::HandleSelectRightKey | SFZTextMenu::HandleSelectLeftKey

The code to use a text menu is as follows:

[Note] Note
To simplify the code, error handling is omitted here.
Void USRApplication::Main(Void)
{
     SFCError error;

     // create the window
     _window = SFZWindow::NewInstance();
     _window->SetParent(GetThis());
     _window->SetRealBound(GetLocalBound());
     _window->SetVirtualBound(SFXRectangle(_window->GetVirtualBound()).SetHeight(640));
     _window->SetState(true, true, true, true);
     _window->SetBackgroundColor(SFXRGBColor(0xDD, 0xFF, 0xDD, 0x00));

     // create the text menu
     SFZTextMenuSmp _textmenu = SFZTextMenu::NewInstance(&error);

     // register the result handler which means that item is selected	
     _textmenu->RegisterHandler(SFXEventRange(SFEVT_RESPONDER_RESULT, SFEVT_RESPONDER_RESULT, SFP16_BEGIN, SFP16_END), 
                                   XANDLER_INTERNAL(OnTextMenu));

     _textmenu->SetState(true, true, true, true);
     _textmenu->SetParent(_window);
     _textmenu->SetTitle("Text Menu");
     _textmenu->ToFront();

     SFXRectangle menuRect(30,95,165,135);  
     menuRect.SetHeight(_textmenu->GetTitleHeight() + 3 * _textmenu->GetItemHeight());
     _textmenu->SetRealBound(menuRect);

     _textmenu->AppendItem("item 1"); 
     _textmenu->AppendItem("item 2"); 
     _textmenu->AppendItem("item 3"); 
	 
     // disable 3rd item
     _textmenu->SetItemEnable(2, false);

     return;
}

// result handler which means that item is selected
XANDLER_IMPLEMENT_VOIDRESULT(USRApplication, OnTextMenu, invoker, reason, result)
{
    // text menu will be passed via invoker
    // P16 value of result event will be passed via reason

    switch (reason) {

        case SFP16_RESULT_OK:  // when the operation key is pressed[item needs to be enabled with SetItemEnable()]

            // the index of the selected item will be passed via the result argument

            if (result == 0) {       // when 1st item is selected

                 ...

            }
            else if (result == 1) {  // when 2nd item is selected
 
                 ...

            }
            else if (result == 2) {  // when 3rd item is selected

                 ...

            }

            break;

        case SFP16_RESULT_ESCAPE:  // when the ESCAPE key is pressed or the time scheduled with ScheduleTimer() elapses

            // 0 will be passed via the result argument

            // close text menu
            invoker->Terminate();  
            // or "_textmenu->Terminate();"

            break;
    }

    return;
}

Execution result:

Reference

Text Menu [SFZTextMenu] | SFYMenu | SFZGridMenu | SFZFlexListMenu

Members

Constructor/Destructor
SFZTextMenu( Void )
Constructor of the SFZTextMenu class.
~SFZTextMenu( Void )
Destructor of the SFZTextMenu class.
Public Functions
SFCError AppendItem( SFXPathConstRef path , UInt16 id )
[DEPRECATED]Append an item to this text menu. Use the InsertLast() function.
SFCError AppendItem( SFXPathConstRef path , UInt16 id , AVKType key , WChar keyIcon = 0 )
[DEPRECATED]Append an item to this text menu. Use the InsertLast() function.
SFCError AppendItem( SFXWideStringConstRef text )
[DEPRECATED]Append an item to this text menu. Use the InsertLast() function.
SFCError AppendItem( SFXWideStringConstRef text , AVKType key , WChar keyIcon = 0 )
[DEPRECATED]Append an item to this text menu. Use the InsertLast() function.
Void Clear( Void )
Delete all items from this menu.
SFXBevelColorConstRef GetBevelColor( Void )
Get the bevel color for outer frame of this menu.
SFXRGBColorConstRef GetDefaultItemBackColor( Void )
Get the default background color of unselected item of this menu.
SFXRGBColorConstRef GetDefaultItemForeColor( Void )
Get the default foreground color of unselected item of this menu.
AEEFont GetFont( Void )
Get the font of this menu.
AVKType GetItemAccessKey( SInt16 index )
Get the access key of the specified item of this menu.
SFXRGBColorConstRef GetItemBackColor( SInt16 index )
Get the background color of the specified unselected item of this menu.
SInt16 GetItemCount( Void )
Get the number of the items of this menu.
Bool GetItemEnable( SInt16 index )
Get the value of enable flag of the specified item of this menu.
SFXRGBColorConstRef GetItemForeColor( SInt16 index )
Get the foreground color of the specified unselected item of this menu.
SInt16 GetItemHeight( Void )
Get the item height of this menu.
SFBImageSmpConstRef GetItemImage( SInt16 index )
Get the image of the specified item of this menu.
SFXMarginConstRef GetItemMargin( Void )
Get the margin of the item of this menu.
SFZTextMenuSmp GetItemSubMenu( SInt16 index )
Get the sub menu for the specified item of this menu.
SFXWideStringConstRef GetItemText( SInt16 index )
Get the text of the specified item of this menu.
MenuStyleEnum GetMenuStyle( Void )
Get the menu style of this menu.
SFZTextMenuSmp GetRootMenu( Void )
Get the root menu of this menu.
SFXRGBColorConstRef GetSelBackColor( Void )
Get the background color of selected item of this menu.
SFXRGBColorConstRef GetSelForeColor( Void )
Get the foreground color of selected item of this menu.
SInt16 GetSelect( Void )
Get the index of currently selected item of this menu.
SFXWideStringConstRef GetTitle( Void )
Get the title of this menu.
SFXRGBColorConstRef GetTitleBackColor( Void )
Get the background color of the title of this menu.
SFXRGBColorConstRef GetTitleForeColor( Void )
Get the foreground color of the title of this menu.
SInt16 GetTitleHeight( Void )
Get the height of the title of this menu.
Bool HasParentMenu( Void )
Check whether or not this menu has any parent menu.
SFCError Insert( SInt32 index , SFXPathConstRef path , UInt16 id )
Insert the specified item before the specified index.
SFCError Insert( SInt32 index , SFXPathConstRef path , UInt16 id , AVKType key , WChar keyIcon )
Insert the specified item before the specified index.
SFCError Insert( SInt32 index , SFXWideStringConstRef text )
Insert the specified item before the specified index.
SFCError Insert( SInt32 index , SFXWideStringConstRef text , AVKType key , WChar keyIcon )
Insert the specified item before the specified index.
SFCError InsertFirst( SFXPathConstRef path , UInt16 id )
Insert the specified item at the head.
SFCError InsertFirst( SFXPathConstRef path , UInt16 id , AVKType key , WChar keyIcon )
Insert the specified item at the head.
SFCError InsertFirst( SFXWideStringConstRef text )
Insert the specified item at the head.
SFCError InsertFirst( SFXWideStringConstRef text , AVKType key , WChar keyIcon )
Insert the specified item at the head.
SFCError InsertLast( SFXPathConstRef path , UInt16 id )
Insert the specified item at the tail.
SFCError InsertLast( SFXPathConstRef path , UInt16 id , AVKType key , WChar keyIcon )
Insert the specified item at the tail.
SFCError InsertLast( SFXWideStringConstRef text )
Insert the specified item at the tail.
SFCError InsertLast( SFXWideStringConstRef text , AVKType key , WChar keyIcon )
Insert the specified item at the tail.
static
SFZTextMenuSmp
NewInstance( SFCErrorPtr exception = null )
Create a new instance of this responder class.
Void Remove( SInt32 index )
Remove specified items from this text menu.
Void Remove( SInt32 begin , SInt32 end )
Remove specified items from this text menu.
Void RemoveFirst( Void )
Remove the first item from this text menu.
Void RemoveItem( SInt16 index )
[DEPRECATED]Remove the specified item from this text menu. Use the Remove() function.
Void RemoveLast( Void )
Remove the last item from this text menu.
Void SetBevelColor( SFXBevelColorConstRef param )
Set the bevel color for outer frame of this menu to the specified value.
Void SetDefaultItemBackColor( SFXRGBColorConstRef param )
Set the default background color of unselected item of this menu to the specified value.
Void SetDefaultItemForeColor( SFXRGBColorConstRef param )
Set the default foreground color of unselected item of this menu to the specified value.
Void SetFont( AEEFont param )
Set the font of this menu to the specified value.
SFCError SetItemAccessKey( SInt16 index , AVKType key , WChar keyIcon = 0 )
Set the access key and the key icon of the specified item of this menu to specified values.
SFCError SetItemBackColor( SInt16 index , SFXRGBColorConstRef param )
Set the background color of the specified unselected item of this menu to the specified value.
SFCError SetItemEnable( SInt16 index , Bool param )
Set the enable flag of the specified item of this menu to the specified value.
SFCError SetItemForeColor( SInt16 index , SFXRGBColorConstRef param )
Set the foreground color of the specified unselected item of this menu to the specified value.
Void SetItemHeight( SInt16 param )
Set the item height of this menu to the specified value. [pixels]
SFCError SetItemImage( SInt16 index , SFXPathConstRef path )
Set the image of the specified item of this menu to the specified value.
SFCError SetItemImage( SInt16 index , SFXPathConstRef path , UInt16 id )
Set the image of the specified item of this menu to the specified value.
SFCError SetItemImage( SInt16 index , SFBImageSmpConstRef param )
Set the image of the specified item of this menu to the specified value.
Void SetItemMargin( SFXMarginConstRef param )
Set the margin of the item of this menu to the specified value.
SFCError SetItemSubMenu( SInt16 index , SFZTextMenuSmp subMenu )
Set the sub menu of the specified item of this menu to the specified value.
SFCError SetItemText( SInt16 index , SFXPathConstRef index , UInt16 id )
Set the text of the specified item of this menu to the specified value.
SFCError SetItemText( SInt16 index , SFXWideStringConstRef param )
Set the text of the specified item of this menu to the specified value.
Void SetMenuStyle( MenuStyleEnum param )
Set the menu style of this menu to the specified value.
Void SetSelBackColor( SFXRGBColorConstRef param )
Set the background color of selected item of this menu to the specified value.
Void SetSelForeColor( SFXRGBColorConstRef param )
Set the foreground color of selected item of this menu to the specified value.
Void SetSelect( SInt16 param )
Set the index of currently selected item of this menu to the specified value.
SFCError SetTitle( SFXPathConstRef path , UInt16 id )
Set the title of this menu to the specified value.
SFCError SetTitle( SFXWideStringConstRef param )
Set the title of this menu to the specified value.
Void SetTitleBackColor( SFXRGBColorConstRef param )
Set the background color of the title of this menu to the specified value.
Void SetTitleForeColor( SFXRGBColorConstRef param )
Set the foreground color of the title of this menu to the specified value.
Void SetTitleHeight( SInt16 param )
Set the height of the title of this menu to the specified value. [pixels]
Void CancelTimer( Void ) (inherits from SFYMenu)
Cancel the timer of this menu.
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.
SFYDistributerPtr GetDistributer( Void ) (inherits from SFYResponder)
Get the distributer bound with this responder.
AVKType GetEscapeKey( Void ) (inherits from SFYMenu)
Get the ESCAPE key of this menu.
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 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.
AVKType GetOperateKey( Void ) (inherits from SFYMenu)
Get the operation key of this menu.
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.
AVKType GetSelectDownKey( Void ) (inherits from SFYMenu)
Get the DOWN key of this menu.
AVKType GetSelectLeftKey( Void ) (inherits from SFYMenu)
Get the LEFT key of this menu.
AVKType GetSelectRightKey( Void ) (inherits from SFYMenu)
Get the RIGHT key of this menu.
AVKType GetSelectUpKey( Void ) (inherits from SFYMenu)
Get the UP key of this menu.
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 RewindTimer( Void ) (inherits from SFYMenu)
Reset the time until this menu is automatically closed.
Void ScheduleTimer( UInt32 param ) (inherits from SFYMenu)
Schedule the timer that HandleEscapeKey() will be called after the specified time elapses. [milliseconds]
Void SetBackgroundColor( SFXRGBColorConstRef param ) (inherits from SFYWidget)
Set the background color to the specified value.
Void SetDistributer( SFYDistributerPtr param ) (inherits from SFYResponder)
Bind this responder with the specified distributer.
Void SetEscapeKey( AVKType param ) (inherits from SFYMenu)
Set the ESCAPE key of this menu to the specified value.
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 SetOperateKey( AVKType param ) (inherits from SFYMenu)
Set the operation key of this menu 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 SetSelectDownKey( AVKType param ) (inherits from SFYMenu)
Set the DOWN key of this menu to the specified value.
Void SetSelectLeftKey( AVKType param ) (inherits from SFYMenu)
Set the LEFT key of this menu to the specified value.
Void SetSelectRightKey( AVKType param ) (inherits from SFYMenu)
Set the RIGHT key of this menu to the specified value.
Void SetSelectUpKey( AVKType param ) (inherits from SFYMenu)
Set the UP key of this menu to the specified value.
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 HandleBoundReal( Void )
This function will be called when the real region is changed.
Void HandleBoundVirtual( Void )
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 HandleEscapeKey( Void )
This function will be called when the SFEVT_KEY event of the ESCAPE key is received.
Void HandleOperateKey( Void )
This function will be called when the SFEVT_KEY event of the operation key is received.
Void HandleRenderRequest( SFXGraphicsPtr graphics )
This function will be called when the (SFEVT_RESPONDER_RENDER, SFP16_RENDER_REQUEST) event is received. [Draw this menu.]
Void HandleSelectDownKey( Void )
This function will be called when the DOWN key is pressed.
Void HandleSelectLeftKey( Void )
This function will be called when the LEFT key is pressed.
Void HandleSelectRightKey( Void )
This function will be called when the RIGHT key is pressed.
Void HandleSelectUpKey( Void )
This function will be called when the UP key is pressed.
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 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 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 SFZTextMenu class.
MenuStyleEnum
Constant that represents the enum of the menu style.
HorizontalEnum (inherits from SFYResponder)
Constants that represent the horizontal alignment.
VerticalEnum (inherits from SFYResponder)
Constants that represent the vertical alignment.

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

Description

This constructor performs the initializations as follows:

  1. Set the type of this responder to "mtmn".
  2. Set the menu style to SFZTextMenu::DEFAULT_STYLE [paging style].
  3. Set the font to AEE_FONT_NORMAL.
  4. Set the bevel color for outer frame to SFXBevelColor(SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00), SFXRGBColor(0xEE, 0xEE, 0xEE, 0x00), SFXRGBColor(0x88, 0x88, 0x88, 0x00)).
  5. Set the background color of the title to SFXRGBColor(0xDD, 0xDD, 0xDD, 0x00)[gray color].
  6. Set the foreground color of the title to SFXRGBColor(0x00, 0x00, 0x00, 0x00)[black color].
  7. Set the default background color of unselected item to SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00)[white color].
  8. Set the default foreground color of unselected item to SFXRGBColor(0x00, 0x00, 0x00, 0x00)[black color].
  9. Set the background color of selected item to SFXRGBColor(0x11, 0x22, 0xBB, 0x00)[blue color].
  10. Set the foreground color of selected item to SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00)[white color].
  11. Set the title to ""[null string].
  12. Set the height of the title to "font height + 2".
  13. Set the height of the item to "font height + 2".
  14. Set the margin of the item to SFXMargin(2, 0).
  15. Set the item of the index 0 to be selected.
  16. Set the item of the index 0 to be display at the top in the menu.
  17. Register the event handler in the table below into this responder.

Table 242. Event handler

Event Content of the handler
SFEVT_KEY event of the access key set with SFZTextMenu::SetItemAccessKey Call the SFZTextMenu::HandleOperateKey function.
Result event[SFEVT_RESPONDER_RESULT] Terminate this menu. If this menu is a sub menu, terminate all its parent menus too.
[Note] Note
In a responder inheriting from SFZTextMenu the corresponding handler will be called when the above event occurs.

Reference

SFYResponder::SetType | SFZTextMenu::CodeEnum | SFZTextMenu::MenuStyleEnum | SFZTextMenu::SetMenuStyle | SFZTextMenu::SetFont | SFZTextMenu::SetBevelColor | SFZTextMenu::SetTitleBackColor | SFZTextMenu::SetTitleForeColor | SFZTextMenu::SetDefaultItemBackColor | SFZTextMenu::SetDefaultItemForeColor | SFZTextMenu::SetSelBackColor | SFZTextMenu::SetSelForeColor | SFZTextMenu::SetTitle | SFZTextMenu::SetTitleHeight | SFZTextMenu::SetItemHeight | SFZTextMenu::SetItemMargin | SFZTextMenu::SetSelect | SFZTextMenu::SetItemAccessKey | SFZTextMenu::HandleOperateKey | SFXBevelColor | SFXRGBColor | SFXMargin | Type | Event | Key Event[SFEVT_KEY]


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

Description

Delete all items from this text menu.

Reference

SFZTextMenu::Clear


SFZTextMenu::AppendItem
[DEPRECATED]Append an item to this text menu. Use the InsertLast() function.
[ public ]
SFCError AppendItem(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
);
[ public ]
SFCError AppendItem(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
    AVKType key            // access key
    WChar keyIcon = 0      // key icon
);
[ public ]
SFCError AppendItem(
    SFXWideStringConstRef text   // text
);
[ public ]
SFCError AppendItem(
    SFXWideStringConstRef text   // text
    AVKType key                  // access key
    WChar keyIcon = 0            // key icon
);

Description

This function appends an item to this menu. The appended item becomes the last item of this menu.

[Caution] Caution
Since this function is deprecated, use the SFZTextMenu::InsertLast function instead.

Reference

SFZTextMenu::InsertLast | SFZTextMenu::RemoveItem | SFZTextMenu::Clear


SFZTextMenu::Clear
Delete all items from this menu.
[ public ]
Void Clear(Void);

Description

This function deletes all items from this menu.

Reference

SFZTextMenu::RemoveItem | SFZTextMenu::AppendItem


SFZTextMenu::GetBevelColor
Get the bevel color for outer frame of this menu.
[ public, const ]
SFXBevelColorConstRef GetBevelColor(Void);

Return value

Bevel color (SFXBevelColor) of this menu, which is the color of the outer frame to draw this menu in the 3D style.

Reference

SFZTextMenu::SetBevelColor | SFXBevelColor


SFZTextMenu::GetDefaultItemBackColor
Get the default background color of unselected item of this menu.
[ public, const ]
SFXRGBColorConstRef GetDefaultItemBackColor(Void);

Description

This function gets the default background color(SFXRGBColor) of unselected item of this menu.

Reference

SFZTextMenu::SetDefaultItemBackColor


SFZTextMenu::GetDefaultItemForeColor
Get the default foreground color of unselected item of this menu.
[ public, const ]
SFXRGBColorConstRef GetDefaultItemForeColor(Void);

Description

This function gets the default foreground color(SFXRGBColor) to draw the text of unselected item of this menu.

Reference

SFZTextMenu::SetDefaultItemForeColor


SFZTextMenu::GetFont
Get the font of this menu.
[ public, const ]
AEEFont GetFont(Void);

Description

This function gets the font to draw the item and the title of this menu.

Reference

SFZTextMenu::SetFont


SFZTextMenu::GetItemAccessKey
Get the access key of the specified item of this menu.
[ public, const ]
AVKType GetItemAccessKey(
    SInt16 index   // index of item
);

Description

This function gets the access key of the specified item of this menu. AVK_UNDEFINED will be returned if the access key is not set.

Reference

SFZTextMenu::SetItemAccessKey


SFZTextMenu::GetItemBackColor
Get the background color of the specified unselected item of this menu.
[ public, const ]
SFXRGBColorConstRef GetItemBackColor(
    SInt16 index   // index of item 
);

Description

This function gets the background color(SFXRGBColor) of the specified unselected item of this menu.

Reference

SFZTextMenu::SetItemBackColor | SFXRGBColor


SFZTextMenu::GetItemCount
Get the number of the items of this menu.
[ public, const ]
SInt16 GetItemCount(Void);

Description

This function gets the number of the items of this menu.


SFZTextMenu::GetItemEnable
Get the value of enable flag of the specified item of this menu.
[ public, const ]
Bool GetItemEnable(
    SInt16 index   // index of item
);

Description

This function gets the value of enable flag of the specified item of this menu. If the specified item is valid, "true" will be returned. Otherwise "false" will be returned.

Reference

SFZTextMenu::SetItemEnable


SFZTextMenu::GetItemForeColor
Get the foreground color of the specified unselected item of this menu.
[ public, const ]
SFXRGBColorConstRef GetItemForeColor(
    SInt16 index   // index of item
);

Description

This function gets the foreground color(SFXRGBColor) to draw the text of the specified unselected item of this menu.

Reference

SFZTextMenu::SetItemForeColor | SFXRGBColor


SFZTextMenu::GetItemHeight
Get the item height of this menu.
[ public, const ]
SInt16 GetItemHeight(Void);

Description

This function gets the item height of this menu.

Reference

SFZTextMenu::SetItemHeight


SFZTextMenu::GetItemImage
Get the image of the specified item of this menu.
[ public, const ]
SFBImageSmpConstRef GetItemImage(
    SInt16 index   // index of item
);

Return value

Pointer to the image attached with the item.

Description

This function gets the image of the specified item of this menu.

Reference

SFZTextMenu::SetItemImage


SFZTextMenu::GetItemMargin
Get the margin of the item of this menu.
[ public, const ]
SFXMarginConstRef GetItemMargin(Void);

Description

This function gets the margin between the border and the text of the item of this menu.

This margin region is filled in the bevel color set with the SFZTextMenu::SetBevelColor function.

Reference

SFZTextMenu::SetItemMargin | SFZTextMenu::GetBevelColor | SFXMargin | SFXBevelColor


SFZTextMenu::GetItemSubMenu
Get the sub menu for the specified item of this menu.
[ public ]
SFZTextMenuSmp GetItemSubMenu(
    SInt16 index   // index of item
);

Return value

  • If the specified item has a sub menu: pointer to the sub menu
  • Otherwise: a null pointer

Reference

SFZTextMenu::SetItemSubMenu


SFZTextMenu::GetItemText
Get the text of the specified item of this menu.
[ public, const ]
SFXWideStringConstRef GetItemText(
    SInt16 index   // index of item
);

Description

This function gets the text of the specified item of this menu.

Reference

SFZTextMenu::SetItemText


SFZTextMenu::GetMenuStyle
Get the menu style of this menu.
[ public, const ]
MenuStyleEnum GetMenuStyle(Void);

Return value

  • If paging style: SFZTextMenu::PAGE_STYLE
  • Otherwise: SFZTextMenu::SCROLLABLE_STYLE

Description

This function gets the menu style of this menu.

Reference

SFZTextMenu::SetMenuStyle | SFZTextMenu::MenuStyleEnum


SFZTextMenu::GetRootMenu
Get the root menu of this menu.
[ public ]
SFZTextMenuSmp GetRootMenu(Void);

Return value

Root menu of this menu[The parent menu at the highest position is called "Root menu".]

Description

This function gets the root menu of this menu.

[Tip] Tip
To close a menu which has a parent menu, call only the SFYResponder::Terminate function of its root menu gotten by calling this function.

Reference

SFYResponder::Terminate


SFZTextMenu::GetSelBackColor
Get the background color of selected item of this menu.
[ public, const ]
SFXRGBColorConstRef GetSelBackColor(Void);

Description

This function gets the background color(SFXRGBColor) of selected item of this menu.

Reference

SFZTextMenu::SetSelBackColor | SFXRGBColor


SFZTextMenu::GetSelForeColor
Get the foreground color of selected item of this menu.
[ public, const ]
SFXRGBColorConstRef GetSelForeColor(Void);

Description

This function gets the foreground color(SFXRGBColor) of selected item of this menu.

Reference

SFZTextMenu::SetSelForeColor | SFXRGBColor


SFZTextMenu::GetSelect
Get the index of currently selected item of this menu.
[ public, const ]
SInt16 GetSelect(Void);

Return value

Index of currently selected item.

Description

This function gets the index of currently selected item of this menu.

Reference

SFZTextMenu::SetSelect


SFZTextMenu::GetTitle
Get the title of this menu.
[ public, const ]
SFXWideStringConstRef GetTitle(Void);

Return value

Menu title.

Description

This function gets the title of this menu.

Reference

SFZTextMenu::SetTitle


SFZTextMenu::GetTitleBackColor
Get the background color of the title of this menu.
[ public, const ]
SFXRGBColorConstRef GetTitleBackColor(Void);

Return value

Background color (SFXRGBColor) to fill the rectangle containing the title.

Description

This function gets the background color(SFXRGBColor) of the title of this menu, in which the rectangle containing the title is filled.

Reference

SFZTextMenu::SetTitleBackColor | SFXRGBColor


SFZTextMenu::GetTitleForeColor
Get the foreground color of the title of this menu.
[ public, const ]
SFXRGBColorConstRef GetTitleForeColor(Void);

Return value

Foreground color (SFXRGBColor) of the title.

Description

This function gets the foreground color(SFXRGBColor) of the title of this menu, in which the title is drawn.

Reference

SFZTextMenu::SetTitleForeColor | SFXRGBColor


SFZTextMenu::GetTitleHeight
Get the height of the title of this menu.
[ public, const ]
SInt16 GetTitleHeight(Void);

Return value

Height of the title.

Description

This function gets the height of the title of this menu.

Reference

SFZTextMenu::SetTitleHeight


SFZTextMenu::HandleBoundReal
This function will be called when the real region is changed.
[ protected, virtual ]
Void HandleBoundReal(Void);

Description

This function will be called when the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_REAL) event is received.

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

The default implementation is as follows:

  1. Equalize the virtual region with the real region.
  2. Calculate the number of the items which can be displayed in the real region.
  3. Register this menu into the redraw region.
[Note] Sending the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_REAL) event

The (SFEVT_RESPONDER_BOUND, SFP16_BOUND_REAL) event will occur when the real region is changed by calling the SFYResponder::SetRealBound function.

[Note] Processing when the real region is changed

Other than overriding this virtual function, there is another method to define and implement the handler for the region event[XANDLER_DECLARE_VOIDBOUND], and register it into the responder.

In the processing when the real region is updated, this virtual function is executed first, and next the handlers for the region event are executed in the registered order.

Internal Implementation

Internal implementation of the SFZTextMenu::HandleBoundReal function is as follows:

/*protected virtual */Void SFZTextMenu::HandleBoundReal(Void)
{
    SetVirtualBound(SFXRectangle(SFXGrid::ZeroInstance(), GetRealBound().GetSize()));
    if (_itemHeight != 0) {
        _field = (GetLocalBound().GetHeight() - _titleHeight) / _itemHeight;
    }
    Invalidate();
    return;
}// SFZTextMenu::HandleBoundReal //

Reference

SFYResponder::SetRealBound | SFXEvent | Real Region | Virtual Region | Region Event[SFEVT_RESPONDER_BOUND] | Handler for the Region Event[XANDLER_DECLARE_VOIDBOUND]


SFZTextMenu::HandleBoundVirtual
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.]
[ protected, virtual ]
Void HandleBoundVirtual(Void);

Description

This function will be called when the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_VIRTUAL) event is received.

In case you want to perform your own processing when the virtual region is changed, override this virtual function.

The default implementation is to equalize the virtual region with the real region.

[Note] Sending the (SFEVT_RESPONDER_BOUND, SFP16_BOUND_VIRTUAL) event

The (SFEVT_RESPONDER_BOUND, SFP16_BOUND_VIRTUAL) event will occur when the virtual region is changed by calling the SFYResponder::SetRealBound or SFYResponder::SetVirtualBound function.

[Note] Another method when the virtual region is changed

Other than overriding this virtual function, it is possible to define and implement the handler for region event[XANDLER_DECLARE_VOIDBOUND], and register it into the responder.

In the processing when the virtual region is updated, this virtual function is executed first, and next the handlers for region event are executed in the registered order.

In almost all cases, the method to override this virtual function is adopted since defining, implementing and registering the handler for region event can be omitted.

Internal Implementation

Internal implementation of the SFZTextMenu::HandleBoundVirtual function is as follows:

/*protected virtual */Void SFZTextMenu::HandleBoundVirtual(Void)
{
    SetVirtualBound(SFXRectangle(SFXGrid::ZeroInstance(), GetRealBound().GetSize()));
    return;
}// SFZTextMenu::HandleBoundVirtual //

Reference

SFYResponder::SetRealBound | SFXEvent | Real Region | Virtual Region | Region Event[SFEVT_RESPONDER_BOUND] | Handler for the Region Event[XANDLER_DECLARE_VOIDBOUND]


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

Description

This function will be called when the SFEVT_KEY event(key event[SFEVT_KEY]) of the ESCAPE key set with the SFYMenu::SetEscapeKey function is received.

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

The default implementation is as follows:

  1. If this menu has any parent menu, return to it.
  2. Otherwise send the result event [SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_ESCAPE, 0)].

Internal Implementation

Internal implementation of the SFZTextMenu::HandleEscapeKey function is as follows:

/*protected virtual */Void SFZTextMenu::HandleEscapeKey(Void)
{
    if (HasParentMenu()) {
 SetState(false, false, false, false);
 SFZTextMenuSmp parent(static_pointer_cast<SFZTextMenu>(GetParent()));
        if (parent != null) {
            parent->SetState(true, true, true, true);
            parent->ToFront();
        }
    }
    else {
        InvokeForward(SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_ESCAPE, 0), false);
    }
    return;
}// SFZTextMenu::HandleEscapeKey //

Reference

SFYMenu::SetEscapeKey | SFXEvent | Result Event[SFEVT_RESPONDER_RESULT] | Key Event[SFEVT_KEY]


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

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

The default implementation is as follows:

  1. If the enable flag of selected item is set to "false" using the SFZTextMenu::SetItemEnable function, nothing will happen.
  2. If the enable flag of selected item is set to "true" and the item has a sub menu, the sub menu will be moved foremost, all its states will be set to "true", and the first item will be selected.
  3. If the enable flag of selected item is set to "true" and the item has no sub menu, the result event of SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, index of item) will be sent.

Internal Implementation

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

enum CodeEnum {
    CODE_TYPE                           = four_char_code('m', 't', 'm', 'n')
};

/*protected virtual */Void SFZTextMenu::HandleOperateKey(Void)
{
    MenuItemPtr                                 item;
    SFZTextMenuSmp                              subMenu;

    item = GetMenuItem(_selectedItem);
    if (item != null && item->enable) {
        if (item->subMenu != null) {
            subMenu = item->subMenu;
            subMenu->SetState(true, true, true, true);
            subMenu->SetMenuStyle(GetMenuStyle());
            subMenu->SetSelect(0);
            subMenu->ToFront();
        }
        else {
            InvokeForward(SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, GetSelect()), false);
        }
    }
    return;
}// SFZTextMenu::HandleOperateKey //

Reference

SFYMenu::SetOperateKey | SFZTextMenu::SetItemEnable | SFXEvent | key event[SFEVT_KEY] | Result Event[SFEVT_RESPONDER_RESULT] | Key Event[SFEVT_KEY]


SFZTextMenu::HandleRenderRequest
This function will be called when the (SFEVT_RESPONDER_RENDER, SFP16_RENDER_REQUEST) event is received. [Draw this menu.]
[ protected, virtual, const ]
Void HandleRenderRequest(
    SFXGraphicsPtr graphics   // graphic object
);

Description

This function will be called when the (SFEVT_RESPONDER_RENDER, SFP16_RENDER_REQUEST) event is received.

In case you want to perform your own drawing of this responder, override this function.

The default implementation is to draw this menu.

[Note] The method to darw a responder

In addition to overriding this virtual function, it is possible to define and implement the handler for drawing event(drawing handler)[XANDLER_DECLARE_VOIDRENDER], and register it into the responder.

Then, the overridden virtual function will be called first, and next the drawing handlers registered into the responder will be booted up in the registered order.

In almost all cases, the method to override this function is used to draw the responder since there is no need to declare and register the drawing handler.

[Note] Procedure of drawing a responder

The drawing handler will be booted up when the drawing event(SFEVT_RESPONDER_RENDER) occurs. And then the drawing handler draw the responder actually.

The drawing event will be sent to only the responders including the region to be redrawn out of the redraw regions registered into the renderer using the SFYResponder::InvokeBackward function after the SFYResponder::Render function boots up the renderer.

Here, the SFYResponder::Render function will be called at the following situations:

  1. At the end of the event loop
  2. At the applet start / resume or the end of a highest priority event handler
  3. In the callback, which is outside the event loop.

If calling the SFYResponder::Render function with specifying "true" as an argument, the drawing event will be sent to all the responders to be actually displayed on the screen which are located below the responder in the responder tree, regardless of the registration of redraw region.

Internal Implementation

Internal implementation of the SFZTextMenu::HandleRenderRequest function is as follows:

enum MenuStyleEnum {
    PAGE_STYLE                          = 0,
    SCROLLABLE_STYLE,
    DEFAULT_STYLE                       = PAGE_STYLE
};

/*protected virtual */Void SFZTextMenu::HandleRenderRequest(SFXGraphicsPtr graphics) const
{
    DrawMenu(graphics);
    return;
}// SFZTextMenu::HandleRenderRequest //

/*private */Void SFZTextMenu::DrawMenu(SFXGraphicsPtr graphics) const
{
    SFXRectangle                                menuRect(GetLocalBound());
    SFXRectangle                                titleRect;
    SFXRectangle                                pageRect;
    SFXRectangle                                contentRect;
    SFXRectangle                                temp;
    SInt32                                      pageSize;
    SInt32                                      pageNumber;
    SInt32                                      pageCount;

    graphics->FillBevelRectangle(menuRect, _color.bevel);
    titleRect = menuRect;
    titleRect.SetHeight(_titleHeight);
    pageRect = titleRect;
    pageRect.AddLeft(pageRect.GetWidth() - 2 - SFXGraphics::MeasureSingleText(AEE_FONT_NORMAL, "9/9"));
    contentRect = menuRect;
    contentRect.AddTop(_titleHeight);
    pageSize = _field;
    contentRect.SetHeight(static_cast<SInt16>(_itemHeight * pageSize));
    menuRect.SetHeight(_titleHeight + contentRect.GetHeight());
    graphics->SetFont(_font);
    temp = titleRect;
    temp.Deflate(1, 1);
    graphics->FillRectangle(temp, _color.titleBack);
    graphics->SetFont(_font);
    graphics->DrawSingleText(_title, titleRect.GetOrigin() + SFXGrid(2, 2), titleRect, _color.titleFore);
    if (_style == PAGE_STYLE) {
        if (pageSize != 0) {
            pageNumber = Ceil(_selectedItem + 1, pageSize);
            pageCount = Ceil(GetItemCount(), pageSize);
            pageNumber = (pageCount == 0) ? 0 : pageNumber;
            graphics->SetFont(_font);
            graphics->DrawSingleText(SFXAnsiString::Format("%d/%d", pageNumber, pageCount), pageRect.GetOrigin() + SFXGrid(0, 2), pageRect, _color.titleFore, IDF_ALIGN_CENTER);
            DrawPage(graphics, contentRect, pageSize, pageNumber);
        }
    }
    else if (_style == SCROLLABLE_STYLE) {
        pageRect.AddLeft(_itemHeight);
        DrawPage(graphics, contentRect, pageRect);
    }
    return;
}// SFZTextMenu::DrawMenu //

/*private */Void SFZTextMenu::DrawPage(SFXGraphicsPtr graphics, SFXRectangleConstRef rect, SInt32 pageSize, SInt32 pageNumber) const
{
    SInt32                                      i;
    SInt32                                      firstIndex;
    MenuItemPtr                                 item;
    SFXRectangle                                contentRect(rect);
    SFXRectangle                                itemRect;

    firstIndex = (pageNumber - 1) * pageSize;
    contentRect.SetHeight(_itemHeight);
    for (i = firstIndex; i < firstIndex + pageSize; ++ i) {
        if ((item = GetMenuItem(i)) != null) {
            itemRect = contentRect;
            itemRect.Deflate(_itemMargin);
            DrawItem(graphics, itemRect, item);
            contentRect.AddY(_itemHeight);
        }
        else {
            break;
        }
    }
    return;
}// SFZTextMenu::DrawPage //

/*private */Void SFZTextMenu::DrawPage(SFXGraphicsPtr graphics, SFXRectangleConstRef rect, SFXRectangleConstRef scroll) const
{
    SInt32                                      i;
    MenuItemPtr                                 item;
    SFXRectangle                                upRect(scroll);
    SFXRectangle                                downRect;
    SFXRectangle                                contentRect(rect);
    SFXRectangle                                itemRect;

    upRect.SubBottom(upRect.GetHeight() / 2);
    upRect.Deflate(1, 1);
    downRect = upRect;
    //downRect.AddY(upRect.GetHeight() + 1);
    downRect.Offset(0, upRect.GetHeight() + 2);
    if (_selectedItem > 0) {
        DrawTriangle(graphics, upRect, _color.selFore, 0);
    }
    if (_selectedItem < GetItemCount() - 1) {
        DrawTriangle(graphics, downRect, _color.selFore, 1);
    }
    contentRect.SetHeight(_itemHeight);
    for (i = 0; i < _field; ++ i) {
        if ((item = GetMenuItem(i + _topIndex)) != null) {
            itemRect = contentRect;
            itemRect.Deflate(_itemMargin);
            DrawItem(graphics, itemRect, item);
            contentRect.AddY(_itemHeight);
        }
        else {
            break;
        }
    }
    return;
}// SFZTextMenu::DrawPage //

/*private */Void SFZTextMenu::DrawItem(SFXGraphicsPtr graphics, SFXRectangleConstRef rect, MenuItemPtr item) const
{
    SFXRectangle                                itemRect(rect);
    SFXRectangle                                iconRect;
    SFXRectangle                                imageRect;
    SFXRGBColor                                 itemColor(item->foreColor);

    if (item == GetMenuItem(_selectedItem)) {
        graphics->FillRectangle(itemRect, _color.selBack);
        itemColor.Set(_color.selFore);
    }
    else {
        graphics->FillRectangle(itemRect, item->backColor);
    }
    if (!item->enable) {
        itemColor = DiffLightness(item->backColor);
    }
    if (item->subMenu != null) {
        iconRect = itemRect;
        iconRect.Deflate(iconRect.GetWidth() - iconRect.GetHeight() / 3, 0, -1, 0);
        iconRect.Deflate(0, iconRect.GetHeight() / 3 + 1, 0, 0);
        DrawTriangle(graphics, iconRect, itemColor, 2);
        itemRect.SubRight(iconRect.GetWidth() + 1);
    }
    if (item->keyIcon != 0) {
        iconRect = itemRect;
        iconRect.SetWidth(_itemHeight);
        itemRect.AddLeft(_itemHeight);
        graphics->SetFont(_font);
        graphics->DrawSingleText(SFXWideString(item->keyIcon), iconRect, itemColor, IDF_ALIGN_LEFT);
    }
    if (item->image != null) {
        imageRect = itemRect;
        imageRect.SetWidth(_itemHeight);
        itemRect.AddLeft(_itemHeight);
        AEEImageInfo  info;
 SInt16 dx;
 SInt16 dy;
        item->image->GetInfo(&info);
        if (info.cx > 0 && info.cy > 0) {
            dx = (imageRect.GetWidth() - info.cx) / 2;
            dy = (imageRect.GetHeight() - info.cy) / 2;
            imageRect.SetSize(info.cx, info.cy);
            graphics->DrawImage(item->image, imageRect.GetOrigin() + SFXGrid(dx, dy));
        }
    }
    graphics->SetFont(_font);
    graphics->DrawSingleText(item->text, itemRect, itemColor, IDF_ALIGN_LEFT);
    return;
}// SFZTextMenu::DrawItem //

/*private */Void SFZTextMenu::DrawTriangle(SFXGraphicsPtr graphics, SFXRectangleConstRef rect, SFXRGBColorConstRef color, SInt16 direction) const
{
    SFXTriangle                                 triangle;
    SInt16                                      width((rect.GetWidth() / 4) * 2);
    SFXPixel                                    pixel;

    switch (direction) {
        case 0: //up
            pixel.Set(rect.GetVertexLeftBottom());
            triangle.SetFirst(pixel);
            pixel.Offset(width, 0);
            triangle.SetSecond(pixel);
            pixel.Offset(0 - width / 2, 0 - width / 2);
            triangle.SetThird(pixel);
            break;
        case 1: //down
            pixel.Set(rect.GetVertexLeftTop());
            triangle.SetFirst(pixel);
            pixel.Offset(width, 0);
            triangle.SetSecond(pixel);
            pixel.Offset(0 - width / 2, width / 2);
            triangle.SetThird(pixel);
            break;
        case 2: //right
            pixel.Set(rect.GetVertexLeftTop());
            triangle.SetFirst(pixel);
            pixel.Offset(0, width * 2);
            triangle.SetSecond(pixel);
            pixel.Offset(width, 0 - width);
            triangle.SetThird(pixel);
            break;
        default:
            break;
    }
    graphics->SetForeColor(color);
    graphics->SetFillColor(color);
    graphics->SetFillMode(true);
    graphics->DrawTriangle(triangle);
    return;
}// SFZTextMenu::DrawTriangle //

Reference

SFYResponder::Invalidate | SFYResponder::Render | SFYResponder::InvokeBackward | SFXEvent | Drawing Event[SFEVT_RESPONDER_RENDER] | Handler for the Drawing Event[XANDLER_DECLARE_VOIDRENDER] | Rendering | Event Loop | Responder Tree


SFZTextMenu::HandleSelectDownKey
This function will be called when the DOWN key is pressed.
[ protected, virtual ]
Void HandleSelectDownKey(Void);

Description

This function will be called when the SFEVT_KEY event(key event[SFEVT_KEY]) of the DOWN key set with the SFYMenu::SetSelectDownKey function is received.

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

The default implementation is as follows:

In case of the paging style

  1. If currently selected item is the last item of all pages, nothing will occur.
  2. If currently selected item is the last item of the page, the first item of the next page will be set to the selected item
  3. If currently selected item is not the last item of the page, the next item of the same page will be set to the selected item

In case of the scrollable style

  1. If currently selected item is the last item, nothing will occur.
  2. If currently selected item is not at the last row, the next row will be set to the selected item

Internal Implementation

Internal implementation of the SFZTextMenu::HandleSelectDownKey function is as follows:

enum MenuStyleEnum {
    PAGE_STYLE                          = 0,
    SCROLLABLE_STYLE,
    DEFAULT_STYLE                       = PAGE_STYLE
};

/*protected virtual */Void SFZTextMenu::HandleSelectDownKey(Void)
{
    if (_selectedItem < GetItemCount() - 1) {
        ++_selectedItem;
    }
    else if (_style == PAGE_STYLE && _selectedItem == GetItemCount() - 1) {
        _selectedItem = 0;
    }
    RefreshMenu();
    return;
}// SFZTextMenu::HandleSelectDownKey //

/*private */Void SFZTextMenu::RefreshMenu(Void)
{
    if (_style == SCROLLABLE_STYLE) {
        if (_field > 0 && _selectedItem >= 0 && _selectedItem < GetItemCount()) {
            if (_topIndex > GetItemCount() - _field) {
                _topIndex = GetItemCount() - _field;
            }
            if (_topIndex < 0) {
                _topIndex = 0;
            }
            if (_topIndex > _selectedItem) {
                _topIndex = _selectedItem;
            }
            else if (_topIndex < _selectedItem - _field + 1)  {
                _topIndex = _selectedItem - _field + 1;
            }
        }
    }
    Invalidate();
    return;
}// SFZTextMenu::RefreshMenu

Reference

SFYMenu::SetSelectDownKey | SFXEvent | Key Event[SFEVT_KEY]


SFZTextMenu::HandleSelectLeftKey
This function will be called when the LEFT key is pressed.
[ protected, virtual ]
Void HandleSelectLeftKey(Void);

Description

This function will be called when the SFEVT_KEY event(key event[SFEVT_KEY]) of the LEFT key set with the SFYMenu::SetSelectLeftKey function is received.

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

The default implementation is as follows:

  1. If this menu has no parent menu, nothing will occur.
  2. Otherwise, the parent menu will be moved foremost.

Internal Implementation

Internal implementation of the SFZTextMenu::HandleSelectLeftKey function is as follows:

/*protected virtual */Void SFZTextMenu::HandleSelectLeftKey(Void)
{
    if (HasParentMenu()) {
 SetState(false, false, false, false);
 SFYResponderSmp parent = GetParent();
        if (parent != null) {
            parent->SetState(true, true, true, true);
            parent->ToFront();
        }
    }
    return;
}// SFZTextMenu::HandleSelectLeftKey //

Reference

SFYMenu::SetSelectLeftKey | SFXEvent | Key Event[SFEVT_KEY]


SFZTextMenu::HandleSelectRightKey
This function will be called when the RIGHT key is pressed.
[ protected, virtual ]
Void HandleSelectRightKey(Void);

Description

This function will be called when the SFEVT_KEY event(key event[SFEVT_KEY]) of the RIGHT key set with the SFYMenu::SetSelectRightKey function is received.

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

The default implementation is as follows:

  1. If no sub menu is bound with currently selected item, nothing will occur.
  2. Otherwise, all the states of the sub menu will be set to "true", the first item will be selected, and it will be moved foremost.

Internal Implementation

Internal implementation of the SFZTextMenu::HandleSelectRightKey function is as follows:

/*protected virtual */Void SFZTextMenu::HandleSelectRightKey(Void)
{
    MenuItemPtr                                 item;
    SFZTextMenuSmp                              subMenu;

    if ((item = GetMenuItem(_selectedItem)) != null) {
        if (item->subMenu != null && item->enable) {
            subMenu = item->subMenu;
            subMenu->SetState(true, true, true, true);
            subMenu->SetMenuStyle(GetMenuStyle());
            subMenu->SetSelect(0);
            subMenu->ToFront();
        }
    }
    return;
}// SFZTextMenu::HandleSelectRightKey //

Reference

SFYMenu::SetSelectRightKey | SFXEvent | Key Event[SFEVT_KEY]


SFZTextMenu::HandleSelectUpKey
This function will be called when the UP key is pressed.
[ protected, virtual ]
Void HandleSelectUpKey(Void);

Description

This function will be called when the SFEVT_KEY event(key event[SFEVT_KEY]) of the UP key set with the SFYMenu::SetSelectUpKey function is received.

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

In case of the paging style

  1. If currently selected item is the first item of all pages, nothing will occur.
  2. If currently selected item is the first item of the page, the last item of the previous page will be set to the selected item
  3. If currently selected item is not the first item of the page, the previous item of the same page will be set to the selected item

In case of the scrollable style

  1. If currently selected item is the first item, nothing will occur.
  2. If currently selected item is not at the first item, the previous item will be set to the selected item

Internal Implementation

Internal implementation of the SFZTextMenu::HandleSelectUpKey function is as follows:

enum MenuStyleEnum {
    PAGE_STYLE                          = 0,
    SCROLLABLE_STYLE,
    DEFAULT_STYLE                       = PAGE_STYLE
};

/*protected virtual */Void SFZTextMenu::HandleSelectUpKey(Void)
{
    if (_selectedItem > 0) {
        --_selectedItem;
    }
    else if (_style == PAGE_STYLE && _selectedItem == 0) {
        _selectedItem = GetItemCount() - 1;
        if (_selectedItem < 0) {
            _selectedItem = 0;
        }
    }
    RefreshMenu();
    return;
}// SFZTextMenu::HandleSelectUpKey //

/*private */Void SFZTextMenu::RefreshMenu(Void)
{
    if (_style == SCROLLABLE_STYLE) {
        if (_field > 0 && _selectedItem >= 0 && _selectedItem < GetItemCount()) {
            if (_topIndex > GetItemCount() - _field) {
                _topIndex = GetItemCount() - _field;
            }
            if (_topIndex < 0) {
                _topIndex = 0;
            }
            if (_topIndex > _selectedItem) {
                _topIndex = _selectedItem;
            }
            else if (_topIndex < _selectedItem - _field + 1)  {
                _topIndex = _selectedItem - _field + 1;
            }
        }
    }
    Invalidate();
    return;
}// SFZTextMenu::RefreshMenu

Reference

SFYMenu::SetSelectUpKey | SFXEvent | Key Event[SFEVT_KEY]


SFZTextMenu::HasParentMenu
Check whether or not this menu has any parent menu.
[ public, const ]
Bool HasParentMenu(Void);

Return value

  • If this menu has a parent menu: true
  • Otherwise: false

Description

This fucntion checks whether or not this menu has any parent menu.

Reference

SFZTextMenu::HandleEscapeKey | SFZTextMenu::HandleSelectLeftKey | SFZTextMenu::GetRootMenu


SFZTextMenu::Insert
Insert the specified item before the specified index.
[ public ]
SFCError Insert(
    SInt32 index           // index of item
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
);
[ public ]
SFCError Insert(
    SInt32 index           // index of item
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
    AVKType key            // access key
    WChar keyIcon          // key icon
);
[ public ]
SFCError Insert(
    SInt32 index                 // index of item
    SFXWideStringConstRef text   // text
);
[ public ]
SFCError Insert(
    SInt32 index                 // index of item
    SFXWideStringConstRef text   // text
    AVKType key                  // access key
    WChar keyIcon                // key icon
);

Return value

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

Description

This function inserts the specified item before the specified index.

If the value of the specified index is less than or equals 0, the item will be inserted at the head.

If the value of the specified index is greater than or equals the number of items, the item will be inserted at the tail.

Reference

SFZTextMenu::InsertFirst | SFZTextMenu::InsertLast | SFZTextMenu::Remove


SFZTextMenu::InsertFirst
Insert the specified item at the head.
[ public ]
SFCError InsertFirst(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
);
[ public ]
SFCError InsertFirst(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
    AVKType key            // access key
    WChar keyIcon          // key icon
);
[ public ]
SFCError InsertFirst(
    SFXWideStringConstRef text   // text
);
[ public ]
SFCError InsertFirst(
    SFXWideStringConstRef text   // text
    AVKType key                  // access key
    WChar keyIcon                // key icon
);

Return value

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

Description

This function inserts the specified item at the head.

Reference

SFZTextMenu::Insert | SFZTextMenu::InsertLast | SFZTextMenu::RemoveFirst


SFZTextMenu::InsertLast
Insert the specified item at the tail.
[ public ]
SFCError InsertLast(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
);
[ public ]
SFCError InsertLast(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
    AVKType key            // access key
    WChar keyIcon          // key icon
);
[ public ]
SFCError InsertLast(
    SFXWideStringConstRef text   // text
);
[ public ]
SFCError InsertLast(
    SFXWideStringConstRef text   // text
    AVKType key                  // access key
    WChar keyIcon                // key icon
);

Return value

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

Description

This function inserts the specified item at the tail.

Reference

SFZTextMenu::Insert | SFZTextMenu::InsertFirst | SFZTextMenu::RemoveLast


SFZTextMenu::NewInstance
Create a new instance of this responder class.
[ public, static ]
SFZTextMenuSmp NewInstance(
    SFCErrorPtr exception = null   // error value
);

Argument

exception

Return the error value generated inside the function.

Return value

  • If succeeds: not null pointer
  • Otherwise: null pointer

Description

This function creates a new instance of this responder class.

If succeeds, a not null pointer will be returned, and the "exception" argument is SFERR_NO_ERROR. If fails such as insufficient memory, a null pointer will be returned, and the "exception" argument holds the error value.

Example

The code to create a new instance of this responder class is as follows:

SFZTextMenuSmp _textmenu;
SFCError error;

if ((_textmenu = SFZTextMenu::NewInstance(&error)) != null) {

    ...
}

SFZTextMenu::Remove
Remove specified items from this text menu.
[ public ]
Void Remove(
    SInt32 index   // index of item to delete
);
[ public ]
Void Remove(
    SInt32 begin   // beginning index to remove(this index is included)
    SInt32 end     // ending index to remove(this index is not included)
);
-->

Description

This function removes the item at the specified index or the items in the specified index range from this text menu.

If the specified index is less than 0 or greater than or equals the number of items, no item will be removed

If the beginning index to remove is greater than or equals the number of items or the ending index to remove is less than or equals 0, no item will be removed

If the beginning index to remove is less than or equals 0, it will be reset to 0.

If the ending index to remove is greater than the number of items, it will be reset to the number of items.

Example

SFZTextMenuSmp    menu;

// create instance etc. 

       ...

// insert item at the tail
if (menu->InsertLast("0 index") == SFERR_NO_ERROR) {
    // insert item at the tail
    if (menu->InsertLast("1 index") == SFERR_NO_ERROR) {
        // insert item at the tail
        if (menu->InsertLast("2 index") == SFERR_NO_ERROR) {
            // insert item at the tail
            if (menu->InsertLast("3 index") == SFERR_NO_ERROR) {
                // select "2 index" item
                menu->SetSelect(2);

                ////////////////////////////
                // state of menu          //
                // 0: "0 index"           //
                // 1: "1 index"           //
                // 2: "2 index" <---***//
                // 3: "3 index"           //
                ////////////////////////////

                // remove items from "1 index" to "2 index"
                menu->Remove(1, 3);

                ////////////////////////////
                // state of menu          //
                // 0: "0 index"           //
                // 1: "3 index" <---***//
                ////////////////////////////
            }
        }
    }
}

Reference

SFZTextMenu::Clear | SFZTextMenu::Remove | SFZTextMenu::RemoveLast | SFZTextMenu::Insert


SFZTextMenu::RemoveFirst
Remove the first item from this text menu.
[ public ]
Void RemoveFirst(Void);

Description

This function removes the first item from this text menu.

Reference

SFZTextMenu::Clear | SFZTextMenu::Remove | SFZTextMenu::RemoveLast | SFZTextMenu::InsertFirst


SFZTextMenu::RemoveItem
[DEPRECATED]Remove the specified item from this text menu. Use the Remove() function.
[ public ]
Void RemoveItem(
    SInt16 index   // index of item
);

Description

This function removes the item at the specified index from this text menu.

If the specified index is less than 0 or greater than or equals the number of items, no item will be removed

[Caution] Caution
Since this function is deprecated, use the SFZTextMenu::Remove function instead.

Reference

SFZTextMenu::Remove | SFZTextMenu::AppendItem


SFZTextMenu::RemoveLast
Remove the last item from this text menu.
[ public ]
Void RemoveLast(Void);

Description

This function removes the last item from this text menu.

Reference

SFZTextMenu::Clear | SFZTextMenu::Remove | SFZTextMenu::RemoveFirst | SFZTextMenu::InsertLast


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

Description

This function sets the bevel color(SFXBevelColor) for the outer frame of this menu to draw this menu in the 3D style to the specified value.

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

Reference

SFZTextMenu::GetBevelColor | SFXBevelColor | SFXRGBColor


SFZTextMenu::SetDefaultItemBackColor
Set the default background color of unselected item of this menu to the specified value.
[ public ]
Void SetDefaultItemBackColor(
    SFXRGBColorConstRef param   // default background color to set
);

Description

This function sets the default background color(SFXRGBColor) of unselected item of this menu to the specified value.

Default: SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00)[white color]

[Note] Default background color of unselected item

The default background color of unselected item can be changed using the SFZTextMenu::SetItemBackColor function.

If you want to make the background color of unselected item be the same one, the background color needs to be set using this function. The SFZTextMenu::SetItemBackColor function to set it individually is not recommended.

However, the background color of selected item is always the one set with the SFZTextMenu::SetSelBackColor function.

Reference

SFZTextMenu::GetDefaultItemBackColor | SFZTextMenu::SetDefaultItemForeColor | SFZTextMenu::SetItemBackColor | SFZTextMenu::SetSelBackColor | SFZTextMenu::SetItemEnable


SFZTextMenu::SetDefaultItemForeColor
Set the default foreground color of unselected item of this menu to the specified value.
[ public ]
Void SetDefaultItemForeColor(
    SFXRGBColorConstRef param   // default foreground color to set
);

Description

This function sets the default foreground color(SFXRGBColor) to draw the text of unselected item of this menu to the specified value.

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

[Note] Default foreground color of unselected item

The default foreground color of unselected item can be changed using the SFZTextMenu::SetItemForeColor function.

If you want to make the foreground color of all unselected items be the same one, the foreground color needs to be set using this function. The SFZTextMenu::SetItemForeColor function to set it individually is not recommended.

However, the foreground color of selected item is always the one set with the SFZTextMenu::SetSelForeColor function, except when the enable flag of the item is set to "false" using the SFZTextMenu::SetItemEnable function.

[Note] Foreground color of unselected item when the enable flag of the item is set to "false"

If the enable flag of the item is set to "false" using the SFZTextMenu::SetItemEnable function, the text will not be drawn in the foreground color of this item set with this function.

In this case, the foreground color will be the color subtracted 0x33 from each RGB value of the background color of this item if the brightness of background color is bigger than 0x7F, otherwise it will be the color added 0x33 on each RGB value of the background color of this item.

The brightness of color is the value obtained using the SFXRGBColor::GetBrightness function.

Reference

SFZTextMenu::GetDefaultItemForeColor | SFZTextMenu::SetDefaultItemBackColor | SFZTextMenu::SetItemForeColor | SFZTextMenu::SetSelForeColor | SFZTextMenu::SetItemEnable | SFXRGBColor::GetBrightness | SFXRGBColor


SFZTextMenu::SetFont
Set the font of this menu to the specified value.
[ public ]
Void SetFont(
    AEEFont param   // font to set
);

Description

This function sets the font of this menu to the specified value, which is used to draw the item and the title of this menu.

Default: AEE_FONT_NORMAL.

Reference

SFZTextMenu::GetFont


SFZTextMenu::SetItemAccessKey
Set the access key and the key icon of the specified item of this menu to specified values.
[ public ]
SFCError SetItemAccessKey(
    SInt16 index        // index of item
    AVKType key         // access key
    WChar keyIcon = 0   // key icon
);

Description

This function sets the access key and the key icon of the specified item of this menu to specified values.

[Note] Note
The access key is valid only if the enable flag of the corresponding item is set to "true" using the SFZTextMenu::SetItemEnable function.

Example

The code to set an access key and a key icon for an item is as follows:

// set access key to AVK_1, key icon to 0xFBF6 for first item of _textmenu menu 
_textmenu->SetItemAccessKey(0, AVK_1, 0xFBF6);

Reference

SFZTextMenu::GetItemAccessKey | SFZTextMenu::SetItemEnable


SFZTextMenu::SetItemBackColor
Set the background color of the specified unselected item of this menu to the specified value.
[ public ]
SFCError SetItemBackColor(
    SInt16 index                // index of item
    SFXRGBColorConstRef param   // background color to set
);

Description

This function sets the background color(SFXRGBColor) of the specified unselected item of this menu to the specified value.

Default: The default background color set with the SFZTextMenu::SetDefaultItemBackColor function. SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00)[white color] if the default background color is not set.

[Note] Foreground color of unselected item

For the foreground color of unselected item, refer to SFZTextMenu::SetItemForeColor.

[Note] Foreground color of selected item

For the foreground color of selected item, refer to SFZTextMenu::SetSelForeColor.

[Note] Background color of selected item

For the background color of selected item, refer to SFZTextMenu::SetSelBackColor.

Reference

SFZTextMenu::SetDefaultItemBackColor | SFZTextMenu::GetItemBackColor | SFZTextMenu::SetItemForeColor | SFZTextMenu::SetSelForeColor | SFZTextMenu::SetSelBackColor | SFXRGBColor


SFZTextMenu::SetItemEnable
Set the enable flag of the specified item of this menu to the specified value.
[ public ]
SFCError SetItemEnable(
    SInt16 index   // index of item
    Bool param     // value to set. (true if item is valid, false otherwise)
);

Description

This function sets the enable flag of the specified item of this menu to the specified value.

Default: "true"(The item is valid.)

[Note] When the enable flag of the item is set to "false"

Even if the operation key or the access key is pressed, the result event will not be sent. The sub-menu will not be displayed if it exists.

The foreground color will be the color subtracted 0x33 from each RGB value of the background color of this item if the brightness of background color is bigger than 0x7F, otherwise it will be the color added 0x33 on each RGB value of the background color of this item.

The brightness of color is the value obtained using the SFXRGBColor::GetBrightness function.

Reference

SFZTextMenu::GetItemEnable | SFZTextMenu::HandleOperateKey | SFZTextMenu::SetItemForeColor | Result Event[SFEVT_RESPONDER_RESULT]


SFZTextMenu::SetItemForeColor
Set the foreground color of the specified unselected item of this menu to the specified value.
[ public ]
SFCError SetItemForeColor(
    SInt16 index                // index of item
    SFXRGBColorConstRef param   // foreground color to set
);

Description

This function sets the foreground color(SFXRGBColor) to draw the text of the specified unselected item of this menu to the specified value.

Default: The default foreground color set with the SFZTextMenu::SetDefaultItemForeColor function. SFXRGBColor(0x00, 0x00, 0x00, 0x00)[black color] if the default background color is not set.

[Note] Foreground color of unselected item when the enable flag of the item is set to "false"

If the enable flag of the item is set to "false" using the SFZTextMenu::SetItemEnable function, the text will not be drawn in the foreground color of this item set with this function.

In this case, the foreground color will be the color subtracted 0x33 from each RGB value of the background color of this item if the brightness of background color is bigger than 0x7F, otherwise it will be the color added 0x33 on each RGB value of the background color of this item.

The brightness of color is the value obtained using the SFXRGBColor::GetBrightness function.

[Note] Background color of unselected item

For the background color of unselected item, refer to SFZTextMenu::SetItemBackColor.

[Note] Foreground color of selected item

For the foreground color of selected item, refer to SFZTextMenu::SetSelForeColor.

[Note] Background color of selected item

For the background color of selected item, refer to SFZTextMenu::SetSelBackColor.

Reference

SFZTextMenu::SetDefaultItemForeColor | SFZTextMenu::GetItemForeColor | SFZTextMenu::SetItemBackColor | SFZTextMenu::SetSelForeColor | SFZTextMenu::SetSelBackColor | SFZTextMenu::SetItemEnable | SFXRGBColor::GetBrightness | SFXRGBColor


SFZTextMenu::SetItemHeight
Set the item height of this menu to the specified value. [pixels]
[ public ]
Void SetItemHeight(
    SInt16 param   // value to set
);

Description

This function sets the item height of this menu to the specified value. All items of this menu have the same height value.

Default: font height + 2 [pixels]

Reference

SFZTextMenu::GetItemHeight


SFZTextMenu::SetItemImage
Set the image of the specified item of this menu to the specified value.
[ public ]
SFCError SetItemImage(
    SInt16 index           // index of item
    SFXPathConstRef path   // path to resource file
);
[ public ]
SFCError SetItemImage(
    SInt16 index           // index of item
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
);
[ public ]
SFCError SetItemImage(
    SInt16 index                // index of item
    SFBImageSmpConstRef param   // image
);

Description

This function sets the image of the specified item of this menu to the specified value.

Reference

SFZTextMenu::GetItemImage


SFZTextMenu::SetItemMargin
Set the margin of the item of this menu to the specified value.
[ public ]
Void SetItemMargin(
    SFXMarginConstRef param   // value to set
);

Description

This function sets the margin between the border and the text of the item of this menu to the specified value.

This margin region is filled in the bevel color set with the SFZTextMenu::SetBevelColor function.

Default: SFXMargin(2, 0).

Reference

SFZTextMenu::GetItemMargin | SFZTextMenu::GetBevelColor | SFXMargin | SFXBevelColor


SFZTextMenu::SetItemSubMenu
Set the sub menu of the specified item of this menu to the specified value.
[ public ]
SFCError SetItemSubMenu(
    SInt16 index             // index of item
    SFZTextMenuSmp subMenu   // sub menu
);

Description

This function sets the sub menu of the specified item of this menu to the specified value.

Reference

SFZTextMenu::GetItemSubMenu


SFZTextMenu::SetItemText
Set the text of the specified item of this menu to the specified value.
[ public ]
SFCError SetItemText(
    SInt16 index            // index of item
    SFXPathConstRef index   // path to resource file
    UInt16 id               // object id
);
[ public ]
SFCError SetItemText(
    SInt16 index                  // index of item
    SFXWideStringConstRef param   // text to set
);

Description

This function sets the text of the specified item of this menu to the specified value.

Reference

SFZTextMenu::GetItemText


SFZTextMenu::SetMenuStyle
Set the menu style of this menu to the specified value.
[ public ]
Void SetMenuStyle(
    MenuStyleEnum param   // menu to set
);

Description

This function sets the menu style of this menu to the specified value. Text menu can be set to be the scrollable style (SFZTextMenu::SCROLLABLE_STYLE) or the paging style (SFZTextMenu::PAGE_STYLE).

Default: SFZTextMenu::PAGE_STYLE.

Reference

SFZTextMenu::GetMenuStyle | SFZTextMenu::MenuStyleEnum


SFZTextMenu::SetSelBackColor
Set the background color of selected item of this menu to the specified value.
[ public ]
Void SetSelBackColor(
    SFXRGBColorConstRef param   // background color to set
);

Description

This function sets the background color(SFXRGBColor) of selected item of this menu to the specified value.

Default: SFXRGBColor(0x11, 0x22, 0xBB, 0x00)[blue color]

[Note] Foreground color of selected item

For the foreground color of selected item, refer to SFZTextMenu::SetSelForeColor.

[Note] Foreground color of unselected item

For the foreground color of unselected item, refer to SFZTextMenu::SetItemForeColor.

[Note] Background color of unselected item

For the background color of unselected item, refer to SFZTextMenu::SetItemBackColor.

Reference

SFZTextMenu::GetSelBackColor | SFZTextMenu::SetSelForeColor | SFZTextMenu::SetItemForeColor | SFZTextMenu::SetItemBackColor | SFXRGBColor


SFZTextMenu::SetSelForeColor
Set the foreground color of selected item of this menu to the specified value.
[ public ]
Void SetSelForeColor(
    SFXRGBColorConstRef param   // foreground color to set
);

Description

This function sets the foreground color(SFXRGBColor) of selected item of this menu to the specified value.

Default: SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00)[white color]

[Note] Background color of selected item

For the background color of selected item, refer to SFZTextMenu::SetSelBackColor.

[Note] Foreground color of unselected item

For the foreground color of unselected item, refer to SFZTextMenu::SetItemForeColor.

[Note] Background color of unselected item

For the background color of unselected item, refer to SFZTextMenu::SetItemBackColor.

Reference

SFZTextMenu::GetSelForeColor | SFZTextMenu::SetItemForeColor | SFZTextMenu::SetItemBackColor | SFZTextMenu::SetSelBackColor | SFZTextMenu::SetItemEnable | SFXRGBColor::GetBrightness | SFXRGBColor


SFZTextMenu::SetSelect
Set the index of currently selected item of this menu to the specified value.
[ public ]
Void SetSelect(
    SInt16 param   // index of item to set
);

Description

This function sets the index of currently selected item of this menu to the specified value.

Reference

SFZTextMenu::GetSelect


SFZTextMenu::SetTitle
Set the title of this menu to the specified value.
[ public ]
SFCError SetTitle(
    SFXPathConstRef path   // path to resource file
    UInt16 id              // object id
);
[ public ]
SFCError SetTitle(
    SFXWideStringConstRef param   // text to set
);

Description

This function sets the title of this menu to the specified value.

The title is set by specifying the string as an argument directly, or by reading from the resource file.

Default: ""[null string]

Reference

SFZTextMenu::GetTitle


SFZTextMenu::SetTitleBackColor
Set the background color of the title of this menu to the specified value.
[ public ]
Void SetTitleBackColor(
    SFXRGBColorConstRef param   // value to set
);

Description

This function sets the background color(SFXRGBColor) of the title of this menu to the specified value, in which the rectangle containing the title is filled.

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

Reference

SFZTextMenu::GetTitleBackColor | SFXRGBColor


SFZTextMenu::SetTitleForeColor
Set the foreground color of the title of this menu to the specified value.
[ public ]
Void SetTitleForeColor(
    SFXRGBColorConstRef param   // value to set
);

Description

This function sets the foreground color(SFXRGBColor) of the title of this menu to the specified value, in which the title is drawn.

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

Reference

SFZTextMenu::GetTitleForeColor | SFXRGBColor


SFZTextMenu::SetTitleHeight
Set the height of the title of this menu to the specified value. [pixels]
[ public ]
Void SetTitleHeight(
    SInt16 param   // value to set
);

Description

This function sets the height of the title of this menu to the specified value. If this value is set to "0", the title will be hidden and never drawn.

Default: font height + 2 [pixels]

Reference

SFZTextMenu::GetTitleHeight


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

Reference

SFYResponder::GetType | SFYResponder::SetType


SFZTextMenu::MenuStyleEnum
Constant that represents the enum of the menu style.
enum MenuStyleEnum {
    PAGE_STYLE         = 0,          //  paging style(method of switching pages)
    SCROLLABLE_STYLE,                //  scrollable style
    DEFAULT_STYLE      = PAGE_STYLE  //  Default: paging style
};
SFMTYPEDEFTYPE(MenuStyleEnum)

Reference

SFZTextMenu::SetMenuStyle