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:
87
src/generic/richmsgdlgg.cpp
Normal file
87
src/generic/richmsgdlgg.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/generic/richmsgdlgg.cpp
|
||||
// Purpose: wxGenericRichMessageDialog
|
||||
// Author: Rickard Westerlund
|
||||
// Created: 2010-07-04
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2010 wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_RICHMSGDLG
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/sizer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/collpane.h"
|
||||
#include "wx/richmsgdlg.h"
|
||||
|
||||
wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Events and handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase)
|
||||
EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY,
|
||||
wxGenericRichMessageDialog::OnPaneChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void wxGenericRichMessageDialog::OnPaneChanged(wxCollapsiblePaneEvent& event)
|
||||
{
|
||||
if ( event.GetCollapsed() )
|
||||
m_detailsPane->SetLabel( m_detailsExpanderCollapsedLabel );
|
||||
else
|
||||
m_detailsPane->SetLabel( m_detailsExpanderExpandedLabel );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericRichMessageDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer *sizer)
|
||||
{
|
||||
if ( !m_checkBoxText.empty() )
|
||||
{
|
||||
wxSizer *sizerCheckBox = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_checkBox = new wxCheckBox( this,
|
||||
wxID_ANY,
|
||||
m_checkBoxText );
|
||||
m_checkBox->SetValue( m_checkBoxValue );
|
||||
sizerCheckBox->Add( m_checkBox, 0, wxBOTTOM | wxALIGN_LEFT );
|
||||
|
||||
sizer->Add( sizerCheckBox, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
|
||||
}
|
||||
}
|
||||
|
||||
void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer *sizer)
|
||||
{
|
||||
if ( !m_detailedText.empty() )
|
||||
{
|
||||
wxSizer *sizerDetails = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_detailsPane =
|
||||
new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel );
|
||||
|
||||
// add the detailed text
|
||||
wxWindow *windowPane = m_detailsPane->GetPane();
|
||||
wxSizer *sizerPane = new wxBoxSizer( wxHORIZONTAL );
|
||||
sizerPane->Add( new wxStaticText( windowPane, -1, m_detailedText ) );
|
||||
windowPane->SetSizer( sizerPane );
|
||||
|
||||
sizerDetails->Add( m_detailsPane, wxSizerFlags().Right().Expand() );
|
||||
sizer->Add( sizerDetails, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_RICHMSGDLG
|
||||
Reference in New Issue
Block a user