]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/palmos/checkbox.cpp | |
3 | // Purpose: wxCheckBox | |
4 | // Author: William Osborne - minimal working wxPalmOS port | |
5 | // Modified by: Wlodzimierz ABX Skiba - native implementation | |
6 | // Created: 10/13/04 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
21 | #pragma implementation "checkbox.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #if wxUSE_CHECKBOX | |
32 | ||
33 | #ifndef WX_PRECOMP | |
34 | #include "wx/checkbox.h" | |
35 | #include "wx/brush.h" | |
36 | #include "wx/dcscreen.h" | |
37 | #include "wx/settings.h" | |
38 | #endif | |
39 | ||
40 | // ============================================================================ | |
41 | // implementation | |
42 | // ============================================================================ | |
43 | ||
44 | #if wxUSE_EXTENDED_RTTI | |
45 | WX_DEFINE_FLAGS( wxCheckBoxStyle ) | |
46 | ||
47 | wxBEGIN_FLAGS( wxCheckBoxStyle ) | |
48 | // new style border flags, we put them first to | |
49 | // use them for streaming out | |
50 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) | |
51 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
52 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
53 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
54 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
55 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
56 | ||
57 | // old style border flags | |
58 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) | |
59 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
60 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
61 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
62 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
63 | wxFLAGS_MEMBER(wxNO_BORDER) | |
64 | ||
65 | // standard window styles | |
66 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) | |
67 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
68 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
69 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
70 | wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE) | |
71 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) | |
72 | wxFLAGS_MEMBER(wxVSCROLL) | |
73 | wxFLAGS_MEMBER(wxHSCROLL) | |
74 | ||
75 | wxEND_FLAGS( wxCheckBoxStyle ) | |
76 | ||
77 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl,"wx/checkbox.h") | |
78 | ||
79 | wxBEGIN_PROPERTIES_TABLE(wxCheckBox) | |
80 | wxEVENT_PROPERTY( Click , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) | |
81 | ||
82 | wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
83 | wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
84 | wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
85 | wxPROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style | |
86 | wxEND_PROPERTIES_TABLE() | |
87 | ||
88 | wxBEGIN_HANDLERS_TABLE(wxCheckBox) | |
89 | wxEND_HANDLERS_TABLE() | |
90 | ||
91 | wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) | |
92 | #else | |
93 | IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) | |
94 | #endif | |
95 | ||
96 | ||
97 | // ---------------------------------------------------------------------------- | |
98 | // wxCheckBox | |
99 | // ---------------------------------------------------------------------------- | |
100 | ||
101 | bool wxCheckBox::Create(wxWindow *parent, | |
102 | wxWindowID id, | |
103 | const wxString& label, | |
104 | const wxPoint& pos, | |
105 | const wxSize& size, long style, | |
106 | const wxValidator& validator, | |
107 | const wxString& name) | |
108 | { | |
109 | if(!wxControl::Create(parent, id, pos, size, style, validator, name)) | |
110 | return false; | |
111 | ||
112 | return wxControl::PalmCreateControl(checkboxCtl, label, pos, size); | |
113 | } | |
114 | ||
115 | wxSize wxCheckBox::DoGetBestSize() const | |
116 | { | |
117 | return wxSize(0,0); | |
118 | } | |
119 | ||
120 | void wxCheckBox::SetValue(bool val) | |
121 | { | |
122 | SetBoolValue(val); | |
123 | } | |
124 | ||
125 | bool wxCheckBox::GetValue() const | |
126 | { | |
127 | return GetBoolValue(); | |
128 | } | |
129 | ||
130 | bool wxCheckBox::SendClickEvent() | |
131 | { | |
132 | wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId()); | |
133 | event.SetInt(GetValue()); | |
134 | event.SetEventObject(this); | |
135 | return ProcessCommand(event); | |
136 | } | |
137 | ||
138 | void wxCheckBox::Command(wxCommandEvent& event) | |
139 | { | |
140 | } | |
141 | ||
142 | void wxCheckBox::DoSet3StateValue(wxCheckBoxState state) | |
143 | { | |
144 | } | |
145 | ||
146 | wxCheckBoxState wxCheckBox::DoGet3StateValue() const | |
147 | { | |
148 | return (wxCheckBoxState) 0; | |
149 | } | |
150 | ||
151 | #endif // wxUSE_CHECKBOX |