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


C++ TBWidget类代码示例

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


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

示例1: SetRect

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

示例2: assert

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

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

示例3:

TBWidget *TBSelectList::GetItemWidget(int index)
{
    if (index == -1)
        return nullptr;
    for (TBWidget *tmp = m_layout.GetContentRoot()->GetFirstChild(); tmp; tmp = tmp->GetNext())
        if (tmp->data.GetInt() == index)
            return tmp;
    return nullptr;
}
开发者ID:rongzhou,项目名称:turbobadger,代码行数:9,代码来源:tb_select.cpp

示例4: Center

void ProgressModal::Center()
{
    UI* tbui = GetSubsystem<UI>();
    TBRect rect = window_->GetRect();
    TBWidget* root = tbui->GetRootWidget();
    TBRect bounds(0, 0, root->GetRect().w, root->GetRect().h);
    window_->SetRect(rect.CenterIn(bounds).MoveIn(bounds).Clip(bounds));
    delegate_->SetRect(bounds);

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

示例5: OnEvent

bool ImageWindow::OnEvent(const TBWidgetEvent &ev)
{
	if (ev.type == EVENT_TYPE_CLICK && ev.target->GetID() == TBIDC("remove"))
	{
		TBWidget *image = ev.target->GetParent();
		image->GetParent()->RemoveChild(image);
		delete image;
		return true;
	}
	return DemoWindow::OnEvent(ev);
}
开发者ID:carriercomm,项目名称:turbobadger,代码行数:11,代码来源:Demo01.cpp

示例6: GetNumPages

int TBTabContainer::GetNumPages()
{
	int count = 0;
	for (TBWidget *tab = m_tab_layout.GetFirstChild(); tab; tab = tab->GetNext())
		count++;

    if (!count)
        m_current_page = -1;

	return count;
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:11,代码来源:tb_tab_container.cpp

示例7: GatherWidgets

void JSUI::GatherWidgets(tb::TBWidget* widget, PODVector<tb::TBWidget*>& widgets)
{
    if (widget->GetID() != TBID())
        widgets.Push(widget);

    for (TBWidget *n = widget->GetFirstChild(); n; n = n->GetNext())
    {
        GatherWidgets(n, widgets);
    }

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

示例8: GetAlignedRect

TBRect TBPopupAlignment::GetAlignedRect(TBWidget *popup, TBWidget *target) const
{
    TBWidget *root = target->GetParentRoot();

    SizeConstraints sc(root->GetRect().w, root->GetRect().h);

    PreferredSize ps = popup->GetPreferredSize(sc);

    TBRect target_rect;
    TBPoint pos;
    int w = MIN(ps.pref_w, root->GetRect().w);
    int h = MIN(ps.pref_h, root->GetRect().h);
    if (pos_in_root.x != UNSPECIFIED &&
            pos_in_root.y != UNSPECIFIED)
    {
        pos = pos_in_root;
    }
    else
    {
        target->ConvertToRoot(pos.x, pos.y);

        if (align == TB_ALIGN_TOP || align == TB_ALIGN_BOTTOM)
        {
            if (expand_to_target_width)
                w = MAX(w, target->GetRect().w);

            // If the menu is aligned top or bottom, limit its height to the worst case available height.
            // Being in the center of the root, that is half the root height minus the target rect.
            h = MIN(h, root->GetRect().h / 2 - target->GetRect().h);
        }
        target_rect = target->GetRect();
    }

    int x, y;
    if (align == TB_ALIGN_BOTTOM)
    {
        x = pos.x;
        y = pos.y + target_rect.h + h > root->GetRect().h ? pos.y - h : pos.y + target_rect.h;
    }
    else if (align == TB_ALIGN_TOP)
    {
        x = pos.x;
        y = pos.y - h < 0 ? pos.y + target_rect.h : pos.y - h;
    }
    else if (align == TB_ALIGN_RIGHT)
    {
        x = pos.x + target_rect.w + w > root->GetRect().w ? pos.x - w : pos.x + target_rect.w;
        y = MIN(pos.y, root->GetRect().h - h);
    }
    else //if (align == TB_ALIGN_LEFT)
    {
        x = pos.x - w < 0 ? pos.x + target_rect.w : pos.x - w;
        y = MIN(pos.y, root->GetRect().h - h);
    }

    return TBRect(x, y, w, h);
}
开发者ID:Burianu,项目名称:turbobadger,代码行数:57,代码来源:tb_popup_window.cpp

示例9: while

void TBScroller::GetTargetScrollXY(int &x, int &y) const
{
	x = 0;
	y = 0;
	TBWidget *tmp = m_target->GetScrollRoot();
	while (tmp)
	{
		TBWidget::ScrollInfo info = tmp->GetScrollInfo();
		x += info.x;
		y += info.y;
		tmp = tmp->GetParent();
	}
}
开发者ID:Burianu,项目名称:turbobadger,代码行数:13,代码来源:tb_scroller.cpp

示例10: Center

void UIWidget::Center()
{
    if (!widget_)
        return;

    // this should center on parent widget, not root
    UI* ui = GetSubsystem<UI>();
    TBRect rect = widget_->GetRect();
    TBWidget* root = ui->GetRootWidget();
    TBRect bounds(0, 0, root->GetRect().w, root->GetRect().h);
    widget_->SetRect(rect.CenterIn(bounds).MoveIn(bounds).Clip(bounds));

}
开发者ID:adebgamesoft,项目名称:AtomicGameEngine,代码行数:13,代码来源:UIWidget.cpp

示例11: drop_callback

static void drop_callback(GLFWwindow *window, int count, const char **files_utf8)
{
	ApplicationBackendGLFW *backend = GetBackend(window);
	TBWidget *target = TBWidget::hovered_widget;
	if (!target)
		target = TBWidget::focused_widget;
	if (!target)
		target = backend->GetRoot();
	if (target)
	{
		TBWidgetEventFileDrop ev;
		for (int i = 0; i < count; i++)
			ev.files.Add(new TBStr(files_utf8[i]));
		target->InvokeEvent(ev);
	}
}
开发者ID:malmrose,项目名称:turbobadger,代码行数:16,代码来源:port_glfw.cpp

示例12: GetParent

TBWindow *TBWindow::GetTopMostOtherWindow(bool only_activable_windows)
{
	TBWindow *other_window = nullptr;
	TBWidget *sibling = GetParent()->GetLastChild();
	while (sibling && !other_window)
	{
		if (sibling != this)
			other_window = TBSafeCast<TBWindow>(sibling);

		if (only_activable_windows && other_window && !(other_window->m_settings & WINDOW_SETTINGS_CAN_ACTIVATE))
			other_window = nullptr;

		sibling = sibling->GetPrev();
	}
	return other_window;
}
开发者ID:rongzhou,项目名称:turbobadger,代码行数:16,代码来源:tb_window.cpp

示例13: Center

void UIWidget::Center()
{
    if (!widget_)
        return;

    TBRect rect = widget_->GetRect();
    TBWidget* root = widget_->GetParent();
    if (!root)
    {
        UI* ui = GetSubsystem<UI>();
        root = ui->GetRootWidget();
    }

    TBRect bounds(0, 0, root->GetRect().w, root->GetRect().h);
    widget_->SetRect(rect.CenterIn(bounds).MoveIn(bounds).Clip(bounds));

}
开发者ID:sourceops,项目名称:AtomicGameEngine,代码行数:17,代码来源:UIWidget.cpp

示例14: HandleMouseDown

void UIDragDrop::HandleMouseDown(StringHash eventType, VariantMap& eventData)
{
    using namespace MouseButtonDown;

    Input* input = GetSubsystem<Input>();

    if (!input->IsMouseVisible())
        return;

    if ((eventData[P_BUTTONS].GetUInt() & MOUSEB_LEFT) && TBWidget::hovered_widget)
    {
        // see if we have a widget with a drag object

        TBWidget* tbw = TBWidget::hovered_widget;
        UIWidget* widget = nullptr;

        while(tbw)
        {
            if (tbw->GetDelegate())
            {
                widget = (UIWidget*) tbw->GetDelegate();

                if (widget->GetDragObject())
                {
                    // TODO: check if we're in widget bounds
                    // this is going to need to be updated for drag/drop multiselect
                    break;
                }

                widget = nullptr;
            }

            tbw = tbw->GetParent();
        }

        if (!widget)
            return;

        currentTargetWidget_ = widget;
        dragSourceWidget_ = widget;
        mouseDownPosition_ = input->GetMousePosition();

    }

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

示例15: AddWidgetListItemsRecursive

void ResourceEditWindow::AddWidgetListItemsRecursive(TBWidget *widget, int depth)
{
	if (depth > 0) // Ignore the root
	{
		// Add a new ResourceItem for this widget
		TBStr str;
		const char *classname = widget->GetClassName();
		if (!*classname)
			classname = "<Unknown widget type>";
		str.SetFormatted("% *s%s", depth - 1, "", classname);

		if (ResourceItem *item = new ResourceItem(widget, str))
			m_widget_list_source.AddItem(item);
	}

	for (TBWidget *child = widget->GetFirstChild(); child; child = child->GetNext())
		AddWidgetListItemsRecursive(child, depth + 1);
}
开发者ID:CarlJacobs,项目名称:turbobadger,代码行数:18,代码来源:ResourceEditWindow.cpp


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