]>
Commit | Line | Data |
---|---|---|
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 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2000 Johnny C. Norris II | |
526954c5 | 10 | // Licence: wxWindows Licence |
1db8dc4a VZ |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _WX_TOGGLEBUTTON_H_BASE_ | |
14 | #define _WX_TOGGLEBUTTON_H_BASE_ | |
15 | ||
16 | #include "wx/defs.h" | |
17 | ||
18 | #if wxUSE_TOGGLEBTN | |
19 | ||
20 | #include "wx/event.h" | |
b4354db1 | 21 | #include "wx/anybutton.h" // base class |
1db8dc4a | 22 | |
4add61fd VZ |
23 | extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; |
24 | ||
9b11752c | 25 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent ); |
1db8dc4a | 26 | |
10ff9c61 RR |
27 | // ---------------------------------------------------------------------------- |
28 | // wxToggleButtonBase | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
b4354db1 | 31 | class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton |
10ff9c61 RR |
32 | { |
33 | public: | |
34 | wxToggleButtonBase() { } | |
35 | ||
36 | // Get/set the value | |
37 | virtual void SetValue(bool state) = 0; | |
38 | virtual bool GetValue() const = 0; | |
39 | ||
40 | void UpdateWindowUI(long flags) | |
41 | { | |
42 | wxControl::UpdateWindowUI(flags); | |
43 | ||
44 | if ( !IsShown() ) | |
45 | return; | |
46 | ||
47 | wxWindow *tlw = wxGetTopLevelParent( this ); | |
48 | if (tlw && wxPendingDelete.Member( tlw )) | |
49 | return; | |
50 | ||
51 | wxUpdateUIEvent event( GetId() ); | |
52 | event.SetEventObject(this); | |
53 | ||
54 | if (GetEventHandler()->ProcessEvent(event) ) | |
55 | { | |
56 | if ( event.GetSetChecked() ) | |
57 | SetValue( event.GetChecked() ); | |
58 | } | |
59 | } | |
60 | ||
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; } | |
65 | ||
66 | protected: | |
67 | // choose the default border for this window | |
68 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } | |
69 | ||
c0c133e1 | 70 | wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase); |
10ff9c61 RR |
71 | }; |
72 | ||
73 | ||
7fa03f04 VZ |
74 | #define EVT_TOGGLEBUTTON(id, fn) \ |
75 | wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn)) | |
1db8dc4a | 76 | |
43be3c33 JS |
77 | #if defined(__WXUNIVERSAL__) |
78 | #include "wx/univ/tglbtn.h" | |
79 | #elif defined(__WXMSW__) | |
1db8dc4a | 80 | #include "wx/msw/tglbtn.h" |
323d36e4 | 81 | #define wxHAS_BITMAPTOGGLEBUTTON |
1be7a35c | 82 | #elif defined(__WXGTK20__) |
1db8dc4a | 83 | #include "wx/gtk/tglbtn.h" |
323d36e4 | 84 | #define wxHAS_BITMAPTOGGLEBUTTON |
1be7a35c MR |
85 | #elif defined(__WXGTK__) |
86 | #include "wx/gtk1/tglbtn.h" | |
1db8dc4a | 87 | # elif defined(__WXMOTIF__) |
08e5319b | 88 | #include "wx/motif/tglbtn.h" |
eabe6af8 | 89 | #elif defined(__WXMAC__) |
ef0e9220 | 90 | #include "wx/osx/tglbtn.h" |
323d36e4 | 91 | #define wxHAS_BITMAPTOGGLEBUTTON |
e8344916 DW |
92 | #elif defined(__WXPM__) |
93 | #include "wx/os2/tglbtn.h" | |
1db8dc4a VZ |
94 | #endif |
95 | ||
96 | #endif // wxUSE_TOGGLEBTN | |
97 | ||
98 | #endif // _WX_TOGGLEBUTTON_H_BASE_ | |
99 |