示例#1
0
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() + ");");
  }
}
示例#2
0
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() + ");");
  }
}
示例#3
0
文件: Widget.C 项目: ReWeb3D/wt
void Widget::setHidden(bool hidden, const WAnimation& animation)
{
  WWebWidget::setHidden(hidden, animation);

  if (isRendered() || !canOptimizeUpdates())
    addUpdateJS(elVar() + ".setVisible(" + (hidden ? "false" : "true") + ");");
}
示例#4
0
文件: WText.C 项目: LifeGo/wt
bool WText::setText(const WString& text)
{
  bool unChanged = canOptimizeUpdates() && (text == text_.text);

  // Even if the current text is the same, it may be a tr() one which
  // may get other content in a different locale
  bool ok = text_.setText(text);

  if (canOptimizeUpdates() && unChanged)
    return true;

  flags_.set(BIT_TEXT_CHANGED);
  repaint(RepaintSizeAffected);

  return ok;
}
示例#5
0
void WAbstractToggleButton::setCheckState(CheckState state)
{
  if (canOptimizeUpdates() && state == state_)
    return;

  state_ = state;
  flags_.set(BIT_STATE_CHANGED);
  repaint();
}
示例#6
0
void WAbstractToggleButton::setText(const WString& text)
{
  if (canOptimizeUpdates() && (text == text_.text))
    return;

  text_.setText(text);
  flags_.set(BIT_TEXT_CHANGED);
  repaint(RepaintSizeAffected);
}
void WAbstractToggleButton::setCheckState(CheckState state)
{
  if (canOptimizeUpdates() && state == state_)
    return;

  state_ = state;
  stateChanged_ = true;
  repaint(RepaintPropertyIEMobile);
}
void WAbstractToggleButton::setText(const WString& text)
{
  if (canOptimizeUpdates() && (text == text_.text))
    return;

  text_.setText(text);
  textChanged_ = true;
  repaint(RepaintInnerHtml);
}
示例#9
0
文件: WPushButton.C 项目: bend/wt
void WPushButton::setIcon(const WLink& link)
{
  if (canOptimizeUpdates() && (link == icon_))
    return;

  icon_ = link;
  flags_.set(BIT_ICON_CHANGED);

  repaint(RepaintSizeAffected);
}
示例#10
0
文件: WImage.C 项目: NeilNienaber/wt
void WImage::setAlternateText(const WString& text)
{
  if (canOptimizeUpdates() && (text == altText_))
    return;

  altText_ = text;
  flags_.set(BIT_ALT_TEXT_CHANGED);

  repaint(RepaintPropertyAttribute);
}
示例#11
0
文件: WPushButton.C 项目: Spencerx/wt
void WPushButton::setText(const WString& text)
{
  if (canOptimizeUpdates() && (text == text_))
    return;

  text_ = text;
  flags_.set(BIT_TEXT_CHANGED);

  repaint(RepaintInnerHtml);
}
示例#12
0
文件: WPushButton.C 项目: bend/wt
bool WPushButton::setText(const WString& text)
{
  if (canOptimizeUpdates() && (text == text_.text))
    return true;

  bool ok = text_.setText(text);

  flags_.set(BIT_TEXT_CHANGED);
  repaint(RepaintSizeAffected);

  return ok;
}
示例#13
0
bool WText::setText(const WString& text)
{
  if (canOptimizeUpdates() && (text == text_.text))
    return true;

  bool ok = text_.setText(text);

  flags_.set(BIT_TEXT_CHANGED);
  repaint(RepaintInnerHtml);

  return ok;
}
示例#14
0
文件: WImage.C 项目: NeilNienaber/wt
void WImage::setImageLink(const WLink& link)
{
  if (link.type() != WLink::Resource && canOptimizeUpdates()
      && (link == imageLink_))
    return;

  imageLink_ = link;

  if (link.type() == WLink::Resource)
    link.resource()->dataChanged().connect(this, &WImage::resourceChanged);

  flags_.set(BIT_IMAGE_LINK_CHANGED);

  repaint(RepaintPropertyIEMobile);
}
示例#15
0
文件: WText.C 项目: ReWeb3D/wt
bool WText::setText(const WString& text)
{
  if (canOptimizeUpdates() && (text == text_))
    return true;

  text_ = text;

  bool textok = checkWellFormed();
  if (!textok)
    textFormat_ = PlainText;

  flags_.set(BIT_TEXT_CHANGED);
  repaint(RepaintInnerHtml);

  return textok;
}
示例#16
0
void WNavigationBar::expandContents()
{
  WContainerWidget *contents = resolve<WContainerWidget *>("contents");
  WInteractWidget *collapseButton
    = resolve<WInteractWidget *>("collapse-button");
  WInteractWidget *expandButton
    = resolve<WInteractWidget *>("expand-button");

  collapseButton->show();
  expandButton->hide();

  if (!animatedResponsive())
    contents->show();
  else {
    if (canOptimizeUpdates())
      contents->show();
    else
      contents->animateShow(WAnimation(WAnimation::SlideInFromTop,
				       WAnimation::Ease));
  }
}