class MASKING_DLL_DECLSPEC Item

Represent one listbox item (one row of values)

Public Fields

[more]int sortColumn
Index of the column that is to be used for sorting.
[more]int sortOrder
The sorting order.

Public Methods

[more]virtual bool operator<(const Item &rhs) const
The less than operator.
[more]virtual void InsertColumn(int index=-1)
Inserts a new column (subitem) with an empty string at the specified index.
[more]virtual void DeleteColumn(int index)
Deletes the specified column
[more]virtual int GetColumnCount()
Returns the number of subitems in this item
[more]virtual int h()
Returns the rendering height of the item.
[more]virtual bool IsSelected()
Checks whether the item is selected or not
[more]virtual void Select()
Selects the item
[more]virtual void Deselect()
Deselects the item
[more]virtual void Toggle()
Toggles item selection status
[more] Item(const Item &rhs, long userData=0)
Copy constructor
[more]Item& operator=(const Item &rhs)
Assignment operator
[more]virtual void SetText(const char* str, int index=0)
Sets the value of the specified subitem
[more]virtual const char* GetText(int index=0) const
Retreives the value of the specified subitem

Protected Fields

[more]std::vector<std::string> cells
Vector of item values (strings), one for each column
[more]ListBoxEx* parent
A pointer to the item's parent listbox.
[more]bool selected
True when the item is selected, false otherwise

Protected Methods

[more]virtual void DrawBackground(Bitmap &dst, int state, const Rect &dstRect)
Draws background for the entire row.
[more]virtual void DrawItem(Bitmap &canvas, int i, int state, const Rect &dstRect)
Draws contents (ie.
[more]virtual void DrawGrid(Bitmap &canvas, int i, int state, const Rect &dstRect)
Draws gridlines for this item and column i.


Documentation

Represent one listbox item (one row of values)
ostd::vector<std::string> cells
Vector of item values (strings), one for each column

oListBoxEx* parent
A pointer to the item's parent listbox. The item uses this pointer to access bitmaps, fonts and colours in the skin that is used to skin the listbox.

obool selected
True when the item is selected, false otherwise

oint sortColumn
Index of the column that is to be used for sorting. The listbox sets this value as necessary when sorting the list.

oint sortOrder
The sorting order. Positive for ascending order, negative for descending.

ovirtual bool operator<(const Item &rhs) const
The less than operator. Used for sorting lists. Overload this for custom sorting. The default implementation sorts lexicographically. The operator should use sortColumn and sortOrder to calculate the result. It should return true if this item should come before the item in the right side of the comparison expression, false if it should come after. If items are equal, the order is arbitrary.

ovirtual void DrawBackground(Bitmap &dst, int state, const Rect &dstRect)
Draws background for the entire row. State is different than in most other widgets. Each item can be in one of 8 states (as opposed to just 4):
      0 - list does not have focus, item is not selected
      1 - list does not have focus, item is selected
      2 - list has focus, item is not the focus item, item is not selected
      3 - list has focus, item is the focus item, item is not selected
      4 - list has focus, item is the focus item, item is selected
      5 - list has focus, item is not the focus item, item is selected
      6 - list is disabled, item is not selected
      7 - list is disabled, item is selected
This only applies to multiselect lists. In normal mode only states 0, 1, 5 and 6 are possible and are equivalent to the familiar states NORMAL, SELECTED, FOCUSED and DISABLED.

Parameters:
dst - the destination bitmap
state - the state of the item as described above
dstRect - the clipping rectangle of the item; all drawing should be done inside this rectangle Overload this to implement custom drawing of the list item backgrounds.

ovirtual void DrawItem(Bitmap &canvas, int i, int state, const Rect &dstRect)
Draws contents (ie. the text) of the specified column of this item. All parameters are the same as for DrawBackground() with the addition of i which is the index of the column to be drawn. Overload this to implement custom drawing of list box items.

See Also:
DrawBackground

ovirtual void DrawGrid(Bitmap &canvas, int i, int state, const Rect &dstRect)
Draws gridlines for this item and column i. Default implementation draws the gridlines by drawing one vertical dotted line on the rightmost side of the item and one horizontal dotted line at the bottom of the item. Overload to draw some fancy custom gridlines.

See Also:
DrawItem

ovirtual void InsertColumn(int index=-1)
Inserts a new column (subitem) with an empty string at the specified index. If index is a negative number, new column is added to the en of the list. The listbox makes sure each item in the list always has the same number of subitmes as there are columns in the listbox.

ovirtual void DeleteColumn(int index)
Deletes the specified column

ovirtual int GetColumnCount()
Returns the number of subitems in this item

ovirtual int h()
Returns the rendering height of the item. The height of the skin bitmap used for rendering the list items is the default height. Overload this if you want items of different size.

ovirtual bool IsSelected()
Checks whether the item is selected or not

ovirtual void Select()
Selects the item

ovirtual void Deselect()
Deselects the item

ovirtual void Toggle()
Toggles item selection status

o Item(const Item &rhs, long userData=0)
Copy constructor

oItem& operator=(const Item &rhs)
Assignment operator

ovirtual void SetText(const char* str, int index=0)
Sets the value of the specified subitem

ovirtual const char* GetText(int index=0) const
Retreives the value of the specified subitem


This class has no child classes.
Friends:
class ListBoxEx

Alphabetic index Hierarchy of classes


Back to front page   |   page generated with DOC++