当前位置: 首页>>代码示例>>C++>>正文


C++ WWidget类代码示例

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


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

示例1: resolveWidget

void WTemplate::resolveString(const std::string& varName,
			      const std::vector<WString>& args,
			      std::ostream& result)
{
  /*
   * FIXME: have an extra result parameter which indicates whether the
   * widget is view-only. Better to do that in resolveValue() and
   * provide a utility method that converts a widget to XHTML ?
   */

  StringMap::const_iterator i = strings_.find(varName);
  if (i != strings_.end())
    result << i->second;
  else {
    WWidget *w = resolveWidget(varName);
    if (w) {
      w->setParentWidget(this);

      if (previouslyRendered_
	  && previouslyRendered_->find(w) != previouslyRendered_->end()) {
	result << "<span id=\"" << w->id() << "\"> </span>";
      } else {
	applyArguments(w, args);
	w->htmlText(result);
      }

      if (newlyRendered_)
        newlyRendered_->push_back(w);
    } else
      handleUnresolvedVariable(varName, args, result);
  }
}
开发者ID:ScienziatoBestia,项目名称:wt,代码行数:32,代码来源:WTemplate.C

示例2: createMixed

std::string Widget::createMixed(const std::vector<WWidget *>& items,
				std::stringstream& js)
{
  std::string refs;
 
  for (unsigned i = 0; i < items.size(); ++i) {
    WWidget *c = items[i];
    Widget *w = dynamic_cast<Widget *>(c);
    FormField *ff = dynamic_cast<FormField *>(c);

    std::string var;
    if (w && !ff) {
      var = w->createExtElement(js, 0);
    } else {
      var = c->createJavaScript(js, "document.body.appendChild(");
    }

    if (i != 0)
      refs += ",";

    refs += var;
  }

  return refs;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:25,代码来源:Widget.C

示例3: currentWidget

void WStackedWidget::setCurrentIndex(int index, const WAnimation& animation,
				     bool autoReverse)
{
  if (!animation.empty() && loadAnimateJS()
      && (isRendered() || !canOptimizeUpdates())) {
    if (canOptimizeUpdates() && index == currentIndex_)
      return;

    WWidget *previous = currentWidget();

    setJavaScriptMember("wtAutoReverse", autoReverse ? "true" : "false");

    if (previous)
      previous->animateHide(animation);
    widget(index)->animateShow(animation);

    currentIndex_ = index;
  } else {
    currentIndex_ = index;

    for (int i = 0; i < count(); ++i)
      if (widget(i)->isHidden() != (currentIndex_ != i))
	widget(i)->setHidden(currentIndex_ != i);

    if (isRendered())
      doJavaScript("$('#" + id() + "').data('obj').setCurrent("
		   + widget(currentIndex_)->jsRef() + ");");
  }
}
开发者ID:zcoder,项目名称:wt,代码行数:29,代码来源:WStackedWidget.C

示例4: loadAnimateJS

void WStackedWidget::setCurrentIndex(int index, const WAnimation& animation,
				     bool autoReverse)
{
  if (!animation.empty() && 
      WApplication::instance()->environment().supportsCss3Animations() &&
      ((isRendered() && javaScriptDefined_) || !canOptimizeUpdates())) {
    if (canOptimizeUpdates() && index == currentIndex_)
      return;

    loadAnimateJS();

    WWidget *previous = currentWidget();

    doJavaScript("$('#" + id() + "').data('obj').adjustScroll("
		 + widget(currentIndex_)->jsRef() + ");");
    setJavaScriptMember("wtAutoReverse", autoReverse ? "true" : "false");

    if (previous)
      previous->animateHide(animation);
    widget(index)->animateShow(animation);

    currentIndex_ = index;
  } else {
    currentIndex_ = index;

    for (int i = 0; i < count(); ++i)
      if (widget(i)->isHidden() != (currentIndex_ != i))
	widget(i)->setHidden(currentIndex_ != i);

    if (currentIndex_ >= 0 && isRendered() && javaScriptDefined_)
      doJavaScript("$('#" + id() + "').data('obj').setCurrent("
		   + widget(currentIndex_)->jsRef() + ");");
  }
}
开发者ID:Dinesh-Ramakrishnan,项目名称:wt,代码行数:34,代码来源:WStackedWidget.C

示例5: parent

void WWidget::childResized(WWidget *child, WFlags<Orientation> directions)
{
    WWidget *p = parent();

    if (p)
        p->childResized(this, directions);
}
开发者ID:bytemaster,项目名称:wt-1,代码行数:7,代码来源:WWidget.C

示例6: webWidget

void WWidget::scheduleRerender(bool laterOnly, WFlags<RepaintFlag> flags)
{
  if (!flags_.test(BIT_NEED_RERENDER)) {
    flags_.set(BIT_NEED_RERENDER);
    WApplication::instance()->session()->renderer().needUpdate(this, laterOnly);
  }

  if ((flags & RepaintSizeAffected) &&
      !flags_.test(BIT_NEED_RERENDER_SIZE_CHANGE)) {
    flags_.set(BIT_NEED_RERENDER_SIZE_CHANGE);

    webWidget()->parentResized(this, Vertical);

    /*
     * A size change to an absolutely positioned widget will not affect
     * a layout computation, except if it's itself in a layout!
     */
    if (positionScheme() == Absolute && !isInLayout())
      return;

    /*
     * Propagate event up, this will be caught by a container widget
     * with a layout manager.
     */
    WWidget *p = parent();

    if (p)
      p->childResized(this, Vertical);
  }
}
开发者ID:DTidd,项目名称:wt,代码行数:30,代码来源:WWidget.C

示例7:

DomElement *StdWidgetItemImpl::createDomElement(bool fitWidth, bool fitHeight,
						WApplication *app)
{
  WWidget *w = item_->widget();

  w->setInline(false);

  DomElement *d = w->createSDomElement(app);
  DomElement *result = d;

  if (app->environment().agentIsIElt(9) &&
      (d->type() == DomElement_TEXTAREA || d->type() == DomElement_SELECT
       || d->type() == DomElement_INPUT || d->type() == DomElement_BUTTON)) {
    d->removeProperty(PropertyStyleDisplay);
  }

  // FIXME IE9 does border-box perhaps ?
  if (!app->environment().agentIsIE() && 
      w->javaScriptMember(WWidget::WT_RESIZE_JS).empty() &&
      d->type() != DomElement_TABLE /* buggy in Chrome, see #1856 */ &&
      app->theme()->canBorderBoxElement(*d))
    d->setProperty(PropertyStyleBoxSizing, "border-box");

  return result;
}
开发者ID:913862627,项目名称:wt,代码行数:25,代码来源:StdWidgetItemImpl.C

示例8: handleRequest

void PrintResource::handleRequest(const Wt::Http::Request& request,
                                  Wt::Http::Response& response)
{
    //log("info")<<"PrintResource::handleRequest() "<<__LINE__;
    response.addHeader("Cache-Control", "max-age=315360000");
    response.setMimeType("text/html; charset=utf-8");
    std::ostringstream htmlStream;// = std::cout;
    htmlStream << "";

    //log("info")<<m_content->find("order_form");
    if(WContainerWidget *form = dynamic_cast<WContainerWidget*>(m_content->find("order_form")))
    {
        for(int i=0;i < form->count()-1;i++)
        {
            WWidget *item = form->widget(i);
            if(item->id() == "comments")
            {
                item->decorationStyle().setBorder(WBorder());
            }else
                item->setHidden(true);
        }
    }

    response.out() <<"<link href=\"http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css\" type=\"text/css\" rel=\"stylesheet\">"<<std::endl;
    response.out() <<"<link href=\"http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css\" type=\"text/css\" rel=\"stylesheet\">"<<std::endl;
    response.out() << "<script src=\"/css/ie_console.js\"></script>";

    response.out() << ""
    "<script type=\"text/javascript\">\n"
    "        window.setTimeout(function () {\n"
    "            window.print();\n"
    "        }, 1000);\n"
    "</script>\n"<<std::endl;

    m_content->htmlText(response.out());
    //log("info")<<"PrintResource::handleRequest() "<<__LINE__;

/*
    response.out() << ""
    "<script type=\"text/javascript\">\n"
    "    (function() { \n"
    "        window.setTimeout(function () {\n"
    "            window.print();\n"
    "        }, 1500);\n"
    "    }); \n"
    "</script>\n"<<std::endl;

*/
    //m_content->htmlText(htmlStream);
    //std::string htmlStr= "";
    //htmlStr << htmlStream;
    //std::cout <<htmlStream<<std::endl;
    //renderer.render(WString().fromUTF8(htmlStream.str()));

    response.out() << WString().fromUTF8(htmlStream.str()) << std::endl;
}
开发者ID:ineron,项目名称:fit-zakaz-portal,代码行数:56,代码来源:PrintResource.cpp

示例9:

bool StdGridLayoutImpl2::hasItem(int row, int col) const
{
  WLayoutItem *item = grid_.items_[row][col].item_;

  if (item) {
    WWidget *w = item->widget();
    return !w || !w->isHidden();
  } else
    return false;
}
开发者ID:Unss,项目名称:wt,代码行数:10,代码来源:StdGridLayoutImpl2.C

示例10:

WWidget *WTemplate::takeWidget(const std::string& varName)
{
  WidgetMap::iterator i = widgets_.find(varName);

  if (i != widgets_.end()) {
    WWidget *result = i->second;
    result->setParentWidget(0);
    return result;
  } else
    return 0;
}
开发者ID:dreamsxin,项目名称:WebWidgets,代码行数:11,代码来源:WTemplate.C

示例11: containsExposed

bool WWidget::containsExposed(WWidget *w) const
{
    if (w == this)
        return true;

    for (WWidget *p = w; p; p = p->parent())
        if (p == this)
            return true;

    return false;
}
开发者ID:bytemaster,项目名称:wt-1,代码行数:11,代码来源:WWidget.C

示例12: setWidget

WWidget *WScrollArea::takeWidget()
{
  WWidget *result = widget_;
  widget_ = 0;

  setWidget(0);

  if (result)
    result->setParent(0);

  return result;
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例13: parent

void WWidget::childResized(WWidget *child, WFlags<Orientation> directions)
{
  /*
   * Stop propagation at an absolutely positioned widget
   */
  if (positionScheme() == Absolute && !isInLayout())
    return;

  WWidget *p = parent();

  if (p)
    p->childResized(this, directions);
}
开发者ID:DTidd,项目名称:wt,代码行数:13,代码来源:WWidget.C

示例14: main

int main(int argc, char *argv[])
{
	QApplication app(argc, argv);

	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
	QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
	QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));

	WWidget wwidget;
	wwidget.show();

	return app.exec();
	return 0;
}
开发者ID:EMail2HF,项目名称:wpsforlinux,代码行数:14,代码来源:main.cpp

示例15: _id

bool WTemplate::_id(const std::vector<WString>& args,
		    std::ostream& result)
{
  if (args.size() == 1) {
    WWidget *w = this->resolveWidget(args[0].toUTF8());
    if (w) {
      result << w->id();
      return true;
    } else
      return false;
  } else {
    LOG_ERROR("Functions::tr(): expects exactly one argument");
    return false;
  }
}
开发者ID:ScienziatoBestia,项目名称:wt,代码行数:15,代码来源:WTemplate.C


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