/[pcsx2_0.9.7]/trunk/common/include/Utilities/pxCheckBox.h
ViewVC logotype

Annotation of /trunk/common/include/Utilities/pxCheckBox.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 2853 byte(s)
committing r3113 initial commit again...
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16     #pragma once
17    
18     #include <wx/wx.h>
19     #include "wxGuiTools.h"
20    
21     // -------------------------------------------------------------------------------------
22     // pxCheckBox
23     // --------------------------------------------------------------------------------------
24     // The checkbox panel created uses the default spacer setting for adding checkboxes (see
25     // SizerFlags). The SetToolTip API provided by this function applies the tooltip to both
26     // both the checkbox and it's static subtext (if present), and performs word wrapping on
27     // platforms that need it (eg mswindows).
28     //
29     class pxCheckBox : public wxPanelWithHelpers
30     {
31     protected:
32     wxCheckBox* m_checkbox;
33     pxStaticText* m_subtext;
34    
35     public:
36     pxCheckBox( wxWindow* parent, const wxString& label, const wxString& subtext=wxEmptyString );
37     virtual ~pxCheckBox() throw() {}
38    
39     bool HasSubText() const { return m_subtext != NULL; }
40     const pxStaticText* GetSubText() const { return m_subtext; }
41    
42     pxCheckBox& SetToolTip( const wxString& tip );
43     pxCheckBox& SetValue( bool val );
44     bool GetValue() const;
45     bool IsChecked() const { pxAssert( m_checkbox != NULL ); return m_checkbox->IsChecked(); }
46    
47     operator wxCheckBox&() { pxAssert( m_checkbox != NULL ); return *m_checkbox; }
48     operator const wxCheckBox&() const { pxAssert( m_checkbox != NULL ); return *m_checkbox; }
49    
50     wxCheckBox* GetWxPtr() { return m_checkbox; }
51     const wxCheckBox* GetWxPtr() const { return m_checkbox; }
52    
53     //wxWindowID GetId() const { pxAssert( m_checkbox != NULL ); return m_checkbox->GetId(); }
54    
55     protected:
56     void Init( const wxString& label, const wxString& subtext );
57     void OnCheckpartCommand( wxCommandEvent& evt );
58     void OnSubtextClicked( wxCommandEvent& evt );
59     };
60    
61     extern void operator+=( wxSizer& target, pxCheckBox* src );
62     extern void operator+=( wxSizer& target, pxCheckBox& src );
63     extern void operator+=( wxSizer* target, pxCheckBox& src );
64    
65     template<>
66     inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxCheckBox>& src )
67     {
68     target.Add( src.window, src.flags );
69     }
70    
71     template<>
72     inline void operator+=( wxSizer* target, const pxWindowAndFlags<pxCheckBox>& src )
73     {
74     target->Add( src.window, src.flags );
75     }

  ViewVC Help
Powered by ViewVC 1.1.22