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() + ");"); } }
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() + ");"); } }
void Widget::setHidden(bool hidden, const WAnimation& animation) { WWebWidget::setHidden(hidden, animation); if (isRendered() || !canOptimizeUpdates()) addUpdateJS(elVar() + ".setVisible(" + (hidden ? "false" : "true") + ");"); }
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; }
void WAbstractToggleButton::setCheckState(CheckState state) { if (canOptimizeUpdates() && state == state_) return; state_ = state; flags_.set(BIT_STATE_CHANGED); repaint(); }
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); }
void WPushButton::setIcon(const WLink& link) { if (canOptimizeUpdates() && (link == icon_)) return; icon_ = link; flags_.set(BIT_ICON_CHANGED); repaint(RepaintSizeAffected); }
void WImage::setAlternateText(const WString& text) { if (canOptimizeUpdates() && (text == altText_)) return; altText_ = text; flags_.set(BIT_ALT_TEXT_CHANGED); repaint(RepaintPropertyAttribute); }
void WPushButton::setText(const WString& text) { if (canOptimizeUpdates() && (text == text_)) return; text_ = text; flags_.set(BIT_TEXT_CHANGED); repaint(RepaintInnerHtml); }
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; }
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; }
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); }
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; }
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)); } }