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