]> git.saurik.com Git - wxWidgets.git/blame - include/wx/tglbtn.h
extracted wxWrapSizer in separate files and somewhat improved it (heavily modified...
[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
8// RCS-ID: $Id$
9// Copyright: (c) 2000 Johnny C. Norris II
99d80019 10// License: 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"
21#include "wx/control.h" // base class
22
c058cafa 23extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TOGGLEBUTTON_CLICKED;
1db8dc4a 24
10ff9c61
RR
25// ----------------------------------------------------------------------------
26// wxToggleButtonBase
27// ----------------------------------------------------------------------------
28
53a2db12 29class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxControl
10ff9c61
RR
30{
31public:
32 wxToggleButtonBase() { }
33
34 // Get/set the value
35 virtual void SetValue(bool state) = 0;
36 virtual bool GetValue() const = 0;
37
38 void UpdateWindowUI(long flags)
39 {
40 wxControl::UpdateWindowUI(flags);
41
42 if ( !IsShown() )
43 return;
44
45 wxWindow *tlw = wxGetTopLevelParent( this );
46 if (tlw && wxPendingDelete.Member( tlw ))
47 return;
48
49 wxUpdateUIEvent event( GetId() );
50 event.SetEventObject(this);
51
52 if (GetEventHandler()->ProcessEvent(event) )
53 {
54 if ( event.GetSetChecked() )
55 SetValue( event.GetChecked() );
56 }
57 }
58
59 // Buttons on MSW can look bad if they are not native colours, because
60 // then they become owner-drawn and not theme-drawn. Disable it here
61 // in wxToggleButtonBase to make it consistent.
62 virtual bool ShouldInheritColours() const { return false; }
63
64protected:
65 // choose the default border for this window
66 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
67
68 DECLARE_NO_COPY_CLASS(wxToggleButtonBase)
69};
70
71
7fa03f04
VZ
72#define EVT_TOGGLEBUTTON(id, fn) \
73 wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn))
1db8dc4a 74
43be3c33
JS
75#if defined(__WXUNIVERSAL__)
76 #include "wx/univ/tglbtn.h"
77#elif defined(__WXMSW__)
1db8dc4a 78 #include "wx/msw/tglbtn.h"
1be7a35c 79#elif defined(__WXGTK20__)
1db8dc4a 80 #include "wx/gtk/tglbtn.h"
1be7a35c
MR
81#elif defined(__WXGTK__)
82 #include "wx/gtk1/tglbtn.h"
1db8dc4a 83# elif defined(__WXMOTIF__)
08e5319b 84 #include "wx/motif/tglbtn.h"
eabe6af8
SC
85#elif defined(__WXMAC__)
86 #include "wx/mac/tglbtn.h"
bdb54365
WS
87#elif defined(__WXPALMOS__)
88 #include "wx/palmos/tglbtn.h"
e8344916
DW
89#elif defined(__WXPM__)
90 #include "wx/os2/tglbtn.h"
1db8dc4a
VZ
91#endif
92
93#endif // wxUSE_TOGGLEBTN
94
95#endif // _WX_TOGGLEBUTTON_H_BASE_
96