Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / include / wx / tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/tglbtn.h
3 // Purpose: This dummy header includes the proper header file for the
4 // system we're compiling under.
5 // Author: John Norris, minor changes by Axel Schlueter
6 // Modified by:
7 // Created: 08.02.01
8 // Copyright: (c) 2000 Johnny C. Norris II
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TOGGLEBUTTON_H_BASE_
13 #define _WX_TOGGLEBUTTON_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_TOGGLEBTN
18
19 #include "wx/event.h"
20 #include "wx/anybutton.h" // base class
21
22 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
23
24 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOGGLEBUTTON, wxCommandEvent );
25
26 // ----------------------------------------------------------------------------
27 // wxToggleButtonBase
28 // ----------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton
31 {
32 public:
33 wxToggleButtonBase() { }
34
35 // Get/set the value
36 virtual void SetValue(bool state) = 0;
37 virtual bool GetValue() const = 0;
38
39 void UpdateWindowUI(long flags)
40 {
41 wxControl::UpdateWindowUI(flags);
42
43 if ( !IsShown() )
44 return;
45
46 wxWindow *tlw = wxGetTopLevelParent( this );
47 if (tlw && wxPendingDelete.Member( tlw ))
48 return;
49
50 wxUpdateUIEvent event( GetId() );
51 event.SetEventObject(this);
52
53 if (GetEventHandler()->ProcessEvent(event) )
54 {
55 if ( event.GetSetChecked() )
56 SetValue( event.GetChecked() );
57 }
58 }
59
60 // Buttons on MSW can look bad if they are not native colours, because
61 // then they become owner-drawn and not theme-drawn. Disable it here
62 // in wxToggleButtonBase to make it consistent.
63 virtual bool ShouldInheritColours() const { return false; }
64
65 protected:
66 // choose the default border for this window
67 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
68
69 wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase);
70 };
71
72
73 #define EVT_TOGGLEBUTTON(id, fn) \
74 wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn))
75
76 #if defined(__WXUNIVERSAL__)
77 #include "wx/univ/tglbtn.h"
78 #elif defined(__WXMSW__)
79 #include "wx/msw/tglbtn.h"
80 #define wxHAS_BITMAPTOGGLEBUTTON
81 #elif defined(__WXGTK20__)
82 #include "wx/gtk/tglbtn.h"
83 #define wxHAS_BITMAPTOGGLEBUTTON
84 #elif defined(__WXGTK__)
85 #include "wx/gtk1/tglbtn.h"
86 # elif defined(__WXMOTIF__)
87 #include "wx/motif/tglbtn.h"
88 #elif defined(__WXMAC__)
89 #include "wx/osx/tglbtn.h"
90 #define wxHAS_BITMAPTOGGLEBUTTON
91 #elif defined(__WXPM__)
92 #include "wx/os2/tglbtn.h"
93 #endif
94
95 // old wxEVT_COMMAND_* constants
96 #define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON
97
98 #endif // wxUSE_TOGGLEBTN
99
100 #endif // _WX_TOGGLEBUTTON_H_BASE_
101