SimpleListView Class Reference

#include <c4d_listview.h>

Inheritance diagram for SimpleListView:

Detailed Description

A class for simple list views. See ListView.cpp SDK example.

Public Member Functions

 SimpleListView ()
 
virtual ~SimpleListView ()
 
Bool SetLayout (Int32 columns, const BaseContainer &data)
 
Bool SetItem (Int32 id, const BaseContainer &data)
 
Bool GetItem (Int32 id, BaseContainer *data)
 
Int32 GetItemCount ()
 
Bool GetItemLine (Int32 num, Int32 *id, BaseContainer *data)
 
Bool RemoveItem (Int32 id)
 
Int32 GetSelection (BaseSelect *selection)
 
Bool SetSelection (BaseSelect *selection)
 
Int32 GetProperty (Int32 id)
 
Bool SetProperty (Int32 id, Int32 val)
 
virtual void LvCallBack (Int32 &res_type, void *&result, void *secret, Int32 cmd, Int32 line, Int32 col, void *data1)
 
void ShowCell (Int32 line, Int32 col)
 
- Public Member Functions inherited from GeListView
 GeListView ()
 
virtual ~GeListView ()
 
Int LvCallBackLong (void *secret, Int32 cmd, Int32 line, Int32 col, void *data1)
 
void LvSuperCall (Int32 &res_type, void *&result, void *secret, Int32 cmd, Int32 line, Int32 col)
 
void Redraw ()
 
void DataChanged ()
 
Bool SendParentMessage (const BaseContainer &msg)
 
Int32 GetId ()
 
Bool ExtractMouseInfo (void *secret, MouseDownInfo &info, Int32 size)
 
Bool ExtractDrawInfo (void *secret, DrawInfo &info, Int32 size)
 
Bool AttachListView (GeDialog *cd, Int32 id)
 
void ShowCell (Int32 line, Int32 col)
 

Additional Inherited Members

- Protected Attributes inherited from GeListView
_GeListView * lv
 
GeDialogcd
 

Constructor & Destructor Documentation

◆ SimpleListView()

Constructor. Creates the list view, but does not attach it to any dialog.

See also
GeListView::AttachListView

◆ ~SimpleListView()

virtual ~SimpleListView ( )
virtual

Destructor. Destroys the list view.

Member Function Documentation

◆ SetLayout()

Bool SetLayout ( Int32  columns,
const BaseContainer data 
)

Sets the current column layout.
The data is layed out linearly in the supplied container, i.e. the order of the columns is specified by the order in which the items are added to the container.
Each item in the container represents one column. The ID of the element is the column ID. The value of the item (of type Int32) should be one of the following:

  • LV_COLUMN_TEXT
  • LV_COLUMN_CHECKBOX
  • LV_COLUMN_BUTTON

Here is an example:

#define COL_CHECK 'chck'
#define COL_NAME 'name'
#define COL_BUTTON 'bttn'
layout.SetInt32(COL_CHECK, LV_COLUMN_CHECKBOX);
layout.SetInt32(COL_NAME, LV_COLUMN_TEXT);
layout.SetInt32(COL_BUTTON, LV_COLUMN_BUTTON);
listview.SetLayout(3, layout);
Definition: c4d_basecontainer.h:47
void SetInt32(Int32 id, Int32 l)
Definition: c4d_basecontainer.h:505
@ LV_COLUMN_BUTTON
Button.
Definition: ge_prepass.h:5408
@ LV_COLUMN_CHECKBOX
Checkbox.
Definition: ge_prepass.h:5407
@ LV_COLUMN_TEXT
Text.
Definition: ge_prepass.h:5404
Parameters
[in]columnsThe number of columns.
[in]dataThe column data.
Returns
true if successful, otherwise false.

◆ SetItem()

Bool SetItem ( Int32  id,
const BaseContainer data 
)

Sets the data for a list view line, inserting a new one if it is not found.
The container should be filled with proper values for each column ID that needs to be changed/set.
Here is an example:

data.SetBool(COL_CHECK, obj.GetChecked());
data.SetString(COL_NAME, obj.GetName());
listview.SetItem(obj.GetID(), data);
void SetBool(Int32 id, Bool b)
Definition: c4d_basecontainer.h:498
void SetString(Int32 id, const maxon::String &s)
Definition: c4d_basecontainer.h:569
PyObject * obj
Definition: complexobject.h:60
Parameters
[in]idThe ID of the line.
[in]dataThe data for the line.
Returns
true if successful, otherwise false.

◆ GetItem()

Bool GetItem ( Int32  id,
BaseContainer data 
)

Retrieves the data for a list view line.

Parameters
[out]idThe ID of the line.
[out]dataFor each column of the line an item with the column ID is inserted into data.
Returns
true if successful, otherwise false.

◆ GetItemCount()

Int32 GetItemCount ( )

Gets the number of lines.

Returns
The number of lines in the list view.

◆ GetItemLine()

Bool GetItemLine ( Int32  num,
Int32 id,
BaseContainer data 
)

Like GetItem(), but with the line number instead of line ID.

Parameters
[in]numThe number of the line.
[out]idAssigned the line ID.
[out]dataFor each column of the line an item with the column ID is inserted into data.
Returns
true if successful, otherwise false.

◆ RemoveItem()

Bool RemoveItem ( Int32  id)

Removes a line from the list view.

Parameters
[in]idThe ID of the line.
Returns
true if successful, otherwise false.

◆ GetSelection()

Int32 GetSelection ( BaseSelect selection)

Retrieves the current selection.

Parameters
[out]selectionFilled with the current selection. Multiple selections are possible (see SLV_MULTIPLESELECTION). The caller owns the pointed container.
Returns
The number of selected items.

◆ SetSelection()

Bool SetSelection ( BaseSelect selection)

Sets the current selection.

Parameters
[in]selectionThe selection to set. Multiple selections are possible (see SLV_MULTIPLESELECTION). The caller owns the pointed container.
Returns
true if successful, otherwise false.

◆ GetProperty()

Int32 GetProperty ( Int32  id)

Retrieves a property for the list view.

Parameters
[in]idThe ID of the property: SLV
Returns
The property value.

◆ SetProperty()

Bool SetProperty ( Int32  id,
Int32  val 
)

Sets a property for the list view.

Parameters
[in]idThe ID of the property: SLV_MULTIPLESELECTION.
[in]valThe property value.
Returns
true if successful, otherwise false.

◆ LvCallBack()

virtual void LvCallBack ( Int32 res_type,
void *&  result,
void *  secret,
Int32  cmd,
Int32  line,
Int32  col,
void *  data1 
)
virtual

Internal.

Reimplemented from GeListView.

◆ ShowCell()

void ShowCell ( Int32  line,
Int32  col 
)

Scrolls to the cell specified by line and col.

Parameters
[in]lineThe line of the cell.
[in]colThe column of the cell.