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 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt: Wt::WAnchor Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WAnchor.html">WAnchor</a>
</div>
</div>
<div class="contents">
<h1>Wt::WAnchor Class Reference</h1><!-- doxytag: class="Wt::WAnchor" --><!-- doxytag: inherits="Wt::WContainerWidget" -->A widget that represents an HTML anchor (to link to other documents).
<a href="#_details">More...</a>
<p>
<code>#include <Wt/WAnchor></code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WAnchor:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WAnchor__inherit__graph.png" border="0" usemap="#Wt_1_1WAnchor__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WAnchor__inherit__map">
<area shape="rect" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets." alt="" coords="5,304,157,331"><area shape="rect" href="classWt_1_1WInteractWidget.html" title="An abstract widget that can receive user-interface interaction." alt="" coords="11,229,152,256"><area shape="rect" href="classWt_1_1WWebWidget.html" title="A base class for widgets with an HTML counterpart." alt="" coords="20,155,143,181"><area shape="rect" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component." alt="" coords="33,80,129,107"><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="33,5,129,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classWt_1_1WAnchor-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0416606719711d768ba21ceacc5bf496"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="0416606719711d768ba21ceacc5bf496" args="(WContainerWidget *parent=0)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#0416606719711d768ba21ceacc5bf496">WAnchor</a> (<a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c2187f2f49e6f25f1d537203558432f2"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="c2187f2f49e6f25f1d537203558432f2" args="(const std::string &url, WContainerWidget *parent=0)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#c2187f2f49e6f25f1d537203558432f2">WAnchor</a> (const std::string &url, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor referring to a URL. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#667242ca0bbb3690a434ba9ffbb5b5e9">WAnchor</a> (<a class="el" href="classWt_1_1WResource.html">WResource</a> *resource, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor referrring a resource. <a href="#667242ca0bbb3690a434ba9ffbb5b5e9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7a1283860b03fa23e4b777971e9b8f00"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="7a1283860b03fa23e4b777971e9b8f00" args="(const std::string &url, const WString &text, WContainerWidget *parent=0)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#7a1283860b03fa23e4b777971e9b8f00">WAnchor</a> (const std::string &url, const <a class="el" href="classWt_1_1WString.html">WString</a> &text, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor referring to a URL, using a text message. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#1fabbd73453d9462e0fd20a9d4161bf9">WAnchor</a> (<a class="el" href="classWt_1_1WResource.html">WResource</a> *resource, const <a class="el" href="classWt_1_1WString.html">WString</a> &text, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor referring to a resource, using a text message. <a href="#1fabbd73453d9462e0fd20a9d4161bf9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#b816a891dde296d19fe7a8a2351597e2">WAnchor</a> (const std::string &ref, <a class="el" href="classWt_1_1WImage.html">WImage</a> *image, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor referring to a URL, using an image. <a href="#b816a891dde296d19fe7a8a2351597e2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#94e54cb64ea12090170f526fd8d6ae55">WAnchor</a> (<a class="el" href="classWt_1_1WResource.html">WResource</a> *resource, <a class="el" href="classWt_1_1WImage.html">WImage</a> *image, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an anchor referring to a resource, using an image. <a href="#94e54cb64ea12090170f526fd8d6ae55"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3">setRef</a> (const std::string &url)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the destination URL. <a href="#cf0206a2ac91ea67d68ba10e3a951ba3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#e3ea26646f135bf133871564f5d6798d">setRefInternalPath</a> (const std::string &path)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the destination URL as an internal path. <a href="#e3ea26646f135bf133871564f5d6798d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#c188644d6b10201ea99714f073c5b20f">ref</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the destination URL. <a href="#c188644d6b10201ea99714f073c5b20f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#f4b130e223525c4b6084eb2fb8797738">setResource</a> (<a class="el" href="classWt_1_1WResource.html">WResource</a> *resource)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets a destination resource. <a href="#f4b130e223525c4b6084eb2fb8797738"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WResource.html">WResource</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#e95cf2ea27a8b04e74334e0e78e46bad">resource</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the destination resource. <a href="#e95cf2ea27a8b04e74334e0e78e46bad"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#8379cfef23023ac070d2b7dcedacdac8">setText</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &text)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the label text. <a href="#8379cfef23023ac070d2b7dcedacdac8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#a29b29327d79b2e15ac74904e8b79cac">text</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the label text. <a href="#a29b29327d79b2e15ac74904e8b79cac"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#be96ca40734d6af4a901d5fb2a9c8c59">setWordWrap</a> (bool wordWrap)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Configures text word wrapping. <a href="#be96ca40734d6af4a901d5fb2a9c8c59"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#f31ca59038f6b696b90c79fc1232ea64">wordWrap</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the widget may break lines. <a href="#f31ca59038f6b696b90c79fc1232ea64"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#d9fc10558d724684b1fd9314aa5ea8e7">setImage</a> (<a class="el" href="classWt_1_1WImage.html">WImage</a> *image)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets an image. <a href="#d9fc10558d724684b1fd9314aa5ea8e7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WImage.html">WImage</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#144d76630a616ea8fb7b268240c6f7ff">image</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the image. <a href="#144d76630a616ea8fb7b268240c6f7ff"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#169c32b60dcb5d4511a3cbdd4979c941">setTarget</a> (<a class="el" href="namespaceWt.html#6c93a6e97016801a310275457e43f333">AnchorTarget</a> target)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the location where the referred content should be displayed. <a href="#169c32b60dcb5d4511a3cbdd4979c941"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceWt.html#6c93a6e97016801a310275457e43f333">AnchorTarget</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#75c557c92118cf0cdaaad437f8d91ad5">target</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the location where the referred content should be displayed. <a href="#75c557c92118cf0cdaaad437f8d91ad5"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WAnchor.html#188c6f7fa64408e9214c08292974834d">enableAjax</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Progresses to an Ajax-enabled widget. <a href="#188c6f7fa64408e9214c08292974834d"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A widget that represents an HTML anchor (to link to other documents).
<p>
Use an anchor to link to another web page, document, internal application path or a resource. The anchor may contain a label text, an image, or any other widget (as it inherits from <a class="el" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">WContainerWidget</a>). If you do not want the application to terminate when the user follows the anchor, you must use <a class="el" href="classWt_1_1WAnchor.html#169c32b60dcb5d4511a3cbdd4979c941">setTarget(TargetNewWindow)</a>. Even for non-HTML documents, this may be important since pending AJAX requests are cancelled if documents are not served within the browser window in certain browsers.<p>
Usage example: <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WAnchor.html#0416606719711d768ba21ceacc5bf496" title="Creates an anchor.">WAnchor</a> *a;
<span class="comment">// Create an anchor that references a URL</span>
a = <span class="keyword">new</span> <a class="code" href="classWt_1_1WAnchor.html#0416606719711d768ba21ceacc5bf496" title="Creates an anchor.">WAnchor</a>(<span class="stringliteral">"http://www.webtoolkit.eu/"</span>, <span class="stringliteral">"Wt web toolkit"</span>, <span class="keyword">this</span>);
<span class="comment">// Create an anchor that references an internal path</span>
a = <span class="keyword">new</span> <a class="code" href="classWt_1_1WAnchor.html#0416606719711d768ba21ceacc5bf496" title="Creates an anchor.">WAnchor</a>(<span class="keyword">this</span>);
a->setRefInternalPath(<span class="stringliteral">"/docs/"</span> + myDocName());
<span class="comment">// and listen to the corresponding change in internal path</span>
<a class="code" href="classWt_1_1WApplication.html#38d922da0a0d83395519f3eaab85d0f6" title="Returns the current application instance.">WApplication::instance</a>()->internalPathChanged().connect(SLOT(<span class="keyword">this</span>, DocsListWidget::onInternalPathChange));
<span class="comment">// Create an anchor that references a resource</span>
WResource *r = <span class="keyword">new</span> PdfResource(<span class="keyword">this</span>); <span class="comment">// serializes to a PDF file.</span>
a = <span class="keyword">new</span> <a class="code" href="classWt_1_1WAnchor.html#0416606719711d768ba21ceacc5bf496" title="Creates an anchor.">WAnchor</a>(r, <span class="stringliteral">"PDF version"</span>, <span class="keyword">this</span>);
a->setTarget(<a class="code" href="namespaceWt.html#6c93a6e97016801a310275457e43f33395e5b4e8a2eed99252fc0eb2bb483cd8" title="Show in a separate new tab or window.">TargetNewWindow</a>);
</pre></div><p>
WAnchor is an <a class="el" href="classWt_1_1WWidget.html#c78e3af143883334c82031790c87416e">inline </a> widget.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>If you set a text or image using one of the API methods like <a class="el" href="classWt_1_1WAnchor.html#8379cfef23023ac070d2b7dcedacdac8" title="Sets the label text.">setText()</a> or <a class="el" href="classWt_1_1WAnchor.html#d9fc10558d724684b1fd9314aa5ea8e7" title="Sets an image.">setImage()</a> or a constructor, you should not attempt to remove all contents (using <a class="el" href="classWt_1_1WContainerWidget.html#608f748cbdda763f1a11556ddad9fbe1" title="Removes and deletes all child widgets.">clear()</a>, or provide a layout (using <a class="el" href="classWt_1_1WContainerWidget.html#1c84e0ffe330d4798f0ce217f75be08c" title="Sets a layout manager for the container.">setLayout()</a>), as this will result in undefined behaviour: the text or image are simply inserted as widgets into the container.</dd></dl>
<h3>CSS</h3>
<p>
The widget corresponds to the HTML <code><a></code> tag and does not provide styling. It can be styled using inline or external CSS as appropriate. <hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="667242ca0bbb3690a434ba9ffbb5b5e9"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="667242ca0bbb3690a434ba9ffbb5b5e9" args="(WResource *resource, WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WAnchor::WAnchor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WResource.html">WResource</a> * </td>
<td class="paramname"> <em>resource</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates an anchor referrring a resource.
<p>
The <code>resource</code> specifies application-dependent content that may be generated by your application on demand.<p>
The anchor does not assume ownership of <code>resource</code>, so that you may share the same resources for several anchors.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WResource.html" title="An object which can be rendered in the HTTP protocol.">WResource</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="1fabbd73453d9462e0fd20a9d4161bf9"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="1fabbd73453d9462e0fd20a9d4161bf9" args="(WResource *resource, const WString &text, WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WAnchor::WAnchor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WResource.html">WResource</a> * </td>
<td class="paramname"> <em>resource</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates an anchor referring to a resource, using a text message.
<p>
The <code>resource</code> specifies application-dependent content that may be generated by your application on demand.<p>
The anchor does not assume ownership of <code>resource</code>, so that you may share the same resources for several anchors.
</div>
</div><p>
<a class="anchor" name="b816a891dde296d19fe7a8a2351597e2"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="b816a891dde296d19fe7a8a2351597e2" args="(const std::string &ref, WImage *image, WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WAnchor::WAnchor </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>ref</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WImage.html">WImage</a> * </td>
<td class="paramname"> <em>image</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates an anchor referring to a URL, using an image.
<p>
Ownership of the image is transferred to the anchor.
</div>
</div><p>
<a class="anchor" name="94e54cb64ea12090170f526fd8d6ae55"></a><!-- doxytag: member="Wt::WAnchor::WAnchor" ref="94e54cb64ea12090170f526fd8d6ae55" args="(WResource *resource, WImage *image, WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WAnchor::WAnchor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WResource.html">WResource</a> * </td>
<td class="paramname"> <em>resource</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WImage.html">WImage</a> * </td>
<td class="paramname"> <em>image</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates an anchor referring to a resource, using an image.
<p>
The <code>resource</code> specifies application-dependent content that may be generated by your application on demand.<p>
The anchor does not assume ownership of <code>resource</code>, so that you may share the same resources for several anchors.<p>
Ownership of the image is transferred to the anchor.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="cf0206a2ac91ea67d68ba10e3a951ba3"></a><!-- doxytag: member="Wt::WAnchor::setRef" ref="cf0206a2ac91ea67d68ba10e3a951ba3" args="(const std::string &url)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setRef </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>url</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the destination URL.
<p>
This method should not be used when the anchor has been pointed to a dynamically generated resource using <a class="el" href="classWt_1_1WAnchor.html#f4b130e223525c4b6084eb2fb8797738" title="Sets a destination resource.">setResource()</a>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#f4b130e223525c4b6084eb2fb8797738" title="Sets a destination resource.">setResource()</a>, <a class="el" href="classWt_1_1WAnchor.html#e3ea26646f135bf133871564f5d6798d" title="Sets the destination URL as an internal path.">setRefInternalPath()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="e3ea26646f135bf133871564f5d6798d"></a><!-- doxytag: member="Wt::WAnchor::setRefInternalPath" ref="e3ea26646f135bf133871564f5d6798d" args="(const std::string &path)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setRefInternalPath </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>path</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the destination URL as an internal path.
<p>
Sets the anchor to point to the internal path <code>path</code>. When the anchor is activated, the internal path is set to <code>path</code>, and the <a class="el" href="classWt_1_1WApplication.html#3e68c4b6bb387f27a614e7962e11967b" title="Signal which indicates that the user changes the internal path.">WApplication::internalPathChanged()</a> signal is emitted.<p>
This is the easiest way to let the application participate in browser history, and generate URLs that are bookmarkable and search engine friendly.<p>
Internally, this method sets the destination URL using: <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3" title="Sets the destination URL.">setRef</a>(<a class="code" href="classWt_1_1WApplication.html#38d922da0a0d83395519f3eaab85d0f6" title="Returns the current application instance.">WApplication::instance</a>()->bookmarkUrl(path))
</pre></div><p>
The <a class="el" href="classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c" title="Event signal emitted when a mouse key was clicked on this widget.">clicked()</a> signal is connected to a slot that changes the internal path by calling <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WApplication.html#38d922da0a0d83395519f3eaab85d0f6" title="Returns the current application instance.">WApplication::instance</a>()->setInternalPath(<a class="code" href="classWt_1_1WAnchor.html#c188644d6b10201ea99714f073c5b20f" title="Returns the destination URL.">ref</a>(), <span class="keyword">true</span>);
</pre></div><p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3" title="Sets the destination URL.">setRef()</a>, <a class="el" href="classWt_1_1WAnchor.html#f4b130e223525c4b6084eb2fb8797738" title="Sets a destination resource.">setResource()</a><p>
<a class="el" href="classWt_1_1WApplication.html#37b4cf44f393688785ed3b34f53fead1" title="Returns a bookmarkable URL for the current internal path.">WApplication::bookmarkUrl()</a>, <a class="el" href="classWt_1_1WApplication.html#2c1a10aadc0d7ed877b5715b42ca4911" title="Change the internal path.">WApplication::setInternalPath()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="c188644d6b10201ea99714f073c5b20f"></a><!-- doxytag: member="Wt::WAnchor::ref" ref="c188644d6b10201ea99714f073c5b20f" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const std::string& Wt::WAnchor::ref </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the destination URL.
<p>
When the anchor refers to a resource, the current resource URL is returned. When the anchor refers to an internal path, the internal path is returned. Otherwise, the URL is returned that was set using <a class="el" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3" title="Sets the destination URL.">setRef()</a>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3" title="Sets the destination URL.">setRef()</a>, <a class="el" href="classWt_1_1WResource.html#11169bf885f297f6f2ebbc1789aeded2" title="Returns the current URL for this resource.">WResource::url()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="f4b130e223525c4b6084eb2fb8797738"></a><!-- doxytag: member="Wt::WAnchor::setResource" ref="f4b130e223525c4b6084eb2fb8797738" args="(WResource *resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setResource </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WResource.html">WResource</a> * </td>
<td class="paramname"> <em>resource</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets a destination resource.
<p>
A resource specifies application-dependent content, which may be generated by your application on demand.<p>
This sets the <code>resource</code> as the destination of the anchor, and is an alternative to <a class="el" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3" title="Sets the destination URL.">setRef()</a>. The resource may be cleared by passing <code>resource</code> = <code>0</code>.<p>
The anchor does not assume ownership of the resource.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#cf0206a2ac91ea67d68ba10e3a951ba3" title="Sets the destination URL.">setRef()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="e95cf2ea27a8b04e74334e0e78e46bad"></a><!-- doxytag: member="Wt::WAnchor::resource" ref="e95cf2ea27a8b04e74334e0e78e46bad" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WResource.html">WResource</a>* Wt::WAnchor::resource </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the destination resource.
<p>
Returns <code>0</code> if no resource has been set.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#f4b130e223525c4b6084eb2fb8797738" title="Sets a destination resource.">setResource()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="8379cfef23023ac070d2b7dcedacdac8"></a><!-- doxytag: member="Wt::WAnchor::setText" ref="8379cfef23023ac070d2b7dcedacdac8" args="(const WString &text)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setText </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>text</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the label text.
<p>
If no text was previously set, a new <a class="el" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">WText</a> widget is added using <a class="el" href="classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2" title="Adds a child widget to this container.">addWidget()</a>.
</div>
</div><p>
<a class="anchor" name="a29b29327d79b2e15ac74904e8b79cac"></a><!-- doxytag: member="Wt::WAnchor::text" ref="a29b29327d79b2e15ac74904e8b79cac" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classWt_1_1WString.html">WString</a> & Wt::WAnchor::text </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the label text.
<p>
Returns an empty string if no label was set.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#8379cfef23023ac070d2b7dcedacdac8" title="Sets the label text.">setText()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="be96ca40734d6af4a901d5fb2a9c8c59"></a><!-- doxytag: member="Wt::WAnchor::setWordWrap" ref="be96ca40734d6af4a901d5fb2a9c8c59" args="(bool wordWrap)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setWordWrap </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>wordWrap</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Configures text word wrapping.
<p>
When <code>wordWrap</code> is <code>true</code>, the text set with <a class="el" href="classWt_1_1WAnchor.html#8379cfef23023ac070d2b7dcedacdac8" title="Sets the label text.">setText()</a> may be broken up over multiple lines. When <code>wordWrap</code> is <code>false</code>, the text will displayed on a single line, unless the text contains <br /> tags or other block-level tags.<p>
The default value is <code>true</code>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#f31ca59038f6b696b90c79fc1232ea64" title="Returns whether the widget may break lines.">wordWrap()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="f31ca59038f6b696b90c79fc1232ea64"></a><!-- doxytag: member="Wt::WAnchor::wordWrap" ref="f31ca59038f6b696b90c79fc1232ea64" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Wt::WAnchor::wordWrap </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns whether the widget may break lines.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#be96ca40734d6af4a901d5fb2a9c8c59" title="Configures text word wrapping.">setWordWrap(bool)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="d9fc10558d724684b1fd9314aa5ea8e7"></a><!-- doxytag: member="Wt::WAnchor::setImage" ref="d9fc10558d724684b1fd9314aa5ea8e7" args="(WImage *image)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setImage </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WImage.html">WImage</a> * </td>
<td class="paramname"> <em>image</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets an image.
<p>
If an image was previously set, it is deleted. The <code>image</code> is added using <a class="el" href="classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2" title="Adds a child widget to this container.">addWidget()</a>.<p>
Ownership of the image is transferred to the anchor.
</div>
</div><p>
<a class="anchor" name="144d76630a616ea8fb7b268240c6f7ff"></a><!-- doxytag: member="Wt::WAnchor::image" ref="144d76630a616ea8fb7b268240c6f7ff" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WImage.html">WImage</a>* Wt::WAnchor::image </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the image.
<p>
Returns <code>0</code> if no image is set.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#d9fc10558d724684b1fd9314aa5ea8e7" title="Sets an image.">setImage()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="169c32b60dcb5d4511a3cbdd4979c941"></a><!-- doxytag: member="Wt::WAnchor::setTarget" ref="169c32b60dcb5d4511a3cbdd4979c941" args="(AnchorTarget target)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::setTarget </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceWt.html#6c93a6e97016801a310275457e43f333">AnchorTarget</a> </td>
<td class="paramname"> <em>target</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the location where the referred content should be displayed.
<p>
By default, the referred content is displayed in the application (<a class="el" href="namespaceWt.html#6c93a6e97016801a310275457e43f333e976883723836b4423d81ecf590bde0c" title="Show Instead of the application.">Wt::TargetSelf</a>). When the destination is an HTML document, the application is replaced with the new document. When the reference is a document that cannot be displayed in the browser, it is offered for download or opened using an external program, depending on browser settings.<p>
By setting <code>target</code> to <a class="el" href="namespaceWt.html#6c93a6e97016801a310275457e43f33395e5b4e8a2eed99252fc0eb2bb483cd8" title="Show in a separate new tab or window.">Wt::TargetNewWindow</a>, the destination is displayed in a new browser window or tab.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#75c557c92118cf0cdaaad437f8d91ad5" title="Returns the location where the referred content should be displayed.">target()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="75c557c92118cf0cdaaad437f8d91ad5"></a><!-- doxytag: member="Wt::WAnchor::target" ref="75c557c92118cf0cdaaad437f8d91ad5" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceWt.html#6c93a6e97016801a310275457e43f333">AnchorTarget</a> Wt::WAnchor::target </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the location where the referred content should be displayed.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WAnchor.html#169c32b60dcb5d4511a3cbdd4979c941" title="Sets the location where the referred content should be displayed.">setTarget()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="188c6f7fa64408e9214c08292974834d"></a><!-- doxytag: member="Wt::WAnchor::enableAjax" ref="188c6f7fa64408e9214c08292974834d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WAnchor::enableAjax </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Progresses to an Ajax-enabled widget.
<p>
This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.<p>
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WApplication.html#78016406c4746c56b2c2ffce7c5e181f" title="Progresses to an Ajax-enabled user interface.">WApplication::enableAjax()</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classWt_1_1WWebWidget.html#2893433f4aa1d6775875f1ebddd7c5ba">Wt::WWebWidget</a>.</p>
</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:06 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>
|