本文整理汇总了C++中TabButton类的典型用法代码示例。如果您正苦于以下问题:C++ TabButton类的具体用法?C++ TabButton怎么用?C++ TabButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TabButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTabPressed
void TabControl::OnTabPressed( Controls::Base* control )
{
TabButton* pButton = gwen_cast<TabButton>(control);
if ( !pButton ) return;
Base* pPage = pButton->GetPage();
if ( !pPage ) return;
if ( m_pCurrentButton == pButton)
return;
if ( m_pCurrentButton )
{
Base* pPage = m_pCurrentButton->GetPage();
if ( pPage )
{
pPage->SetHidden( true );
}
m_pCurrentButton->Redraw();
m_pCurrentButton = NULL;
}
m_pCurrentButton = pButton;
pPage->SetHidden( false );
m_TabStrip->Invalidate();
Invalidate();
}
示例2: selectTab_impl
/*************************************************************************
Select tab implementation
*************************************************************************/
void TabControl::selectTab_impl(Window* wnd)
{
bool modified = false;
bool foundSelected = false;
// Iterate in order of tab index
TabButtonIndexMap::iterator i, iend;
iend = d_tabButtonIndexMap.end();
for (i = d_tabButtonIndexMap.begin(); i != iend; ++i)
{
// get corresponding tab button and content window
TabButton* tb = i->second;
Window* child = tb->getTargetWindow();
// Should we be selecting?
bool selectThis = (child == wnd);
// Are we modifying this tab?
modified = modified || (tb->isSelected() != selectThis);
foundSelected = foundSelected || selectThis;
// Select tab & set visible if this is the window, not otherwise
tb->setSelected(selectThis);
tb->setRightOfSelected(foundSelected);
child->setVisible(selectThis);
}
// Trigger event?
if (modified)
{
WindowEventArgs args(this);
onSelectionChanged(args);
}
}
示例3: OnTabPressed
void TabControl::OnTabPressed( Controls::Base* control )
{
if (!control)
return;
TabButton* pButton = control->DynamicCastTabButton();
if ( !pButton ) return;
Base* pPage = pButton->GetPage();
if ( !pPage ) return;
if ( m_pCurrentButton == pButton)
return;
if ( m_pCurrentButton )
{
Base* pPage = m_pCurrentButton->GetPage();
if ( pPage )
{
pPage->SetHidden( true );
}
m_pCurrentButton = NULL;
}
m_pCurrentButton = pButton;
pPage->SetHidden( false );
m_TabStrip->Invalidate();
Invalidate();
}
示例4: makeTabVisible_impl
/*************************************************************************
Select tab implementation
*************************************************************************/
void TabControl::selectTab_impl(Window* wnd)
{
makeTabVisible_impl(wnd);
bool modified = false;
// Iterate in order of tab index
for (size_t i = 0; i < d_tabButtonVector.size(); ++i)
{
// get corresponding tab button and content window
TabButton* tb = d_tabButtonVector [i];
Window* child = tb->getTargetWindow();
// Should we be selecting?
bool selectThis = (child == wnd);
// Are we modifying this tab?
modified = modified || (tb->isSelected() != selectThis);
// Select tab & set visible if this is the window, not otherwise
tb->setSelected(selectThis);
child->setVisible(selectThis);
}
// Trigger event?
if (modified)
{
WindowEventArgs args(this);
onSelectionChanged(args);
}
}
示例5: CanvasPosToLocal
bool TabStrip::DragAndDrop_HandleDrop(Gwen::DragAndDrop::Package* /*pPackage*/, int x, int y)
{
Gwen::Point LocalPos = CanvasPosToLocal(Gwen::Point(x, y));
Base* el = DragAndDrop::SourceControl;
TabButton* pButton = el ? el->DynamicCastTabButton() : 0;
TabControl* pTabControl = GetParent() ? GetParent()->DynamicCastTabControl() : 0;
if (pTabControl && pButton)
{
if (pButton->GetTabControl() != pTabControl)
{
// We've moved tab controls!
pTabControl->AddPage(pButton);
}
}
Base* DroppedOn = GetControlAt(LocalPos.x, LocalPos.y);
if (DroppedOn)
{
Gwen::Point DropPos = DroppedOn->CanvasPosToLocal(Gwen::Point(x, y));
DragAndDrop::SourceControl->BringNextToControl(DroppedOn, DropPos.x > DroppedOn->Width() / 2);
}
else
{
DragAndDrop::SourceControl->BringToFront();
}
return true;
}
示例6: handleTabButtonClicked
/*************************************************************************
Tab button clicked
*************************************************************************/
bool TabControl::handleTabButtonClicked(const EventArgs& args)
{
const WindowEventArgs& wargs = static_cast<const WindowEventArgs&>(args);
TabButton* tabButton = static_cast<TabButton*>(wargs.window);
setSelectedTab(tabButton->getTargetWindow()->getName());
return true;
}
示例7: TabButton
TabButton* Toolbar::addButton(const QPixmap& _icon)
{
TabButton* button = new TabButton(this);
button->setImage(_icon);
addButton(button);
return button;
}
示例8: removeButtonForTabContent
/*************************************************************************
Remove tab button
*************************************************************************/
void TabControl::removeButtonForTabContent(Window* wnd)
{
// get
TabButton* tb = static_cast<TabButton*>(
d_tabButtonPane->getChild(makeButtonName(wnd)));
// remove
d_tabButtonIndexMap.erase(tb->getTabIndex());
d_tabButtonPane->removeChildWindow(tb);
// destroy
WindowManager::getSingleton().destroyWindow(tb);
}
示例9: render
void FalagardTabButton::render()
{
TabButton* w = static_cast<TabButton*>(d_window);
// get WidgetLookFeel for the assigned look.
const WidgetLookFeel& wlf = getLookNFeel();
TabControl* tc = w->getParent() ? dynamic_cast<TabControl*>(w->getParent()->getParent()) : 0;
String prefix((tc && tc->getTabPanePosition() == TabControl::Bottom) ? "Bottom" : "Top");
String state;
if (w->isEffectiveDisabled())
state = "Disabled";
else if (w->isSelected())
state = "Selected";
else if (w->isPushed())
state = "Pushed";
else if (w->isHovering())
state = "Hover";
else if (w->isFocused())
state = "Focused";
else
state = "Normal";
if (!wlf.isStateImageryPresent(prefix + state))
{
state = "Normal";
if (!wlf.isStateImageryPresent(prefix + state))
prefix = "";
}
wlf.getStateImagery(prefix + state).render(*w);
}
示例10: pLargestTab
void TabStrip::Layout( Skin::Base* skin )
{
Gwen::Point pLargestTab( 5, 5 );
int iNum = 0;
for ( Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter )
{
TabButton* pButton = gwen_cast<TabButton>(*iter);
if ( !pButton ) continue;
pButton->SizeToContents();
Margin m;
int iNotFirst = iNum > 0 ? -1 : 0;
if ( m_iDock == Pos::Top )
{
m.left = iNotFirst;
pButton->Dock( Pos::Left );
}
if ( m_iDock == Pos::Left )
{
m.top = iNotFirst;
pButton->Dock( Pos::Top );
}
if ( m_iDock == Pos::Right )
{
m.top = iNotFirst;
pButton->Dock( Pos::Top );
}
if ( m_iDock == Pos::Bottom )
{
m.left = iNotFirst;
pButton->Dock( Pos::Left );
}
pLargestTab.x = Utility::Max( pLargestTab.x, pButton->Width() );
pLargestTab.y = Utility::Max( pLargestTab.y, pButton->Height() );
pButton->SetMargin( m );
iNum++;
}
if ( m_iDock == Pos::Top || m_iDock == Pos::Bottom )
SetSize( Width(), pLargestTab.y );
if ( m_iDock == Pos::Left || m_iDock == Pos::Right )
SetSize( pLargestTab.x, Height() );
BaseClass::Layout( skin );
}
示例11: TabButton
bool TabBar::AddButton(const int id,
const QString & title,
const QIcon & icon)
{
TabButton * button = new TabButton(this, id);
button->setText(title);
button->setIcon(icon);
layout_.addWidget(button);
buttons_.push_back(button);
connect(button, SIGNAL(clicked(const int, bool)),
this, SLOT(OnClicked(const int, bool)));
return true;
}
示例12: getButtonForTabContents
/*************************************************************************
Return the tab button for the given tab content window
*************************************************************************/
TabButton* TabControl::getButtonForTabContents(Window* wnd) const
{
TabButtonIndexMap::const_iterator i, iend;
iend = d_tabButtonIndexMap.end();
for (i = d_tabButtonIndexMap.begin(); i != iend; ++i)
{
// get corresponding tab button and content window
TabButton* tb = i->second;
Window* child = tb->getTargetWindow();
if (child == wnd)
{
return tb;
}
}
throw UnknownObjectException((utf8*)"TabControl::getButtonForTabContents - The Window object is not a tab contents.");
}
示例13: getSelectedTabIndex
/*************************************************************************
Return whether the tab content window is currently selected.
*************************************************************************/
uint TabControl::getSelectedTabIndex() const
{
uint index;
TabButtonIndexMap::const_iterator i, iend;
iend = d_tabButtonIndexMap.end();
for (i = d_tabButtonIndexMap.begin(); i != iend; ++i)
{
// get corresponding tab button and content window
TabButton* tb = i->second;
if (tb->isSelected())
{
index = i->first;
break;
}
}
return index;
}
示例14: Base
TabButton* TabControl::AddPage( TextObject strText, Controls::Base* pPage )
{
if ( !pPage )
{
pPage = new Base( this );
}
else
{
pPage->SetParent( this );
}
TabButton* pButton = new TabButton( m_TabStrip );
pButton->SetText( strText );
pButton->SetPage( pPage );
pButton->SetTabable( false );
AddPage( pButton );
return pButton;
}
示例15: removeTab
TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id,
bool _add_stretch, bool _text_is_tooltip )
{
// already tab with id?
if( m_tabs.contains( _id ) )
{
// then remove it
removeTab( _id );
}
QString caption = ( _text_is_tooltip ) ? QString( "" ) : _text;
// create tab-button
TabButton * b = new TabButton( caption, _id, this );
connect( b, SIGNAL( clicked( int ) ), this, SLOT( tabClicked( int ) ) );
b->setIconSize( QSize( 48, 48 ) );
b->setFixedSize( 64, 64 );
b->show();
if( _text_is_tooltip )
{
ToolTip::add( b, _text );
}
// small workaround, because QBoxLayout::addWidget(...) doesn't
// work properly, so we first have to remove all tabs from the
// layout and them add them in the correct order
QMap<int, QPair<TabButton *, QWidget *> >::iterator it;
for( it = m_tabs.begin(); it != m_tabs.end(); ++it )
{
m_layout->removeWidget( it.value().first );
}
m_tabs.insert( _id, qMakePair( b, _w ) );
for( it = m_tabs.begin(); it != m_tabs.end(); ++it )
{
m_layout->addWidget( it.value().first );
}
if( _add_stretch )
{
m_layout->addStretch();
}
// we assume, parent-widget is a widget acting as widget-stack so all
// widgets have the same size and only the one on the top is visible
_w->setFixedSize( _w->parentWidget()->size() );
b->setFont( pointSize<8>( b->font() ) );
return( b );
}