void CBAboutDialog::BuildWindow ( const JCharacter* prevVersStr ) { // begin JXLayout JXWindow* window = new JXWindow(this, 430,180, ""); assert( window != NULL ); JXImageWidget* jccIcon = new JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 25,20, 40,40); assert( jccIcon != NULL ); JXStaticText* textWidget = new JXStaticText(JGetString("textWidget::CBAboutDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 90,20, 330,110); assert( textWidget != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::CBAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 320,150, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::CBAboutDialog::shortcuts::JXLayout")); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::CBAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 185,150, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::CBAboutDialog::shortcuts::JXLayout")); itsCreditsButton = new JXTextButton(JGetString("itsCreditsButton::CBAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,150, 60,20); assert( itsCreditsButton != NULL ); JXImageWidget* npsIcon = new JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,75, 65,65); assert( npsIcon != NULL ); // end JXLayout window->SetTitle("About"); SetButtons(okButton, NULL); ListenTo(itsHelpButton); ListenTo(itsCreditsButton); // text JString text = CBGetVersionStr(); if (!JStringEmpty(prevVersStr)) { const JCharacter* map[] = { "vers", prevVersStr }; text += JGetString("UpgradeNotice::CBAboutDialog"); (JGetStringManager())->Replace(&text, map, sizeof(map)); itsHelpButton->SetLabel(JGetString("ChangeButtonLabel::CBAboutDialog")); itsIsUpgradeFlag = kJTrue; } textWidget->SetText(text); // Code Crusader icon itsAnimTask = new CBAboutDialogIconTask(jccIcon); assert( itsAnimTask != NULL ); itsAnimTask->Start(); // NPS icon JXImage* image = new JXImage(GetDisplay(), new_planet_software); assert( image != NULL ); npsIcon->SetImage(image, kJTrue); // adjust window to fit text const JSize bdh = textWidget->GetBoundsHeight(); const JSize aph = textWidget->GetApertureHeight(); if (bdh > aph) { window->AdjustSize(0, bdh - aph); // safe to calculate once bdh > aph } }
void GLAboutDialog::BuildWindow ( const JCharacter* prevVersStr ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 430,180, ""); assert( window != NULL ); JXImageWidget* gloveIcon = jnew JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,15, 50,50); assert( gloveIcon != NULL ); JXStaticText* textWidget = jnew JXStaticText(JGetString("textWidget::GLAboutDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 90,20, 330,110); assert( textWidget != NULL ); JXImageWidget* npsIcon = jnew JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,75, 65,65); assert( npsIcon != NULL ); JXTextButton* okButton = jnew JXTextButton(JGetString("okButton::GLAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 320,150, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::GLAboutDialog::shortcuts::JXLayout")); itsHelpButton = jnew JXTextButton(JGetString("itsHelpButton::GLAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 185,150, 60,20); assert( itsHelpButton != NULL ); itsCreditsButton = jnew JXTextButton(JGetString("itsCreditsButton::GLAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,150, 60,20); assert( itsCreditsButton != NULL ); // end JXLayout window->SetTitle("About"); SetButtons(okButton, NULL); ListenTo(itsHelpButton); ListenTo(itsCreditsButton); const JCharacter* map1[] = { "version", JGetString("VERSION"), "copyright", JGetString("COPYRIGHT") }; JString text = JGetString(kDescriptionID, map1, sizeof(map1)); if (!JStringEmpty(prevVersStr)) { const JCharacter* map[] = { "vers", prevVersStr }; text += JGetString(kUpgradeNoticeID); (JGetStringManager())->Replace(&text, map, sizeof(map)); itsHelpButton->SetLabel(JGetString(kChangeButtonLabelID)); itsIsUpgradeFlag = kJTrue; } textWidget->SetText(text); JXImage* image = jnew JXImage(GetDisplay(), JXPM(glove_icon)); assert(image != NULL); gloveIcon->SetImage(image, kJTrue); // NPS icon image = jnew JXImage(GetDisplay(), nps); assert( image != NULL ); npsIcon->SetImage(image, kJTrue); const JSize bdh = textWidget->GetBoundsHeight(); const JSize aph = textWidget->GetApertureHeight(); if (bdh > aph) { window->AdjustSize(0, bdh - aph); // safe to calculate once bdh > aph } }
void MDAboutDialog::BuildWindow ( const JCharacter* prevVersStr ) { // begin JXLayout JXWindow* window = new JXWindow(this, 370,120, ""); assert( window != NULL ); JXStaticText* textWidget = new JXStaticText(JGetString("textWidget::MDAboutDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 70,20, 280,50); assert( textWidget != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::MDAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 260,90, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::MDAboutDialog::shortcuts::JXLayout")); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::MDAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 155,90, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::MDAboutDialog::shortcuts::JXLayout")); JXImageWidget* imageWidget = new JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 40,40); assert( imageWidget != NULL ); itsCreditsButton = new JXTextButton(JGetString("itsCreditsButton::MDAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,90, 60,20); assert( itsCreditsButton != NULL ); // end JXLayout window->SetTitle(JGetString("WindowTitle::MDAboutDialog")); SetButtons(okButton, NULL); ListenTo(itsHelpButton); ListenTo(itsCreditsButton); JXImage* image = new JXImage(GetDisplay(), md_about_icon); assert( image != NULL ); imageWidget->SetImage(image, kJTrue); JString text = MDGetVersionStr(); if (!JStringEmpty(prevVersStr)) { const JCharacter* map[] = { "vers", prevVersStr }; text += JGetString(kUpgradeNoticeID); (JGetStringManager())->Replace(&text, map, sizeof(map)); itsHelpButton->SetLabel(JGetString(kChangeButtonLabelID)); itsIsUpgradeFlag = kJTrue; } textWidget->SetText(text); const JSize bdh = textWidget->GetBoundsHeight(); const JSize aph = textWidget->GetApertureHeight(); if (bdh > aph) { window->AdjustSize(0, bdh - aph); // safe to calculate once bdh > aph } }
void JXTipOfTheDayDialog::BuildWindow ( const JBoolean showStartupCB, const JBoolean showAtStartup ) { // begin JXLayout JXWindow* window = new JXWindow(this, 410,260, ""); assert( window != NULL ); JXFlatRect* sideBar = new JXFlatRect(window, JXWidget::kFixedLeft, JXWidget::kVElastic, 10,10, 50,200); assert( sideBar != NULL ); sideBar->SetColor((GetColormap())->GetInactiveLabelColor()); itsCloseButton = new JXTextButton(JGetString("itsCloseButton::JXTipOfTheDayDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 340,225, 60,20); assert( itsCloseButton != NULL ); itsNextTipButton = new JXTextButton(JGetString("itsNextTipButton::JXTipOfTheDayDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 260,225, 60,20); assert( itsNextTipButton != NULL ); itsNextTipButton->SetShortcuts(JGetString("itsNextTipButton::JXTipOfTheDayDialog::shortcuts::JXLayout")); JXImageWidget* icon = new JXImageWidget(sideBar, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,15, 30,30); assert( icon != NULL ); JXScrollbarSet* scrollbarSet = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kVElastic, 60,60, 340,150); assert( scrollbarSet != NULL ); JXStaticText* title = new JXStaticText(JGetString("title::JXTipOfTheDayDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kFixedTop, 60,10, 340,50); assert( title != NULL ); itsShowAtStartupCB = new JXTextCheckbox(JGetString("itsShowAtStartupCB::JXTipOfTheDayDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 10,225, 140,20); assert( itsShowAtStartupCB != NULL ); // end JXLayout window->SetTitle("Tip of the Day"); window->LockCurrentMinSize(); window->PlaceAsDialogWindow(); JXDisplay* display = GetDisplay(); JXImage* wIcon = new JXImage(display, jx_tip_of_the_day); assert( wIcon != NULL ); window->SetIcon(wIcon); sideBar->SetColor((GetColormap())->GetGrayColor(50)); icon->SetXPM(jx_tip_of_the_day, (GetColormap())->GetGrayColor(50)); title->SetBorderWidth(kJXDefaultBorderWidth); title->TESetLeftMarginWidth(5); title->SetBackColor(title->GetFocusColor()); title->JTextEditor::SetFont(1, title->GetTextLength(), "Times", 18, JFontStyle(kJTrue, kJFalse, 0, kJFalse), kJTrue); title->SetCaretLocation(1); title->Paste("\n"); itsText = new JXStaticText("", kJTrue, kJFalse, scrollbarSet, scrollbarSet->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( itsText != NULL ); itsText->FitToEnclosure(); itsText->TESetLeftMarginWidth(5); itsShowAtStartupCB->SetVisible(showStartupCB); itsShowAtStartupCB->SetState(showAtStartup); ListenTo(itsNextTipButton); ListenTo(itsCloseButton); }