4 * Radio button control.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
30 * Revision 1.19 2001/05/22 12:49:33 robertj
31 * Did some seriously wierd rewrite of platform headers to eliminate the
32 * stupid GNU compiler warning about braces not matching.
34 * Revision 1.18 1999/03/10 03:49:53 robertj
35 * More documentation adjustments.
37 * Revision 1.17 1999/03/09 08:01:49 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.16 1999/02/16 08:08:46 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.15 1998/09/23 06:28:32 robertj
44 * Added open source copyright license.
46 * Revision 1.14 1995/03/14 12:42:20 robertj
47 * Updated documentation to use HTML codes.
49 * Revision 1.13 1995/01/14 06:19:25 robertj
52 * Revision 1.12 1994/10/30 11:47:01 robertj
53 * Changed mechanism for doing notification callback functions.
55 * Revision 1.11 1994/08/23 11:32:52 robertj
58 * Revision 1.10 1994/08/22 00:46:48 robertj
59 * Added pragma fro GNU C++ compiler.
61 * Revision 1.9 1994/06/25 11:55:15 robertj
62 * Unix version synchronisation.
64 * Revision 1.8 1994/03/07 07:38:19 robertj
65 * Major enhancementsacross the board.
67 * Revision 1.7 1994/01/15 02:50:29 robertj
68 * Moved control contructors to common and added a platform dependent Construct() function.
70 * Revision 1.6 1994/01/03 04:42:23 robertj
71 * Mass changes to common container classes and interactors etc etc etc.
73 * Revision 1.5 1993/12/15 21:10:10 robertj
74 * Changed group to use containers reference system.
76 * Revision 1.4 1993/09/27 16:35:25 robertj
77 * Removed special constructor for dialog resource loading.
79 * Revision 1.3 1993/08/21 01:50:33 robertj
80 * Made Clone() function optional, default will assert if called.
82 * Revision 1.2 1993/07/14 12:49:16 robertj
95 /**A simple radio button control. A set of radio buttons is used to select one
96 of a number of choices. A group of radio buttons may be created by passing
97 the first radio button created to all the others subsequently created. Then
98 whenever one of the buttons is selected all the other buttons in the group
99 are automatically deselected.
101 Note that a radio button can only be in one group at a time.
103 class PRadioButton
: public PNamedControl
105 PCLASSINFO(PRadioButton
, PNamedControl
);
108 /**Create a radio button with the specified parameters: name, notification
109 function and radio button group.
111 Add this button to the group that the #groupButton# parameter
112 is also contained in. This is typically the first button created.
115 PInteractor
* parent
/// Interactor into which the control is placed
118 PInteractor
* parent
, /// Interactor into which the control is placed.
119 const PString
& name
/// Text string name of the radio button.
122 PInteractor
* parent
, /// Interactor into which the control is placed.
123 const PString
& name
, /// Text string name of the radio button.
124 const PNotifier
& notify
/// Function to call when changes state.
127 PInteractor
* parent
, /// Interactor into which the control is placed.
128 const PString
& name
, /// Text string name of the radio button.
129 PRadioButton
& groupButton
/// A radio button in the group to be added to.
132 PInteractor
* parent
, /// Interactor into which the control is placed.
133 const PString
& name
, /// Text string name of the radio button.
134 const PNotifier
& notify
, /// Function to call when changes state.
135 PRadioButton
& groupButton
/// A radio button in the group to be added to.
138 /** Create control from interactor layout with the specified control ID. */
140 PInteractorLayout
* parent
, /// Interactor into which the box is placed.
141 PRESOURCE_ID ctlID
, /// Identifier for the control in the layout.
142 const PNotifier
& notify
, /// Function to call when changes state.
143 PINDEX
* valuePtr
/// Variable to change to the check box state.
146 /** Destroy the radio button, removing it from its group. */
147 virtual ~PRadioButton();
150 /**@name Overrides from class PControl */
151 /**This function transfers the value of the control to or from the variable
152 pointed to by the value pointer member variable.
154 virtual void TransferValue(
156 /**Transfer value option. When this is -1 when the function transfers
157 the value from the value pointer into the control. This is called in
158 \Ref{PDialog::OnInit()} function. When option is zero then the
159 function transfers the value from the control to the value pointer
160 variable. This is called just before the callback function every time
161 the radio button groups value changes.
166 /**@name New functions for class */
167 /** Set the default (minimum) dimensions for the control */
168 void DefaultDimensions();
170 /**Set the value of the radio button group. The buttons are created are
171 numbered from one up. This will set the button specifed deselecting all
172 the others. If the #newVal# parameter is out of the range 1
173 to the number of buttons in the group, all buttons are deselected
176 PINDEX newVal
/// New value for radio button group.
179 /**Get the currently selected button in the radio button group. If no
180 radio buttons in the group are selected then zero is returned.
183 index of selected radio button or zero if none selected.
185 PINDEX
GetValue() const;
187 /**Get the current value pointer associated with the control. The variable
188 pointed to by this is autamatically updated with the current value of
189 the radio button group.
192 value pointer associated with the control.
194 PINDEX
* GetValuePointer() const;
196 /**Set the current value pointer associated with the control. The variable
197 pointed to by this is autamatically updated with the current value of
198 the radio button group.
200 void SetValuePointer(
201 PINDEX
* ptr
/// New value pointer to associate with the control.
205 /**Add this button to the group that the #groupButton# parameter
206 is also contained in. This is typically the first button created.
209 PRadioButton
& groupButton
/// Radio button in the group to add to.
215 PLIST(Group
, PRadioButton
);
216 /**List of buttons in the group. This is a common container for all
217 buttons in the group.
223 // New functions for class
225 // Common, platform dependent, constructor code for the cosntructors.
228 // Include platform dependent part of class
229 #include <pwlib/rbutton.h>
233 // End Of File ///////////////////////////////////////////////////////////////