예제 #1
0
bool wxDialogBase::SendCloseButtonClickEvent()
{
    int idCancel = GetEscapeId();
    switch ( idCancel )
    {
        case wxID_NONE:
            // The user doesn't want this dialog to close "implicitly".
            break;

        case wxID_ANY:
            // this value is special: it means translate Esc to wxID_CANCEL
            // but if there is no such button, then fall back to wxID_OK
            if ( EmulateButtonClickIfPresent(wxID_CANCEL) )
                return true;
            idCancel = GetAffirmativeId();
            wxFALLTHROUGH;

        default:
            // translate Esc to button press for the button with given id
            if ( EmulateButtonClickIfPresent(idCancel) )
                return true;
    }

    return false;
}
예제 #2
0
void wxDialogBase::OnCharHook(wxKeyEvent& event)
{
    if ( event.GetKeyCode() == WXK_ESCAPE )
    {
        int idCancel = GetEscapeId();
        switch ( idCancel )
        {
            case wxID_NONE:
                // don't handle Esc specially at all
                break;

            case wxID_ANY:
                // this value is special: it means translate Esc to wxID_CANCEL
                // but if there is no such button, then fall back to wxID_OK
                if ( EmulateButtonClickIfPresent(wxID_CANCEL) )
                    return;
                idCancel = GetAffirmativeId();
                // fall through

            default:
                // translate Esc to button press for the button with given id
                if ( EmulateButtonClickIfPresent(idCancel) )
                    return;
        }
    }

    event.Skip();
}
예제 #3
0
// Responds to the OK button in a PocketPC titlebar. This
// can be overridden, or you can change the id used for
// sending the event, by calling SetAffirmativeId.
bool wxDialog::DoOK()
{
    const int idOk = GetAffirmativeId();
    if ( EmulateButtonClickIfPresent(idOk) )
        return true;

    wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetAffirmativeId());
    event.SetEventObject(this);

    return GetEventHandler()->ProcessEvent(event);
}
예제 #4
0
// Responds to the OK button in a PocketPC titlebar. This
// can be overridden, or you can change the id used for
// sending the event, by calling SetAffirmativeId.
bool wxDialog::DoOK()
{
    const int idOk = GetAffirmativeId();
    if ( EmulateButtonClickIfPresent(idOk) )
        return true;

    wxCommandEvent event(wxEVT_BUTTON, GetAffirmativeId());
    event.SetEventObject(this);

    return HandleWindowEvent(event);
}