1.1 --- a/epoc32/include/mw/eiklbi.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eiklbi.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,1256 @@
1.4 -eiklbi.h
1.5 +/*
1.6 +* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +#if !defined(__EIKLBI_H__)
1.26 +#define __EIKLBI_H__
1.27 +
1.28 +#include <e32base.h>
1.29 +#include <gdi.h>
1.30 +
1.31 +
1.32 +class CWindowGc;
1.33 +class CListBoxData;
1.34 +class TListItemProperties;
1.35 +class TListFontBoundValues;
1.36 +class MAknsControlContext;
1.37 +
1.38 +
1.39 +/**
1.40 + * The @c CListItemDrawer class is the base class for the list box item drawers
1.41 + * which handle drawing of the contents of list box items.
1.42 + * The items may optionally be markable.
1.43 + *
1.44 + * @since Symbian 5.0
1.45 + */
1.46 +class CListItemDrawer : public CBase
1.47 + {
1.48 +
1.49 +public:
1.50 +
1.51 + /**
1.52 + * Destructor.
1.53 + */
1.54 + IMPORT_C ~CListItemDrawer();
1.55 +
1.56 + /**
1.57 + * Draws the entire item.
1.58 + *
1.59 + * This function is called by the list box view. As implemented
1.60 + * in @c CListItemDrawer, this function draws the item text using
1.61 + * @c DrawActualItem(), and an item mark using @c DrawItemMark().
1.62 + *
1.63 + * @param aItemIndex Index of the item to draw.
1.64 + * @param aItemRectPos Position of the rectangle to draw.
1.65 + * @param aItemIsSelected Whether the item is selected.
1.66 + * @param aItemIsCurrent Whether the item is current.
1.67 + * @param aViewIsEmphasized Whether the list box view has the emphasised
1.68 + * flag set (see @c CListBoxView::SetEmphasized()).
1.69 + * @param aViewIsDimmed Whether the list box view has its dimmed flag set
1.70 + * (see @c CListBoxView::SetDimmed()).
1.71 + */
1.72 + IMPORT_C virtual void DrawItem(TInt aItemIndex,
1.73 + TPoint aItemRectPos,
1.74 + TBool aItemIsSelected,
1.75 + TBool aItemIsCurrent,
1.76 + TBool aViewIsEmphasized,
1.77 + TBool aViewIsDimmed) const;
1.78 +
1.79 + /**
1.80 + * Clears the specified rectangle of this object's graphics context.
1.81 + *
1.82 + * @param aRect Rectangle to clear.
1.83 + */
1.84 + IMPORT_C virtual void ClearRect(const TRect& aRect) const;
1.85 +
1.86 + /**
1.87 + * Gets the width of the specified item.
1.88 + *
1.89 + * @param aItemIndex The index of the item whose width is to be returned.
1.90 + * @return The width of the item. This is 0 in @c CListItemDrawer
1.91 + */
1.92 + IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
1.93 +
1.94 + /**
1.95 + * Gets the minimum cell size.
1.96 + *
1.97 + * @return The minimum size for a cell. This is @c TSize(0, 0)
1.98 + * in @c CListItemDrawer.
1.99 + */
1.100 + IMPORT_C virtual TSize MinimumCellSize() const;
1.101 +
1.102 + /**
1.103 + * Sets the graphics context which this object uses for drawing.
1.104 + *
1.105 + * @param aGc Pointer to the context to use.
1.106 + */
1.107 + IMPORT_C virtual void SetGc(CWindowGc* aGc);
1.108 +
1.109 + /**
1.110 + * Gets graphics context which is used for drawing.
1.111 + *
1.112 + * @return Pointer to the graphics context used for drawing.
1.113 + */
1.114 + IMPORT_C CWindowGc* Gc() const;
1.115 +
1.116 + /**
1.117 + * Sets the width of the column containing the mark.
1.118 + *
1.119 + * @param aWidthInPixels New width for the mark column.
1.120 + */
1.121 + IMPORT_C virtual void SetMarkColumnWidth(TInt aWidthInPixels);
1.122 +
1.123 + /**
1.124 + * Sets the width of the gap between the column containing the lists item
1.125 + * marks and the text column.
1.126 + *
1.127 + * @param aGapInPixels New gap size.
1.128 + */
1.129 + IMPORT_C virtual void SetMarkGutter(TInt aGapInPixels);
1.130 +
1.131 + /**
1.132 + * Gets mark column width.
1.133 + *
1.134 + * @return Mark column width.
1.135 + */
1.136 + IMPORT_C TInt MarkColumn() const;
1.137 +
1.138 + /**
1.139 + * Gets the width of the gap between the column containig the lists item
1.140 + * marks and the text column.
1.141 + *
1.142 + * @return Size of the inter-column gutter.
1.143 + */
1.144 + IMPORT_C TInt MarkGutter() const;
1.145 +
1.146 + /**
1.147 + * Sets the item cell size.
1.148 + * The cell size is the on-screen size of the entire item, including
1.149 + * its text and its item mark.
1.150 + *
1.151 + * @param aSizeInPixels New size for the item cell.
1.152 + */
1.153 + IMPORT_C virtual void SetItemCellSize(const TSize& aSizeInPixels);
1.154 +
1.155 + /**
1.156 + * Gets current item cell size.
1.157 + *
1.158 + * @since Symbian 3.0
1.159 + * @return Item cell size
1.160 + */
1.161 + IMPORT_C TSize ItemCellSize() const;
1.162 +
1.163 + /**
1.164 + * Sets the viewing rectangle for this item drawer.
1.165 + * This value is not used by the @c CListItemViewer, but may be used by its
1.166 + * derived classes.
1.167 + *
1.168 + * @param aRect New value for @c iViewRect.
1.169 + */
1.170 + IMPORT_C virtual void SetViewRect(const TRect& aRect);
1.171 +
1.172 + /**
1.173 + * Sets whether item tick marks are drawn.
1.174 + *
1.175 + * If the draw mark flag iDrawMark is set, @c DrawItem() leaves space for
1.176 + * the marks column to the left of the text column, and @c DrawItemMark()
1.177 + * draws the item marks.
1.178 + *
1.179 + * @param aDrawMark New value for iDrawMark.
1.180 + */
1.181 + IMPORT_C void SetDrawMark(TBool aDrawMark);
1.182 +
1.183 + /**
1.184 + * Gets a rectangle describing where the matcher cursor should be drawn.
1.185 + * The default behavious is to return uninitialised @c TRect.
1.186 + *
1.187 + * @deprecated
1.188 + * @param aMatchableText The text of the currently matched string.
1.189 + * @param aCharPos The position in the string of the character just matched
1.190 + * in the current incremental match.
1.191 + * @param aItemCellYPos Y position of the item cell.
1.192 + * @param aCurrentItemIndex Item index for the current item.
1.193 + * @return Where the cursor should be drawn.
1.194 + */
1.195 + IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText,
1.196 + TInt aCharPos,
1.197 + TInt aItemCellYPos,
1.198 + TInt aCurrentItemIndex ) const;
1.199 +
1.200 + /**
1.201 + * Gets the ascent of the matcher cursor.
1.202 + *
1.203 + * This is obtained for the item at index @c aCurrentItemIndex.
1.204 + * The function returns 0 by default.
1.205 + *
1.206 + * @deprecated
1.207 + * @param aCurrentItemIndex Item index of the target item.
1.208 + * @return The height of the matcher cursor.
1.209 + */
1.210 + IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
1.211 +
1.212 + /**
1.213 + * Not Used in S60.
1.214 + */
1.215 + IMPORT_C virtual void DrawItemMark(TBool aItemIsSelected,
1.216 + TBool aViewIsDimmed,
1.217 + const TPoint& aMarkPos) const;
1.218 +
1.219 + /**
1.220 + * Sets symbol font for the item drawer.
1.221 + * The symbol font is used to draw the standard tick item marks.
1.222 + *
1.223 + * @param aFont The font to be used.
1.224 + */
1.225 + IMPORT_C void SetSymbolFont(const CFont* aFont);
1.226 +
1.227 + /**
1.228 + * Sets the vertical gap between items in the list.
1.229 + *
1.230 + * @param aGapInPixels New value for the vertical gap between items
1.231 + * in pixels.
1.232 + */
1.233 + IMPORT_C void SetVerticalInterItemGap(TInt aGapInPixels);
1.234 +
1.235 + /**
1.236 + * Sets the font storage data for the item drawer and transfer ownership
1.237 + * of that data.
1.238 + *
1.239 + * @param aData Font storage data .
1.240 + */
1.241 + IMPORT_C void SetData(CListBoxData* aData);
1.242 +
1.243 + /**
1.244 + * Gets the font for the specified item.
1.245 + *
1.246 + * The function returns @c NULL if no font storage data has been set.
1.247 + *
1.248 + * @param aItemIndex The index of the item for which the font is returned.
1.249 + * @return The item's font.
1.250 + */
1.251 + IMPORT_C CFont* Font(TInt aItemIndex) const;
1.252 +
1.253 + /**
1.254 + * Gets the colour and style properties of the specified item.
1.255 + *
1.256 + * @param aItemIndex The index of the item for which properties
1.257 + * are obtained (Not Used).
1.258 + * @return The item's properties.
1.259 + */
1.260 + IMPORT_C virtual TListItemProperties Properties(TInt aItemIndex) const;
1.261 +
1.262 + /**
1.263 + * Draws the frame.
1.264 + *
1.265 + * Uses the colours set with the fonts and colour functions described above.
1.266 + *
1.267 + * @deprecated
1.268 + * @param aGc The graphics context used to draw the frame.
1.269 + * @param aRect The frame's rectangle.
1.270 + * @param aFlags The item drawer flags.
1.271 + */
1.272 + IMPORT_C void DrawFrame(CWindowGc& aGc,
1.273 + const TRect& aRect,
1.274 + TInt aFlags) const;
1.275 +
1.276 +public:
1.277 +
1.278 + /**
1.279 + * Provides list box attributes for handling multiple selections. These
1.280 + * flags can be set using the @c CListItemDrawer::SetFlags function.
1.281 + */
1.282 + enum TFlags
1.283 + {
1.284 + /**
1.285 + * If set, specifies the inclusion of a gap into which a tick mark can
1.286 + * be drawn if the item is selected. This is used in the following
1.287 + * @c CListItemDrawer class functions:
1.288 + * @c DrawItem(),
1.289 + * @c DrawItemMark(),
1.290 + * @c SetDrawMark()
1.291 + */
1.292 + EDrawMarkSelection = 0x0001,
1.293 +
1.294 + /**
1.295 + * If set, draws a highlight over a selected list item. This is used
1.296 + * in the @c CTextListItemDrawer::DoDrawItemText() function.
1.297 + */
1.298 + EPaintedSelection = 0x0002,
1.299 +
1.300 + /** This flag is not supported. */
1.301 + EDrawOnlyActiveSelection = 0x0004,
1.302 +
1.303 + /** If set highlight is disabled. */
1.304 + EDisableHighlight = 0x0008,
1.305 +
1.306 + /** This flag indicates @c CListboxData to draw pressed down state
1.307 + * rather than normal highlight on item. Make sure checking this
1.308 + * flag in subclass's Draw method, if using a custom @c CListboxData
1.309 + * inheriting from @c CColumnListBoxData or @c CFormattedCellListBoxData.
1.310 + */
1.311 + EPressedDownState = 0x0010,
1.312 +
1.313 + /** This flag indicates the marquee is disabled. If it is set, @c CColumnListBoxData
1.314 + * or @c CFormattedCellListBoxData would disable maquee temporarily for
1.315 + * performance reason.
1.316 + */
1.317 + EDisableMarquee = 0x0020
1.318 + };
1.319 +
1.320 +public:
1.321 +
1.322 + /**
1.323 + * Provides attributes for list items
1.324 + */
1.325 + enum TListItemAttribute
1.326 +
1.327 + {
1.328 + /** Highlight for current text. */
1.329 + ECurrent = 0x0001, // may be drawn with a frame
1.330 +
1.331 + /**
1.332 + * Highlight for text when the listbox view is emphasized.
1.333 + *
1.334 + * This is used in the following @c CListBoxView class functions:
1.335 + * @c DrawItem(), @c DrawMatcherCursor(), @c SetEmphasized().
1.336 + */
1.337 + EEmphasized = 0x0002, // special highlight (not selected)
1.338 +
1.339 + /**
1.340 + * Highlight for text that is selected. This is used in the following
1.341 + * functions: @c CColumnListBoxItemDrawer::DrawItemText(),
1.342 + * @c CHierarchicalListItemDrawer::DrawActualItem(),
1.343 + * @c CDirContentsListItemDrawer::DrawActualItem().
1.344 + */
1.345 + ESelected = 0x0004, // usually different than emphasized
1.346 +
1.347 + /**
1.348 + * Sum of all the above attributes.
1.349 + * This last attribute is used to control that one can use only
1.350 + * valid attributes above. So do not use it at all.
1.351 + */
1.352 + EMask = 0x0007 // sum of all others attributes
1.353 +
1.354 + };
1.355 +
1.356 +public:
1.357 +
1.358 + /**
1.359 + * Sets the colour used to draw non-highlighted text.
1.360 + *
1.361 + * @param aColor The text colour.
1.362 + */
1.363 + inline void SetTextColor(TRgb aColor);
1.364 +
1.365 + /**
1.366 + * Sets the colour used to draw the background for non-highlighted items.
1.367 + *
1.368 + * @param aColor The background colour.
1.369 + */
1.370 + inline void SetBackColor(TRgb aColor);
1.371 +
1.372 + /**
1.373 + * Sets the colour used to draw highlighted text.
1.374 + *
1.375 + * @param aColor The highlighted text colour.
1.376 + */
1.377 + inline void SetHighlightedTextColor(TRgb aColor);
1.378 +
1.379 + /**
1.380 + * Sets the colour used to draw the background for highlighted items.
1.381 + *
1.382 + * @param aColor The highlighted background colour.
1.383 + */
1.384 + inline void SetHighlightedBackColor(TRgb aColor);
1.385 +
1.386 + /**
1.387 + * Sets the colour used to draw dimmed text.
1.388 + *
1.389 + * @param aColor The dimmed text colour.
1.390 + */
1.391 + inline void SetDimmedTextColor(TRgb aColor);
1.392 +
1.393 + /**
1.394 + * Sets the colour used to draw the background for dimmed items.
1.395 + *
1.396 + * @param aColor The background colour for dimmed items.
1.397 + */
1.398 + inline void SetDimmedBackColor(TRgb aColor);
1.399 +
1.400 + /**
1.401 + * Gets the colour used to draw non-highlighted text.
1.402 + *
1.403 + * @return The text colour.
1.404 + */
1.405 + inline TRgb TextColor() const;
1.406 +
1.407 + /**
1.408 + * Gets the colour used to draw the background for non-highlighted items.
1.409 + *
1.410 + * @return Background colour.
1.411 + */
1.412 + inline TRgb BackColor() const;
1.413 +
1.414 + /**
1.415 + * Gets the colour used to draw highlighted text.
1.416 + *
1.417 + * @return The highlighted text colour.
1.418 + */
1.419 + inline TRgb HighlightedTextColor() const;
1.420 +
1.421 + /**
1.422 + * Gets the colour used to draw the background for highlighted items.
1.423 + *
1.424 + * @return The highlighted background colour.
1.425 + */
1.426 + inline TRgb HighlightedBackColor() const;
1.427 +
1.428 + /**
1.429 + * Gets the colour used to draw dimmed text.
1.430 + *
1.431 + * @return The dimmed text colour.
1.432 + */
1.433 + inline TRgb DimmedTextColor() const;
1.434 +
1.435 + /**
1.436 + * Gets the colour used to draw the background for dimmed items.
1.437 + *
1.438 + * @return The background colour for dimmed items.
1.439 + */
1.440 + inline TRgb DimmedBackColor() const;
1.441 +
1.442 + /**
1.443 + * Gets the item drawer flags.
1.444 + *
1.445 + * @return The item drawer flags.
1.446 + */
1.447 + inline TInt Flags() const;
1.448 +
1.449 + /**
1.450 + * Sets the item drawer flags.
1.451 + *
1.452 + * @param aFlags The new item drawer flags.
1.453 + */
1.454 + IMPORT_C void SetFlags(TInt aFlags);
1.455 +
1.456 + /**
1.457 + * Sets the item drawer flags.
1.458 + *
1.459 + * @param aFlags The new item drawer flags.
1.460 + */
1.461 + IMPORT_C void ClearFlags(TInt aFlags);
1.462 +
1.463 + /**
1.464 + * Access to skin contexts.
1.465 + *
1.466 + * @since S60 2.0
1.467 + * @return Pointer to skin background control context.
1.468 + */
1.469 + IMPORT_C MAknsControlContext *SkinBackgroundControlContext() const;
1.470 + /**
1.471 + * Ability to enable skins in listboxes.
1.472 + *
1.473 + * @since S60 2.0
1.474 + * @param aEnabled parameter for enabling/disabling skin.
1.475 + * @c ETrue enables skin,
1.476 + * @c EFalse disables skin
1.477 + */
1.478 + IMPORT_C void SetSkinEnabledL(TBool aEnabled);
1.479 +
1.480 +protected:
1.481 +
1.482 + /**
1.483 + * C++ default constructor.
1.484 + */
1.485 + IMPORT_C CListItemDrawer();
1.486 +
1.487 + /**
1.488 + * Draws item text.
1.489 + *
1.490 + * This function is called by @c CListItemDrawer::DrawItem() with
1.491 + * appropriate arguments. Its purpose is to draw the actual item
1.492 + * - everything other than the item mark - into the graphics context.
1.493 + *
1.494 + * @param aItemIndex Which item to draw.
1.495 + * @param aActualItemRect Where the item should be drawn.
1.496 + * @param aItemIsCurrent Whether the item is current.
1.497 + * @param aViewIsEmphasized Whether the list box view is emphasised.
1.498 + * @param aViewIsDimmed Whether the list box view is dimmed.
1.499 + * @param aItemIsSelected Whether the list box item is selected.
1.500 + */
1.501 + virtual void DrawActualItem(TInt aItemIndex,
1.502 + const TRect& aActualItemRect,
1.503 + TBool aItemIsCurrent,
1.504 + TBool aViewIsEmphasized,
1.505 + TBool aViewIsDimmed,
1.506 + TBool aItemIsSelected) const = 0;
1.507 +
1.508 + /**
1.509 + * Resets the pen style, brush style, brush colour etc. to suitable
1.510 + * starting values for this class.
1.511 + *
1.512 + * This function is called after every drawing operation.
1.513 + */
1.514 + IMPORT_C virtual void ResetGc() const;
1.515 +
1.516 + /**
1.517 + * Gets the colour used to draw tick marks.
1.518 + *
1.519 + * A tick mark usually indicates that an item is selected.
1.520 + *
1.521 + * @return The tick mark colour.
1.522 + */
1.523 + inline TRgb MarkColor() const;
1.524 +
1.525 + /**
1.526 + * Gets the vertical gap between items in pixels.
1.527 + *
1.528 + * @return The vertical gap between items in pixels.
1.529 + */
1.530 + IMPORT_C TInt VerticalInterItemGap() const;
1.531 +
1.532 + /**
1.533 + * Sets up the graphics context for the specified item.
1.534 + *
1.535 + * @param aItemIndex The item for which the graphics context
1.536 + * will be set up.
1.537 + */
1.538 + IMPORT_C void SetupGc(TInt aItemIndex) const;
1.539 +
1.540 +private:
1.541 +
1.542 + IMPORT_C virtual TAny* Reserved_1();
1.543 +
1.544 + inline TInt& VerticalInterItemGap();
1.545 +
1.546 + inline const CFont* SymbolFont() const;
1.547 +
1.548 + inline const CFont*& SymbolFont();
1.549 +
1.550 +protected:
1.551 +
1.552 + /** Item's cell size. */
1.553 + TSize iItemCellSize;
1.554 +
1.555 + /** Mark gutter. */
1.556 + TInt iMarkGutter;
1.557 +
1.558 + /** Mark column width. */
1.559 + TInt iMarkColumnWidth;
1.560 +
1.561 + /** View area. */
1.562 + TRect iViewRect;
1.563 +
1.564 + /** Draw mark. */
1.565 + TBool iDrawMark;
1.566 +
1.567 + /** Graphics context controller. */
1.568 + CWindowGc* iGc;
1.569 +
1.570 + /** Color of text. */
1.571 + TRgb iTextColor;
1.572 +
1.573 + /** Background color. */
1.574 + TRgb iBackColor;
1.575 +
1.576 + /** Color of highlighted text. */
1.577 + TRgb iHighlightedTextColor;
1.578 +
1.579 + /** Highlighted background color. */
1.580 + TRgb iHighlightedBackColor;
1.581 +
1.582 + /** Color of dimmed text. */
1.583 + TRgb iDimmedTextColor;
1.584 +
1.585 + /** Color of dimmed background. */
1.586 + TRgb iDimmedBackColor;
1.587 +
1.588 + /** Mark color. */
1.589 + TRgb iMarkColor;
1.590 +
1.591 + /** Data model. */
1.592 + CListBoxData* iData;
1.593 +
1.594 +private:
1.595 +
1.596 + const CFont* iSymbolFont;
1.597 +
1.598 + TInt iVerticalInterItemGap;
1.599 +
1.600 + TInt iSpare;
1.601 +
1.602 + TUint iFlags;
1.603 +
1.604 + };
1.605 +
1.606 +
1.607 +
1.608 +
1.609 +class MTextListBoxModel;
1.610 +
1.611 +
1.612 +/**
1.613 + * Item drawer which can handle text.
1.614 + *
1.615 + * Used by @c CListBoxView to draw individual list box items
1.616 + * for a @c CEikTextListBox
1.617 + */
1.618 +class CTextListItemDrawer : public CListItemDrawer
1.619 + {
1.620 +
1.621 +public:
1.622 +
1.623 + /**
1.624 + * C++ default constructor.
1.625 + */
1.626 + IMPORT_C CTextListItemDrawer();
1.627 +
1.628 + /**
1.629 + * Destructor.
1.630 + */
1.631 + IMPORT_C ~CTextListItemDrawer();
1.632 +
1.633 + /**
1.634 + * C++ default constructor.
1.635 + *
1.636 + * Constructs a new text item drawer which draws the data of the specified
1.637 + * model using the supplied font.
1.638 + *
1.639 + * @param aTextListBoxModel The model whose items will be drawn.
1.640 + * @param aFont The font in which the items will be drawn.
1.641 + */
1.642 + IMPORT_C CTextListItemDrawer(MTextListBoxModel* aTextListBoxModel,
1.643 + const CFont* aFont);
1.644 +
1.645 + /**
1.646 + * Handles 2nd phase construction.
1.647 + *
1.648 + * @param aFont The font in which the list box items will be drawn.
1.649 + */
1.650 + IMPORT_C void ConstructL(const CFont* aFont);
1.651 +
1.652 + /**
1.653 + * Draws the actual item contents for the specified item in the specified
1.654 + * rectangle.
1.655 + *
1.656 + * @param aItemIndex Index of the item to draw.
1.657 + * @param aActualItemRect Area to draw into.
1.658 + * @param aItemIsCurrent @c ETrue if the item is current.
1.659 + * @param aViewIsEmphasized @c ETrue if the view is emphasised.
1.660 + * @param aViewIsDimmed Ignored
1.661 + * @param aItemIsSelected @c ETrue if the item is selected.
1.662 + */
1.663 + IMPORT_C virtual void DrawActualItem(TInt aItemIndex,
1.664 + const TRect& aActualItemRect,
1.665 + TBool aItemIsCurrent,
1.666 + TBool aViewIsEmphasized,
1.667 + TBool aViewIsDimmed,
1.668 + TBool aItemIsSelected) const;
1.669 +
1.670 + /**
1.671 + * Gets the width in pixels of the specified item.
1.672 + *
1.673 + * @param aItemIndex The index of the item for which the width is obtained.
1.674 + * @return The specified item’s width in pixels.
1.675 + */
1.676 + IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
1.677 +
1.678 + /**
1.679 + * Gets the minimum size of a cell based on the font and the number of
1.680 + * characters in the cell.
1.681 + *
1.682 + * @return The minimum size for a cell, in pixels.
1.683 + */
1.684 + IMPORT_C virtual TSize MinimumCellSize() const;
1.685 +
1.686 + /**
1.687 + * Sets the graphics context.
1.688 + *
1.689 + * @param aGc The graphics context to use.
1.690 + */
1.691 + IMPORT_C virtual void SetGc(CWindowGc* aGc);
1.692 +
1.693 + /**
1.694 + * Sets the number of characters in a cell.
1.695 + * This value affects only @c MinimumCellSize().
1.696 + *
1.697 + * @param aNumOfCharsToDisplayInCell Number of characters to
1.698 + * display in a cell.
1.699 + */
1.700 + IMPORT_C void SetCellWidthInChars(TInt aNumOfCharsToDisplayInCell);
1.701 +
1.702 + /**
1.703 + * Gets the position and size of the matcher cursor.
1.704 + *
1.705 + * @deprecated
1.706 + * @param aMatchableText String currently being matched. Not Used.
1.707 + * @param aCharPos Position within the string. Not Used.
1.708 + * @param aItemCellYPos Y position of the item cell in pixels. Not Used.
1.709 + * @param aCurrentItemIndex Item index for the current item. Not Used.
1.710 + * @return The rectangle covered by the matcher cursor, in pixels.
1.711 + */
1.712 + IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText,
1.713 + TInt aCharPos,
1.714 + TInt aItemCellYPos,
1.715 + TInt aCurrentItemIndex ) const;
1.716 +
1.717 + /**
1.718 + * No Implementation.
1.719 + *
1.720 + * Derived classes that deal with text and want to support incremental
1.721 + * matching in listboxes need to redefine this function.
1.722 + * Should be used to get the ascent of the matcher cursor in pixels.
1.723 + *
1.724 + * @deprecated
1.725 + * @param aCurrentItemIndex Index of the current item. Not Used.
1.726 + * @return Always returns 0;
1.727 + */
1.728 + IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
1.729 +
1.730 + /**
1.731 + * Sets the font.
1.732 + *
1.733 + * @param aFont The new font.
1.734 + */
1.735 + IMPORT_C void SetFont(const CFont* aFont);
1.736 +
1.737 + /**
1.738 + * Sets the search string.
1.739 + *
1.740 + * @param aSearchString The new search string.
1.741 + */
1.742 + IMPORT_C void SetSearchStringL(const TDesC* aSearchString);
1.743 +
1.744 + /**
1.745 + * Gets font for the specified item.
1.746 + *
1.747 + * @param aIndex The index of the target item.
1.748 + * @return Specified item's font.
1.749 + */
1.750 + IMPORT_C const CFont* Font(TInt aIndex) const;
1.751 +
1.752 + // SAPLAF new methods.
1.753 +
1.754 +
1.755 + /**
1.756 + * Sets item mark position.
1.757 + *
1.758 + * @param aPos The new position.
1.759 + */
1.760 + inline void SetItemMarkPosition(TInt aPos);
1.761 +
1.762 + /**
1.763 + * Gets item mark position.
1.764 + *
1.765 + * @return Position of the Item mark.
1.766 + */
1.767 + inline TInt ItemMarkPosition() const;
1.768 +
1.769 + /**
1.770 + * Sets the item mark replacement.
1.771 + *
1.772 + * @param aReplacement The new replacement descriptor.
1.773 + */
1.774 + inline void SetItemMarkReplacement(const TDesC &aReplacement);
1.775 +
1.776 + /**
1.777 + * Gets item mark replacement.
1.778 + *
1.779 + * @return Pointer to the replacement string.
1.780 + */
1.781 + inline TPtrC ItemMarkReplacement() const;
1.782 +
1.783 + /**
1.784 + * Sets item mark reverse to be active or not.
1.785 + *
1.786 + * @param aReverse The new setting.
1.787 + * @c ETrue if item is marked reversed.
1.788 + */
1.789 + inline void SetItemMarkReverse(TBool aReverse);
1.790 +
1.791 + /**
1.792 + * Check if the item has been marked reversed is active.
1.793 + *
1.794 + * @return Indicates if active or not.
1.795 + * @c ETrue if active
1.796 + */
1.797 + inline TBool ItemMarkReverse() const;
1.798 +
1.799 +
1.800 +protected:
1.801 +
1.802 + /**
1.803 + * Draws text.
1.804 + *
1.805 + * This function is invoked by @c DrawItemText() to draw a string into a
1.806 + * rectangular area of @c iGc.
1.807 + *
1.808 + * @param aDes The string to draw.
1.809 + * @param aItemTextRect Area to draw into.
1.810 + * @param aItemIsCurrent @c ETrue if the item is current.
1.811 + * @param aViewIsEmphasized @c ETrue if the view is emphasised.
1.812 + * @param aItemIsSelected @c ETrue if the item is selected.
1.813 + * @param aItemIndex The item’s index.
1.814 + */
1.815 + IMPORT_C virtual void DoDrawItemText(const TDesC& aDes,
1.816 + const TRect& aItemTextRect,
1.817 + TBool aItemIsCurrent,
1.818 + TBool aViewIsEmphasized,
1.819 + TBool aItemIsSelected,
1.820 + TInt aItemIndex) const;
1.821 +
1.822 + /**
1.823 + * Draw item text.
1.824 + *
1.825 + * This function is invoked by @c DrawActualItem() to draw the item text.
1.826 + *
1.827 + * @param aItemIndex Index of the item to draw.
1.828 + * @param aItemTextRect Area to draw into.
1.829 + * @param aItemIsCurrent @c ETrue if the item is current.
1.830 + * @param aViewIsEmphasized @c ETrue if the view is emphasised.
1.831 + * @param aItemIsSelected @c ETrue if the item is selected.
1.832 + */
1.833 + IMPORT_C virtual void DrawItemText(TInt aItemIndex,
1.834 + const TRect& aItemTextRect,
1.835 + TBool aItemIsCurrent,
1.836 + TBool aViewIsEmphasized,
1.837 + TBool aItemIsSelected) const;
1.838 +
1.839 + /**
1.840 + * Resets the graphics context.
1.841 + * This function invokes @c CListItemDrawer::ResetGc() and resets the pen
1.842 + * colour to @c iTextColor.
1.843 + */
1.844 + IMPORT_C virtual void ResetGc() const;
1.845 +
1.846 +private:
1.847 +
1.848 + IMPORT_C virtual TAny* Reserved_1();
1.849 +
1.850 +protected:
1.851 +
1.852 + /** List box model for the drawer. */
1.853 + MTextListBoxModel* iModel;
1.854 +
1.855 + /** Font used by the drawer. */
1.856 + const CFont* iFont;
1.857 +
1.858 +private:
1.859 +
1.860 + TInt iNumOfCharsInCell;
1.861 +
1.862 + // AVKON LAF
1.863 +
1.864 + TInt iItemMarkPos;
1.865 +
1.866 + TPtrC iItemMarkReplacement;
1.867 +
1.868 + TBool iItemMarkReverse;
1.869 +
1.870 + // AVKON LAF ENDS
1.871 +
1.872 + };
1.873 +
1.874 +
1.875 +
1.876 +
1.877 +/**
1.878 + * The @c TListItemProperties class packages together the color and
1.879 + * style properties which can be applied when drawing the contents
1.880 + * of list box items.
1.881 + *
1.882 + * @since Symbian ER5U
1.883 + */
1.884 +
1.885 +class TListItemProperties
1.886 +
1.887 + {
1.888 +
1.889 +public:
1.890 +
1.891 + /**
1.892 + * C++ default constructor.
1.893 + */
1.894 + IMPORT_C TListItemProperties();
1.895 +
1.896 +public:
1.897 +
1.898 + /**
1.899 + * Sets whether the list item is drawn bold or not bold.
1.900 + *
1.901 + * @deprecated
1.902 + * @param aBold @c ETrue to draw the list item bold.
1.903 + * @c EFalse otherwise.
1.904 + */
1.905 + inline void SetBold(TBool aBold);
1.906 +
1.907 + /**
1.908 + * Tests whether the list item is drawn bold.
1.909 + *
1.910 + * @deprecated
1.911 + * @return @c ETrue if the list item is drawn bold.
1.912 + * @c EFalse otherwise.
1.913 + */
1.914 + inline TBool IsBold() const;
1.915 +
1.916 + /**
1.917 + * Sets whether or not the list item is drawn in italics.
1.918 + *
1.919 + * @deprecated
1.920 + * @param aItalics @c ETrue to draw the list item in italics.
1.921 + * @c EFalse otherwise.
1.922 + */
1.923 + inline void SetItalics(TBool aItalics);
1.924 +
1.925 + /**
1.926 + * Tests whether the list item is italicised.
1.927 + *
1.928 + * @deprecated
1.929 + * @return @c ETrue if the list item is drawn in italics.
1.930 + * @c EFalse otherwise.
1.931 + */
1.932 + inline TBool IsItalics() const;
1.933 +
1.934 + /**
1.935 + * Sets whether or not the list item is drawn with an underline.
1.936 + *
1.937 + * @param aUnderlined @c ETrue to draw the list item with an underline.
1.938 + * @c EFalse otherwise.
1.939 + */
1.940 + inline void SetUnderlined(TBool aUnderlined);
1.941 +
1.942 + /**
1.943 + * Test whether the list item is drawn with an underline.
1.944 + *
1.945 + * @return @c ETrue if the list item is drawn with an underline.
1.946 + * @c EFalse otherwise.
1.947 + */
1.948 + inline TBool IsUnderlined() const;
1.949 +
1.950 + /**
1.951 + * Sets list item dim state.
1.952 + *
1.953 + * An item is usually drawn dimmed to indicate that it cannot accept
1.954 + * user input.
1.955 + *
1.956 + * @param aDimmed @c ETrue to draw the list item dimmed. @c EFalse otherwise.
1.957 + */
1.958 + inline void SetDimmed(TBool aDimmed);
1.959 +
1.960 + /**
1.961 + * Tests list item dim state.
1.962 + *
1.963 + * An item is usually drawn dimmed to indicate that it cannot accept
1.964 + * user input.
1.965 + *
1.966 + * @return @c ETrue if the list item is dimmed.
1.967 + * @c EFalse otherwise.
1.968 + */
1.969 + inline TBool IsDimmed() const;
1.970 +
1.971 + /**
1.972 + * Sets the list item’s colour.
1.973 + *
1.974 + * @param aColor The list item’s colour.
1.975 + */
1.976 + inline void SetColor(TRgb aColor);
1.977 +
1.978 + /**
1.979 + * Gets the list item’s colour.
1.980 + *
1.981 + * @return The list item’s colour.
1.982 + */
1.983 + inline TRgb Color() const;
1.984 +
1.985 + /**
1.986 + * Activate/deactivate separator after item.
1.987 + *
1.988 + * @deprecated
1.989 + * @param aSeparator Active/deactive selector.
1.990 + * @c ETrue = Active.
1.991 + * @c EFalse = Deactivated.
1.992 + */
1.993 + inline void SetSeparatorAfter(TBool aSeparator);
1.994 +
1.995 + /**
1.996 + * Check if separator after item is active.
1.997 + *
1.998 + * @deprecated
1.999 + * @return @c ETrue if Active.
1.1000 + * @c EFalse if Deactivated.
1.1001 + */
1.1002 + inline TBool IsSeparatorAfter() const;
1.1003 +
1.1004 + /**
1.1005 + * Select to hide the item .
1.1006 + *
1.1007 + * @param aHidden Defines whether the item is hidden.
1.1008 + * @c ETrue = Hidden
1.1009 + */
1.1010 + inline void SetHiddenSelection(TBool aHidden);
1.1011 +
1.1012 + /**
1.1013 + * Check if the item is hidden.
1.1014 + *
1.1015 + * @return @c ETrue if item is hidden.
1.1016 + */
1.1017 + inline TBool IsSelectionHidden() const;
1.1018 +
1.1019 +private:
1.1020 +
1.1021 + TUint iFlags;
1.1022 +
1.1023 + TRgb iColor;
1.1024 +
1.1025 +private:
1.1026 +
1.1027 + enum
1.1028 +
1.1029 + {
1.1030 +
1.1031 + ELbxItemBold = 0x0001,
1.1032 +
1.1033 + ELbxItemItalics = 0x0002,
1.1034 +
1.1035 + ELbxItemUnderlined = 0x0004,
1.1036 +
1.1037 + ELbxItemDimmed = 0x0008,
1.1038 +
1.1039 + ELbxItemSeparatorAfter = 0x0010,
1.1040 +
1.1041 + ELbxItemSelectionHidden = 0x0020
1.1042 +
1.1043 + };
1.1044 +
1.1045 + };
1.1046 +
1.1047 +
1.1048 +
1.1049 +//
1.1050 +
1.1051 +// Inlines
1.1052 +
1.1053 +//
1.1054 +
1.1055 +
1.1056 +
1.1057 +inline void CListItemDrawer::SetTextColor(TRgb aColor)
1.1058 +
1.1059 + {iTextColor=aColor;}
1.1060 +
1.1061 +inline void CListItemDrawer::SetBackColor(TRgb aColor)
1.1062 +
1.1063 + {iBackColor=aColor;}
1.1064 +
1.1065 +inline void CListItemDrawer::SetHighlightedTextColor(TRgb aColor)
1.1066 +
1.1067 + {iHighlightedTextColor=aColor;}
1.1068 +
1.1069 +inline void CListItemDrawer::SetHighlightedBackColor(TRgb aColor)
1.1070 +
1.1071 + {iHighlightedBackColor=aColor;}
1.1072 +
1.1073 +inline void CListItemDrawer::SetDimmedTextColor(TRgb aColor)
1.1074 +
1.1075 + {iDimmedTextColor=aColor;}
1.1076 +
1.1077 +inline void CListItemDrawer::SetDimmedBackColor(TRgb aColor)
1.1078 +
1.1079 + {iDimmedBackColor=aColor;}
1.1080 +
1.1081 +inline TRgb CListItemDrawer::TextColor() const
1.1082 +
1.1083 + {return iTextColor;}
1.1084 +
1.1085 +inline TRgb CListItemDrawer::BackColor() const
1.1086 +
1.1087 + {return iBackColor;}
1.1088 +
1.1089 +inline TRgb CListItemDrawer::HighlightedTextColor() const
1.1090 +
1.1091 + {return iHighlightedTextColor;}
1.1092 +
1.1093 +inline TRgb CListItemDrawer::HighlightedBackColor() const
1.1094 +
1.1095 + {return iHighlightedBackColor;}
1.1096 +
1.1097 +inline TRgb CListItemDrawer::DimmedTextColor() const
1.1098 +
1.1099 + {return iDimmedTextColor;}
1.1100 +
1.1101 +inline TRgb CListItemDrawer::DimmedBackColor() const
1.1102 +
1.1103 + {return iDimmedBackColor;}
1.1104 +
1.1105 +inline TRgb CListItemDrawer::MarkColor() const
1.1106 +
1.1107 + {return iMarkColor;}
1.1108 +
1.1109 +inline TInt CListItemDrawer::Flags() const
1.1110 +
1.1111 + {return iFlags;}
1.1112 +
1.1113 +
1.1114 +
1.1115 +inline TBool TListItemProperties::IsItalics() const
1.1116 +
1.1117 + {return iFlags&ELbxItemItalics;}
1.1118 +
1.1119 +inline TBool TListItemProperties::IsBold() const
1.1120 +
1.1121 + {return iFlags&ELbxItemBold;}
1.1122 +
1.1123 +inline TBool TListItemProperties::IsUnderlined() const
1.1124 +
1.1125 + {return iFlags&ELbxItemUnderlined;}
1.1126 +
1.1127 +inline TBool TListItemProperties::IsDimmed() const
1.1128 +
1.1129 + {return iFlags&ELbxItemDimmed;}
1.1130 +
1.1131 +inline TBool TListItemProperties::IsSeparatorAfter() const
1.1132 +
1.1133 + {return iFlags&ELbxItemSeparatorAfter;}
1.1134 +
1.1135 +inline TBool TListItemProperties::IsSelectionHidden() const
1.1136 +
1.1137 + {return iFlags&ELbxItemSelectionHidden;}
1.1138 +
1.1139 +
1.1140 +
1.1141 +inline void TListItemProperties::SetColor(TRgb aColor)
1.1142 +
1.1143 + {iColor=aColor;}
1.1144 +
1.1145 +inline TRgb TListItemProperties::Color() const
1.1146 +
1.1147 + {return iColor;}
1.1148 +
1.1149 +inline void TListItemProperties::SetBold(TBool aBold)
1.1150 +
1.1151 + {
1.1152 +
1.1153 + if (aBold)
1.1154 +
1.1155 + iFlags|=ELbxItemBold;
1.1156 +
1.1157 + else
1.1158 +
1.1159 + iFlags&=(~ELbxItemBold);
1.1160 +
1.1161 + }
1.1162 +
1.1163 +inline void TListItemProperties::SetItalics(TBool aItalics)
1.1164 +
1.1165 + {
1.1166 +
1.1167 + if (aItalics)
1.1168 +
1.1169 + iFlags|=ELbxItemItalics;
1.1170 +
1.1171 + else
1.1172 +
1.1173 + iFlags&=(~ELbxItemItalics);
1.1174 +
1.1175 + }
1.1176 +
1.1177 +inline void TListItemProperties::SetUnderlined(TBool aUnderlined)
1.1178 +
1.1179 + {
1.1180 +
1.1181 + if (aUnderlined)
1.1182 +
1.1183 + iFlags|=ELbxItemUnderlined;
1.1184 +
1.1185 + else
1.1186 +
1.1187 + iFlags&=(~ELbxItemUnderlined);
1.1188 +
1.1189 + }
1.1190 +
1.1191 +inline void TListItemProperties::SetDimmed(TBool aDimmed)
1.1192 +
1.1193 + {
1.1194 +
1.1195 + if (aDimmed)
1.1196 +
1.1197 + iFlags|=ELbxItemDimmed;
1.1198 +
1.1199 + else
1.1200 +
1.1201 + iFlags&=(~ELbxItemDimmed);
1.1202 +
1.1203 + }
1.1204 +
1.1205 +
1.1206 +
1.1207 +inline void TListItemProperties::SetSeparatorAfter(TBool aSeparator)
1.1208 +
1.1209 + {
1.1210 +
1.1211 + if (aSeparator)
1.1212 +
1.1213 + iFlags|=ELbxItemSeparatorAfter;
1.1214 +
1.1215 + else
1.1216 +
1.1217 + iFlags&=(~ELbxItemSeparatorAfter);
1.1218 +
1.1219 + }
1.1220 +
1.1221 +
1.1222 +inline void TListItemProperties::SetHiddenSelection(TBool aBlocked)
1.1223 +
1.1224 + {
1.1225 +
1.1226 + if (aBlocked)
1.1227 +
1.1228 + iFlags|=ELbxItemSelectionHidden;
1.1229 +
1.1230 + else
1.1231 +
1.1232 + iFlags&=(~ELbxItemSelectionHidden);
1.1233 +
1.1234 + }
1.1235 +
1.1236 +
1.1237 +
1.1238 +
1.1239 +
1.1240 +
1.1241 +// AVKON LAF
1.1242 +
1.1243 +inline void CTextListItemDrawer::SetItemMarkPosition(TInt aPos) { iItemMarkPos = aPos; }
1.1244 +
1.1245 +inline TInt CTextListItemDrawer::ItemMarkPosition() const { return iItemMarkPos; }
1.1246 +
1.1247 +inline void CTextListItemDrawer::SetItemMarkReplacement(const TDesC & aReplacement) { iItemMarkReplacement.Set(aReplacement); }
1.1248 +
1.1249 +inline TPtrC CTextListItemDrawer::ItemMarkReplacement() const { return iItemMarkReplacement; }
1.1250 +
1.1251 +inline void CTextListItemDrawer::SetItemMarkReverse(TBool aReverse) { iItemMarkReverse = aReverse; }
1.1252 +inline TBool CTextListItemDrawer::ItemMarkReverse() const { return iItemMarkReverse; }
1.1253 +
1.1254 +// END OF AVKON LAF
1.1255 +
1.1256 +
1.1257 +
1.1258 +#endif // __EIKLBI_H__
1.1259 +
1.1260 +// End of File