/*============================================ SUMiscUtils::FindSibblingPaneByID ==============================================*/ LPane *SUMiscUtils::FindSibblingPaneByID( LPane *inPane, PaneIDT inPaneID ) { ThrowIfNil_( inPane ); LView *topView = SUMiscUtils::GetTopView( inPane ); ThrowIfNil_( topView ); return( topView->FindPaneByID( inPaneID ) ); }
void CPrintAttachment::SetOwnerHost(LAttachable* inOwnerHost) { LAttachment::SetOwnerHost(inOwnerHost); if (mBrowserShell == nil) { if (mBrowserShellPaneID != PaneIDT_Unspecified) { LView* container = GetTopmostView(dynamic_cast<LPane*>(mOwnerHost)); if (container != nil) { LPane* targetPane = container->FindPaneByID(mBrowserShellPaneID); if (targetPane != nil) mBrowserShell = dynamic_cast<CBrowserShell*>(targetPane); } } else mBrowserShell = dynamic_cast<CBrowserShell*>(mOwnerHost); Assert_(mBrowserShell != nil); // Programmer error } }
LView* CPrintAttachment::GetTopmostView(LPane* inStartPane) { // Begin with the start Pane as a // View. Will be nil if start Pane // is nil or is not an LView. LView* theView = dynamic_cast<LView*>(inStartPane); if (inStartPane != nil) { // Look at SuperView of start Pane LView* superView = inStartPane->GetSuperView(); while (superView != nil) { // Move up view hierarchy until theView = superView; // reaching a nil SuperView superView = theView->GetSuperView(); } } return theView; }
void VPLView::ValueChangedSelf( FourCharCode inAttributeKey, DMAttribute* inAttribute) { // Validate pointers. ValidateThis_(); ValidateObject_(mDisplayPane); ValidateObject_(mModelObject.GetObject()); ValidateObject_(inAttribute); // Cast attribute to integer attribute. We'll probably need it. DMIntegerAttribute* intAttr = (dynamic_cast<DMIntegerAttribute*>(inAttribute)); // Cast display pane to LView. LView* view = (dynamic_cast<LView*>(mDisplayPane)); ValidateObject_(view); // Dispatch attribute key. switch (inAttributeKey) { // Image width: Resize image. case pPaneImageWidth: { SDimension32 imageSize; view->GetImageSize(imageSize); ValidateObject_(intAttr); imageSize.width = intAttr->GetIntValue(); view->ResizeImageTo(imageSize.width, imageSize.height, true); break; } // Image height: Resize image. case pPaneImageHeight: { SDimension32 imageSize; view->GetImageSize(imageSize); ValidateObject_(intAttr); imageSize.height = intAttr->GetIntValue(); view->ResizeImageTo(imageSize.width, imageSize.height, true); break; } // Scroll position: Rebuild view. (Brute force approach... *sigh*) case pPaneScrollPosHoriz: case pPaneScrollPosVert: RebuildMe(); break; // Reconcile overhang: Adjust setting. case pPaneReconcileOverhang: ValidateObject_(intAttr); SInt32 reconcile = intAttr->GetIntValue(); view->SetReconcileOverhang(reconcile); break; // Otherwise, see if LPane wants it. default: VPLPane::ValueChangedSelf(inAttributeKey, inAttribute); } }