Ejemplo n.º 1
0
Shell::Pointer ShellPool::AllocateShell(IShellListener* closeListener)
{
  Shell::Pointer result;
  if (!availableShells.empty())
  {
    result = availableShells.front();
    availableShells.pop_front();
  }
  else
  {
    result = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->CreateShell(parentShell.Lock(),
        flags);
    result->AddShellListener(this);
    //result.addDisposeListener(disposeListener);
  }

  result->SetExtraShellListener(closeListener);
  return result;
}
Ejemplo n.º 2
0
Shell::Pointer Window::CreateShell()
{

  Shell::Pointer newParent = this->GetParentShell();
//  if (newParent != 0 && newParent.isDisposed())
//  {
//    parentShell = new SameShellProvider(null);
//    newParent = getParentShell();//Find a better parent
//  }

  //Create the shell
  Shell::Pointer newShell = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->CreateShell(newParent, this->GetShellStyle());

  //    resizeListener = new Listener() {
  //      public void handleEvent(Event e) {
  //        resizeHasOccurred = true;
  //      }
  //    };

  //newShell.addListener(SWT.Resize, resizeListener);
  newShell->SetData(Object::Pointer(this));

  //Add a listener
  newShell->AddShellListener(this->GetShellListener());

  //Set the layout
  this->ConfigureShell(newShell);

//  //Register for font changes
//  if (fontChangeListener == null)
//  {
//    fontChangeListener = new FontChangeListener();
//  }
//  JFaceResources.getFontRegistry().addListener(fontChangeListener);

  return newShell;
}