Esempio n. 1
0
void SimpleScrollableAreaSkin::setFixedBox(float width, float height)
{
    auto box = std::make_shared<FixedBox>(width, height);
    if (m_box->isValid())
        box->checkInited();
    m_box = box;
}
Esempio n. 2
0
void AnimatedButtonSkin::setFixedBox(float width, float height)
{
    auto box = std::make_shared<FixedBox>(width, height);
    if (m_box->isValid())
        box->checkInited();
    m_box = box;
}
Esempio n. 3
0
void CanvasLayout::setFixedBox(float width, float height)
{
    auto box = std::make_shared<FixedBox>(width, height);
    if (m_box->isValid())
        box->checkInited();
    m_box = box;
    update();
}
std::string TRChartsJNI::DateFormatterInterfaceMarshaller::Proxy::formatDate(double seconds, Charts::DateUnit unit) const
{
	JNIEnv * const env = Utils::getThreadEnv();
	assert(env);
	checkInited(env);
	jvalue args[] = {
		TRChartsJNI::getNumberMarshaller().unmarshallToValue(env, seconds),
		TRChartsJNI::getDateUnitMarshaller().unmarshallToValue(env, unit)
	};
	const jobject hostObject = getHostObject(env);
	const std::string result = TRChartsJNI::getStringMarshaller().callMethod(env, hostObject, midFormatDate, args);
	env->DeleteLocalRef(hostObject);
	return result;
}
std::shared_ptr<Charts::DateFormatter> TRChartsJNI::DateFormatterInterfaceMarshaller::marshall(JNIEnv * const env, const jobject & in) const
{
	checkInited(env);
	if(in) {
		if(Utils::isBaseObjectInstance(env, in)) {
			Handle * const handle = reinterpret_cast<Handle *>(Utils::getBaseObjectHandle(env, in));
			return handle->getNativeObject<Charts::DateFormatter>(env);
		} else {
			Proxy * const impl = new Proxy(env, *this, in);
			const jobject strongRef = env->NewGlobalRef(in);
			return std::shared_ptr<Charts::DateFormatter>(impl, [=](Charts::DateFormatter * const ptr) -> void {
				delete ptr;
				env->DeleteGlobalRef(strongRef);
			});
		}
	}
	return std::shared_ptr<Charts::DateFormatter>();
}
jobject TRChartsJNI::DateFormatterInterfaceMarshaller::unmarshall(JNIEnv * const env, const std::shared_ptr<Charts::DateFormatter> & in) const
{
	checkInited(env);
	if(in) {
		CodegenSupport::BaseObject * const baseObject = dynamic_cast<CodegenSupport::BaseObject *>(in.get());
		if(baseObject) {
			Handle * const handle = reinterpret_cast<Handle *>(baseObject->getHandle());
			return handle->getHostObject(env);
		} else {
			Proxy * proxy = dynamic_cast<Proxy *>(in.get());
			if(proxy) {
				return proxy->getHostObject(env);
			} else {
				throw new std::logic_error("Cannot unmarshall");
			}
		}
	}
	return nullptr;
}