]> git.saurik.com Git - wxWidgets.git/blame - src/generic/richmsgdlgg.cpp
Better close button placement on tabs, especially for bottom tab alignment
[wxWidgets.git] / src / generic / richmsgdlgg.cpp
CommitLineData
a1bdd4ab
VZ
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
d482d5e4 21 #include "wx/checkbox.h"
a1bdd4ab
VZ
22 #include "wx/stattext.h"
23 #include "wx/sizer.h"
24#endif
25
26#include "wx/collpane.h"
27#include "wx/richmsgdlg.h"
28
29wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog)
30
31// ----------------------------------------------------------------------------
32// Events and handlers
33// ----------------------------------------------------------------------------
34
35BEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase)
36 EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY,
37 wxGenericRichMessageDialog::OnPaneChanged)
38END_EVENT_TABLE()
39
40void 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
52void wxGenericRichMessageDialog::AddMessageDialogCheckBox(wxSizer *sizer)
53{
54 if ( !m_checkBoxText.empty() )
55 {
56 wxSizer *sizerCheckBox = new wxBoxSizer( wxHORIZONTAL );
57
58 m_checkBox = new wxCheckBox( this,
59 wxID_ANY,
60 m_checkBoxText );
61 m_checkBox->SetValue( m_checkBoxValue );
62 sizerCheckBox->Add( m_checkBox, 0, wxBOTTOM | wxALIGN_LEFT );
63
64 sizer->Add( sizerCheckBox, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
65 }
66}
67
68void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer *sizer)
69{
70 if ( !m_detailedText.empty() )
71 {
72 wxSizer *sizerDetails = new wxBoxSizer( wxHORIZONTAL );
73
74 m_detailsPane =
75 new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel );
76
77 // add the detailed text
78 wxWindow *windowPane = m_detailsPane->GetPane();
79 wxSizer *sizerPane = new wxBoxSizer( wxHORIZONTAL );
80 sizerPane->Add( new wxStaticText( windowPane, -1, m_detailedText ) );
81 windowPane->SetSizer( sizerPane );
82
83 sizerDetails->Add( m_detailsPane, wxSizerFlags().Right().Expand() );
84 sizer->Add( sizerDetails, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
85 }
86}
87
d482d5e4
VZ
88bool wxGenericRichMessageDialog::IsCheckBoxChecked() const
89{
90 // This function can be called before the dialog is shown and hence before
91 // the check box is created.
92 return m_checkBox? m_checkBoxValue : m_checkBox->IsChecked();
93}
94
a1bdd4ab 95#endif // wxUSE_RICHMSGDLG