1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/richmsgdlgg.cpp
3 // Purpose: wxGenericRichMessageDialog
4 // Author: Rickard Westerlund
6 // Copyright: (c) 2010 wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
20 #include "wx/checkbox.h"
21 #include "wx/stattext.h"
25 #include "wx/collpane.h"
26 #include "wx/richmsgdlg.h"
28 wxIMPLEMENT_CLASS(wxRichMessageDialog
, wxDialog
)
30 // ----------------------------------------------------------------------------
31 // Events and handlers
32 // ----------------------------------------------------------------------------
34 BEGIN_EVENT_TABLE(wxGenericRichMessageDialog
, wxRichMessageDialogBase
)
35 EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY
,
36 wxGenericRichMessageDialog::OnPaneChanged
)
39 void wxGenericRichMessageDialog::OnPaneChanged(wxCollapsiblePaneEvent
& event
)
41 if ( event
.GetCollapsed() )
42 m_detailsPane
->SetLabel( m_detailsExpanderCollapsedLabel
);
44 m_detailsPane
->SetLabel( m_detailsExpanderExpandedLabel
);
47 // ----------------------------------------------------------------------------
48 // wxGenericRichMessageDialog
49 // ----------------------------------------------------------------------------
51 void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer
*sizer
)
53 if ( !m_checkBoxText
.empty() )
55 m_checkBox
= new wxCheckBox(this, wxID_ANY
, m_checkBoxText
);
56 m_checkBox
->SetValue(m_checkBoxValue
);
58 sizer
->Add(m_checkBox
, wxSizerFlags().Left().Border(wxLEFT
|wxTOP
, 10));
62 void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer
*sizer
)
64 if ( !m_detailedText
.empty() )
66 wxSizer
*sizerDetails
= new wxBoxSizer( wxHORIZONTAL
);
69 new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel
);
71 // add the detailed text
72 wxWindow
*windowPane
= m_detailsPane
->GetPane();
73 wxSizer
*sizerPane
= new wxBoxSizer( wxHORIZONTAL
);
74 sizerPane
->Add( new wxStaticText( windowPane
, -1, m_detailedText
) );
75 windowPane
->SetSizer( sizerPane
);
77 sizerDetails
->Add( m_detailsPane
, wxSizerFlags().Right().Expand() );
78 sizer
->Add( sizerDetails
, 0, wxTOP
|wxLEFT
|wxRIGHT
| wxALIGN_LEFT
, 10 );
82 bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
84 // This function can be called before the dialog is shown and hence before
85 // the check box is created.
86 return m_checkBox
? m_checkBox
->IsChecked() : m_checkBoxValue
;
89 #endif // wxUSE_RICHMSGDLG