本文整理汇总了C++中TBWidget::GetNext方法的典型用法代码示例。如果您正苦于以下问题:C++ TBWidget::GetNext方法的具体用法?C++ TBWidget::GetNext怎么用?C++ TBWidget::GetNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBWidget
的用法示例。
在下文中一共展示了TBWidget::GetNext方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEvent
bool TabContainerWindow::OnEvent(const TBWidgetEvent &ev)
{
if (ev.type == EVENT_TYPE_CLICK && ev.target->GetID() == TBIDC("set_align"))
{
if (TBTabContainer *tc = GetWidgetByIDAndType<TBTabContainer>(TBIDC("tabcontainer")))
tc->SetAlignment(static_cast<TB_ALIGN>(ev.target->data.GetInt()));
ResizeToFitContent(RESIZE_FIT_CURRENT_OR_NEEDED);
}
else if (ev.type == EVENT_TYPE_CLICK && ev.target->GetID() == TBIDC("toggle_tab_axis"))
{
static AXIS axis = AXIS_X;
axis = axis == AXIS_X ? AXIS_Y : AXIS_X;
if (TBTabContainer *tc = GetWidgetByIDAndType<TBTabContainer>(TBIDC("tabcontainer")))
{
for (TBWidget *child = tc->GetTabLayout()->GetFirstChild(); child; child = child->GetNext())
{
if (TBButton *button = TBSafeCast<TBButton>(child))
button->SetAxis(axis);
}
}
ResizeToFitContent(RESIZE_FIT_CURRENT_OR_NEEDED);
}
else if (ev.type == EVENT_TYPE_CLICK && ev.target->GetID() == TBIDC("start_spinner"))
{
if (TBProgressSpinner *spinner = GetWidgetByIDAndType<TBProgressSpinner>(TBIDC("spinner")))
spinner->SetValue(1);
}
else if (ev.type == EVENT_TYPE_CLICK && ev.target->GetID() == TBIDC("stop_spinner"))
{
if (TBProgressSpinner *spinner = GetWidgetByIDAndType<TBProgressSpinner>(TBIDC("spinner")))
spinner->SetValue(0);
}
return DemoWindow::OnEvent(ev);
}
示例2: ToggleGroup
//static
void TBRadioCheckBox::ToggleGroup(TBWidget *root, TBWidget *toggled)
{
if (root != toggled && root->GetGroupID() == toggled->GetGroupID())
root->SetValue(0);
for (TBWidget *child = root->GetFirstChild(); child; child = child->GetNext())
ToggleGroup(child, toggled);
}
示例3: SetCurrentPage
void TBTabContainer::SetCurrentPage(int index)
{
if (index == m_current_page)
return;
m_current_page = index;
// Update the pages visibility and tabs pressed value.
index = 0;
TBWidget *page = m_content_root.GetFirstChild();
TBWidget *tab = m_tab_layout.GetFirstChild();
for ( ; page && tab; page = page->GetNext(), tab = tab->GetNext(), index++)
{
bool active = index == m_current_page;
page->SetOpacity(active ? 1.0f : 0.0f);
tab->SetValue(active ? 1 : 0);
}
}
示例4: GetIndexFromChild
int TBTabLayout::GetIndexFromChild(TBWidget *child) const
{
int index = 0;
for (TBWidget *tmp = GetFirstChild(); tmp; tmp = tmp->GetNext(), index++)
if (tmp == child)
return index;
return -1;
}
示例5:
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;
}
示例6: 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);
}
}
示例7: 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;
}
示例8: SetValue
void TBTabContainer::SetValue(int index)
{
if (index == m_current_page || !GetNumPages())
return;
m_current_page = index;
// Update the pages visibility and tabs pressed value.
index = 0;
TBWidget *page = m_content_root.GetFirstChild();
TBWidget *tab = m_tab_layout.GetFirstChild();
for ( ; page && tab; page = page->GetNext(), tab = tab->GetNext(), index++)
{
bool active = index == m_current_page;
page->SetVisibilility(active ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_INVISIBLE);
tab->SetValue(active ? 1 : 0);
}
TBWidgetEvent ev(EVENT_TYPE_TAB_CHANGED);
InvokeEvent(ev);
}
示例9: 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);
}
示例10: ChangeValue
bool TBSelectList::ChangeValue(SPECIAL_KEY key)
{
if (!m_source || !m_layout.GetContentRoot()->GetFirstChild())
return false;
bool forward;
if (key == TB_KEY_HOME || key == TB_KEY_DOWN)
forward = true;
else if (key == TB_KEY_END || key == TB_KEY_UP)
forward = false;
else
return false;
TBWidget *item_root = m_layout.GetContentRoot();
TBWidget *current = GetItemWidget(m_value);
TBWidget *origin = nullptr;
if (key == TB_KEY_HOME || (!current && key == TB_KEY_DOWN))
current = item_root->GetFirstChild();
else if (key == TB_KEY_END || (!current && key == TB_KEY_UP))
current = item_root->GetLastChild();
else
origin = current;
while (current)
{
if (current != origin && !current->GetDisabled())
break;
current = forward ? current->GetNext() : current->GetPrev();
}
// Select and focus what we found
if (current)
{
SetValue(current->data.GetInt());
return true;
}
return false;
}