// =========================================================================== // CSimlabGraphDefWin.cp // ©1995 J. Rodden, DD/MF & Associates. All rights reserved // =========================================================================== #include "RuntimeResources.h" #include "CSimlabGraphDefWin.h" #include "CSimlabGraphDefPanel.h" #include <3DAttachments.h> #include <3DDrawingUtils.h> const Int32 kVarPaneHeight = 22; // --------------------------------------------------------------------------- static StringPtr sOutputs[] = { "\pOutputVar1", "\pOutputVar2", "\pOutputVar3", "\pOutputVar4", "\pOutputVar5" } ; // --------------------------------------------------------------------------- // € CreateFromStream [static] // --------------------------------------------------------------------------- // Return a new View object initialized using data from a Stream CSimlabGraphDefWin* CSimlabGraphDefWin::CreateFromStream( LStream *inStream) { return (new CSimlabGraphDefWin(inStream)); } // --------------------------------------------------------------------------- // € CSimlabGraphDefWin(LStream*) // --------------------------------------------------------------------------- // Construct View from data in a Stream CSimlabGraphDefWin::CSimlabGraphDefWin( LStream *inStream) : UHiddenWindow(inStream) { } // --------------------------------------------------------------------------- // € ~CSimlabGraphDefWin // --------------------------------------------------------------------------- CSimlabGraphDefWin::~CSimlabGraphDefWin() { delete mRadioGroup; } // --------------------------------------------------------------------------- // € FinishCreateSelf // --------------------------------------------------------------------------- void CSimlabGraphDefWin::FinishCreateSelf() { //U3DDrawingUtils::MakeWindow3D(this); LView* theView = (LView*) FindPaneByID(PaneID_OutputView); theView->AddAttachment(new C3DBkgdAttachment); mRadioGroup = new LRadioGroup(); short num = sizeof (sOutputs) / sizeof(StringPtr); for ( short i = 0 ; i < num ; i++) { AddVariable( theView, i, sOutputs[i]); } } // --------------------------------------------------------------------------- // € AddVariable // --------------------------------------------------------------------------- void CSimlabGraphDefWin::AddVariable( LView* inView, Int32 inPaneID, Str255 inString) { SDimension16 viewSize; GetFrameSize(viewSize); SViewInfo theViewInfo = { { 0, 0}, { 0, 0}, { 1, 1}, false}; SPaneInfo thePaneInfo; // Universal pane settings thePaneInfo.userCon = 0; thePaneInfo.paneID = inPaneID; thePaneInfo.visible = true; thePaneInfo.enabled = true; thePaneInfo.bindings.left = true; thePaneInfo.bindings.top = false; thePaneInfo.bindings.right = true; thePaneInfo.bindings.bottom = false; // Setup containing view thePaneInfo.left = 0; thePaneInfo.top = inPaneID*kVarPaneHeight; thePaneInfo.width = viewSize.width; thePaneInfo.height = kVarPaneHeight; thePaneInfo.superView = inView; CSimlabGraphDefPanel* thePanel = new CSimlabGraphDefPanel( thePaneInfo, theViewInfo, this, inString); mRadioGroup->AddRadio((LControl*)thePanel->GetRadioBtn()); inView->ResizeImageBy(0,kVarPaneHeight,true); }