CAknGridView Class Reference

#include <mw/AknGridView.h>

Link against: avkon.lib

class CAknGridView : public CListBoxView

Inherits from

Nested Classes and Structures

Public Member Enumerations
enumTGridFlags { EPrimaryIsVertical, ETopToBottom, ELeftToRight }
enumTScrollingType { EScrollFollowsItemsAndStops, EScrollFollowsItemsAndLoops, EScrollFollowsGrid, EScrollStops, ..., EScrollIncrementLineAndLoops }
Protected Member Enumerations
enumTPageIndex { EPreviousPage, ENextPage, EHome, EEnd }
enumTPositionCurrentIndex { EPage, EColumn, EOppositeCorner }
Public Member Functions
CAknGridView()
virtual ~CAknGridView()
IMPORT_C TIntActualDataIndex(TInt)
virtual IMPORT_C voidCalcBottomItemIndex()
virtual IMPORT_C voidCalcDataWidth()
IMPORT_C voidCalcItemIndexFromRowAndColIndexes(TInt &, TInt, TInt)
virtual IMPORT_C TIntCalcNewTopItemIndexSoItemIsVisible(TInt)
IMPORT_C voidCalcRowAndColIndexesFromItemIndex(TInt, TInt &, TInt &)
virtual IMPORT_C TIntCalculateHScrollOffsetSoItemIsVisible(TInt)
TInt ColumnWidth()
IMPORT_C TIntCurrentDataIndex()
virtual IMPORT_C TIntCurrentItemIndex()
IMPORT_C voidDataIndexFromLogicalPos(TInt &, TInt, TInt)
virtual IMPORT_C voidDraw(const TRect *)
virtual IMPORT_C voidDrawEmptyList()
virtual IMPORT_C voidDrawItem(TInt)
virtual IMPORT_C voidDrawItemRange(TInt, TInt)
virtual IMPORT_C voidDrawMatcherCursor()
IMPORT_C TSizeGridCellDimensions()
IMPORT_C TBoolIsPrimaryVertical()
virtual IMPORT_C TPointItemPos(TInt)
virtual IMPORT_C TSizeItemSize(TInt)
IMPORT_C TIntListBoxIndex(TInt)
IMPORT_C voidListBoxIndexFromLogicalPos(TInt &, TInt, TInt)
IMPORT_C voidLogicalPosFromDataIndex(TInt, TInt &, TInt &)
IMPORT_C voidLogicalPosFromListBoxIndex(TInt, TInt &, TInt &)
virtual IMPORT_C voidMoveCursorL(TCursorMovement, TSelectionMode)
voidMoveCursorWithRepeatsL(TBool, TSelectionMode, TInt)
IMPORT_C voidMoveToItemIndexL(TInt, TSelectionMode)
IMPORT_C TIntNumberOfColsInView()
IMPORT_C TIntNumberOfRowsInView()
virtual IMPORT_C TBoolScrollToMakeItemVisible(TInt)
IMPORT_C voidSetColumnWidth(TInt)
IMPORT_C voidSetCurrentDataIndex(TInt)
IMPORT_C voidSetGridCellDimensions(TSize)
IMPORT_C voidSetGridDetails(SGrid)
virtual IMPORT_C voidSetItemHeight(TInt)
IMPORT_C voidSetPrimaryScrollingType(TScrollingType)
IMPORT_C voidSetSecondaryScrollingType(TScrollingType)
IMPORT_C voidSetSpacesBetweenItems(TSize)
virtual IMPORT_C voidSetTopItemIndex(TInt)
virtual IMPORT_C TIntVisibleWidth(const TRect &)
virtual IMPORT_C TBoolXYPosToItemIndex(TPoint, TInt &)
Protected Member Functions
IMPORT_C voidClearUnusedItemSpace(TInt, TInt)
IMPORT_C voidDoMoveL(TCursorMovement, TSelectionMode)
IMPORT_C voidDrawColumnRange(TInt, TInt)
CAknGridM *GridModel()
IMPORT_C TBoolItemExists(TInt)
IMPORT_C voidUpdateHScrollOffsetBasedOnTopItemIndex()
Inherited Attributes
CListBoxView::iBottomItemIndex
CListBoxView::iCurrentItemIndex
CListBoxView::iDataWidth
CListBoxView::iDisableVerticalLineDrawing
CListBoxView::iExtension
CListBoxView::iFlags
CListBoxView::iGc
CListBoxView::iGroupWin
CListBoxView::iHScrollOffset
CListBoxView::iItemDrawer
CListBoxView::iItemHeight
CListBoxView::iListEmptyText
CListBoxView::iModel
CListBoxView::iTopItemIndex
CListBoxView::iVerticalOffset
CListBoxView::iViewRect
CListBoxView::iWin
Inherited Enumerations
CListBoxView:TCursorMovement
CListBoxView:TFlags
CListBoxView:TSelectionMode
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CListBoxView::BackColor()const
CListBoxView::BottomItemIndex()const
CListBoxView::CEikListBox
CListBoxView::CListBoxView()
CListBoxView::ClearFlags(TInt)
CListBoxView::ClearSelection()
CListBoxView::ClearSelection(TBool)
CListBoxView::ClearSelectionAnchorAndActiveIndex()
CListBoxView::ConstructL(MListBoxModel *,CListItemDrawer *,CWsScreenDevice *,RWindowGroup *,RWindow *,const TRect &,TInt)
CListBoxView::DataWidth()const
CListBoxView::DeselectItem(TInt)
CListBoxView::DeselectRangeL(TInt,TInt)
CListBoxView::DisableVerticalLineDrawing(TBool)
CListBoxView::DrawEmptyList(const TRect &)const
CListBoxView::EmptyListText()const
CListBoxView::Flags()const
CListBoxView::GetSelectionIndexesL(CSelectionIndexArray *)const
CListBoxView::HScroll(TInt)
CListBoxView::HScrollOffset()const
CListBoxView::HideMatcherCursor()
CListBoxView::IsVisible()const
CListBoxView::ItemDrawer()const
CListBoxView::ItemHeight()const
CListBoxView::ItemIsPartiallyVisible(TInt)const
CListBoxView::ItemIsSelected(TInt)const
CListBoxView::ItemIsVisible(TInt)const
CListBoxView::ItemOffsetInPixels()const
CListBoxView::MatcherCursorPos()const
CListBoxView::NumberOfItemsThatFitInRect(const TRect &)const
CListBoxView::RedrawDisabled()const
CListBoxView::SelectItemL(TInt)
CListBoxView::SelectRangeL(TInt,TInt)
CListBoxView::SelectionIndexes()const
CListBoxView::SetAnchor(TInt)
CListBoxView::SetBackColor(TRgb)
CListBoxView::SetCurrentItemIndex(TInt)
CListBoxView::SetDimmed(TBool)
CListBoxView::SetDisableRedraw(TBool)
CListBoxView::SetEmphasized(TBool)
CListBoxView::SetFlags(TInt)
CListBoxView::SetHScrollOffset(TInt)
CListBoxView::SetItemOffsetInPixels(TInt)
CListBoxView::SetListEmptyTextL(const TDesC &)
CListBoxView::SetMatcherCursor(TBool)
CListBoxView::SetMatcherCursorColor(TRgb)
CListBoxView::SetMatcherCursorPos(TInt)
CListBoxView::SetPaintedSelection(TBool)
CListBoxView::SetScrolling(TBool)
CListBoxView::SetSelectionIndexesL(const CSelectionIndexArray *)
CListBoxView::SetTextColor(TRgb)
CListBoxView::SetViewRect(const TRect &)
CListBoxView::SetVisibilityObserver(MListVisibilityObserver *)
CListBoxView::TextColor()const
CListBoxView::ToggleItemL(TInt)
CListBoxView::TopItemIndex()const
CListBoxView::UpdateSelectionL(TSelectionMode)
CListBoxView::VScrollTo(TInt)
CListBoxView::VScrollTo(TInt,TRect &)
CListBoxView::VerticalMoveToItemL(TInt,TSelectionMode)
CListBoxView::ViewRect()const
CListBoxView::~CListBoxView()
Inherited Type Definitions
CListBoxView::CSelectionIndexArray

Detailed Description

CAknGridView handles the drawing, the mapping of the grid data index to the underlying listbox index (and vice versa) as well as the movement around the grid. Differentiation is needed between a data index and the list box index since the inherited list box code handles the top, bottom and current indexes as though everything is order topdown and left to right. This is no good for grid that maybe order in 8 different ways so need conversion between list box index and actual data index. List box index is the index for the data item according to the snaking list box format of numbering data items. Data index is the actual index in the grid according to the ordering applied to the data by the user. Note: the logical position is the intermediate form used to map from a list box index to a data index or vi sa versa. It is essentialy the position of the item in relation to the top left corner of the grid. I.e. the top left position has logical position 0,0.

Since
0.9

Member Enumeration Documentation

Enum TGridFlags

Enumeration flags for grid.

EnumeratorValueDescription
EPrimaryIsVertical0x0001

Vertical is primary direction.

ETopToBottom0x0002

From top to bottom.

ELeftToRight0x0004

From left to right.

Enum TPageIndex

Enumeration flags for pages.

EnumeratorValueDescription
EPreviousPage

Previous page.

ENextPage

Next page.

EHome

First page.

EEnd

Last page.

Enum TPositionCurrentIndex

EnumeratorValueDescription
EPage

Page.

EColumn

Column.

EOppositeCorner

Opposite corner.

Enum TScrollingType

Enumeration for different scrolling types.

EnumeratorValueDescription
EScrollFollowsItemsAndStops

Scrolling follows items and stops.

EScrollFollowsItemsAndLoops

Scrolling follows items and loops.

EScrollFollowsGrid

Scrolling follows grid.

EScrollStops

Scrolling stops.

EScrollIncrementLineAndStops

Scrolls one line and stops.

EScrollIncrementLineAndLoops

Scrolls one line and loops.

Constructor & Destructor Documentation

CAknGridView ( )

IMPORT_CCAknGridView()

Default C++ constructor.

~CAknGridView ( )

IMPORT_C~CAknGridView()[virtual]

Destructor.

Member Function Documentation

ActualDataIndex ( TInt )

IMPORT_C TIntActualDataIndex(TIntaListBoxIndex)const

Returns the actual index of given listbox index.

ParameterDescription
aListBoxIndexThe index of the listbox.

Returns: The actual data index.

CalcBottomItemIndex ( )

IMPORT_C voidCalcBottomItemIndex()[virtual]

This function has been overloaded to draw items correctly. Recalculates the bottom item s index. This is called by the list box control when either the size or the number of items in its model changes.

CalcDataWidth ( )

IMPORT_C voidCalcDataWidth()[virtual]

Calculates the data width in columns. iDataWidth is calculated based on model and drawer information.

CalcItemIndexFromRowAndColIndexes ( TInt &, TInt, TInt )

IMPORT_C voidCalcItemIndexFromRowAndColIndexes(TInt &aItemIndex,
TIntaRowIndex,
TIntaColIndex
)const

This function converts a row/column pair into the item index for that item.

ParameterDescription
aItemIndexReference to the item index.
aRowIndexRow index of the item.
aColIndexColumn index of the item.

CalcNewTopItemIndexSoItemIsVisible ( TInt )

IMPORT_C TIntCalcNewTopItemIndexSoItemIsVisible(TIntaItemIndex)const [virtual]

This function gets the item the view would need to be moved to in order to make the specified item visible.

ParameterDescription
aItemIndexThe item to make visible.

Returns: The item to scroll to to make aItemIndex visible.

CalcRowAndColIndexesFromItemIndex ( TInt, TInt &, TInt & )

IMPORT_C voidCalcRowAndColIndexesFromItemIndex(TIntaItemIndex,
TInt &aRowIndex,
TInt &aColIndex
)const

Converts an item index into the (row, column) pair describing that item.

ParameterDescription
aItemIndexThe item index.
aRowIndexReference to the row index.
aColIndexReference the column index.

CalculateHScrollOffsetSoItemIsVisible ( TInt )

IMPORT_C TIntCalculateHScrollOffsetSoItemIsVisible(TIntaItemIndex)[virtual]

Gets the number of columns that this view would need to be scrolled by to make the specified item visible. The function returns 0 if no scrolling is needed. ScrollToMakeItemVisible() uses this function.

ParameterDescription
aItemIndexItem to make visible.

Returns: The number of columns to scroll, or zero if no scrolling is needed.

ClearUnusedItemSpace ( TInt, TInt )

IMPORT_C voidClearUnusedItemSpace(TIntaStartItemIndex,
TIntaEndItemIndex
)const [protected]

This function clears each item s rectangle between the specified start and finish item s indexes.

ParameterDescription
aStartItemIndexThe first item to clear.
aEndItemIndexThe last item to clear.

ColumnWidth ( )

TInt ColumnWidth()const [inline]

This function gets the width of all columns in the view.

Returns: The width of all columns in the view, in pixels.

CurrentDataIndex ( )

IMPORT_C TIntCurrentDataIndex()const

Returns the current data index with respect to the ordering of the cells in the grid.

Returns: Current data index.

CurrentItemIndex ( )

IMPORT_C TIntCurrentItemIndex()const [virtual]

From CListBoxView. This function returns the current item in the grid and -1 if there is no current item,

Returns: The current item.

DataIndexFromLogicalPos ( TInt &, TInt, TInt )

IMPORT_C voidDataIndexFromLogicalPos(TInt &aItemIndex,
TIntaRowIndex,
TIntaColIndex
)const

Converts a logical position on the grid, where the co-ordinates are with respect to the top left hand corner of the grid, to an index for the cell with respect to the ordering of the cells in the grid.

ParameterDescription
aItemIndexReference to the index for the cell in the grid.
aRowIndexThe row in the grid.
aColIndexThe column in the grid.

DoMoveL ( TCursorMovement, TSelectionMode )

IMPORT_C voidDoMoveL(TCursorMovementaCursorMovement,
TSelectionModeaSelectionMode
)[protected]

This function handles movement routines.

ParameterDescription
aCursorMovementHandles cursor movements etc. ECursorNextItem and ECursorPreviousItem.
aSelectionModeModes for modifying the selection.

Draw ( const TRect * )

IMPORT_C voidDraw(const TRect *aClipRect = NULL)const [virtual]

This function draws every visible item into the specified rectangle. As implemented in CListBoxView, this function's argument is ignored and the internal viewing rectangle is used. See SetViewRect().

DrawColumnRange ( TInt, TInt )

IMPORT_C voidDrawColumnRange(TIntaStartColIndex,
TIntaEndColIndex
)const [protected]

This function draws every item in every column between the start and end columns inclusively.

ParameterDescription
aStartColIndexThe first column to draw.
aEndColIndexThe last column to draw.

DrawEmptyList ( )

IMPORT_C voidDrawEmptyList()const [virtual]

Draws empty grid list.

DrawItem ( TInt )

IMPORT_C voidDrawItem(TIntaItemIndex)const [virtual]

This has been overloaded to ensure that only valid cells are drawn and not the empty cells.

ParameterDescription
aItemIndexIndex number of the item to draw.

DrawItemRange ( TInt, TInt )

IMPORT_C voidDrawItemRange(TIntaStartItemIndex,
TIntaEndItemIndex
)const [virtual]

This function draws every item between the start and end indices inclusively.

ParameterDescription
aStartItemIndexThe first item to draw.
aEndItemIndexThe final item to draw.

DrawMatcherCursor ( )

IMPORT_C voidDrawMatcherCursor()[virtual]

From CListBoxView. Basically empty implementation of CListBoxView::DrawMatcherCursor.

GridCellDimensions ( )

IMPORT_C TSizeGridCellDimensions()const

Returns the current grid dimensions.

Returns: The size of the current grid.

GridModel ( )

CAknGridM *GridModel()const [protected, inline]

This inline function is grid model helper.

Returns: A pointer to CAknGridM object.

IsPrimaryVertical ( )

IMPORT_C TBoolIsPrimaryVertical()const

Returns ETrue if the primary dimension of the grid is vertical.

Returns: if vertical is set as primary, otherwise EFalse.

ItemExists ( TInt )

IMPORT_C TBoolItemExists(TIntaListBoxIndex)const [protected]

This function tests whether an item exists.

ParameterDescription
aListBoxIndexIndex to test.

Returns: ETrue if the specified item exists, EFalse otherwise.

ItemPos ( TInt )

IMPORT_C TPointItemPos(TIntaItemIndex)const [virtual]

This function gets the position of the top left corner of the specified item, in pixels.

ParameterDescription
aItemIndexAn item in the model.

Returns: TPoint position of the top left corner of the item, in pixels.

ItemSize ( TInt )

IMPORT_C TSizeItemSize(TIntaItemIndex = 0)const [virtual]

Gets the size of the specified item.

Returns: TSize The size of the item in pixels.

ListBoxIndex ( TInt )

IMPORT_C TIntListBoxIndex(TIntaDataIndex)const

Returns the listbox index of given data index.

ParameterDescription
aDataIndexThe index of the actual data.

Returns: The index in listbox.

ListBoxIndexFromLogicalPos ( TInt &, TInt, TInt )

IMPORT_C voidListBoxIndexFromLogicalPos(TInt &aItemIndex,
TIntaRowIndex,
TIntaColIndex
)const

Converts a CEikListBox index for a cell in the grid, given with respect to the snaking listbox top down, left to right structure underlying the grid structure, to a logical position on the grid, where the co-ordinates are with respect to the top left hand corner of the grid.

ParameterDescription
aItemIndexReference to the index for the cell in the grid.
aRowIndexThe row in the grid.
aColIndexThe column in the grid.

LogicalPosFromDataIndex ( TInt, TInt &, TInt & )

IMPORT_C voidLogicalPosFromDataIndex(TIntaItemIndex,
TInt &aRowIndex,
TInt &aColIndex
)const

Converts an index for a cell in the grid, given with respect to the ordering of the cells in the grid, to a logical position on the grid, where the co-ordinates are with respect to the top left hand corner of the grid.

ParameterDescription
aItemIndexThe index for the cell in the grid.
aRowIndexReference to the row in the grid.
aColIndexReference to the column in the grid.

LogicalPosFromListBoxIndex ( TInt, TInt &, TInt & )

IMPORT_C voidLogicalPosFromListBoxIndex(TIntaItemIndex,
TInt &aRowIndex,
TInt &aColIndex
)const

Converts a logical position on the grid, where the co-ordinates are with respect to the top left hand corner of the grid, to a CEikListBox index for the cell with respect to the snaking listbox top down, left to right structure underlying the grid structure.

ParameterDescription
aItemIndexThe index for the cell in the grid.
aRowIndexReference to the row in the grid.
aColIndexReference to the column in the grid.

MoveCursorL ( TCursorMovement, TSelectionMode )

IMPORT_C voidMoveCursorL(TCursorMovementaCursorMovement,
TSelectionModeaSelectionMode
)[virtual]

Overloaded MoveCursorL method to process cursor movement according to orientation of the grid.

ParameterDescription
aCursorMovementThe cursor movement to apply etc. ECursorNextItem and ECursorPreviousItem.
aSelectionModeThe selection mode of the calling list box.

MoveCursorWithRepeatsL ( TBool, TSelectionMode, TInt )

voidMoveCursorWithRepeatsL(TBoolaNextOrPrev,
TSelectionModeaSelectionMode,
TIntaAmount
)
Moves cursor with repeats.
Since
S60 3.2
ParameterDescription
aSelectionModeselection mode.
aAmountAmount of steps to move.

MoveToItemIndexL ( TInt, TSelectionMode )

IMPORT_C voidMoveToItemIndexL(TIntaItemIndex,
TSelectionModeaSelectionMode
)

This moves to the item and draws the grid in the right place.

ParameterDescription
aItemIndexThe wanted item index.
aSelectionModeMode for modifying the selection.

NumberOfColsInView ( )

IMPORT_C TIntNumberOfColsInView()const

This function returns the number of visible columns.

Returns: The number of visible columns in view.

NumberOfRowsInView ( )

IMPORT_C TIntNumberOfRowsInView()const

This function returns the number of visible rows.

Returns: The number of visible rows in view.

ScrollToMakeItemVisible ( TInt )

IMPORT_C TBoolScrollToMakeItemVisible(TIntaItemIndex)[virtual]

Makes the specified item visible by moving the view location and redrawing the control. Index of the item to make visible.

ParameterDescription
aItemIndexIndex of the item to make visible.

Returns: ETrue if the control was redrawn, EFalse if no redraw happened (i.e. the item was already visible, or redraw was disabled).

SetColumnWidth ( TInt )

IMPORT_C voidSetColumnWidth(TIntaColumnWidth)

This function sets the width of the grid column. This should only be called via the selection box class's SetColumnWidth method.

ParameterDescription
aColumnWidthThe required width of all columns in the view, in pixels.

SetCurrentDataIndex ( TInt )

IMPORT_C voidSetCurrentDataIndex(TIntaDataIndex)

Sets the current data index with a value given with respect to the ordering of the cells in the grid.

ParameterDescription
aDataIndexThe index to be set.

SetGridCellDimensions ( TSize )

IMPORT_C voidSetGridCellDimensions(TSizeaGridDimensions)

Checks that number of cells in the grid is always enough to fill the current grid dimensions. This method should be called after any method that may alter the amount of data within the grid.

ParameterDescription
aGridDimensionsGrid diemnsions.

SetGridDetails ( SGrid )

IMPORT_C voidSetGridDetails(SGridaGridDetails)

Grid initialisation function.

ParameterDescription
aGridDetailsStruct of grid details.

SetItemHeight ( TInt )

IMPORT_C voidSetItemHeight(TIntaItemHeight)[virtual]

This function sets item height in pixels.

ParameterDescription
aItemHeightNew height in pixels for this view s items.

SetPrimaryScrollingType ( TScrollingType )

IMPORT_C voidSetPrimaryScrollingType(TScrollingTypeaScrollingType)

Sets the form of scroll to activate upon reaching the limit when moving in the primary direction of grid, primary meaning whether the items are organised vertically or horizontally.

ParameterDescription
aScrollingTypeThe primary scrolling type.

SetSecondaryScrollingType ( TScrollingType )

IMPORT_C voidSetSecondaryScrollingType(TScrollingTypeaSecondaryScrolling)

Sets the form of scroll to activate upon reaching the limit when moving in the secondary direction of grid.

ParameterDescription
aSecondaryScrollingThe secondary scrolling type.

SetSpacesBetweenItems ( TSize )

IMPORT_C voidSetSpacesBetweenItems(TSizeaSizeOfSpaceBetweenItems)

Sets the size of the spaces between items.

ParameterDescription
aSizeOfSpaceBetweenItemsThe size of the spaces between items.

SetTopItemIndex ( TInt )

IMPORT_C voidSetTopItemIndex(TIntaItemIndex)[virtual]

Sets which item appears at the top left corner of the view. The function changes items displayed in the view appropriately.

ParameterDescription
aItemIndexIndex of the item to set at the top left.

UpdateHScrollOffsetBasedOnTopItemIndex ( )

IMPORT_C voidUpdateHScrollOffsetBasedOnTopItemIndex()[protected]

This function updates the horizontal scroll offset (iHScrollOffset) based on the top item s index. This function is called internally by CEikSnakingListBoxes when needed.

VisibleWidth ( const TRect & )

IMPORT_C TIntVisibleWidth(const TRect &aRect)const [virtual]

Gets the visible width of the specified rectangle in pixels.

ParameterDescription
aRectReference to the rectangle for which to get the visible width.

Returns: Visible width of aRect in pixels.

XYPosToItemIndex ( TPoint, TInt & )

IMPORT_C TBoolXYPosToItemIndex(TPointaPosition,
TInt &aItemIndex
)const [virtual]

Converts a pixel position into an item index.

The function returns ETrue and sets aItemIndex to the index of the item whose bounding box contains aPosition. Returns EFalse if no such item exists.

ParameterDescription
aPositionA position relative to the origin of the list box control.
aItemIndexIs set to the item at that position.

Returns: ETrue if there was an item at aPosition.