• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WApplication类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WApplication的典型用法代码示例。如果您正苦于以下问题:C++ WApplication类的具体用法?C++ WApplication怎么用?C++ WApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: defineJS

void WPopupWidget::defineJS()
{
    WApplication *app = WApplication::instance();

    LOAD_JAVASCRIPT(app, "js/WPopupWidget.js", "WPopupWidget", wtjs1);

    WStringStream jsObj;

    jsObj << "new " WT_CLASS ".WPopupWidget("
          << app->javaScriptClass() << ',' << jsRef() << ','
          << transient_ << ',' << autoHideDelay_ << ','
          << !isHidden() << ");";

    setJavaScriptMember(" WPopupWidget", jsObj.str());
}
开发者ID:hhirsch,项目名称:wtim,代码行数:15,代码来源:WPopupWidget.C


示例2: defineJavaScript

void WAbstractSpinBox::defineJavaScript()
{
  WApplication *app = WApplication::instance();

  LOAD_JAVASCRIPT(app, "js/WSpinBox.js", "WSpinBox", wtjs1);

  std::string jsObj = "new " WT_CLASS ".WSpinBox("
    + app->javaScriptClass() + "," + jsRef() + ","
    + boost::lexical_cast<std::string>(decimals()) + ","
    + prefix().jsStringLiteral() + ","
    + suffix().jsStringLiteral() + ","
    + jsMinMaxStep() + ");";

  setJavaScriptMember("_a", "0;" + jsObj);
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:15,代码来源:WAbstractSpinBox.C


示例3: defineJavaScript

void WSuggestionPopup::defineJavaScript()
{
  WApplication *app = WApplication::instance();

  const char *THIS_JS = "js/WSuggestionPopup.js";
  LOAD_JAVASCRIPT(app, THIS_JS, "WSuggestionPopup", wtjs1);
  LOAD_JAVASCRIPT(app, THIS_JS, "WSuggestionPopupStdMatcher", wtjs2);

  setJavaScriptMember(" WSuggestionPopup",
		      "new " WT_CLASS ".WSuggestionPopup("
		      + app->javaScriptClass() + "," + jsRef() + ","
		      + replacerJS_ + "," + matcherJS_ + ","
		      + boost::lexical_cast<std::string>(filterLength_) + ","
		      + boost::lexical_cast<std::string>(defaultValue_) + ");");
}
开发者ID:ScienziatoBestia,项目名称:wt,代码行数:15,代码来源:WSuggestionPopup.C


示例4: return

/**
* @brief Get's the cookie from the app
*
* @return The cookie that the client's browser is giving us
*/
const string& BaseSessionHandle::getCookie() const {
    // First ask the browser
    WApplication* app = WApplication::instance();
    const WEnvironment::CookieMap& cookies = app->environment().cookies();
    WEnvironment::CookieMap::const_iterator i = cookies.find(_cookieName);
    if (i != cookies.end()) {
        return (*i).second;
    }
    // Fall back to cached version
    // If the browser doesn't have a cookie, we might have just set it and no requests have happened yet
    // Even if this server side cache is old (and the user has logged out, and the client side cookie deleted)
    // It shouldn't matter because the session store still won't return a user ID for it.
    // But still if there is a browser side cookie, that takes precedence
    return cookieCache;
}
开发者ID:lyase,项目名称:cblog,代码行数:20,代码来源:BaseSessionHandle.cpp


示例5: selectVisual

void WMenu::undoSelectVisual()
{
  std::string prevPath = previousInternalPath_;
  int prevStackIndex = previousStackIndex_;

  selectVisual(current_, true, true);

  if (internalPathEnabled_) {
    WApplication *app = wApp;
    app->setInternalPath(prevPath);
  }

  if (contentsStack_)
    contentsStack_->setCurrentIndex(prevStackIndex);
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:15,代码来源:WMenu.C


示例6: anchor

void WMenuItem::setIcon(const std::string& path)
{
  if (!icon_) {
    WAnchor *a = anchor();
    if (!a)
      return;

    icon_ = new WText(" ");
    a->insertWidget(0, icon_);

    WApplication *app = WApplication::instance();
    app->theme()->apply(this, icon_, MenuItemIconRole);
  }

  icon_->decorationStyle().setBackgroundImage(WLink(path));
}
开发者ID:chr-thien,项目名称:wt,代码行数:16,代码来源:WMenuItem.C


示例7: WText

void WMenuItem::setCloseable(bool closeable)
{
  if (closeable_ != closeable) {
    closeable_ = closeable;

    if (closeable_) {
      WText *closeIcon = new WText("");
      insertWidget(0, std::unique_ptr<WText>(closeIcon));
      WApplication *app = WApplication::instance();
      app->theme()->apply(this, closeIcon, WidgetThemeRole::MenuItemClose);

      closeIcon->clicked().connect(this, &WMenuItem::close);
    } else
      removeWidget(widget(0));
  }
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:16,代码来源:WMenuItem.C


示例8: logout

void AuthModel::logout(Login& login)
{
  if (login.loggedIn()) {
    if (baseAuth()->authTokensEnabled()) {
      WApplication *app = WApplication::instance();
      app->removeCookie(baseAuth()->authTokenCookieName());

      /*
       * FIXME: it would be nice if we also delete the relevant token
       * from the database!
       */
    }

    login.logout();
  }
}
开发者ID:kdeforche,项目名称:wt,代码行数:16,代码来源:AuthModel.C


示例9: addFunction

void AuthWidget::init()
{
    registrationModel_ = 0;
    registrationEnabled_ = false;
    created_ = false;
    dialog_ = 0;
    messageBox_ = 0;

    addFunction("id", WT_TEMPLATE_FUNCTION(id));
    addFunction("tr", WT_TEMPLATE_FUNCTION(tr));

    WApplication *app = WApplication::instance();
    app->useStyleSheet(WApplication::resourcesUrl() + "form.css");
    app->internalPathChanged().connect(this, &AuthWidget::onPathChange);
    app->builtinLocalizedStrings().useBuiltin(skeletons::Auth_xml1);
}
开发者ID:nkabir,项目名称:wt,代码行数:16,代码来源:AuthWidget.C


示例10: sendConfirmMail

void WsNewsLetter::sendConfirmMail(const std::string& email,
                                       const std::string& userToken) const
{
  std::string url = "/newsletter/subscribe/";
  WApplication *app = WApplication::instance();
  url = app->makeAbsoluteUrl(app->bookmarkUrl(url)) + userToken;

  Mail::Message message;

  message.addRecipient(Mail::To, Mail::Mailbox(email));
  message.setSubject(WString::tr("subject"));
  message.setBody(WString::tr("body").arg(email).arg(url));
  message.addHtmlBody(WString::tr("htmlbody").arg(email).arg(url));

  sendMail(message);
}
开发者ID:Wittyshare,项目名称:wittyshare,代码行数:16,代码来源:WsNewsLetterEm.C


示例11: init

void WTextEdit::init()
{
  WApplication *app = WApplication::instance();

  setInline(false);

  initTinyMCE();

  version_ = getTinyMCEVersion();

  setJavaScriptMember(" WTextEdit", "new " WT_CLASS ".WTextEdit("
		      + app->javaScriptClass() + "," + jsRef() + ");");

  setJavaScriptMember
    (WT_RESIZE_JS,
     "function(e, w, h) { var obj = $('#" + id() + "').data('obj'); "
     "obj.wtResize(e, w, h); };");

  std::string direction = app->layoutDirection() == LeftToRight ? "ltr" : "rtl";
  setConfigurationSetting("directionality", direction);

  std::string toolbar;
  if (version_ < 4)
    toolbar = "fontselect,|,bold,italic,underline,|,fontsizeselect,|"
      ",forecolor,backcolor,|"
      ",justifyleft,justifycenter,justifyright,justifyfull,|,anchor,|"
      ",numlist,bullist";
  else
    toolbar = "undo redo | styleselect | bold italic | link";

  setToolBar(0, toolbar);
  for (int i = 1; i <= 3; i++)
    setToolBar(i, std::string());

  setConfigurationSetting("doctype", wApp->docType());
  setConfigurationSetting("relative_urls", true);

  if (version_ < 4) {
    //this setting is no longer mentioned in the tinymce documenation though...
    setConfigurationSetting("button_tile_map", true);
    setConfigurationSetting("theme", std::string("advanced"));
    setConfigurationSetting("theme_advanced_toolbar_location", 
			    std::string("top"));
    setConfigurationSetting("theme_advanced_toolbar_align",
			    std::string("left"));
  }
}
开发者ID:ChowZenki,项目名称:wt,代码行数:47,代码来源:WTextEdit.C


示例12: gameStarted

void menuWidget::gameStarted()
{
    WApplication * app = WApplication::instance();
    gameEnded = false;
    if(ifCreator)
    {
        information->setText("It's your turn");
    }
    endGame->disable();
    giveUp->enable();
    map<Coordinates,WPushButton*>::iterator it;
    for(it = gameButtons.begin(); it != gameButtons.end(); it++)
    {
        it->second->enable();
    }
    app->triggerUpdate();
}
开发者ID:micp,项目名称:ZPR,代码行数:17,代码来源:menuWidget.cpp


示例13: handleRegistrationPath

bool AuthWidget::handleRegistrationPath(const std::string& path)
{
  if (!basePath_.empty()) {
    WApplication *app = WApplication::instance();

    if (app->internalPathMatches(basePath_)) {
      std::string ap = app->internalSubPath(basePath_);

      if (ap == "register") {
	registerNewUser();
	return true;
      }
    }
  }

  return false;
}
开发者ID:913862627,项目名称:wt,代码行数:17,代码来源:AuthWidget.C


示例14: WText

void WMenuItem::setCloseable(bool closeable)
{
  if (closeable_ != closeable) {
    closeable_ = closeable;

    if (closeable_) {
      WText *closeIcon = new WText("");
      insertWidget(0, closeIcon);
      WApplication *app = WApplication::instance();
      app->theme()->apply(this, closeIcon, MenuItemCloseRole);

      closeIcon->clicked().connect(this, &WMenuItem::close);
    } else {
      delete widget(0);
    }
  }
}
开发者ID:chr-thien,项目名称:wt,代码行数:17,代码来源:WMenuItem.C


示例15: WCheckBox

void WMenuItem::setCheckable(bool checkable)
{
  if (isCheckable() != checkable) {
    if (checkable) {
      checkBox_ = new WCheckBox();
      anchor()->insertWidget(0, checkBox_);
      setText(text());

      text_->setBuddy(checkBox_);

      WApplication *app = WApplication::instance();
      app->theme()->apply(this, checkBox_, MenuItemCheckBoxRole);
    } else {
      delete checkBox_;
    }
  }
}
开发者ID:chr-thien,项目名称:wt,代码行数:17,代码来源:WMenuItem.C


示例16: setInternalPathEnabled

void WMenu::setInternalPathEnabled(const std::string& basePath)
{
  WApplication *app = WApplication::instance();

  basePath_ = basePath.empty() ? app->internalPath() : basePath;
  basePath_ = Utils::append(Utils::prepend(basePath_, '/'), '/');

  if (!internalPathEnabled_) {
    internalPathEnabled_ = true;
    app->internalPathChanged().connect(this, &WMenu::handleInternalPathChange);
  }

  previousInternalPath_ = app->internalPath();
  internalPathChanged(app->internalPath());

  updateItemsInternalPath();
}
开发者ID:LifeGo,项目名称:wt,代码行数:17,代码来源:WMenu.C


示例17: WCompositeWidget

WMediaPlayer::WMediaPlayer(MediaType mediaType, WContainerWidget *parent)
  : WCompositeWidget(parent),
    mediaType_(mediaType),
    videoWidth_(0),
    videoHeight_(0),
    gui_(this),
    boundSignals_(0)
{
  for (unsigned i = 0; i < 11; ++i)
    control_[i] = 0;

  for (unsigned i = 0; i < 3; ++i)
    display_[i] = 0;

  for (unsigned i = 0; i < 2; ++i)
    progressBar_[i] = 0;

  WTemplate *impl = new WMediaPlayerImpl(this, tr("Wt.WMediaPlayer.template"));
  impl->bindString("gui", std::string());

  setImplementation(impl);

  WApplication *app = WApplication::instance();

  LOAD_JAVASCRIPT(app, "js/WMediaPlayer.js", "WMediaPlayer", wtjs1);

  std::string res = WApplication::relativeResourcesUrl() + "jPlayer/";

  if (!app->environment().ajax())
    app->require(res + "jquery.min.js");

  if (app->require(res + "jquery.jplayer.min.js"))
    app->useStyleSheet(res + "skin/jplayer.blue.monday.css");

  if (mediaType_ == Video)
    setVideoSize(480, 270);

#ifndef WT_TARGET_JAVA
  implementJavaScript(&WMediaPlayer::play,
		      jsPlayerRef() + ".jPlayer('play');");
  implementJavaScript(&WMediaPlayer::pause,
		      jsPlayerRef() + ".jPlayer('pause');");
  implementJavaScript(&WMediaPlayer::stop,
		      jsPlayerRef() + ".jPlayer('stop');");
#endif
}
开发者ID:913862627,项目名称:wt,代码行数:46,代码来源:WMediaPlayer.C


示例18: container

StdGridLayoutImpl2::~StdGridLayoutImpl2()
{ 
  WApplication *app = WApplication::instance();

  /*
   * If it is a top-level layout (as opposed to a nested layout),
   * configure overflow of the container.
   */
  if (parentLayoutImpl() == 0) {
    if (container() == app->root()) {
      app->setBodyClass("");
      app->setHtmlClass("");
    }

    if (app->environment().agentIsIElt(9) && container())
      container()->setOverflow(WContainerWidget::OverflowVisible);
  }
}
开发者ID:Unss,项目名称:wt,代码行数:18,代码来源:StdGridLayoutImpl2.C


示例19: cb

void WMenuItem::setCheckable(bool checkable)
{
  if (isCheckable() != checkable) {
    if (checkable) {
      std::unique_ptr<WCheckBox> cb(checkBox_ = new WCheckBox());
      anchor()->insertWidget(0, std::move(cb));
      setText(text());

      text_->setBuddy(checkBox_);

      WApplication *app = WApplication::instance();
      app->theme()->apply(this, checkBox_, WidgetThemeRole::MenuItemCheckBox);
    } else {
      removeWidget(checkBox_);
      checkBox_ = nullptr;
    }
  }
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:18,代码来源:WMenuItem.C


示例20: escapeText

std::string WText::formattedText() const
{
  if (text_.format == PlainText)
    return escapeText(text_.text, true).toUTF8();
  else {
    WApplication *app = WApplication::instance();
    if (flags_.test(BIT_ENCODE_INTERNAL_PATHS)
	|| app->session()->hasSessionIdInUrl()) {
      WFlags<RefEncoderOption> options;
      if (flags_.test(BIT_ENCODE_INTERNAL_PATHS))
	options |= EncodeInternalPaths;
      if (app->session()->hasSessionIdInUrl())
	options |= EncodeRedirectTrampoline;
      return EncodeRefs(text_.text, options).toUTF8();
    } else
      return text_.text.toUTF8();
  }
}
开发者ID:LifeGo,项目名称:wt,代码行数:18,代码来源:WText.C



注:本文中的WApplication类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WBEvent类代码示例发布时间:2022-05-31
下一篇:
C++ WAnchor类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap