Ejemplo n.º 1
0
void ShellPool::ShellClosed(ShellEvent::Pointer e)
{

  if (e->doit)
  {
    Shell::Pointer s = e->GetSource();
    IShellListener::Pointer l =
        s->GetData(CLOSE_LISTENER).Cast<IShellListener> ();

    if (l != 0)
    {
      s->SetData(Object::Pointer(0), CLOSE_LISTENER);
      l->ShellClosed(e);

      // The shell can 'cancel' the close by setting
      // the 'doit' to false...if so, do nothing
      if (e->doit)
      {
        availableShells.push_back(s);
        s->SetVisible(false);
      }
      else
      {
        // Restore the listener
        s->SetData(l, CLOSE_LISTENER);
      }
    }
  }
  e->doit = false;
}
Ejemplo n.º 2
0
Shell::Pointer ShellPool::AllocateShell(IShellListener::Pointer 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(IShellListener::Pointer(this));
    //result.addDisposeListener(disposeListener);
  }

  result->SetData(closeListener, CLOSE_LISTENER);
  return result;
}
Ejemplo n.º 3
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;
}