Ticket #15121: icon_auth_needed_v2.patch

File icon_auth_needed_v2.patch, 4.8 KB (added by spencercw, 5 years ago)

Updated per review comments

  • include/wx/defs.h

     
    19241924#define wxMORE                  0x00010000
    19251925#define wxSETUP                 0x00020000
    19261926#define wxICON_NONE             0x00040000
     1927#define wxICON_AUTH_NEEDED      0x00080000
    19271928
    19281929#define wxICON_MASK \
    1929     (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE)
     1930    (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE|wxICON_AUTH_NEEDED)
    19301931
    19311932/*
    19321933 * Background styles. See wxWindow::SetBackgroundStyle
  • include/wx/msgdlg.h

     
    209209        { return m_help.empty() ? GetDefaultHelpLabel() : m_help; }
    210210
    211211    // based on message dialog style, returns exactly one of: wxICON_NONE,
    212     // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION
    213     long GetEffectiveIcon() const
     212    // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION,
     213    // wxICON_AUTH_NEEDED
     214    virtual long GetEffectiveIcon() const
    214215    {
    215216        if ( m_dialogStyle & wxICON_NONE )
    216217            return wxICON_NONE;
  • include/wx/msw/msgdlg.h

     
    2727
    2828    virtual int ShowModal();
    2929
     30    virtual long GetEffectiveIcon() const;
     31
    3032    // implementation-specific
    3133
    3234    // return the font used for the text in the message box
  • interface/wx/msgdlg.h

     
    6868        Displays an information symbol. This icon is used by default if
    6969        @c wxYES_NO is not given so it is usually unnecessary to specify it
    7070        explicitly.
     71    @style{wxICON_AUTH_NEEDED}
     72        Displays an authentication needed symbol. This style is only supported
     73        for message dialogs under wxMSW when a task dialog is used to implement
     74        them (i.e. when running under Windows Vista or later). In other cases
     75        the default icon selection logic will be used. Note this can be
     76        combined with other styles to provide a fallback. For instance, using
     77        wxICON_AUTH_NEEDED | wxICON_QUESTION will show a shield symbol on
     78        Windows Vista or above and a question symbol on other platforms.
     79        @since 2.9.5
    7180    @style{wxSTAY_ON_TOP}
    7281        Makes the message box stay on top of all other windows and not only
    7382        just its parent (currently implemented only under MSW and GTK).
  • samples/dialogs/dialogs.cpp

     
    30053005        "&Information icon",
    30063006        "&Question icon",
    30073007        "&Warning icon",
    3008         "&Error icon"
     3008        "&Error icon",
     3009        "A&uth needed icon"
    30093010    };
    30103011
    30113012   wxCOMPILE_TIME_ASSERT( WXSIZEOF(icons) == MsgDlgIcon_Max, IconMismatch );
     
    31063107        case MsgDlgIcon_Error:
    31073108            style |= wxICON_ERROR;
    31083109            break;
     3110
     3111        case MsgDlgIcon_AuthNeeded:
     3112            style |= wxICON_AUTH_NEEDED;
     3113            break;
    31093114    }
    31103115
    31113116    if ( m_chkCentre->IsChecked() )
  • samples/dialogs/dialogs.h

     
    249249        MsgDlgIcon_Question,
    250250        MsgDlgIcon_Warning,
    251251        MsgDlgIcon_Error,
     252        MsgDlgIcon_AuthNeeded,
    252253        MsgDlgIcon_Max
    253254    };
    254255
  • src/msw/msgdlg.cpp

     
    629629    return ShowMessageBox();
    630630}
    631631
     632long wxMessageDialog::GetEffectiveIcon() const
     633{
     634    // only use the auth needed icon if available, otherwise fallback to the default logic
     635    if ( (m_dialogStyle & wxICON_AUTH_NEEDED) &&
     636        wxMSWMessageDialog::HasNativeTaskDialog() )
     637    {
     638        return wxICON_AUTH_NEEDED;
     639    }
     640
     641    return wxMessageDialogBase::GetEffectiveIcon();
     642}
     643
    632644void wxMessageDialog::DoCentre(int dir)
    633645{
    634646#ifdef wxHAS_MSW_TASKDIALOG
     
    738750        case wxICON_INFORMATION:
    739751            tdc.pszMainIcon = TD_INFORMATION_ICON;
    740752            break;
     753
     754        case wxICON_AUTH_NEEDED:
     755            tdc.pszMainIcon = TD_SHIELD_ICON;
     756            break;
    741757    }
    742758
    743759    // custom label button array that can hold all buttons in use