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
8 // Copyright: (c) 2000 Johnny C. Norris II
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TOGGLEBUTTON_H_BASE_
13 #define _WX_TOGGLEBUTTON_H_BASE_
20 #include "wx/anybutton.h" // base class
22 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr
[];
24 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_TOGGLEBUTTON
, wxCommandEvent
);
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 class WXDLLIMPEXP_CORE wxToggleButtonBase
: public wxAnyButton
33 wxToggleButtonBase() { }
36 virtual void SetValue(bool state
) = 0;
37 virtual bool GetValue() const = 0;
39 void UpdateWindowUI(long flags
)
41 wxControl::UpdateWindowUI(flags
);
46 wxWindow
*tlw
= wxGetTopLevelParent( this );
47 if (tlw
&& wxPendingDelete
.Member( tlw
))
50 wxUpdateUIEvent
event( GetId() );
51 event
.SetEventObject(this);
53 if (GetEventHandler()->ProcessEvent(event
) )
55 if ( event
.GetSetChecked() )
56 SetValue( event
.GetChecked() );
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; }
66 // choose the default border for this window
67 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
69 wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase
);
73 #define EVT_TOGGLEBUTTON(id, fn) \
74 wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn))
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"
95 // old wxEVT_COMMAND_* constants
96 #define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON
98 #endif // wxUSE_TOGGLEBTN
100 #endif // _WX_TOGGLEBUTTON_H_BASE_