本文整理汇总了C++中UIControl::GetBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ UIControl::GetBackground方法的具体用法?C++ UIControl::GetBackground怎么用?C++ UIControl::GetBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIControl
的用法示例。
在下文中一共展示了UIControl::GetBackground方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UIHierarchyCell
UIHierarchyCell * GraphBase::CellForNode(UIHierarchy *forHierarchy, void *node)
{
UIHierarchyCell *c= forHierarchy->GetReusableCell("Graph cell"); //try to get cell from the reusable cells store
if(!c)
{
//if cell of requested type isn't find in the store create new cell
int32 leftSideWidth = EditorSettings::Instance()->GetLeftPanelWidth();
c = new UIHierarchyCell(Rect(0, 0, leftSideWidth, ControlsFactory::CELL_HEIGHT), "Graph cell");
UIControl *icon = new UIControl(Rect(0, 0, ControlsFactory::CELL_HEIGHT, ControlsFactory::CELL_HEIGHT));
icon->SetName("_Icon_");
icon->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_PROPORTIONAL);
c->text->AddControl(icon);
UIControl *marker = new UIControl(Rect(0, 0, ControlsFactory::CELL_HEIGHT, ControlsFactory::CELL_HEIGHT));
marker->SetName("_Marker_");
marker->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_PROPORTIONAL);
c->text->AddControl(marker);
UIStaticText *text = new UIStaticText(Rect(ControlsFactory::CELL_HEIGHT, 0, leftSideWidth - ControlsFactory::CELL_HEIGHT, ControlsFactory::CELL_HEIGHT));
Font *font = ControlsFactory::GetFont12();
text->SetFont(font);
text->SetAlign(ALIGN_LEFT|ALIGN_VCENTER);
text->SetName("_Text_");
text->SetTextColor(ControlsFactory::GetColorDark());
c->text->AddControl(text);
}
FillCell(c, node);
ControlsFactory::CustomizeExpandButton(c->openButton);
ControlsFactory::CustomizeSceneGraphCell(c);
return c;
}
示例2: UIControl
UIControl * ControlsFactory::CreateLine(const Rect & rect, Color color)
{
UIControl * lineControl = new UIControl(rect);
lineControl->GetBackground()->color = color;
lineControl->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
return lineControl;
}
示例3: InitializeControl
void UIAggregatorMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
int paramsCount = this->GetParamsCount();
for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
{
UIControl* control = this->treeNodeParams[i].GetUIControl();
control->SetName(controlName);
control->SetPosition(position);
control->GetBackground()->SetDrawType(UIControlBackground::DRAW_ALIGNED);
}
}
示例4: InitializeControl
// Initialize the control(s) attached.
void BaseMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
int paramsCount = this->GetParamsCount();
for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
{
UIControl* control = this->treeNodeParams[i].GetUIControl();
control->SetName(controlName);
control->SetSize(INITIAL_CONTROL_SIZE);
control->SetPosition(position);
control->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
}
}
示例5: 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);
}
示例6: LoadResources
//.........这里部分代码省略.........
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);
tc = new UIControl(Rect(0, size.y - sizeY, 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_BOTTOM);
tx->SetText(L"This text is aligned by the Left and Bottom borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect((size.x - sizeX)/2, size.y - sizeY, 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_BOTTOM);
tx->SetText(L"This text is aligned by the Center and Bottom borders.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect(size.x - sizeX, size.y - sizeY, 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_BOTTOM);
tx->SetText(L"No desc elems.uj");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
tc = new UIControl(Rect((size.x - sizeX)/2, (size.y - sizeY)/2 - 70, 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_HJUSTIFY|ALIGN_TOP);
tx->SetText(L"This text is Justify and it's looks little better than the others. aja. AVA.");
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
//fnt->SetColor(1.0f, 0.3f, 0.3f, 1.0f);
fnt->SetVerticalSpacing(5);
tc = new UIControl(Rect(100, 100, 600, 400));
tc->SetSpriteDrawType(UIControlBackground::DRAW_FILL);
tc->GetBackground()->color = Color(0.5f,0.5,0.5f,1.0f);
tx = new UIStaticText(Rect(10, 10, 400, 200));
tx->SetFont(fnt);
tx->SetMultiline(true);
tx->SetAlign(ALIGN_HJUSTIFY|ALIGN_TOP);
tx->SetText(L"Test test shadow, shadow test ABCDEFGHJIKLMNOPQRSTUVWXYZ\nTest test shadow, shadow test ABCDEFGHJIKLMNOPQRSTUVWXYZ\nTest test shadow, shadow test ABCDEFGHJIKLMNOPQRSTUVWXYZ");
tx->SetTextColor(Color(0.0f, 1.0f, 0.0f, 1.0f));
tx->SetShadowColor(Color(0.0f, 0.0f, 0.0f, 0.25f));
tx->SetShadowOffset(Vector2(2.0f, 2.0f));
tc->AddControl(tx);
AddControl(tc);
SafeRelease(tc);
SafeRelease(tx);
SafeRelease(fnt);
}
示例7: UIListCell
UIListCell *MaterialEditor::CellAtIndex(UIList *forList, int32 index)
{
UIListCell *c = forList->GetReusableCell("Material name cell");
if (!c)
{
c = new UIListCell(Rect(0, 0, forList->GetRect().dx, 20), "Material name cell");
float32 boxSize = 16;
float32 y = (CellHeight(forList, index) - boxSize) / 2;
float32 x = forList->GetRect().dx - boxSize;
//Temporary fix for loading of UI Interface to avoid reloading of texrures to different formates.
// 1. Reset default format before loading of UI
// 2. Restore default format after loading of UI from stored settings.
Texture::SetDefaultFileFormat(NOT_FILE);
Rect r = Rect(x, y, boxSize, boxSize);
UIControl *sceneFlagBox = new UIControl(r);
sceneFlagBox->SetName("flagBox");
sceneFlagBox->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT);
sceneFlagBox->SetSprite("~res:/Gfx/UI/marker", 1);
sceneFlagBox->SetInputEnabled(false);
c->AddControl(sceneFlagBox);
SafeRelease(sceneFlagBox);
Texture::SetDefaultFileFormat((ImageFileFormat)EditorSettings::Instance()->GetTextureViewFileFormat());
}
Material *mat = GetMaterial(index);
bool found = false;
if(EDM_ALL == displayMode)
{
for (int32 i = 0; i < (int32)workingNodeMaterials.size(); ++i)
{
if(workingNodeMaterials[i] == mat)
{
found = true;
break;
}
}
}
else
{
found = true;
}
ControlsFactory::CustomizeListCell(c, StringToWString(mat->GetName()), false);
UIControl *sceneFlagBox = c->FindByName("flagBox");
sceneFlagBox->SetVisible(found, false);
if (index == selectedMaterial)
{
c->SetSelected(true, false);
lastSelection = c;
}
else
{
c->SetSelected(false, false);
}
return c;
}