1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/richmsgdlgg.cpp
3 // Purpose: wxGenericRichMessageDialog
4 // Author: Rickard Westerlund
7 // Copyright: (c) 2010 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
21 #include "wx/checkbox.h"
22 #include "wx/stattext.h"
26 #include "wx/collpane.h"
27 #include "wx/richmsgdlg.h"
29 wxIMPLEMENT_CLASS(wxRichMessageDialog
, wxDialog
)
31 // ----------------------------------------------------------------------------
32 // Events and handlers
33 // ----------------------------------------------------------------------------
35 BEGIN_EVENT_TABLE(wxGenericRichMessageDialog
, wxRichMessageDialogBase
)
36 EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY
,
37 wxGenericRichMessageDialog::OnPaneChanged
)
40 void wxGenericRichMessageDialog::OnPaneChanged(wxCollapsiblePaneEvent
& event
)
42 if ( event
.GetCollapsed() )
43 m_detailsPane
->SetLabel( m_detailsExpanderCollapsedLabel
);
45 m_detailsPane
->SetLabel( m_detailsExpanderExpandedLabel
);
48 // ----------------------------------------------------------------------------
49 // wxGenericRichMessageDialog
50 // ----------------------------------------------------------------------------
52 void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer
*sizer
)
54 if ( !m_checkBoxText
.empty() )
56 wxSizer
*sizerCheckBox
= new wxBoxSizer( wxHORIZONTAL
);
58 m_checkBox
= new wxCheckBox( this,
61 m_checkBox
->SetValue( m_checkBoxValue
);
62 sizerCheckBox
->Add( m_checkBox
, 0, wxBOTTOM
| wxALIGN_LEFT
);
64 sizer
->Add( sizerCheckBox
, 0, wxTOP
|wxLEFT
|wxRIGHT
| wxALIGN_LEFT
, 10 );
68 void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer
*sizer
)
70 if ( !m_detailedText
.empty() )
72 wxSizer
*sizerDetails
= new wxBoxSizer( wxHORIZONTAL
);
75 new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel
);
77 // add the detailed text
78 wxWindow
*windowPane
= m_detailsPane
->GetPane();
79 wxSizer
*sizerPane
= new wxBoxSizer( wxHORIZONTAL
);
80 sizerPane
->Add( new wxStaticText( windowPane
, -1, m_detailedText
) );
81 windowPane
->SetSizer( sizerPane
);
83 sizerDetails
->Add( m_detailsPane
, wxSizerFlags().Right().Expand() );
84 sizer
->Add( sizerDetails
, 0, wxTOP
|wxLEFT
|wxRIGHT
| wxALIGN_LEFT
, 10 );
88 bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
90 // This function can be called before the dialog is shown and hence before
91 // the check box is created.
92 return m_checkBox
? m_checkBoxValue
: m_checkBox
->IsChecked();
95 #endif // wxUSE_RICHMSGDLG