]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/generic/richmsgdlgg.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / generic / richmsgdlgg.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/generic/richmsgdlgg.cpp
3// Purpose: wxGenericRichMessageDialog
4// Author: Rickard Westerlund
5// Created: 2010-07-04
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
20 #include "wx/checkbox.h"
21 #include "wx/stattext.h"
22 #include "wx/sizer.h"
23#endif
24
25#include "wx/collpane.h"
26#include "wx/richmsgdlg.h"
27
28wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog)
29
30// ----------------------------------------------------------------------------
31// Events and handlers
32// ----------------------------------------------------------------------------
33
34BEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase)
35 EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY,
36 wxGenericRichMessageDialog::OnPaneChanged)
37END_EVENT_TABLE()
38
39void 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
51void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer *sizer)
52{
53 if ( !m_checkBoxText.empty() )
54 {
55 m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
56 m_checkBox->SetValue(m_checkBoxValue);
57
58 sizer->Add(m_checkBox, wxSizerFlags().Left().Border(wxLEFT|wxTOP, 10));
59 }
60}
61
62void 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
82bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
83{
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;
87}
88
89#endif // wxUSE_RICHMSGDLG