コード例 #1
0
void SwitchToWindowMenu::MenuItemTriggered(int index)
{
  if (index < 0 || index >= windows.size()) return;

  IWorkbenchWindow* window = windows[index];
  Shell::Pointer windowShell = window->GetShell();
  if (windowShell->GetMinimized())
  {
    windowShell->SetMinimized(false);
  }
  windowShell->SetActive();
  windowShell->GetControl()->raise();

}
コード例 #2
0
QList<Shell::Pointer> QtShell::GetShells()
{
  GuiWidgetsTweaklet* widgetTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
  QList<Shell::Pointer> allShells(widgetTweaklet->GetShells());
  QList<Shell::Pointer> descendants;

  for (int i = 0; i < allShells.size(); ++i)
  {
    Shell::Pointer shell = allShells[i];
    if (widgetTweaklet->GetShell(shell->GetControl()) == this)
    {
      descendants.push_back(shell);
    }
  }

  return descendants;
}
コード例 #3
0
Shell::Pointer QtWidgetsTweakletImpl::CreateShell(Shell::Pointer parent, int style)
{
#ifdef __APPLE__
  Qt::WindowFlags qtFlags(0);
#else
  Qt::WindowFlags qtFlags(Qt::CustomizeWindowHint);
#endif

  if (style & Constants::MAX)
    qtFlags |= Qt::WindowMaximizeButtonHint;
  if (style & Constants::MIN)
    qtFlags |= Qt::WindowMinimizeButtonHint;
  if (style & Constants::CLOSE)
  {
    qtFlags |= Qt::WindowSystemMenuHint;
#if QT_VERSION >= 0x040500
    qtFlags |= Qt::WindowCloseButtonHint;
#endif
  }
  if (!(style & Constants::BORDER))
    qtFlags |= Qt::FramelessWindowHint;
  if (style & Constants::TITLE)
    qtFlags |= Qt::WindowTitleHint;
  if (style & Constants::TOOL)
    qtFlags |= Qt::Tool;

  QWidget* parentWidget = nullptr;
  if (parent != 0)
    parentWidget = static_cast<QWidget*>(parent->GetControl());

  auto   qtshell = new QtShell(parentWidget, qtFlags);
  Shell::Pointer shell(qtshell);
  shellList.push_back(shell);

  if ((style & Constants::APPLICATION_MODAL)
      || (style & Constants::SYSTEM_MODAL)) qtshell->GetWidget()->setWindowModality(Qt::ApplicationModal);
  if (style & Constants::PRIMARY_MODAL) qtshell->GetWidget()->setWindowModality(Qt::WindowModal);

  return shell;
}