void TiUIScrollViewProxy::setContentOffset(Ti::TiValue arg) { if(!arg.isList()) return; QList<Ti::TiValue> args = arg.toList(); // Thanks for this ssaracut // https://github.com/appcelerator/titanium_mobile_blackberry/pull/217 Ti::TiValue position = args.at(0); if(!position.isMap()) return; QMap<QString, Ti::TiValue> positionMap = position.toMap(); Ti::TiValue xPos = positionMap.value(QString("x")); Ti::TiValue yPos = positionMap.value(QString("y")); float x = xPos.toNumber(); float y = yPos.toNumber(); bool isAnimated = true; if(args.size() > 1) { Ti::TiValue animated = args.at(1); if(animated.isMap()) { QMap<QString, Ti::TiValue> animatedMap = animated.toMap(); Ti::TiValue animatedValue = animatedMap.value(QString("animated")); isAnimated = animatedValue.toBool(); } } _nativeScrollView->scrollToPoint((float)x, (float)y, isAnimated ? bb::cascades::ScrollAnimation::Default : bb::cascades::ScrollAnimation::None); }
void Ti::TiViewProxy::setFocusable(Ti::TiValue value) { if(value.toBool()) getChildControl()->setFocusPolicy(bb::cascades::FocusPolicy::KeyAndTouch); else getChildControl()->setFocusPolicy(bb::cascades::FocusPolicy::None); }
void Ti::TiViewProxy::setTouchEnabled(Ti::TiValue value) { if(value.toBool()) getChildControl()->resetTouchPropagationMode(); else getChildControl()->setTouchPropagationMode(bb::cascades::TouchPropagationMode::PassThrough); }
void TiUIScrollViewProxy::setDisableBounce(Ti::TiValue val) { if(val.toBool() == true) { _nativeScrollView->scrollViewProperties()->setOverScrollEffectMode(bb::cascades::OverScrollEffectMode::None); } else { _nativeScrollView->scrollViewProperties()->setOverScrollEffectMode(bb::cascades::OverScrollEffectMode::Default); } }
void TiUIScrollViewProxy::setScrollingEnabled(Ti::TiValue val) { if(val.toBool() == true) { // TODO: Come back to this _nativeScrollView->scrollViewProperties()->setScrollMode(bb::cascades::ScrollMode::Both); } else { _nativeScrollView->scrollViewProperties()->setScrollMode(bb::cascades::ScrollMode::None); } }
void TiUIWebViewProxy::setHideLoadIndicator(Ti::TiValue val) { if(val.toBool() == true) { _tiWebView->hideLoadingIndicator(); } }
void TiUIWebViewProxy::setDisableBounce(Ti::TiValue val) { _tiWebView->setDisableBounce(val.toBool()); }
void TiUIWebViewProxy::setScalesPageToFit(Ti::TiValue val) { _tiWebView->setScalesPageToFit(val.toBool()); }
void Ti::TiViewProxy::setVisible(Ti::TiValue value) { getChildControl()->setVisible(value.toBool()); }
void Ti::TiViewProxy::setEnabled(Ti::TiValue value) { getChildControl()->setEnabled(value.toBool()); }
void Ti::TiViewProxy::setBackgroundRepeat(Ti::TiValue value) { _backgroundImageRepeat = value.toBool(); setBackground(); }
void TiUISwitchProxy::setValue(Ti::TiValue value) { _switch->setChecked(value.toBool()); }
void TiUISwitchProxy::setEnabled(Ti::TiValue val) { _switch->setEnabled(val.toBool()); }
void TiUITabGroupProxy::setShowTabsOnActionBar(Ti::TiValue value) { getTabbedPane()->setShowTabsOnActionBar(value.toBool()); }