// ================================================================================= // CSimlabPropsListBox.cp ©1995 J. Rodden, DD/MF & Associates. All rights reserved // ================================================================================= #include #include "RuntimeMessages.h" #include "RuntimeResources.h" #include "CSimlabPropsListBox.h" #include // ================================================================================= // € CreateFromStream // ================================================================================= CSimlabPropsListBox* CSimlabPropsListBox::CreateFromStream (LStream *inStream) { return (new CSimlabPropsListBox(inStream)); } // ================================================================================= // € CSimlabPropsListBox(LStream *inStream) // ================================================================================= CSimlabPropsListBox::CSimlabPropsListBox(LStream *inStream) : CSimlabHierListBox(inStream) { } // ================================================================================= // € FinishCreateSelf // ================================================================================= void CSimlabPropsListBox::FinishCreateSelf() { CSimlabHierListBox::FinishCreateSelf(); //mFlavorAccepted = flavorTypeHFS; mUseDefaultRect = true; } // ================================================================================= // € DoDeleteKey // ================================================================================= void CSimlabPropsListBox::DoDeleteKey() { Int16 numColumns = (**mMacListH).dataBounds.right; Int16 numRows = (**mMacListH).dataBounds.bottom; Cell theSelection = {0, 0}; if (::LGetSelect(true, &theSelection, mMacListH)) { SimlabListTag theTag = ((CSimlabListRec*)GetElementData(theSelection))->GetTag(); short theElementSubIndex = GetElementSubIndex(theSelection); MessageT theMessage = msg_Nothing; short theListIdx = 0; if ( GetElementIndent(theSelection) > 0 ) { switch (theTag) { case tagSetting: if ( theElementSubIndex > 1) { // Can't delete default setting theListIdx = settingsSublist; theMessage = msg_DeleteSetting; } break; case tagGraph: theListIdx = graphsSublist; theMessage = msg_DeleteGraph; break; } if ( theListIdx != 0 ) { LList* theList = nil; mSublists.FetchItemAt( theListIdx, &theList); if ( theList != nil ) theList->RemoveItemsAt( 1, theElementSubIndex); BroadcastMessage( theMessage, &theElementSubIndex); CBetterListBox::DoDeleteKey(); } } } } // ============================================================================ // € HFSItemIsAcceptable // ============================================================================ Boolean CSimlabPropsListBox::HFSItemIsAcceptable(HFSFlavor& inHFSFlavorData, Boolean& inTargetIsFolder) { switch (inHFSFlavorData.fileType) { case 'TEXT': case OldSimlabFileType: case SimlabModelFileType: return true; } if (inTargetIsFolder) return true; else return false; } // ============================================================================ // € CopyOrMoveDragData // ============================================================================ void CSimlabPropsListBox::CopyOrMoveDragData( void* inDragData, Size inDataSize, Boolean inCopyData, Boolean inFromFinder, Rect& inItemBounds) { //Str255 theString; //CopyPStr( ((FSSpecPtr)inDragData)->name, theString); //AddSubListElement(dscrptnSublist, theString); //BroadcastMessage(msg_AddSourceFile,inDragData); } // =================================================================================