SVNMainDirector::SVNMainDirector ( JXDirector* supervisor, const JCharacter* path ) : JXWindowDirector(supervisor), itsPath(path) { SVNMainDirectorX(); JPoint desktopLoc; JCoordinate w,h; if ((SVNGetPrefsManager())->GetWindowSize(kSVNMainDirectorWindSizeID, &desktopLoc, &w, &h)) { JXWindow* window = GetWindow(); window->Place(desktopLoc.x, desktopLoc.y); window->SetSize(w,h); } if (itsRepoWidget != NULL) { itsRepoWidget->RefreshContent(); } }
void JXSearchTextDialog::ReadSetup ( istream& input ) { JFileVersion vers; input >> vers; assert( vers <= kCurrentSetupVersion ); JXWindow* window = GetWindow(); if (vers == 0) { JPoint pt; input >> pt; window->Place(pt.x, pt.y); }
void JXMenuDirector::BuildWindow ( const JPoint& leftPtR, const JPoint& rightPtR, const JCoordinate sourceHeight ) { (GetDisplay())->ShrinkDisplayBoundsToActiveScreen(); itsMenuTable = CreateMenuTable(); itsMenuTable->FitToEnclosure(); itsMenuTable->SetSingleFocusWidget(); const JCoordinate bw = itsMenuTable->GetBorderWidth(); const JRect bounds = itsMenuTable->GetBoundsGlobal(); const JCoordinate w = bounds.width() + 2*bw; const JCoordinate h = bounds.height() + 2*bw; const JRect rootBounds = (GetDisplay())->GetBounds(); JCoordinate windowX, windowWidth = w; JPoint usedPtR = rightPtR; if (rightPtR.x + w <= rootBounds.right) { windowX = rightPtR.x; } else if (leftPtR.x - w >= rootBounds.left) { windowX = leftPtR.x - w; usedPtR = leftPtR; } else { windowX = rootBounds.right - w; } if (windowX + w > rootBounds.right) { windowX = rootBounds.right - w; } if (windowX < rootBounds.left) { windowX = rootBounds.left; if (windowX + w > rootBounds.right) { windowWidth = rootBounds.width(); } } JCoordinate windowY, windowHeight = h; JBoolean scrollBottom = kJFalse; if (usedPtR.y + h <= rootBounds.bottom) { windowY = usedPtR.y; } else if (sourceHeight > 0 && rootBounds.top <= usedPtR.y - sourceHeight - h) { windowY = usedPtR.y - sourceHeight - h; } else if (sourceHeight > 0 && rootBounds.bottom - usedPtR.y > usedPtR.y - sourceHeight - rootBounds.top) { windowY = usedPtR.y; windowHeight = rootBounds.bottom - usedPtR.y; } else if (sourceHeight > 0) { windowY = rootBounds.top; windowHeight = usedPtR.y - sourceHeight - rootBounds.top; scrollBottom = kJTrue; } else { windowY = rootBounds.bottom - h; if (windowY < rootBounds.top) { windowY = rootBounds.top; windowHeight = rootBounds.height(); } } JXWindow* window = GetWindow(); window->Place(windowX, windowY); window->SetSize(windowWidth, windowHeight); // if menu will scroll, might as well start at the bottom if (scrollBottom) { itsMenuTable->TableScrollToCell(JPoint(1, itsMenuTable->GetRowCount())); } (GetDisplay())->RestoreDisplayBounds(); }
void JXHintDirector::BuildWindow ( const JRect& frameR, const JCharacter* text ) { // create window and contents JXWindow* window = jnew JXWindow(this, 10,10, "", kJTrue); assert( window != NULL ); window->SetWMWindowType(JXWindow::kWMTooltipType); JXBorderRect* border = jnew JXBorderRect(window, JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 10,10); assert( border != NULL ); border->FitToEnclosure(); JXStaticText* textWidget = jnew JXStaticText(text, border, JXWidget::kFixedLeft, JXWidget::kFixedTop, kHMargin, kVMargin, 0,0); assert( textWidget != NULL ); JCoordinate ascent = 0, descent = 0; if (!JStringEmpty(text)) { (textWidget->GetFont(1)).GetLineHeight(&ascent, &descent); } const JCoordinate w = 2*kHMargin + textWidget->GetFrameWidth(); const JCoordinate h = 2*kVMargin + ascent + descent; window->SetSize(w,h); // place window const JRect rootBounds = GetDisplay()->GetBounds(); JCoordinate x = frameR.left + 1; JCoordinate y = frameR.bottom + 1; if (x + w > rootBounds.right) { x = rootBounds.right - w - 1; } if (x < 0) { x = rootBounds.left + 1; } if (y + h > rootBounds.bottom) { y = frameR.top - h - 1; } window->Place(x,y); // use standard background color JColorIndex backColorIndex = GetColormap()->JColormap::GetColor(kBackColor); window->SetBackColor(backColorIndex); border->SetBackColor(backColorIndex); textWidget->SetBackgroundColor(backColorIndex); }