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