コード例 #1
0
		TITANIUM_FUNCTION(TableView, insertSectionAfter)
		{
			TITANIUM_LOG_WARN("TableView.insertSectionAfter is not implemented yet");
			if (arguments.size() < 3) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 3) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const auto _1 = arguments.at(1);
				TITANIUM_ASSERT(_1.IsObject());
				const auto _2 = arguments.at(2);
				//TITANIUM_ASSERT(_2.IsTableViewAnimationProperties());
				const double index = static_cast<double>(_0);
				const auto section = static_cast<JSObject>(_1);
				const auto animation = static_cast<JSObject>(_2);
				// insertSectionAfter(index, section, animation);
			} else if (arguments.size() >= 2) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const auto _1 = arguments.at(1);
				TITANIUM_ASSERT(_1.IsObject());
				const double index = static_cast<double>(_0);
				const auto section = static_cast<JSObject>(_1);
				// insertSectionAfter(index, section);
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const double index = static_cast<double>(_0);
				// insertSectionAfter(index);
			}
			return get_context().CreateUndefined();
		}
コード例 #2
0
	JSValue GlobalObject::requireModule(const JSObject& parent, const std::string& moduleId)
	{
		TITANIUM_GLOBALOBJECT_LOCK_GUARD;

		const auto js_context = parent.get_context();

		// check if we have special module such as ti.map
		if (requiredBuiltinModuleExists(js_context, moduleId)) {
			return requireBuiltinModule(js_context, moduleId);
		}

		// check if we have native module
		if (requiredNativeModuleExists(js_context, moduleId)) {
			return requireNativeModule(js_context, moduleId);
		}

		auto module_path = requestResolveModule(parent, moduleId);
		if (module_path.empty()) {
			// Fall back to assuming equivalent of "/" + moduleId?
			module_path = requestResolveModule(parent, "/" + moduleId);
			if (module_path.empty()) {
				detail::ThrowRuntimeError("require", "Could not load module " + moduleId);
			}
		}

		// check if we have already loaded the module
		if (module_cache__.find(module_path) != module_cache__.end()) {
			return module_cache__.at(module_path);
		}

		const auto module_js = readRequiredModule(parent, module_path);

		if (module_js.empty()) {
			detail::ThrowRuntimeError("require", "Could not load module " + moduleId);
		}

		try {
			JSValue result = js_context.CreateUndefined();
			if (boost::ends_with(module_path, ".json")){
				result = js_context.CreateValueFromJSON(module_js);
			} else if (js_context.JSCheckScriptSyntax(module_js, moduleId)) {
				const std::vector<JSValue> args = { js_context.CreateString(moduleId), js_context.CreateString(module_js) };
				result = require_function__(args, js_context.get_global_object());
			} else {
				detail::ThrowRuntimeError("require", "Could not load module "+moduleId);
			}
			if (!result.IsObject()) {
				TITANIUM_LOG_WARN("GlobalObject::require: module '", moduleId, "' replaced 'exports' with a non-object: ", to_string(result));
			}
			// cache it so that we can reuse it
			module_cache__.insert({module_path, result});
			return result;
		} catch (const std::exception& exception) {
			detail::ThrowRuntimeError("require", "Error while require("+moduleId+") "+static_cast<std::string>(exception.what()));
		} catch (...) {
			detail::ThrowRuntimeError("require", "Unknown error while require("+moduleId+")");
		}
		return js_context.CreateUndefined();
	}
コード例 #3
0
		TITANIUM_FUNCTION(TableView, setFilterAttribute)
		{
			TITANIUM_LOG_WARN("TableView.setFilterAttribute is not implemented yet");
			if (arguments.empty()) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsString());
				const std::string filterAttribute = static_cast<std::string>(_0);
				// setFilterAttribute(filterAttribute);
			}
			return get_context().CreateUndefined();
		}
コード例 #4
0
		TITANIUM_FUNCTION(TableView, setHeaderView)
		{
			TITANIUM_LOG_WARN("TableView.setHeaderView is not implemented yet");
			if (arguments.empty()) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				//TITANIUM_ASSERT(_0.IsTitanium.UI.View());
				const auto headerView = static_cast<JSObject>(_0);
				// setHeaderView(headerView);
			}
			return get_context().CreateUndefined();
		}
コード例 #5
0
		TITANIUM_FUNCTION(TableView, setRowHeight)
		{
			TITANIUM_LOG_WARN("TableView.setRowHeight is not implemented yet");
			if (arguments.empty()) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const double rowHeight = static_cast<double>(_0);
				// setRowHeight(rowHeight);
			}
			return get_context().CreateUndefined();
		}
コード例 #6
0
		TITANIUM_FUNCTION(TableView, setSections)
		{
			TITANIUM_LOG_WARN("TableView.setSections is not implemented yet");
			if (arguments.empty()) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsObject());
				const auto sections = static_cast<JSObject>(_0);
				// setSections(sections);
			}
			return get_context().CreateUndefined();
		}
コード例 #7
0
		TITANIUM_FUNCTION(TableView, setSeparatorColor)
		{
			TITANIUM_LOG_WARN("TableView.setSeparatorColor is not implemented yet");
			if (arguments.empty()) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsString());
				const std::string separatorColor = static_cast<std::string>(_0);
				// setSeparatorColor(separatorColor);
			}
			return get_context().CreateUndefined();
		}
コード例 #8
0
		TITANIUM_FUNCTION(TableView, setFilterCaseInsensitive)
		{
			TITANIUM_LOG_WARN("TableView.setFilterCaseInsensitive is not implemented yet");
			if (arguments.empty()) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsBoolean());
				const bool filterCaseInsensitive = static_cast<bool>(_0);
				// setFilterCaseInsensitive(filterCaseInsensitive);
			}
			return get_context().CreateUndefined();
		}
TITANIUM_PROPERTY_SETTER(Button, image)
{
    if (argument.IsString()) {
        set_image(static_cast<std::string>(argument));
        imageAsBlob__ = nullptr;
    } else if (argument.IsObject()) {
        const auto object = static_cast<JSObject>(argument);
        set_imageAsBlob(object.GetPrivate<Titanium::Blob>());
        image__ = "";
    } else {
        TITANIUM_LOG_WARN("Button.image should be either string or Blob");
    }
    return true;
}
コード例 #10
0
		//
		// _executeListener is internal function for Ti.App event callback.
		//
		TITANIUM_FUNCTION(WebView, _executeListener)
		{
			ENSURE_ARGUMENT_INDEX(1);
			ENSURE_OBJECT_AT_INDEX(callee, 1);
			auto webview = callee.GetProperty("webview");
			if (!webview.IsObject()) {
				TITANIUM_LOG_WARN("WebView._executeListener: Can't find this object");
				return get_context().CreateUndefined();
			}
			auto webview_ptr = static_cast<JSObject>(webview).GetPrivate<Titanium::UI::WebView>();
			TITANIUM_ASSERT(webview_ptr);

			ENSURE_OBJECT_AT_INDEX(data, 0);
			webview_ptr->_executeListener(
				static_cast<std::string>(data.GetProperty("type")),
				static_cast<std::string>(static_cast<JSValue>(data).ToJSONString()));

			return get_context().CreateUndefined();
		}
コード例 #11
0
		TITANIUM_FUNCTION(TableView, scrollToTop)
		{
			TITANIUM_LOG_WARN("TableView.scrollToTop is not implemented yet");
			if (arguments.size() < 2) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 2) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const auto _1 = arguments.at(1);
				//TITANIUM_ASSERT(_1.IsTableViewAnimationProperties());
				const double top = static_cast<double>(_0);
				const auto animation = static_cast<JSObject>(_1);
				// scrollToTop(top, animation);
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const double top = static_cast<double>(_0);
				// scrollToTop(top);
			}
			return get_context().CreateUndefined();
		}
コード例 #12
0
		TITANIUM_FUNCTION(TableView, deleteRow)
		{
			TITANIUM_LOG_WARN("TableView.deleteRow is not implemented yet");
			if (arguments.size() < 2) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 2) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsObject());
				const auto _1 = arguments.at(1);
				//TITANIUM_ASSERT(_1.IsTableViewAnimationProperties());
				const auto row = static_cast<JSObject>(_0);
				const auto animation = static_cast<JSObject>(_1);
				// deleteRow(row, animation);
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsObject());
				const auto row = static_cast<JSObject>(_0);
				// deleteRow(row);
			}
			return get_context().CreateUndefined();
		}
コード例 #13
0
		void Picker::createColumns(const std::vector<std::shared_ptr<Titanium::UI::PickerColumn>>& columns)
		{
			if (type__ == Titanium::UI::PICKER_TYPE::PLAIN) {
				for (const auto c : columns) {
					const auto column = std::dynamic_pointer_cast<TitaniumWindows::UI::PickerColumn>(c);
					const auto picker = column->getComponent();

					column->refreshRows();

					plainPicker__->Children->Append(picker);

					const auto cdef = ref new ColumnDefinition();
					cdef->Width = GridLengthHelper::FromValueAndType(1.0, GridUnitType::Star); // <RowDefinition Height="*"/>
					plainPicker__->ColumnDefinitions->Append(cdef);
					plainPicker__->SetColumn(picker, (plainPicker__->Children->Size - 1));
					plainPicker__->SetRow(picker, 0);
				}
			} else {
				TITANIUM_LOG_WARN("Picker::add: Unable to modify columns. This only works with plain picker");
			}
		}
コード例 #14
0
	TITANIUM_FUNCTION(TiModule, createBuffer)
	{
		TITANIUM_LOG_WARN("TiModule::js_createBuffer: Unimplemented");
		return get_context().CreateNull();
	}
コード例 #15
0
		void ListSection::items_set_notify(size_t index, size_t count)
		{
			TITANIUM_LOG_WARN("ListSection::items_set_notify: Unimplemented");
		}
コード例 #16
0
		TITANIUM_PROPERTY_GETTER(WebView, data)
		{
			// TODO Convert std::vector<unstd::uint8_t> to JSObject (Ti.Blob)
			TITANIUM_LOG_WARN("WebView.data is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #17
0
	std::uint32_t IOStream::write(const std::shared_ptr<Buffer>& buffer, const std::uint32_t& offset, const std::uint32_t& length)
	{
		TITANIUM_LOG_WARN("IOStream::write: Unimplemented");
		return 0;
	}
コード例 #18
0
		TITANIUM_FUNCTION(TableView, getSeparatorColor)
		{
			TITANIUM_LOG_WARN("TableView.getSeparatorColor is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #19
0
	void IOStream::close()
	{
		TITANIUM_LOG_WARN("IOStream::close: Unimplemented");
	}
コード例 #20
0
		TITANIUM_FUNCTION(TableView, getSectionCount)
		{
			TITANIUM_LOG_WARN("TableView.getSectionCount is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #21
0
		void File::writeAsync(const std::vector<std::uint8_t>& data, const std::uint32_t& offset, const std::uint32_t& length, const bool& append, const std::function<void(const ErrorResponse&, const uint32_t&)>&)
		{
			TITANIUM_LOG_WARN("File::writeAsync(vector<uint8_t>): Unimplemented");
		}
コード例 #22
0
		TITANIUM_FUNCTION(TableView, getMinRowHeight)
		{
			TITANIUM_LOG_WARN("TableView.getMinRowHeight is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #23
0
		std::vector<std::uint8_t> File::readBytes(const std::uint32_t& offset, const std::uint32_t& length) const
		{
			TITANIUM_LOG_WARN("File::readBytes(): Unimplemented");
			return std::vector<std::uint8_t>();
		}
コード例 #24
0
		void File::readBytesAsync(const std::uint32_t& offset, const std::uint32_t& length, const std::function<void(const ErrorResponse&, const std::vector<std::uint8_t>&)>&) const
		{
			TITANIUM_LOG_WARN("File::readBytesAsync(): Unimplemented");
		}
コード例 #25
0
		TITANIUM_FUNCTION(TableView, getHeaderView)
		{
			TITANIUM_LOG_WARN("TableView.getHeaderView is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #26
0
		TITANIUM_FUNCTION(TableView, getFooterTitle)
		{
			TITANIUM_LOG_WARN("TableView.getFooterTitle is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #27
0
		TITANIUM_FUNCTION(TableView, getFilterAnchored)
		{
			TITANIUM_LOG_WARN("TableView.getFilterAnchored is not implemented yet");
			return get_context().CreateUndefined();
		}
コード例 #28
0
		TITANIUM_FUNCTION(TableView, getFilterCaseInsensitive)
		{
			TITANIUM_LOG_WARN("TableView.getFilterCaseInsensitive is not implemented yet");
			return get_context().CreateUndefined();
		}