void SeparateTabBar::mouseReleaseEvent (QMouseEvent *event)
	{
		int index = tabAt (event->pos ());
		if (index == count () - 1 &&
				event->button () == Qt::LeftButton &&
				IsLastTab_)
		{
			emit addDefaultTab ();
			return;
		}

		if (InMove_)
		{
			emit releasedMouseAfterMove (currentIndex ());
			InMove_ = false;
			emit currentChanged (currentIndex ());
		}
		else if (index != -1 &&
				event->button () == Qt::MidButton &&
				index != count () - 1)
		{
			auto rootWM = Core::Instance ().GetRootWindowsManager ();
			auto tm = rootWM->GetTabManager (Window_);
			tm->remove (index);
		}

		QTabBar::mouseReleaseEvent (event);
	}
	void SeparateTabWidget::setCurrentIndex (int index)
	{
		if (index >= WidgetCount ())
			index = WidgetCount () - 1;

		auto rootWM = Core::Instance ().GetRootWindowsManager ();
		auto tabManager = rootWM->GetTabManager (Window_);

		MainStackedWidget_->setCurrentIndex (-1);
		if (CurrentToolBar_)
		{
			RemoveWidgetFromSeparateTabWidget (CurrentToolBar_);
			CurrentToolBar_ = nullptr;
		}

		MainTabBar_->setCurrentIndex (index);

		if (auto bar = tabManager->GetToolBar (index))
		{
			AddWidget2SeparateTabWidget (bar);
			bar->show ();
			CurrentToolBar_ = bar;
		}
		MainStackedWidget_->setCurrentIndex (index);

		CurrentIndex_ = index;
		if (CurrentWidget_ != Widget (index))
		{
			PreviousWidget_ = CurrentWidget_;
			CurrentWidget_ = Widget (index);
			emit currentChanged (index);
		}
	}
void CXTPTabManagerItem::DrawImage(CDC* pDC, CRect rcIcon, CXTPImageManagerIcon* pImage)
{
	if (rcIcon.Width() == rcIcon.Height() && GetTabManager()->GetPaintManager()->m_bRotateImageOnVerticalDraw
		&& (GetTabManager()->GetPosition() == xtpTabPositionLeft || GetTabManager()->GetPosition() == xtpTabPositionRight)
		&& DrawRotatedImage(pDC, rcIcon, pImage))
	{

	}
	else
	{
		CXTPImageManagerIconHandle& imageHandle = !IsEnabled() ? pImage->GetDisabledIcon(): IsHighlighted() ? pImage->GetHotIcon() :
			IsSelected() ? pImage->GetCheckedIcon() : pImage->GetIcon();

		pImage->Draw(pDC, rcIcon.TopLeft(), imageHandle, rcIcon.Size());
	}
}
	void SeparateTabWidget::mousePressEvent (QMouseEvent *event)
	{
		const bool mBack = event->button () == Qt::XButton1;
		const bool mForward = event->button () == Qt::XButton2;
		if (mBack || mForward)
		{
			auto rootWM = Core::Instance ().GetRootWindowsManager ();
			auto tm = rootWM->GetTabManager (Window_);
			mBack ? tm->rotateLeft () : tm->rotateRight ();
			event->accept ();
			return;
		}

		QWidget::mousePressEvent (event);
	}
void FAssetEditorToolkit::InvokeTab(const FTabId& TabId)
{
	GetTabManager()->InvokeTab(TabId);
}