Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Dialog Class Reference

Base class for handling dialogs in CPLAT.

Inheritance diagram for CP_Dialog:

CP_Object CP_SigSlot::CP_SlotObject CP_NoCopy List of all members.

Public Types

enum  { kCP_DialogModality_Modal, kCP_DialogModality_Modeless }

Public Member Functions

void SetID (FourCharCode inIdentifier)
FourCharCode GetID ()
void RegisterSignal (const CP_SignalHolder &inSignal)
CP_DataValueSignal * FindSignal (const CP_String &inSignalName)
UInt32 GetNumberSignals ()
CP_String GetNthSignalName (UInt32 inSignalIndex)
void RegisterSlot (const CP_SlotHolder &inSlot)
CP_DataValueSlot FindSlot (const CP_String &inSlotName)
UInt32 GetNumberSlots ()
CP_String GetNthSlotName (UInt32 inSlotIndex)
template<class R, class P1, class P2>
CP_CommandHandlerSignal * Connect (CPLAT::CP_CommandNo cmd, void(R::*handler)(P1, P2), SInt32 mode)
template<class R, class P1, class P2>
void Connect (CP_Object *control, const CPLAT::CP_String &signalName, void(R::*handler)(P1, P2))
void disconnect_all ()
void signal_connect (CP_Signal *inSender)
void signal_disconnect (CP_Signal *inSender)
Constructor / Destructor
 CP_Dialog ()
 Constructor.
virtual ~CP_Dialog () throw ()
 Destructor.
Initialization
void Create (const CP_Point &inUpperLeft, const CP_Size &inContentSize, const CP_String &inWindowTitle, const CP_WindowTypeBase &inWindowType)
void CreateButtons (const CP_String &inDefaultButtonText, const CP_String &inCancelButtonText)
Events
void Run (SInt16 inModal=kCP_DialogModality_Modal)
Getters
CP_Window * GetWindow ()
Setters
void SetModality (CP_DialogModality *inModality)
void SetModality (WindowModality inWindowModality, CP_Window *inParentWindow=NULL)

Static Public Member Functions

static void Connect (CP_Object *sender, const CP_String &signalName, CP_Object *receiver, const CP_String &slotName, const bool reciprocal=false)
static void Connect (CP_Object *sender, CP_Object *receiver, const bool reciprocal=false, const CP_String &signalName=kCP_Signal_ValueChanged, const CP_String &slotName=kCP_Slot_SetValue)

Protected Member Functions

Slots
void DismissButtonClicked (CP_DataValueHolder &inValue, OSStatus &inOutStatus)
void CancelButtonClicked (CP_DataValueHolder &inValue, OSStatus &inOutStatus)

Protected Attributes

CP_Window * fDialogWindow
CP_DialogModality * fDialogModality
CP_DataValueSignal fDismissDialogSignal
CP_DataValueSignal fCancelDialogSignal
CP_Signals_Array * fSignals
CP_Slots_Array * fSlots
FourCharCode fObjectID
sender_set fSenders

Static Protected Attributes

static FourCharCode fObjectIDCount = 0

Member Enumeration Documentation

anonymous enum
 

Enumeration values:
kCP_DialogModality_Modal 
kCP_DialogModality_Modeless 


Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_Dialog::CP_Dialog (   ) 
 

Constructor.

Exceptions:
none 

CP_Dialog::~CP_Dialog (   )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

void CP_Dialog::Create (  const CP_Point &  inUpperLeft,
const CP_Size &  inContentSize,
const CP_String &  inWindowTitle,
const CP_WindowTypeBase &  inWindowType
) 
 

Creates the dialogs main window from the passed in params. Use this if you want to create just the dialogs window, and then will populate the dialog with views.

Parameters:
inUpperLeft Upper left corner of the dialogs window.
inContentSize Content size of the dialogs window.
inWindowTitle Title of the dialogs window.
inWindowType CP_WindowTypeBase object that controls the appearance of the dialogs window.
Exceptions:
none 
Returns:
void

void CP_Dialog::CreateButtons (  const CP_String &  inDefaultButtonText,
const CP_String &  inCancelButtonText
) 
 

Creates the default and optionally cancel buttons for the dialog. The cancel button will only be created if the inCancelButtonText is not empty, otherwise only the default button is created. The buttons will be assigned the following object ids: DefaultButton - kCP_DefaultButtonObjectID, CancelButton - kCP_CancelButtonObjectID

Parameters:
inDefaultButtonText Text of the default button.
innCancelButtonText Text of the cancel button.
Exceptions:
none 
Returns:
void

void CP_Dialog::Run (  SInt16  inModal = kCP_DialogModality_Modal  ) 
 

Runs the dialog event loop. Call this once the dialog has been created and you want to handle the events for the dialog.

Parameters:
inModal Flag to indicate the modality of the dialog. It can be one of the following values:
  • kCP_DialogModality_Modal
  • kCP_DialogModality_Modeless
Exceptions:
none 
Returns:
void

CP_Window* CP_Dialog::GetWindow (   ) 
 

Returns the CP_Window used to display the dialogs views.

Exceptions:
none 
Returns:
CP_Window The dialogs window.

void CP_Dialog::SetModality (  CP_DialogModality *  inModality  ) 
 

Sets the dialogs modality.

Parameters:
inModality The CP_DialogModality to control the modality of this dialog.
Exceptions:
none 
Returns:
void

void CP_Dialog::SetModality (  WindowModality  inWindowModality,
CP_Window *  inParentWindow = NULL
) 
 

Sets the modality of the dialogs window.

Parameters:
inWindowModality Modality of the dialogs window, and can be one of the following values:
  • kCP_E_WindowModalityNone
  • kCP_E_WindowModalitySystemModal
  • kCP_E_WindowModalityAppModal
  • kCP_E_WindowModalityWindowModal
Exceptions:
none 
Returns:
void

void CP_Dialog::DismissButtonClicked (  CP_DataValueHolder &  inValue,
OSStatus &  inOutStatus
)  [protected]
 

Called when the user has clicked on the dismiss button. This will send out a kCP_Signal_DismissDialog which you can listen for and handle any action needed when the user wants to dismiss the dialog. If you want the dialog to be dismissed, then return CP_noErr from this signal, otherwise the dialog will not be dismissed. You might not want to return CP_noErr to dismiss the dialog, if say an edit field did not contain a valid value. This gives you a chance to validate the data in the dialog before it is dismissed.

Parameters:
inValue Not used.
inOutStatus Status value passed from the clicked on button.
Exceptions:
none 
Returns:
void

void CP_Dialog::CancelButtonClicked (  CP_DataValueHolder &  inValue,
OSStatus &  inOutStatus
)  [protected]
 

Called when the user has clicked on the cancel button. This will send out a kCP_Signal_CancelDialog which you can listen for and handle any action needed when the user wants to dismiss the dialog. If you want the dialog to be dismissed, then return CP_noErr from this signal, otherwise the dialog will not be dismissed. You might not want to return CP_noErr to dismiss the dialog, if say an edit field did not contain a valid value. This gives you a chance to validate the data in the dialog before it is dismissed.

Parameters:
inValue Not used.
inOutStatus Status value passed from the clicked on button.
Exceptions:
none 
Returns:
void

void CP_Object::SetID (  FourCharCode  inIdentifier  )  [inherited]
 

Sets the identifier for this object. If a specific identifier is not set with this function, then a default id is used, which is simply a running count of the number of objects created.

Parameters:
inIdentifier The objects identifier.
Returns:
void

FourCharCode CP_Object::GetID (   )  [inherited]
 

Returns the objects identifier.

Returns:
FourCharCode The identifier of this object.

void CP_Object::RegisterSignal (  const CP_SignalHolder &  inSignal  )  [inherited]
 

Registers the signal / signal name contained in the passed in inSignal object.

Parameters:
inSignal CP_SignalHolder that holds a signal and string identifier.
Returns:
void

CP_DataValueSignal * CP_Object::FindSignal (  const CP_String &  inSignalName  )  [inherited]
 

Finds the CP_DataValueSignal object that matches the passed in inSignalName.

Parameters:
inSignalName CP_String containing the identifier of the signal to return.
Returns:
CP_DataValueSignal * Returns a pointer to a CP_DataValueSignal object.

UInt32 CP_Object::GetNumberSignals (   )  [inherited]
 

Returns the number of signals for this object.

Returns:
UInt32 The number of signals.

CP_String CP_Object::GetNthSignalName (  UInt32  inSignalIndex  )  [inherited]
 

Returns the signal name of the passed in signal index.

Parameters:
inSignalIndex Index of the name of the signal to return.
Returns:
CP_String The name of the nth signal being returned.

void CP_Object::RegisterSlot (  const CP_SlotHolder &  inSlot  )  [inherited]
 

Registers the slot / slot name contained in the passed in inSlot object.

Parameters:
inSlot CP_SignalHolder that holds a slot and string identifier.
Returns:
void

CP_DataValueSlot CP_Object::FindSlot (  const CP_String &  inSlotName  )  [inherited]
 

Finds the CP_Slot1 object that matches the passed in inSlotName.

Parameters:
inSlotName CP_String containing the identifier of the slot to return.
Returns:
CP_DataValueSlot Returns a pointer to a CP_DataValueSlot object.

UInt32 CP_Object::GetNumberSlots (   )  [inherited]
 

Returns the number of slots for this object.

Returns:
UInt32 The number of slots.

CP_String CP_Object::GetNthSlotName (  UInt32  inSlotIndex  )  [inherited]
 

Returns the slot name of the passed in signal index.

Parameters:
inSlotIndex Index of the name of the slot to return.
Returns:
CP_String The name of the nth slot being returned.

template<class R, class P1, class P2>
CP_CommandHandlerSignal* CP_Object::Connect (  CPLAT::CP_CommandNo  cmd,
void(R::*)(P1, P2)  handler,
SInt32  mode
)  [inherited]
 

template<class R, class P1, class P2>
void CP_Object::Connect (  CP_Object *  control,
const CPLAT::CP_String &  signalName,
void(R::*)(P1, P2)  handler
)  [inherited]
 

void CP_Object::Connect (  CP_Object *  sender,
const CP_String &  signalName,
CP_Object *  receiver,
const CP_String &  slotName,
const bool  reciprocal = false
)  [static, inherited]
 

void CP_Object::Connect (  CP_Object *  sender,
CP_Object *  receiver,
const bool  reciprocal = false,
const CP_String &  signalName = kCP_Signal_ValueChanged,
const CP_String &  slotName = kCP_Slot_SetValue
)  [static, inherited]
 

void CP_SigSlot::CP_SlotObject::disconnect_all (   )  [inherited]
 

void CP_SigSlot::CP_SlotObject::signal_connect (  CP_Signal *  inSender  )  [inherited]
 

void CP_SigSlot::CP_SlotObject::signal_disconnect (  CP_Signal *  inSender  )  [inherited]
 


Member Data Documentation

CP_Window* CP_Dialog::fDialogWindow [protected]
 

CP_DialogModality* CP_Dialog::fDialogModality [protected]
 

CP_Window used to display the dialog.

CP_DataValueSignal CP_Dialog::fDismissDialogSignal [protected]
 

Modality of the dialog.

CP_DataValueSignal CP_Dialog::fCancelDialogSignal [protected]
 

Signal sent when the dismiss button is clicked.

CP_Signals_Array* CP_Object::fSignals [protected, inherited]
 

CP_Slots_Array* CP_Object::fSlots [protected, inherited]
 

List of registered signals for this object.

FourCharCode CP_Object::fObjectID [protected, inherited]
 

List of registered slots for this object.

CPLAT_Begin_Namespace_CPLAT FourCharCode CP_Object::fObjectIDCount = 0 [static, protected, inherited]
 

Object identifier.

sender_set CP_SigSlot::CP_SlotObject::fSenders [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:28 2005 for CPLAT by  doxygen 1.4.0