RadioGroup Class Reference

Allows user interface gadgets (GadgetID) to be associated with objects (CCObject), which can then respond to messages sent to the gadgets. More...

#include <radio.h>

List of all members.

Public Member Functions

 RadioGroup (DialogOp *pDialog=NULL, CGadgetAssociation *AssocArray=NULL, UINT32 NumGadgets=0)
BOOL SetAssociations (DialogOp *pDialog, CGadgetAssociation *AssocArray, UINT32 NumGadgets)
 Sets up the RadioGroup. Call prior to any other member.
CCObjectGetDefault ()
 Allows the setting of a new ApplyNow state.
BOOL SetDefault (CCObject *pDefaultObject)
 Sets the gadget associated with the given object as the default (using SetBoolGadgetSelected).
UINT32 GetRadioBoxCount ()
BOOL Disable ()
 Disables all the radio items in this group.
BOOL Enable ()
 Disables all the radio items in this group.
CCObjectGetSelected ()
 Allows the setting of a new ApplyNow state.

Protected Attributes

DialogOpm_pDialog
CGadgetAssociationm_Associations
UINT32 m_nNumAssociations

Private Member Functions

 CC_DECLARE_MEMDUMP (RadioGroup)


Detailed Description

Allows user interface gadgets (GadgetID) to be associated with objects (CCObject), which can then respond to messages sent to the gadgets.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Notes: Subsequent to construction, but prior to any other member invocations, SetAssociations() must be called. The AssocArray argument should be declared something like: MonoOn: static const UINT32 NUM_GADGETS = 2;

static CGadgetAssociation ColourUnitAssociations[NUM_GADGETS] = { {_R(IDC_GADGET1), PointerToObject1}, {_R(IDC_GADGET2), PointerToObject2} }; MonoOff:

This class is under construction and will probably change.

Scope: public

See also:
CGadgetAssociation

Definition at line 153 of file radio.h.


Constructor & Destructor Documentation

RadioGroup::RadioGroup DialogOp pDialog = NULL,
CGadgetAssociation AssocArray = NULL,
UINT32  NumGadgets = 0
[inline]
 

Definition at line 158 of file radio.h.

00158                                                                                                        : 
00159         m_pDialog(pDialog), m_Associations(AssocArray), m_nNumAssociations(NumGadgets) {}


Member Function Documentation

RadioGroup::CC_DECLARE_MEMDUMP RadioGroup   )  [private]
 

BOOL RadioGroup::Disable  ) 
 

Disables all the radio items in this group.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful FALSE otherwise

Errors: ERROR2IF no dialog associated with this RadioGroup

See also:
Enable()

Definition at line 184 of file radio.cpp.

00185 {
00186     ERROR2IF(m_pDialog == NULL, FALSE, "RadioGroup::Disable - m_pDialog not set");
00187 
00188     for (UINT32 i = 0; i < GetRadioBoxCount(); i++)
00189     {
00190         m_pDialog->EnableGadget(m_Associations[i].m_GadgetID, FALSE);
00191     }
00192     return TRUE;
00193 }

BOOL RadioGroup::Enable  ) 
 

Disables all the radio items in this group.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful FALSE otherwise

Errors: ERROR2IF no dialog associated with this RadioGroup

See also:
Enable()

Definition at line 211 of file radio.cpp.

00212 {
00213     ERROR2IF(m_pDialog == NULL, FALSE, "RadioGroup::Disable - m_pDialog not set");
00214 
00215     for (UINT32 i = 0; i < GetRadioBoxCount(); i++)
00216     {
00217         m_pDialog->EnableGadget(m_Associations[i].m_GadgetID, FALSE);
00218     }
00219     return TRUE;
00220 }

CCObject * RadioGroup::GetDefault  ) 
 

Allows the setting of a new ApplyNow state.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
NULL

Errors: ERROR3IF always because its not implemented. Do not use

See also:
class RadioGroup

Definition at line 161 of file radio.cpp.

00162 {
00163     ERROR3IF(TRUE, "RadioGroup::GetDefault() - not implemented");
00164 
00165     return NULL;
00166 }

UINT32 RadioGroup::GetRadioBoxCount  )  [inline]
 

Definition at line 164 of file radio.h.

00164 {return m_nNumAssociations;}

CCObject * RadioGroup::GetSelected  ) 
 

Allows the setting of a new ApplyNow state.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Pointer to the Object associated with the radio box selected

Errors: ERROR2IF no dialog associated with this RadioGroup

See also:
class RadioGroup

Definition at line 268 of file radio.cpp.

00269 {
00270     ERROR2IF(m_pDialog == NULL, NULL, "RadioGroup::GetSelected - m_pDialog not set");
00271 
00272     for (UINT32 i = 0; i < GetRadioBoxCount(); i++)
00273     {
00274         if (m_pDialog->GetBoolGadgetSelected(m_Associations[i].m_GadgetID))
00275             return (m_Associations[i].m_pObject);
00276 
00277     }
00278     ERROR3IF(TRUE, "RadioGroup::GetSelected() - None selected");
00279     return NULL;
00280 }   

BOOL RadioGroup::SetAssociations DialogOp pDialog,
CGadgetAssociation AssocArray,
UINT32  NumGadgets
 

Sets up the RadioGroup. Call prior to any other member.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Parameters:
pDialog - The dialog in which this RadioGroup is [INPUTS] AssocArray - the array of CGadgetID / CCObject associations NumGadgets - the number of radio items in the array
- [OUTPUTS]
Returns:
TRUE if set OK

Errors: ERROR2IF pDialog, AssocArray NULL or NumGadgets zero

See also:
class RadioGroup

Definition at line 134 of file radio.cpp.

00135 {
00136     ERROR2IF(pDialog == NULL, FALSE, "RadioGroup::SetAssociations() - pDialog NULL");
00137     ERROR2IF(AssocArray == NULL, FALSE, "RadioGroup::SetAssociations() - AssocArray NULL");
00138     ERROR2IF(NumGadgets == 0, FALSE, "RadioGroup::SetAssociations() - NumGadgets is zero");
00139 
00140     m_pDialog = pDialog;
00141     m_Associations = AssocArray;
00142     m_nNumAssociations = NumGadgets;
00143     return TRUE;
00144 }

BOOL RadioGroup::SetDefault CCObject pDefaultObject  ) 
 

Sets the gadget associated with the given object as the default (using SetBoolGadgetSelected).

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/05/96
Parameters:
pDefaultObject - pointer to the object [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the gadget with which pDefaultObject is associated was set FALSE otherwise

Errors: ERROR2IF no dialog associated with this RadioGroup ERROR3IF pDefaultObject is not associated with any gadget in this radio group

See also:
class RadioGroup

Definition at line 240 of file radio.cpp.

00241 {
00242     ERROR2IF(m_pDialog == NULL, FALSE, "RadioGroup::SetDefault - m_pDialog not set");
00243 
00244     for (UINT32 i = 0; i < GetRadioBoxCount(); i++)
00245     {
00246         if (m_Associations[i].m_pObject == pDefaultObject)
00247             return (m_pDialog->SetBoolGadgetSelected(m_Associations[i].m_GadgetID, TRUE));
00248     }
00249     ERROR3IF(TRUE, "RadioGroup::SetDefault - pDefaultObject not in RadioGroup");
00250     return FALSE;
00251 }   


Member Data Documentation

CGadgetAssociation* RadioGroup::m_Associations [protected]
 

Definition at line 172 of file radio.h.

UINT32 RadioGroup::m_nNumAssociations [protected]
 

Definition at line 173 of file radio.h.

DialogOp* RadioGroup::m_pDialog [protected]
 

Definition at line 171 of file radio.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:17 2007 for Camelot by  doxygen 1.4.4