2009-11-18 07:53:02 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "PrecompiledHeader.h"
|
|
|
|
#include "pxCheckBox.h"
|
|
|
|
#include "pxStaticText.h"
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// pxCheckBox Implementations
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
pxCheckBox::pxCheckBox(wxWindow* parent, const wxString& label, const wxString& subtext)
|
|
|
|
: wxPanelWithHelpers( parent, wxVERTICAL )
|
|
|
|
{
|
|
|
|
Init( label, subtext );
|
|
|
|
}
|
|
|
|
|
|
|
|
void pxCheckBox::Init(const wxString& label, const wxString& subtext)
|
|
|
|
{
|
|
|
|
m_subtext = NULL;
|
|
|
|
m_checkbox = new wxCheckBox( this, wxID_ANY, label );
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2009-11-19 05:08:24 +00:00
|
|
|
*this += m_checkbox | pxSizerFlags::StdExpand();
|
2009-11-18 07:53:02 +00:00
|
|
|
|
|
|
|
static const int Indentation = 23;
|
|
|
|
if( !subtext.IsEmpty() )
|
|
|
|
{
|
|
|
|
m_subtext = new pxStaticText( this, subtext );
|
|
|
|
if( HasIdealWidth() )
|
|
|
|
m_subtext->SetWrapWidth( m_idealWidth - Indentation );
|
|
|
|
|
2009-11-19 05:08:24 +00:00
|
|
|
wxBoxSizer& spaced( *new wxBoxSizer( wxHORIZONTAL ) );
|
|
|
|
spaced += Indentation;
|
2010-01-31 02:21:58 +00:00
|
|
|
spaced += m_subtext | pxBorder( wxBOTTOM, 9 );
|
2009-11-19 05:08:24 +00:00
|
|
|
spaced += pxSizerFlags::StdPadding;
|
|
|
|
|
|
|
|
*this += &spaced;
|
2009-11-18 07:53:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// applies the tooltip to both both the checkbox and it's static subtext (if present), and
|
|
|
|
// performs word wrapping on platforms that need it (eg mswindows).
|
|
|
|
pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip )
|
|
|
|
{
|
|
|
|
const wxString wrapped( pxFormatToolTipText(this, tip) );
|
|
|
|
pxSetToolTip( m_checkbox, wrapped );
|
|
|
|
pxSetToolTip( m_subtext, wrapped );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
pxCheckBox& pxCheckBox::SetValue( bool val )
|
|
|
|
{
|
|
|
|
m_checkbox->SetValue( val );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pxCheckBox::GetValue() const
|
|
|
|
{
|
|
|
|
return m_checkbox->GetValue();
|
|
|
|
}
|
2009-11-19 13:44:44 +00:00
|
|
|
|
|
|
|
void operator+=( wxSizer& target, pxCheckBox* src )
|
|
|
|
{
|
|
|
|
if( !pxAssert( src != NULL ) ) return;
|
2010-01-31 02:21:58 +00:00
|
|
|
target.Add( src, pxExpand );
|
2009-11-19 13:44:44 +00:00
|
|
|
}
|
2009-11-25 03:54:57 +00:00
|
|
|
|
|
|
|
void operator+=( wxSizer& target, pxCheckBox& src )
|
|
|
|
{
|
2010-01-31 02:21:58 +00:00
|
|
|
target.Add( &src, pxExpand );
|
2009-11-25 03:54:57 +00:00
|
|
|
}
|
2009-12-14 12:18:55 +00:00
|
|
|
|
|
|
|
void operator+=( wxSizer* target, pxCheckBox& src )
|
|
|
|
{
|
2010-01-31 02:21:58 +00:00
|
|
|
target->Add( &src, pxExpand );
|
2009-12-14 12:18:55 +00:00
|
|
|
}
|