1 /////////////////////////////////////////////////////////////////////////////
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
9 // Copyright: (c) 2000 Johnny C. Norris II
10 // Licence: wxWindows Licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_TOGGLEBUTTON_H_BASE_
14 #define _WX_TOGGLEBUTTON_H_BASE_
21 #include "wx/anybutton.h" // base class
23 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr
[];
25 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_TOGGLEBUTTON
, wxCommandEvent
);
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLIMPEXP_CORE wxToggleButtonBase
: public wxAnyButton
34 wxToggleButtonBase() { }
37 virtual void SetValue(bool state
) = 0;
38 virtual bool GetValue() const = 0;
40 void UpdateWindowUI(long flags
)
42 wxControl::UpdateWindowUI(flags
);
47 wxWindow
*tlw
= wxGetTopLevelParent( this );
48 if (tlw
&& wxPendingDelete
.Member( tlw
))
51 wxUpdateUIEvent
event( GetId() );
52 event
.SetEventObject(this);
54 if (GetEventHandler()->ProcessEvent(event
) )
56 if ( event
.GetSetChecked() )
57 SetValue( event
.GetChecked() );
61 // Buttons on MSW can look bad if they are not native colours, because
62 // then they become owner-drawn and not theme-drawn. Disable it here
63 // in wxToggleButtonBase to make it consistent.
64 virtual bool ShouldInheritColours() const { return false; }
67 // choose the default border for this window
68 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
70 wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase
);
74 #define EVT_TOGGLEBUTTON(id, fn) \
75 wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn))
77 #if defined(__WXUNIVERSAL__)
78 #include "wx/univ/tglbtn.h"
79 #elif defined(__WXMSW__)
80 #include "wx/msw/tglbtn.h"
81 #define wxHAS_BITMAPTOGGLEBUTTON
82 #elif defined(__WXGTK20__)
83 #include "wx/gtk/tglbtn.h"
84 #define wxHAS_BITMAPTOGGLEBUTTON
85 #elif defined(__WXGTK__)
86 #include "wx/gtk1/tglbtn.h"
87 # elif defined(__WXMOTIF__)
88 #include "wx/motif/tglbtn.h"
89 #elif defined(__WXMAC__)
90 #include "wx/osx/tglbtn.h"
91 #define wxHAS_BITMAPTOGGLEBUTTON
92 #elif defined(__WXPM__)
93 #include "wx/os2/tglbtn.h"
96 // old wxEVT_COMMAND_* constants
97 #define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON
99 #endif // wxUSE_TOGGLEBTN
101 #endif // _WX_TOGGLEBUTTON_H_BASE_