|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <IMOpenAPIExamplegrid.h>
Public Member Functions | |
| void | ConstructL (TInt aGridResource, const TDesC &aImageFile) |
| ~CIMOpenAPIExampleGrid () | |
| void | SetCellSign (TGameSign aCellValue, TInt aCellIndex) |
| void | ResetGrid () |
Private Member Functions | |
| void | SizeChanged () |
| void | SetupGrid () |
| void | SetupGridIconsL (const TDesC &aImageFile) |
Private Attributes | |
| CDesCArray * | iArray |
Definition at line 30 of file IMOpenAPIExampleGrid.h.
|
|
Destructor. Definition at line 57 of file IMOpenAPIExampleGrid.cpp.
|
|
||||||||||||
|
ConstructL. 2nd phase constructor.
Definition at line 32 of file IMOpenAPIExampleGrid.cpp. References iArray, ResetGrid(), SetupGridIconsL(), and SizeChanged(). 00033 { 00034 // Construct the grid from resource 00035 TResourceReader reader; 00036 CEikonEnv::Static()->CreateResourceReaderLC(reader, aGridResource); 00037 ConstructFromResourceL(reader); 00038 CleanupStack::PopAndDestroy(); // reader 00039 00040 // Set up the icons 00041 SetupGridIconsL (aImageFile); 00042 00043 // set up text and icons in array 00044 iArray = static_cast<CDesCArray*>(this->Model()->ItemTextArray()); 00045 ResetGrid(); 00046 00047 // Draw the grid 00048 SizeChanged(); 00049 00050 }
|
|
||||||||||||
|
SetCellSign. Put the specified graphical cell sign to the specified index in grid
Definition at line 139 of file IMOpenAPIExampleGrid.cpp. References iArray. 00140 { 00141 _LIT(KFormatString, "%d"); 00142 TBuf<1> cellValueString; 00143 cellValueString.Format(KFormatString, aCellValue); 00144 00145 // return if index is out of bound 00146 if ( (aCellIndex>8) || (aCellIndex<0) ) 00147 return; 00148 iArray->Delete(aCellIndex); 00149 iArray->InsertL(aCellIndex,cellValueString); 00150 HandleItemAdditionL(); 00151 }
|
|
|
ResetGrid. Reset the whole grid and put empty signs Definition at line 158 of file IMOpenAPIExampleGrid.cpp. References iArray. 00159 { 00160 _LIT(KFormatString, "%d"); 00161 TBuf<2> cellValueString; 00162 00163 for (TInt i=0; i<9 ; i++) 00164 { 00165 cellValueString.Format(KFormatString, EEmptySign); 00166 iArray->Delete(i); 00167 iArray->InsertL(i,cellValueString); 00168 } 00169 HandleItemAdditionL(); 00170 }
|
|
|
SizeChanged. From CoeControl Definition at line 128 of file IMOpenAPIExampleGrid.cpp. References SetupGrid(). 00129 { 00130 CAknGrid::SizeChanged(); 00131 SetupGrid(); 00132 }
|
|
|
SetupGrid. Initialized the grid Definition at line 90 of file IMOpenAPIExampleGrid.cpp. 00091 { 00092 // Setup text foreground and background colours to default 00093 AknListBoxLayouts::SetupStandardGrid(*this); 00094 00095 00096 // Get local copies of data we will need 00097 CFormattedCellListBoxItemDrawer* itemDrawer = this->ItemDrawer(); 00098 TInt cellWidth = ColumnWidth(); 00099 TInt cellHeight = ItemHeight(); 00100 00101 00102 // Set up graphics subcells 00103 AknListBoxLayouts::SetupFormGfxCell(*this, //the grid 00104 itemDrawer, // the grid's drawer 00105 0, // index of the graphic within item strings 00106 1, // left position 00107 1, // top position 00108 0, // right - unused 00109 0, // bottom - unused 00110 cellWidth-4, // width of graphic 00111 cellHeight-4, // height of graphic 00112 TPoint (0, 0), // start position 00113 TPoint (cellWidth , cellHeight)); // end position 00114 CEikScrollBarFrame* frame = ScrollBarFrame(); 00115 00116 if (frame) 00117 { 00118 frame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); 00119 } 00120 00121 }
|
|
|
SetupGridIconsL. Initialized the grid icons with the images in given file name Definition at line 66 of file IMOpenAPIExampleGrid.cpp. 00067 { 00068 00069 // Create an array of icons, reading them from the file 00070 CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(KNumberOfIcons); 00071 CleanupStack::PushL(icons); 00072 00073 icons->AppendL( iEikonEnv->CreateIconL( aImageFile, 0, 3 ) ); 00074 icons->AppendL( iEikonEnv->CreateIconL( aImageFile, 1, 3 ) ); 00075 icons->AppendL( iEikonEnv->CreateIconL( aImageFile, 2, 3 ) ); 00076 00077 00078 00079 CleanupStack::Pop(icons); 00080 // passing ownership of icons 00081 ItemDrawer()->FormattedCellData()->SetIconArray(icons); 00082 00083 }
|
|
|
iArray. array of icons and text Definition at line 90 of file IMOpenAPIExampleGrid.h. |
|
© Nokia 2006 |