struct CCL::IItemModel

Overview

Model interface for list and tree controls. More…

#include <iitemmodel.h>

struct IItemModel: public CCL::IUnknown
{
    // structs

    struct AccessibilityInfo;
    struct DrawInfo;
    struct EditInfo;
    struct StyleInfo;

    // methods

    virtual void CCL_API viewDetached (IItemView* itemView) = 0;
    virtual int CCL_API countFlatItems () = 0;
    virtual tbool CCL_API getRootItem (ItemIndex& index) = 0;
    virtual tbool CCL_API isItemFolder (ItemIndexRef index) = 0;
    virtual tbool CCL_API canExpandItem (ItemIndexRef index) = 0;
    virtual tbool CCL_API canAutoExpandItem (ItemIndexRef index) = 0;
    virtual tbool CCL_API getSubItems (IUnknownList& items, ItemIndexRef index) = 0;
    virtual IItemSelection*CCL_API getSelection () = 0;
    virtual tbool CCL_API getItemTitle (String& title, ItemIndexRef index) = 0;

    virtual tbool CCL_API getUniqueItemName (
        MutableCString& name,
        ItemIndexRef index
    ) = 0;

    virtual IImage*CCL_API getItemIcon (ItemIndexRef index) = 0;
    virtual IImage*CCL_API getItemThumbnail (ItemIndexRef index) = 0;

    virtual tbool CCL_API getItemTooltip (
        String& tooltip,
        ItemIndexRef index,
        int column
    ) = 0;

    virtual tbool CCL_API canSelectItem (ItemIndexRef index) = 0;

    virtual tbool CCL_API getItemAccessibilityInfo (
        AccessibilityInfo& info,
        ItemIndexRef index,
        int column
    ) const = 0;

    virtual tbool CCL_API onItemFocused (ItemIndexRef index) = 0;

    virtual tbool CCL_API openItem (
        ItemIndexRef index,
        int column,
        const EditInfo& info
    ) = 0;

    virtual tbool CCL_API canRemoveItem (ItemIndexRef index) = 0;
    virtual tbool CCL_API removeItem (ItemIndexRef index) = 0;

    virtual tbool CCL_API canInsertData (
        ItemIndexRef index,
        int column,
        const IUnknownList& data,
        IDragSession* session,
        IView* targetView = nullptr
    ) = 0;

    virtual tbool CCL_API insertData (
        ItemIndexRef index,
        int column,
        const IUnknownList& data,
        IDragSession* session
    ) = 0;

    virtual tbool CCL_API editCell (
        ItemIndexRef index,
        int column,
        const EditInfo& info
    ) = 0;

    virtual tbool CCL_API drawCell (
        ItemIndexRef index,
        int column,
        const DrawInfo& info
    ) = 0;

    virtual tbool CCL_API drawIconOverlay (ItemIndexRef index, const DrawInfo& info) = 0;
    virtual StringID CCL_API getItemBackground (ItemIndexRef index) = 0;

    virtual tbool CCL_API measureCellContent (
        Rect& size,
        ItemIndexRef index,
        int column,
        const StyleInfo& info
    ) = 0;

    virtual tbool CCL_API drawItem (ItemIndexRef index, const DrawInfo& info) = 0;
    virtual tbool CCL_API createColumnHeaders (IColumnHeaderList& list) = 0;
    virtual tbool CCL_API getSortColumnID (MutableCString& columnID, tbool& upwards) = 0;
    virtual IUnknown*CCL_API createDragSessionData (ItemIndexRef index) = 0;

    virtual tbool CCL_API appendItemMenu (
        IContextMenu& menu,
        ItemIndexRef item,
        const IItemSelection& selection
    ) = 0;

    virtual tbool CCL_API interpretCommand (
        const CommandMsg& msg,
        ItemIndexRef item,
        const IItemSelection& selection
    ) = 0;

    virtual ITouchHandler*CCL_API createTouchHandler (
        ItemIndexRef index,
        int column,
        const EditInfo& info
    ) = 0;
};

Inherited Members

public:
    // methods

    virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0;
    virtual unsigned int CCL_API retain () = 0;
    virtual unsigned int CCL_API release () = 0;

Detailed Documentation

Model interface for list and tree controls.

Methods

virtual void CCL_API viewDetached (IItemView* itemView) = 0

View ends to use the model.

virtual int CCL_API countFlatItems () = 0

Get item count of (flat) list.

virtual tbool CCL_API getRootItem (ItemIndex& index) = 0

Get tree root item.

virtual tbool CCL_API isItemFolder (ItemIndexRef index) = 0

Check if item is a folder.

virtual tbool CCL_API canExpandItem (ItemIndexRef index) = 0

Check if item can be expanded.

virtual tbool CCL_API canAutoExpandItem (ItemIndexRef index) = 0

Check if item can be expanded automatically on click (if tree view has style kTreeViewAutoExpand).

virtual tbool CCL_API getSubItems (IUnknownList& items, ItemIndexRef index) = 0

Get children of given item.

virtual IItemSelection*CCL_API getSelection () = 0

Get special item selection implementation provided by model.

Return null to use default selection of view.

virtual tbool CCL_API getItemTitle (String& title, ItemIndexRef index) = 0

Get title of specified item.

virtual tbool CCL_API getUniqueItemName (
    MutableCString& name,
    ItemIndexRef index
) = 0

Get a unique name (unique among siblings) of specified item.

Must not contain a ‘/’. Used for storing expand states of items.

virtual IImage*CCL_API getItemIcon (ItemIndexRef index) = 0

Get icon of specified item.

virtual IImage*CCL_API getItemThumbnail (ItemIndexRef index) = 0

Get thumbnail of specified item.

virtual tbool CCL_API getItemTooltip (
    String& tooltip,
    ItemIndexRef index,
    int column
) = 0

Get tooltip of specified item.

virtual tbool CCL_API canSelectItem (ItemIndexRef index) = 0

Check if item can be selected.

virtual tbool CCL_API getItemAccessibilityInfo (
    AccessibilityInfo& info,
    ItemIndexRef index,
    int column
) const = 0

Get accessibility info.

virtual tbool CCL_API onItemFocused (ItemIndexRef index) = 0

Item was focused.

virtual tbool CCL_API openItem (
    ItemIndexRef index,
    int column,
    const EditInfo& info
) = 0

Item was double-clicked, or [Enter] key was pressed.

virtual tbool CCL_API canRemoveItem (ItemIndexRef index) = 0

Check if item can be removed.

virtual tbool CCL_API removeItem (ItemIndexRef index) = 0

Item should be removed (e.g.

delete key pressed or dropped outside during drag session).

virtual tbool CCL_API canInsertData (
    ItemIndexRef index,
    int column,
    const IUnknownList& data,
    IDragSession* session,
    IView* targetView = nullptr
) = 0

Check if data can be inserted (during drag session).

virtual tbool CCL_API insertData (
    ItemIndexRef index,
    int column,
    const IUnknownList& data,
    IDragSession* session
) = 0

Insert data (during drag session).

virtual tbool CCL_API editCell (
    ItemIndexRef index,
    int column,
    const EditInfo& info
) = 0

Edit cell.

virtual tbool CCL_API drawCell (
    ItemIndexRef index,
    int column,
    const DrawInfo& info
) = 0

Draw cell in list or tree view.

virtual tbool CCL_API drawIconOverlay (ItemIndexRef index, const DrawInfo& info) = 0

Draw overlay on top of item icon (optional).

virtual StringID CCL_API getItemBackground (ItemIndexRef index) = 0

Get an optional background color id for an item.

It is looked up in the visual style of the ItemView.

virtual tbool CCL_API measureCellContent (
    Rect& size,
    ItemIndexRef index,
    int column,
    const StyleInfo& info
) = 0

Get size of cell content.

virtual tbool CCL_API drawItem (ItemIndexRef index, const DrawInfo& info) = 0

Draw custom item, i.e.

framework draws nothing (requires kListViewDrawCustomItem style).

virtual tbool CCL_API createColumnHeaders (IColumnHeaderList& list) = 0

Create column headers.

virtual tbool CCL_API getSortColumnID (MutableCString& columnID, tbool& upwards) = 0

Get identifier of current sort column.

virtual IUnknown*CCL_API createDragSessionData (ItemIndexRef index) = 0

Create object for dragging item data.

virtual tbool CCL_API appendItemMenu (
    IContextMenu& menu,
    ItemIndexRef item,
    const IItemSelection& selection
) = 0

Append context menu for selected items.

virtual tbool CCL_API interpretCommand (
    const CommandMsg& msg,
    ItemIndexRef item,
    const IItemSelection& selection
) = 0

Interpret commands for selected items.

virtual ITouchHandler*CCL_API createTouchHandler (
    ItemIndexRef index,
    int column,
    const EditInfo& info
) = 0

Create touch handler.