Vaca::ListView Class Reference

#include <ListView.h>

Inheritance diagram for Vaca::ListView:

Vaca::Widget Vaca::Component Vaca::Referenceable Vaca::NonCopyable

List of all members.


Detailed Description

A ListView control.

Public Member Functions

 ListView (Widget *parent, Style style=ListViewStyle)
 Creates a new ListView.
virtual ~ListView ()
virtual void setBgColor (const Color &color)
 Sets the background color.
Color getTextColor ()
void setTextColor (const Color &color)
Color getTextBgColor ()
void setTextBgColor (const Color &color)
ListViewType getType ()
void setType (ListViewType type)
void setNormalImageList (const ImageList &imageList)
void setSmallImageList (const ImageList &imageList)
void setStateImageList (const ImageList &imageList)
int addColumn (const String &header, TextAlign textAlign=TextAlign::Left)
int insertColumn (int columnIndex, const String &header, TextAlign textAlign=TextAlign::Left)
void removeColumn (int columnIndex)
 Removes the specified column columnIndex.
int getColumnCount ()
 Returns the number of columns.
Rect getColumnBounds (int columnIndex)
int getColumnWidth (int columnIndex)
 Returns the width (in pixels) of the specified columnIndex.
void setColumnWidth (int columnIndex, int width)
 Sets the width (in pixels) of the specified column columnIndex.
void setPreferredColumnWidth (int columnIndex, bool useHeader=true)
 Sets the width of the columnIndex to its preferred size.
int addItem (const String &text, int imageIndex=-1)
 Inserts a new item in the last position.
int insertItem (int itemIndex, const String &text, int imageIndex=-1)
 Inserts a new item in the itemIndex position.
void removeItem (int itemIndex)
 Removes one item from the list.
void removeAllItems ()
 Clears the list.
int getItemCount ()
 Returns the number of items.
Rect getItemBounds (int itemIndex, int code=LVIR_BOUNDS)
 TODO it's absolute or relative?
String getItemText (int itemIndex, int columnIndex=0)
 Returns the text of the specified item.
void setItemText (int itemIndex, const String &text, int columnIndex=0)
 Changes the text of the speficied item.
void editItemText (int itemIndex)
 Creates an Edit control to edit the specified item.
bool isItemSelected (int itemIndex)

Public Attributes

Signal1< void, ListViewEvent & > BeforeSelect
Signal1< void, ListViewEvent & > AfterSelect
Signal1< void, ListViewEvent & > ColumnClick

Protected Member Functions

virtual void onBeforeSelect (ListViewEvent &ev)
 Returns the index of the item that has the focus (LVM_GETSELECTIONMARK).
virtual void onAfterSelect (ListViewEvent &ev)
virtual void onColumnClick (ListViewEvent &ev)
virtual bool onReflectedNotify (LPNMHDR lpnmhdr, LRESULT &lResult)
 This method can be used to handle notifications (WM_NOTIFY(W32)) reflected from the parent.

Private Member Functions

void insertDummyColumn ()
void removeDummyColumn ()

Private Attributes

ImageList m_normalImageList
ImageList m_smallImageList
ImageList m_stateImageList

Constructor & Destructor Documentation

ListView::ListView ( Widget parent,
Style  style = ListViewStyle 
)

Creates a new ListView.

It uses the LVS_SHAREIMAGELISTS to avoid destroying the image-list that you specified using setImageList().

ListView::~ListView (  )  [virtual]


Member Function Documentation

void ListView::setBgColor ( const Color color  )  [virtual]

Sets the background color.

This color is used on WM_ERASEBKGND and WM_COLORCTL* messages. The default value is the System::getColor(COLOR_3DFACE).

See also:
getBgColor

Reimplemented from Vaca::Widget.

Color ListView::getTextColor (  ) 

void ListView::setTextColor ( const Color color  ) 

Color ListView::getTextBgColor (  ) 

void ListView::setTextBgColor ( const Color color  ) 

ListViewType ListView::getType (  ) 

void ListView::setType ( ListViewType  type  ) 

void ListView::setNormalImageList ( const ImageList imageList  ) 

void ListView::setSmallImageList ( const ImageList imageList  ) 

void ListView::setStateImageList ( const ImageList imageList  ) 

int ListView::addColumn ( const String header,
TextAlign  textAlign = TextAlign::Left 
)

int ListView::insertColumn ( int  columnIndex,
const String header,
TextAlign  textAlign = TextAlign::Left 
)

void ListView::removeColumn ( int  columnIndex  ) 

Removes the specified column columnIndex.

int ListView::getColumnCount (  ) 

Returns the number of columns.

Only for Report views.

Rect ListView::getColumnBounds ( int  columnIndex  ) 

int ListView::getColumnWidth ( int  columnIndex  ) 

Returns the width (in pixels) of the specified columnIndex.

Only for Report views.

void ListView::setColumnWidth ( int  columnIndex,
int  width 
)

Sets the width (in pixels) of the specified column columnIndex.

Only for Report views.

void ListView::setPreferredColumnWidth ( int  columnIndex,
bool  useHeader = true 
)

Sets the width of the columnIndex to its preferred size.

If useHeader is true means that in the preferred size must be included the header, not just the items' text. Only for Report views.

int ListView::addItem ( const String text,
int  imageIndex = -1 
)

Inserts a new item in the last position.

int ListView::insertItem ( int  itemIndex,
const String text,
int  imageIndex = -1 
)

Inserts a new item in the itemIndex position.

Returns:
The index (generally itemIndex).

void ListView::removeItem ( int  itemIndex  ) 

Removes one item from the list.

void ListView::removeAllItems (  ) 

Clears the list.

int ListView::getItemCount (  ) 

Returns the number of items.

Rect ListView::getItemBounds ( int  itemIndex,
int  code = LVIR_BOUNDS 
)

TODO it's absolute or relative?

String ListView::getItemText ( int  itemIndex,
int  columnIndex = 0 
)

Returns the text of the specified item.

void ListView::setItemText ( int  itemIndex,
const String text,
int  columnIndex = 0 
)

Changes the text of the speficied item.

The columnIndex can be used to change the text of the different columns in a Report view.

void ListView::editItemText ( int  itemIndex  ) 

Creates an Edit control to edit the specified item.

bool ListView::isItemSelected ( int  itemIndex  ) 

void ListView::onBeforeSelect ( ListViewEvent ev  )  [protected, virtual]

Returns the index of the item that has the focus (LVM_GETSELECTIONMARK).

void ListView::onAfterSelect ( ListViewEvent ev  )  [protected, virtual]

void ListView::onColumnClick ( ListViewEvent ev  )  [protected, virtual]

bool ListView::onReflectedNotify ( LPNMHDR  lpnmhdr,
LRESULT &  lResult 
) [protected, virtual]

This method can be used to handle notifications (WM_NOTIFY(W32)) reflected from the parent.

Parameters:
lpnmhdr Information about the notification message.
lResult Result to return by the wndProc method.
Returns:
False if it doesn't use the notification.

Reimplemented from Vaca::Widget.

void ListView::insertDummyColumn (  )  [private]

void ListView::removeDummyColumn (  )  [private]


Member Data Documentation