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


C++ LabelPtr::ReferencesObject方法代码示例

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


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

示例1: InterpretFilePathField


//.........这里部分代码省略.........
				editButton->a_HelpText.Set( TXT( "Attempt to edit the file using its associated default application." ) );
				container->AddChild( editButton );
			}
		}
	}
	else
	{
		ValuePtr value = CreateControl< Value >();
		value->a_IsReadOnly.Set( readOnly );
		value->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
		container->AddChild( value );
	}


	//
	// Setup label
	//

	LabelPtr label = NULL;

	{
		std::vector< ControlPtr >::const_iterator itr = container->GetChildren().begin();
		std::vector< ControlPtr >::const_iterator end = container->GetChildren().end();
		for( ; itr != end; ++itr )
		{
			Label* label = Reflect::SafeCast<Label>( *itr );
			if (label)
			{
				break;
			}
		}
	}

	if (!label.ReferencesObject())
	{
		label = CreateControl< Label >();

		std::string temp;
		field->GetProperty( TXT( "UIName" ), temp );
		if ( temp.empty() )
		{
			bool converted = Helium::ConvertString( field->m_Name, temp );
			HELIUM_ASSERT( converted );
		}

		label->BindText( temp );
		label->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );

		container->InsertChild(0, label);
	}

	//
	// Create type m_FinderSpecific data bound to this and additional objects
	//

	std::vector<Data*> datas;

	{
		std::vector<Reflect::Object*>::const_iterator itr = objects.begin();
		std::vector<Reflect::Object*>::const_iterator end = objects.end();
		for ( ; itr != end; ++itr )
		{
			Data s = field->CreateData();

			if (s->IsA(Reflect::GetMetaClass<ContainerData>()))
			{
开发者ID:HeliumProject,项目名称:Inspect,代码行数:67,代码来源:Reflect.cpp

示例2: InterpretField

void ReflectValueInterpreter::InterpretField(const Field* field, const std::vector<Reflect::Object*>& instances, Container* parent)
{
    if (field->m_Flags & FieldFlags::Hide)
    {
        return;
    }

    //
    // Create the ui we are generating
    //

    ContainerPtr container = CreateControl<Container>();

    bool readOnly = ( field->m_Flags & FieldFlags::ReadOnly ) == FieldFlags::ReadOnly;

    //
    // Parse
    //

    tstring fieldUI;
    field->GetProperty( TXT( "UIScript" ), fieldUI );
    bool result = Script::Parse(fieldUI, this, parent->GetCanvas(), container, field->m_Flags);

    if (!result)
    {
        if ( field->m_DataClass == Reflect::GetClass<EnumerationData>() )
        {
            ChoicePtr choice = CreateControl<Choice>();

            const Reflect::Enumeration* enumeration = Reflect::ReflectionCast< Enumeration >( field->m_Type );

            std::vector< ChoiceItem > items;
            items.resize( enumeration->m_Elements.GetSize() );

            DynArray< EnumerationElement >::ConstIterator itr = enumeration->m_Elements.Begin();
            DynArray< EnumerationElement >::ConstIterator end = enumeration->m_Elements.End();
            for ( size_t index=0; itr != end; ++itr, ++index )
            {
                ChoiceItem& item = items[index];

                item.m_Key = itr->m_Name;
                item.m_Data = itr->m_Name;
            }

            choice->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
            choice->a_Items.Set( items );
            choice->a_IsDropDown.Set( true );
            choice->a_IsReadOnly.Set( readOnly );

            container->AddChild(choice);
        }
        else
        {
            if ( field->m_DataClass == Reflect::GetClass<BoolData>() )
            {
                CheckBoxPtr checkBox = CreateControl<CheckBox>();
                checkBox->a_IsReadOnly.Set( readOnly );
                checkBox->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
                container->AddChild( checkBox );
            }
            else
            {
                ValuePtr value = CreateControl<Value>();
                value->a_IsReadOnly.Set( readOnly );
                value->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
                container->AddChild( value );
            }
        }
    }

    //
    // Setup label
    //

    LabelPtr label = NULL;

    {
        V_Control::const_iterator itr = container->GetChildren().begin();
        V_Control::const_iterator end = container->GetChildren().end();
        for( ; itr != end; ++itr )
        {
            Label* label = Reflect::SafeCast<Label>( *itr );
            if (label)
            {
                break;
            }
        }
    }

    if (!label.ReferencesObject())
    {
        label = CreateControl<Label>();

        tstring temp;
        field->GetProperty( TXT( "UIName" ), temp );
        if ( temp.empty() )
        {
            bool converted = Helium::ConvertString( field->m_Name, temp );
            HELIUM_ASSERT( converted );
        }
//.........这里部分代码省略.........
开发者ID:euler0,项目名称:Helium,代码行数:101,代码来源:ReflectValueInterpreter.cpp

示例3: InterpretValueField

void ReflectInterpreter::InterpretValueField( const std::vector< Reflect::Pointer >& pointers, Reflect::Translator* translator, const Field* field, Container* parent )
{
	if (field->m_Flags & FieldFlags::Hide)
	{
		return;
	}

	//
	// Create the ui we are generating
	//

	ContainerPtr container = CreateControl<Container>();

	bool readOnly = ( field->m_Flags & FieldFlags::ReadOnly ) == FieldFlags::ReadOnly;

	if ( field->m_ValueType && field->m_ValueType->IsA( MetaIds::MetaEnum ) )
	{
		const Reflect::MetaEnum* enumeration = Reflect::ReflectionCast< MetaEnum >( field->m_ValueType );

		ChoicePtr choice = CreateControl<Choice>();

		std::vector< ChoiceItem > items;
		items.resize( enumeration->m_Elements.GetSize() );

		DynamicArray< MetaEnum::Element >::ConstIterator itr = enumeration->m_Elements.Begin();
		DynamicArray< MetaEnum::Element >::ConstIterator end = enumeration->m_Elements.End();
		for ( size_t index=0; itr != end; ++itr, ++index )
		{
			ChoiceItem& item = items[index];

			item.m_Key = itr->m_Name;
			item.m_Data = itr->m_Name;
		}

		choice->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
		choice->a_Items.Set( items );
		choice->a_IsDropDown.Set( true );
		choice->a_IsReadOnly.Set( readOnly );

		container->AddChild(choice);
	}
	else
	{
		ScalarTranslator* scalar = ReflectionCast< ScalarTranslator >( field->m_Translator );
		if ( scalar && scalar->m_Type == ScalarTypes::Boolean )
		{
			CheckBoxPtr checkBox = CreateControl<CheckBox>();
			checkBox->a_IsReadOnly.Set( readOnly );
			checkBox->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
			container->AddChild( checkBox );
		}
		else
		{
			ValuePtr value = CreateControl<Value>();
			value->a_IsReadOnly.Set( readOnly );
			value->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
			container->AddChild( value );
		}
	}

	//
	// Setup label
	//

	LabelPtr label = NULL;

	{
		std::vector< ControlPtr >::const_iterator itr = container->GetChildren().begin();
		std::vector< ControlPtr >::const_iterator end = container->GetChildren().end();
		for( ; itr != end; ++itr )
		{
			Label* label = Reflect::SafeCast<Label>( *itr );
			if (label)
			{
				break;
			}
		}
	}

	if (!label.ReferencesObject())
	{
		label = CreateControl<Label>();

		std::string temp;
		field->GetProperty( TXT( "UIName" ), temp );
		if ( temp.empty() )
		{
			bool converted = Helium::ConvertString( field->m_Name, temp );
			HELIUM_ASSERT( converted );
		}

		label->BindText( temp );
		label->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );

		container->InsertChild(0, label);
	}

	//
	// Bind data
	//
//.........这里部分代码省略.........
开发者ID:HeliumProject,项目名称:Inspect,代码行数:101,代码来源:Reflect.cpp


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