本文整理汇总了C++中Label::SetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::SetFont方法的具体用法?C++ Label::SetFont怎么用?C++ Label::SetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::SetFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFontsToList
void CSchemeVisualizer::AddFontsToList()
{
#ifdef POSIX
const char strOAccent[] = { 0xc3, 0x93, 0x00 }; // UTF-8 for U+00D3 (LATIN CAPITAL LETTER O WITH ACUTE)
#else
const uint8 strOAccent[] = { 0xd3, 0x00 };
#endif
// Stick an intl character in here to test accents (O')
CFmtStr fmtText( "ABCDEFGHIJKLMN%[email protected]#$%%^&*()-_=+", strOAccent );
const int nFontCount = m_pViewScheme->GetFontCount();
for ( int i = 0; i < nFontCount; ++i )
{
HFont hCurFont = m_pViewScheme->GetFontAtIndex( i );
const char *pCurFontName = m_pViewScheme->GetFontName( hCurFont );
CFmtStr fmtName( "FontPanel_%s", pCurFontName );
Label *pNewFontLabel = new Label( m_pList, fmtName.Access(), fmtText.Access() );
pNewFontLabel->SetFont( hCurFont );
pNewFontLabel->SizeToContents();
pNewFontLabel->SetWide( m_pList->GetWide() );
m_pList->AddItem( new Label( NULL, "Label", pCurFontName ), pNewFontLabel );
}
}
示例2: Label
TimeMenu::TimeMenu()
{
Label *label;
LineSpacer *spacer;
label = new Label();
label->SetFont(&MetaWatch_Large_16pt);
label->SetText("Time & Date");
label->SetAlignment(caCentre);
AddControl(label);
spacer = new LineSpacer(5, 2);
spacer->SetLeftPadding(10);
spacer->SetRightPadding(10);
AddControl(spacer);
// Time editor
timeEntry = new NumberEntry();
timeEntry->SetFont(&MetaWatch_Large_8pt);
timeEntry->SetFormat("[0-2][0-9]:[0-5][0-9]:[0-5][0-9]"); // TODO: Change with time format?
timeEntry->SetAlignment(caCentre);
AddControl(timeEntry);
// Date editor
dateEntry = new NumberEntry();
dateEntry->SetFont(&MetaWatch_Large_8pt);
dateEntry->SetFormat("[0-3][0-9]:[0-1][0-9]:[0-2][0-9][0-9][0-9]"); // TODO: Change with date format?
dateEntry->SetAlignment(caCentre);
AddControl(dateEntry);
}
示例3: SetActiveControl
//.........这里部分代码省略.........
editCombo->AddItem( "2 - resize down", NULL);
editCombo->AddItem( "3 - down & right", NULL);
edit = editCombo;
}
else if (datat == TYPE_CORNER)
{
// drop-down combo box
editCombo = new ComboBox(this, NULL, 4, false);
editCombo->AddItem("0 - top-left", NULL);
editCombo->AddItem("1 - top-right", NULL);
editCombo->AddItem("2 - bottom-left", NULL);
editCombo->AddItem("3 - bottom-right", NULL);
edit = editCombo;
}
else if (datat == TYPE_LOCALIZEDSTRING)
{
editButton = new Button(this, NULL, "...");
editButton->SetParent(this);
editButton->AddActionSignalTarget(this);
editButton->SetTabPosition(tabPosition++);
editButton->SetTall( itemHeight );
label->SetAssociatedControl(editButton);
}
else
{
// normal string edit
edit = new CSmallTextEntry(this, NULL);
}
if (edit)
{
edit->SetTall( itemHeight );
edit->SetParent(this);
edit->AddActionSignalTarget(this);
edit->SetTabPosition(tabPosition++);
label->SetAssociatedControl(edit);
}
HFont smallFont = scheme()->GetIScheme( GetScheme() )->GetFont( "DefaultVerySmall" );
if ( label )
{
label->SetFont( smallFont );
}
if ( edit )
{
edit->SetFont( smallFont );
}
if ( editCombo )
{
editCombo->SetFont( smallFont );
}
if ( editButton )
{
editButton->SetFont( smallFont );
}
// add to our control list
m_pPanelList->AddItem(label, edit, editCombo, editButton, fieldName, datat);
if ( edit )
{
m_pPanelList->m_pControls->AddItem(label, edit);
}
else
{
m_pPanelList->m_pControls->AddItem(label, editButton);
}
}
// check and see if the current panel is a Label
// iterate through the class hierarchy
if ( controlToEdit->IsBuildModeDeletable() )
{
m_pDeleteButton->SetEnabled(true);
}
else
{
m_pDeleteButton->SetEnabled(false);
}
// update the property data in the dialog
UpdateControlData(m_pCurrentPanel);
// set our title
if ( m_pBuildGroup->GetResourceName() )
{
m_pFileSelectionCombo->SetText(m_pBuildGroup->GetResourceName());
}
else
{
m_pFileSelectionCombo->SetText("[ no resource file associated with dialog ]");
}
m_pApplyButton->SetEnabled(false);
InvalidateLayout();
Repaint();
}
示例4: UpdateChildCount
void FormEdit::UpdateChildCount(int count)
{
for (int i = 0; i < _Ctrls.GetCount(); ++i)
_CtrlContainer.RemoveChild(&_Ctrls[i]);
_Ctrls.Clear();
_ItemList.Clear();
_Temporaries.Clear();
if (!_View.IsLayout())
{
UpdateItemList();
return;
}
// if (_ViewMode == VIEW_MODE_WIREFRAME)
// return;
for (int i = 0; i < count; ++i)
{
if (!_View.GetObject(i))
continue;
String type = (*_View.GetObjects())[i].Get("Type");
Font font = _View.GetFont();
int h = _View.ZoomY((*_View.GetObjects())[i].GetNumber("Font.Height"));
if (h != 0) font.Height(h);
if (font.GetHeight() == 0) font.Height(StdFont().GetHeight());
_ItemList.AddRow(type, (*_View.GetObjects())[i].Get("Variable"));
if ((*_View.GetObjects())[i].GetBool("OutlineDraw", false)
&& _ViewMode != VIEW_MODE_AS_IS)
{
if (_ViewMode != VIEW_MODE_WIREFRAME)
_CtrlContainer.Add( _Ctrls.Create<StaticRect>() );
}
else if (type == "Button")
{
Button* b = &_Ctrls.Create<Button>();
b->SetFont(font);
if (_ViewMode == VIEW_MODE_AS_IS)
b->SetLabel((*_View.GetObjects())[i].Get("Label"));
if (_ViewMode != VIEW_MODE_WIREFRAME)
_CtrlContainer.Add( b->NoWantFocus() );
}
else if (type == "DropDate")
{
DropDate *b = &_Ctrls.Create<DropDate>();
b->SetFont(font);
if (_ViewMode != VIEW_MODE_WIREFRAME)
_CtrlContainer.Add( b->NoWantFocus() );
}
else if (type == "GridCtrl")
{
GridCtrl *b = &_Ctrls.Create<GridCtrl>();
// b->SetFont(font); TODO
#ifdef PLATFORM_WIN32
b->Chameleon();
#endif
String src = (*_View.GetObjects())[i].Get("Grid.Columns");
ReplaceString(src, ";", "\r\n");
StringStream s;
s.Open(src);
IniFile f;
f.Load(s);
Vector<String> names = f.EnumNames("Columns");
for (int j = 0; j < names.GetCount(); ++j)
{
int n = ScanInt(names[j]);
Vector<String> values = f.GetArray("Columns", names[j]);
if (values.GetCount() != 3)
continue;
if (values[1] == "Left") b->AddColumn(values[0]).HeaderAlignCenterLeft();
else if (values[1] == "Right") b->AddColumn(values[0]).HeaderAlignCenterRight();
else b->AddColumn(values[0]).HeaderAlignCenter();
}
if (_ViewMode != VIEW_MODE_WIREFRAME)
_CtrlContainer.Add( b->NoWantFocus() );
}
else if (type == "EditField")
{
EditField *b = &_Ctrls.Create<EditField>();
b->SetFont(font);
if (_ViewMode == VIEW_MODE_AS_IS)
b->SetText((*_View.GetObjects())[i].Get("DefaultData"));
if (_ViewMode != VIEW_MODE_WIREFRAME)
_CtrlContainer.Add( b->NoWantFocus() );
}
else if (type == "EditInt")
{
EditInt *b = &_Ctrls.Create<EditInt>();
b->SetFont(font);
//.........这里部分代码省略.........