/usr/share/doc/unity-scopes/previewwidgets.html is in libunity-scopes-doc 1.0.4+16.04.20160402.4-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Unity Scopes API: Preview widget types</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Unity Scopes API
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('previewwidgets.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Preview widget types </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="previewtypes"></a>
Recognized preview widget types</h1>
<p>The following widget types are recognized by Unity: </p><ul>
<li><code>audio</code> </li>
<li><code>video</code> </li>
<li><code>image</code> </li>
<li><code>gallery</code> </li>
<li><code>header</code> </li>
<li><code>actions</code> </li>
<li><code>icon-actions</code> </li>
<li><code>progress</code> </li>
<li><code>text</code> </li>
<li><code>rating-input</code> </li>
<li><code>rating-edit</code> </li>
<li><code>reviews</code> </li>
<li><code>comment-input</code> </li>
<li><code>comment</code> </li>
<li><code>expandable</code> </li>
<li><code>table</code> </li>
</ul>
<h2><a class="anchor" id="audio"></a>
audio widget</h2>
<p>The audio widget displays a list of tracks with play/pause controls.</p>
<p>List of attributes:</p>
<ul>
<li><code>tracks</code> A composite attribute containing an array of tuples, where each tuple has up to four fields: <code>title</code> (mandatory string), <code>subtitle</code> (optional string), <code>source</code> (mandatory URI), and <code>length</code> (optional integer specifying the track length in seconds)</li>
</ul>
<p>You can construct composite attributes with <a class="el" href="classunity_1_1scopes_1_1_variant_builder.html" title="Helper class for creating and populating Variant containers. ">unity::scopes::VariantBuilder</a>:</p>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"tracks"</span>, <span class="stringliteral">"audio"</span>);</div><div class="line"></div><div class="line"> VariantBuilder builder;</div><div class="line"> builder.add_tuple({</div><div class="line"> {<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"Track #1"</span>)},</div><div class="line"> {<span class="stringliteral">"source"</span>, Variant(<span class="stringliteral">"file:///tmp/song1.mp3"</span>)},</div><div class="line"> {<span class="stringliteral">"length"</span>, Variant(194)}</div><div class="line"> });</div><div class="line"> builder.add_tuple({</div><div class="line"> {<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"Track #2"</span>)},</div><div class="line"> {<span class="stringliteral">"source"</span>, Variant(<span class="stringliteral">"file:///tmp/song2.mp3"</span>)},</div><div class="line"> {<span class="stringliteral">"length"</span>, Variant(207)}</div><div class="line"> });</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"tracks"</span>, builder.end());</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="video"></a>
video widget</h2>
<p>The video widget displays a still from a video and allows playing the video.</p>
<p>List of attributes:</p>
<ul>
<li><code>source</code> A URI pointing to the video </li>
<li><code>screenshot</code> A URI pointing to a screenshot of the video (optional) </li>
<li><code>share-data</code> An optional dictionary for making this video shareable with Content Hub. See <a class="el" href="previewwidgets.html#contentsharing">content sharing</a> below.</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"video1"</span>, <span class="stringliteral">"video"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"source"</span>, Variant(<span class="stringliteral">"file:///tmp/video1.mp4"</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="image"></a>
image widget</h2>
<p>The image widget displays a single image.</p>
<p>List of attributes:</p>
<ul>
<li><code>source</code> A URI pointing to the image </li>
<li><code>zoomable</code> A boolean specifying whether the image is zoomable (default: <code>false</code>) </li>
<li><code>fallback</code> A fallback image to be used if the image URI is empty or cannot be retrieved (default: none) </li>
<li><code>share-data</code> An optional dictionary for making this image shareable with Content Hub. See <a class="el" href="previewwidgets.html#contentsharing">content sharing</a> below.</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"img1"</span>, <span class="stringliteral">"image"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"source"</span>, Variant(<span class="stringliteral">"http://example.com/image.jpg"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"fallback"</span>, Variant(<span class="stringliteral">"file:///tmp/image.jpg"</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="gallery"></a>
gallery widget</h2>
<p>The gallery widget displays a set of images.</p>
<p>List of attributes:</p>
<ul>
<li><code>sources</code> An array of image URIs </li>
<li><code>fallback</code> A fallback image to be used if an image URI is empty or cannot be retrieved (default: none)</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"gal"</span>, <span class="stringliteral">"gallery"</span>);</div><div class="line"></div><div class="line"> <a class="code" href="namespaceunity_1_1scopes.html#aa3bf32d584efd902bca79698a07dd934">VariantArray</a> arr;</div><div class="line"> arr.push_back(Variant(<span class="stringliteral">"http://example.com/image1.jpg"</span>));</div><div class="line"> arr.push_back(Variant(<span class="stringliteral">"file:///tmp/image2.jpg"</span>));</div><div class="line"> arr.push_back(Variant(<span class="stringliteral">"file:///tmp/image3.jpg"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"sources"</span>, Variant(arr));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"fallback"</span>, Variant(<span class="stringliteral">"file:///tmp/fallback.png"</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="header"></a>
header widget</h2>
<p>The header widget displays basic infomation about the result.</p>
<p>List of attributes:</p>
<ul>
<li><code>title</code> A string specifying the title </li>
<li><code>subtitle</code> A string specifying the subtitle </li>
<li><code>mascot</code> A URI specifying the mascot </li>
<li><code>fallback</code> A fallback image to be used if the mascot URI is empty or cannot be retrieved (default: none) </li>
<li><code>emblem</code> A URI specifying the emblem</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"hdr"</span>, <span class="stringliteral">"header"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"Result item"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"mascot"</span>, Variant(<span class="stringliteral">"http://example.com/image.png"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"fallback"</span>, Variant(<span class="stringliteral">"file:///tmp/fallback_mascot.png"</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="actions"></a>
actions widget</h2>
<p>The actions widget displays one or more buttons.</p>
<p>List of attributes:</p>
<ul>
<li><code>actions</code> A composite attribute containing an array of tuples, where each tuple has at least these fields: <code>id</code> (a mandatory string that is passed to unity::scopes::ScopeBase::activate_preview_action()), <code>label</code> (mandatory string), and <code>icon</code> (optional URI).</li>
</ul>
<p>You can construct composite attributes with <a class="el" href="classunity_1_1scopes_1_1_variant_builder.html" title="Helper class for creating and populating Variant containers. ">unity::scopes::VariantBuilder</a>:</p>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"buttons"</span>, <span class="stringliteral">"actions"</span>);</div><div class="line"></div><div class="line"> VariantBuilder builder;</div><div class="line"> builder.add_tuple({</div><div class="line"> {<span class="stringliteral">"id"</span>, Variant(<span class="stringliteral">"open"</span>)},</div><div class="line"> {<span class="stringliteral">"label"</span>, Variant(<span class="stringliteral">"Open"</span>)}</div><div class="line"> });</div><div class="line"> builder.add_tuple({</div><div class="line"> {<span class="stringliteral">"id"</span>, Variant(<span class="stringliteral">"download"</span>)},</div><div class="line"> {<span class="stringliteral">"label"</span>, Variant(<span class="stringliteral">"Download"</span>)}</div><div class="line"> });</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"actions"</span>, builder.end());</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="icon-actions"></a>
icon-actions widget</h2>
<p>The icon-actions widget displays one or more buttons represented by icons and/or labels. It's similar to actions widget, but uses different layout. Every button can provide an optional temporary icon to be displayed immediately after user taps it.</p>
<p>List of attributes:</p>
<ul>
<li><code>actions</code> A composite attribute containing an array of tuples, where each tuple has at least these fields: <code>id</code> (a mandatory string that is passed to unity::scopes::ScopeBase::activate_preview_action()), <code>label</code> (optional string), <code>icon</code> (optional URI, required if label is missing), <code>temporaryIcon</code> (optional URI).</li>
</ul>
<h2><a class="anchor" id="progress"></a>
progress widget</h2>
<p>The progress widget displays the progress of an action, such as download progress.</p>
<p>On completion, the scope receives a preview action activation with the id <code>"finished"</code> or <code>"failed"</code>, depending on the outcome of the operation.</p>
<p>List of attributes:</p>
<ul>
<li><code>source</code> A tuple with keys understood by a progress provider</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"download"</span>, <span class="stringliteral">"progress"</span>);</div><div class="line"></div><div class="line"> <a class="code" href="namespaceunity_1_1scopes.html#ad5d8ccfa11a327fca6f3e4cee11f4c10">VariantMap</a> tuple;</div><div class="line"> tuple[<span class="stringliteral">"dbus-name"</span>] = <span class="stringliteral">"com.canonical.DownloadManager"</span>;</div><div class="line"> tuple[<span class="stringliteral">"dbus-object"</span>] = <span class="stringliteral">"/com/canonical/download/obj1"</span>;</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"source"</span>, Variant(tuple));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="text"></a>
text widget</h2>
<p>A text widget can be used for text of any length (without formatting).</p>
<p>List of attributes:</p>
<ul>
<li><code>title</code> Optional string </li>
<li><code>text</code> A string containing the text</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"summary"</span>, <span class="stringliteral">"text"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"text"</span>, Variant(<span class="stringliteral">"Lorem Ipsum ..."</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="rating-input"></a>
rating-input widget</h2>
<p>The rating-input widget allows users to rate content. It consists of two types of widget: a star-based rating and an input field for the user to enter his/her review. It is possible to hide each widget as well as to require them to be filled in.</p>
<p>When a user presses the "Send" button, the scope receives a preview action activation with the id <code>"rated"</code>. The actual rating and/or review can be accessed via <a class="el" href="classunity_1_1scopes_1_1_action_metadata.html#a34777e687ce700a7b6313f3dad6d3340" title="Get data attached to this ActionMetadata. ">unity::scopes::ActionMetadata::scope_data</a>. The scope data will be a VariantMap with the following keys:</p>
<ul>
<li><code>"rating"</code> - a double holding the number of stars the user selected (1 to 5)</li>
<li><code>"review"</code> - a string holding the free text review</li>
</ul>
<p>List of attributes:</p>
<ul>
<li><code>rating-label</code> String for the star-based rating (default: "Rate this") </li>
<li><code>review-label</code> String for the review input (default: "Add a review") </li>
<li><code>submit-label</code> String for the confirmation button (default: "Send") </li>
<li><code>rating-icon-empty</code> URI for an empty rating icon </li>
<li><code>rating-icon-full</code> URI for a full rating icon </li>
<li><code>visible</code> String specifying which of the two widgets are visible (<code>"rating"</code>, <code>"review"</code> or default:<code>"both"</code>) </li>
<li><code>required</code> String specifying which of the two widgets are required to be filled in (<code>"rating"</code>, <code>"review"</code> or default:<code>"both"</code>)</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"rating"</span>, <span class="stringliteral">"rating-input"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"visible"</span>, Variant(<span class="stringliteral">"rating"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"required"</span>, Variant(<span class="stringliteral">"rating"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"rating-icon-empty"</span>, Variant(<span class="stringliteral">"file:///tmp/star-empty.svg"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"rating-icon-full"</span>, Variant(<span class="stringliteral">"file:///tmp/star-full.svg"</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="rating-edit"></a>
rating-edit widget</h2>
<p>The rating-edit widget allows users to edit an existing review and rating. When used in a preview, the widget displays an existing review and a small "pen" icon; user can update the review and/or rating after tapping the "pen" icon.</p>
<p>This widget supports all the attributes of rating-input widget, plus three extra attributes (<code>"review"</code>, <code>"rating"</code>, <code>"author"</code>) to pre-fill the widget with data of an existing review.</p>
<p>List of attributes:</p>
<ul>
<li><code>rating-label</code> String for the star-based rating (default: "Rate this") </li>
<li><code>review-label</code> String for the review input (default: "Add a review") </li>
<li><code>submit-label</code> String for the confirmation button (default: "Send") </li>
<li><code>rating-icon-empty</code> URI for an empty rating icon </li>
<li><code>rating-icon-full</code> URI for a full rating icon </li>
<li><code>visible</code> String specifying which of the two widgets are visible (<code>"rating"</code>, <code>"review"</code> or default:<code>"both"</code>) </li>
<li><code>required</code> String specifying which of the two widgets are required to be filled in (<code>"rating"</code>, <code>"review"</code> or default:<code>"both"</code>) </li>
<li><code>author</code> String for the name of the reviewer (optional) </li>
<li><code>review</code> String for the text of existing review (optional) </li>
<li><code>rating</code> Number for the rating value (optional)</li>
</ul>
<p>Note: The rating-edit widget may not be supported by older versions of unity8 shell.</p>
<h2><a class="anchor" id="reviews"></a>
reviews widget</h2>
<p>The reviews widget is used to display previously-rated content.</p>
<p>List of attributes:</p>
<ul>
<li><code>rating-icon-empty</code> URI for an empty rating icon </li>
<li><code>rating-icon-half</code> URI for an half-full rating icon </li>
<li><code>rating-icon-full</code> URI for a full rating icon </li>
<li><code>reviews</code> A composite attribute containing an array of tuples, where each tuple has up to three fields: <code>rating</code> (optional integer specifying the number of stars), <code>author</code> (mandatory string) and <code>review</code> (optional string).</li>
</ul>
<p>You can construct composite attributes with <a class="el" href="classunity_1_1scopes_1_1_variant_builder.html" title="Helper class for creating and populating Variant containers. ">unity::scopes::VariantBuilder</a>:</p>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"summary"</span>, <span class="stringliteral">"reviews"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"rating-icon-empty"</span>, Variant(<span class="stringliteral">"file:///tmp/star-empty.svg"</span>));</div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"rating-icon-full"</span>, Variant(<span class="stringliteral">"file:///tmp/star-full.svg"</span>));</div><div class="line"></div><div class="line"> VariantBuilder builder;</div><div class="line"> builder.add_tuple({</div><div class="line"> {<span class="stringliteral">"author"</span>, Variant(<span class="stringliteral">"John Doe"</span>)},</div><div class="line"> {<span class="stringliteral">"rating"</span>, Variant(3)}</div><div class="line"> });</div><div class="line"> builder.add_tuple({</div><div class="line"> {<span class="stringliteral">"author"</span>, Variant(<span class="stringliteral">"Mr. Smith"</span>)},</div><div class="line"> {<span class="stringliteral">"rating"</span>, Variant(5)}</div><div class="line"> });</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"reviews"</span>, builder.end());</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="comment-input"></a>
comment-input widget</h2>
<p>The comment-input widget allows users to add comments. It displays an input box along with "Send" button.</p>
<p>When a user presses the "Send" button, the scope receives a preview action activation with the id <code>"commented"</code>. The actual comment can be accessed via <a class="el" href="classunity_1_1scopes_1_1_action_metadata.html#a34777e687ce700a7b6313f3dad6d3340" title="Get data attached to this ActionMetadata. ">unity::scopes::ActionMetadata::scope_data</a>. The scope data will be a VariantMap with the <code>"comment"</code> field holding the text entered by the user.</p>
<p>List of attributes:</p>
<ul>
<li><code>submit-label</code> String for the label of the submit button (optional, uses "Submit" by default).</li>
</ul>
<div class="fragment"><div class="line">{</div><div class="line"> PreviewWidget w1(<span class="stringliteral">"cmt"</span>, <span class="stringliteral">"comment-input"</span>);</div><div class="line"></div><div class="line"> w1.add_attribute_value(<span class="stringliteral">"submit-label"</span>, Variant(<span class="stringliteral">"Comment it!"</span>));</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h2><a class="anchor" id="comment"></a>
comment widget</h2>
<p>The comment widget shows an avatar, author name, subtitle and a comment text.</p>
<p>List of attributes: </p><ul>
<li><code>source</code> URI for an avatar icon (optional) </li>
<li><code>author</code> A string specifying the author of the comment (mandatory) </li>
<li><code>subtitle</code> A string for the subtitle (optional) </li>
<li><code>comment</code> A string for the comment text (mandatory)</li>
</ul>
<h2><a class="anchor" id="expandable"></a>
expandable widget</h2>
<p>The expandable widget is used to group several widgets into an expandable pane.</p>
<p>List of attributes: </p><ul>
<li><code>title</code> A string specifying the title </li>
<li><code>collapsed-widgets</code> Optional number of collapsed widgets (0 makes all of them visible)</li>
</ul>
<div class="fragment"><div class="line">PreviewWidget expandable(<span class="stringliteral">"exp"</span>, <span class="stringliteral">"expandable"</span>);</div><div class="line">expandable.add_attribute_value(<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"This is an expandable widget"</span>));</div><div class="line">expandable.add_attribute_value(<span class="stringliteral">"collapsed-widgets"</span>, Variant(0));</div><div class="line"></div><div class="line">PreviewWidget w1(<span class="stringliteral">"w1"</span>, <span class="stringliteral">"text"</span>);</div><div class="line">w1.add_attribute_value(<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"Subwidget 1"</span>));</div><div class="line">w1.add_attribute_value(<span class="stringliteral">"text"</span>, Variant(<span class="stringliteral">"A text"</span>));</div><div class="line">PreviewWidget w2(<span class="stringliteral">"w2"</span>, <span class="stringliteral">"text"</span>);</div><div class="line">w2.add_attribute_value(<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"Subwidget 2"</span>));</div><div class="line">w2.add_attribute_value(<span class="stringliteral">"text"</span>, Variant(<span class="stringliteral">"A text"</span>));</div><div class="line">expandable.add_widget(w1);</div><div class="line">expandable.add_widget(w2);</div><div class="line">...</div></div><!-- fragment --><h2><a class="anchor" id="table"></a>
table widget</h2>
<p>The table widget is used to show a table with labels and values. When used inside an Expandable widget, the topmost 3 rows are shown until it's expanded.</p>
<p>List of attributes: </p><ul>
<li><code>title</code> A string specifying the title to be shown on top </li>
<li><code>values</code> An array with one element per row. Each element is an array of two strings: label and value</li>
</ul>
<div class="fragment"><div class="line">PreviewWidget table(<span class="stringliteral">"details"</span>, <span class="stringliteral">"table"</span>);</div><div class="line">table.add_attribute_value(<span class="stringliteral">"title"</span>, Variant(<span class="stringliteral">"This is a table widget"</span>));</div><div class="line"></div><div class="line"><a class="code" href="namespaceunity_1_1scopes.html#aa3bf32d584efd902bca79698a07dd934">VariantArray</a> values {</div><div class="line"> Variant{<a class="code" href="namespaceunity_1_1scopes.html#aa3bf32d584efd902bca79698a07dd934">VariantArray</a>{Variant{_(<span class="stringliteral">"Version number"</span>)}, Variant{<span class="stringliteral">"0.83b"</span>}}},</div><div class="line"> Variant{<a class="code" href="namespaceunity_1_1scopes.html#aa3bf32d584efd902bca79698a07dd934">VariantArray</a>{Variant{_(<span class="stringliteral">"Last updated"</span>)}, Variant{<span class="stringliteral">"2015-01-15"</span>}}},</div><div class="line"> Variant{<a class="code" href="namespaceunity_1_1scopes.html#aa3bf32d584efd902bca79698a07dd934">VariantArray</a>{Variant{_(<span class="stringliteral">"First released"</span>)}, Variant{<span class="stringliteral">"2013-12-16"</span>}}},</div><div class="line"> Variant{<a class="code" href="namespaceunity_1_1scopes.html#aa3bf32d584efd902bca79698a07dd934">VariantArray</a>{Variant{_(<span class="stringliteral">"Size"</span>)}, Variant{<span class="stringliteral">"11.3 MiB"</span>}}},</div><div class="line">};</div><div class="line">table.add_attribute_value(<span class="stringliteral">"values"</span>, Variant(values));</div><div class="line">...</div></div><!-- fragment --><h2><a class="anchor" id="contentsharing"></a>
Content sharing</h2>
<p>Some widgets support content sharing with the special share-data attribute. When the widget is tapped (clicked), data (image, video etc.) can be shared with Content Hub.</p>
<p>The share-data attribute is a dictionary (VariantMap) that needs to contain the following keys:</p>
<ul>
<li><code>uri</code> A single URI to share or an array of URIs. </li>
<li><code>content-type</code> A name of the content type known to Content Hub, e.g. "links", "pictures", "videos". Please refer to Content Hub documentation for information on supported content types.</li>
</ul>
<p>Here is an example of a shareable image:</p>
<div class="fragment"><div class="line">PreviewWidget image(<span class="stringliteral">"img"</span>, <span class="stringliteral">"image"</span>);</div><div class="line">image.add_attribute_value(<span class="stringliteral">"source"</span>, Variant(<span class="stringliteral">"http://www.example.org/graphics.png"</span>));</div><div class="line"></div><div class="line"><a class="code" href="namespaceunity_1_1scopes.html#ad5d8ccfa11a327fca6f3e4cee11f4c10">VariantMap</a> share_data;</div><div class="line">share_data[<span class="stringliteral">"uri"</span>] = Variant(<span class="stringliteral">"http://www.example.org/graphics_big.png"</span>);</div><div class="line">share_data[<span class="stringliteral">"content-type"</span>] = Variant(<span class="stringliteral">"pictures"</span>);</div><div class="line">image.add_attribute_value(<span class="stringliteral">"share-data"</span>, share_data);</div></div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Sat Apr 2 2016 03:24:17 for Unity Scopes API by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>
|