]> git.saurik.com Git - wxWidgets.git/blame - include/wx/tglbtn.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / tglbtn.h
CommitLineData
1db8dc4a
VZ
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
1db8dc4a 8// Copyright: (c) 2000 Johnny C. Norris II
526954c5 9// Licence: wxWindows Licence
1db8dc4a
VZ
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"
b4354db1 20#include "wx/anybutton.h" // base class
1db8dc4a 21
4add61fd
VZ
22extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
23
ce7fe42e 24wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOGGLEBUTTON, wxCommandEvent );
1db8dc4a 25
10ff9c61
RR
26// ----------------------------------------------------------------------------
27// wxToggleButtonBase
28// ----------------------------------------------------------------------------
29
b4354db1 30class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton
10ff9c61
RR
31{
32public:
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
65protected:
66 // choose the default border for this window
67 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
68
c0c133e1 69 wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase);
10ff9c61
RR
70};
71
72
7fa03f04 73#define EVT_TOGGLEBUTTON(id, fn) \
ce7fe42e 74 wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn))
1db8dc4a 75
43be3c33
JS
76#if defined(__WXUNIVERSAL__)
77 #include "wx/univ/tglbtn.h"
78#elif defined(__WXMSW__)
1db8dc4a 79 #include "wx/msw/tglbtn.h"
323d36e4 80 #define wxHAS_BITMAPTOGGLEBUTTON
1be7a35c 81#elif defined(__WXGTK20__)
1db8dc4a 82 #include "wx/gtk/tglbtn.h"
323d36e4 83 #define wxHAS_BITMAPTOGGLEBUTTON
1be7a35c
MR
84#elif defined(__WXGTK__)
85 #include "wx/gtk1/tglbtn.h"
1db8dc4a 86# elif defined(__WXMOTIF__)
08e5319b 87 #include "wx/motif/tglbtn.h"
eabe6af8 88#elif defined(__WXMAC__)
ef0e9220 89 #include "wx/osx/tglbtn.h"
323d36e4 90 #define wxHAS_BITMAPTOGGLEBUTTON
e8344916
DW
91#elif defined(__WXPM__)
92 #include "wx/os2/tglbtn.h"
1db8dc4a
VZ
93#endif
94
ce7fe42e
VZ
95// old wxEVT_COMMAND_* constants
96#define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON
97
1db8dc4a
VZ
98#endif // wxUSE_TOGGLEBTN
99
100#endif // _WX_TOGGLEBUTTON_H_BASE_
101