# CLVEasyItem

Derived from: public CLVListItem

Declared in: CLVEasyItem.h

Library: none

## Overview

A CLVEasyItem is a list item that automates display of text and graphics, automates string truncation of items that don't fit in the column, and automates sorting of the items based on the text. In most cases, it is best to use a CLVEasyItem instead of a CLVListItem, since it can save you a lot of work and gives nice results.

## Constructor and Destructor

### CLVEasyItem()

          CLVEasyItem(uint32 level = 0, bool superitem = false, bool expanded = false, float minheight = 0.0)
          CLVEasyItem(BMessage *archive)    /*Not implemented*/

Marks the CLVEasyItem as being at the specified outline level , as being an expandable superitem if the superitem flag is `true`, and as controlling an expanded section of the outline if the expanded flag is `true` or a collapsed section if expanded is `false`. Minheight specifies the minimum height that the item may be. This is useful if the item's height is to vary to respond to user preferences, but elements of the item (an icon, for example), place a constraint on how small the item may be. Outline levels are indicated by an index, with 0 as the outer level, 1 for one level of indentation, 2 for two levels of indentation, and so on.

Initially, the item has a width and height of 0.0 coordinate units, is enabled, and is not selected.

Construction from an archive is currently not implemented. It isn't high on my priorities, since archival is not something I'm making use of. If someone needs this functionality and fills it in, please send me the modified code so that others can benefit from it.

### ~CLVEasyItem()

          virtual ~CLVEasyItem()

Frees all memory used for storing the item's column contents.

## Member Functions

### Archive()

          virtual status_t Archive(BMessage *archive, bool deep = true) const

Currently not implemented. It isn't high on my priorities, since archival is not something I'm making use of. If someone needs this functionality and fills it in, please send me the modified code so that others can benefit from it.

See also: `BArchivable::Archive()`, `Instantiate()` static function

### GetColumnContentBitmap(), GetColumnContentText()

          const Bitmap* GetColumnContentBitmap(int column_index)
          const char* GetColumnContentText(int column_index)

Gets the contents of the specified column. If the column either has the wrong content type for the function version or no content, the function returns `NULL`.

See also: `SetColumnContent()`

### SetColumnContent()

          virtual void SetColumnContent(int column_index, const char *text, bool truncate = true)
          virtual void SetColumnContent(int column_index, const BBitmap *bitmap, float horizontal_offset = 2.0,
                bool copy = true); ;

For the text version, sets the column column_index to display the specified text. If truncate is `true`, if the text does not fit in the column, it will be truncated with an ellipsis instead of being chopped off at the edge of the column. If truncate is `true`, the CLVColumn for column_index should have its `CLV_HEADER_TRUNCATE` flag set, and must have its `CLV_TELL_ITEMS_WIDTH` flag set. In hierarchical ColumnListViews with string truncation columns, it is not advisable to have the `CLV_PUSH_PASS` flag set for a string truncation column. Doing so makes for bad UI since the text doesn't fall under its column header, and will cause some flicker during column resizing in the area where the content "encroaches" into the subsequent column. It can also lead to truncation failure for columns to the left of a column being resized (a display glitch, not a crash; it's a known bug which is being left for efficiency reasons because it only arises when these UI guidelines are ignored). The advisable column configuration is an expander column followed by an icon column with the `CLV_PUSH_PASS` flag set, followed by any number of string truncation or bitmap columns with the `CLV_PUSH_PASS` flag cleared.

For the bitmap version, sets the column column_index to display the specified bitmap. It will be rendered horizontal_offset pixels to the right of the left edge of the column. If copy is `true`, it will make a copy of the bitmap. Otherwise, it will just store a pointer to bitmap, and the application must not delete bitmap as long as the item is using it.

See also: `GetColumnContentBitmap()`,`GetColumnContentText()`

By Brian Tietz

Copyright 1997

Bug reports (including documentation errors) and feature requests can be sent to briant@digaudio.com.