Exemplo n.º 1
0
void StartScreen::init() {
    loadContent();
    label = LinkLabel(font);
    label.setText("Press bugista nappia to begin");
    label.setFocused(true);
    label.setTabStop(true);
    int w, h;
    TTF_SizeText(font, label.getText().c_str(), &w, &h);
    Vector position((game->getWidth() - w )/ 2, (game->getHeight()-h)/2);
    label.setPosition(position);
    controlManager.add(&label);

    passwordLabel = LinkLabel(font);
    passwordLabel.setText("Password");
    passwordLabel.setFocused(false);
    passwordLabel.setTabStop(true);
    TTF_SizeText(font, passwordLabel.getText().c_str(), &w, &h);
    position.y += 50;
    passwordLabel.setPosition(position);
    controlManager.add(&passwordLabel);
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
__fastcall TAboutDialog::TAboutDialog(TComponent * AOwner,
  TConfiguration * Configuration, bool AllowLicense, TRegistration * Registration,
  bool ALoadThirdParty)
  : TForm(AOwner)
{
  FConfiguration = Configuration;
  UseSystemSettings(this);
  LinkLabel(HomepageLabel, LoadStr(HOMEPAGE_URL));
  LinkLabel(ForumUrlLabel, LoadStr(FORUM_URL));
  ApplicationLabel->ParentFont = true;
  ApplicationLabel->Font->Style = ApplicationLabel->Font->Style << fsBold;
  ApplicationLabel->Caption = AppName;
  WinSCPCopyrightLabel->Caption = LoadStr(WINSCP_COPYRIGHT);
  UnicodeString Translator = LoadStr(TRANSLATOR_INFO);

  if (Registration == NULL)
  {
    RegistrationLabel->Visible = false;
    RegistrationBox->Visible = false;
    ClientHeight = ClientHeight -
      (ThirdPartyPanel->Top - RegistrationBox->Top);
  }
  else
  {
    RegistrationSubjectLabel->Caption = Registration->Subject;
    if (Registration->Registered)
    {
      UnicodeString Text;
      Text = FORMAT(LoadStrPart(ABOUT_REGISTRATION_LICENSES, 1),
        (Registration->Licenses >= 0 ? IntToStr(Registration->Licenses) :
          UnicodeString(LoadStrPart(ABOUT_REGISTRATION_LICENSES, 2))));
      if (!Registration->NeverExpires)
      {
        Text = FMTLOAD(ABOUT_REGISTRATION_EXPIRES,
          (Text, FormatDateTime(L"ddddd", Registration->Expiration)));
      }
      RegistrationLicensesLabel->Caption = Text;
      Text = FMTLOAD(ABOUT_REGISTRATION_PRODUCTID, (Registration->ProductId));
      if (Registration->EduLicense)
      {
        Text = FMTLOAD(ABOUT_REGISTRATION_EDULICENSE, (Text));
      }
      RegistrationProductIdLabel->Caption = Text;
      RegistrationProductIdLabel->Font->Style =
        RegistrationProductIdLabel->Font->Style << fsBold;
    }
    else
    {
      RegistrationLicensesLabel->Visible = false;
      FOnRegistrationLink = Registration->OnRegistrationLink;
      RegistrationProductIdLabel->Caption = LoadStr(ABOUT_REGISTRATION_LINK);
      LinkLabel(RegistrationProductIdLabel, L"");
    }
  }

  if (Translator.IsEmpty())
  {
    TranslatorLabel->Visible = false;
    TranslatorUrlLabel->Visible = false;
    ClientHeight = ClientHeight -
      (TranslatorLabel->Top - ProductSpecificMessageLabel->Top);
  }
  else
  {
    TranslatorLabel->Caption = LoadStr(TRANSLATOR_INFO);
    UnicodeString TranslatorUrl = LoadStr(TRANSLATOR_URL);
    if (!TranslatorUrl.IsEmpty())
    {
      LinkLabel(TranslatorUrlLabel, TranslatorUrl);
    }
    else
    {
      TranslatorUrlLabel->Visible = false;

      // allow two lines of text, if there's no URL
      TranslatorLabel->AutoSize = false;
      TranslatorLabel->Width = ThirdPartyPanel->Width;
      TranslatorLabel->Height = TranslatorLabel->Height * 2;
      TranslatorLabel->WordWrap = true;
    }
  }

  LicenseButton->Visible = AllowLicense;

  LoadData();
  if (ALoadThirdParty)
  {
    LoadThirdParty();
  }
  else
  {
    CreateLabelPanel(ThirdPartyPanel, LoadStr(MESSAGE_DISPLAY_ERROR));
  }
}