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


C++ TBWidget::AddChild方法代码示例

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


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

示例1: Show

void ProgressModal::Show()
{
    assert(!dimmer_->GetParent());
    UI* tbui = GetSubsystem<UI>();
    TBWidget* root = tbui->GetRootWidget();
    root->AddChild(dimmer_);
    root->AddChild(delegate_);

}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:9,代码来源:UIProgressModal.cpp

示例2: Object

UIDragDrop::UIDragDrop(Context* context) : Object(context)
{
    SubscribeToEvent(E_MOUSEMOVE, ATOMIC_HANDLER(UIDragDrop,HandleMouseMove));
    SubscribeToEvent(E_MOUSEBUTTONUP, ATOMIC_HANDLER(UIDragDrop,HandleMouseUp));
    SubscribeToEvent(E_MOUSEBUTTONDOWN, ATOMIC_HANDLER(UIDragDrop,HandleMouseDown));

    SharedPtr<UIFontDescription> fd(new UIFontDescription(context));
    fd->SetId("Vera");
    fd->SetSize(12);

    dragText_ = new UITextField(context);
    dragText_->SetFontDescription(fd);
    dragText_->SetGravity(UI_GRAVITY_TOP);

    dragLayout_ = new UILayout(context);
    dragLayout_->AddChild(dragText_);

    dragLayout_->SetLayoutSize(UI_LAYOUT_SIZE_PREFERRED);
    dragLayout_->SetVisibility(UI_WIDGET_VISIBILITY_GONE);

    // put into hierarchy so we aren't pruned
    TBWidget* root = GetSubsystem<UI>()->GetRootWidget();
    root->AddChild(dragLayout_->GetInternalWidget());

    InitDragAndDrop(this);

}
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:27,代码来源:UIDragDrop.cpp

示例3: Show

bool TBPopupWindow::Show(const TBPopupAlignment &alignment)
{
    // Calculate and set a good size for the popup window
    SetRect(alignment.GetAlignedRect(this, m_target.Get()));

    TBWidget *root = m_target.Get()->GetParentRoot();
    root->AddChild(this);
    return true;
}
开发者ID:Burianu,项目名称:turbobadger,代码行数:9,代码来源:tb_popup_window.cpp

示例4: SetSkinBg

MenubarItemWidget::MenubarItemWidget(MenubarItem *item, MenubarItemSource *source,
                                     TBSelectItemViewer *source_viewer, int index)
    : m_source(source)
    , m_source_viewer(source_viewer)
    , m_index(index)
{
    SetSkinBg(TBIDC("TBSelectItem"));
    SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
    SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP);
    SetPaintOverflowFadeout(false);

    TBWidget* root = GetContentRoot();

    TBFontDescription fd;
    fd.SetID(TBIDC("Vera"));
    fd.SetSize(12);

    TBTextField* text = new TBTextField();
    text->SetIgnoreInput(true);
    text->SetText(item->str);
    text->SetFontDescription(fd);
    root->AddChild(text);

    if (item->shortcut_.Length())
    {
        TBWidget* spacer = new TBWidget();
        spacer->SetIgnoreInput(true);
        spacer->SetGravity(WIDGET_GRAVITY_LEFT_RIGHT);
        root->AddChild(spacer);

        TBTextField* shortcut = new TBTextField();
        shortcut->SetIgnoreInput(true);
        shortcut->SetText(item->shortcut_.CString());
        shortcut->SetFontDescription(fd);
        shortcut->SetGravity(WIDGET_GRAVITY_RIGHT);
        root->AddChild(shortcut);
    }

}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:39,代码来源:UIMenubar.cpp

示例5: Show

bool TBMessageWindow::Show(const char *title, const char *message, TBMessageWindowSettings *settings)
{
	TBWidget *target = m_target.Get();
	if (!target)
		return false;

	TBMessageWindowSettings default_settings;
	if (!settings)
		settings = &default_settings;

	TBWidget *root = target->GetParentRoot();

	const char *source =	"TBLayout: axis: y, distribution: available\n"
							"	TBLayout: distribution: available, size: available\n"
							"		TBSkinImage: id: 2\n"
							"		TBEditField: multiline: 1, readonly: 1, id: 1\n"
							"	TBLayout: distribution-position: right bottom, id: 3\n";
	if (!g_widgets_reader->LoadData(GetContentRoot(), source))
		return false;

	SetText(title);

	GetWidgetByIDAndType<TBSkinImage>(2)->SetSkinBg(settings->icon_skin);

	TBEditField *editfield = GetWidgetByIDAndType<TBEditField>(1);
	editfield->SetStyling(settings->styling);
	editfield->SetText(message);
	editfield->SetSkinBg("");

	// Create buttons
	if (settings->msg == TB_MSG_OK)
	{
		AddButton("TBMessageWindow.ok", true);
	}
	else if (settings->msg == TB_MSG_OK_CANCEL)
	{
		AddButton("TBMessageWindow.ok", true);
		AddButton("TBMessageWindow.cancel", false);
	}
	else if (settings->msg == TB_MSG_YES_NO)
	{
		AddButton("TBMessageWindow.yes", true);
		AddButton("TBMessageWindow.no", false);
	}

	// Size to fit content. This will use the default size of the textfield.
	ResizeToFitContent();
	TBRect rect = GetRect();

	// Get how much we overflow the textfield has given the current width, and grow our height to show all we can.
	// FIX: It would be better to use adapt-to-content on the editfield to achieve the most optimal size.
	// At least when we do full blown multi pass size checking.
	rect.h += editfield->GetStyleEdit()->GetOverflowY();

	// Create background dimmer
	if (settings->dimmer)
	{
		if (TBDimmer *dimmer = new TBDimmer)
		{
			root->AddChild(dimmer);
			m_dimmer.Set(dimmer);
		}
	}

	// Center and size to the new height
	TBRect bounds(0, 0, root->GetRect().w, root->GetRect().h);
	SetRect(rect.CenterIn(bounds).MoveIn(bounds).Clip(bounds));
	root->AddChild(this);
	return true;
}
开发者ID:rongzhou,项目名称:turbobadger,代码行数:70,代码来源:tb_message_window.cpp


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