// =========================================================================== // CSimlabGraphDefPanel.cp // ©1995 J. Rodden, DD/MF & Associates. All rights reserved // =========================================================================== #include "RuntimeResources.h" #include "CSimlabGraphDefPanel.h" #include <3DTextFields.h> #include <3DDrawingUtils.h> #include // --------------------------------------------------------------------------- const ResIDT k3DButtonsCDEF = 1000; const ResIDT PaneID_radioBtn = 'rbut'; const ResIDT PaneID_checkBox = 'cbox'; const ResIDT PaneID_minField = 'min'; const ResIDT PaneID_maxField = 'max'; const Int32 kUniversalInset = 4; const Int32 kUniversalHeightAdj = 2*kUniversalInset; const Int32 kCaptionWidth = 90; const Int32 kControlWidth = 16; const Int32 kRadioBtnOffset = 114; const Int32 kCheckBoxOffset = 132; const Int32 kMinEditOffset = 150; const Int32 kMaxEditOffset = 192; const Int32 kEditWidth = 40; // --------------------------------------------------------------------------- // € CSimlabGraphDefPanel(SPaneInfo&, SViewInfo&) // --------------------------------------------------------------------------- // Construct View from input parameters CSimlabGraphDefPanel::CSimlabGraphDefPanel( const SPaneInfo& inPaneInfo, const SViewInfo& inViewInfo, LCommander* inSuper, Str255 inString) : LView(inPaneInfo,inViewInfo) { SPaneInfo thePaneInfo = inPaneInfo; // Universal pane settings thePaneInfo.userCon = 0; thePaneInfo.superView = this; thePaneInfo.top = kUniversalInset; thePaneInfo.height = inPaneInfo.height - kUniversalHeightAdj; thePaneInfo.bindings.left = true; thePaneInfo.bindings.top = false; thePaneInfo.bindings.right = false; thePaneInfo.bindings.bottom = false; // Setup caption thePaneInfo.paneID = 0; thePaneInfo.left = kUniversalInset; thePaneInfo.width = kCaptionWidth; new LCaption( thePaneInfo, inString, Txtr_Geneva9); // Setup radio button thePaneInfo.paneID = PaneID_radioBtn; thePaneInfo.left = kRadioBtnOffset; thePaneInfo.width = kControlWidth; new LStdCDEFRadioButton( thePaneInfo, inPaneInfo.paneID, 0, Txtr_Geneva9, nil, k3DButtonsCDEF); // Setup checkbox thePaneInfo.paneID = PaneID_checkBox; thePaneInfo.left = kCheckBoxOffset; new LStdCDEFCheckBox( thePaneInfo, inPaneInfo.paneID, 0, Txtr_Geneva9, nil, k3DButtonsCDEF); // Edit field settings thePaneInfo.top = 1; thePaneInfo.height = inPaneInfo.height - kUniversalInset; thePaneInfo.width = kEditWidth; // Min edit field thePaneInfo.paneID = PaneID_minField; thePaneInfo.left = kMinEditOffset; C3DEditField::CreateFromData( thePaneInfo, "\p0", Txtr_Geneva9Right, 100, false, (KeyFilterFunc) UKeyFilters::IntegerField, inSuper); // Max edit field thePaneInfo.paneID = PaneID_maxField; thePaneInfo.left = kMaxEditOffset; C3DEditField::CreateFromData( thePaneInfo, "\p100", Txtr_Geneva9Right, 100, false, (KeyFilterFunc) UKeyFilters::IntegerField, inSuper); } // --------------------------------------------------------------------------- // € ~CSimlabGraphDefPanel // --------------------------------------------------------------------------- // Destructor // CSimlabGraphDefPanel::~CSimlabGraphDefPanel() { } // --------------------------------------------------------------------------- // € DrawSelf // --------------------------------------------------------------------------- void CSimlabGraphDefPanel::DrawSelf() { PenState thePenState; U3DDrawingUtils::Get3DPenState(&thePenState); Rect theRect; CalcLocalFrameRect(theRect); theRect.left += thePenState.pnSize.h; theRect.right -= thePenState.pnSize.h; RGBColor theBkgdColor; U3DDrawingUtils::Get3DBackColor(&theBkgdColor); ::RGBBackColor(&theBkgdColor); ::EraseRect(&theRect); U3DDrawingUtils::Draw3DInsetHLine( theRect.bottom - 2*thePenState.pnSize.v, theRect.left - thePenState.pnSize.h, theRect.right + thePenState.pnSize.h); LView::DrawSelf(); } // --------------------------------------------------------------------------- // € GetRadioBtn // --------------------------------------------------------------------------- LStdControl* CSimlabGraphDefPanel::GetRadioBtn() { return (LStdControl*) FindPaneByID(PaneID_radioBtn); } // --------------------------------------------------------------------------- // € GetCheckBox // --------------------------------------------------------------------------- LStdControl* CSimlabGraphDefPanel::GetCheckBox() { return (LStdControl*) FindPaneByID(PaneID_checkBox); } // --------------------------------------------------------------------------- // € GetMinEditField // --------------------------------------------------------------------------- LEditField* CSimlabGraphDefPanel::GetMinEditField() { return (LEditField*) FindPaneByID(PaneID_minField); } // --------------------------------------------------------------------------- // € GetMaxEditField // --------------------------------------------------------------------------- LEditField* CSimlabGraphDefPanel::GetMaxEditField() { return (LEditField*) FindPaneByID(PaneID_maxField); }