Example #1
0
void WPopupMenu::popupImpl()
{
  renderOutAll();

  result_ = 0;

  WApplication *app = WApplication::instance();

  // XXX
  // We rely here on the fact that no other widget is listening for
  // escape on the root()
  if (app->globalEscapePressed().isConnected())
    app->globalEscapePressed().emit();

  globalClickConnection_
    = app->root()->clicked().connect(this, &WPopupMenu::done);
  globalEscapeConnection_
    = app->globalEscapePressed().connect(this, &WPopupMenu::done);

  app->pushExposedConstraint(this);

  prepareRender(app);

  show();
}
Example #2
0
void WPopupMenu::done(WPopupMenuItem *result)
{
  location_ = 0;
  result_ = result;

  hide();

  WApplication *app = WApplication::instance();

  app->root()->clicked().disconnect(globalClickConnection_);
  app->globalEscapePressed().disconnect(globalEscapeConnection_);
  app->popExposedConstraint(this);

  recursiveEventLoop_ = false;

  triggered_.emit(result_);

  aboutToHide_.emit();
}