void CBEditSearchPathsDialog::BuildWindow ( const CBDirList& dirList, CBRelPathCSF* csf ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 370,370, ""); assert( window != NULL ); JXScrollbarSet* scrollbarSet = jnew JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,100, 240,220); assert( scrollbarSet != NULL ); JXTextButton* cancelButton = jnew JXTextButton(JGetString("cancelButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 70,340, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = jnew JXTextButton(JGetString("okButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 230,340, 70,20); assert( okButton != NULL ); JXStaticText* instrText = jnew JXStaticText(JGetString("instrText::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,20, 330,70); assert( instrText != NULL ); JXTextButton* addPathButton = jnew JXTextButton(JGetString("addPathButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,110, 70,20); assert( addPathButton != NULL ); addPathButton->SetShortcuts(JGetString("addPathButton::CBEditSearchPathsDialog::shortcuts::JXLayout")); JXTextButton* removePathButton = jnew JXTextButton(JGetString("removePathButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,140, 70,20); assert( removePathButton != NULL ); removePathButton->SetShortcuts(JGetString("removePathButton::CBEditSearchPathsDialog::shortcuts::JXLayout")); JXTextButton* choosePathButton = jnew JXTextButton(JGetString("choosePathButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,190, 70,20); assert( choosePathButton != NULL ); choosePathButton->SetShortcuts(JGetString("choosePathButton::CBEditSearchPathsDialog::shortcuts::JXLayout")); // end JXLayout instrText->SetText(JGetString(kInstructionsID)); window->AdjustSize(0, instrText->GetBoundsHeight() - instrText->GetFrameHeight()); instrText->SetSizing(JXWidget::kHElastic, JXWidget::kFixedTop); scrollbarSet->SetSizing(JXWidget::kHElastic, JXWidget::kVElastic); addPathButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); removePathButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); choosePathButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); window->SetTitle("Search Paths for Symbol Database"); window->PlaceAsDialogWindow(); window->LockCurrentMinSize(); UseModalPlacement(kJFalse); SetButtons(okButton, cancelButton); itsTable = jnew CBPathTable(dirList, addPathButton, removePathButton, choosePathButton, csf, scrollbarSet, scrollbarSet->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 10,10); assert( itsTable != NULL ); }
void JXRadioGroupDialog::BuildWindow ( const JCharacter* windowTitle, const JCharacter* prompt, const JPtrArray<JString>& choiceList, const JPtrArray<JString>* shortcutList ) { JIndex i; const JSize actionCount = choiceList.GetElementCount(); JXWindow* window = new JXWindow(this, 10,10, windowTitle); assert( window != NULL ); JCoordinate y = kFirstItemTop; // instructions JXStaticText* instrText = new JXStaticText(prompt, window, JXWidget::kFixedLeft, JXWidget::kFixedTop, kHMarginWidth,y, 0,0); assert( instrText != NULL ); y += instrText->GetFrameHeight() + kItemVDelta; // radio group const JCoordinate kInitRGWidth = 10; // arbitrary, >0 itsRG = new JXRadioGroup(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, kHMarginWidth,y, kInitRGWidth, kItemVDelta + actionCount * kItemVSeparation); assert( itsRG != NULL ); // choices JCoordinate wmin = 0; JPtrArray<JXRadioButton> buttonList(JPtrArrayT::kForgetAll, actionCount); for (i=1; i<=actionCount; i++) { JXTextRadioButton* button = new JXTextRadioButton(i, *(choiceList.NthElement(i)), itsRG, JXWidget::kFixedLeft, JXWidget::kFixedTop, kRGHLMarginWidth, kItemVDelta + (i-1) * kItemVSeparation, 10,kTextHeight); assert( button != NULL ); if (shortcutList != NULL) { button->SetShortcuts(*(shortcutList->NthElement(i))); } buttonList.Append(button); wmin = JMax(button->GetPreferredWidth(), wmin); } // all choices should be the same width for (i=1; i<=actionCount; i++) { (buttonList.NthElement(i))->SetSize(wmin, kTextHeight); } wmin += kRGHLMarginWidth + kRGHRMarginWidth; itsRG->AdjustSize(wmin - kInitRGWidth, 0); const JCoordinate wminInstr = instrText->GetFrameWidth(); if (wmin < wminInstr) { const JCoordinate delta = (wminInstr - wmin)/2; itsRG->Move(delta, 0); wmin = wminInstr; } y = (itsRG->GetFrame()).bottom + kRGButtonVDelta; // OK and Cancel buttons wmin += 2*kHMarginWidth; const JCoordinate wminButton = 3*kMinButtonHMargin + 2*kButtonWidth; if (wmin < wminButton) { const JCoordinate delta = (wminButton - wmin)/2; instrText->Move(delta, 0); itsRG->Move(delta, 0); wmin = wminButton; } const JCoordinate buttonX = (wmin - 2*kButtonWidth)/3; JXTextButton* cancelButton = new JXTextButton("Cancel", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, buttonX,y, kButtonWidth,kTextHeight); assert( cancelButton != NULL ); JXTextButton* okButton = new JXTextButton("OK", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, wmin - buttonX - (kButtonWidth+2), y-1, kButtonWidth+2, kTextHeight+2); assert( okButton != NULL ); okButton->SetShortcuts("^M"); SetButtons(okButton, cancelButton); // window size window->SetSize(wmin, y + kItemVSeparation); }