1 | /*********************************************************************** |
---|
2 | MultiColumnList |
---|
3 | ***********************************************************************/ |
---|
4 | struct MCLGridRef |
---|
5 | { |
---|
6 | unsigned int row; |
---|
7 | unsigned int column; |
---|
8 | |
---|
9 | //bool operator< (const MCLGridRef& rhs) const; |
---|
10 | //bool operator>= (const MCLGridRef& rhs) const; |
---|
11 | bool operator== (const MCLGridRef& rhs) const; |
---|
12 | |
---|
13 | MCLGridRef(unsigned int r, unsigned int c); |
---|
14 | }; |
---|
15 | |
---|
16 | |
---|
17 | /*********************************************************************** |
---|
18 | MultiColumnList |
---|
19 | ***********************************************************************/ |
---|
20 | class MultiColumnList : public Window |
---|
21 | { |
---|
22 | enum SelectionMode |
---|
23 | { |
---|
24 | RowSingle, |
---|
25 | RowMultiple, |
---|
26 | CellSingle, |
---|
27 | CellMultiple, |
---|
28 | NominatedColumnSingle, |
---|
29 | NominatedColumnMultiple, |
---|
30 | ColumnSingle, |
---|
31 | ColumnMultiple, |
---|
32 | NominatedRowSingle, |
---|
33 | NominatedRowMultiple |
---|
34 | }; |
---|
35 | |
---|
36 | bool isUserSortControlEnabled() const; |
---|
37 | bool isUserColumnSizingEnabled() const; |
---|
38 | bool isUserColumnDraggingEnabled() const; |
---|
39 | |
---|
40 | unsigned int getColumnCount() const; |
---|
41 | unsigned int getRowCount() const; |
---|
42 | unsigned int getSortColumn() const; |
---|
43 | unsigned int getColumnWithID(unsigned int col_id) const; |
---|
44 | unsigned int getColumnWithHeaderText(string text) const; |
---|
45 | |
---|
46 | UDim getTotalColumnHeadersWidth() const; |
---|
47 | UDim getColumnHeaderWidth(unsigned int col_idx) const; |
---|
48 | |
---|
49 | ListHeaderSegment::SortDirection getSortDirection() const; |
---|
50 | ListHeaderSegment& getHeaderSegmentForColumn(unsigned int col_idx) const; |
---|
51 | |
---|
52 | unsigned int getItemRowIndex(const ListboxItem* item) const; |
---|
53 | unsigned int getItemColumnIndex(const ListboxItem* item) const; |
---|
54 | |
---|
55 | MCLGridRef getItemGridReference(const ListboxItem* item) const; |
---|
56 | ListboxItem* getItemAtGridReference(const MCLGridRef& grid_ref) const; |
---|
57 | |
---|
58 | bool isListboxItemInColumn(const ListboxItem* item, unsigned int col_idx) const; |
---|
59 | bool isListboxItemInRow(const ListboxItem* item, unsigned int row_idx) const; |
---|
60 | bool isListboxItemInList(const ListboxItem* item) const; |
---|
61 | |
---|
62 | ListboxItem* findColumnItemWithText(string text, unsigned int col_idx, const ListboxItem* start_item) const; |
---|
63 | ListboxItem* findRowItemWithText(string text, unsigned int row_idx, const ListboxItem* start_item) const; |
---|
64 | ListboxItem* findListItemWithText(string text, const ListboxItem* start_item) const; |
---|
65 | ListboxItem* getFirstSelectedItem() const; |
---|
66 | ListboxItem* getNextSelected(const ListboxItem* start_item) const; |
---|
67 | |
---|
68 | unsigned int getSelectedCount() const; |
---|
69 | bool isItemSelected(const MCLGridRef& grid_ref) const; |
---|
70 | |
---|
71 | unsigned int getNominatedSelectionColumnID() const; |
---|
72 | unsigned int getNominatedSelectionColumn() const; |
---|
73 | unsigned int getNominatedSelectionRow() const; |
---|
74 | |
---|
75 | SelectionMode getSelectionMode() const; |
---|
76 | |
---|
77 | bool isVertScrollbarAlwaysShown() const; |
---|
78 | bool isHorzScrollbarAlwaysShown() const; |
---|
79 | |
---|
80 | unsigned int getColumnID(unsigned int col_idx) const; |
---|
81 | unsigned int getRowID(unsigned int row_idx) const; |
---|
82 | unsigned int getRowWithID(unsigned int row_id) const; |
---|
83 | |
---|
84 | Rect getListRenderArea() const; |
---|
85 | |
---|
86 | Scrollbar* getVertScrollbar() const; |
---|
87 | Scrollbar* getHorzScrollbar() const; |
---|
88 | ListHeader* getListHeader() const; |
---|
89 | |
---|
90 | float getTotalRowsHeight() const; |
---|
91 | float getWidestColumnItemWidth(unsigned int col_idx) const; |
---|
92 | float getHighestRowItemHeight(unsigned int row_idx) const; |
---|
93 | |
---|
94 | void resetList(); |
---|
95 | |
---|
96 | void addColumn(string text, unsigned int col_id, const UDim& width); |
---|
97 | void insertColumn(string text, unsigned int col_id, const UDim& width, unsigned int position); |
---|
98 | void removeColumn(unsigned int col_idx); |
---|
99 | void removeColumnWithID(unsigned int col_id); |
---|
100 | void moveColumn(unsigned int col_idx, unsigned int position); |
---|
101 | void moveColumnWithID(unsigned int col_id, unsigned int position); |
---|
102 | |
---|
103 | unsigned int addRow(); |
---|
104 | unsigned int addRow(ListboxItem* item, unsigned int col_id); |
---|
105 | unsigned int insertRow(unsigned int row_idx); |
---|
106 | unsigned int insertRow(ListboxItem* item, unsigned int col_id, unsigned int row_idx); |
---|
107 | void removeRow(unsigned int row_idx); |
---|
108 | |
---|
109 | void setItem(ListboxItem* item, const MCLGridRef& position); |
---|
110 | void setItem(ListboxItem* item, unsigned int col_id, unsigned int row_idx); |
---|
111 | |
---|
112 | void setSelectionMode(MultiColumnList::SelectionMode sel_mode); |
---|
113 | void setNominatedSelectionColumnID(unsigned int col_id); |
---|
114 | void setNominatedSelectionColumn(unsigned int col_idx); |
---|
115 | void setNominatedSelectionRow(unsigned int row_idx); |
---|
116 | |
---|
117 | void setSortDirection(ListHeaderSegment::SortDirection direction); |
---|
118 | void setSortColumn(unsigned int col_idx); |
---|
119 | void setSortColumnByID(unsigned int col_id); |
---|
120 | |
---|
121 | void setShowVertScrollbar(bool setting); |
---|
122 | void setShowHorzScrollbar(bool setting); |
---|
123 | |
---|
124 | void clearAllSelections(); |
---|
125 | |
---|
126 | void setItemSelectState(ListboxItem* item, bool state); |
---|
127 | void setItemSelectState(const MCLGridRef& grid_ref, bool state); |
---|
128 | |
---|
129 | void handleUpdatedItemData(); |
---|
130 | |
---|
131 | void setColumnHeaderWidth(unsigned int col_idx, const UDim& width); |
---|
132 | void setUserSortControlEnabled(bool setting); |
---|
133 | void setUserColumnSizingEnabled(bool setting); |
---|
134 | void setUserColumnDraggingEnabled(bool setting); |
---|
135 | void autoSizeColumnHeader(unsigned int col_idx); |
---|
136 | |
---|
137 | void setRowID(unsigned int row_idx, unsigned int row_id); |
---|
138 | }; |
---|