Add wxRichMessageDialog class.
This is a generalization of wxMessageDialog based on the native task dialog under recent (Vista and later) Windows versions and implemented generically for the other ports for now. It provides the possibility to use additional controls in the message boxes (checkbox useful for the "Don't ask me again" kind of dialogs and collapsible detailed explanations field) and better look and feel under Windows. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -929,6 +929,14 @@
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_RIBBON) */
|
||||
|
||||
#ifndef wxUSE_RICHMSGDLG
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_RICHMSGDLG must be defined, please read comment near the top of this file."
|
||||
# else
|
||||
# define wxUSE_RICHMSGDLG 0
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_RIBBON) */
|
||||
|
||||
#ifndef wxUSE_SASH
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_SASH must be defined, please read comment near the top of this file."
|
||||
@@ -1539,6 +1547,17 @@
|
||||
# endif
|
||||
#endif /* wxUSE_REARRANGECTRL */
|
||||
|
||||
#if wxUSE_RICHMSGDLG
|
||||
# if !wxUSE_MSGDLG
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_RICHMSGDLG requires wxUSE_MSGDLG"
|
||||
# else
|
||||
# undef wxUSE_MSGDLG
|
||||
# define wxUSE_MSGDLG 1
|
||||
# endif
|
||||
# endif
|
||||
#endif /* wxUSE_RICHMSGDLG */
|
||||
|
||||
/* don't attempt to use native status bar on the platforms not having it */
|
||||
#ifndef wxUSE_NATIVE_STATUSBAR
|
||||
# define wxUSE_NATIVE_STATUSBAR 0
|
||||
|
54
include/wx/generic/richmsgdlgg.h
Normal file
54
include/wx/generic/richmsgdlgg.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/richmsgdlgg.h
|
||||
// Purpose: wxGenericRichMessageDialog
|
||||
// Author: Rickard Westerlund
|
||||
// Created: 2010-07-04
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2010 wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_RICHMSGDLGG_H_
|
||||
#define _WX_GENERIC_RICHMSGDLGG_H_
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxCheckBox;
|
||||
class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane;
|
||||
class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGenericRichMessageDialog
|
||||
: public wxRichMessageDialogBase
|
||||
{
|
||||
public:
|
||||
wxGenericRichMessageDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
long style)
|
||||
: wxRichMessageDialogBase( parent, message, caption, style ),
|
||||
m_checkBox(NULL),
|
||||
m_detailsPane(NULL)
|
||||
{ }
|
||||
|
||||
virtual bool IsCheckBoxChecked() const
|
||||
{
|
||||
// This function can be called before the dialog is shown and hence
|
||||
// before the check box is created.
|
||||
return m_checkBox? m_checkBoxValue : m_checkBox->IsChecked();
|
||||
}
|
||||
|
||||
protected:
|
||||
wxCheckBox *m_checkBox;
|
||||
wxCollapsiblePane *m_detailsPane;
|
||||
|
||||
// overrides methods in the base class
|
||||
virtual void AddMessageDialogCheckBox(wxSizer *sizer);
|
||||
virtual void AddMessageDialogDetails(wxSizer *sizer);
|
||||
|
||||
private:
|
||||
void OnPaneChanged(wxCollapsiblePaneEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxGenericRichMessageDialog);
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_RICHMSGDLGG_H_
|
@@ -751,6 +751,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
31
include/wx/msw/richmsgdlg.h
Normal file
31
include/wx/msw/richmsgdlg.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/richmsgdlg.h
|
||||
// Purpose: wxRichMessageDialog
|
||||
// Author: Rickard Westerlund
|
||||
// Created: 2010-07-04
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2010 wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_RICHMSGDLG_H_
|
||||
#define _WX_MSW_RICHMSGDLG_H_
|
||||
|
||||
class WXDLLIMPEXP_CORE wxRichMessageDialog : public wxGenericRichMessageDialog
|
||||
{
|
||||
public:
|
||||
wxRichMessageDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
long style)
|
||||
: wxGenericRichMessageDialog(parent, message, caption, style)
|
||||
{ }
|
||||
|
||||
// overridden base class method showing the native task dialog if possible
|
||||
virtual int ShowModal();
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog);
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_RICHMSGDLG_H_
|
@@ -751,6 +751,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
@@ -751,6 +751,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
@@ -751,6 +751,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
@@ -752,6 +752,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
@@ -751,6 +751,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
89
include/wx/richmsgdlg.h
Normal file
89
include/wx/richmsgdlg.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/richmsgdlg.h
|
||||
// Purpose: wxRichMessageDialogBase
|
||||
// Author: Rickard Westerlund
|
||||
// Created: 2010-07-03
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2010 wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_RICHMSGDLG_H_BASE_
|
||||
#define _WX_RICHMSGDLG_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_RICHMSGDLG
|
||||
|
||||
#include "wx/msgdlg.h"
|
||||
|
||||
// Extends a message dialog with an optional checkbox and user-expandable
|
||||
// detailed text.
|
||||
class WXDLLIMPEXP_CORE wxRichMessageDialogBase : public wxGenericMessageDialog
|
||||
{
|
||||
public:
|
||||
wxRichMessageDialogBase( wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
long style )
|
||||
: wxGenericMessageDialog( parent, message, caption, style ),
|
||||
m_detailsExpanderCollapsedLabel( _("&See details") ),
|
||||
m_detailsExpanderExpandedLabel( _("&Hide details") ),
|
||||
m_checkBoxValue( false )
|
||||
{ }
|
||||
|
||||
void ShowCheckBox(const wxString& checkBoxText, bool checked = false)
|
||||
{
|
||||
m_checkBoxText = checkBoxText;
|
||||
m_checkBoxValue = checked;
|
||||
}
|
||||
|
||||
wxString GetCheckBoxText() const { return m_checkBoxText; }
|
||||
|
||||
void ShowDetailedText(const wxString& detailedText)
|
||||
{ m_detailedText = detailedText; }
|
||||
|
||||
wxString GetDetailedText() const { return m_detailedText; }
|
||||
|
||||
virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; };
|
||||
|
||||
protected:
|
||||
const wxString m_detailsExpanderCollapsedLabel;
|
||||
const wxString m_detailsExpanderExpandedLabel;
|
||||
|
||||
wxString m_checkBoxText;
|
||||
bool m_checkBoxValue;
|
||||
wxString m_detailedText;
|
||||
|
||||
private:
|
||||
void ShowDetails(bool shown);
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxRichMessageDialogBase);
|
||||
};
|
||||
|
||||
// Always include the generic version as it's currently used as the base class
|
||||
// by the MSW native implementation too.
|
||||
#include "wx/generic/richmsgdlgg.h"
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/msw/richmsgdlg.h"
|
||||
#else
|
||||
class WXDLLIMPEXP_CORE wxRichMessageDialog
|
||||
: public wxGenericRichMessageDialog
|
||||
{
|
||||
public:
|
||||
wxRichMessageDialog( wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
long style )
|
||||
: wxGenericRichMessageDialog( parent, message, caption, style )
|
||||
{ }
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_RICHMSGDLG
|
||||
|
||||
#endif // _WX_RICHMSGDLG_H_BASE_
|
@@ -747,6 +747,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
@@ -750,6 +750,7 @@
|
||||
#define wxUSE_LISTCTRL 1 // wxListCtrl
|
||||
#define wxUSE_RADIOBOX 1 // wxRadioBox
|
||||
#define wxUSE_RADIOBTN 1 // wxRadioButton
|
||||
#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog
|
||||
#define wxUSE_SCROLLBAR 1 // wxScrollBar
|
||||
#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl
|
||||
#define wxUSE_SLIDER 1 // wxSlider
|
||||
|
Reference in New Issue
Block a user