1.1 --- a/epoc32/include/grdstd.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,753 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#if !defined(__GRDSTD_H__)
1.20 -#define __GRDSTD_H__
1.21 -
1.22 -#if !defined(__E32STD_H__)
1.23 -#include <e32std.h>
1.24 -#endif
1.25 -#if !defined(__GDI_H__)
1.26 -#include <gdi.h>
1.27 -#endif
1.28 -#if !defined(__GRDCELLS_H__)
1.29 -#include <grdcells.h>
1.30 -#endif
1.31 -#if !defined(__GRDDEF_H__)
1.32 -#include <grddef.h>
1.33 -#endif
1.34 -
1.35 -
1.36 -
1.37 -class MGridTable
1.38 -/** An interface that can be implemented to provide row and column information.
1.39 -
1.40 -Note that for grids that have indefinite row boundaries, an implementation
1.41 -is mandatory.
1.42 -
1.43 -A concrete implementation is passed to a CGridLay object through its CGridLay::ConstructL()
1.44 -functions or its CGridLay::SetGridTable() function.
1.45 -
1.46 -@publishedAll
1.47 -@released */
1.48 - {
1.49 -public:
1.50 - enum
1.51 - {
1.52 - /** The number of rows returned by the default implementation of RowExtent(). */
1.53 - EDefaultRowExtent=20,
1.54 - /** The number of columns returned by the default implementation of ColumnExtent(). */
1.55 - EDefaultColumnExtent=20
1.56 - };
1.57 -public:
1.58 - IMPORT_C virtual TBool RequestRow(TInt aRow,TInt& aReturnRow) const;//If used should be derived from
1.59 - IMPORT_C virtual TInt RowExtent() const;
1.60 - IMPORT_C virtual TInt ColumnExtent() const;
1.61 - };
1.62 -
1.63 -
1.64 -////////////////////////->
1.65 -
1.66 -class TGridColors
1.67 -/** The grid colour specification.
1.68 -
1.69 -An object of this type encapsulates the colours to be used when drawing a
1.70 -grid cell.
1.71 -
1.72 -@publishedAll
1.73 -@released
1.74 -@see CGridLabelImg */
1.75 - {
1.76 -public:
1.77 - IMPORT_C TGridColors();
1.78 - IMPORT_C TGridColors(TRgb aForeground, TRgb aBackground, TRgb aLines, TRgb aLabelSeparators);
1.79 -public:
1.80 - /** The foreground colour. */
1.81 - TRgb iForeground;
1.82 - /** The background colour. */
1.83 - TRgb iBackground;
1.84 - /** The colour of lines. */
1.85 - TRgb iLines;
1.86 - /** The colour of label separators. */
1.87 - TRgb iLabelSeparators;
1.88 -// TRgb iEdge;
1.89 - };
1.90 -////////////////////////->
1.91 -
1.92 -
1.93 -class RReadStream;
1.94 -class RWriteStream;
1.95 -class CStreamStore;
1.96 -class CGridImg;
1.97 -class CSparseMap;
1.98 -
1.99 -
1.100 -class CGridLay : public CBase
1.101 -/** Handles the layout of a grid, and controls how columns, rows and selections
1.102 -appear.
1.103 -
1.104 -@publishedAll
1.105 -@released */
1.106 - {
1.107 - friend class CGridImg;
1.108 -public:
1.109 - /** Defines the order in which pages are printed. */
1.110 - enum TPageOrder
1.111 - {
1.112 - /** All pages in a horizontal line are drawn before starting on the next horizontal
1.113 - line. */
1.114 - ERightThenDown,
1.115 - /** All pages in a vertical line are drawn before starting on the next vertical
1.116 - line to the right. */
1.117 - EDownThenRight
1.118 - };
1.119 - /** Indicates whether the size of the grid should be adjusted when columns and
1.120 - rows are inserted or deleted. */
1.121 - enum TFixGridRange
1.122 - {
1.123 - /** The grid range should not be adjusted on insertion or deletion of rows and/or columns. */
1.124 - EFixGridRange,
1.125 - /** The grid range can be adjusted on insertion or deletion of rows and/or columns. */
1.126 - EAdjustGridRange
1.127 - };
1.128 -public:
1.129 - IMPORT_C CGridLay(MGraphicsDeviceMap* aGraphicsDeviceMap);
1.130 - IMPORT_C void ConstructL(CGridLay* aGridLay,CGridImg* aGridImg);//Constructs Partial Copy
1.131 - IMPORT_C void ConstructL(const MGridTable *aGridTable,CGridImg *aGridImg,TInt aNoOfRows,TInt aNoOfCols);
1.132 - IMPORT_C void ConstructL(const MGridTable *aGridTable,CGridImg *aGridImg,TInt aNoOfCols);
1.133 - IMPORT_C virtual ~CGridLay();
1.134 -
1.135 - IMPORT_C TPoint PageScroll(TMoveDirectionAndAmount aPageScroll);
1.136 - IMPORT_C TPoint ExposeCell(const TCellRef &aCell);
1.137 - IMPORT_C TPoint ExposeCellToTopLeft(const TCellRef &aCell);
1.138 -
1.139 - IMPORT_C void SetGridImgL(CGridImg* aGridImg);
1.140 - inline void SetGridTable(const MGridTable* aGridTable);
1.141 - inline TRangeRef VisibleRange() const;
1.142 - IMPORT_C void SetVisibleRange(const TCellRef& aTopLeftCell);
1.143 - inline TRangeRef TitleRange() const;
1.144 - inline TRangeRef GridRange() const;
1.145 - IMPORT_C void SetGraphicsDeviceMap(MGraphicsDeviceMap* aGraphicsDeviceMap);
1.146 - IMPORT_C void SetGridToDefault();
1.147 -
1.148 - IMPORT_C TInt ColumnWidthInTwips(TInt aCol) const;
1.149 - IMPORT_C void SetColumnWidthInTwipsL(TInt aCol,TInt aWidthInTwips);
1.150 - IMPORT_C TInt SetColumnWidthInTwipsL(TInt aStartCol,TInt aEndCol,TInt aWidthInTwips);
1.151 - IMPORT_C TInt DefaultColumnWidthInTwips() const;
1.152 - IMPORT_C void SetDefaultColumnWidthInTwips(TInt aWidthInTwips);
1.153 - IMPORT_C void SetColumnWidthsToDefault();
1.154 - IMPORT_C TInt MinColumnWidthInPixels() const;
1.155 - IMPORT_C void SetMinColumnWidthInPixels(TInt aWidthInPixels);
1.156 - IMPORT_C TInt ColumnWidthOfSelectedInTwips() const;
1.157 - IMPORT_C void SetColumnWidthOfSelectedInTwipsL(TInt aWidthInTwips);
1.158 - IMPORT_C TInt RowHeightInTwips(TInt aRow) const;
1.159 - IMPORT_C void SetRowHeightInTwipsL(TInt aRow,TInt aHeightInTwips);
1.160 - IMPORT_C TInt SetRowHeightInTwipsL(TInt aStartRow,TInt aEndRow,TInt aHeightInTwips);
1.161 - IMPORT_C TInt DefaultRowHeightInTwips() const;
1.162 - IMPORT_C void SetDefaultRowHeightInTwips(TInt aHeightInTwips);
1.163 - IMPORT_C void SetRowHeightsToDefault();
1.164 - IMPORT_C TInt MinRowHeightInPixels() const;
1.165 - IMPORT_C void SetMinRowHeightInPixels(TInt aHeightInPixels);
1.166 - IMPORT_C TInt RowHeightOfSelectedInTwips() const;
1.167 - IMPORT_C void SetRowHeightOfSelectedInTwipsL(TInt aHeightInTwips);
1.168 - IMPORT_C void RecalcPixelSparseMaps();
1.169 - IMPORT_C void InsertDeleteColumns(TInt aStartCol,TInt aNoOfCols,
1.170 - TFixGridRange aFixGridRange=EFixGridRange);
1.171 - IMPORT_C void InsertDeleteRows(TInt aStartRow,TInt aNoOfRows,
1.172 - TFixGridRange aFixGridRange=EFixGridRange);
1.173 -
1.174 - inline TBool IsSideLabels() const;
1.175 - IMPORT_C void SetSideLabels(TBool aState);
1.176 - inline TBool IsTopLabels() const;
1.177 - IMPORT_C void SetTopLabels(TBool aState);
1.178 - inline TBool IsVerticalGridLines() const;
1.179 - IMPORT_C void SetVerticalGridLines(TBool aState);
1.180 - inline TBool IsHorizontalGridLines() const;
1.181 - IMPORT_C void SetHorizontalGridLines(TBool aState);
1.182 - inline TBool IsGridLabelSeparators() const;
1.183 - IMPORT_C void SetGridLabelSeparators(TBool aState);
1.184 - inline TBool IsColumnBursting() const;
1.185 - IMPORT_C void SetColumnBursting(TBool aState);
1.186 - inline TBool IsCursorVisible() const;
1.187 - IMPORT_C void SetCursorVisible(TBool aVisible);
1.188 - inline TBool IsHighlightVisible() const;
1.189 - IMPORT_C void SetHighlightVisible(TBool aVisible);
1.190 - inline TBool IsRowPermanentlySelected() const;
1.191 - IMPORT_C void SetRowPermanentlySelectedL(TBool aState);
1.192 - inline TBool IsTitleLines() const;
1.193 - inline TBool IsHorizontalTitleLine() const;
1.194 - inline TBool IsVerticalTitleLine() const;
1.195 - IMPORT_C void SetTitleLinesL(TBool aState);
1.196 - IMPORT_C void SetTitleLinesL(const TCellRef& aCellRef);
1.197 - IMPORT_C void ToggleTitleLinesL();
1.198 - inline TBool IsIndefiniteRowBoundaries() const;
1.199 - inline TBool IsUniformRowHeight() const;
1.200 - IMPORT_C void SetUniformRowHeight(TBool aState);
1.201 - inline TBool IsUniformColumnWidth() const;
1.202 - IMPORT_C void SetUniformColumnWidth(TBool aState);
1.203 - inline TBool IsTopLabelDragDisabled() const;
1.204 - IMPORT_C void SetTopLabelDragDisabled(TBool aState);
1.205 - inline TBool IsSideLabelDragDisabled() const;
1.206 - IMPORT_C void SetSideLabelDragDisabled(TBool aState);
1.207 - inline TBool IsPrintedLabels() const;
1.208 - IMPORT_C void SetPrintedLabels(TBool aState);
1.209 - inline TBool IsPrintedGridLines() const;
1.210 - IMPORT_C void SetPrintedGridLines(TBool aState);
1.211 - inline TBool IsEncroachingCellBorders() const;
1.212 - IMPORT_C void SetEncroachingCellBorders(TBool aState);
1.213 - inline TBool IsRowSelectionDisabled() const;
1.214 - IMPORT_C void SetRowSelectionDisabled(TBool aState);
1.215 - inline TBool IsColumnSelectionDisabled() const;
1.216 - IMPORT_C void SetColumnSelectionDisabled(TBool aState);
1.217 - inline TBool IsAutoClearGridCells() const;
1.218 - IMPORT_C void SetAutoClearGridCells(TBool aState);
1.219 - inline TBool IsPageBreakLinesHidden() const;
1.220 - IMPORT_C void SetPageBreakLinesHidden(TBool aState);
1.221 - inline TBool HasChanged() const;
1.222 - inline void SetHasChanged(TBool aHasChanged);
1.223 - inline void SetGridEdgeColor(TRgb aColor);
1.224 -
1.225 - IMPORT_C TInt MinVisibleFromRow() const;
1.226 - IMPORT_C TInt MinVisibleFromColumn() const;
1.227 - IMPORT_C void ResetVisibleToRow();
1.228 - IMPORT_C void ResetVisibleToColumn();
1.229 - IMPORT_C void ResetVisibleToCell();
1.230 - IMPORT_C TInt RowExtent() const;
1.231 - IMPORT_C TInt ColumnExtent() const;
1.232 -
1.233 - IMPORT_C TInt RowToYVal(TInt aRow) const;
1.234 - IMPORT_C TInt RowToYVal(TInt aStartRow,TInt aEndRow) const;
1.235 - IMPORT_C TInt VisibleRowToYVal(TInt aRow) const;
1.236 - IMPORT_C TInt TitleRowToYVal(TInt aTitleRow) const;
1.237 - IMPORT_C TInt ColumnToXVal(TInt aCol) const;
1.238 - IMPORT_C TInt ColumnToXVal(TInt aStartCol,TInt aEndCol) const;
1.239 - IMPORT_C TInt VisibleColumnToXVal(TInt aCol) const;
1.240 - IMPORT_C TInt TitleColumnToXVal(TInt aTitleCol) const;
1.241 - IMPORT_C TInt YValToRow(TInt aYVal) const;
1.242 - IMPORT_C TInt YValToRow(TInt aStartRow,TInt aDisp) const;
1.243 - IMPORT_C TInt YValToTitleRow(TInt aYVal) const;
1.244 - IMPORT_C TInt XValToColumn(TInt aXVal) const;
1.245 - IMPORT_C TInt XValToColumn(TInt aStartCol,TInt aDisp) const;
1.246 - IMPORT_C TInt XValToTitleColumn(TInt aXVal) const;
1.247 - IMPORT_C TCellRef PointToCell(const TPoint &aPoint) const;
1.248 - IMPORT_C TCellRef PointToCell(const TCellRef &aStartCell,const TPoint &aPointDisp) const;
1.249 - IMPORT_C TPoint CellToPoint(const TCellRef &aCell) const;
1.250 - IMPORT_C TPoint CellToPoint(const TCellRef &aStartCell,const TCellRef &aEndCell) const;
1.251 - IMPORT_C TPoint TitleCellToPoint(const TCellRef& aTitleCell) const;
1.252 - IMPORT_C TRect CellToRect(const TCellRef& aCell) const;
1.253 - IMPORT_C TInt YValToNearestRow(TInt aStartRow,TInt aDisp) const;
1.254 - IMPORT_C TInt XValToNearestColumn(TInt aStartCol,TInt aDisp) const;
1.255 - IMPORT_C TSize TopLeftTitleRangeSize() const;
1.256 -
1.257 - IMPORT_C void PaginateL();
1.258 - IMPORT_C void ClearPagination();
1.259 - IMPORT_C void NotifyPaginationOutOfDateL();
1.260 - inline TBool IsPaginated() const;
1.261 - IMPORT_C TRangeRef PageToRange(TInt aPageNo,TPageOrder aPageOrder) const;
1.262 - inline void SetPrintRange(const TRangeRef& aPrintRange);
1.263 - IMPORT_C TInt NoOfPages() const;
1.264 - IMPORT_C void SetPageSizeInTwipsL(const TSize& aPageSize);
1.265 - inline TSize PageSizeInTwips() const;
1.266 - inline TBool IsAutoPagination() const;
1.267 - IMPORT_C void SetAutoPagination(TBool aState);
1.268 - IMPORT_C TBool IsHardRowPageBreak(TInt aRow) const;
1.269 - IMPORT_C TBool IsHardColumnPageBreak(TInt aCol) const;
1.270 - IMPORT_C void SetHardRowPageBreakL(TInt aRow);
1.271 - IMPORT_C void ClearHardRowPageBreakL(TInt aRow);
1.272 - IMPORT_C void SetHardColumnPageBreakL(TInt aCol);
1.273 - IMPORT_C void ClearHardColumnPageBreakL(TInt aCol);
1.274 - IMPORT_C void ClearAllHardPageBreaksL();
1.275 -
1.276 - IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
1.277 - IMPORT_C void InternalizeL(RReadStream &aStream);
1.278 - IMPORT_C TStreamId StoreL(CStreamStore& aStore) const;
1.279 - IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aStreamId);
1.280 -////////////////////////->
1.281 -// Setting the grid colors
1.282 - IMPORT_C void SetGridColors(TGridColors aColors);
1.283 -// Getting the grid colors
1.284 - IMPORT_C const TGridColors& GridColors() const;
1.285 -////////////////////////->
1.286 -private:
1.287 - void SetIndefiniteRowBoundaries(TBool aState);
1.288 - inline TBool IsVisibleToRowFullyVisible() const;
1.289 - void SetVisibleToRowFullyVisible(TBool aState);
1.290 - inline TBool IsVisibleToColumnFullyVisible() const;
1.291 - void SetVisibleToColumnFullyVisible(TBool aState);
1.292 - TInt ColumnWidthInPixels(TInt aCol) const;
1.293 - void SetColumnWidthInPixelsL(TInt aCol,TInt aWidthInPixels);
1.294 - void PreCheckColumnWidthChange(TInt aCol,TBool aNonZeroWidth);
1.295 - void PostCheckColumnWidthChange(TInt aCol,TBool aNonZeroWidth);
1.296 - TInt DefaultColumnWidthInPixels() const;
1.297 - void SetDefaultColumnWidthInPixels(TInt aWidthInPixels);
1.298 - TInt RowHeightInPixels(TInt aRow) const;
1.299 - void SetRowHeightInPixelsL(TInt aRow,TInt aHeightInPixels);
1.300 - void PreCheckRowHeightChange(TInt aRow,TBool aNonZeroHeight);
1.301 - void PostCheckRowHeightChange(TInt aRow,TBool aNonZeroHeight);
1.302 - TInt DefaultRowHeightInPixels() const;
1.303 - void SetDefaultRowHeightInPixels(TInt aHeightInPixels);
1.304 - TPoint CalcOffsetBetweenCells(const TCellRef& aCell1,const TCellRef& aCell2) const;
1.305 - TBool LimitRow(TInt& aRow) const;
1.306 - TBool LimitColumn(TInt &aColumn) const;
1.307 - void LimitRow(TInt& aRow,TInt aLowerLimit,TInt aUpperLimit) const;
1.308 - void LimitColumn(TInt& aCol,TInt aLowerLimit,TInt aUpperLimit) const;
1.309 - TBool LimitCell(TCellRef& aCell) const;
1.310 - void LimitRowToVisible(TInt& aRow) const;
1.311 - void LimitColumnToVisible(TInt& aCol) const;
1.312 - void LimitCellToVisible(TCellRef& aCell) const;
1.313 - TBool IsCellOutOfVisibleRange(const TCellRef &aCell) const;
1.314 - TBool IsCellOutOfGridRange(const TCellRef& aCell) const;
1.315 - void StepRowForward(TInt& aRow) const;
1.316 - void StepRowBackward(TInt& aRow) const;
1.317 - void StepColumnForward(TInt& aCol) const;
1.318 - void StepColumnBackward(TInt& aCol) const;
1.319 - void CalcVisibleFromRow(TInt aVisibleToRow,TInt& aNewVisibleFromRow) const;
1.320 - TBool CalcVisibleToRow(TInt aVisibleFromRow,TInt& aNewVisibleToRow) const;
1.321 - void CalcVisibleFromColumn(TInt aVisibleToCol,TInt& aNewVisibleFromCol) const;
1.322 - TBool CalcVisibleToColumn(TInt aVisibleFromCol,TInt& aNewVisibleToCol) const;
1.323 - TInt CalcVisibleFromRowAfterPageScroll(TMoveDirectionAndAmount aPageScroll) const;
1.324 - TInt CalcVisibleFromColumnAfterPageScroll(TMoveDirectionAndAmount aPageScroll) const;
1.325 - TCellRef CalcVisibleFromCellAfterPageScroll(TMoveDirectionAndAmount aPageScroll) const;
1.326 - TBool FindNextRowPageBreak(TInt aSearchStart,TInt& aFoundRow) const;
1.327 - TBool FindNextColumnPageBreak(TInt aSearchStart,TInt& aFoundCol) const;
1.328 - void DoMainPaginationLoopL(TInt aPageSpan,CSparseMap* aCellSpanMap,CSparseMap* aPageMap,
1.329 - CArrayFix<TInt>* aHardPageBreaks,TInt aStartId);
1.330 - TBool RequestRow(TInt aRow,TInt& aReturnRow) const;
1.331 -
1.332 - void ConstructL(const MGridTable *aGridTable,CGridImg *aGridImg,const TRangeRef& aGridRange);
1.333 -//private:
1.334 -private:
1.335 - enum
1.336 - {
1.337 - EMaxArrayChanges=256,
1.338 - EInitialDefaultRowHeightInTwips = 300,
1.339 - EInitialDefaultColumnWidthInTwips = 900
1.340 - };
1.341 - enum
1.342 - {
1.343 - EIsTopLabels = 0x1,
1.344 - EIsSideLabels = 0x2,
1.345 - EIsHorizontalGridLines = 0x4,
1.346 - EIsVerticalGridLines = 0x8,
1.347 - EIsColumnBursting = 0x10,
1.348 - EIsCursorVisible = 0x20,
1.349 - EIsRowPermanentlySelected = 0x40,
1.350 - EIsHorizontalTitleLine = 0x80,
1.351 - EIsVerticalTitleLine = 0x100,
1.352 - EIsIndefiniteRowBoundaries = 0x200,
1.353 - EIsUniformRowHeight = 0x400,
1.354 - EIsUniformColumnWidth = 0x800,
1.355 - EIsTopLabelDragDisabled = 0x1000,
1.356 - EIsSideLabelDragDisabled = 0x2000,
1.357 - EIsPaginated = 0x4000,
1.358 - EIsAutoPagination = 0x8000,
1.359 - EIsPrintedLabels = 0x10000,
1.360 - EIsPrintedGridLines = 0x20000,
1.361 - EIsVisibleToRowFullyVisible = 0x40000,
1.362 - EIsVisibleToColumnFullyVisible = 0x80000,
1.363 - EIsEncroachingCellBorders = 0x100000,
1.364 - EIsColumnSelectionDisabled = 0x200000,
1.365 - EIsRowSelectionDisabled = 0x400000,
1.366 - EIsAutoClearGridCells = 0x800000,
1.367 - EIsGridLabelSeparators = 0x1000000,
1.368 - EIsHighlightVisible = 0x2000000,
1.369 - EIsPageBreakLinesHidden = 0x4000000
1.370 - };
1.371 -private:
1.372 - const MGridTable* iGridTable;
1.373 - const MGraphicsDeviceMap* iGraphicsDeviceMap; //*
1.374 - CGridImg* iGridImg; //*
1.375 -// persistent
1.376 - TRangeRef iGridRange; //*
1.377 - TRangeRef iVisibleRange;
1.378 - TRangeRef iTitleRange;
1.379 - CSparseMap* iColumnWidthMap; //*
1.380 - CSparseMap* iRowHeightMap; //*
1.381 - CSparseMap* iColumnPageMap; //*
1.382 - CSparseMap* iRowPageMap; //*
1.383 - CArrayFix<TInt>* iHardRowPageBreaks;
1.384 - CArrayFix<TInt>* iHardColumnPageBreaks;
1.385 - TRgb iGridEdgeColor;
1.386 - TInt iMinRowHeightInPixels;
1.387 - TInt iMinColumnWidthInPixels;
1.388 - TSize iPageSizeInTwips; //*
1.389 - TUint32 iFlags; //* Starred items are used in printing
1.390 -////////////////////////->
1.391 - TGridColors iColors;
1.392 -////////////////////////->
1.393 -// End of persistent data
1.394 - TBool iHasChanged;
1.395 - };
1.396 -
1.397 -
1.398 -
1.399 -
1.400 -class CGridLabelImg : public CBase
1.401 -/** Draws a grid cell's label.
1.402 -
1.403 -@publishedAll
1.404 -@released */
1.405 - {
1.406 - friend class CGridImg;
1.407 -public:
1.408 - IMPORT_C virtual ~CGridLabelImg();
1.409 - IMPORT_C void ConstructL();
1.410 - inline void SetGraphicsDeviceMap(MGraphicsDeviceMap* aGraphicsDeviceMap);
1.411 - inline TFontSpec FontSpec() const;
1.412 - IMPORT_C void ReleaseFont();
1.413 - IMPORT_C void NotifyGraphicsDeviceMapChangeL();
1.414 - inline void SetGridColors(const TGridColors& aGridColors);
1.415 -protected:
1.416 - IMPORT_C CGridLabelImg(const TFontSpec& aFontSpec,MGraphicsDeviceMap* aGraphicsDeviceMap);
1.417 -////////////////////////->
1.418 - IMPORT_C void DrawTopLeftLabelL(CGraphicsContext* aGc,const TRect& aRect, TRgb aColor) const;
1.419 -////////////////////////->
1.420 -private:
1.421 - /** Draws a row label.
1.422 -
1.423 - @publishedAll
1.424 - @released
1.425 - @param aGc The graphics context to be used.
1.426 - @param aRow The row for which the label is to be drawn.
1.427 - @param aRect The rectangle in which the label is to be drawn. */
1.428 - virtual void DrawRowLabelL(CGraphicsContext* aGc,TInt aRow,const TRect& aRect) const=0;
1.429 - /** Draws a column label.
1.430 -
1.431 - @publishedAll
1.432 - @released
1.433 - @param aGc The graphics context to be used.
1.434 - @param aCol The column for which the label is to be drawn.
1.435 - @param aRect The rectangle in which the label is to be drawn. */
1.436 - virtual void DrawColLabelL(CGraphicsContext* aGc,TInt aCol,const TRect& aRect) const=0;
1.437 - IMPORT_C virtual void DrawTopLeftLabelL(CGraphicsContext* aGc,const TRect& aRect) const;
1.438 - IMPORT_C virtual TInt SideLabelWidthInPixels(TInt aStartRow,TInt aEndRow) const;
1.439 - IMPORT_C virtual TInt TopLabelHeightInPixels() const;
1.440 - IMPORT_C virtual void DrawRowCursorL(CGraphicsContext* aGc,const TRect& aRect) const;
1.441 -protected:
1.442 - enum
1.443 - {
1.444 - /** The default width of side labels, in twips.
1.445 -
1.446 - This is used by the default implementation of SideLabelWidthInPixels(). */
1.447 - EDefaultSideLabelWidthInTwips=300,
1.448 - /** The default height of top labels, in twips.
1.449 -
1.450 - This is used by the default implementation of TopLabelHeightInPixels(). */
1.451 - EDefaultTopLabelHeightInTwips=300
1.452 - };
1.453 -protected:
1.454 - /** The nearest font to that specified in the font specification. */
1.455 - CFont* iFont;
1.456 - /** The font specification in device independent terms. */
1.457 - TFontSpec iFontSpec;
1.458 - /** The graphics device map, an interface for mapping between twips and device-specific
1.459 - units. */
1.460 - MGraphicsDeviceMap* iGraphicsDeviceMap;
1.461 - /** The grid colour specification. */
1.462 - TGridColors iGridColors;
1.463 -private:
1.464 - TInt iSpare;
1.465 - };
1.466 -
1.467 -
1.468 -class CGridCellImg : public CBase
1.469 -/** Draws a grid cell's contents.
1.470 -
1.471 -@publishedAll
1.472 -@released */
1.473 - {
1.474 - friend class CGridImg;
1.475 -public:
1.476 - IMPORT_C virtual ~CGridCellImg();
1.477 - inline TInt BurstColOffset() const;
1.478 - inline TInt BurstLeft() const;
1.479 - inline TInt BurstRight() const;
1.480 - inline TBool IsHorizontalGridLines() const;
1.481 - inline TBool IsVerticalGridLines() const;
1.482 - inline void SetGridColors(const TGridColors& aGridColors);
1.483 -protected:
1.484 - IMPORT_C CGridCellImg();
1.485 -private:
1.486 - /** Draws the contents of the specified cell.
1.487 -
1.488 - @publishedAll
1.489 - @released
1.490 - @param aGc The graphics context to be used.
1.491 - @param aCell The cell whose contents are to be drawn.
1.492 - @param aDrawRect The rectangle in which the cell is to be drawn.
1.493 - @param aClipRect The rectangle to which drawing is clipped. */
1.494 - virtual void DrawL(CGraphicsContext* aGc,const TCellRef& aCell,const TRect& aDrawRect,
1.495 - const TRect& aClipRect) const=0;
1.496 - IMPORT_C virtual TInt DataWidthInPixelsL(const TCellRef& aCell) const;
1.497 - IMPORT_C virtual TBool DoesCellContainDataL(const TCellRef& aCell) const;
1.498 -// reserved virtual function
1.499 - IMPORT_C virtual void Reserved_1();
1.500 -private:
1.501 - void SetBurstingData(TInt aBurstColOffset=0,TInt aBurstLeft=0,TInt aBurstRight=0);
1.502 -private:
1.503 - enum { EIsHorizontalGridLines = 0x1, EIsVerticalGridLines = 0x2 };
1.504 -protected:
1.505 - /** The grid colour specification. */
1.506 - TGridColors iGridColors;
1.507 -private:
1.508 - TInt iBurstColOffset;
1.509 - TInt iBurstLeft;
1.510 - TInt iBurstRight;
1.511 - TUint32 iGridLineFlags;
1.512 - };
1.513 -
1.514 -
1.515 -class MGridCursorMoveCallBack
1.516 -/** An interface to a callback function that is intended to be called whenever
1.517 -there is a change to the cursor position.
1.518 -
1.519 -If such a callback is needed, a concrete implementation is defined, instantiated
1.520 -and passed to CGridImg::SetCursorMoveCallBack().
1.521 -
1.522 -@publishedAll
1.523 -@released */
1.524 - {
1.525 -public:
1.526 - /** Deals with the change to the cursor position.
1.527 -
1.528 - This function is called immediately before exiting the following functions:
1.529 - CGridImg::SetCursorPosL(), CGridImg::SetAnchorPosL(), CGridImg::MoveCursorL(),CGridImg::ResetSelectedL(),
1.530 - CGridImg::AddRangeToSelectedL(), CGridImg::AddRegionToSelectedL(), CGridImg::AddRowToSelectedL(),
1.531 - CGridImg::AddColToSelectedL().
1.532 -
1.533 - The function is commonly used to do any necessary redrawing. */
1.534 - virtual void HandleCursorMoveL()=0;
1.535 - };
1.536 -
1.537 -class RWindow;
1.538 -class CWindowGc;
1.539 -
1.540 -
1.541 -class CGridImg : public CBase
1.542 -/** Draws the contents of the grid.
1.543 -
1.544 -@publishedAll
1.545 -@released
1.546 -*/
1.547 - {
1.548 - friend class CGridLay;
1.549 -public:
1.550 - enum
1.551 - {
1.552 - /** Indicates that the selection state is to be maintained.
1.553 -
1.554 - If a region of cells is selected, then this selection is to be kept.
1.555 -
1.556 - Typically, this is set by a control when a drag operation is in
1.557 - progress and the shift modifier key is also pressed. */
1.558 - EIsWithSelect=0x0001,
1.559 - /** Indicates that the control modifier key has been pressed. */
1.560 - EIsWithControl=0x0002,
1.561 - /** Indicates that a drag operation is in progress. */
1.562 - EIsWithDrag=0x0004,
1.563 - /** Indicates that the cursor is the edge of the grid. */
1.564 - EIsAtBoundary=0x0008,
1.565 - /** Indicates that a new cell is being selected, without dragging. */
1.566 - EIsAbsoluteMove=0x0010,
1.567 - /** Indicates that a whole row is selected. */
1.568 - EIsRowSelected=0x0020,
1.569 - /** Indicates that a whole column is selected.
1.570 -
1.571 - This also means that the label cell for the column is included in the selection. */
1.572 - EIsColumnSelected=0x0040
1.573 - };
1.574 - enum
1.575 - {
1.576 - /** Defines a scale value of 100.
1.577 -
1.578 - Scale factor values are divided into this value to calculate
1.579 - drawing points, rectangles etc. */
1.580 - EScaleOneToOne=100
1.581 - };
1.582 -
1.583 - enum TSelectType
1.584 - {
1.585 - /** Indicates that an existing selected region is to be reset (i.e. emptied) before
1.586 - adding a new region. */
1.587 - ESelectOverwrite,
1.588 - /** Indicates that a new region is to be appended to any existing selected region. */
1.589 - ESelectAppend
1.590 - };
1.591 -public:
1.592 - IMPORT_C virtual ~CGridImg();
1.593 - IMPORT_C static CGridImg* NewL(CGraphicsDevice* aGraphicsDevice,CGridCellImg* aGridCellImg,CGridLay* aGridLay);
1.594 - IMPORT_C static CGridImg* NewL(CGridCellImg* aGridCellImg,CGridLay* aGridLay); //Creates Partial GridImg
1.595 - inline void SetGridLay(CGridLay* aGridLay);
1.596 - inline void SetWindow(RWindow* aWin);
1.597 -////////////////////////->
1.598 - IMPORT_C void SetGridLabelImg(CGridLabelImg* aGridLabelImg);
1.599 -////////////////////////->
1.600 - inline void SetCursorMoveCallBack(MGridCursorMoveCallBack* aCursorMoveCallBack);
1.601 - inline const CGridCellRegion* Selected() const;
1.602 - inline const CGridLabelImg* GridLabelImg() const;
1.603 -
1.604 - IMPORT_C void ScrollL(const TPoint &aOffset);
1.605 - IMPORT_C void MoveCursorL(TMoveDirectionAndAmount aCursorMove,TUint aSelectState);
1.606 - IMPORT_C void SetCursorWithPointerL(const TPoint& aPoint,TUint aFlagList);
1.607 - IMPORT_C void ResetSelectedL();
1.608 - IMPORT_C void AddRangeToSelectedL(const TRangeRef& aRange,TSelectType aType=ESelectOverwrite);
1.609 - IMPORT_C void AddRegionToSelectedL(const CArrayFix<TRangeRef>* aCellRegion,TSelectType aType=ESelectOverwrite);
1.610 - IMPORT_C void AddRowToSelectedL(TInt aRow,TSelectType aType=ESelectOverwrite);
1.611 - IMPORT_C void AddColToSelectedL(TInt aCol,TSelectType aType=ESelectOverwrite);
1.612 - IMPORT_C void DrawL(CGraphicsContext* aGc) const;
1.613 - IMPORT_C void DrawL(CGraphicsContext* aGc,const TRect& aRect) const;
1.614 - IMPORT_C void DrawCellL(const TCellRef& aCell) const;
1.615 - IMPORT_C void DrawRangeL(const TRangeRef& aRange) const;
1.616 - IMPORT_C void DrawSelectedL() const;
1.617 - IMPORT_C void DrawTitleLines() const;
1.618 - IMPORT_C void ClearTitleLineRegionL(const TPoint& aCrossPoint) const;
1.619 - IMPORT_C void PrintGridLinesAndCellsInRangeL(CGraphicsContext* aPrinterGc,const TRangeRef& aRange,
1.620 - TInt aScaleFactor) const;
1.621 -
1.622 - inline TCellRef CursorPos() const;
1.623 - IMPORT_C void SetCursorPosL(const TCellRef& aCursorPos);
1.624 - inline TCellRef NewCursorPos() const;
1.625 - inline TCellRef AnchorPos() const;
1.626 - IMPORT_C void SetAnchorPosL(const TCellRef& aAnchorPos);
1.627 - inline TRect GridRect() const;
1.628 - IMPORT_C void SetGridRect(const TRect& aNewRect);
1.629 - IMPORT_C void SetPrintGridRect(const TRect& aPrintRect);
1.630 - inline TPoint TitlePoint() const;
1.631 - inline TPoint MainPoint() const;
1.632 - inline TRect MainRect() const;
1.633 - IMPORT_C void ResetReferencePoints();
1.634 - IMPORT_C void NotifyGridRangeResize();
1.635 -
1.636 - IMPORT_C void CheckSideLabelWidthAndScrollL();
1.637 - IMPORT_C TInt CheckSideLabelWidth();
1.638 - IMPORT_C TInt SideLabelWidthInPixels() const;
1.639 - IMPORT_C TInt MaxSideLabelWidthInPixels() const;
1.640 - IMPORT_C TInt TopLabelHeightInPixels() const;
1.641 - IMPORT_C void FinishLabelDragL();
1.642 - IMPORT_C TBool StartLabelDrag(const TPoint &aPoint);
1.643 - IMPORT_C TBool UpdateLabelDrag(const TPoint &aPoint);
1.644 - IMPORT_C TBool StartLabelResize(TBool aIsColumnLabel, TInt aIndex);
1.645 - IMPORT_C TBool UpdateLabelResize(TInt aDelta);
1.646 - IMPORT_C void FinishLabelResizeL(TBool aResize);
1.647 -private:
1.648 - enum TDragDim {EXDrag,EYDrag,ENoDrag};
1.649 - enum TRefPoint {ETitleRef,EMainRef};
1.650 - enum TDragDraw {EDragDrawWithBitmap,EDragDrawWithoutBitmap};
1.651 - enum TArrows {EBothArrows,ESecondArrowOnly};
1.652 - enum
1.653 - {
1.654 - EIsLabelDraggingIgnored = 0x1,
1.655 - EIsSidewaysScrollIgnored = 0x2
1.656 - };
1.657 -private:
1.658 - void DrawResizingDragHiglights(const TRect& aRect);
1.659 - void DrawAllGridLabelsL() const;
1.660 - void DrawTopLeftGridLabelL() const;
1.661 - void DrawTopGridLabelsL(TInt aStartCol,TInt aEndCol,TRefPoint aXRef=EMainRef) const;
1.662 - void DrawSideGridLabelsL(TInt aStartRow,TInt aEndRow,TRefPoint aYRef=EMainRef) const;
1.663 - void DrawSideGridLabelIfOnScreenL(TInt aRow) const;
1.664 - void DrawAllGridLinesAndCellsL() const;
1.665 - void DrawGridLinesAndCellsInRangeL(const TRangeRef& aRange,const TRect& aClipRect,
1.666 - TRefPoint aXRef=EMainRef,TRefPoint aYRef=EMainRef) const;
1.667 - void DrawCellsToGcL(CGraphicsContext* aGc,const TRangeRef& aRange,const TRect& aClipRect,
1.668 - const TPoint& aStartPoint,TInt aScaleFactor=EScaleOneToOne) const;
1.669 - void DrawBurstingCellL(CGraphicsContext* aGc,const TCellRef& aCell,const TRect& aRect,const TRect& aClipRect,
1.670 - TInt aScaleFactor,TInt aBurstLeft,const TCellRef& aBurstCell) const;
1.671 - TInt CalcBurstLeftL(TCellRef& aBurstCell,TInt aScaleFactor) const;
1.672 - TInt CalcBurstRightL(const TCellRef& aCell,TInt aExcessRight,TInt aScaleFactor) const;
1.673 - void DrawVerticalTitleLine() const;
1.674 - void DrawHorizontalTitleLine() const;
1.675 - void BeginRedrawAndDrawL() const;
1.676 - void BeginRedrawAndDrawL(const TRect& aRect) const;
1.677 -
1.678 - void AppendTotalHighlightRegionL(TRegion& aRegion) const;
1.679 - void AppendPartialHighlightRegionL(TRegion& aRegion,const TRect& aClipRect,
1.680 - TRefPoint aXRef=EMainRef,TRefPoint aYRef=EMainRef) const;
1.681 - void RemoveRowLabelFromRegionL(TInt aRow,TRegion& aRegion) const;
1.682 - void HighlightMinRegionL(const TRegion &aOldRegion,const TRegion &aNewRegion);
1.683 - void HighlightRegion(const TRegion &aRegion) const;
1.684 - void HighlightNewRegionFromOldL(const TRegion& aOldRegion);
1.685 - void DrawCursorOrRegionL(TUint aMoveFlags);
1.686 - void UpdateSelectedRegion(TInt aSelectCount,TUint aMoveFlags);
1.687 - void AddLabelToRegionL(TUint aMoveFlags);
1.688 - void StartSelectedRegionL(TUint aMoveFlags);
1.689 - TBool ScanColumnsForDrag(TInt aFromColumn,TInt aToColumn,TInt aPointerPos,TInt& aPrevious,TInt& aCurrent);
1.690 - TBool ScanRowsForDrag(TInt aFromRow,TInt aToRow,TInt aPointerPos,TInt& aPrevious,TInt& aCurrent);
1.691 - void DrawDraggingHighlight(const TRect aLine,TDragDraw aDragDraw);
1.692 - void DrawArrowsToInMemoryBitmap(TArrows aArrows);
1.693 - TPoint RelativeCellToPoint(const TCellRef& aCell,TRefPoint aXRef=EMainRef,
1.694 - TRefPoint aYRef=EMainRef) const;
1.695 - TCellRef RelativePointToCell(const TPoint& aPoint,TRefPoint aXRef=EMainRef,
1.696 - TRefPoint aYRef=EMainRef) const;
1.697 - TRect PartialCellRectL(const TCellRef& aCell,const TRect& aClipRect,
1.698 - TRefPoint aXRef=EMainRef,TRefPoint aYRef=EMainRef) const;
1.699 - TRect PartialRangeRect(const TRangeRef& aRange,const TRect& aClipRect,
1.700 - TRefPoint aXRef=EMainRef,TRefPoint aYRef=EMainRef) const;
1.701 - void CreateGc(CGraphicsContext* aGc);
1.702 - void DeleteGc();
1.703 - static void CleanupGc(TAny* aObject);
1.704 - void ResetGcToDefault(CGraphicsContext* aGc) const;
1.705 - void ScaleDown(TPoint& aPoint,TInt aScaleFactor) const;
1.706 - void ConstructSelectedL(const TRangeRef& aGridRange);
1.707 -
1.708 - CGridImg(CGraphicsDevice* aGraphicsDevice,CGridCellImg* aGridCellImg,CGridLay* aGridLay);
1.709 - CGridImg(CGridCellImg* aGridCellImg,CGridLay* aGridLay);
1.710 - void ConstructL();
1.711 -
1.712 -////////////////////////->
1.713 - void SetGridColors(const TGridColors& aGridColors);
1.714 -////////////////////////->
1.715 -private:
1.716 - TRect iGridRect;
1.717 - TPoint iTitlePoint;
1.718 - TPoint iMainPoint;
1.719 - TCellRef iCursorPos; // Persisted
1.720 - TCellRef iNewCursorPos;
1.721 - TCellRef iAnchorPos;
1.722 -
1.723 - CGraphicsDevice* iGraphicsDevice;
1.724 - CGraphicsContext* iGcPtr;
1.725 - CWindowGc* iGc;
1.726 - RWindow* iWin;
1.727 - CGridCellImg* iGridCellImg; //*
1.728 - CGridLabelImg* iGridLabelImg; //*
1.729 - CGridLay* iGridLay; //* Starred items are used in printing
1.730 - CGridCellRegion* iSelected;
1.731 - MGridCursorMoveCallBack* iCursorMoveCallBack;
1.732 - TBool iDrawResizeLines;
1.733 - TInt iDragLabel;
1.734 - TInt iCurrentDragPos;
1.735 - TInt iDragDiff;
1.736 - TInt iDragFlags;
1.737 - TDragDim iDragDim;
1.738 - CFbsBitmap* iDragBmp;
1.739 - TRefPoint iXRefPoint;
1.740 - TRefPoint iYRefPoint;
1.741 - };
1.742 -
1.743 -
1.744 -class TGridUtils
1.745 -/** A collection of Grid utilities.
1.746 -
1.747 -@publishedAll
1.748 -@released */
1.749 - {
1.750 -public:
1.751 - IMPORT_C static void FillRect(CGraphicsContext* aGc,TRgb aColor,const TRect &aRect);
1.752 - };
1.753 -
1.754 -
1.755 -#include <grdstd.inl>
1.756 -#endif