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 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
|
<!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"/>
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/treeview-dragdrop/TreeViewDragDrop.C Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Wt examples
 <span id="projectnumber">3.2.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.5.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">/home/koen/project/wt/public-git/wt/examples/treeview-dragdrop/TreeViewDragDrop.C</div> </div>
</div>
<div class="contents">
<a href="TreeViewDragDrop_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * See the LICENSE file for terms of use.</span>
<a name="l00005"></a>00005 <span class="comment"> */</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include <fstream></span>
<a name="l00007"></a>00007
<a name="l00008"></a>00008 <span class="preprocessor">#include <Wt/WApplication></span>
<a name="l00009"></a>00009 <span class="preprocessor">#include <Wt/WComboBox></span>
<a name="l00010"></a>00010 <span class="preprocessor">#include <Wt/WContainerWidget></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include <Wt/WDatePicker></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include <Wt/WDateValidator></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include <Wt/WDialog></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include <Wt/WEnvironment></span>
<a name="l00015"></a>00015 <span class="preprocessor">#include <Wt/WIntValidator></span>
<a name="l00016"></a>00016 <span class="preprocessor">#include <Wt/WItemDelegate></span>
<a name="l00017"></a>00017 <span class="preprocessor">#include <Wt/WLabel></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include <Wt/WLineEdit></span>
<a name="l00019"></a>00019 <span class="preprocessor">#include <Wt/WMessageBox></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include <Wt/WPushButton></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include <Wt/WRegExpValidator></span>
<a name="l00022"></a>00022 <span class="preprocessor">#include <Wt/WGridLayout></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include <Wt/WPopupMenu></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include <Wt/WSortFilterProxyModel></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include <Wt/WStandardItem></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include <Wt/WStandardItemModel></span>
<a name="l00027"></a>00027 <span class="preprocessor">#include <Wt/WTableView></span>
<a name="l00028"></a>00028 <span class="preprocessor">#include <Wt/WTreeView></span>
<a name="l00029"></a>00029 <span class="preprocessor">#include <Wt/WText></span>
<a name="l00030"></a>00030 <span class="preprocessor">#include <Wt/WVBoxLayout></span>
<a name="l00031"></a>00031
<a name="l00032"></a>00032 <span class="preprocessor">#include <Wt/Chart/WPieChart></span>
<a name="l00033"></a>00033
<a name="l00034"></a>00034 <span class="preprocessor">#include "CsvUtil.h"</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="FolderView_8h.html">FolderView.h</a>"</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="keyword">using namespace </span>Wt;
<a name="l00038"></a>00038
<a name="l00043"></a>00043
<a name="l00051"></a><a class="code" href="classFileModel.html">00051</a> <span class="keyword">class </span><a class="code" href="classFileModel.html" title="A specialized standard item model which report a specific drag and drop mime type.">FileModel</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a>
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053 <span class="keyword">public</span>:
<a name="l00056"></a><a class="code" href="classFileModel.html#ad4119fe945be59b73258454065b70a44">00056</a> <a class="code" href="classFileModel.html" title="A specialized standard item model which report a specific drag and drop mime type.">FileModel</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html">WObject</a> *parent)
<a name="l00057"></a>00057 : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a>(parent) { }
<a name="l00058"></a>00058
<a name="l00061"></a><a class="code" href="classFileModel.html#a1d1b5545d4f6763071536ec8ce6bc2e6">00061</a> <span class="keyword">virtual</span> std::string <a class="code" href="classFileModel.html#a1d1b5545d4f6763071536ec8ce6bc2e6" title="Return the mime type.">mimeType</a>()<span class="keyword"> const </span>{
<a name="l00062"></a>00062 <span class="keywordflow">return</span> <a class="code" href="classFolderView.html#af50f30fffaedf2e6e4b1e0d65acc9df0" title="Constant that indicates the mime type for a selection of files.">FolderView::FileSelectionMimeType</a>;
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064
<a name="l00066"></a><a class="code" href="group__treeviewdragdrop.html#gaf69754b77374aac3aa0eed57360fbb7f">00066</a> <span class="keyword">static</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a> <a class="code" href="group__treeviewdragdrop.html#gaf69754b77374aac3aa0eed57360fbb7f" title="Date display format.">dateDisplayFormat</a>;
<a name="l00067"></a>00067
<a name="l00069"></a><a class="code" href="group__treeviewdragdrop.html#ga7bb540f8c352707933d4bd36c8282aba">00069</a> <span class="keyword">static</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a> <a class="code" href="group__treeviewdragdrop.html#ga7bb540f8c352707933d4bd36c8282aba" title="Date edit format.">dateEditFormat</a>;
<a name="l00070"></a>00070 };
<a name="l00071"></a>00071
<a name="l00072"></a>00072 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a> <a class="code" href="group__treeviewdragdrop.html#gaf69754b77374aac3aa0eed57360fbb7f" title="Date display format.">FileModel::dateDisplayFormat</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html#a17afc7c43b5b7a710047be4a2c639575">WString::fromUTF8</a>(<span class="stringliteral">"MMM dd, yyyy"</span>));
<a name="l00073"></a>00073 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a> <a class="code" href="group__treeviewdragdrop.html#ga7bb540f8c352707933d4bd36c8282aba" title="Date edit format.">FileModel::dateEditFormat</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html#a17afc7c43b5b7a710047be4a2c639575">WString::fromUTF8</a>(<span class="stringliteral">"dd-MM-yyyy"</span>));
<a name="l00074"></a>00074
<a name="l00078"></a><a class="code" href="classFileEditDialog.html">00078</a> <span class="keyword">class </span><a class="code" href="classFileEditDialog.html" title="A dialog for editing a 'file'.">FileEditDialog</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html">WDialog</a>
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080 <span class="keyword">public</span>:
<a name="l00081"></a><a class="code" href="classFileEditDialog.html#aa115f117a2c3d074a2c471049d29af83">00081</a> <a class="code" href="classFileEditDialog.html" title="A dialog for editing a 'file'.">FileEditDialog</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html">WAbstractItemModel</a> *model, <span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a>& item)
<a name="l00082"></a>00082 : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html">WDialog</a>(<span class="stringliteral">"Edit..."</span>),
<a name="l00083"></a>00083 model_(model),
<a name="l00084"></a>00084 item_(item)
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086 <span class="keywordtype">int</span> modelRow = item_.row();
<a name="l00087"></a>00087
<a name="l00088"></a>00088 resize(300, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLength.html#a0cf39ca4225776879d56ade60320c31a">WLength::Auto</a>);
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <span class="comment">/*</span>
<a name="l00091"></a>00091 <span class="comment"> * Create the form widgets, and load them with data from the model.</span>
<a name="l00092"></a>00092 <span class="comment"> */</span>
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <span class="comment">// name</span>
<a name="l00095"></a>00095 nameEdit_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html">WLineEdit</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#ga57b5cadd177847f51eaeb0cee23782c1">asString</a>(model_->data(modelRow, 1)));
<a name="l00096"></a>00096
<a name="l00097"></a>00097 <span class="comment">// type</span>
<a name="l00098"></a>00098 typeEdit_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WComboBox.html">WComboBox</a>();
<a name="l00099"></a>00099 typeEdit_->addItem(<span class="stringliteral">"Document"</span>);
<a name="l00100"></a>00100 typeEdit_->addItem(<span class="stringliteral">"Spreadsheet"</span>);
<a name="l00101"></a>00101 typeEdit_->addItem(<span class="stringliteral">"Presentation"</span>);
<a name="l00102"></a>00102 typeEdit_->setCurrentIndex
<a name="l00103"></a>00103 (typeEdit_->findText(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#ga57b5cadd177847f51eaeb0cee23782c1">asString</a>(model_->data(modelRow, 2))));
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <span class="comment">// size</span>
<a name="l00106"></a>00106 sizeEdit_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html">WLineEdit</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#ga57b5cadd177847f51eaeb0cee23782c1">asString</a>(model_->data(modelRow, 3)));
<a name="l00107"></a>00107 sizeEdit_->setValidator
<a name="l00108"></a>00108 (<span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WIntValidator.html">WIntValidator</a>(0, std::numeric_limits<int>::max(), <span class="keyword">this</span>));
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <span class="comment">// created</span>
<a name="l00111"></a>00111 createdPicker_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDatePicker.html">WDatePicker</a>();
<a name="l00112"></a>00112 createdPicker_->lineEdit()->validator()->setMandatory(<span class="keyword">true</span>);
<a name="l00113"></a>00113 createdPicker_->setFormat(<a class="code" href="group__treeviewdragdrop.html#ga7bb540f8c352707933d4bd36c8282aba" title="Date edit format.">FileModel::dateEditFormat</a>);
<a name="l00114"></a>00114 createdPicker_->setDate(boost::any_cast<WDate>(model_->data(modelRow, 4)));
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <span class="comment">// modified</span>
<a name="l00117"></a>00117 modifiedPicker_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDatePicker.html">WDatePicker</a>();
<a name="l00118"></a>00118 modifiedPicker_->lineEdit()->validator()->setMandatory(<span class="keyword">true</span>);
<a name="l00119"></a>00119 modifiedPicker_->setFormat(<a class="code" href="group__treeviewdragdrop.html#ga7bb540f8c352707933d4bd36c8282aba" title="Date edit format.">FileModel::dateEditFormat</a>);
<a name="l00120"></a>00120 modifiedPicker_->setDate(boost::any_cast<WDate>(model_->data(modelRow, 5)));
<a name="l00121"></a>00121
<a name="l00122"></a>00122 <span class="comment">/*</span>
<a name="l00123"></a>00123 <span class="comment"> * Use a grid layout for the labels and fields</span>
<a name="l00124"></a>00124 <span class="comment"> */</span>
<a name="l00125"></a>00125 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html">WGridLayout</a> *layout = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html">WGridLayout</a>();
<a name="l00126"></a>00126
<a name="l00127"></a>00127 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html">WLabel</a> *l;
<a name="l00128"></a>00128 <span class="keywordtype">int</span> row = 0;
<a name="l00129"></a>00129
<a name="l00130"></a>00130 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(l = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html">WLabel</a>(<span class="stringliteral">"Name:"</span>), row, 0);
<a name="l00131"></a>00131 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(nameEdit_, row, 1);
<a name="l00132"></a>00132 l-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html#af468c613eab7d184c68fd6ae20978de5">setBuddy</a>(nameEdit_);
<a name="l00133"></a>00133 ++row;
<a name="l00134"></a>00134
<a name="l00135"></a>00135 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(l = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html">WLabel</a>(<span class="stringliteral">"Type:"</span>), row, 0);
<a name="l00136"></a>00136 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(typeEdit_, row, 1, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa58fe5182bd266132c59718c6d30945a9">AlignTop</a>);
<a name="l00137"></a>00137 l-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html#af468c613eab7d184c68fd6ae20978de5">setBuddy</a>(typeEdit_);
<a name="l00138"></a>00138 ++row;
<a name="l00139"></a>00139
<a name="l00140"></a>00140 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(l = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html">WLabel</a>(<span class="stringliteral">"Size:"</span>), row, 0);
<a name="l00141"></a>00141 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(sizeEdit_, row, 1);
<a name="l00142"></a>00142 l-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html#af468c613eab7d184c68fd6ae20978de5">setBuddy</a>(sizeEdit_);
<a name="l00143"></a>00143 ++row;
<a name="l00144"></a>00144
<a name="l00145"></a>00145 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(l = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html">WLabel</a>(<span class="stringliteral">"Created:"</span>), row, 0);
<a name="l00146"></a>00146 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(createdPicker_->lineEdit(), row, 1);
<a name="l00147"></a>00147 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(createdPicker_, row, 2);
<a name="l00148"></a>00148 l-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html#af468c613eab7d184c68fd6ae20978de5">setBuddy</a>(createdPicker_->lineEdit());
<a name="l00149"></a>00149 ++row;
<a name="l00150"></a>00150
<a name="l00151"></a>00151 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(l = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html">WLabel</a>(<span class="stringliteral">"Modified:"</span>), row, 0);
<a name="l00152"></a>00152 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(modifiedPicker_->lineEdit(), row, 1);
<a name="l00153"></a>00153 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(modifiedPicker_, row, 2);
<a name="l00154"></a>00154 l-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLabel.html#af468c613eab7d184c68fd6ae20978de5">setBuddy</a>(modifiedPicker_->lineEdit());
<a name="l00155"></a>00155 ++row;
<a name="l00156"></a>00156
<a name="l00157"></a>00157 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a> *b;
<a name="l00158"></a>00158 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *buttons = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>();
<a name="l00159"></a>00159 buttons-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(b = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a>(<span class="stringliteral">"Save"</span>));
<a name="l00160"></a>00160 b-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<span class="keyword">this</span>, &<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html#afab6f75ebb2d2970ebe0bbf1cf19f288">WDialog::accept</a>);
<a name="l00161"></a>00161 contents()->enterPressed().connect(<span class="keyword">this</span>, &<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html#afab6f75ebb2d2970ebe0bbf1cf19f288">WDialog::accept</a>);
<a name="l00162"></a>00162 buttons-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(b = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a>(<span class="stringliteral">"Cancel"</span>));
<a name="l00163"></a>00163 b-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<span class="keyword">this</span>, &<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html#afcff2ea14c4ae79b2fc7bac1a86b0062">WDialog::reject</a>);
<a name="l00164"></a>00164
<a name="l00165"></a>00165 <span class="comment">/*</span>
<a name="l00166"></a>00166 <span class="comment"> * Focus the form widget that corresonds to the selected item.</span>
<a name="l00167"></a>00167 <span class="comment"> */</span>
<a name="l00168"></a>00168 <span class="keywordflow">switch</span> (item.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a0e6568dd7113662c3c378e2084729581">column</a>()) {
<a name="l00169"></a>00169 <span class="keywordflow">case</span> 2:
<a name="l00170"></a>00170 typeEdit_->setFocus(); <span class="keywordflow">break</span>;
<a name="l00171"></a>00171 <span class="keywordflow">case</span> 3:
<a name="l00172"></a>00172 sizeEdit_->setFocus(); <span class="keywordflow">break</span>;
<a name="l00173"></a>00173 <span class="keywordflow">case</span> 4:
<a name="l00174"></a>00174 createdPicker_->lineEdit()->setFocus(); <span class="keywordflow">break</span>;
<a name="l00175"></a>00175 <span class="keywordflow">case</span> 5:
<a name="l00176"></a>00176 modifiedPicker_->lineEdit()->setFocus(); <span class="keywordflow">break</span>;
<a name="l00177"></a>00177 <span class="keywordflow">default</span>:
<a name="l00178"></a>00178 nameEdit_->setFocus(); <span class="keywordflow">break</span>;
<a name="l00179"></a>00179 }
<a name="l00180"></a>00180
<a name="l00181"></a>00181 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(buttons, row, 0, 0, 3, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa121104cdbb5db77c7d038813a93998e5">AlignCenter</a>);
<a name="l00182"></a>00182 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a4605de0523f5613096b6cbd983123c8b">setColumnStretch</a>(1, 1);
<a name="l00183"></a>00183
<a name="l00184"></a>00184 contents()->setLayout(layout, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa58fe5182bd266132c59718c6d30945a9">AlignTop</a> | <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa18cdf9d975a5a41afa182aabfde0de88">AlignJustify</a>);
<a name="l00185"></a>00185
<a name="l00186"></a>00186 finished().connect(<span class="keyword">this</span>, &<a class="code" href="classFileEditDialog.html#a301f7cef04b5cbd1a5f3f5ce5c2cee9a">FileEditDialog::handleFinish</a>);
<a name="l00187"></a>00187
<a name="l00188"></a>00188 show();
<a name="l00189"></a>00189 }
<a name="l00190"></a>00190
<a name="l00191"></a>00191 <span class="keyword">private</span>:
<a name="l00192"></a><a class="code" href="classFileEditDialog.html#a6b753d0d0ce374018cf55664caf7a471">00192</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html">WAbstractItemModel</a> *<a class="code" href="classFileEditDialog.html#a6b753d0d0ce374018cf55664caf7a471">model_</a>;
<a name="l00193"></a><a class="code" href="classFileEditDialog.html#a373d25cfaf212d465426b18df5bbf0a0">00193</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a> <a class="code" href="classFileEditDialog.html#a373d25cfaf212d465426b18df5bbf0a0">item_</a>;
<a name="l00194"></a>00194
<a name="l00195"></a><a class="code" href="classFileEditDialog.html#a83d6bb7ac66a916d969f3b1cd688907c">00195</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html">WLineEdit</a> *nameEdit_, *<a class="code" href="classFileEditDialog.html#a83d6bb7ac66a916d969f3b1cd688907c">sizeEdit_</a>;
<a name="l00196"></a><a class="code" href="classFileEditDialog.html#a956d2a65bc1e5c6683b98bf96c61ad20">00196</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WComboBox.html">WComboBox</a> *<a class="code" href="classFileEditDialog.html#a956d2a65bc1e5c6683b98bf96c61ad20">typeEdit_</a>;
<a name="l00197"></a><a class="code" href="classFileEditDialog.html#a8bcaf0a8a9d414797b9c6a9895891054">00197</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDatePicker.html">WDatePicker</a> *createdPicker_, *<a class="code" href="classFileEditDialog.html#a8bcaf0a8a9d414797b9c6a9895891054">modifiedPicker_</a>;
<a name="l00198"></a>00198
<a name="l00199"></a><a class="code" href="classFileEditDialog.html#a301f7cef04b5cbd1a5f3f5ce5c2cee9a">00199</a> <span class="keywordtype">void</span> handleFinish(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html#a6f4bab24bf9e39be422bb6d9637268e6">DialogCode</a> result)
<a name="l00200"></a>00200 {
<a name="l00201"></a>00201 <span class="keywordflow">if</span> (result == <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDialog.html#a6f4bab24bf9e39be422bb6d9637268e6ad4852d715c07070ca1b117cb7e263840">WDialog::Accepted</a>) {
<a name="l00202"></a>00202 <span class="comment">/*</span>
<a name="l00203"></a>00203 <span class="comment"> * Update the model with data from the edit widgets.</span>
<a name="l00204"></a>00204 <span class="comment"> *</span>
<a name="l00205"></a>00205 <span class="comment"> * You will want to do some validation here...</span>
<a name="l00206"></a>00206 <span class="comment"> *</span>
<a name="l00207"></a>00207 <span class="comment"> * Note that we directly update the source model to avoid</span>
<a name="l00208"></a>00208 <span class="comment"> * problems caused by the dynamic sorting of the proxy model,</span>
<a name="l00209"></a>00209 <span class="comment"> * which reorders row numbers, and would cause us to switch to editing</span>
<a name="l00210"></a>00210 <span class="comment"> * the wrong data.</span>
<a name="l00211"></a>00211 <span class="comment"> */</span>
<a name="l00212"></a>00212 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html">WAbstractItemModel</a> *m = model_;
<a name="l00213"></a>00213 <span class="keywordtype">int</span> modelRow = item_.row();
<a name="l00214"></a>00214
<a name="l00215"></a>00215 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractProxyModel.html">WAbstractProxyModel</a> *proxyModel = <span class="keyword">dynamic_cast<</span><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractProxyModel.html">WAbstractProxyModel</a> *<span class="keyword">></span>(m);
<a name="l00216"></a>00216 <span class="keywordflow">if</span> (proxyModel) {
<a name="l00217"></a>00217 m = proxyModel-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractProxyModel.html#a553fbfaa929ade5275a57186eaf7f2bf">sourceModel</a>();
<a name="l00218"></a>00218 modelRow = proxyModel-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractProxyModel.html#ac36b0ee3110073578da8b999d1882bf7">mapToSource</a>(item_).<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#aa4f1385223391c46ee200a57672f6046">row</a>();
<a name="l00219"></a>00219 }
<a name="l00220"></a>00220
<a name="l00221"></a>00221 m-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(modelRow, 1, boost::any(nameEdit_->text()));
<a name="l00222"></a>00222 m-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(modelRow, 2, boost::any(typeEdit_->currentText()));
<a name="l00223"></a>00223 m-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(modelRow, 3, boost::any(boost::lexical_cast<int>
<a name="l00224"></a>00224 (sizeEdit_->text().toUTF8())));
<a name="l00225"></a>00225 m-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(modelRow, 4, boost::any(createdPicker_->date()));
<a name="l00226"></a>00226 m-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943">setData</a>(modelRow, 5, boost::any(modifiedPicker_->date()));
<a name="l00227"></a>00227 }
<a name="l00228"></a>00228
<a name="l00229"></a>00229 <span class="keyword">delete</span> <span class="keyword">this</span>;
<a name="l00230"></a>00230 }
<a name="l00231"></a>00231
<a name="l00232"></a>00232 };
<a name="l00233"></a>00233
<a name="l00237"></a><a class="code" href="classTreeViewDragDrop.html">00237</a> <span class="keyword">class </span><a class="code" href="classTreeViewDragDrop.html" title="Main application class.">TreeViewDragDrop</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>
<a name="l00238"></a>00238 {
<a name="l00239"></a>00239 <span class="keyword">public</span>:
<a name="l00242"></a><a class="code" href="classTreeViewDragDrop.html#ac45351bd9b49bb4734dfc060f0ffba2d">00242</a> <a class="code" href="classTreeViewDragDrop.html" title="Main application class.">TreeViewDragDrop</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a> &env)
<a name="l00243"></a>00243 : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>(env),
<a name="l00244"></a>00244 popup_(0),
<a name="l00245"></a>00245 popupActionBox_(0)
<a name="l00246"></a>00246 {
<a name="l00247"></a>00247 setCssTheme(<span class="stringliteral">"polished"</span>);
<a name="l00248"></a>00248
<a name="l00249"></a>00249 <span class="comment">/*</span>
<a name="l00250"></a>00250 <span class="comment"> * Create the data models.</span>
<a name="l00251"></a>00251 <span class="comment"> */</span>
<a name="l00252"></a>00252 folderModel_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a>(0, 1, <span class="keyword">this</span>);
<a name="l00253"></a>00253 populateFolders();
<a name="l00254"></a>00254
<a name="l00255"></a>00255 fileModel_ = <span class="keyword">new</span> <a class="code" href="classFileModel.html" title="A specialized standard item model which report a specific drag and drop mime type.">FileModel</a>(<span class="keyword">this</span>);
<a name="l00256"></a>00256 populateFiles();
<a name="l00257"></a>00257
<a name="l00258"></a>00258 <span class="comment">/*</span>
<a name="l00259"></a>00259 <span class="comment"> The header items are also endered using an ItemDelegate, and thus</span>
<a name="l00260"></a>00260 <span class="comment"> support other data, e.g.:</span>
<a name="l00261"></a>00261 <span class="comment"></span>
<a name="l00262"></a>00262 <span class="comment"> fileModel_->setHeaderFlags(0, Horizontal, HeaderIsUserCheckable);</span>
<a name="l00263"></a>00263 <span class="comment"> fileModel_->setHeaderData(0, Horizontal,</span>
<a name="l00264"></a>00264 <span class="comment"> std::string("icons/file.gif"),</span>
<a name="l00265"></a>00265 <span class="comment"> Wt::DecorationRole);</span>
<a name="l00266"></a>00266 <span class="comment"> */</span>
<a name="l00267"></a>00267 fileFilterModel_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WSortFilterProxyModel.html">WSortFilterProxyModel</a>(<span class="keyword">this</span>);
<a name="l00268"></a>00268 fileFilterModel_->setSourceModel(fileModel_);
<a name="l00269"></a>00269 fileFilterModel_->setDynamicSortFilter(<span class="keyword">true</span>);
<a name="l00270"></a>00270 fileFilterModel_->setFilterKeyColumn(0);
<a name="l00271"></a>00271 fileFilterModel_->setFilterRole(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">UserRole</a>);
<a name="l00272"></a>00272
<a name="l00273"></a>00273 <span class="comment">/*</span>
<a name="l00274"></a>00274 <span class="comment"> * Setup the user interface.</span>
<a name="l00275"></a>00275 <span class="comment"> */</span>
<a name="l00276"></a>00276 createUI();
<a name="l00277"></a>00277 }
<a name="l00278"></a>00278
<a name="l00279"></a><a class="code" href="classTreeViewDragDrop.html#a4fbf9013946ad4ddd9ca2d16113921eb">00279</a> <span class="keyword">virtual</span> <a class="code" href="classTreeViewDragDrop.html#a4fbf9013946ad4ddd9ca2d16113921eb">~TreeViewDragDrop</a>() {
<a name="l00280"></a>00280 <span class="keyword">delete</span> popup_;
<a name="l00281"></a>00281 <span class="keyword">delete</span> popupActionBox_;
<a name="l00282"></a>00282 }
<a name="l00283"></a>00283
<a name="l00284"></a>00284 <span class="keyword">private</span>:
<a name="l00286"></a><a class="code" href="classTreeViewDragDrop.html#a8ca159dd6adba348b44caacd40ddd128">00286</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a> *<a class="code" href="classTreeViewDragDrop.html#a8ca159dd6adba348b44caacd40ddd128" title="The folder model (used by folderView_)">folderModel_</a>;
<a name="l00287"></a>00287
<a name="l00289"></a><a class="code" href="classTreeViewDragDrop.html#aa37c4c6162e2c924585943ebe782a820">00289</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a> *<a class="code" href="classTreeViewDragDrop.html#aa37c4c6162e2c924585943ebe782a820" title="The file model (used by fileView_)">fileModel_</a>;
<a name="l00290"></a>00290
<a name="l00292"></a><a class="code" href="classTreeViewDragDrop.html#a19119108885a86409206046fa915d2b5">00292</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WSortFilterProxyModel.html">WSortFilterProxyModel</a> *<a class="code" href="classTreeViewDragDrop.html#a19119108885a86409206046fa915d2b5" title="The sort filter proxy model that adapts fileModel_.">fileFilterModel_</a>;
<a name="l00293"></a>00293
<a name="l00295"></a><a class="code" href="classTreeViewDragDrop.html#a1aad35507448e8a8a59a0961d2c8ae5c">00295</a> std::map<std::string, WString> <a class="code" href="classTreeViewDragDrop.html#a1aad35507448e8a8a59a0961d2c8ae5c" title="Maps folder id's to folder descriptions.">folderNameMap_</a>;
<a name="l00296"></a>00296
<a name="l00298"></a><a class="code" href="classTreeViewDragDrop.html#aed25ae86735ea2e25de9eeafa2f9f0ea">00298</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html">WTreeView</a> *<a class="code" href="classTreeViewDragDrop.html#aed25ae86735ea2e25de9eeafa2f9f0ea" title="The folder view.">folderView_</a>;
<a name="l00299"></a>00299
<a name="l00301"></a><a class="code" href="classTreeViewDragDrop.html#a9b44505d2a75e28e7ed81e38f9abb7b6">00301</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html">WTableView</a> *<a class="code" href="classTreeViewDragDrop.html#a9b44505d2a75e28e7ed81e38f9abb7b6" title="The file view.">fileView_</a>;
<a name="l00302"></a>00302
<a name="l00304"></a><a class="code" href="classTreeViewDragDrop.html#a3fd09573ea89f5b8cadd2eb357af8b3a">00304</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPopupMenu.html">WPopupMenu</a> *<a class="code" href="classTreeViewDragDrop.html#a3fd09573ea89f5b8cadd2eb357af8b3a" title="Popup menu on the folder view.">popup_</a>;
<a name="l00305"></a>00305
<a name="l00307"></a><a class="code" href="classTreeViewDragDrop.html#a0f9c6ce8eb2765dbb97a213d618162c8">00307</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMessageBox.html">WMessageBox</a> *<a class="code" href="classTreeViewDragDrop.html#a0f9c6ce8eb2765dbb97a213d618162c8" title="Message box to confirm the poup menu action.">popupActionBox_</a>;
<a name="l00308"></a>00308
<a name="l00311"></a><a class="code" href="classTreeViewDragDrop.html#a4f0c1c90a10f77bf01a3491a44d95510">00311</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#a4f0c1c90a10f77bf01a3491a44d95510" title="Setup the user interface.">createUI</a>() {
<a name="l00312"></a>00312 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *w = root();
<a name="l00313"></a>00313 w-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">"maindiv"</span>);
<a name="l00314"></a>00314
<a name="l00315"></a>00315 <span class="comment">/*</span>
<a name="l00316"></a>00316 <span class="comment"> * The main layout is a 3x2 grid layout.</span>
<a name="l00317"></a>00317 <span class="comment"> */</span>
<a name="l00318"></a>00318 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html">WGridLayout</a> *layout = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html">WGridLayout</a>();
<a name="l00319"></a>00319 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(createTitle(<span class="stringliteral">"Folders"</span>), 0, 0);
<a name="l00320"></a>00320 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(createTitle(<span class="stringliteral">"Files"</span>), 0, 1);
<a name="l00321"></a>00321 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(folderView(), 1, 0);
<a name="l00322"></a>00322 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a180c33a8f9e21a7b58f12e055fdb469e">setColumnResizable</a>(0);
<a name="l00323"></a>00323
<a name="l00324"></a>00324 <span class="comment">// select the first folder</span>
<a name="l00325"></a>00325 folderView_->select(folderModel_->index(0, 0, folderModel_->index(0, 0)));
<a name="l00326"></a>00326
<a name="l00327"></a>00327 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WVBoxLayout.html">WVBoxLayout</a> *vbox = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WVBoxLayout.html">WVBoxLayout</a>();
<a name="l00328"></a>00328 vbox-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a7c1ec58e25d0b7add93f5f4342844db6">addWidget</a>(fileView(), 1);
<a name="l00329"></a>00329 vbox-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a7c1ec58e25d0b7add93f5f4342844db6">addWidget</a>(pieChart(), 1);
<a name="l00330"></a>00330 vbox-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a00bdfb4d442bd8e8ad9c33b72692763f">setResizable</a>(0);
<a name="l00331"></a>00331
<a name="l00332"></a>00332 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a8e0ae47aa0e7283ce3d4be05249c05eb">addLayout</a>(vbox, 1, 1);
<a name="l00333"></a>00333
<a name="l00334"></a>00334 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a6e64afee237de5665fcd014f407130b2">addWidget</a>(aboutDisplay(), 2, 0, 1, 2, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa58fe5182bd266132c59718c6d30945a9">AlignTop</a>);
<a name="l00335"></a>00335
<a name="l00336"></a>00336 <span class="comment">/*</span>
<a name="l00337"></a>00337 <span class="comment"> * Let row 1 and column 1 take the excess space.</span>
<a name="l00338"></a>00338 <span class="comment"> */</span>
<a name="l00339"></a>00339 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#ad8d1199b57063fb7286be6dab13c998c">setRowStretch</a>(1, 1);
<a name="l00340"></a>00340 layout-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WGridLayout.html#a4605de0523f5613096b6cbd983123c8b">setColumnStretch</a>(1, 1);
<a name="l00341"></a>00341
<a name="l00342"></a>00342 w-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a1c84e0ffe330d4798f0ce217f75be08c">setLayout</a>(layout);
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344
<a name="l00347"></a><a class="code" href="classTreeViewDragDrop.html#a844146104eb081558c89126418f57965">00347</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *<a class="code" href="classTreeViewDragDrop.html#a844146104eb081558c89126418f57965" title="Creates a title widget.">createTitle</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a>& title) {
<a name="l00348"></a>00348 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *result = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(title);
<a name="l00349"></a>00349 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad0957c892e70c6bf5399cf71e66f3e11">setInline</a>(<span class="keyword">false</span>);
<a name="l00350"></a>00350 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">"title"</span>);
<a name="l00351"></a>00351
<a name="l00352"></a>00352 <span class="keywordflow">return</span> result;
<a name="l00353"></a>00353 }
<a name="l00354"></a>00354
<a name="l00357"></a><a class="code" href="classTreeViewDragDrop.html#a57c9da1b5ea0cfafeb0b331077e7aeaa">00357</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html">WTreeView</a> *<a class="code" href="classTreeViewDragDrop.html#a57c9da1b5ea0cfafeb0b331077e7aeaa" title="Creates the folder WTreeView.">folderView</a>() {
<a name="l00358"></a>00358 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html">WTreeView</a> *treeView = <span class="keyword">new</span> <a class="code" href="classFolderView.html" title="A specialized treeview that supports a custom drop event.">FolderView</a>();
<a name="l00359"></a>00359
<a name="l00360"></a>00360 <span class="comment">/*</span>
<a name="l00361"></a>00361 <span class="comment"> * To support right-click, we need to disable the built-in browser</span>
<a name="l00362"></a>00362 <span class="comment"> * context menu.</span>
<a name="l00363"></a>00363 <span class="comment"> *</span>
<a name="l00364"></a>00364 <span class="comment"> * Note that disabling the context menu and catching the</span>
<a name="l00365"></a>00365 <span class="comment"> * right-click does not work reliably on all browsers.</span>
<a name="l00366"></a>00366 <span class="comment"> */</span>
<a name="l00367"></a>00367 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCompositeWidget.html#a874b7a77d0785623f5059ad4dfe93266">setAttributeValue</a>
<a name="l00368"></a>00368 (<span class="stringliteral">"oncontextmenu"</span>,
<a name="l00369"></a>00369 <span class="stringliteral">"event.cancelBubble = true; event.returnValue = false; return false;"</span>);
<a name="l00370"></a>00370 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a390300f766472476e6a0df5aefaa2ef0">setModel</a>(folderModel_);
<a name="l00371"></a>00371 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a482314306c8404d7ed941fd986e32623">resize</a>(200, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLength.html#a0cf39ca4225776879d56ade60320c31a">WLength::Auto</a>);
<a name="l00372"></a>00372 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#af6fcd9761e2f7a3b497d3563c849d320">setSelectionMode</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a74b3f7eb1689a3cbf0ea514ffd20bccca4fd3c5ba6ce5289a1e732d85f002882a">SingleSelection</a>);
<a name="l00373"></a>00373 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#add40d3e05352ae094f6fe2b9c879c2c7">expandToDepth</a>(1);
<a name="l00374"></a>00374 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#ada37ffbe2d470dd227c8714645f150f0">selectionChanged</a>()
<a name="l00375"></a>00375 .<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a15d1150af031537b492674ee651bf4a3">connect</a>(<span class="keyword">this</span>, &<a class="code" href="classTreeViewDragDrop.html#a07188816373ee97848dff41b21f68f21" title="Change the filter on the file view when the selected folder changes.">TreeViewDragDrop::folderChanged</a>);
<a name="l00376"></a>00376
<a name="l00377"></a>00377 treeView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#a0231396a3e026781c600645c24fff616">mouseWentUp</a>().connect(<span class="keyword">this</span>, &<a class="code" href="classTreeViewDragDrop.html#aa9b567b2caea51f6348c784591dc27af" title="Show a popup for a folder item.">TreeViewDragDrop::showPopup</a>);
<a name="l00378"></a>00378
<a name="l00379"></a>00379 folderView_ = treeView;
<a name="l00380"></a>00380
<a name="l00381"></a>00381 <span class="keywordflow">return</span> treeView;
<a name="l00382"></a>00382 }
<a name="l00383"></a>00383
<a name="l00386"></a><a class="code" href="classTreeViewDragDrop.html#a12d3aa730625238df1cdedeeb9d6e321">00386</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html">WTableView</a> *<a class="code" href="classTreeViewDragDrop.html#a12d3aa730625238df1cdedeeb9d6e321" title="Creates the file table view (a WTableView)">fileView</a>() {
<a name="l00387"></a>00387 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html">WTableView</a> *tableView = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html">WTableView</a>();
<a name="l00388"></a>00388
<a name="l00389"></a>00389 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#afbc128d312f1d5aa75c65352cb43e4ca">setAlternatingRowColors</a>(<span class="keyword">true</span>);
<a name="l00390"></a>00390
<a name="l00391"></a>00391 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#a2e3629fbaee86da21c77c4583efb79ed">setModel</a>(fileFilterModel_);
<a name="l00392"></a>00392 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#af6fcd9761e2f7a3b497d3563c849d320">setSelectionMode</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a74b3f7eb1689a3cbf0ea514ffd20bccca7784d55577e92022399052c3d4d69954">ExtendedSelection</a>);
<a name="l00393"></a>00393 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#a0ca99b835708d990b90000917045738e">setDragEnabled</a>(<span class="keyword">true</span>);
<a name="l00394"></a>00394
<a name="l00395"></a>00395 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#af37d27044e96919e2fa6af4e25f3ef67">setColumnWidth</a>(0, 100);
<a name="l00396"></a>00396 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#af37d27044e96919e2fa6af4e25f3ef67">setColumnWidth</a>(1, 150);
<a name="l00397"></a>00397 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#af37d27044e96919e2fa6af4e25f3ef67">setColumnWidth</a>(2, 100);
<a name="l00398"></a>00398 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#af37d27044e96919e2fa6af4e25f3ef67">setColumnWidth</a>(3, 60);
<a name="l00399"></a>00399 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#af37d27044e96919e2fa6af4e25f3ef67">setColumnWidth</a>(4, 100);
<a name="l00400"></a>00400 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableView.html#af37d27044e96919e2fa6af4e25f3ef67">setColumnWidth</a>(5, 100);
<a name="l00401"></a>00401
<a name="l00402"></a>00402 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WItemDelegate.html">WItemDelegate</a> *delegate = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WItemDelegate.html">WItemDelegate</a>(<span class="keyword">this</span>);
<a name="l00403"></a>00403 delegate-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WItemDelegate.html#ad886d265dc00b95d9fb90c022a6322f9">setTextFormat</a>(<a class="code" href="group__treeviewdragdrop.html#gaf69754b77374aac3aa0eed57360fbb7f" title="Date display format.">FileModel::dateDisplayFormat</a>);
<a name="l00404"></a>00404 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#a574bc36ec752012ba4a613e0e11e064e">setItemDelegateForColumn</a>(4, delegate);
<a name="l00405"></a>00405 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#a574bc36ec752012ba4a613e0e11e064e">setItemDelegateForColumn</a>(5, delegate);
<a name="l00406"></a>00406
<a name="l00407"></a>00407 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#aafd2a6edd366b620c71d9b3a89ed6590">setColumnAlignment</a>(3, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fab250310385383f0b2f68d4e0ad5567e1">AlignRight</a>);
<a name="l00408"></a>00408 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#aafd2a6edd366b620c71d9b3a89ed6590">setColumnAlignment</a>(4, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fab250310385383f0b2f68d4e0ad5567e1">AlignRight</a>);
<a name="l00409"></a>00409 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#aafd2a6edd366b620c71d9b3a89ed6590">setColumnAlignment</a>(5, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fab250310385383f0b2f68d4e0ad5567e1">AlignRight</a>);
<a name="l00410"></a>00410
<a name="l00411"></a>00411 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#af782069e7307d3a4ce2395336f338c4e">sortByColumn</a>(1, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga4173856040cf108a9c7360927a43ebacac2e51e9fbb9a1250c908443700e03d3e">AscendingOrder</a>);
<a name="l00412"></a>00412
<a name="l00413"></a>00413 tableView-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#a14ac099f58621d66834aa5674ea8ecb5">doubleClicked</a>().connect(<span class="keyword">this</span>, &<a class="code" href="classTreeViewDragDrop.html#a21bbc7e94625cf982d29e2694a07c9d4" title="Edit a particular row.">TreeViewDragDrop::editFile</a>);
<a name="l00414"></a>00414
<a name="l00415"></a>00415 fileView_ = tableView;
<a name="l00416"></a>00416
<a name="l00417"></a>00417 <span class="keywordflow">return</span> tableView;
<a name="l00418"></a>00418 }
<a name="l00419"></a>00419
<a name="l00422"></a><a class="code" href="classTreeViewDragDrop.html#a21bbc7e94625cf982d29e2694a07c9d4">00422</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#a21bbc7e94625cf982d29e2694a07c9d4" title="Edit a particular row.">editFile</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a>& item) {
<a name="l00423"></a>00423 <span class="keyword">new</span> <a class="code" href="classFileEditDialog.html" title="A dialog for editing a 'file'.">FileEditDialog</a>(fileView_->model(), item);
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425
<a name="l00428"></a><a class="code" href="classTreeViewDragDrop.html#a1c221a8239b067f782ce1f5f79bb0a9a">00428</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classTreeViewDragDrop.html#a1c221a8239b067f782ce1f5f79bb0a9a" title="Creates the chart.">pieChart</a>() {
<a name="l00429"></a>00429 <span class="keyword">using namespace </span>Chart;
<a name="l00430"></a>00430
<a name="l00431"></a>00431 WPieChart *chart = <span class="keyword">new</span> WPieChart();
<a name="l00432"></a>00432 chart->setModel(fileFilterModel_);
<a name="l00433"></a>00433 chart->setTitle(<span class="stringliteral">"File sizes"</span>);
<a name="l00434"></a>00434
<a name="l00435"></a>00435 chart->setLabelsColumn(1); <span class="comment">// Name</span>
<a name="l00436"></a>00436 chart->setDataColumn(3); <span class="comment">// Size</span>
<a name="l00437"></a>00437
<a name="l00438"></a>00438 chart->setPerspectiveEnabled(<span class="keyword">true</span>, 0.2);
<a name="l00439"></a>00439 chart->setDisplayLabels(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga9345394a8eeda6800d8a24c5df44d983a88861128e109b6a63e76a311dc57e408">Outside</a> | <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__charts.html#gga9345394a8eeda6800d8a24c5df44d983a60df9add81425373c20fafe8c4e40b0e">TextLabel</a>);
<a name="l00440"></a>00440
<a name="l00441"></a>00441 <span class="keywordflow">if</span> (!<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a38d922da0a0d83395519f3eaab85d0f6">WApplication::instance</a>()->environment().ajax()) {
<a name="l00442"></a>00442 chart->resize(500, 200);
<a name="l00443"></a>00443 chart->setMargin(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLength.html#a0cf39ca4225776879d56ade60320c31a">WLength::Auto</a>, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a5a6f4636bcc6ab3c075165d249b3a5a3a6568fecac7c7d7223afaed240bcfdd9e">Left</a> | <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a5a6f4636bcc6ab3c075165d249b3a5a3acf431c3ce5eb6f14c0390feb14a68004">Right</a>);
<a name="l00444"></a>00444 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *w = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>();
<a name="l00445"></a>00445 w-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(chart);
<a name="l00446"></a>00446 w-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">"about"</span>);
<a name="l00447"></a>00447 <span class="keywordflow">return</span> w;
<a name="l00448"></a>00448 } <span class="keywordflow">else</span> {
<a name="l00449"></a>00449 chart-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">"about"</span>);
<a name="l00450"></a>00450 <span class="keywordflow">return</span> chart;
<a name="l00451"></a>00451 }
<a name="l00452"></a>00452 }
<a name="l00453"></a>00453
<a name="l00456"></a><a class="code" href="classTreeViewDragDrop.html#aeb1dbfae32f6693fc46560341705f7a3">00456</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classTreeViewDragDrop.html#aeb1dbfae32f6693fc46560341705f7a3" title="Creates the hints text.">aboutDisplay</a>() {
<a name="l00457"></a>00457 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *result = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html#a0afc7dc0f9897456d71b569a86ca26c1">WString::tr</a>(<span class="stringliteral">"about-text"</span>));
<a name="l00458"></a>00458 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">"about"</span>);
<a name="l00459"></a>00459 <span class="keywordflow">return</span> result;
<a name="l00460"></a>00460 }
<a name="l00461"></a>00461
<a name="l00465"></a><a class="code" href="classTreeViewDragDrop.html#a07188816373ee97848dff41b21f68f21">00465</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#a07188816373ee97848dff41b21f68f21" title="Change the filter on the file view when the selected folder changes.">folderChanged</a>() {
<a name="l00466"></a>00466 <span class="keywordflow">if</span> (folderView_->selectedIndexes().empty())
<a name="l00467"></a>00467 <span class="keywordflow">return</span>;
<a name="l00468"></a>00468
<a name="l00469"></a>00469 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a> selected = *folderView_->selectedIndexes().begin();
<a name="l00470"></a>00470 boost::any d = selected.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a7f05920329ca4b7fdbb10931afdb634e">data</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">UserRole</a>);
<a name="l00471"></a>00471 <span class="keywordflow">if</span> (!d.empty()) {
<a name="l00472"></a>00472 std::string folder = boost::any_cast<std::string>(d);
<a name="l00473"></a>00473
<a name="l00474"></a>00474 <span class="comment">// For simplicity, we assume here that the folder-id does not</span>
<a name="l00475"></a>00475 <span class="comment">// contain special regexp characters, otherwise these need to be</span>
<a name="l00476"></a>00476 <span class="comment">// escaped -- or use the \Q \E qutoing escape regular expression</span>
<a name="l00477"></a>00477 <span class="comment">// syntax (and escape \E)</span>
<a name="l00478"></a>00478 fileFilterModel_->setFilterRegExp(folder);
<a name="l00479"></a>00479 }
<a name="l00480"></a>00480 }
<a name="l00481"></a>00481
<a name="l00484"></a><a class="code" href="classTreeViewDragDrop.html#aa9b567b2caea51f6348c784591dc27af">00484</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#aa9b567b2caea51f6348c784591dc27af" title="Show a popup for a folder item.">showPopup</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a>& item, <span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMouseEvent.html">WMouseEvent</a>& event) {
<a name="l00485"></a>00485 <span class="keywordflow">if</span> (event.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMouseEvent.html#afc2a69f4301a3c8be46b8bfde23d6835">button</a>() == <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMouseEvent.html#a67958762760e6aa6973109a7b3d46210a3680e4c90e452cb6b29a7d4df8c41c69">WMouseEvent::RightButton</a>) {
<a name="l00486"></a>00486 <span class="comment">// Select the item, it was not yet selected.</span>
<a name="l00487"></a>00487 <span class="keywordflow">if</span> (!folderView_->isSelected(item))
<a name="l00488"></a>00488 folderView_->select(item);
<a name="l00489"></a>00489
<a name="l00490"></a>00490 <span class="keywordflow">if</span> (!popup_) {
<a name="l00491"></a>00491 popup_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPopupMenu.html">WPopupMenu</a>();
<a name="l00492"></a>00492 popup_->addItem(<span class="stringliteral">"icons/folder_new.gif"</span>, <span class="stringliteral">"Create a New Folder"</span>);
<a name="l00493"></a>00493 popup_->addItem(<span class="stringliteral">"Rename this Folder"</span>)->setCheckable(<span class="keyword">true</span>);
<a name="l00494"></a>00494 popup_->addItem(<span class="stringliteral">"Delete this Folder"</span>);
<a name="l00495"></a>00495 popup_->addSeparator();
<a name="l00496"></a>00496 popup_->addItem(<span class="stringliteral">"Folder Details"</span>);
<a name="l00497"></a>00497 popup_->addSeparator();
<a name="l00498"></a>00498 popup_->addItem(<span class="stringliteral">"Application Inventory"</span>);
<a name="l00499"></a>00499 popup_->addItem(<span class="stringliteral">"Hardware Inventory"</span>);
<a name="l00500"></a>00500 popup_->addSeparator();
<a name="l00501"></a>00501
<a name="l00502"></a>00502 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPopupMenu.html">WPopupMenu</a> *subMenu = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPopupMenu.html">WPopupMenu</a>();
<a name="l00503"></a>00503 subMenu-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPopupMenu.html#a6109cb59b9a36024e9691efe15392770">addItem</a>(<span class="stringliteral">"Sub Item 1"</span>);
<a name="l00504"></a>00504 subMenu-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPopupMenu.html#a6109cb59b9a36024e9691efe15392770">addItem</a>(<span class="stringliteral">"Sub Item 2"</span>);
<a name="l00505"></a>00505 popup_->addMenu(<span class="stringliteral">"File Deployments"</span>, subMenu);
<a name="l00506"></a>00506
<a name="l00507"></a>00507 <span class="comment">/*</span>
<a name="l00508"></a>00508 <span class="comment"> * This is one method of executing a popup, which does not block a</span>
<a name="l00509"></a>00509 <span class="comment"> * thread for a reentrant event loop, and thus scales.</span>
<a name="l00510"></a>00510 <span class="comment"> *</span>
<a name="l00511"></a>00511 <span class="comment"> * Alternatively you could call WPopupMenu::exec(), which returns</span>
<a name="l00512"></a>00512 <span class="comment"> * the result, but while waiting for it, blocks the thread.</span>
<a name="l00513"></a>00513 <span class="comment"> */</span>
<a name="l00514"></a>00514 popup_->aboutToHide().connect(<span class="keyword">this</span>, &<a class="code" href="classTreeViewDragDrop.html#acbeddd767d044a549a980c64db83ab22" title="Process the result of the popup menu.">TreeViewDragDrop::popupAction</a>);
<a name="l00515"></a>00515 }
<a name="l00516"></a>00516
<a name="l00517"></a>00517 <span class="keywordflow">if</span> (popup_->isHidden())
<a name="l00518"></a>00518 popup_->popup(event);
<a name="l00519"></a>00519 <span class="keywordflow">else</span>
<a name="l00520"></a>00520 popup_-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a0825c3ccbd4999afc1a88fafa6aa6fc7">hide</a>();
<a name="l00521"></a>00521 }
<a name="l00522"></a>00522 }
<a name="l00523"></a>00523
<a name="l00526"></a><a class="code" href="classTreeViewDragDrop.html#acbeddd767d044a549a980c64db83ab22">00526</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#acbeddd767d044a549a980c64db83ab22" title="Process the result of the popup menu.">popupAction</a>() {
<a name="l00527"></a>00527 <span class="keywordflow">if</span> (popup_->result()) {
<a name="l00528"></a>00528 <span class="comment">/*</span>
<a name="l00529"></a>00529 <span class="comment"> * You could also bind extra data to an item using setData() and</span>
<a name="l00530"></a>00530 <span class="comment"> * check here for the action asked. For now, we just use the text.</span>
<a name="l00531"></a>00531 <span class="comment"> */</span>
<a name="l00532"></a>00532 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a> text = popup_->result()->text();
<a name="l00533"></a>00533 popup_->hide();
<a name="l00534"></a>00534
<a name="l00535"></a>00535 popupActionBox_ = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMessageBox.html">WMessageBox</a>(<span class="stringliteral">"Sorry."</span>,<span class="stringliteral">"Action '"</span> + text
<a name="l00536"></a>00536 + <span class="stringliteral">"' is not implemented."</span>, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#aaa26ad9f143951595691fbd604567f5fa2ad77ae37661ce098ec3134ae56af58d">NoIcon</a>, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a270a5e1af09979a6559f0f39e3d93062af92b793210df9123b9be1ee11dd0d36d">Ok</a>);
<a name="l00537"></a>00537 popupActionBox_->buttonClicked()
<a name="l00538"></a>00538 .connect(<span class="keyword">this</span>, &<a class="code" href="classTreeViewDragDrop.html#ae673eec6def5902878d44858a252f661" title="Process the result of the message box.">TreeViewDragDrop::dialogDone</a>);
<a name="l00539"></a>00539 popupActionBox_->show();
<a name="l00540"></a>00540 } <span class="keywordflow">else</span> {
<a name="l00541"></a>00541 popup_->hide();
<a name="l00542"></a>00542 }
<a name="l00543"></a>00543 }
<a name="l00544"></a>00544
<a name="l00547"></a><a class="code" href="classTreeViewDragDrop.html#ae673eec6def5902878d44858a252f661">00547</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#ae673eec6def5902878d44858a252f661" title="Process the result of the message box.">dialogDone</a>() {
<a name="l00548"></a>00548 <span class="keyword">delete</span> popupActionBox_;
<a name="l00549"></a>00549 popupActionBox_ = 0;
<a name="l00550"></a>00550 }
<a name="l00551"></a>00551
<a name="l00559"></a><a class="code" href="classTreeViewDragDrop.html#ae4512c07f7d7206d9dfd5a0520f5e623">00559</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#ae4512c07f7d7206d9dfd5a0520f5e623" title="Populate the files model.">populateFiles</a>() {
<a name="l00560"></a>00560 fileModel_->invisibleRootItem()->setRowCount(0);
<a name="l00561"></a>00561
<a name="l00562"></a>00562 std::ifstream f((appRoot() + <span class="stringliteral">"data/files.csv"</span>).c_str());
<a name="l00563"></a>00563
<a name="l00564"></a>00564 <span class="keywordflow">if</span> (!f)
<a name="l00565"></a>00565 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"Could not read: data/files.csv"</span>);
<a name="l00566"></a>00566
<a name="l00567"></a>00567 <a class="code" href="group__chartsexample.html#ga1ce51cd14c57073cb7839d5e05b59c65" title="Utility function that reads a model from a CSV file.">readFromCsv</a>(f, fileModel_);
<a name="l00568"></a>00568
<a name="l00569"></a>00569 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < fileModel_->rowCount(); ++i) {
<a name="l00570"></a>00570 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a> *item = fileModel_->item(i, 0);
<a name="l00571"></a>00571 item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#aedf80dfed644a525e5d726a4b6e74b94">setFlags</a>(item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a81bc3d55f8117f5c80edcb3c9c6b871a">flags</a>() | <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga1d77c4de293aebfacbdde124de06b8b0a2b0edddfd15d67a84723c9043479ced1">ItemIsDragEnabled</a>);
<a name="l00572"></a>00572 item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a6ef82d367150a352795bdb2f780db14a">setIcon</a>(<span class="stringliteral">"icons/file.gif"</span>);
<a name="l00573"></a>00573
<a name="l00574"></a>00574 std::string folderId = item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a5cd26b1515b25d32b2872210918d7e68">text</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html#a159d088da6e8f2be1035b2341889254c">toUTF8</a>();
<a name="l00575"></a>00575
<a name="l00576"></a>00576 item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#afbe54e68e576c4902c9085f8966c93ef">setData</a>(boost::any(folderId), <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">UserRole</a>);
<a name="l00577"></a>00577 item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a7922bbfa1b9236f2c3f20ed8082bc2e3">setText</a>(folderNameMap_[folderId]);
<a name="l00578"></a>00578
<a name="l00579"></a>00579 convertToDate(fileModel_->item(i, 4));
<a name="l00580"></a>00580 convertToDate(fileModel_->item(i, 5));
<a name="l00581"></a>00581 }
<a name="l00582"></a>00582 }
<a name="l00583"></a>00583
<a name="l00586"></a><a class="code" href="classTreeViewDragDrop.html#aa4863b443e2681dcb0d6dbb276042631">00586</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#aa4863b443e2681dcb0d6dbb276042631" title="Convert a string to a date.">convertToDate</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a> *item) {
<a name="l00587"></a>00587 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDate.html">WDate</a> d = <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WDate.html#a86383757788870ff2f22bd29536336b7">WDate::fromString</a>(item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a5cd26b1515b25d32b2872210918d7e68">text</a>(), <a class="code" href="group__treeviewdragdrop.html#ga7bb540f8c352707933d4bd36c8282aba" title="Date edit format.">FileModel::dateEditFormat</a>);
<a name="l00588"></a>00588 item-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#afbe54e68e576c4902c9085f8966c93ef">setData</a>(boost::any(d), <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">DisplayRole</a>);
<a name="l00589"></a>00589 }
<a name="l00590"></a>00590
<a name="l00593"></a><a class="code" href="classTreeViewDragDrop.html#afed9370b8ffa1178307e66965fbfdef6">00593</a> <span class="keywordtype">void</span> <a class="code" href="classTreeViewDragDrop.html#afed9370b8ffa1178307e66965fbfdef6" title="Populate the folders model.">populateFolders</a>() {
<a name="l00594"></a>00594 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a> *level1, *level2;
<a name="l00595"></a>00595
<a name="l00596"></a>00596 folderModel_-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level1 = createFolderItem(<span class="stringliteral">"San Fransisco"</span>));
<a name="l00597"></a>00597 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Investors"</span>, <span class="stringliteral">"sf-investors"</span>));
<a name="l00598"></a>00598 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Fellows"</span>, <span class="stringliteral">"sf-fellows"</span>));
<a name="l00599"></a>00599
<a name="l00600"></a>00600 folderModel_->appendRow(level1 = createFolderItem(<span class="stringliteral">"Sophia Antipolis"</span>));
<a name="l00601"></a>00601 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"R&D"</span>, <span class="stringliteral">"sa-r_d"</span>));
<a name="l00602"></a>00602 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Services"</span>, <span class="stringliteral">"sa-services"</span>));
<a name="l00603"></a>00603 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Support"</span>, <span class="stringliteral">"sa-support"</span>));
<a name="l00604"></a>00604 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Billing"</span>, <span class="stringliteral">"sa-billing"</span>));
<a name="l00605"></a>00605
<a name="l00606"></a>00606 folderModel_->appendRow(level1 = createFolderItem(<span class="stringliteral">"New York"</span>));
<a name="l00607"></a>00607 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Marketing"</span>, <span class="stringliteral">"ny-marketing"</span>));
<a name="l00608"></a>00608 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Sales"</span>, <span class="stringliteral">"ny-sales"</span>));
<a name="l00609"></a>00609 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Advisors"</span>, <span class="stringliteral">"ny-advisors"</span>));
<a name="l00610"></a>00610
<a name="l00611"></a>00611 folderModel_->appendRow(level1 = createFolderItem
<a name="l00612"></a>00612 (<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html#a17afc7c43b5b7a710047be4a2c639575">WString::fromUTF8</a>(<span class="stringliteral">"Frankfürt"</span>)));
<a name="l00613"></a>00613 level1-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(level2 = createFolderItem(<span class="stringliteral">"Sales"</span>, <span class="stringliteral">"frank-sales"</span>));
<a name="l00614"></a>00614
<a name="l00615"></a>00615 folderModel_->setHeaderData(0, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a2a8d45559e16a0185bf61bfad0a67912ac2ebf22b096a22b18eef23e736aa2e28">Horizontal</a>,
<a name="l00616"></a>00616 boost::any(std::string(<span class="stringliteral">"SandBox"</span>)));
<a name="l00617"></a>00617 }
<a name="l00618"></a>00618
<a name="l00623"></a><a class="code" href="classTreeViewDragDrop.html#a3a35c22db2a87fdaf0663258d89b133b">00623</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a> *createFolderItem(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a>& location,
<a name="l00624"></a>00624 <span class="keyword">const</span> std::string& folderId = std::string())
<a name="l00625"></a>00625 {
<a name="l00626"></a>00626 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a> *result = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a>(location);
<a name="l00627"></a>00627
<a name="l00628"></a>00628 <span class="keywordflow">if</span> (!folderId.empty()) {
<a name="l00629"></a>00629 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#afbe54e68e576c4902c9085f8966c93ef">setData</a>(boost::any(folderId));
<a name="l00630"></a>00630 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#aedf80dfed644a525e5d726a4b6e74b94">setFlags</a>(result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a81bc3d55f8117f5c80edcb3c9c6b871a">flags</a>() | <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga1d77c4de293aebfacbdde124de06b8b0a95d23063251001545d4bfab1308879a3">ItemIsDropEnabled</a>);
<a name="l00631"></a>00631 folderNameMap_[folderId] = location;
<a name="l00632"></a>00632 } <span class="keywordflow">else</span>
<a name="l00633"></a>00633 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#aedf80dfed644a525e5d726a4b6e74b94">setFlags</a>(result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a81bc3d55f8117f5c80edcb3c9c6b871a">flags</a>().clear(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga1d77c4de293aebfacbdde124de06b8b0a77f858c86a06358abdcc64e4f9d03e40">ItemIsSelectable</a>));
<a name="l00634"></a>00634
<a name="l00635"></a>00635 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a6ef82d367150a352795bdb2f780db14a">setIcon</a>(<span class="stringliteral">"icons/folder.gif"</span>);
<a name="l00636"></a>00636
<a name="l00637"></a>00637 <span class="keywordflow">return</span> result;
<a name="l00638"></a>00638 }
<a name="l00639"></a>00639
<a name="l00640"></a>00640 };
<a name="l00641"></a>00641
<a name="l00642"></a><a class="code" href="group__treeviewdragdrop.html#gacb337c09cd35644b56da8b0e5bb17b9c">00642</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *<a class="code" href="ComposeExample_8C.html#acb337c09cd35644b56da8b0e5bb17b9c">createApplication</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a>& env)
<a name="l00643"></a>00643 {
<a name="l00644"></a>00644 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *app = <span class="keyword">new</span> <a class="code" href="classTreeViewDragDrop.html" title="Main application class.">TreeViewDragDrop</a>(env);
<a name="l00645"></a>00645 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a63d991e268c9af8898329217a1242563">setTwoPhaseRenderingThreshold</a>(0);
<a name="l00646"></a>00646 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a71a3f7da5abb9a76df94fab69ba61670">setTitle</a>(<span class="stringliteral">"WTreeView Drag & Drop"</span>);
<a name="l00647"></a>00647 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#af377d541443b4bcea5fcc40be7c70173">useStyleSheet</a>(<span class="stringliteral">"styles.css"</span>);
<a name="l00648"></a>00648 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a4f304244f6bc75be6cd5f41798ea5e2e">messageResourceBundle</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMessageResourceBundle.html#a01368946b2a2aaceab3a64cddb1cb1e2">use</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a88b082dadadd3fb7dbe10887e7d89c91">WApplication::appRoot</a>() + <span class="stringliteral">"about"</span>);
<a name="l00649"></a>00649 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a02b9d8aa1b6c2d0dc9edc1b9c63f86dc">refresh</a>();
<a name="l00650"></a>00650
<a name="l00651"></a>00651 <span class="keywordflow">return</span> app;
<a name="l00652"></a>00652 }
<a name="l00653"></a>00653
<a name="l00654"></a><a class="code" href="group__treeviewdragdrop.html#ga3c04138a5bfe5d72780bb7e82a18e627">00654</a> <span class="keywordtype">int</span> <a class="code" href="ComposeExample_8C.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
<a name="l00655"></a>00655 {
<a name="l00656"></a>00656 <span class="keywordflow">return</span> WRun(argc, argv, &<a class="code" href="ComposeExample_8C.html#acb337c09cd35644b56da8b0e5bb17b9c">createApplication</a>);
<a name="l00657"></a>00657 }
<a name="l00658"></a>00658
</pre></div></div>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Fri Mar 30 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by <a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>
|