29 #ifndef _CEGUIMultiColumnList_h_
30 #define _CEGUIMultiColumnList_h_
33 #include "../Window.h"
34 #include "./ListHeader.h"
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
52 MCLGridRef(uint r, uint c) : row(r), column(c) {}
193 NominatedColumnSingle,
194 NominatedColumnMultiple,
267 uint getSortColumnID(
void)
const;
816 void addColumn(
const String& value);
1668 bool handleHeaderScroll(
const EventArgs& e);
1669 bool handleHeaderSegMove(
const EventArgs& e);
1670 bool handleColumnSizeChange(
const EventArgs& e);
1671 bool handleHorzScrollbar(
const EventArgs& e);
1672 bool handleVertScrollbar(
const EventArgs& e);
1673 bool handleSortColumnChange(
const EventArgs& e);
1674 bool handleSortDirectionChange(
const EventArgs& e);
1675 bool handleHeaderSegDblClick(
const EventArgs& e);
1691 ListboxItem*
const& operator[](uint idx)
const {
return d_items[idx];}
1692 ListboxItem*& operator[](uint idx) {
return d_items[idx];}
1727 CEGUI_VECTOR_ALLOC(
ListRow)> ListItemGrid;
1740 void addMultiColumnListProperties(
void);
1753 static const String& getDataTypeName()
1755 static String type(
"SelectionMode");
1764 if (str ==
"RowMultiple")
1766 mode = MultiColumnList::RowMultiple;
1768 else if (str ==
"ColumnSingle")
1770 mode = MultiColumnList::ColumnSingle;
1772 else if (str ==
"ColumnMultiple")
1774 mode = MultiColumnList::ColumnMultiple;
1776 else if (str ==
"CellSingle")
1778 mode = MultiColumnList::CellSingle;
1780 else if (str ==
"CellMultiple")
1782 mode = MultiColumnList::CellMultiple;
1784 else if (str ==
"NominatedColumnSingle")
1786 mode = MultiColumnList::NominatedColumnSingle;
1788 else if (str ==
"NominatedColumnMultiple")
1790 mode = MultiColumnList::NominatedColumnMultiple;
1792 else if (str ==
"NominatedRowSingle")
1794 mode = MultiColumnList::NominatedRowSingle;
1796 else if (str ==
"NominatedRowMultiple")
1798 mode = MultiColumnList::NominatedRowMultiple;
1802 mode = MultiColumnList::RowSingle;
1811 case MultiColumnList::RowMultiple:
1812 return String(
"RowMultiple");
1815 case MultiColumnList::ColumnSingle:
1816 return String(
"ColumnSingle");
1819 case MultiColumnList::ColumnMultiple:
1820 return String(
"ColumnMultiple");
1823 case MultiColumnList::CellSingle:
1824 return String(
"CellSingle");
1827 case MultiColumnList::CellMultiple:
1828 return String(
"CellMultiple");
1831 case MultiColumnList::NominatedColumnSingle:
1832 return String(
"NominatedColumnSingle");
1835 case MultiColumnList::NominatedColumnMultiple:
1836 return String(
"NominatedColumnMultiple");
1839 case MultiColumnList::NominatedRowSingle:
1840 return String(
"NominatedRowSingle");
1843 case MultiColumnList::NominatedRowMultiple:
1844 return String(
"NominatedRowMultiple");
1848 return String(
"RowSingle");
1857 #if defined(_MSC_VER)
1858 # pragma warning(pop)
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: Element.h:211
Base class used as the argument to all subscribers Event object.
Definition: EventArgs.h:51
Base class for list box items.
Definition: ListboxItem.h:53
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition: InputEvent.h:281
Base class for the multi column list window renderer.
Definition: widgets/MultiColumnList.h:72
MultiColumnListWindowRenderer(const String &name)
Constructor.
virtual Rectf getListRenderArea(void) const =0
Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used fo...
Base class for the multi column list widget.
Definition: widgets/MultiColumnList.h:97
bool d_forceHorzScroll
true if horizontal scrollbar should always be displayed
Definition: widgets/MultiColumnList.h:1710
MultiColumnList::SelectionMode getSelectionMode(void) const
Return the currently set selection mode.
void setSortColumn(uint col_idx)
Set the column to be used as the sort key.
uint getColumnCount(void) const
Return the number of columns in the multi-column list.
void ensureItemIsVisible(const ListboxItem *item)
Ensure the specified item is made visible within the multi-column listbox.
bool d_autoSizeColumnUsesHeader
whether header size will be considered when auto-sizing columns.
Definition: widgets/MultiColumnList.h:1731
SelectionMode
Enumerated values for the selection modes possible with a Multi-column list.
Definition: widgets/MultiColumnList.h:188
bool isUserColumnSizingEnabled(void) const
Return whether the user may size column segments.
void setShowVertScrollbar(bool setting)
Set whether the vertical scroll bar should always be shown, or just when needed.
virtual void onSortDirectionChanged(WindowEventArgs &e)
Handler called when the sort direction changes.
bool selectRange(const MCLGridRef &start, const MCLGridRef &end)
select all strings between positions start and end. (inclusive). Returns true if something was modifi...
virtual void onMouseWheel(MouseEventArgs &e)
Handler called when the mouse wheel (z-axis) position changes within this window's area.
uint getNominatedSelectionRow(void) const
Return the index of the currently set nominated selection row to be used when in one of the Nominated...
void setShowHorzScrollbar(bool setting)
Set whether the horizontal scroll bar should always be shown, or just when needed.
uint getColumnID(uint col_idx) const
Return the ID code assigned to the requested column.
virtual void onListContentsChanged(WindowEventArgs &e)
Handler called when the list contents is changed.
ListboxItem * findRowItemWithText(const String &text, uint row_idx, const ListboxItem *start_item) const
Return the ListboxItem in row row_idx that has the text string text.
uint getNominatedSelectionColumnID(void) const
Return the ID of the currently set nominated selection column to be used when in one of the Nominated...
void setUserColumnSizingEnabled(bool setting)
Set whether the user may size column segments.
virtual bool validateWindowRenderer(const WindowRenderer *renderer) const
Function used in checking if a WindowRenderer is valid for this window.
bool d_multiSelect
Allow multiple selections.
Definition: widgets/MultiColumnList.h:1716
void ensureItemIsVisible(const MCLGridRef &grid_ref)
Ensure the item at the specified grid coordinate is visible within the multi-column listbox.
uint getColumnWithID(uint col_id) const
Return the zero based column index of the column with the specified ID.
static const String EventListContentsChanged
Definition: widgets/MultiColumnList.h:147
uint d_columnCount
keeps track of the number of columns.
Definition: widgets/MultiColumnList.h:1723
MCLGridRef getItemGridReference(const ListboxItem *item) const
Return the grid reference for item.
static const String EventHorzScrollbarModeChanged
Definition: widgets/MultiColumnList.h:135
void setSortColumnByID(uint col_id)
Set the column to be used as the sort key.
static const String ListHeaderName
Widget name for the list header component.
Definition: widgets/MultiColumnList.h:178
virtual void onMouseButtonDown(MouseEventArgs &e)
Handler called when a mouse button has been depressed within this window's area.
uint insertRow(uint row_idx, uint row_id=0)
Insert an empty row into the list box.
void setNominatedSelectionRow(uint row_idx)
Set the row to be used for the NominatedRow* selection modes.
void addColumn(const String &text, uint col_id, const UDim &width)
Add a column to the list box.
SelectionMode d_selectMode
Holds selection mode (represented by settings below).
Definition: widgets/MultiColumnList.h:1713
static const String EventListColumnSized
Definition: widgets/MultiColumnList.h:165
static const String EventListColumnMoved
Definition: widgets/MultiColumnList.h:171
void setSortDirection(ListHeaderSegment::SortDirection direction)
Set the sort direction to be used.
uint getItemRowIndex(const ListboxItem *item) const
Return the zero based index of the Row that contains item.
static const String VertScrollbarName
Widget name for the vertical scrollbar component.
Definition: widgets/MultiColumnList.h:176
virtual void onFontChanged(WindowEventArgs &e)
Handler called when the window's font is changed.
Scrollbar * getHorzScrollbar() const
Return a pointer to the horizontal scrollbar component widget for this MultiColumnList.
MultiColumnList(const String &type, const String &name)
Constructor for the Multi-column list base class.
ListboxItem * getItemAtPoint(const Vector2f &pt) const
Return the ListboxItem under the given window local pixel co-ordinate.
void setItem(ListboxItem *item, const MCLGridRef &position)
Set the ListboxItem for grid reference position.
void resortList()
Causes the internal list to be (re)sorted.
void moveColumn(uint col_idx, uint position)
Move the column at index col_idx so it is at index position.
void removeRow(uint row_idx)
Remove the list box row with index row_idx. Any ListboxItem in row row_idx using autoDelete mode will...
void removeColumn(uint col_idx)
Removes a column from the list box. This will cause any ListboxItem using the autoDelete option in th...
float getHighestRowItemHeight(uint row_idx) const
Return, in pixels, the height of the highest item in the given row.
void ensureItemRowIsVisible(const ListboxItem *item)
Ensure that the row of the item is visible within the multi-column listbox.
static const String EventSelectionModeChanged
Definition: widgets/MultiColumnList.h:111
uint getNominatedSelectionColumn(void) const
Return the index of the currently set nominated selection column to be used when in one of the Nomina...
void setUserColumnDraggingEnabled(bool setting)
Set whether the user may modify the order of the columns.
static const String HorzScrollbarName
Widget name for the horizontal scrollbar component.
Definition: widgets/MultiColumnList.h:177
uint getSortColumn(void) const
Return the zero based index of the current sort column. There must be at least one column to successf...
virtual void onSelectionModeChanged(WindowEventArgs &e)
Handler called when the selection mode of the list box changes.
bool d_useNominatedCol
true if we use a nominated col to select.
Definition: widgets/MultiColumnList.h:1720
Scrollbar * getVertScrollbar() const
Return a pointer to the vertical scrollbar component widget for this MultiColumnList.
void setItemSelectState(ListboxItem *item, bool state)
Sets or clears the selected state of the given ListboxItem which must be attached to the list.
bool resetList_impl(void)
Remove all items from the list.
UDim getColumnHeaderWidth(uint col_idx) const
Return the width of the specified column header (and therefore the column itself).
float getTotalRowsHeight(void) const
Return the sum of all row heights in pixels.
void setItemSelectState(const MCLGridRef &grid_ref, bool state)
Sets or clears the selected state of the ListboxItem at the given grid reference.
void ensureItemColumnIsVisible(const ListboxItem *item)
Ensure that the column of item is visible within the multi-column listbox.
virtual void onNominatedSelectRowChanged(WindowEventArgs &e)
Handler called when the nominated selection row changes.
ListHeaderSegment & getHeaderSegmentForColumn(uint col_idx) const
Return the ListHeaderSegment object for the specified column.
void setColumnHeaderWidth(uint col_idx, const UDim &width)
Set the width of the specified column header (and therefore the column itself).
virtual void onNominatedSelectColumnChanged(WindowEventArgs &e)
Handler called when the nominated selection column changes.
uint getRowCount(void) const
Return the number of rows in the multi-column list.
uint d_nominatedSelectCol
Nominated column for single column selection.
Definition: widgets/MultiColumnList.h:1714
uint insertRow(ListboxItem *item, uint col_id, uint row_idx, uint row_id=0)
Insert a row into the list box, and set the item in the column with ID col_id to item.
bool d_useNominatedRow
true if we use a nominated row to select.
Definition: widgets/MultiColumnList.h:1719
virtual void onSized(ElementEventArgs &e)
Handler called when the window's size changes.
UDim getTotalColumnHeadersWidth(void) const
Return the total width of all column headers.
bool setItemSelectState_impl(const MCLGridRef grid_ref, bool state)
Set select state for the given item. This appropriately selects other items depending upon the select...
void setItem(ListboxItem *item, uint col_id, uint row_idx)
Set the ListboxItem for the column with ID col_id in row row_idx.
ListHeaderSegment::SortDirection getSortDirection(void) const
Return the currently set sort direction.
ListboxItem * findColumnItemWithText(const String &text, uint col_idx, const ListboxItem *start_item) const
Return the ListboxItem in column col_idx that has the text string text.
Rectf getListRenderArea(void) const
Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used fo...
bool isListboxItemInList(const ListboxItem *item) const
return whether ListboxItem item is attached to the list box.
static const String EventNominatedSelectRowChanged
Definition: widgets/MultiColumnList.h:123
uint getRowID(uint row_idx) const
Return the ID code assigned to the requested row.
uint getSelectedCount(void) const
Return the number of selected ListboxItems attached to this list box.
ListHeader * getListHeader() const
Return a pointer to the list header component widget for this MultiColumnList.
static const String EventNominatedSelectColumnChanged
Definition: widgets/MultiColumnList.h:117
bool isListboxItemInRow(const ListboxItem *item, uint row_idx) const
return whether ListboxItem item is attached to the row at index row_idx.
void ensureRowIsVisible(uint row_idx)
Ensure that the row with index row_idx is visible within the multi-column listbox.
virtual void onListColumnSized(WindowEventArgs &e)
Handler called when a column is sized.
bool isItemSelected(const MCLGridRef &grid_ref) const
Return whether the ListboxItem at grid_ref is selected.
void setSelectionMode(MultiColumnList::SelectionMode sel_mode)
Set the selection mode for the list box.
bool clearAllSelections_impl(void)
Clear the selected state for all items (implementation)
ListboxItem * findListItemWithText(const String &text, const ListboxItem *start_item) const
Return the ListboxItem that has the text string text.
virtual void onSortColumnChanged(WindowEventArgs &e)
Handler called when the sort column changes.
static const String EventNamespace
Namespace for global events.
Definition: widgets/MultiColumnList.h:99
ListboxItem * getNextSelected(const ListboxItem *start_item) const
Return a pointer to the next selected ListboxItem after start_item.
bool d_fullRowSelect
All items in a row are selected.
Definition: widgets/MultiColumnList.h:1717
static const String WidgetTypeName
Window factory name.
Definition: widgets/MultiColumnList.h:100
void setRowID(uint row_idx, uint row_id)
Set the ID code assigned to a given row.
void setSelectForItemsInColumn(uint col_idx, bool state)
Set select state for all items in the given column.
void resetList(void)
Remove all items from the list.
static const String EventSelectionChanged
Definition: widgets/MultiColumnList.h:141
void ensureColumnIsVisible(uint column_idx)
Ensure that the column with ID column_idx is visible within the multi-column listbox.
void removeColumnWithID(uint col_id)
Removes a column from the list box. This will cause any ListboxItem using the autoDelete option in th...
ListItemGrid d_grid
Holds the list box data.
Definition: widgets/MultiColumnList.h:1728
static const String EventSortColumnChanged
Definition: widgets/MultiColumnList.h:153
bool isUserColumnDraggingEnabled(void) const
Return whether the user may modify the order of the columns.
void configureScrollbars(void)
Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used fo...
uint addRow(uint row_id=0)
Add an empty row to the list box.
virtual ~MultiColumnList(void)
Destructor for the multi-column list base class.
static const String EventVertScrollbarModeChanged
Definition: widgets/MultiColumnList.h:129
static const String EventSortDirectionChanged
Definition: widgets/MultiColumnList.h:159
bool isVertScrollbarAlwaysShown(void) const
Return whether the vertical scroll bar is always shown.
virtual void initialiseComponents(void)
Initialise the Window based object ready for use.
bool isUserSortControlEnabled(void) const
Return whether user manipulation of the sort column and direction are enabled.
void setSelectForItemsInRow(uint row_idx, bool state)
Set select state for all items in the given row.
void setNominatedSelectionColumn(uint col_idx)
Set the column to be used for the NominatedColumn* selection modes.
void insertColumn(const String &text, uint col_id, const UDim &width, uint position)
Insert a new column in the list.
bool d_forceVertScroll
true if vertical scrollbar should always be displayed
Definition: widgets/MultiColumnList.h:1709
uint getItemColumnIndex(const ListboxItem *item) const
Return the current zero based index of the column that contains item.
uint d_nominatedSelectRow
Nominated row for single row selection.
Definition: widgets/MultiColumnList.h:1715
bool getAutoSizeColumnUsesHeader() const
Get whether or not column auto-sizing (autoSizeColumnHeader()) will use the list header segment size.
ListboxItem * getFirstSelectedItem(void) const
Return a pointer to the first selected ListboxItem attached to this list box.
uint getRowWithID(uint row_id) const
Return the zero based row index of the row with the specified ID.
void moveColumn_impl(uint col_idx, uint position)
Move the column at index col_idx so it is at index position. Implementation version which does not mo...
ListboxItem * getItemAtGridReference(const MCLGridRef &grid_ref) const
Return a pointer to the ListboxItem at the specified grid reference.
void clearAllSelections(void)
Removed the selected state from any currently selected ListboxItem attached to the list.
uint addRow(ListboxItem *item, uint col_id, uint row_id=0)
Add a row to the list box, and set the item in the column with ID col_id to item.
ListboxItem * d_lastSelected
holds pointer to the last selected item (used in range selections)
Definition: widgets/MultiColumnList.h:1721
bool isListboxItemInColumn(const ListboxItem *item, uint col_idx) const
return whether ListboxItem item is attached to the column at index col_idx.
virtual void onHorzScrollbarModeChanged(WindowEventArgs &e)
Handler called when the horizontal scroll bar 'force' mode is changed.
bool d_fullColSelect
All items in a column are selected.
Definition: widgets/MultiColumnList.h:1718
void setNominatedSelectionColumnID(uint col_id)
Set the column to be used for the NominatedColumn* selection modes.
float getWidestColumnItemWidth(uint col_idx) const
Return the pixel width of the widest item in the given column.
virtual void onListColumnMoved(WindowEventArgs &e)
Handler called when the column order is changed.
void setAutoSizeColumnUsesHeader(bool include_header)
Instruct column auto-sizing (autoSizeColumnHeader()) to also use the list header segment size.
bool isHorzScrollbarAlwaysShown(void) const
Return whether the horizontal scroll bar is always shown.
virtual void onSelectionChanged(WindowEventArgs &e)
Handler called when the current selection changes.
void handleUpdatedItemData(void)
Inform the list box that one or more attached ListboxItems have been externally modified,...
virtual void onVertScrollbarModeChanged(WindowEventArgs &e)
Handler called when the vertical scroll bar 'force' mode is changed.
static bool pred_descend(const ListRow &a, const ListRow &b)
std algorithm predicate used for sorting in descending order
void moveColumnWithID(uint col_id, uint position)
Move the column with ID col_id so it is at index position.
void setUserSortControlEnabled(bool setting)
Set whether user manipulation of the sort column and direction are enabled.
void autoSizeColumnHeader(uint col_idx)
Automatically determines the "best fit" size for the specified column and sets the column width to th...
uint getColumnWithHeaderText(const String &text) const
Return the zero based index of the column whos header text matches the specified text.
Helper class used to convert various data types to and from the format expected in Property strings.
Definition: ForwardRefs.h:84
String class used within the GUI system.
Definition: String.h:64
Dimension that has both a relative 'scale' portion and and absolute 'offset' portion.
Definition: UDim.h:94
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:252
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:52
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
Class used to create XML Document.
Definition: XMLSerializer.h:87
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
bool CEGUIEXPORT operator<=(const String &str1, const String &str2)
Return true if String str1 is lexicographically less than or equal to String str2.
bool CEGUIEXPORT operator>(const String &str1, const String &str2)
Return true if String str1 is lexicographically greater than String str2.
bool CEGUIEXPORT operator<(const String &str1, const String &str2)
Return true if String str1 is lexicographically less than String str2.
bool CEGUIEXPORT operator>=(const String &str1, const String &str2)
Return true if String str1 is lexicographically greater than or equal to String str2.
bool CEGUIEXPORT operator!=(const String &str1, const String &str2)
Return true if String str1 is not equal to String str2.
bool CEGUIEXPORT operator==(const String &str1, const String &str2)
Return true if String str1 is equal to String str2.
Simple grid index structure.
Definition: widgets/MultiColumnList.h:51
uint row
Zero based row index.
Definition: widgets/MultiColumnList.h:54
uint column
Zero based column index.
Definition: widgets/MultiColumnList.h:55
Struct used internally to represent a row in the list and also to ease sorting of the rows.
Definition: widgets/MultiColumnList.h:1683