/usr/include/cegui-0.8.7/CEGUI/widgets/MultiColumnList.h is in libcegui-mk2-dev 0.8.7-1.3+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 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 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 | /***********************************************************************
created: 13/4/2004
author: Paul D Turner
purpose: Interface to base class for MultiColumnList widget
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIMultiColumnList_h_
#define _CEGUIMultiColumnList_h_
#include "../Base.h"
#include "../Window.h"
#include "./ListHeader.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Simple grid index structure.
*/
struct CEGUIEXPORT MCLGridRef
{
MCLGridRef(uint r, uint c) : row(r), column(c) {}
uint row; //!< Zero based row index.
uint column; //!< Zero based column index.
// operators
MCLGridRef& operator=(const MCLGridRef& rhs);
bool operator<(const MCLGridRef& rhs) const;
bool operator<=(const MCLGridRef& rhs) const;
bool operator>(const MCLGridRef& rhs) const;
bool operator>=(const MCLGridRef& rhs) const;
bool operator==(const MCLGridRef& rhs) const;
bool operator!=(const MCLGridRef& rhs) const;
};
/*!
\brief
Base class for the multi column list window renderer.
*/
class CEGUIEXPORT MultiColumnListWindowRenderer : public WindowRenderer
{
public:
/*!
\brief
Constructor
*/
MultiColumnListWindowRenderer(const String& name);
/*!
\brief
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering list items.
\return
Rect object describing the area of the Window to be used for rendering
list box items.
*/
virtual Rectf getListRenderArea(void) const = 0;
};
/*!
\brief
Base class for the multi column list widget.
*/
class CEGUIEXPORT MultiColumnList : public Window
{
public:
static const String EventNamespace; //!< Namespace for global events
static const String WidgetTypeName; //!< Window factory name
/*************************************************************************
Constants
*************************************************************************/
// Event names
/** Event fired when the selection mode for the list box changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose selection mode
* has been changed.
*/
static const String EventSelectionModeChanged;
/** Event fired when the nominated select column changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose nominated
* selection column has been changed.
*/
static const String EventNominatedSelectColumnChanged;
/** Event fired when the nominated select row changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose nominated
* selection row has been changed.
*/
static const String EventNominatedSelectRowChanged;
/** Event fired when the vertical scroll bar 'force' setting changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose vertical scroll
* bar mode has been changed.
*/
static const String EventVertScrollbarModeChanged;
/** Event fired when the horizontal scroll bar 'force' setting changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose horizontal
* scroll bar mode has been changed.
*/
static const String EventHorzScrollbarModeChanged;
/** Event fired when the current selection(s) within the list box changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose current
* selection has changed.
*/
static const String EventSelectionChanged;
/** Event fired when the contents of the list box changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose contents has
* changed.
*/
static const String EventListContentsChanged;
/** Event fired when the sort column changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose sort column has
* been changed.
*/
static const String EventSortColumnChanged;
/** Event fired when the sort direction changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList whose sort direction
* has been changed.
*/
static const String EventSortDirectionChanged;
/** Event fired when the width of a column in the list changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList for which a column
* width has changed.
*/
static const String EventListColumnSized;
/** Event fired when the column order changes.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the MultiColumnList for which the order
* of columns has been changed.
*/
static const String EventListColumnMoved;
/*************************************************************************
Child Widget name constants
*************************************************************************/
static const String VertScrollbarName; //!< Widget name for the vertical scrollbar component.
static const String HorzScrollbarName; //!< Widget name for the horizontal scrollbar component.
static const String ListHeaderName; //!< Widget name for the list header component.
/*************************************************************************
Enumerations
*************************************************************************/
/*!
\brief
Enumerated values for the selection modes possible with a Multi-column list
*/
enum SelectionMode
{
RowSingle, // Any single row may be selected. All items in the row are selected.
RowMultiple, // Multiple rows may be selected. All items in the row are selected.
CellSingle, // Any single cell may be selected.
CellMultiple, // Multiple cells bay be selected.
NominatedColumnSingle, // Any single item in a nominated column may be selected.
NominatedColumnMultiple, // Multiple items in a nominated column may be selected.
ColumnSingle, // Any single column may be selected. All items in the column are selected.
ColumnMultiple, // Multiple columns may be selected. All items in the column are selected.
NominatedRowSingle, // Any single item in a nominated row may be selected.
NominatedRowMultiple // Multiple items in a nominated row may be selected.
};
/*************************************************************************
Accessor Methods
*************************************************************************/
/*!
\brief
Return whether user manipulation of the sort column and direction are enabled.
\return
true if the user may interactively modify the sort column and direction. false if the user may not
modify the sort column and direction (these can still be set programmatically).
*/
bool isUserSortControlEnabled(void) const;
/*!
\brief
Return whether the user may size column segments.
\return
true if the user may interactively modify the width of columns, false if they may not.
*/
bool isUserColumnSizingEnabled(void) const;
/*!
\brief
Return whether the user may modify the order of the columns.
\return
true if the user may interactively modify the order of the columns, false if they may not.
*/
bool isUserColumnDraggingEnabled(void) const;
/*!
\brief
Return the number of columns in the multi-column list
\return
uint value equal to the number of columns in the list.
*/
uint getColumnCount(void) const;
/*!
\brief
Return the number of rows in the multi-column list.
\return
uint value equal to the number of rows currently in the list.
*/
uint getRowCount(void) const;
/*!
\brief
Return the zero based index of the current sort column. There must be at least one column to successfully call this
method.
\return
Zero based column index that is the current sort column.
\exception InvalidRequestException thrown if there are no columns in this multi column list.
*/
uint getSortColumn(void) const;
uint getSortColumnID(void) const;
/*!
\brief
Return the zero based column index of the column with the specified ID.
\param col_id
ID code of the column whos index is to be returned.
\return
Zero based column index of the first column whos ID matches \a col_id.
\exception InvalidRequestException thrown if no attached column has the requested ID.
*/
uint getColumnWithID(uint col_id) const;
/*!
\brief
Return the zero based index of the column whos header text matches the specified text.
\param text
String object containing the text to be searched for.
\return
Zero based column index of the column whos header has the specified text.
\exception InvalidRequestException thrown if no columns header has the requested text.
*/
uint getColumnWithHeaderText(const String& text) const;
/*!
\brief
Return the total width of all column headers.
\return
Sum total of all the column header widths as a UDim.
*/
UDim getTotalColumnHeadersWidth(void) const;
/*!
\brief
Return the width of the specified column header (and therefore the column itself).
\param col_idx
Zero based column index of the column whos width is to be returned.
\return
Width of the column header at the zero based column index specified by \a col_idx, as a UDim
\exception InvalidRequestException thrown if \a column is out of range.
*/
UDim getColumnHeaderWidth(uint col_idx) const;
/*!
\brief
Return the currently set sort direction.
\return
One of the ListHeaderSegment::SortDirection enumerated values specifying the current sort direction.
*/
ListHeaderSegment::SortDirection getSortDirection(void) const;
/*!
\brief
Return the ListHeaderSegment object for the specified column
\param col_idx
zero based index of the column whos ListHeaderSegment is to be returned.
\return
ListHeaderSegment object for the column at the requested index.
\exception InvalidRequestException thrown if \a col_idx is out of range.
*/
ListHeaderSegment& getHeaderSegmentForColumn(uint col_idx) const;
/*!
\brief
Return the zero based index of the Row that contains \a item.
\param item
Pointer to the ListboxItem that the row index is to returned for.
\return
Zero based index of the row that contains ListboxItem \a item.
\exception InvalidRequestException thrown if \a item is not attached to the list box.
*/
uint getItemRowIndex(const ListboxItem* item) const;
/*!
\brief
Return the current zero based index of the column that contains \a item.
\param item
Pointer to the ListboxItem that the column index is to returned for.
\return
Zero based index of the column that contains ListboxItem \a item.
\exception InvalidRequestException thrown if \a item is not attached to the list box.
*/
uint getItemColumnIndex(const ListboxItem* item) const;
/*!
\brief
Return the grid reference for \a item.
\param item
Pointer to the ListboxItem whos current grid reference is to be returned.
\return
MCLGridRef object describing the current grid reference of ListboxItem \a item.
\exception InvalidRequestException thrown if \a item is not attached to the list box.
*/
MCLGridRef getItemGridReference(const ListboxItem* item) const;
/*!
\brief
Return a pointer to the ListboxItem at the specified grid reference.
\param grid_ref
MCLGridRef object that describes the position of the ListboxItem to be returned.
\return
Pointer to the ListboxItem at grid reference \a grid_ref.
\exception InvalidRequestException thrown if \a grid_ref is invalid for this list box.
*/
ListboxItem* getItemAtGridReference(const MCLGridRef& grid_ref) const;
/*!
\brief
return whether ListboxItem \a item is attached to the column at index \a col_idx.
\param item
Pointer to the ListboxItem to look for.
\param col_idx
Zero based index of the column that is to be searched.
\return
- true if \a item is attached to list box column \a col_idx.
- false if \a item is not attached to list box column \a col_idx.
\exception InvalidRequestException thrown if \a col_idx is out of range.
*/
bool isListboxItemInColumn(const ListboxItem* item, uint col_idx) const;
/*!
\brief
return whether ListboxItem \a item is attached to the row at index \a row_idx.
\param item
Pointer to the ListboxItem to look for.
\param row_idx
Zero based index of the row that is to be searched.
\return
- true if \a item is attached to list box row \a row_idx.
- false if \a item is not attached to list box row \a row_idx.
\exception InvalidRequestException thrown if \a row_idx is out of range.
*/
bool isListboxItemInRow(const ListboxItem* item, uint row_idx) const;
/*!
\brief
return whether ListboxItem \a item is attached to the list box.
\param item
Pointer to the ListboxItem to look for.
\return
- true if \a item is attached to list box.
- false if \a item is not attached to list box.
*/
bool isListboxItemInList(const ListboxItem* item) const;
/*!
\brief
Return the ListboxItem in column \a col_idx that has the text string \a text.
\param text
String object containing the text to be searched for.
\param col_idx
Zero based index of the column to be searched.
\param start_item
Pointer to the ListboxItem where the exclusive search is to start, or NULL to search from the top of the column.
\return
Pointer to the first ListboxItem in column \a col_idx, after \a start_item, that has the string \a text.
\exception InvalidRequestException thrown if \a start_item is not attached to the list box, or if \a col_idx is out of range.
*/
ListboxItem* findColumnItemWithText(const String& text, uint col_idx, const ListboxItem* start_item) const;
/*!
\brief
Return the ListboxItem in row \a row_idx that has the text string \a text.
\param text
String object containing the text to be searched for.
\param row_idx
Zero based index of the row to be searched.
\param start_item
Pointer to the ListboxItem where the exclusive search is to start, or NULL to search from the start of the row.
\return
Pointer to the first ListboxItem in row \a row_idx, after \a start_item, that has the string \a text.
\exception InvalidRequestException thrown if \a start_item is not attached to the list box, or if \a row_idx is out of range.
*/
ListboxItem* findRowItemWithText(const String& text, uint row_idx, const ListboxItem* start_item) const;
/*!
\brief
Return the ListboxItem that has the text string \a text.
\note
List box searching progresses across the columns in each row.
\param text
String object containing the text to be searched for.
\param start_item
Pointer to the ListboxItem where the exclusive search is to start, or NULL to search the whole list box.
\return
Pointer to the first ListboxItem, after \a start_item, that has the string \a text.
\exception InvalidRequestException thrown if \a start_item is not attached to the list box.
*/
ListboxItem* findListItemWithText(const String& text, const ListboxItem* start_item) const;
/*!
\brief
Return a pointer to the first selected ListboxItem attached to this list box.
\note
List box searching progresses across the columns in each row.
\return
Pointer to the first ListboxItem attached to this list box that is selected, or NULL if no item is selected.
*/
ListboxItem* getFirstSelectedItem(void) const;
/*!
\brief
Return a pointer to the next selected ListboxItem after \a start_item.
\note
List box searching progresses across the columns in each row.
\param start_item
Pointer to the ListboxItem where the exclusive search is to start, or NULL to search the whole list box.
\return
Pointer to the first selected ListboxItem attached to this list box, after \a start_item, or NULL if no item is selected.
\exception InvalidRequestException thrown if \a start_item is not attached to the list box.
*/
ListboxItem* getNextSelected(const ListboxItem* start_item) const;
/*!
\brief
Return the number of selected ListboxItems attached to this list box.
return
uint value equal to the number of ListboxItems attached to this list box that are currently selected.
*/
uint getSelectedCount(void) const;
/*!
\brief
Return whether the ListboxItem at \a grid_ref is selected.
\param grid_ref
MCLGridRef object describing the grid reference that is to be examined.
\return
- true if there is a ListboxItem at \a grid_ref and it is selected.
- false if there is no ListboxItem at \a grid_ref, or if the item is not selected.
\exception InvalidRequestException thrown if \a grid_ref contains an invalid grid position.
*/
bool isItemSelected(const MCLGridRef& grid_ref) const;
/*!
\brief
Return the ID of the currently set nominated selection column to be used when in one of the NominatedColumn*
selection modes. There must be at least one column to successfully call this method.
\note
You should only ever call this when getColumnCount() returns > 0.
\return
ID code of the nominated selection column.
*/
uint getNominatedSelectionColumnID(void) const;
/*!
\brief
Return the index of the currently set nominated selection column to be used when in one of the NominatedColumn*
selection modes.
\return
Zero based index of the nominated selection column.
*/
uint getNominatedSelectionColumn(void) const;
/*!
\brief
Return the index of the currently set nominated selection row to be used when in one of the NominatedRow*
selection modes.
\return
Zero based index of the nominated selection column.
*/
uint getNominatedSelectionRow(void) const;
/*!
\brief
Return the currently set selection mode.
\return
One of the MultiColumnList::SelectionMode enumerated values specifying the current selection mode.
*/
MultiColumnList::SelectionMode getSelectionMode(void) const;
/*!
\brief
Return whether the vertical scroll bar is always shown.
\return
- true if the scroll bar will always be shown even if it is not required.
- false if the scroll bar will only be shown when it is required.
*/
bool isVertScrollbarAlwaysShown(void) const;
/*!
\brief
Return whether the horizontal scroll bar is always shown.
\return
- true if the scroll bar will always be shown even if it is not required.
- false if the scroll bar will only be shown when it is required.
*/
bool isHorzScrollbarAlwaysShown(void) const;
/*!
\brief
Return the ID code assigned to the requested column.
\param col_idx
Zero based index of the column whos ID code is to be returned.
\return
Current ID code assigned to the column at the requested index.
\exception InvalidRequestException thrown if \a col_idx is out of range
*/
uint getColumnID(uint col_idx) const;
/*!
\brief
Return the ID code assigned to the requested row.
\param row_idx
Zero based index of the row who's ID code is to be returned.
\return
Current ID code assigned to the row at the requested index.
\exception InvalidRequestException thrown if \a row_idx is out of range
*/
uint getRowID(uint row_idx) const;
/*!
\brief
Return the zero based row index of the row with the specified ID.
\param row_id
ID code of the row who's index is to be returned.
\return
Zero based row index of the first row who's ID matches \a row_id.
\exception InvalidRequestException thrown if no row has the requested ID.
*/
uint getRowWithID(uint row_id) const;
/*!
\brief
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering list items.
\return
Rect object describing the area of the Window to be used for rendering
list box items.
*/
Rectf getListRenderArea(void) const;
/*!
\brief
Return a pointer to the vertical scrollbar component widget for this
MultiColumnList.
\return
Pointer to a Scrollbar object.
\exception UnknownObjectException
Thrown if the vertical Scrollbar component does not exist.
*/
Scrollbar* getVertScrollbar() const;
/*!
\brief
Return a pointer to the horizontal scrollbar component widget for this
MultiColumnList.
\return
Pointer to a Scrollbar object.
\exception UnknownObjectException
Thrown if the horizontal Scrollbar component does not exist.
*/
Scrollbar* getHorzScrollbar() const;
/*!
\brief
Return a pointer to the list header component widget for this
MultiColumnList.
\return
Pointer to a ListHeader object.
\exception UnknownObjectException
Thrown if the list header component does not exist.
*/
ListHeader* getListHeader() const;
/*!
\brief
Return the sum of all row heights in pixels.
*/
float getTotalRowsHeight(void) const;
/*!
\brief
Return the pixel width of the widest item in the given column
*/
float getWidestColumnItemWidth(uint col_idx) const;
/*!
\brief
Return, in pixels, the height of the highest item in the given row.
*/
float getHighestRowItemHeight(uint row_idx) const;
/*!
\brief
Get whether or not column auto-sizing (autoSizeColumnHeader()) will use
the list header segment size.
\return
Return true if the header segment will be included in the width
calculation.
*/
bool getAutoSizeColumnUsesHeader() const;
/*************************************************************************
Manipulator Methods
*************************************************************************/
/*!
\brief
Initialise the Window based object ready for use.
\note
This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type.
\return
Nothing
*/
virtual void initialiseComponents(void);
/*!
\brief
Remove all items from the list.
Note that this will cause 'AutoDelete' items to be deleted.
*/
void resetList(void);
/*!
\brief
Add a column to the list box.
\param text
String object containing the text label for the column header.
\param col_id
ID code to be assigned to the column header.
\param width
UDim describing the initial width to be set for the column.
\return
Nothing.
*/
void addColumn(const String& text, uint col_id, const UDim& width);
void addColumn(const String& value);
/*!
\brief
Insert a new column in the list.
\param text
String object containing the text label for the column header.
\param col_id
ID code to be assigned to the column header.
\param width
UDim describing the initial width to be set for the column.
\param position
Zero based index where the column is to be inserted. If this is greater than the current
number of columns, the new column is inserted at the end.
\return
Nothing.
*/
void insertColumn(const String& text, uint col_id, const UDim& width, uint position);
/*!
\brief
Removes a column from the list box. This will cause any ListboxItem using the autoDelete option in the column to be deleted.
\param col_idx
Zero based index of the column to be removed.
\return
Nothing.
\exception InvalidRequestException thrown if \a col_idx is invalid.
*/
void removeColumn(uint col_idx);
/*!
\brief
Removes a column from the list box. This will cause any ListboxItem using the autoDelete option in the column to be deleted.
\param col_id
ID code of the column to be deleted.
\return
Nothing.
\exception InvalidRequestException thrown if no column with \a col_id is available on this list box.
*/
void removeColumnWithID(uint col_id);
/*!
\brief
Move the column at index \a col_idx so it is at index \a position.
\param col_idx
Zero based index of the column to be moved.
\param position
Zero based index of the new position for the column.
\return
Nothing.
\exception InvalidRequestException thrown if \a col_idx is invalid.
*/
void moveColumn(uint col_idx, uint position);
/*!
\brief
Move the column with ID \a col_id so it is at index \a position.
\param col_id
ID code of the column to be moved.
\param position
Zero based index of the new position for the column.
\return
Nothing.
\exception InvalidRequestException thrown if no column with \a col_id is available on this list box.
*/
void moveColumnWithID(uint col_id, uint position);
/*!
\brief
Add an empty row to the list box.
\param row_id
ID code to be assigned to the new row.
\note
If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
applied. If no sorting is being done, the new row will appear at the bottom of the list.
\return
Initial zero based index of the new row.
*/
uint addRow(uint row_id = 0);
/*!
\brief
Add a row to the list box, and set the item in the column with ID \a col_id to \a item.
\note
If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
applied. If no sorting is being done, the new row will appear at the bottom of the list.
\param item
Pointer to a ListboxItem to be used as the initial contents for the column with ID \a col_id.
\param col_id
ID code of the column whos initial item is to be set to \a item.
\param row_id
ID code to be assigned to the new row.
\return
Initial zero based index of the new row.
\exception InvalidRequestException thrown if no column with the specified ID is attached to the list box.
*/
uint addRow(ListboxItem* item, uint col_id, uint row_id = 0);
/*!
\brief
Insert an empty row into the list box.
\note
If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
applied. If no sorting is being done, the new row will appear at the specified index.
\param row_idx
Zero based index where the row should be inserted. If this is greater than the current number of rows, the row is
appended to the list.
\param row_id
ID code to be assigned to the new row.
\return
Zero based index where the row was actually inserted.
*/
uint insertRow(uint row_idx, uint row_id = 0);
/*!
\brief
Insert a row into the list box, and set the item in the column with ID \a col_id to \a item.
\note
If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
applied. If no sorting is being done, the new row will appear at the specified index.
\param item
Pointer to a ListboxItem to be used as the initial contents for the column with ID \a col_id.
\param col_id
ID code of the column whos initial item is to be set to \a item.
\param row_idx
Zero based index where the row should be inserted. If this is greater than the current number of rows, the row is
appended to the list.
\param row_id
ID code to be assigned to the new row.
\return
Zero based index where the row was actually inserted.
\exception InvalidRequestException thrown if no column with the specified ID is attached to the list box.
*/
uint insertRow(ListboxItem* item, uint col_id, uint row_idx, uint row_id = 0);
/*!
\brief
Remove the list box row with index \a row_idx. Any ListboxItem in row \a row_idx using autoDelete mode will be deleted.
\param row_idx
Zero based index of the row to be removed.
\return
Nothing.
\exception InvalidRequestException thrown if \a row_idx is invalid.
*/
void removeRow(uint row_idx);
/*!
\brief
Set the ListboxItem for grid reference \a position.
\param item
Pointer to the ListboxItem to be set at \a position.
\param position
MCLGridRef describing the grid reference of the item to be set.
\return
Nothing.
\exception InvalidRequestException thrown if \a position contains an invalid grid reference.
*/
void setItem(ListboxItem* item, const MCLGridRef& position);
/*!
\brief
Set the ListboxItem for the column with ID \a col_id in row \a row_idx.
\param item
Pointer to the ListboxItem to be set into the list.
\param col_id
ID code of the column to receive \a item.
\param row_idx
Zero based index of the row to receive \a item.
\return
Nothing.
\exception InvalidRequestException thrown if no column with ID \a col_id exists, or of \a row_idx is out of range.
*/
void setItem(ListboxItem* item, uint col_id, uint row_idx);
/*!
\brief
Set the selection mode for the list box.
\param sel_mode
One of the MultiColumnList::SelectionMode enumerated values specifying the selection mode to be used.
\return
Nothing.
\exception InvalidRequestException thrown if the value specified for \a sel_mode is invalid.
*/
void setSelectionMode(MultiColumnList::SelectionMode sel_mode);
/*!
\brief
Set the column to be used for the NominatedColumn* selection modes.
\param col_id
ID code of the column to be used in NominatedColumn* selection modes.
\return
Nothing.
\exception InvalidRequestException thrown if no column has ID code \a col_id.
*/
void setNominatedSelectionColumnID(uint col_id);
/*!
\brief
Set the column to be used for the NominatedColumn* selection modes.
\param col_idx
zero based index of the column to be used in NominatedColumn* selection modes.
\return
Nothing.
\exception InvalidRequestException thrown if \a col_idx is out of range.
*/
void setNominatedSelectionColumn(uint col_idx);
/*!
\brief
Set the row to be used for the NominatedRow* selection modes.
\param row_idx
zero based index of the row to be used in NominatedRow* selection modes.
\return
Nothing.
\exception InvalidRequestException thrown if \a row_idx is out of range.
*/
void setNominatedSelectionRow(uint row_idx);
/*!
\brief
Set the sort direction to be used.
\param direction
One of the ListHeaderSegment::SortDirection enumerated values specifying the sort direction to be used.
\return
Nothing.
*/
void setSortDirection(ListHeaderSegment::SortDirection direction);
/*!
\brief
Set the column to be used as the sort key.
\param col_idx
Zero based index of the column to use as the key when sorting the list items.
\return
Nothing.
\exception InvalidRequestException thrown if col_idx is out of range.
*/
void setSortColumn(uint col_idx);
/*!
\brief
Set the column to be used as the sort key.
\param col_id
ID code of the column to use as the key when sorting the list items.
\return
Nothing.
\exception InvalidRequestException thrown if col_id is invalid for this list box.
*/
void setSortColumnByID(uint col_id);
/*!
\brief
Set whether the vertical scroll bar should always be shown, or just when needed.
\param setting
- true to have the vertical scroll bar shown at all times.
- false to have the vertical scroll bar appear only when needed.
\return
Nothing.
*/
void setShowVertScrollbar(bool setting);
/*!
\brief
Set whether the horizontal scroll bar should always be shown, or just when needed.
\param setting
- true to have the horizontal scroll bar shown at all times.
- false to have the horizontal scroll bar appear only when needed.
\return
Nothing.
*/
void setShowHorzScrollbar(bool setting);
/*!
\brief
Removed the selected state from any currently selected ListboxItem attached to the list.
\return
Nothing.
*/
void clearAllSelections(void);
/*!
\brief
Sets or clears the selected state of the given ListboxItem which must be attached to the list.
\note
Depending upon the current selection mode, this may cause other items to be selected, other
items to be deselected, or for nothing to actually happen at all.
\param item
Pointer to the attached ListboxItem to be affected.
\param state
- true to put the ListboxItem into the selected state.
- false to put the ListboxItem into the de-selected state.
\return
Nothing.
\exception InvalidRequestException thrown if \a item is not attached to the list box.
*/
void setItemSelectState(ListboxItem* item, bool state);
/*!
\brief
Sets or clears the selected state of the ListboxItem at the given grid reference.
\note
Depending upon the current selection mode, this may cause other items to be selected, other
items to be deselected, or for nothing to actually happen at all.
\param grid_ref
MCLGridRef object describing the position of the item to be affected.
\param state
- true to put the ListboxItem into the selected state.
- false to put the ListboxItem into the de-selected state.
\return
Nothing.
\exception InvalidRequestException thrown if \a grid_ref is invalid for this list box.
*/
void setItemSelectState(const MCLGridRef& grid_ref, bool state);
/*!
\brief
Inform the list box that one or more attached ListboxItems have been externally modified, and
the list should re-sync its internal state and refresh the display as needed.
\return
Nothing.
*/
void handleUpdatedItemData(void);
/*!
\brief
Set the width of the specified column header (and therefore the column itself).
\param col_idx
Zero based column index of the column whos width is to be set.
\param width
UDim value specifying the new width for the column.
\return
Nothing.
\exception InvalidRequestException thrown if \a column is out of range.
*/
void setColumnHeaderWidth(uint col_idx, const UDim& width);
/*!
\brief
Set whether user manipulation of the sort column and direction are enabled.
\param setting
- true if the user may interactively modify the sort column and direction.
- false if the user may not modify the sort column and direction (these can still be set programmatically).
\return
Nothing.
*/
void setUserSortControlEnabled(bool setting);
/*!
\brief
Set whether the user may size column segments.
\param setting
- true if the user may interactively modify the width of columns.
- false if the user may not change the width of the columns.
\return
Nothing.
*/
void setUserColumnSizingEnabled(bool setting);
/*!
\brief
Set whether the user may modify the order of the columns.
\param setting
- true if the user may interactively modify the order of the columns.
- false if the user may not modify the order of the columns.
*/
void setUserColumnDraggingEnabled(bool setting);
/*!
\brief
Automatically determines the "best fit" size for the specified column and sets
the column width to the same.
\param col_idx
Zero based index of the column to be sized.
\return
Nothing.
\exception InvalidRequestException thrown if \a col_idx is out of range.
*/
void autoSizeColumnHeader(uint col_idx);
/*!
\brief
Set the ID code assigned to a given row.
\param row_idx
Zero based index of the row who's ID code is to be set.
\param row_id
ID code to be assigned to the row at the requested index.
\return
Nothing.
\exception InvalidRequestException thrown if \a row_idx is out of range
*/
void setRowID(uint row_idx, uint row_id);
/*!
\brief
Ensure the specified item is made visible within the multi-column
listbox.
\param item
Pointer to the ListboxItem to be made visible in the multi-column
listbox.
\return
Nothing.
\exception InvalidRequestException thrown if \a item is not attached to
this multicolumnlist.
*/
void ensureItemIsVisible(const ListboxItem* item);
/*!
\brief
Ensure the item at the specified grid coordinate is visible within the
multi-column listbox.
\param grid_ref
MCLGridRef object holding the grid coordinate that is to be made
visible.
\return
Nothing.
*/
void ensureItemIsVisible(const MCLGridRef& grid_ref);
/*!
\brief
Ensure that the row of the \a item is visible within the multi-column
listbox.
\note
This doesn't necessarily make \a item visible.
\param item
Pointer to the ListboxItem whose row is to be made visible in the
multi-column listbox.
\return
Nothing.
*/
void ensureItemRowIsVisible(const ListboxItem* item);
/*!
\brief
Ensure that the column of \a item is visible within the multi-column
listbox.
\note
This doesn't necessarily make \a item visible.
\param item
Pointer to the ListboxItem whose column is to be made visible in the
multi-column listbox.
\return
Nothing.
*/
void ensureItemColumnIsVisible(const ListboxItem* item);
/*!
\brief
Ensure that the row with index \a row_idx is visible within the
multi-column listbox.
\param row_id
row_idx is the zero-based index of the row to be made visible.
\return
Nothing.
*/
void ensureRowIsVisible(uint row_idx);
/*!
\brief
Ensure that the column with ID \a column_idx is visible within the
multi-column listbox.
\param column_idx
column_idx is the zero-based index of the column to be made visible.
\return
Nothing.
*/
void ensureColumnIsVisible(uint column_idx);
/*!
\brief
Instruct column auto-sizing (autoSizeColumnHeader()) to also use the
list header segment size.
\param include_header
Whether method autoSizeColumnHeader() also should use the size of the
column header segment.
\return
Nothing.
*/
void setAutoSizeColumnUsesHeader(bool include_header);
/*************************************************************************
Construction and Destruction
*************************************************************************/
/*!
\brief
Constructor for the Multi-column list base class
*/
MultiColumnList(const String& type, const String& name);
/*!
\brief
Destructor for the multi-column list base class.
*/
virtual ~MultiColumnList(void);
protected:
/*************************************************************************
Implementation Functions (abstract interface)
*************************************************************************/
/*!
\brief
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering list items.
\return
Rect object describing the area of the Window to be used for rendering
list box items.
*/
//virtual Rect getListRenderArea_impl(void) const = 0;
/*************************************************************************
Implementation Functions
*************************************************************************/
/*!
\brief
display required integrated scroll bars according to current state of the list box and update their values.
*/
void configureScrollbars(void);
/*!
\brief
select all strings between positions \a start and \a end. (inclusive). Returns true if something was modified.
*/
bool selectRange(const MCLGridRef& start, const MCLGridRef& end);
/*!
\brief
Clear the selected state for all items (implementation)
\return
true if some selections were cleared, false nothing was changed.
*/
bool clearAllSelections_impl(void);
/*!
\brief
Return the ListboxItem under the given window local pixel co-ordinate.
\return
ListboxItem that is under window pixel co-ordinate \a pt, or NULL if no
item is under that position.
*/
ListboxItem* getItemAtPoint(const Vector2f& pt) const;
/*!
\brief
Set select state for the given item. This appropriately selects other
items depending upon the select mode. Returns true if something is
changed, else false.
*/
bool setItemSelectState_impl(const MCLGridRef grid_ref, bool state);
/*!
\brief
Set select state for all items in the given row
*/
void setSelectForItemsInRow(uint row_idx, bool state);
/*!
\brief
Set select state for all items in the given column
*/
void setSelectForItemsInColumn(uint col_idx, bool state);
/*!
\brief
Move the column at index \a col_idx so it is at index \a position. Implementation version which does not move the
header segment (since that may have already happened).
\exception InvalidRequestException thrown if \a col_idx is invalid.
*/
void moveColumn_impl(uint col_idx, uint position);
/*!
\brief
Remove all items from the list.
\note
Note that this will cause 'AutoDelete' items to be deleted.
\return
- true if the list contents were changed.
- false if the list contents were not changed (list already empty).
*/
bool resetList_impl(void);
// overrides function in base class.
virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
// overrides function in base class.
int writePropertiesXML(XMLSerializer& xml_stream) const;
/*!
\brief
Causes the internal list to be (re)sorted.
*/
void resortList();
/*************************************************************************
New event handlers for multi column list
*************************************************************************/
/*!
\brief
Handler called when the selection mode of the list box changes
*/
virtual void onSelectionModeChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the nominated selection column changes
*/
virtual void onNominatedSelectColumnChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the nominated selection row changes.
*/
virtual void onNominatedSelectRowChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the vertical scroll bar 'force' mode is changed.
*/
virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the horizontal scroll bar 'force' mode is changed.
*/
virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the current selection changes.
*/
virtual void onSelectionChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the list contents is changed.
*/
virtual void onListContentsChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the sort column changes.
*/
virtual void onSortColumnChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the sort direction changes.
*/
virtual void onSortDirectionChanged(WindowEventArgs& e);
/*!
\brief
Handler called when a column is sized.
*/
virtual void onListColumnSized(WindowEventArgs& e);
/*!
\brief
Handler called when the column order is changed.
*/
virtual void onListColumnMoved(WindowEventArgs& e);
/*************************************************************************
Overridden Event handlers
*************************************************************************/
virtual void onFontChanged(WindowEventArgs& e);
virtual void onSized(ElementEventArgs& e);
virtual void onMouseButtonDown(MouseEventArgs& e);
virtual void onMouseWheel(MouseEventArgs& e);
/*************************************************************************
Handlers for subscribed events
*************************************************************************/
bool handleHeaderScroll(const EventArgs& e);
bool handleHeaderSegMove(const EventArgs& e);
bool handleColumnSizeChange(const EventArgs& e);
bool handleHorzScrollbar(const EventArgs& e);
bool handleVertScrollbar(const EventArgs& e);
bool handleSortColumnChange(const EventArgs& e);
bool handleSortDirectionChange(const EventArgs& e);
bool handleHeaderSegDblClick(const EventArgs& e);
/*!
\brief
Struct used internally to represent a row in the list and also to ease
sorting of the rows.
*/
struct ListRow
{
typedef std::vector<ListboxItem*
CEGUI_VECTOR_ALLOC(ListboxItem*)> RowItems;
RowItems d_items;
uint d_sortColumn;
uint d_rowID;
// operators
ListboxItem* const& operator[](uint idx) const {return d_items[idx];}
ListboxItem*& operator[](uint idx) {return d_items[idx];}
bool operator<(const ListRow& rhs) const;
bool operator>(const ListRow& rhs) const;
};
/*!
\brief
std algorithm predicate used for sorting in descending order
*/
static bool pred_descend(const ListRow& a, const ListRow& b);
/*************************************************************************
Implementation Data
*************************************************************************/
// scrollbar settings.
bool d_forceVertScroll; //!< true if vertical scrollbar should always be displayed
bool d_forceHorzScroll; //!< true if horizontal scrollbar should always be displayed
// selection abilities.
SelectionMode d_selectMode; //!< Holds selection mode (represented by settings below).
uint d_nominatedSelectCol; //!< Nominated column for single column selection.
uint d_nominatedSelectRow; //!< Nominated row for single row selection.
bool d_multiSelect; //!< Allow multiple selections.
bool d_fullRowSelect; //!< All items in a row are selected.
bool d_fullColSelect; //!< All items in a column are selected.
bool d_useNominatedRow; //!< true if we use a nominated row to select.
bool d_useNominatedCol; //!< true if we use a nominated col to select.
ListboxItem* d_lastSelected; //!< holds pointer to the last selected item (used in range selections)
uint d_columnCount; //!< keeps track of the number of columns.
// storage of items in the list box.
typedef std::vector<ListRow
CEGUI_VECTOR_ALLOC(ListRow)> ListItemGrid;
ListItemGrid d_grid; //!< Holds the list box data.
//! whether header size will be considered when auto-sizing columns.
bool d_autoSizeColumnUsesHeader;
friend class MultiColumnListWindowRenderer;
private:
/*************************************************************************
Private methods
*************************************************************************/
void addMultiColumnListProperties(void);
};
template<>
class PropertyHelper<MultiColumnList::SelectionMode>
{
public:
typedef MultiColumnList::SelectionMode return_type;
typedef return_type safe_method_return_type;
typedef MultiColumnList::SelectionMode pass_type;
typedef String string_return_type;
static const String& getDataTypeName()
{
static String type("SelectionMode");
return type;
}
static return_type fromString(const String& str)
{
MultiColumnList::SelectionMode mode;
if (str == "RowMultiple")
{
mode = MultiColumnList::RowMultiple;
}
else if (str == "ColumnSingle")
{
mode = MultiColumnList::ColumnSingle;
}
else if (str == "ColumnMultiple")
{
mode = MultiColumnList::ColumnMultiple;
}
else if (str == "CellSingle")
{
mode = MultiColumnList::CellSingle;
}
else if (str == "CellMultiple")
{
mode = MultiColumnList::CellMultiple;
}
else if (str == "NominatedColumnSingle")
{
mode = MultiColumnList::NominatedColumnSingle;
}
else if (str == "NominatedColumnMultiple")
{
mode = MultiColumnList::NominatedColumnMultiple;
}
else if (str == "NominatedRowSingle")
{
mode = MultiColumnList::NominatedRowSingle;
}
else if (str == "NominatedRowMultiple")
{
mode = MultiColumnList::NominatedRowMultiple;
}
else
{
mode = MultiColumnList::RowSingle;
}
return mode;
}
static string_return_type toString(pass_type val)
{
switch(val)
{
case MultiColumnList::RowMultiple:
return String("RowMultiple");
break;
case MultiColumnList::ColumnSingle:
return String("ColumnSingle");
break;
case MultiColumnList::ColumnMultiple:
return String("ColumnMultiple");
break;
case MultiColumnList::CellSingle:
return String("CellSingle");
break;
case MultiColumnList::CellMultiple:
return String("CellMultiple");
break;
case MultiColumnList::NominatedColumnSingle:
return String("NominatedColumnSingle");
break;
case MultiColumnList::NominatedColumnMultiple:
return String("NominatedColumnMultiple");
break;
case MultiColumnList::NominatedRowSingle:
return String("NominatedRowSingle");
break;
case MultiColumnList::NominatedRowMultiple:
return String("NominatedRowMultiple");
break;
default:
return String("RowSingle");
break;
}
}
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIMultiColumnList_h_
|