home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-12-22 | 9.2 KB | 463 lines | [TEXT/CWIE] |
- // CModelessCheckboxes.cp -- dialog methods
-
- #include "CModelessCheckboxes.h"
-
- #include <UEnvironment.h>
- #include <UReanimator.h>
- #include <URegistrar.h>
- #include <LStream.h>
- #include <LTabGroup.h>
- #include <LCheckBox.h>
- #include <LAMControlImp.h>
- #include <LGACheckboxImp.h>
- #include <LDisclosureTriangle.h>
- #include <LGADisclosureTriangleImp.h>
- #include <LStaticText.h>
- #include <LAMStaticTextImp.h>
- #include <LGAStaticTextImp.h>
- #include <LTextGroupBox.h>
- #include <LAMControlViewImp.h>
- #include <LGATextGroupBoxImp.h>
- #include <CustomControls.h>
- #include <LToggleButton.h>
- #include <LBevelButton.h>
- #include <LAMBevelButtonImp.h>
- #include <LGABevelButtonImp.h>
- #include <CTextUtils.h>
-
- #include "DModelessCheckboxesData.h"
- #include "EverythingCmds.h"
- #include <PP_Messages.h>
-
- const MessageT msgStandard = 'Stad';
- const MessageT msgXx = 'Xx ';
- const MessageT msgLR = 'LR ';
- const MessageT msgLR2 = 'LR2 ';
- const MessageT msgLR3 = 'LR3 ';
- const MessageT msgLR4 = 'LR4 ';
- const MessageT msgCheckbox = 'Chex';
- const MessageT msgCheckbox2 = 'Che2';
- const MessageT msgNext = 'Next';
- const MessageT msgNext2 = 'Nex2';
-
- #define PPob_ModelessCheckboxesID 215
- #define RidL_ModelessCheckboxesID 215
-
- Boolean CModelessCheckboxes::sIsRegistered = false;
-
- //----------
- CModelessCheckboxes* CModelessCheckboxes::CreateModelessCheckboxes (
- LCommander* inSuperCommander,
- CommandT inCommand,
- DModelessCheckboxesData* inData)
- {
- if (!sIsRegistered) {
- RegisterClass ();
- }
- CModelessCheckboxes* dlog;
- dlog = ((CModelessCheckboxes *)LWindow::CreateWindow(PPob_ModelessCheckboxesID, inSuperCommander));
- dlog->mCommand = inCommand;
- dlog->SetFromData (inData);
-
- return dlog;
- }
-
- //----------
- #define RegisterClasses(AbstractClass,AMImpClass,GAImpClass) \
- RegisterClass_(AbstractClass); \
- if (useAppearance) { \
- RegisterClassID_(AMImpClass, AbstractClass::imp_class_ID); \
- } else { \
- RegisterClassID_(GAImpClass, AbstractClass::imp_class_ID); \
- }
-
- //----------
- void CModelessCheckboxes::RegisterClass ()
- {
- Boolean useAppearance = UEnvironment::HasFeature (env_HasAppearance);
-
- RegisterClass_(CModelessCheckboxes);
-
- // register the pane classes we use
- RegisterClasses (LCheckBox, LAMControlImp, LGACheckBoxImp);
- RegisterClasses (LDisclosureTriangle, LAMControlImp, LGADisclosureTriangleImp);
- RegisterClasses (LStaticText, LAMStaticTextImp, LGAStaticTextImp);
- RegisterClasses (LTextGroupBox, LAMControlViewImp, LGATextGroupBoxImp);
- RegisterClasses (CCheckBox, CustomControlImp, CustomControlImp);
- RegisterClass_(LToggleButton);
- RegisterClasses (LBevelButton, LAMBevelButtonImp, LGABevelButtonImp);
-
- sIsRegistered = true;
- }
-
- //----------
- CModelessCheckboxes::CModelessCheckboxes (
- LStream* inStream)
- : LGADialog (inStream)
- {
- mData = nil;
- }
-
- //----------
- CModelessCheckboxes::~CModelessCheckboxes()
- {
- delete mData;
- }
-
- //----------
- // This member function gets called once the containment hierarchy that contains
- // this pane has been built. It gives us a chance to get data members for
- // interesting subviews, and to do other operations now that our subviews exist.
- void CModelessCheckboxes::FinishCreateSelf()
- {
- LGADialog::FinishCreateSelf();
-
- mStandardCheck = (LCheckBox*) FindPaneByID ('Stad');
-
- mXxCheck = (LDisclosureTriangle*) FindPaneByID ('Xx ');
-
- mLRCheck = (CCheckBox*) FindPaneByID ('LR ');
-
- mLR2Check = (CCheckBox*) FindPaneByID ('LR2 ');
-
- mLR3Check = (LToggleButton*) FindPaneByID ('LR3 ');
-
- mLR4Check = (LToggleButton*) FindPaneByID ('LR4 ');
-
- mCheckboxCheck = (CCheckBox*) FindPaneByID ('Chex');
-
- mCheckbox2Check = (LBevelButton*) FindPaneByID ('Che2');
-
- mNextCheck = (LBevelButton*) FindPaneByID ('Next');
-
- mNext2Check = (LBevelButton*) FindPaneByID ('Nex2');
-
-
- UReanimator::LinkListenerToControls(this, this, RidL_ModelessCheckboxesID);
- // the purpose is to "connect" self to whatever controls
- // that we want to "listen" to
-
- // any additional initialization for your dialog:
-
- }
-
- //----------
- void CModelessCheckboxes::SetFromData (
- DModelessCheckboxesData* inData)
- {
- mData = inData;
- mData->AddListener (this);
-
- mStandardCheck->SetValue (mData->GetStandard7 ());
- mXxCheck->SetValue (mData->GetXx3 ());
- mLRCheck->SetValue (mData->GetLR9 ());
- mLR2Check->SetValue (mData->GetLR10 ());
- mLR3Check->SetValue (mData->GetLR11 ());
- mLR4Check->SetValue (mData->GetLR12 ());
- mCheckboxCheck->SetValue (mData->GetCheckbox5 ());
- mCheckbox2Check->SetValue (mData->GetCheckbox6 ());
- mNextCheck->SetValue (mData->GetNext5 ());
- mNext2Check->SetValue (mData->GetNext6 ());
- }
-
- //----------
- DModelessCheckboxesData* CModelessCheckboxes::GetData ()
- {
-
- return mData;
- }
-
- //----------
- void CModelessCheckboxes::DataChanged (
- long inDataID)
- {
- StopListening ();
-
- if (inDataID == idStandard7) {
- mStandardCheck->SetValue (mData->GetStandard7 ());
- }
- if (inDataID == idXx3) {
- mXxCheck->SetValue (mData->GetXx3 ());
- }
- if (inDataID == idLR9) {
- mLRCheck->SetValue (mData->GetLR9 ());
- }
- if (inDataID == idLR10) {
- mLR2Check->SetValue (mData->GetLR10 ());
- }
- if (inDataID == idLR11) {
- mLR3Check->SetValue (mData->GetLR11 ());
- }
- if (inDataID == idLR12) {
- mLR4Check->SetValue (mData->GetLR12 ());
- }
- if (inDataID == idCheckbox5) {
- mCheckboxCheck->SetValue (mData->GetCheckbox5 ());
- }
- if (inDataID == idCheckbox6) {
- mCheckbox2Check->SetValue (mData->GetCheckbox6 ());
- }
- if (inDataID == idNext5) {
- mNextCheck->SetValue (mData->GetNext5 ());
- }
- if (inDataID == idNext6) {
- mNext2Check->SetValue (mData->GetNext6 ());
- }
-
- StartListening ();
- }
-
- //----------
- void CModelessCheckboxes::ListenToMessage (
- MessageT inMessage,
- void *ioParam)
- {
- switch (inMessage) {
- case msg_OK:
- GetSuperCommander()->ProcessCommand(-mCommand, this);
- break;
-
- case msg_Cancel:
- DoClose();
- break;
-
- case msgDataChanged:
- DataChanged ((long)ioParam);
- break;
-
- case msgStandard:
- mData->SetStandard7 (mStandardCheck->GetValue ());
- break;
-
- case msgXx:
- mData->SetXx3 (mXxCheck->GetValue ());
- break;
-
- case msgLR:
- mData->SetLR9 (mLRCheck->GetValue ());
- break;
-
- case msgLR2:
- mData->SetLR10 (mLR2Check->GetValue ());
- break;
-
- case msgLR3:
- mData->SetLR11 (mLR3Check->GetValue ());
- break;
-
- case msgLR4:
- mData->SetLR12 (mLR4Check->GetValue ());
- break;
-
- case msgCheckbox:
- mData->SetCheckbox5 (mCheckboxCheck->GetValue ());
- break;
-
- case msgCheckbox2:
- mData->SetCheckbox6 (mCheckbox2Check->GetValue ());
- break;
-
- case msgNext:
- mData->SetNext5 (mNextCheck->GetValue ());
- break;
-
- case msgNext2:
- mData->SetNext6 (mNext2Check->GetValue ());
- break;
-
-
- default:
- ; // do something
- break;
- }
- }
-
- //----------
- Boolean CModelessCheckboxes::ObeyCommand (
- CommandT inCommand,
- void* ioParam)
- {
- Boolean cmdHandled = true;
-
- if (inCommand < 0) {
- // modal dialog has finished
-
- switch (-inCommand) {
- }
-
- } else {
- switch (inCommand) {
-
- default:
- cmdHandled = LGADialog::ObeyCommand(inCommand, ioParam);
- break;
- }
- }
-
- return cmdHandled;
- }
-
- //----------
- void CModelessCheckboxes::FindCommandStatus (
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- default:
- LGADialog::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- // following functions will be obsoleted
- // retained only for backwards compatibility
- //----------
- Boolean
- CModelessCheckboxes::GetStandardChoice()
- {
- return mStandardCheck->GetValue();
- }
-
- void
- CModelessCheckboxes::SetStandardChoice (
- Boolean inChoice)
- {
- mStandardCheck->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetXxChoice()
- {
- return mXxCheck->GetValue();
- }
-
- void
- CModelessCheckboxes::SetXxChoice (
- Boolean inChoice)
- {
- mXxCheck->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetLRChoice()
- {
- return mLRCheck->GetValue();
- }
-
- void
- CModelessCheckboxes::SetLRChoice (
- Boolean inChoice)
- {
- mLRCheck->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetLR2Choice()
- {
- return mLR2Check->GetValue();
- }
-
- void
- CModelessCheckboxes::SetLR2Choice (
- Boolean inChoice)
- {
- mLR2Check->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetLR3Choice()
- {
- return mLR3Check->GetValue();
- }
-
- void
- CModelessCheckboxes::SetLR3Choice (
- Boolean inChoice)
- {
- mLR3Check->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetLR4Choice()
- {
- return mLR4Check->GetValue();
- }
-
- void
- CModelessCheckboxes::SetLR4Choice (
- Boolean inChoice)
- {
- mLR4Check->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetCheckboxChoice()
- {
- return mCheckboxCheck->GetValue();
- }
-
- void
- CModelessCheckboxes::SetCheckboxChoice (
- Boolean inChoice)
- {
- mCheckboxCheck->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetCheckbox2Choice()
- {
- return mCheckbox2Check->GetValue();
- }
-
- void
- CModelessCheckboxes::SetCheckbox2Choice (
- Boolean inChoice)
- {
- mCheckbox2Check->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetNextChoice()
- {
- return mNextCheck->GetValue();
- }
-
- void
- CModelessCheckboxes::SetNextChoice (
- Boolean inChoice)
- {
- mNextCheck->SetValue (inChoice);
- }
-
- //----------
- Boolean
- CModelessCheckboxes::GetNext2Choice()
- {
- return mNext2Check->GetValue();
- }
-
- void
- CModelessCheckboxes::SetNext2Choice (
- Boolean inChoice)
- {
- mNext2Check->SetValue (inChoice);
- }
-
-