当前位置: 首页>>代码示例>>C++>>正文


C++ UIControl::AddControl方法代码示例

本文整理汇总了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);
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例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);
		}
	}	
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:24,代码来源:HierarchyTreeControlNode.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:101,代码来源:StaticTextScreen.cpp


注:本文中的UIControl::AddControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。