]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/tglbtn.cpp
adding missing file
[wxWidgets.git] / src / palmos / tglbtn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/tglbtn.cpp
3 // Purpose: Definition of the wxToggleButton class, which implements a
4 // toggle button.
5 // Author: William Osborne - minimal working wxPalmOS port
6 // Modified by: Wlodzimierz ABX Skiba - native implementation
7 // Created: 10/13/04
8 // RCS-ID: $Id$
9 // Copyright: (c) William Osborne, Wlodzimierz Skiba
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 // ============================================================================
14 // declatations
15 // ============================================================================
16
17 // ----------------------------------------------------------------------------
18 // headers
19 // ----------------------------------------------------------------------------
20
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_TOGGLEBTN
28
29 #include "wx/tglbtn.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/button.h"
33 #include "wx/brush.h"
34 #include "wx/dcscreen.h"
35 #include "wx/settings.h"
36
37 #include "wx/log.h"
38 #endif // WX_PRECOMP
39
40 #include <Control.h>
41
42 // ----------------------------------------------------------------------------
43 // macros
44 // ----------------------------------------------------------------------------
45
46 IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl)
47 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
48
49 // ============================================================================
50 // implementation
51 // ============================================================================
52
53 // ----------------------------------------------------------------------------
54 // wxToggleButton
55 // ----------------------------------------------------------------------------
56
57 // Single check box item
58 bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
59 const wxString& label,
60 const wxPoint& pos,
61 const wxSize& size, long style,
62 const wxValidator& validator,
63 const wxString& name)
64 {
65 if(!wxControl::Create(parent, id, pos, size, style, validator, name))
66 return false;
67
68 return wxControl::PalmCreateControl(pushButtonCtl, label, pos, size);
69 }
70
71 wxBorder wxToggleButton::GetDefaultBorder() const
72 {
73 return wxBORDER_NONE;
74 }
75
76 wxSize wxToggleButton::DoGetBestSize() const
77 {
78 return wxSize(0,0);
79 }
80
81 void wxToggleButton::SetValue(bool val)
82 {
83 SetBoolValue(val);
84 }
85
86 bool wxToggleButton::GetValue() const
87 {
88 return GetBoolValue();
89 }
90
91 bool wxToggleButton::SendClickEvent()
92 {
93 wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId());
94 event.SetInt(GetValue());
95 event.SetEventObject(this);
96 return ProcessCommand(event);
97 }
98
99 void wxToggleButton::Command(wxCommandEvent & event)
100 {
101 }
102
103 #endif // wxUSE_TOGGLEBTN