PrevNextUpHome SophiaFramework UNIVERSE 5.3

9.14. Dialog(Basic)

Dialog is the responder designed to be placed in the root[SFZRoot].

All dialogs inherit from SFZDialog, which provides functions to scroll the virtual region larger than the real region, move the focus, register the timer processing callback(for more details, see SFZDialog::ScheduleTimer), and handle some key events by default.

For instance, dialogs such as SFZMessageDialog or SFZQuestionDialog are implemented by inheriting from this class.

Though the dialog can be used as the container to place controls like the window, it is used for user to select the result from the temporarily displayed screen.

The concrete dialog is the part class which can be used as it is in the applet development. On the other hand, the abstract dialog is the base class to define and implement the user-defined dialog.

Table 9.14. Type of concrete dialog

Class name Description
SFZDialog General purpose dialog to place controls and/or containers.
SFZMessageDialog Dialog to display a notification message.
SFZQuestionDialog Dialog to display a selection message.
[Important] IMPORTANT

In the concrete dialog, the SFYResponder::SetParent, SFYResponder::SetState, and SFYResponder::SetRealBound functions must be always called.

Other functions are optionally called.

* When a frame is attached to a dialog with the SFYResponder::SetFrame function, calling the SFYResponder::SetRealBound function of the dialog can be omitted by setting the real region of the frame with the SFYResponder::SetRealBound function since that of the dialog will be internally set to the region obtained by deflating it by the frame margin.

[Note] Default background color

In SFZDialog, the default background color set with the SFYWidget::SetBackgroundColor function is the gray color[SFXRGBColor(0xEE, 0xEE, 0xEE,0x00)].

Table 9.15. Type of abstract dialog

Class name Description
SFZDialog Abstract class which represents a dialog.

9.14.1. General Purpose Dialog to Place a Control or Container [SFZDialog]

SFZDialog is the general purpose dialog in which controls and/or containers are placed.

Figure 9.37. Execution Result

Execution Result

When controls and/or containers are placed, the focus can be moved using the scroll key set with the SFYContainer::SetScrollDownKey / SFYContainer::SetScrollUpKey / SFYContainer::SetPageDownKey / SFYContainer::SetPageUpKey / SFYContainer::SetSnapDownKey / SFYContainer::SetSnapUpKey functions.

The virtual region larger than the real region can be scrolled up and down, and the focus can be moved among the child responders of the dialog . At this time, scrolling is performed in cooperation with moving the focus.

In the default implementation, the general purpose dialog[SFZDialog] will receive the following result events[SFEVT_RESPONDER_RESULT].

The developer can register handlers for these events. The default handler closes the dialog only.

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

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

[Note] Note
The timer processing callback scheduled with the SFZDialog::ScheduleTimer function will be canceled automatically when the operation key of the dialog or the ESCAPE key is pressed.
[Note] Default background color

In SFZDialog, the default background color set with the SFYWidget::SetBackgroundColor function is the gray color[SFXRGBColor(0xEE, 0xEE, 0xEE,0x00)].

Example 9.64. Declaration

SFMTYPEDEFCLASS(USRApplication)
class USRApplication: public SFYApplication {
    SFMSEALCOPY(USRApplication)
private:
    SFZDialogSmp _dialog;

    ...
private:
    SFCError Make(Void);

    // result handler
    XANDLER_DECLARE_VOIDRESULT(OnResult)
};

Example 9.65. Implementation

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

    // create the dialog
    if ((_dialog = SFZDialog::NewInstance(&error)) != null) {

        // set the dialog's parent responder to USRApplication
        error = _dialog->SetParent(GetThis());
        if (error == SFERR_NO_ERROR) {

            // register the result handler into the dialog
            error = _dialog->RegisterHandler(
                SFXEventRange(SFEVT_RESPONDER_RESULT, SFEVT_RESPONDER_RESULT, SFP16_BEGIN, SFP16_END),
                XANDLER_INTERNAL(OnResult)
            );
            if (error == SFERR_NO_ERROR) {

                // Calculate the suitable dialog region within the hint region obtained by deflating the screen device region by (20, 20), 
                // which will be aligned at the center and the middle of the hint region.
                // Set the dialog's real region to it.
                _dialog->SetRealBound(_dialog->GetSuitableBound(GetLocalBound().Deflate(10, 10), SFYResponder::HORIZONTAL_CENTER, SFYResponder::VERTICAL_MIDDLE));

                // set the dialog's state to "visible" + "active" + "enable" + "focus" together
                _dialog->SetState(true, true, true, true);

                // move the dialog foremost
                _dialog->ToFront();
            }
        }
    }

    return error;
}

// result handler
XANDLER_IMPLEMENT_VOIDRESULT(USRApplication, OnResult, invoker, reason, result)
{
    // the dialog will be passed via the invoker argument
    // the P16 value of the result event will be passed via the reason argument
    // "0" will be passed via the result argument

    switch (reason) {

        case SFP16_RESULT_OK:

            // when the operation key is pressed

            ...

            break;

        case SFP16_RESULT_ESCAPE:

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

            ...

            break;
    }

    // close the dialog
    invoker->Terminate();
    // or "_dialog->Terminate();"

    return;
}

Figure 9.38. Dialog with a border and/or a title [SFZDialog]


Dialog with a border and/or a title [SFZDialog]

For the sample code to attach a frame with a border and/or a title to a dialog[SFZDialog], see SFZDialog.

9.14.2. Dialog to Display a Notification Message [SFZMessageDialog]

SFZMessageDialog is the dialog to display a notification message, which consists of the icon image, the message text, and the OK button.

Each element can be omitted(it will be omitted if nothing is set with the Set function).

Figure 9.39. Execution Result

Execution Result

The icon image, the message text, and the OK button are internally contained as the SFZImageLabelControl, SFZMultipleTextLabelControl, and SFZTextButtonControl instance respectively. There are the APIs to get these instances.

Since the states of the icon image and the message text are set to "disable", the focus cannot be moved to these objects. The OK button, whose state is set to "enable", will be focused if the focus is moved to the dialog.

If the icon image, the message text, or the button text is not set with the SFZMessageDialog::SetIconImage, SFZMessageDialog::SetMessageText, or SFZMessageDialog::SetButtonText function respectively, it will not be displayed since regarded as omitted.

In the default implementation, the notification message dialog[SFZMessageDialog] will receive the following result events[SFEVT_RESPONDER_RESULT].

The handler for these events can be registered. The default handler closes the dialog only.

The operation key of the dialog is set with the SFZDialog::SetOperateKey function. The operation key of the button for operating the OK button is set with the SFYButtonControl::SetOperateKey function. By default, the operation key of the dialog and the operation key of the button are set to the SELECT key. When the button is displayed, the SELECT key is handled as the operation key of the button.

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

[Note] Note
The timer processing callback scheduled with the SFZDialog::ScheduleTimer function will be canceled automatically when the operation key of the dialog, the ESCAPE key, or the OK button is pressed.
[Note] Operating a dialog with its operation key

If the OK button is omitted or its state is set to "disable", the dialog will be operated by its operation key. In the default implementation, its behaviour is the same as when the OK button is pressed.

That is, if the operation key is pressed, the (SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK) event will be sent, and then the dialog will close. This function is used for the dialog with no button which has only the warning message and is closed with its operation key.

[Note] Default background color

In SFZMessageDialog, the default background color set with the SFYWidget::SetBackgroundColor function is the gray color[SFXRGBColor(0xEE, 0xEE, 0xEE,0x00)].

Example 9.66. Declaration

SFMTYPEDEFCLASS(USRApplication)
class USRApplication: public SFYApplication {
    SFMSEALCOPY(USRApplication)
private:
    SFZMessageDialogSmp _dialog;

    ...
private:
    SFCError Make(Void);

    // result handler
    XANDLER_DECLARE_VOIDRESULT(OnResult)
};

Example 9.67. Implementation

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

    // create the dialog
    if ((_dialog = SFZMessageDialog::NewInstance(&error)) != null) {

        // set the dialog's parent responder to USRApplication
        error = _dialog->SetParent(GetThis());
        if (error == SFERR_NO_ERROR) {

            // register the result handler into the dialog
            error = _dialog->RegisterHandler(
                SFXEventRange(SFEVT_RESPONDER_RESULT, SFEVT_RESPONDER_RESULT, SFP16_BEGIN, SFP16_END),
                XANDLER_INTERNAL(OnResult)
            );
            if (error == SFERR_NO_ERROR) {

                // set the image for the dialog's icon
                // * SFBImage image can be set from the resource file or normal file
                error = _dialog->SetIconImage(SFXPath("resource.bar"), IMAGE_ID);
                if (error == SFERR_NO_ERROR) {

                    // set the text for the dialog's message
                    // * SFXWideString text can be set from the resource file
                    error = _dialog->SetMessageText("hello world\n\nThis is a notification message.");
                    if (error == SFERR_NO_ERROR) {

                        // set the text for the dialog's OK button
                        // * SFXWideString text can be set from the resource file
                        error = _dialog->SetButtonText("OK");
                        if (error == SFERR_NO_ERROR) {

                            // Calculate the suitable dialog region within the hint region obtained by deflating the screen device region by (20, 20), 
                            // which will be aligned at the center and the middle of the hint region.
                            // Set the dialog's real region to it.
                            _dialog->SetRealBound(_dialog->GetSuitableBound(GetLocalBound().Deflate(10, 10), SFYResponder::HORIZONTAL_CENTER, SFYResponder::VERTICAL_MIDDLE));

                            // set the dialog's state to "visible" + "active" + "enable" + "focus" together
                            _dialog->SetState(true, true, true, true);

                            // move the dialog foremost
                            _dialog->ToFront();
                        }
                    }
                }
            }
        }
    }

    return error;
}

// result handler
XANDLER_IMPLEMENT_VOIDRESULT(USRApplication, OnResult, invoker, reason, result)
{
    // the dialog will be passed via the invoker argument
    // the P16 value of the result event will be passed via the reason argument
    // "0" will be passed via the result argument

    switch (reason) {

        case SFP16_RESULT_OK:

            // when the OK button or the operation key is pressed

            ...

            break;

        case SFP16_RESULT_ESCAPE:

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

            ...

            break;
    }

    // close the dialog
    invoker->Terminate();
    // or "_dialog->Terminate();"

    return;
}

Figure 9.40. Dialog with a border and/or a title [SFZMessageDialog]


Dialog with a border and/or a title [SFZMessageDialog]

For the sample code to attach a frame with a border and/or a title to a dialog[SFZMessageDialog], see SFZMessageDialog.

9.14.3. Dialog to Display a Selection Message [SFZQuestionDialog]

SFZQuestionDialog is the dialog to display a selection message, which consists of the icon image, the message text, the ANOTHER button, the OK button, and the CANCEL button.

Each element can be omitted(it will be omitted if nothing is set with the Set function.

Figure 9.41. Execution Result

Execution Result

The icon image, the message text, and the ANOTHER, OK, and CANCEL buttons are internally contained as the SFZImageLabelControl, SFZMultipleTextLabelControl, and SFZTextButtonControl instance respectively. There are the APIs to get these instances.

Since the states of the icon image and the message text are set to "disable", the focus cannot be moved to these objects. The ANOTHER, OK, and CANCEL buttons, whose states are set to "enable", can be focused with the scroll keys set with the SFYContainer::SetScrollUpKey and SFYContainer::SetScrollDownKey functions. When the dialog is first displayed on the device screen, the button set last with the SFZQuestionDialog::SetButtonText function is focused.

If the icon image, the message text, or the button text is not set with the SFZQuestionDialog::SetIconImage, SFZQuestionDialog::SetMessageText, or SFZQuestionDialog::SetButtonText function respectively, it will not be displayed since regarded as omitted.

In the default implementation, the selection message dialog[SFZQuestionDialog] will receive the following result events[SFEVT_RESPONDER_RESULT].

  • Result event [SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, 0)] : This event will occur in the internal handler for the OK button or in the SFZDialog::HandleOperateKey function when the OK button or the operation key of the dialog is pressed.
  • Result event [SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_CANCEL, 0)] : This event will occur in the internal handler for the CANCEL button when the CANCEL button is pressed.
  • Result event [SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_ANOTHER, 0)] : This event will occur in the internal handler for the ANOTHER button when the ANOTHER button is pressed.
  • Result event [SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_ESCAPE, 0)] : when the ESCAPE key is pressed, or when the time set with the SFZDialog::ScheduleTimer function elapses

The handler for these events can be registered. The default handler closes the dialog only.

The operation key of the dialog is set with the SFZDialog::SetOperateKey function. The operation key of the button for operating the ANOTHER, CANCEL, and OK buttons is set with the SFYButtonControl::SetOperateKey function. By default, the operation key of the dialog and the operation key of the button are set to the SELECT key. When the button is displayed, the SELECT key is handled as the operation key of the button.

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

[Note] Note
The timer processing callback scheduled with the SFZDialog::ScheduleTimer function will be canceled automatically when the operation key of the dialog, the ESCAPE key, the OK button, the CANCEL button or the ANOTHER button is pressed.
[Note] Operating a dialog with its operation key

If all buttons are omitted or their states are set to "disable", the dialog will be operated by its operation key. In the default implementation, its behaviour is the same as when the OK button is pressed.

That is, if the operation key is pressed, the (SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK) event will be sent, and then the dialog will close. This function is used for the dialog with no button which has only the warning message and is closed with its operation key.

[Note] Default background color

In SFZQuestionDialog, the default background color set with the SFYWidget::SetBackgroundColor function is the gray color[SFXRGBColor(0xEE, 0xEE, 0xEE,0x00)].

Example 9.68. Declaration

SFMTYPEDEFCLASS(USRApplication)
class USRApplication: public SFYApplication {
    SFMSEALCOPY(USRApplication)
private:
    SFZQuestionDialogSmp _dialog;

    ...
private:
    SFCError Make(Void);

    // result handler
    XANDLER_DECLARE_VOIDRESULT(OnResult)
};

Example 9.69. Implementation

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

    // create the dialog
    if ((_dialog = SFZQuestionDialog::NewInstance(&error)) != null) {

        // set the dialog's parent responder to USRApplication
        error = _dialog->SetParent(GetThis());
        if (error == SFERR_NO_ERROR) {

            // register the result handler into the dialog
            error = _dialog->RegisterHandler(
                SFXEventRange(SFEVT_RESPONDER_RESULT, SFEVT_RESPONDER_RESULT, SFP16_BEGIN, SFP16_END),
                XANDLER_INTERNAL(OnResult)
            );
            if (error == SFERR_NO_ERROR) {

                // set the image for the dialog's icon
                // * SFBImage image can be set from the resource file or normal file
                error = _dialog->SetIconImage(SFXPath("resource.bar"), IMAGE_ID);
                if (error == SFERR_NO_ERROR) {

                    // set the text for the dialog's message
                    // * SFXWideString text can be set from the resource file
                    error = _dialog->SetMessageText("hello world\n\nThis is a question message.");
                    if (error == SFERR_NO_ERROR) {

                        // set the text for the dialog's ANOTHER button
                        // * SFXWideString text can be set from the resource file
                        error = _dialog->SetButtonText(SFZQuestionDialog::BUTTON_ANOTHER, "ANOTHER");
                        if (error == SFERR_NO_ERROR) {

                            // set the text for the dialog's CANCEL button
                            // * SFXWideString text can be set from the resource file
                            error = _dialog->SetButtonText(SFZQuestionDialog::BUTTON_CANCEL, "CANCEL");
                            if (error == SFERR_NO_ERROR) {

                                // set the text to the dialog's OK button
                                // since the text for the OK button is set last, first the OK button is displayed in the focus state
                                // * SFXWideString text can be set from the resource file
                                error = _dialog->SetButtonText(SFZQuestionDialog::BUTTON_OK, "OK");
                                if (error == SFERR_NO_ERROR) {

                                    // Calculate the suitable dialog region within the hint region obtained by deflating the screen device region by (20, 20), 
                                    // which will be aligned at the center and the middle of the hint region.
                                    // Set the dialog's real region to it.
                                    _dialog->SetRealBound(_dialog->GetSuitableBound(GetLocalBound().Deflate(10, 10), SFYResponder::HORIZONTAL_CENTER, SFYResponder::VERTICAL_MIDDLE));

                                    // set the dialog's state to "visible" + "active" + "enable" + "focus" together
                                    _dialog->SetState(true, true, true, true);

                                    // move the dialog foremost
                                    _dialog->ToFront();
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    return error;
}

// result handler
XANDLER_IMPLEMENT_VOIDRESULT(USRApplication, OnResult, invoker, reason, result)
{
    // the dialog will be passed via the invoker argument
    // the P16 value of the result event will be passed via the reason argument
    // "0" will be passed via the result argument

    switch (reason) {

        case SFP16_RESULT_OK:

            // when the OK button or the operation key is pressed

            ...

            break;

        case SFP16_RESULT_CANCEL:

            // when the CANCEL button is pressed

            ...

            break;

        case SFP16_RESULT_ANOTHER:

            // when the OTHER button is pressed

            ...

            break;

        case SFP16_RESULT_ESCAPE:

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

            ...

            break;
    }

    // close the dialog
    invoker->Terminate();
    // or "_dialog->Terminate();"

    return;
}

Figure 9.42. Dialog with a border and/or a title [SFZQuestionDialog]


Dialog with a border and/or a title [SFZQuestionDialog]

For the sample code to attach a frame with a border and/or a title to a dialog[SFZQuestionDialog], see SFZQuestionDialog.

9.14.4. General Purpose Dialog as Abstract Class that Represents a Dialog [SFZDialog]

SFZDialog is the abstract base class for all dialogs.

For instance, dialogs such as SFZMessageDialog or SFZQuestionDialog are implemented by inheriting from SFZDialog.

In SFZDialog, there are functions to close itself after the specified period, to scroll up and down the virtual region larger than the real region in cooperation with the move-focus function, manage the dialog operation, ESCAPE key, and scroll keys, and implement some default handlers(virtual functions).

When controls and/or containers are placed in the dialog, the focus can be moved among the child responders of the dialog using the scroll key set with the SFYContainer::SetScrollDownKey and SFYContainer::SetScrollUpKey functions.

The virtual region larger than the real region can be scrolled up and down, and the focus can be moved among the child responders of the dialog . At this time, scrolling is performed in cooperation with moving the focus.

In the default implementation, the abstract dialog[SFZDialog] will receive the following result events[SFEVT_RESPONDER_RESULT].

The developer can register handlers for these events. The default handler closes the dialog only.

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

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

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

The handlers(virtual functions) below for the key event[SFEVT_KEY] on the dialog operation, ESCAPE, and scroll keys, the region event[SFEVT_RESPONDER_BOUND], and the drawing event[SFEVT_RESPONDER_RENDER] are registered.

In a dialog inheriting from SFZDialog, the following handlers(virtual functions) will be booted up first when the event is received.

Table 9.16. Events and their Handlers

Event Handler(Virtual function) Default behaviour Override
SFEVT_KEY event of the operation key set with SFZDialog::SetOperateKey SFZDialog::HandleOperateKey Send the result event *1 Optional
SFEVT_KEY event of the ESCAPE key set with SFZDialog::SetEscapeKey SFZDialog::HandleEscapeKey Send the result event *2 Optional
SFEVT_KEY event of the ScrollUp key set with SFYContainer::SetScrollUpKey SFYContainer::HandleScrollUpKey Scroll up the virtual region *3 Optional
SFEVT_KEY event of the ScrollDown key set with SFYContainer::SetScrollDownKey SFYContainer::HandleScrollDownKey Scroll down the virtual region *4 Optional
SFEVT_KEY event of the PageUp key set with SFYContainer::SetPageUpKey SFYContainer::HandlePageUpKey Scroll up the virtual region by 1 page *5 Optional
SFEVT_KEY event of the PageDown key set with SFYContainer::SetPageDownKey SFYContainer::HandlePageDownKey Scroll down the virtual region by 1 page *6 Optional
SFEVT_KEY event of the SnapUp key set with SFYContainer::SetSnapUpKey SFYContainer::HandleSnapUpKey Scroll up the virtual region to the top *7 Optional
SFEVT_KEY event of the SnapDown key set with SFYContainer::SetSnapDownKey SFYContainer::HandleSnapDownKey Scroll down the virtual region to the bottom *8 Optional
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_REQUEST) event SFYWidget::HandleBoundRequest - Recommended
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_OPTIMIZE) event SFYWidget::HandleBoundOptimize - Recommended
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_REAL) event SFYWidget::HandleBoundReal - Optional
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_VIRTUAL) event SFYWidget::HandleBoundVirtual - Optional
(SFEVT_RESPONDER_BOUND, SFP16_BOUND_GLOBAL) event SFYWidget::HandleBoundGlobal - Optional
(SFEVT_RESPONDER_RENDER, SFP16_RENDER_REQUEST) event SFYWidget::HandleRenderRequest - Optional

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

[Note] NOTE

*1. Execute SFYResponder::InvokeForward(SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_OK, 0), false). Just before the SFZDialog::HandleOperateKey function is called, the timer processing callback scheduled with the SFZDialog::ScheduleTimer function will be canceled internally.

*2. Execute SFYResponder::InvokeForward(SFXEvent(SFEVT_RESPONDER_RESULT, SFP16_RESULT_ESCAPE, 0), false). Just before the SFZDialog::HandleEscapeKey function is called, the timer processing callback scheduled with the SFZDialog::ScheduleTimer function will be canceled internally.

*3. Execute the SFYContainer::ScrollUp function.

*4. Execute the SFYContainer::ScrollDown function.

*5. Execute the SFYContainer::PageUp function.

*6. Execute the SFYContainer::PageDown function.

*7. Execute the SFYContainer::SnapUp function.

*8. Execute the SFYContainer::SnapDown function.

The minimum code necessary to make the user-defined dialog is as follows:

Example 9.70. Declaration

SFMTYPEDEFRESPONDER(USRDialog)
class USRDialog: public SFZDialog {
    SFMSEALRESPONDER(USRDialog)
    SFMRESPONDERINSTANTIATEFIVE(USRDialog, SFZDialog, SFZWindow, SFYContainer, SFYWidget, SFYResponder)
public:

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

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

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

Example 9.71. Implementation

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

        // set the responder type
        SetType(CODE_TYPE);

        // here describe the initialization
    }
}

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

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

Void USRDialog::HandleBoundRequest(SFXRectanglePtr rectangle) const
{
    // calculate the suitable dialog size
    // set the rectangle argument to the calculated suitable dialog size
    // for the rectangle argument, it is recommended to set only its size and not to change its origin in this function

    return;
}

Void USRDialog::HandleBoundOptimize(SFXRectanglePtr rectangle) const
{
    // calculate the suitable dialog size within rectangular region given by the rectangle argument
    // set the rectangle argument to the calculated suitable dialog size
    // for the rectangle argument, it is recommended to set only its size and not to change its origin in this function

    return;
}

Void USRDialog::HandleBoundReal(Void)
{
    // here describe the size recalculation if necessary when the real region is changed

    return;
}

Void USRDialog::HandleBoundVirtual(Void)
{
    // here describe the size recalculation if necessary when the virtual region is changed

    return;
}

Void USRDialog::HandleRenderRequest(SFXGraphicsPtr graphics) const
{
    // draw the dialog

    return;
}