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


C++ ToolButton::SetShortProperties方法代码示例

本文整理汇总了C++中ToolButton::SetShortProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolButton::SetShortProperties方法的具体用法?C++ ToolButton::SetShortProperties怎么用?C++ ToolButton::SetShortProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ToolButton的用法示例。


在下文中一共展示了ToolButton::SetShortProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Create

void BuildingEditWindow::Create()
{
	DarwiniaWindow::Create();

	Building *building = g_app->m_location->GetBuilding(g_app->m_locationEditor->m_selectionId);
	DarwiniaDebugAssert(building);

	int buttonPitch = 18;
	int y = 6;

    ToolButton *mb = new ToolButton(LocationEditor::ToolMove);
	mb->SetShortProperties(LANGUAGEPHRASE("editor_move"), 10, y += buttonPitch, m_w-20);
	RegisterButton(mb);

    ToolButton *rb = new ToolButton(LocationEditor::ToolRotate);
	rb->SetShortProperties(LANGUAGEPHRASE("editor_rotate"), 10, y += buttonPitch, m_w-20);
	RegisterButton(rb);

    CloneBuildingButton *clone = new CloneBuildingButton();
    clone->SetShortProperties(LANGUAGEPHRASE("editor_clone"), 10, y+=buttonPitch, m_w-20);
    RegisterButton(clone);

    DeleteBuildingButton *db = new DeleteBuildingButton();
    db->SetShortProperties(LANGUAGEPHRASE("editor_delete"), 10, y += buttonPitch, m_w-20);
    RegisterButton(db);

    ToolButton *lb = new ToolButton(LocationEditor::ToolLink);
    lb->SetShortProperties(LANGUAGEPHRASE("editor_link"), 10, y += buttonPitch, m_w-20);
    RegisterButton(lb);

	y += buttonPitch;

    for( int i = -1; i < 3; ++i )
    {
        char name[256];
        int w = m_w/4 - 5;
        sprintf( name, "T%d",i);
        TeamButton *tb = new TeamButton(i);
        tb->SetShortProperties(name, 61 + (float)i*((float)w + 1.0f), y, w - 2);
        RegisterButton(tb);
    }

	CreateValueControl(LANGUAGEPHRASE("editor_dynamic"), InputField::TypeChar, &building->m_dynamic, y += buttonPitch,
					   1.0f, 0, 1);

	CreateValueControl(LANGUAGEPHRASE("editor_isglobal"), InputField::TypeChar, &building->m_isGlobal, y += buttonPitch,
					   1.0f, 0, 1);

    if (building->m_type == Building::TypeFactory)
	{
		InputField *intExtra = new InputField();
		intExtra->SetShortProperties(LANGUAGEPHRASE("editor_spirits"), 10, y += buttonPitch, m_w-20);
		Factory *factory = (Factory*)building;
		intExtra->RegisterInt(&factory->m_initialCapacity);
		RegisterButton(intExtra);
	}
    else if (building->m_type == Building::TypeTrunkPort)
    {
        InputField *inExtra = new InputField();
        inExtra->SetShortProperties(LANGUAGEPHRASE("editor_targetlocation"), 10, y += buttonPitch, m_w-20);
        TrunkPort *port = (TrunkPort *) building;
        inExtra->RegisterInt( &port->m_targetLocationId );
        RegisterButton(inExtra);
    }
    else if (building->m_type == Building::TypeLaserFence)
    {
        LaserFence *fence = (LaserFence *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_scale"), InputField::TypeFloat, &fence->m_scale, y+=buttonPitch, 0.01f, 0.0f, 100.0f );

       DropDownMenu *menu = new DropDownMenu(true);
        menu->SetShortProperties( LANGUAGEPHRASE("editor_mode"), 10, y+=buttonPitch, m_w-20 );
        menu->AddOption( LANGUAGEPHRASE("editor_disabled") );
        menu->AddOption( LANGUAGEPHRASE("editor_enabling") );
        menu->AddOption( LANGUAGEPHRASE("editor_enabled") );
        menu->AddOption( LANGUAGEPHRASE("editor_disabling") );
		menu->AddOption( LANGUAGEPHRASE("editor_neveron") );
        menu->RegisterInt( &fence->m_mode );
        RegisterButton( menu );
    }
    else if(building->m_type == Building::TypeAntHill)
    {
        AntHill *antHill = (AntHill *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_numants"), InputField::TypeInt, &antHill->m_numAntsInside, y+=buttonPitch, 1, 0, 1000 );
    }
    else if(building->m_type == Building::TypeSafeArea)
    {
        SafeArea *safeArea = (SafeArea *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_size"), InputField::TypeFloat, &safeArea->m_size, y+=buttonPitch, 1.0f, 0.0f, 1000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_capacity"), InputField::TypeInt, &safeArea->m_entitiesRequired, y+=buttonPitch, 1, 0, 10000 );

        DropDownMenu *menu = new DropDownMenu(true);
        menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 );
        for( int i = 0; i < Entity::NumEntityTypes; ++i)
        {
            menu->AddOption( Entity::GetTypeNameTranslated(i), i );
        }
        menu->RegisterInt( &safeArea->m_entityTypeRequired );
        RegisterButton( menu );
    }
    else if(building->m_type == Building::TypeTrackStart)
//.........这里部分代码省略.........
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:101,代码来源:buildings_window.cpp


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