]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/radiobut.cpp
wxVariant is in wxBase so should be forward declared using WXDLLIMPEXP_BASE and not...
[wxWidgets.git] / src / palmos / radiobut.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/radiobut.cpp
ffecfa5a 3// Purpose: wxRadioButton
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
808e3bce 5// Modified by: Wlodzimierz ABX Skiba - native wxRadioButton implementation
ffecfa5a 6// Created: 10/13/04
e2731512 7// RCS-ID: $Id$
808e3bce 8// Copyright: (c) William Osborne, Wlodzimierz Skiba
ffecfa5a
JS
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 "radiobut.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_RADIOBTN
32
33#ifndef WX_PRECOMP
34 #include "wx/radiobut.h"
35 #include "wx/settings.h"
36 #include "wx/dcscreen.h"
37#endif
38
20bc5ad8
WS
39#include <Control.h>
40
ffecfa5a
JS
41// ============================================================================
42// wxRadioButton implementation
43// ============================================================================
44
45// ----------------------------------------------------------------------------
46// wxRadioButton creation
47// ----------------------------------------------------------------------------
48
49
50#if wxUSE_EXTENDED_RTTI
51WX_DEFINE_FLAGS( wxRadioButtonStyle )
52
53wxBEGIN_FLAGS( wxRadioButtonStyle )
54 // new style border flags, we put them first to
55 // use them for streaming out
56 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
57 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
58 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
59 wxFLAGS_MEMBER(wxBORDER_RAISED)
60 wxFLAGS_MEMBER(wxBORDER_STATIC)
61 wxFLAGS_MEMBER(wxBORDER_NONE)
e2731512 62
ffecfa5a
JS
63 // old style border flags
64 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
65 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
66 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
67 wxFLAGS_MEMBER(wxRAISED_BORDER)
68 wxFLAGS_MEMBER(wxSTATIC_BORDER)
69 wxFLAGS_MEMBER(wxBORDER)
70
71 // standard window styles
72 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
73 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
74 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
75 wxFLAGS_MEMBER(wxWANTS_CHARS)
76 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
77 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
78 wxFLAGS_MEMBER(wxVSCROLL)
79 wxFLAGS_MEMBER(wxHSCROLL)
80
81 wxFLAGS_MEMBER(wxRB_GROUP)
82
83wxEND_FLAGS( wxRadioButtonStyle )
84
85IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioButton, wxControl,"wx/radiobut.h")
86
87wxBEGIN_PROPERTIES_TABLE(wxRadioButton)
88 wxEVENT_PROPERTY( Click , wxEVT_COMMAND_RADIOBUTTON_SELECTED , wxCommandEvent )
89 wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
90 wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
91 wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
92 wxPROPERTY_FLAGS( WindowStyle , wxRadioButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
93wxEND_PROPERTIES_TABLE()
94
95wxBEGIN_HANDLERS_TABLE(wxRadioButton)
96wxEND_HANDLERS_TABLE()
97
e2731512 98wxCONSTRUCTOR_6( wxRadioButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle )
ffecfa5a
JS
99
100#else
101IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
102#endif
103
104
105void wxRadioButton::Init()
106{
a152561c 107 m_radioStyle = pushButtonCtl;
8be10866 108 m_groupID = 0;
ffecfa5a
JS
109}
110
111bool wxRadioButton::Create(wxWindow *parent,
112 wxWindowID id,
113 const wxString& label,
114 const wxPoint& pos,
115 const wxSize& size,
116 long style,
117 const wxValidator& validator,
118 const wxString& name)
119{
9a727a3b 120 // replace native push button with native checkbox
d79decb5 121 if ( style & wxRB_USE_CHECKBOX )
9a727a3b
WS
122 m_radioStyle = checkboxCtl;
123
a152561c
WS
124 if(!wxControl::Create(parent, id, pos, size, style, validator, name))
125 return false;
126
127 return wxControl::PalmCreateControl(
128 // be sure only one of two possibilities was taken
129 m_radioStyle == checkboxCtl ? checkboxCtl : pushButtonCtl,
130 label,
131 pos,
8be10866
WS
132 size,
133 m_groupID
a152561c 134 );
ffecfa5a
JS
135}
136
8be10866
WS
137void wxRadioButton::SetGroup(uint8_t group)
138{
139 m_groupID = group;
140}
141
ffecfa5a
JS
142// ----------------------------------------------------------------------------
143// wxRadioButton functions
144// ----------------------------------------------------------------------------
145
146void wxRadioButton::SetValue(bool value)
147{
808e3bce 148 SetBoolValue(value);
ffecfa5a
JS
149}
150
151bool wxRadioButton::GetValue() const
152{
808e3bce 153 return GetBoolValue();
ffecfa5a
JS
154}
155
156// ----------------------------------------------------------------------------
157// wxRadioButton event processing
158// ----------------------------------------------------------------------------
159
a152561c
WS
160bool wxRadioButton::SendClickEvent()
161{
162 wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, GetId());
163 event.SetInt(GetValue());
164 event.SetEventObject(this);
165 return ProcessCommand(event);
166}
167
ffecfa5a
JS
168void wxRadioButton::Command (wxCommandEvent& event)
169{
170}
171
ffecfa5a
JS
172// ----------------------------------------------------------------------------
173// wxRadioButton geometry
174// ----------------------------------------------------------------------------
175
176wxSize wxRadioButton::DoGetBestSize() const
177{
178 return wxSize(0,0);
179}
180
181#endif // wxUSE_RADIOBTN
182