本文整理汇总了C++中Platform::getLocalPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::getLocalPath方法的具体用法?C++ Platform::getLocalPath怎么用?C++ Platform::getLocalPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::getLocalPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFiles
void createFiles()
{
// Create local HTML files we want to refer to by urls.
// We read data from resources and write to files.
// TODO: This can be removed once automatic resource
// unpacking of file systems is supported.
mPlatform->writeTextToFile(
mPlatform->getLocalPath() + "PageOne.html",
mPlatform->createTextFromHandle(PageOne_html));
mPlatform->writeTextToFile(
mPlatform->getLocalPath() + "PageTwo.html",
mPlatform->createTextFromHandle(PageTwo_html));
}
示例2: createWebView
MAWidgetHandle createWebView()
{
// Create web view.
MAWidgetHandle webView = maWidgetCreate(MAW_WEB_VIEW);
widgetShouldBeValid(webView, "Could not create web view");
// Set size of the web view to fill the parent.
maWidgetSetProperty(webView, "width", "-1");
maWidgetSetProperty(webView, "height", "-1");
// Method 1: Directly html property of WebView.
// MAUtil::String html =
// mPlatform->createTextFromHandle(ColorPage_html);
// maWidgetSetProperty(webView, "html", html.c_str());
// Method 2: Write html file to local file system.
// Write HTML resource files to the local file system
// so they can be accessed by the web view.
// TODO: This can be removed once automatic resource
// unpacking of file systems is supported.
mPlatform->writeTextToFile(
mPlatform->getLocalPath() + "ColorPage.html",
mPlatform->createTextFromHandle(ColorPage_html));
// As a test, create a second page (linked to from ColorPage.html).
mPlatform->writeTextToFile(
mPlatform->getLocalPath() + "AnotherPage.html",
"<html><body><p><a href=\"ColorPage.html\">Hello World</a></p></body></html>");
// Set the URL the web view displays.
// We support both absolute file url and
// as url that assumes a url base is set.
maWidgetSetProperty(webView, "url", "ColorPage.html");
// Register to receive messages from the WebView.
WebViewMessage::getMessagesFor(webView);
return webView;
}