2010-08-18 18:48:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: src/generic/richmsgdlgg.cpp
|
|
|
|
// Purpose: wxGenericRichMessageDialog
|
|
|
|
// Author: Rickard Westerlund
|
|
|
|
// Created: 2010-07-04
|
|
|
|
// 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
|
2010-08-18 20:06:12 -04:00
|
|
|
#include "wx/checkbox.h"
|
2018-01-20 10:53:13 -05:00
|
|
|
#include "wx/statbmp.h"
|
2010-08-18 18:48:41 -04:00
|
|
|
#include "wx/stattext.h"
|
|
|
|
#include "wx/sizer.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/collpane.h"
|
|
|
|
#include "wx/richmsgdlg.h"
|
2018-01-20 10:53:13 -05:00
|
|
|
#include "wx/statline.h"
|
|
|
|
#include "wx/artprov.h"
|
2010-08-18 18:48:41 -04:00
|
|
|
|
|
|
|
wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog)
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Events and handlers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxBEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase)
|
2010-08-18 18:48:41 -04:00
|
|
|
EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY,
|
|
|
|
wxGenericRichMessageDialog::OnPaneChanged)
|
2015-04-23 07:49:01 -04:00
|
|
|
wxEND_EVENT_TABLE()
|
2010-08-18 18:48:41 -04:00
|
|
|
|
|
|
|
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() )
|
|
|
|
{
|
2010-08-19 11:41:24 -04:00
|
|
|
m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
|
|
|
|
m_checkBox->SetValue(m_checkBoxValue);
|
2010-08-18 18:48:41 -04:00
|
|
|
|
2010-08-19 11:41:24 -04:00
|
|
|
sizer->Add(m_checkBox, wxSizerFlags().Left().Border(wxLEFT|wxTOP, 10));
|
2010-08-18 18:48:41 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
2018-01-20 10:53:13 -05:00
|
|
|
|
|
|
|
if ( !m_footerText.empty() )
|
|
|
|
{
|
|
|
|
// add footer
|
|
|
|
sizer->Add( new wxStaticLine(this), wxSizerFlags().Expand().Border() );
|
|
|
|
wxSizer *footerSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
if (m_footerIcon)
|
|
|
|
{
|
|
|
|
wxSize iconSize = wxArtProvider::GetNativeSizeHint(wxART_MENU);
|
|
|
|
|
|
|
|
wxStaticBitmap* footerIcon = new wxStaticBitmap(this, wxID_ANY,
|
|
|
|
wxArtProvider::GetIcon(wxArtProvider::GetMessageBoxIconId(m_footerIcon),
|
|
|
|
wxART_MESSAGE_BOX, iconSize));
|
|
|
|
footerSizer->Add( footerIcon,
|
|
|
|
wxSizerFlags().Border(wxLEFT|wxRIGHT).CenterVertical() );
|
|
|
|
}
|
|
|
|
footerSizer->Add( new wxStaticText(this, wxID_ANY, m_footerText),
|
|
|
|
wxSizerFlags().CenterVertical() );
|
|
|
|
sizer->Add( footerSizer, wxSizerFlags().Border().Expand() );
|
|
|
|
}
|
2010-08-18 18:48:41 -04:00
|
|
|
}
|
|
|
|
|
2010-08-18 20:06:12 -04:00
|
|
|
bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
|
|
|
|
{
|
|
|
|
// This function can be called before the dialog is shown and hence before
|
|
|
|
// the check box is created.
|
2011-01-12 08:39:29 -05:00
|
|
|
return m_checkBox ? m_checkBox->IsChecked() : m_checkBoxValue;
|
2010-08-18 20:06:12 -04:00
|
|
|
}
|
|
|
|
|
2010-08-18 18:48:41 -04:00
|
|
|
#endif // wxUSE_RICHMSGDLG
|