本文整理汇总了C++中Label::CalculateStringWidths方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::CalculateStringWidths方法的具体用法?C++ Label::CalculateStringWidths怎么用?C++ Label::CalculateStringWidths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::CalculateStringWidths方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateSpecialStringWidths
/*****************************************************************************
* Function - CalculateSpecialStringWidths
* DESCRIPTION:
*
****************************************************************************/
void StringWidthCalculator::CalculateSpecialStringWidths()
{
mpDisplayCtrl->GetCurrentDisplay()->SetDisplayNumber("");
Label* pLabel = new Label();
pLabel->SetSize(239+1, 15);
pLabel->SetStringId( SID_STEP_BY_STEP_INSTALLATION_GUIDE );
pLabel->CalculateStringWidths(true);
pLabel->SetSize(78, 15);
pLabel->SetStringId( SID_WORK_PERIOD );
pLabel->CalculateStringWidths(true);
pLabel->SetStringId( SID_OFF_PERIOD );
pLabel->CalculateStringWidths(true);
pLabel->SetStringId( SID_SLEEP_PERIOD );
pLabel->CalculateStringWidths(true);
pLabel->SetVisible(false);
delete pLabel;
CancelOrContinuePopUp* pConfirm = new CancelOrContinuePopUp();
pConfirm->SetQuestionStringId( SID_PASSWORD_TEXT );
pConfirm->CalculateStringWidths(true);
pConfirm->SetQuestionStringId( SID_YOU_ARE_ABOUT_TO_CHANGE_PUMP_OPERATION_MODE_ );
pConfirm->CalculateStringWidths(true);
pConfirm->SetVisible(false);
delete pConfirm;
}
示例2: CalculateUnitStringWidths
/*****************************************************************************
* Function - CalculateUnitStringWidths
* DESCRIPTION:
*
****************************************************************************/
void StringWidthCalculator::CalculateUnitStringWidths()
{
mpDisplayCtrl->GetCurrentDisplay()->SetDisplayNumber("");
Label* pLabel = new Label();
// use the same size as mLabelErrorUnit in AlarmListItem
pLabel->SetSize(225-19+1, 15);
pLabel->SetChildPos(240, 0);
pLabel->SetVisible();
for(int i = 0; i < DISPLAY_UNIT_STRINGS_CNT; ++i)
{
pLabel->SetStringId( DISPLAY_UNIT_STRINGS[i].StringId );
//ignore duplicates
if (!pLabel->IsValid())
pLabel->CalculateStringWidths(true);
}
pLabel->SetStringId( SID_UNIT_UNKNOWN );
pLabel->CalculateStringWidths(true);
pLabel->SetVisible(false);
delete pLabel;
}
示例3: CalculateAlarmStringWidths
/*****************************************************************************
* Function - CalculateAlarmStringWidths
* DESCRIPTION:
*
****************************************************************************/
void StringWidthCalculator::CalculateAlarmStringWidths()
{
Label* pLabel = new Label();
// use the same size as mLabelErrorString in AlarmListItem
pLabel->SetSize(225-5+1, 15);
mpDisplayCtrl->GetCurrentDisplay()->SetDisplayNumber("");
for(int i = 0; i < DISPLAY_ALARM_STRINGS_CNT; ++i)
{
pLabel->SetStringId( DISPLAY_ALARM_STRINGS[i].StringId );
pLabel->CalculateStringWidths(true);
}
pLabel->SetStringId( SID_ALARM_UNKNOWN );
pLabel->CalculateStringWidths(true);
pLabel->SetVisible(false);
delete pLabel;
}
示例4: ExportStringWidthsAdv
/*****************************************************************************
* Function - ExportStringWidths
* DESCRIPTION:
*
****************************************************************************/
void StringWidthCalculator::ExportStringWidthsAdv(StringWidthParameters* parameters)
{
if (parameters->includeHeader)
{//create new file
mpStringLengthFile = fopen(parameters->filename, "wb");
}
else
{//append to file
mpStringLengthFile = fopen(parameters->filename, "ab");
}
if (mpStringLengthFile == NULL)
{
TCHAR sz_msg[512];
_stprintf(sz_msg, TEXT("Unable to open file: %s"), parameters->filename);
::MessageBox(NULL,sz_msg,TEXT("Unable to open file."),MB_OK|MB_ICONHAND);
return;
}
strncpy(mpFirstColumnContents, parameters->firstcolumn, MAX_PATH);
if (parameters->includeHeader)
{
Languages* p_lang = Languages::GetInstance();
LANGUAGE_TYPE orig_lang = p_lang->GetLanguage();
p_lang->SetLanguage(DEV_LANGUAGE);
// write a simple header
DataPointTime* pdt = new DataPointTime();
fprintf(mpStringLengthFile, "\"%s\";\"%s\"\r\n",
p_lang->GetLanguageName( orig_lang ),
pdt->GetText()
);
p_lang->SetLanguage(orig_lang);
delete pdt;
if (parameters->onlyRelationsInCurrentDisplay)
{
sHelpStringIdExported.clear();
// write column names
fprintf(mpStringLengthFile, "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\r\n",
"DisplayFilename","DisplayId","Display","StringId","Visible");
}
else
{
// write column names
fprintf(mpStringLengthFile, "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\r\n",
"DisplayId","Display",
"StringId","Visible","String Width","String Height",
"ComponentId","Component Width","Component Height", "Max. no of lines",
"Wrapped","Fits");
}
}
sStringIdCompWidth.clear();
if (parameters->onlyRelationsInCurrentDisplay)
{
// special export for first display
if (parameters->includeHeader)
{
mpDisplayCtrl->GetMenuBar()->CalculateStringWidths(false);
}
// special export of unreferenced helptexts
if (strcmp(mpFirstColumnContents, UNREFERENCED_HELPTEXT) == 0)
{
for (int i = 0; i < LANG_GEN_HELP_STRING_COUNT; ++i)
{
int id = Languages::GetInstance()->GetHelpStingId(i);
std::map<U16, bool>::iterator itr = sHelpStringIdExported.find(id);
if (itr == sHelpStringIdExported.end())
{
fprintf(mpStringLengthFile, "\"%s\";\"%d\";\"[%s]\";\"%d\";\"%d\"\r\n",
mpFirstColumnContents, 0, "", id, 2);
}
}
}
else // normal export
{
// don't set g_is_calculating_strings, only visible listview rows should be exported
PopupBox* popup = mpDisplayCtrl->GetCurrentPopupBox();
if (popup != NULL)
{
popup->CalculateStringWidths(false);
}
else
{
//.........这里部分代码省略.........