本文整理汇总了C++中UIControl::AddControl方法的典型用法代码示例。如果您正苦于以下问题:C++ UIControl::AddControl方法的具体用法?C++ UIControl::AddControl怎么用?C++ UIControl::AddControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIControl
的用法示例。
在下文中一共展示了UIControl::AddControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadResources
void FormatsTest::LoadResources()
{
GetBackground()->SetColor(Color(0.0f, 1.0f, 0.0f, 1.0f));
int32 columnCount = 6;
int32 rowCount = (FORMAT_COUNT-1) / columnCount;
if(0 != FORMAT_COUNT % columnCount)
{
++rowCount;
}
float32 size = Min(GetSize().x / columnCount, GetSize().y / rowCount);
Font *font = FTFont::Create("~res:/Fonts/korinna.ttf");
DVASSERT(font);
font->SetSize(20);
for(int32 i = FORMAT_RGBA8888; i < FORMAT_COUNT; ++i)
{
int32 y = (i-1) / columnCount;
int32 x = (i-1) % columnCount;
String formatName = Texture::GetPixelFormatString((PixelFormat)i);
UIControl *c = new UIControl(Rect(x*size, y*size, size - 2, size - 2));
c->SetSprite(Format("~res:/TestData/FormatTest/%s/number_0", formatName.c_str()), 0);
c->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT);
UIStaticText *text = new UIStaticText(Rect(0, c->GetSize().y - 30, c->GetSize().x, 30));
text->SetText(StringToWString(formatName));
text->SetFont(font);
text->SetTextColor(Color(1.0f, 1.0f, 1.0f, 1.0f));
c->AddControl(text);
AddControl(c);
SafeRelease(text);
SafeRelease(c);
}
SafeRelease(font);
}
示例2: AddControlToParent
void HierarchyTreeControlNode::AddControlToParent()
{
if (!parent)
return;
DVASSERT(uiObject);
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(parent);
if (screenNode)
{
screenNode->GetScreen()->AddControl(this->uiObject);
}
else
{
//HierarchyTreeControlNode* controlNode = GetControlNode();
HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(parent);
if (controlNode)
{
UIControl* control = controlNode->GetUIObject();
if (control)
control->AddControl(this->uiObject);
}
}
}
示例3: LoadResources
void StaticTextScreen::LoadResources()
{
Font::SetDPI(160);
Font *fnt;
fnt = FTFont::Create(FilePath("~res:/Fonts/yikes.ttf"));
// fnt = GraphicsFont::Create("~res:/Fonts/korinna.def", "~res:/Gfx/Fonts2/korinna");
fnt->SetSize(7.5f);
// fnt->SetSize(12);
// fnt->SetVerticalSpacing(-1);
// fnt->SetColor(.82f, .81f, 0.73f, 1.0f);
float32 sizeX = 50;
float32 sizeY = 80;
UIControl *tc = new UIControl(Rect(0, 0, sizeX, sizeY));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
//tc->GetBackground()->color = Color(0,0,0.4f,1.0f);
UIStaticText *tx = new UIStaticText(Rect(0, 0, sizeX, sizeY));
tx->SetFont(fnt);
// tx->SetMultiline(true);
// tx->SetAlign(ALIGN_LEFT|ALIGN_TOP);
tx->SetText(L"Management");
// tx->SetText(L"This text is aligned by the Left and Top borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect((size.x - sizeX)/2, 0, sizeX, sizeY));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
//tc->GetBackground()->color = Color(0,0,0.4f,1.0f);
tx = new UIStaticText(Rect(0, 0, sizeX, sizeY));
tx->SetFont(fnt);
tx->SetMultiline(true);
tx->SetAlign(ALIGN_HCENTER|ALIGN_TOP);
// tx->SetText(L"abab.");
tx->SetText(L"This text is aligned byyyi the Center and Top borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect(size.x - sizeX, 0, sizeX, sizeY));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
//tc->GetBackground()->color = Color(0,0,0.4f,1.0f);
tx = new UIStaticText(Rect(0, 0, sizeX, sizeY));
tx->SetFont(fnt);
tx->SetMultiline(true);
tx->SetAlign(ALIGN_RIGHT|ALIGN_TOP);
// tx->SetText(L"apap.");
tx->SetText(L"This text is aligned by the Right and Top borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect(0, (size.y - sizeY)/2, sizeX, sizeY));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
//tc->GetBackground()->color = Color(0,0,0.4f,1.0f);
tx = new UIStaticText(Rect(0, 0, sizeX, sizeY));
tx->SetFont(fnt);
tx->SetMultiline(true);
tx->SetAlign(ALIGN_LEFT|ALIGN_VCENTER);
// tx->SetText(L"apap.");
tx->SetText(L"This text is aligned by the Left and Center borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect((size.x - sizeX)/2, (size.y - sizeY)/2, sizeX, sizeY));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
//tc->GetBackground()->color = Color(0,0,0.4f,1.0f);
tx = new UIStaticText(Rect(0, 0, sizeX, sizeY));
tx->SetFont(fnt);
tx->SetMultiline(true);
tx->SetAlign(ALIGN_HCENTER|ALIGN_VCENTER);
// tx->SetText(L"abpbs");
tx->SetText(L"This text is aligned by the Center and Center borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect(size.x - sizeX, (size.y - sizeY)/2, sizeX, sizeY));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
//tc->GetBackground()->color = Color(0,0,0.4f,1.0f);
tx = new UIStaticText(Rect(0, 0, sizeX, sizeY));
tx->SetFont(fnt);
tx->SetMultiline(true);
tx->SetAlign(ALIGN_RIGHT|ALIGN_VCENTER);
// tx->SetText(L"aaaa.");
tx->SetText(L"This text is aligned by the Right and Center borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
//.........这里部分代码省略.........