Ticket #15121: wxicon_auth_needed.patch

File wxicon_auth_needed.patch, 4.3 KB (added by spencercw, 5 years ago)
  • 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.
    7179    @style{wxSTAY_ON_TOP}
    7280        Makes the message box stay on top of all other windows and not only
    7381        just its parent (currently implemented only under MSW and GTK).
  • samples/controls/controls.cpp

     
    15541554
    15551555void MyPanel::OnRadioButton1( wxCommandEvent & WXUNUSED(event) )
    15561556{
    1557     wxMessageBox(wxT("First wxRadioButton selected."), wxT("wxControl sample"));
     1557    wxMessageBox(wxT("First wxRadioButton selected."), wxT("wxControl sample"),
     1558        wxOK | wxICON_AUTH_NEEDED | wxICON_QUESTION);
    15581559}
    15591560
    15601561void MyPanel::OnRadioButton2( wxCommandEvent & WXUNUSED(event) )
  • 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