]> git.saurik.com Git - wxWidgets.git/blob - src/generic/richmsgdlgg.cpp
non-pch build fix
[wxWidgets.git] / src / generic / richmsgdlgg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/richmsgdlgg.cpp
3 // Purpose: wxGenericRichMessageDialog
4 // Author: Rickard Westerlund
5 // Created: 2010-07-04
6 // RCS-ID: $Id$
7 // Copyright: (c) 2010 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_RICHMSGDLG
19
20 #ifndef WX_PRECOMP
21 #include "wx/checkbox.h"
22 #include "wx/stattext.h"
23 #include "wx/sizer.h"
24 #endif
25
26 #include "wx/collpane.h"
27 #include "wx/richmsgdlg.h"
28
29 wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog)
30
31 // ----------------------------------------------------------------------------
32 // Events and handlers
33 // ----------------------------------------------------------------------------
34
35 BEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase)
36 EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY,
37 wxGenericRichMessageDialog::OnPaneChanged)
38 END_EVENT_TABLE()
39
40 void wxGenericRichMessageDialog::OnPaneChanged(wxCollapsiblePaneEvent& event)
41 {
42 if ( event.GetCollapsed() )
43 m_detailsPane->SetLabel( m_detailsExpanderCollapsedLabel );
44 else
45 m_detailsPane->SetLabel( m_detailsExpanderExpandedLabel );
46 }
47
48 // ----------------------------------------------------------------------------
49 // wxGenericRichMessageDialog
50 // ----------------------------------------------------------------------------
51
52 void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer *sizer)
53 {
54 if ( !m_checkBoxText.empty() )
55 {
56 m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
57 m_checkBox->SetValue(m_checkBoxValue);
58
59 sizer->Add(m_checkBox, wxSizerFlags().Left().Border(wxLEFT|wxTOP, 10));
60 }
61 }
62
63 void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer *sizer)
64 {
65 if ( !m_detailedText.empty() )
66 {
67 wxSizer *sizerDetails = new wxBoxSizer( wxHORIZONTAL );
68
69 m_detailsPane =
70 new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel );
71
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 );
77
78 sizerDetails->Add( m_detailsPane, wxSizerFlags().Right().Expand() );
79 sizer->Add( sizerDetails, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
80 }
81 }
82
83 bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
84 {
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();
88 }
89
90 #endif // wxUSE_RICHMSGDLG