📄 aknexgridcontainerasselection.h
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */
#ifndef __AKNEXGRIDCONTAINERASSELECTION_H__
#define __AKNEXGRIDCONTAINERASSELECTION_H__
// INCLUDES
#include <AknGridView.h> // for TScrollingType
#include "AknExGridCommonConstants.h"
// CONSTANTS
// The initial number of items
const TInt KNumOfSelectionColumns = 3;
const TInt KNumOfSelectionRows = 3;
// The initial number of items to be created.
const TInt KInitialNumOfItemsInSelection = 10;
// Number of components in the selection container
const TInt KNumberOfComponentSelection = 3;
// The default text color is black.
const TInt KDefaultTextColor = 215;
// In a cell, the area of graphics : text = 1 : ( KGraphicAreaRatio - 1 )
const TInt KTextAreaRatio = 3;
// For grid layout.
const TInt KAknExGridItemLeft = 0;
const TInt KAknExGridItemTop = 0;
// Index of a graphic and text in the resource
const TInt KIndexOfGraphic = 0;
const TInt KIndexOfText = 1;
// The maximum number of bitmaps to use as graphics in the cell
const TInt KNumberOfBitmap = 10;
// The length of strings
const TInt KLengthOfStringToShowIndex = 40;
const TInt KLengthOfItemResourceString = 40;
const TInt KLengthOfEmptyText = 40;
const TInt KMarginEmptyText = 20;
// If RemoveDataL() is called with KRemoveAllItems, it removes all items.
const TInt KRemoveAllItems = -1;
// If RemoveDataL() is called with KRemoveFromCurrent,
// items are removed from the current index.
const TBool KRemoveFromCurrent = ETrue;
// If RemoveDataL() is called with KRemoveFromLast,
// items are removed from the current index.
const TBool KRemoveFromLast = EFalse;
// For "MarkableGrid"
const TInt KAknExGridMarkSize = 19;
const TInt KAknExGridMarkableIconPosition = 0;
const TInt KAknExGridMarkableMarkPosition = 1;
const TInt KAknExGridMarkableTextPosition = 2;
_LIT( KAknExGridMarkableMarkReplace,"2" );
// path and name of mbm file
_LIT( KPathAppMbm, "\\system\\apps\\AknExGrid\\AknExGrid.mbm" );
// DATA TYPES
enum TPointerToComponentSelection
{
ELabel = 0,
EDoLabel,
EGrid
};
enum TContentType
{
EContainText = 0x0001, // contain only text
EContainGraphic = 0x0002, // contain only graphic
EContainBoth = 0x0004 // contain both text and graphic
};
enum TAknExGridGridType
{
EAknExGridSelectionGrid = 0, // Show grid as "Selection Grid"
EAknExGridMarkableGrid // Show grid as "Markable Grid"
};
// FORWARD DECLARATIONS
class CEikLabel; // for example labels
class CAknGrid; // for iGrid
class CAknGridM; // for iGridM
// CLASS DECLARATION
/**
* CAknExGridContainerAsSelection container control class.
*
*/
class CAknExGridContainerAsSelection : public CCoeControl,
public MCoeControlObserver
{
public: // Constructors and destructor
/**
* NewL.
* Two-phased constructor.
* @param aRect The rectangle this container will be drawn to.
* @param aGridType The grid type.
* @return Pointer to the created
* instance of CAknExGridContainerAsSelection.
*/
static CAknExGridContainerAsSelection* NewL( const TRect& aRect,
TAknExGridGridType aGridType);
/**
* NewLC.
* Two-phased constructor.
* @param aRect The rectangle this container will be drawn to.
* @param aGridType The grid type.
* @return Pointer to the created
* instance of CAknExGridContainerAsSelection.
*/
static CAknExGridContainerAsSelection* NewLC( const TRect& aRect,
TAknExGridGridType aGridType);
/**
* ~CAknExGridContainerAsSelection.
* Destructor.
*/
virtual ~CAknExGridContainerAsSelection();
public: // New functions
/**
* InsertDataL.
* Inserts data to the current index in grid.
* @param The number of items which are inserted.
*/
void InsertDataL( TInt aNum );
/**
* AddDataL.
* Adds data to the last index in the grid.
* @param The number of items which are added.
*/
void AddDataL( TInt aNum );
/**
* RemoveDataL.
* Removes data from the current or the last index in grid.
* @param aNum the number of items which is deleted.
* @param aWhere If ETrue,deletes items from the current index.
If EFalse,deletes items from the last index.
*/
void RemoveDataL( TInt aNum, TBool aWhere );
/**
* SetVerticalScrollingTypeL.
* Sets vertical scrolling type to member variables.
* @param aScrollingType Vertical scrolling type
*/
void SetVerticalScrollingTypeL(
CAknGridView::TScrollingType aScrollingType );
/**
* SetHorizontalScrollingTypeL.
* Sets horizontal scrolling type to member variables.
* @param aScrollingType Horizontal scrolling type
*/
void SetHorizontalScrollingTypeL(
CAknGridView::TScrollingType aScrollingType );
/**
* SetOrientation.
* Sets orientation to member variables.
* @param aVerticalOrientation If ETrue, primary orientation is vertical.
* @param aToRight If ETrue, filling order is from left to right.
* @param aToBottom If ETrue, filling order is from top to bottom.
*/
void SetOrientation( TBool aVerticalOrientation,
TBool aToRight,
TBool aToBottom );
/**
* GetOrientation.
* Gets orientation from member variables.
* @param aVerticalOrientation if ETrue, primary orientation is vertical.
* @param aToRight if ETrue, filling order is from left to right.
* @param aToBottom if ETrue, filling order is from top to bottom.
*/
void GetOrientation( TBool& aVerticalOrientation,
TBool& aToRight,
TBool& aToBottom );
/**
* DetermineFillingOrderL.
* Shows a dialog to determine filling order.
*/
void DetermineFillingOrderL();
/**
* NumberOfColumns.
* Gets the number of columns and set the number of columns to
* ChangeSize dialog.
* @return The number of columns in Selection Grid.
*/
TInt NumberOfColumns();
/**
* NumberOfRows.
* Gets the number of rows and set the number of rows to
* ChangeSize dialog.
* @return the number of rows in Selection Grid.
*/
TInt NumberOfRows();
/**
* SetNumberOfColumns.
* Updates the number of columns of Selection Grid with
* the number of columns in ChangeSize dialog.
* @param aNumberOfColumns The number of colulmns in ChangeSize dialog.
*/
void SetNumberOfColumns( TInt aNumberOfColumns );
/**
* SetNumberOfRows.
* Updates the number of rows of Selection Grid with
* the number of rows in ChangeSize dialog.
* @param aNumberOfRows the number of rows in ChangeSize dialog.
*/
void SetNumberOfRows( TInt aNumberOfRows );
/**
* DetermineChangeSizeL.
* Shows a dialog to determine change size.
*/
virtual void DetermineChangeSizeL();
/**
* SelectContents.
* Selects a kind of contents.
* @param aContents set TContentType
*/
void SelectContents( TInt aContents );
/**
* NumberOfItems.
* Returns the number of items stored away in the grid.
* @return The number of items
*/
TInt NumberOfItems();
/**
* SetNumberOfItems.
* Sets the number of items stored in the grid.
* @param aNumberOfItems The number of items.
*/
void SetNumberOfItems( TInt aNumberOfItems );
/**
* EnterNumberOfItemsL.
* Shows dialog to enter the number of items.
*/
void EnterNumberOfItemsL();
/**
* MarkAllItemsL.
* Select/Deselect/Toggle selection of all items.
* @param aCommand Menu-command that specifies how to set marks.
*/
void MarkAllItemsL( TInt aCommand );
/**
* AutoTestL.
* Runs different tests.
* @return ETrue if there are still tests to be run.
*/
TBool AutoTestL();
protected: // New functions
/**
* CreateGridResourceL.
* Prepares resources for the grid.
*/
void CreateGridResourceL();
/**
* LoadGraphicsL.
* Loads bitmap resources.
*/
void LoadGraphicsL();
/**
* SetGridLayoutL.
* Sets layout for the grid.
*/
void SetGridLayoutL();
/**
* ApplySelGridGraphicStyleL.
* Applies the layout to cells in the grid.
*/
void ApplySelGridGraphicStyleL();
/**
* CheckIndex.
* Shows the current index.
*/
void CheckIndex();
protected: // Constructors and destructors
/**
* CAknExGridContainerAsSelection.
* C++ default constructor.
*/
CAknExGridContainerAsSelection();
private: // Constructors and destructors
/**
* ConstructL.
* 2nd phase constructor.
* @param aRect Frame rectangle for container.
* @param aGridType The grid type.
*/
void ConstructL( const TRect& aRect, TAknExGridGridType aGridType);
private: // Functions from base classes
/**
* From CoeControl, SizeChanged.
* Called by framework when the view size is changed.
*/
void SizeChanged();
/**
* From CoeControl, CountComponentControls.
* Returns the number of components owned by this container.
* @return Number of component controls
*/
TInt CountComponentControls() const;
/**
* From CCoeControl, ComponentControl.
* Returns pointer to a particular control.
* @param aIndex Index of wanted control
* @return Pointer to component control
*/
CCoeControl* ComponentControl( TInt aIndex ) const;
/**
* From CCoeControl, Draw.
* Draws this container to the screen.
* @param aRect The region of the control to be redrawn.
*/
void Draw( const TRect& aRect ) const;
/**
* From MCoeControlObserver, HandleControlEventL
* Handle event from observed control.
* @param aControl The control that sent the event.
* @param aEventType The event type.
*/
void HandleControlEventL(
CCoeControl* aControl, TCoeEvent aEventType );
/**
* From CCoeControl, OfferKeyEventL.
* Handles key events.
* @param aKeyEvent the key event.
* @param aType The type of the event.
* @return Indicates whether or not the key event was used by
this control.
*/
TKeyResponse OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType );
protected : // Data
/**
* iGrid, grid.
* Owned by CAknExGridContainerAsSelection object.
*/
CAknGrid* iGrid;
/**
* iGridM, grid model.
* Not owned by CAknExGridContainerAsSelection object.
*/
CAknGridM* iGridM;
/**
* iVerticalOrientation, params used by SetGridLayoutL().
*/
TBool iVerticalOrientation;
/**
* iLeftToRight, fill order status
*/
TBool iLeftToRight;
/**
* iTopToBottom, fill order status
*/
TBool iTopToBottom;
/**
* iNumOfColumns, number of grid columns
*/
TInt iNumOfColumns;
/**
* iNumOfRows, number of grid rows
*/
TInt iNumOfRows;
/**
* iContentType, type of content
*/
TInt iContentType;
/**
* iSizeOfItems, sixe of grid items
*/
TSize iSizeOfItems;
/**
* iNumOfItems, number of grid items
*/
TInt iNumOfItems;
/**
* iInstantsCreated, indicates whether the Select or the
* Menu grid is used.
*/
TBool iInstantsCreated;
/**
* iVerticalScrollingType, scrolling type
*/
CAknGridView::TScrollingType iVerticalScrollingType;
/**
* iHorizontalScrollingType, scrolling type
*/
CAknGridView::TScrollingType iHorizontalScrollingType;
/**
* iGridType, the specific grid type
*/
TAknExGridGridType iGridType;
private: // Enumerations
enum TSelectionTitles
{
ESelectionTest1=0,
ESelectionTest2,
ESelectionTest3,
ESelectionTest4,
ESelectionTest5,
ESelectionTest6,
ESelectionTest7,
ESelectionTest8,
ESelectionTest9,
ESelectionTest10,
ESelectionTest11,
ESelectionTest12,
ESelectionTest13,
ESelectionTest14,
ESelectionTest15,
ESelectionTest16,
ESelectionTest17,
ESelectionTest18,
ENumberOfSelectionTitles
};
enum TMarkableTitles
{
EMarkableTest1=0,
ENumberOfMarkableTitles
};
private: //data
/**
* iLabel, example label.
* Owned by CAknExGridContainer object.
*/
CEikLabel* iLabel;
/**
* iToDoLabel, example label.
* Owned by CAknExGridContainer object.
*/
CEikLabel* iToDoLabel;
/**
* iTitles, the title list.
* Owned by CAknExGridContainerAsGMS object.
*/
CDesCArrayFlat* iTitles;
/**
* iTestNumber, the next test to be run.
*/
TInt iTestNumber;
};
#endif // __AKNEXGRIDCONTAINERASSELECTION_H__
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -