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 m_checkBox
= new wxCheckBox(this, wxID_ANY
, m_checkBoxText
);
57 m_checkBox
->SetValue(m_checkBoxValue
);
59 sizer
->Add(m_checkBox
, wxSizerFlags().Left().Border(wxLEFT
|wxTOP
, 10));
63 void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer
*sizer
)
65 if ( !m_detailedText
.empty() )
67 wxSizer
*sizerDetails
= new wxBoxSizer( wxHORIZONTAL
);
70 new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel
);
72 // add the detailed text
73 wxWindow
*windowPane
= m_detailsPane
->GetPane();
74 wxSizer
*sizerPane
= new wxBoxSizer( wxHORIZONTAL
);
75 sizerPane
->Add( new wxStaticText( windowPane
, -1, m_detailedText
) );
76 windowPane
->SetSizer( sizerPane
);
78 sizerDetails
->Add( m_detailsPane
, wxSizerFlags().Right().Expand() );
79 sizer
->Add( sizerDetails
, 0, wxTOP
|wxLEFT
|wxRIGHT
| wxALIGN_LEFT
, 10 );
83 bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
85 // This function can be called before the dialog is shown and hence before
86 // the check box is created.
87 return m_checkBox
? m_checkBoxValue
: m_checkBox
->IsChecked();
90 #endif // wxUSE_RICHMSGDLG