1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/eikcba.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,1561 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: EIKON control button array and cba button class definitions.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef __EIKCBA_H__
1.23 +#define __EIKCBA_H__
1.24 +
1.25 +#include <eikctgrp.h>
1.26 +#include <badesca.h>
1.27 +#include <eikbtgrp.h>
1.28 +#include <eiksbobs.h>
1.29 +#include <eiksbfrm.h>
1.30 +
1.31 +#include <eikimage.h>
1.32 +#include <AknControl.h>
1.33 +#include <AknsItemData.h> // TAknsItemID
1.34 +#include <babitflags.h> // TBitFlags
1.35 +
1.36 +class CEikLabel;
1.37 +class CEikCbaButton;
1.38 +class CCoeBrushAndPenContext;
1.39 +class MEikCommandObserver;
1.40 +class TCoeColorUse;
1.41 +
1.42 +class CAknScrollBar;
1.43 +class TEikScrollBarModel;
1.44 +
1.45 +class CEikEnhancedCbaButton;
1.46 +class CEikCommandTable;
1.47 +
1.48 +class CAknsBasicBackgroundControlContext;
1.49 +class CAknsLayeredBackgroundControlContext;
1.50 +class CAknsMaskedLayerBackgroundControlContext;
1.51 +class CEikCbaExtension;
1.52 +
1.53 +const TInt KMaxCbaLabelLength = 32;
1.54 +const TInt KMaxButtonsInCommandTable = 4;
1.55 +
1.56 +/**
1.57 + * Defines a Control Button Array control, used in Avkon to define the softkeys in the
1.58 + * control pane.
1.59 + *
1.60 + * @lib eikcoctl.lib
1.61 + * @since S60 0.9
1.62 + */
1.63 +NONSHARABLE_CLASS(CEikCba) :
1.64 + public CEikControlGroup,
1.65 + public MEikEnhancedButtonGroup,
1.66 + public MEikScrollBarObserver,
1.67 + public MCoeControlObserver
1.68 + {
1.69 +public:
1.70 + /**
1.71 + * Declares an object type for a class, in order to allow the object
1.72 + * provider mechanism to locate and provide objects from the class.
1.73 + */
1.74 + DECLARE_TYPE_ID(0x101F4105)
1.75 +
1.76 + /**
1.77 + * Creates a new control button array.
1.78 + *
1.79 + * @internal
1.80 + * @param aPrevious Previous Cba, used in MinimumSize().
1.81 + * @param aCommandObserver Command observer for softkey events.
1.82 + * @param aParentWg The parent window group.
1.83 + * @return Control button array object.
1.84 + */
1.85 + static CEikCba* NewL(
1.86 + const CEikCba* aPrevious,
1.87 + MEikCommandObserver* aCommandObserver,
1.88 + RWindowGroup* aParentWg);
1.89 +
1.90 + /**
1.91 + * Creates a new control button array.
1.92 + *
1.93 + * @internal
1.94 + * @param aResourceId A resource describing the Cba.
1.95 + * @param aPrevious Previous Cba, used in MinimumSize().
1.96 + * @param aCommandObserver Command observer for softkey events.
1.97 + * @param aParentWg The parent window group.
1.98 + * @return Control button array object.
1.99 + */
1.100 + static CEikCba* NewL(
1.101 + TInt aResourceId,
1.102 + const CEikCba* aPrevious,
1.103 + MEikCommandObserver* aCommandObserver,
1.104 + RWindowGroup* aParentWg);
1.105 +
1.106 + /**
1.107 + * Creates a new control button array.
1.108 + *
1.109 + * @internal
1.110 + * @param aPrevious Previous Cba, used in MinimumSize().
1.111 + * @param aCommandObserver Command observer for softkey events.
1.112 + * @param aParentWg The parent window group.
1.113 + * @return Control button array object.
1.114 + */
1.115 + static CEikCba* NewLC(
1.116 + const CEikCba* aPrevious,
1.117 + MEikCommandObserver* aCommandObserver,
1.118 + RWindowGroup* aParentWg);
1.119 +
1.120 + /**
1.121 + * Creates a new control button array
1.122 + *
1.123 + * @since S60 5.2
1.124 + * @internal
1.125 + * @param aPrevious Previous Cba, used in MinimumSize()
1.126 + * @param aCommandObserver Command observer for softkey events
1.127 + * @param aParentWg The parent window group
1.128 + * @param aFlags CEikButtonGroupContainer::EIsEmbedded if CBA is embedded
1.129 + * inside another control (popup/dialog/setting page)
1.130 + * @return Control button array object
1.131 + */
1.132 + static CEikCba* NewLC(
1.133 + const CEikCba* aPrevious,
1.134 + MEikCommandObserver* aCommandObserver,
1.135 + RWindowGroup* aParentWg, TUint aFlags );
1.136 +
1.137 + /**
1.138 + * Creates a new control button array.
1.139 + *
1.140 + * @internal
1.141 + * @param aResourceId A resource describing the Cba.
1.142 + * @param aPrevious Previous Cba, used in MinimumSize().
1.143 + * @param aCommandObserver Command observer for softkey events.
1.144 + * @param aParentWg The parent window group.
1.145 + * @return Control button array object.
1.146 + */
1.147 + static CEikCba* NewLC(
1.148 + TInt aResourceId,
1.149 + const CEikCba* aPrevious,
1.150 + MEikCommandObserver* aCommandObserver,
1.151 + RWindowGroup* aParentWg);
1.152 +
1.153 + /**
1.154 + * Creates a new control button array
1.155 + *
1.156 + * @since S60 5.2
1.157 + * @internal
1.158 + * @param aResourceId A resource describing the Cba
1.159 + * @param aPrevious Previous Cba, used in MinimumSize()
1.160 + * @param aCommandObserver Command observer for softkey events
1.161 + * @param aParentWg The parent window group
1.162 + * @param aFlags CEikButtonGroupContainer::EIsEmbedded if CBA is embedded
1.163 + * inside another control (popup/dialog/setting page)
1.164 + * @return Control button array object
1.165 + */
1.166 + static CEikCba* NewLC(
1.167 + TInt aResourceId,
1.168 + const CEikCba* aPrevious,
1.169 + MEikCommandObserver* aCommandObserver,
1.170 + RWindowGroup* aParentWg, TUint aFlags );
1.171 +
1.172 + /**
1.173 + * Destructor.
1.174 + */
1.175 + ~CEikCba();
1.176 +
1.177 +public: // new methods
1.178 + /**
1.179 + * Gets the maximum number of buttons that can be supported by the device.
1.180 + *
1.181 + * @internal
1.182 + * @return The number of command buttons supported.
1.183 + */
1.184 + TInt MaxCommands() const;
1.185 +
1.186 + /**
1.187 + * Updates the cba labels.
1.188 + *
1.189 + * @internal
1.190 + * @param aScrollerOn If this is set, the short labels are used instead
1.191 + * of the long ones. To be used if there is an (old style)
1.192 + * scroller between the softkeys.
1.193 + */
1.194 + void UpdateCbaLabels(TBool aScrollerOn);
1.195 +
1.196 + /**
1.197 + * For checking whether the middle softkey is supported in the platform.
1.198 + *
1.199 + * @internal
1.200 + * @return ETrue if the middle softkey is supported in the plaftorm.
1.201 + */
1.202 + TInt MSKEnabledInPlatform() const;
1.203 +
1.204 + /**
1.205 + * Sets the scroll bar frame observer.
1.206 + *
1.207 + * @internal
1.208 + * @param aObserver The scroll bar frame observer.
1.209 + */
1.210 + void SetSBFrameObserver(MEikScrollBarObserver* aObserver);
1.211 +
1.212 + /**
1.213 + * Sets the scroll bar model.
1.214 + *
1.215 + * @internal
1.216 + * @param aModel The scroll bar model.
1.217 + */
1.218 + void SetScrollBarModelL(TEikScrollBarModel* aModel);
1.219 +
1.220 + /**
1.221 + * Returns the scroll bar frame.
1.222 + *
1.223 + * @internal
1.224 + * @return The scroll bar frame.
1.225 + */
1.226 + const CEikCbaScrollBarFrame* ScrollBarFrame() const;
1.227 +
1.228 + /**
1.229 + * Returns the vertical scroll bar as a control.
1.230 + *
1.231 + * @internal The vertical scroll bar as a control
1.232 + */
1.233 + CAknScrollBar* VScrollBarAsControl();
1.234 +
1.235 + /**
1.236 + * Replaces empty scroll bar with actual arrow head scroll bar.
1.237 + *
1.238 + * @internal
1.239 + * @since S60 3.0
1.240 + */
1.241 + void CreateArrowHeadScrollBarL();
1.242 +
1.243 + /**
1.244 + * For external set the MSK icon
1.245 + * Returns ETrue if option is ok, EFalse is not.
1.246 + * @param aId icon bitmap IID
1.247 + * @param aBmpFile file path.
1.248 + * @param aBmp Bitmap ID.
1.249 + * @param aBmpM Bitmap mask ID.
1.250 + * @param aEnable ETrue for set icon, EFalse for use default icon.
1.251 + */
1.252 + IMPORT_C TBool UpdateMSKIconL(
1.253 + const TAknsItemID& aId,
1.254 + const TDesC& aBmpFile,
1.255 + const TInt32 aBmp,
1.256 + const TInt32 aBmpM,
1.257 + TBool aEnable);
1.258 +
1.259 + /**
1.260 + * Enables or disables item specific softkey. If enabled then SK1's
1.261 + * visibility is determined by the screen content. If there's a list or
1.262 + * grid with visible highlight (i.e. highlight is brought visible via
1.263 + * hardware keys) on the display or SK1's associated command is
1.264 + * @c EAknSoftkeyOptions then SK1 is visible, otherwise it's hidden. This
1.265 + * method has no effect if the the application isn't single click enabled.
1.266 + * Item specific softkey is enabled by default.
1.267 + *
1.268 + * @since S60 5.2
1.269 + *
1.270 + * @param aEnable ETrue to enable item specific softkey, EFalse to disable.
1.271 + */
1.272 + IMPORT_C void EnableItemSpecificSoftkey( TBool aEnable );
1.273 +
1.274 +public:
1.275 + /**
1.276 + * From CEikControlGroup.
1.277 + * Adds a wrapped control to the control group array at the given index position.
1.278 + * Overridden to prevent setting container window.
1.279 + *
1.280 + * @param aGroupControl The control to add to the group.
1.281 + * @param aIndex The index for the added control.
1.282 + */
1.283 + void InsertControlL(TEikGroupControl& aGroupControl, TInt aIndex);
1.284 +
1.285 + /**
1.286 + * From MEikButtonGroup.
1.287 + * Sets a command button's text and command ID. Note that this implementation does
1.288 + * not support bitmap and mask.
1.289 + *
1.290 + * @param aPosition The position within the button group of the button to change.
1.291 + * @param aCommandId Command ID the button will send.
1.292 + * @param aText The text for the button.
1.293 + * @param aBitmap Not used.
1.294 + * @param aMask Not used.
1.295 + */
1.296 + void SetCommandL(
1.297 + TInt aPosition,
1.298 + TInt aCommandId,
1.299 + const TDesC* aText,
1.300 + const CFbsBitmap* aBitmap,
1.301 + const CFbsBitmap* aMask);
1.302 +
1.303 + /**
1.304 + * From MEikButtonGroup.
1.305 + * Sets a command button's text label and command ID. The text and command ID are all
1.306 + * read from resource. Note that this implementation does not support bitmap and mask.
1.307 + *
1.308 + * @internal
1.309 + *
1.310 + * @param aPosition The position within the button group of the button to change.
1.311 + * @param aResourceId Resource ID specifying the text and command ID.
1.312 + *
1.313 + */
1.314 + void SetCommandL(TInt aPosition, TInt aResourceId);
1.315 +
1.316 + /**
1.317 + * From MEikButtonGroup.
1.318 + * Initialises the group of command buttons from a resource.
1.319 + * Note that this implementation does not support bitmap and mask.
1.320 + *
1.321 + * @internal
1.322 + *
1.323 + * @param aResourceId ID of the resource structure specifying the command buttons.
1.324 + */
1.325 + void SetCommandSetL(TInt aResourceId);
1.326 +
1.327 + /**
1.328 + * From MEikButtonGroup.
1.329 + * Not supported.
1.330 + *
1.331 + * @internal
1.332 + *
1.333 + * @param aPosition Not used.
1.334 + * @param aCommandId Not used.
1.335 + * @param aText Not used.
1.336 + * @param aBitmap Not used.
1.337 + * @param aMask Not used.
1.338 + * @leave KErrNotSupported If called.
1.339 + */
1.340 + void AddCommandL(
1.341 + TInt aPosition,
1.342 + TInt aCommandId,
1.343 + const TDesC* aText,
1.344 + const CFbsBitmap* aBitmap,
1.345 + const CFbsBitmap* aMask);
1.346 +
1.347 + /**
1.348 + * From MEikButtonGroup.
1.349 + * Pushes a command button with text and a command ID onto a position's button stack.
1.350 + * Note that this implementation does not support bitmap and mask.
1.351 + *
1.352 + * @internal
1.353 + *
1.354 + * @param aPosition The position in the button group at which to add the command button.
1.355 + * @param aCommandId Command ID the button will send.
1.356 + * @param aText Text for the button.
1.357 + * @param aBitmap Not used.
1.358 + * @param aMask Not used.
1.359 + */
1.360 + void AddCommandToStackL(
1.361 + TInt aPosition,
1.362 + TInt aCommandId,
1.363 + const TDesC* aText,
1.364 + const CFbsBitmap* aBitmap,
1.365 + const CFbsBitmap* aMask);
1.366 +
1.367 + /**
1.368 + * From MEikButtonGroup.
1.369 + * Pushes a command button onto a position's button stack. The text and command ID are all
1.370 + * read from resource. Note that this implementation does not support bitmap and mask.
1.371 + *
1.372 + * @internal
1.373 + *
1.374 + * @param aPosition The position in the button group at which to push the command button.
1.375 + * @param aResourceId ID of a resource specifying the text and command ID.
1.376 + */
1.377 + void AddCommandToStackL(TInt aPosition, TInt aResourceId);
1.378 +
1.379 + /**
1.380 + * From MEikButtonGroup.
1.381 + * As with SetCommandL() but for a set of buttons, also allows the previous command button
1.382 + * to be retrieved by calling RemoveCommand(). Note that this implementation does not
1.383 + * support bitmap and mask.
1.384 + *
1.385 + * @internal
1.386 + *
1.387 + * @param aResourceId Resource describing the set of command buttons.
1.388 + */
1.389 + void AddCommandSetToStackL(TInt aResourceId);
1.390 +
1.391 + /**
1.392 + * From MEikButtonGroup.
1.393 + * Not supported.
1.394 + *
1.395 + * @internal
1.396 + *
1.397 + * @param aCommandId Not used.
1.398 + */
1.399 + void SetDefaultCommand(TInt aCommandId);
1.400 +
1.401 + /**
1.402 + * From MEikButtonGroup.
1.403 + * Calculates minimum size required to display the buttons defined in the
1.404 + * specified resource structure.
1.405 + *
1.406 + * @internal
1.407 + *
1.408 + * @param aResourceId The ID of the resource structure describing the button group.
1.409 + * @return Minimum size required to display the button group defined in the specified
1.410 + * resource structure.
1.411 + */
1.412 + TSize CalcMinimumSizeL(TInt aResourceId);
1.413 +
1.414 + /**
1.415 + * From MEikButtonGroup.
1.416 + * Removes the command identified by aCommandId, in position aPosition in the
1.417 + * group, from the command stack. Automatically retrieves the previous command
1.418 + * details. Commands are added to the stack by calling AddCommandToStackL.
1.419 + *
1.420 + * @internal
1.421 + *
1.422 + * @param aPosition The position in the button group from which to remove the
1.423 + * command button.
1.424 + * @param aCommandId Command ID.
1.425 + */
1.426 + void RemoveCommandFromStack(TInt aPosition, TInt aCommandId);
1.427 +
1.428 + /**
1.429 + * From MEikButtonGroup.
1.430 + * Returns the command position by command id.
1.431 + *
1.432 + * @internal
1.433 + *
1.434 + * @param aCommandId The button's command id.
1.435 + * @return The command position in the button group.
1.436 + */
1.437 + TInt CommandPos(TInt aCommandId) const;
1.438 +
1.439 + /**
1.440 + * From MEikButtonGroup.
1.441 + * Dims or undims a button without drawing it.
1.442 + *
1.443 + * @internal
1.444 + *
1.445 + * @param aCommandId Command ID of the button to change.
1.446 + * @param aDimmed ETrue to dim the specified command. EFalse to undim the specified command.
1.447 + */
1.448 + void DimCommand(TInt aCommandId, TBool aDimmed);
1.449 +
1.450 + /**
1.451 + * From MEikButtonGroup.
1.452 + * Determines whether the button with the specified command ID is dimmed.
1.453 + *
1.454 + * @internal
1.455 + *
1.456 + * @param aCommandId The command ID.
1.457 + * @return ETrue if the specified command is dimmed. EFalse if the specified command is
1.458 + * not dimmed.
1.459 + */
1.460 + TBool IsCommandDimmed(TInt aCommandId) const;
1.461 +
1.462 + /**
1.463 + * From MEikButtonGroup.
1.464 + * Makes the button with the specified id either visible, or invisible.
1.465 + *
1.466 + * @internal
1.467 + *
1.468 + * @param aCommandId Specifies the button to alter.
1.469 +
1.470 + * @param aVisible ETrue to make the specified button visible. EFalse to make the specified
1.471 + * button invisible.
1.472 + */
1.473 + void MakeCommandVisible(TInt aCommandId, TBool aVisible);
1.474 +
1.475 + /**
1.476 + * From MEikButtonGroup.
1.477 + * Tests whether the button with the specified command ID is visible.
1.478 + *
1.479 + * @internal
1.480 + *
1.481 + * @param aCommandId Specifies the button.
1.482 + * @return ETrue if the specified button is visible. EFalse if the specified button is
1.483 + * not visible.
1.484 + */
1.485 + TBool IsCommandVisible(TInt aCommandId) const;
1.486 +
1.487 + /**
1.488 + * From MEikButtonGroup.
1.489 + * Not supported.
1.490 + *
1.491 + * @internal
1.492 + *
1.493 + * @param aCommandId Not used.
1.494 + */
1.495 + void AnimateCommand(TInt aCommandId);
1.496 +
1.497 + /**
1.498 + * From MEikButtonGroup.
1.499 + * Returns the button group as a control.
1.500 + *
1.501 + * @internal
1.502 + *
1.503 + * @return The button group as a control.
1.504 + */
1.505 + CCoeControl* AsControl();
1.506 +
1.507 + /**
1.508 + * From MEikButtonGroup.
1.509 + * Returns the button group as a control.
1.510 + *
1.511 + * @internal
1.512 + *
1.513 + * @return The button group as a control.
1.514 + */
1.515 + const CCoeControl* AsControl() const;
1.516 +
1.517 + /**
1.518 + * From MEikButtonGroup.
1.519 + * Sets the boundary rectangle for externally-positioned button groups.
1.520 + * For use by EExternal button groups only.
1.521 + *
1.522 + * @internal
1.523 + *
1.524 + * @param aBoundingRect Not used.
1.525 + */
1.526 + void SetBoundingRect(const TRect& aBoundingRect);
1.527 +
1.528 + /**
1.529 + * From MEikButtonGroup.
1.530 + * Subtracts the area occupied by the button group from the specified bounding rectangle.
1.531 + * This method should be used in preference to querying the container's area at all times.
1.532 + * For use by EExternal button groups only.
1.533 + *
1.534 + * @internal
1.535 + *
1.536 + * @param aBoundingRect Rectangle to be modified.
1.537 + */
1.538 + void ReduceRect(TRect& aBoundingRect) const;
1.539 +
1.540 + /**
1.541 + * Returns a group control (a button) as a control.
1.542 + *
1.543 + * @internal
1.544 + *
1.545 + * @param aCommandId The button's command id.
1.546 + * @return The group control as a control.
1.547 + */
1.548 + CCoeControl* GroupControlById(TInt aCommandId);
1.549 +
1.550 + /**
1.551 + * From MEikButtonGroup.
1.552 + * Returns a group control (a button) as a control.
1.553 + *
1.554 + * @internal
1.555 + *
1.556 + * @param aCommandId The button's command id.
1.557 + * @return The group control as a control.
1.558 + */
1.559 + CCoeControl* GroupControlById(TInt aCommandId) const;
1.560 +
1.561 + /**
1.562 + * From MEikButtonGroup.
1.563 + * Returns the command id by position.
1.564 + *
1.565 + * @internal
1.566 + *
1.567 + * @param aCommandPos The command's position.
1.568 + * @return The command id.
1.569 + */
1.570 + TInt CommandId(TInt aCommandPos) const;
1.571 +
1.572 + /**
1.573 + * From MEikButtonGroup.
1.574 + * Gets the total number of buttons currently present in the group.
1.575 + *
1.576 + * @internal
1.577 + *
1.578 + * @return The number of buttons.
1.579 + */
1.580 + TInt ButtonCount() const;
1.581 +
1.582 + /**
1.583 + * Removes previous command.
1.584 + *
1.585 + * @internal
1.586 + *
1.587 + * @param aPosition The command's position.
1.588 + */
1.589 + void RemovePreviousCommand(TInt aPosition);
1.590 +
1.591 + /**
1.592 + * From MEikButtonGroup.
1.593 + * Not supported, because it is not possible to convert a CBA button to a
1.594 + * CEikCommandButton. Calling this in debug build causes a panic, otherwise
1.595 + * NULL is just returned.
1.596 + *
1.597 + * @internal
1.598 + *
1.599 + * @param aCommandId Not used.
1.600 + */
1.601 + CEikCommandButton* GroupControlAsButton(TInt aCommandId) const;
1.602 +
1.603 + /**
1.604 + * From MEikButtonGroup.
1.605 + * Gets the button group flags.
1.606 + *
1.607 + * @internal
1.608 + *
1.609 + * @return The button group flags.
1.610 + */
1.611 + TUint ButtonGroupFlags() const;
1.612 +
1.613 + /**
1.614 + * Sets the button group flags.
1.615 + *
1.616 + * @internal
1.617 + *
1.618 + * @param aFlags The button group flags.
1.619 + */
1.620 + IMPORT_C void SetButtonGroupFlags(TInt aFlags);
1.621 +
1.622 + /**
1.623 + * Sets the skin background for this control button array. The new background is used
1.624 + * for all the subsequent drawing operations. This method does not itself cause a repaint.
1.625 + *
1.626 + * @internal
1.627 + *
1.628 + * @param aIID Skin item ID of the new background. This is one of the constants
1.629 + * defined in AknsConstants.h, and the usual values are KAknsIIDQsnBgAreaControl,
1.630 + * KAknsIIDQsnBgAreaControlPopup, and KAknsIIDQsnBgAreaControlIdle.
1.631 + * @since S60 2.0
1.632 + */
1.633 + IMPORT_C void SetSkinBackgroundId(const TAknsItemID& aIID);
1.634 +
1.635 + /**
1.636 + * Sets the middle softkey icon.
1.637 + *
1.638 + * @internal
1.639 + *
1.640 + * @since S60 3.1
1.641 + */
1.642 + void SetMSKIconL();
1.643 +
1.644 + /**
1.645 + * From MEikButtonGroup.
1.646 + * Sets the middle softkey command observer.
1.647 + *
1.648 + * @internal
1.649 + *
1.650 + * @param aCommandObserver The middle softkey command observer.
1.651 + * @since S60 3.1
1.652 + */
1.653 + void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver);
1.654 +
1.655 + /**
1.656 + * From MEikButtonGroup.
1.657 + * Dims (but doesn't draw) the button with position aPosition.
1.658 + *
1.659 + * @internal
1.660 + *
1.661 + * @param aPosition The position for command to be dimmed.
1.662 + * @param aDimmed ETrue for dimming.
1.663 + */
1.664 + void DimCommandByPosition(TInt aPosition, TBool aDimmed);
1.665 +
1.666 + /**
1.667 + * From MEikButtonGroup.
1.668 + * Returns ETrue if the button with position aPosition is dimmed.
1.669 + *
1.670 + * @internal
1.671 + *
1.672 + * @param aPosition The position for command to be checked.
1.673 + * @return The state of the button.
1.674 + */
1.675 + TBool IsCommandDimmedByPosition(TInt aPosition) const;
1.676 +
1.677 + /**
1.678 + * From MEikButtonGroup.
1.679 + * Sets the the button with position aPosition to be visible if aVisible is ETrue.
1.680 + *
1.681 + * @internal
1.682 + *
1.683 + * @param aPosition The position for command to be made visible.
1.684 + * @param aVisible EFalse for making button invisible.
1.685 + */
1.686 + void MakeCommandVisibleByPosition(TInt aPosition, TBool aVisible);
1.687 +
1.688 + /**
1.689 + * From MEikButtonGroup.
1.690 + * Returns ETrue if the button with position aPosition is visible.
1.691 + *
1.692 + * @internal
1.693 + *
1.694 + * @param aPosition The position for command to be checked.
1.695 + * @return The state of the button.
1.696 + */
1.697 + TBool IsCommandVisibleByPosition(TInt aPosition) const;
1.698 +
1.699 + /**
1.700 + * From MEikButtonGroup.
1.701 + * Not supported.
1.702 + *
1.703 + * @internal
1.704 + *
1.705 + * @param aPosition Not used.
1.706 + */
1.707 + void AnimateCommandByPosition(TInt aPosition);
1.708 +
1.709 + /**
1.710 + * Returns a group control (a button) as a control.
1.711 + *
1.712 + * @internal
1.713 + *
1.714 + * @param aPosition The button's position.
1.715 + * @return The group control as a control.
1.716 + */
1.717 +// CCoeControl* GroupControlByPosition(TInt aPosition) const;
1.718 +
1.719 + /**
1.720 + * Gets a CBA button rectangle. This can be used in touch layouts to
1.721 + * get the whole rectangle of the CBA button, as the button areas
1.722 + * are larger than the actual button control in touch layouts.
1.723 + *
1.724 + * @param aPosition Position of the button.
1.725 + * @param aRelativeToScreen If @c ETrue, the returned rectangle
1.726 + * coordinates are relative to the screen
1.727 + * rectangle, otherwise they are relative
1.728 + * to the CBA area. Note that this parameter is
1.729 + * only taken into account in touch layouts, and
1.730 + * in nHD landscape mode the returned rectangle
1.731 + * is always relative to the screen regardless
1.732 + * of this parameter.
1.733 + *
1.734 + * @return Rectangle of the specified button.
1.735 + */
1.736 + TRect ButtonRectByPosition( TInt aPosition,
1.737 + TBool aRelativeToScreen );
1.738 +
1.739 + /**
1.740 + * Enable or disable transparent rendering.
1.741 + *
1.742 + * @internal
1.743 + * @since S60 v5.0
1.744 + * @param aEnable ETrue to enable transparency,
1.745 + * EFalse to disable.
1.746 + */
1.747 + void EnablePostingTransparency( TBool aEnable );
1.748 +
1.749 + /**
1.750 + * Returns TBitFlags.
1.751 + *
1.752 + * @internal
1.753 + * @since S60 v5.2
1.754 + * @return TBitFlags.
1.755 + */
1.756 + TBitFlags Flags();
1.757 +
1.758 + /**
1.759 + * Sets content observer.
1.760 + *
1.761 + * @internal
1.762 + * @since S60 v5.2
1.763 + * @param aCallBack call back to notify of content changes.
1.764 + */
1.765 + void SetContentObserver( TCallBack aCallBack );
1.766 +
1.767 +public:
1.768 + /**
1.769 + * Formerly from MTopSetMember<CEikCba>, now reserved.
1.770 + */
1.771 + virtual void Reserved_MtsmPosition();
1.772 +
1.773 + /**
1.774 + * Formerly from MTopSetMember<CEikCba>, now reserved.
1.775 + */
1.776 + virtual void Reserved_MtsmObject();
1.777 +
1.778 +public: // from CCoeControl
1.779 + /**
1.780 + * From CCoeControl.
1.781 + * Handles key events.
1.782 + *
1.783 + * @param aKeyEvent The key event.
1.784 + * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown.
1.785 + * @return Indicates whether or not the key event was used by this control.
1.786 + */
1.787 + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
1.788 +
1.789 + /**
1.790 + * From CCoeControl.
1.791 + * Sets the control's minimum required size.
1.792 + *
1.793 + * @return The minimum size required by the control.
1.794 + */
1.795 + TSize MinimumSize();
1.796 +
1.797 + /**
1.798 + * From CCoeControl.
1.799 + * Gets the list of logical colours used to draw the control.
1.800 + * The list includes an explanation of how each colour is used.
1.801 + *
1.802 + * @param aColorUseList The colour list.
1.803 + */
1.804 + void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
1.805 +
1.806 + /**
1.807 + * From CCoeControl.
1.808 + * Handles a change to the control's resources.
1.809 + *
1.810 + * @param aType A message UID value.
1.811 + */
1.812 + void HandleResourceChange(TInt aType);
1.813 +
1.814 + /**
1.815 + * From CCoeControl.
1.816 + * Sets this control as visible or invisible.
1.817 + *
1.818 + * @param aVisible ETrue to make the control visible, EFalse to make it invisible.
1.819 + */
1.820 + void MakeVisible(TBool aVisible);
1.821 +
1.822 + /**
1.823 + * From CCoeControl.
1.824 + * Handles pointer events.
1.825 + *
1.826 + * @param aPointerEvent The pointer event
1.827 + */
1.828 + void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.829 +
1.830 + /**
1.831 + * From CCoeControl.
1.832 + * Sets the control's containing window by copying it from aContainer.
1.833 + *
1.834 + * @param aContainer The compound control that is the container for this control
1.835 + */
1.836 + void SetContainerWindowL( const CCoeControl& aContainer );
1.837 +
1.838 + void ActivateL();
1.839 +
1.840 +public: // from MEikEnhancedButtonGroup
1.841 + /**
1.842 + * From MEikEnhancedButtonGroup.
1.843 + * Used to offer list of commands for softkeys.
1.844 + *
1.845 + * @param aCommandList A list of command ids to be offered for softkeys.
1.846 + */
1.847 + IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList);
1.848 +
1.849 + /**
1.850 + * From MEikEnhancedButtonGroup.
1.851 + * Used to offer list of commands for softkeys.
1.852 + *
1.853 + * @param aResourceId Id for CBA resource that defines enhanced cba buttons.
1.854 + */
1.855 + IMPORT_C void OfferCommandListL(const TInt aResourceId);
1.856 +
1.857 + /**
1.858 + * From MEikEnhancedButtonGroup.
1.859 + * Used to check if a certain command have been approved to the current command set.
1.860 + *
1.861 + * @param aCommandId The id for command which existence should be checked.
1.862 + * @return ETrue if command is in control group, otherwise EFalse.
1.863 + */
1.864 + IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const;
1.865 +
1.866 + /**
1.867 + * From MEikEnhancedButtonGroup.
1.868 + * Replace existing command with a new command.
1.869 + *
1.870 + * @param aCommandId Id for command that should be replaced.
1.871 + * @param aResourceId Resource id for new enhanced cba button.
1.872 + */
1.873 + IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId);
1.874 +
1.875 +public: // From MCoeControlObserver
1.876 + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
1.877 +
1.878 +private:
1.879 + /**
1.880 + * From CAknControl
1.881 + */
1.882 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.883 +
1.884 +protected:
1.885 + /**
1.886 + * From MEikScrollBarObserver
1.887 + * Handles scroll events. This function is called by the CEikScrollBar object with which
1.888 + * this scroll bar observer object is registered. Implementations should handle scroll
1.889 + * events appropriately.
1.890 + *
1.891 + * @param aScrollBar Pointer to the originating scroll bar object.
1.892 + * @param aEventType A scroll event.
1.893 + */
1.894 + virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
1.895 +
1.896 + /**
1.897 + * From CCoeControl
1.898 + * Retrieves an object of the same type as that encapsulated in aId.
1.899 + * This function is used to allow controls to ask their owners for access to other
1.900 + * objects that they own.
1.901 + *
1.902 + * @param aId An encapsulated object type ID.
1.903 + * @return Encapsulates the pointer to the object provided. Note that the encapsulated
1.904 + * pointer may be NULL.
1.905 + */
1.906 + TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
1.907 +
1.908 + /**
1.909 + * From CCoeControl.
1.910 + * Draws the control.
1.911 + *
1.912 + * @param aRect Rectangle to draw on.
1.913 + */
1.914 + void Draw(const TRect& aRect) const;
1.915 +
1.916 +public:
1.917 +
1.918 + /**
1.919 + * Checks if the CBA contains no commands.
1.920 + * Note that this returns always @c EFalse if the CBA belongs
1.921 + * to a full screen query.
1.922 + *
1.923 + * @internal
1.924 + *
1.925 + * @return @c ETrue if the CBA buttons are empty, @c EFalse otherwise.
1.926 + *
1.927 + * @since 5.0
1.928 + */
1.929 + IMPORT_C TBool IsEmpty() const;
1.930 +
1.931 + /**
1.932 + * Returns ETrue if softkey status change is allowed.
1.933 + *
1.934 + * @param aSofkeyPosition Softkey position.
1.935 + * @param aDisabled ETrue if softkey is to be disabled.
1.936 + * @return ETrue if softkey status change is allowed.
1.937 + */
1.938 + TBool SoftkeyStatusChangeAllowed(
1.939 + TInt aSofkeyPosition, TBool aDisabled );
1.940 +
1.941 + /**
1.942 + * Returns item specific softkey if it state should be updated.
1.943 + *
1.944 + * @return Item specific softkey.
1.945 + */
1.946 + TEikGroupControl* ItemSpecificSoftkey() const;
1.947 +
1.948 + /**
1.949 + * Updates item specific softkey.
1.950 + *
1.951 + * @param aVisibleCollection ETrue if state should be updated according
1.952 + * to visible collection.
1.953 + */
1.954 + void UpdateItemSpecificSoftkey( TBool aVisibleCollection = ETrue );
1.955 +
1.956 +
1.957 +private: // new methods
1.958 +
1.959 + CEikCba(
1.960 + const CEikCba* aPrevious,
1.961 + MEikCommandObserver* aCommandObserver,
1.962 + RWindowGroup* aParentWg,
1.963 + TUint aFlags = 0 );
1.964 + void BaseConstructL();
1.965 + void ConstructL(TInt aResourceId);
1.966 + void ConstructFromResourceL(TResourceReader& aReader);
1.967 + CCoeControl* ButtonById( TInt aCommandId ) const;
1.968 + void CreateScrollBarFrameL();
1.969 + void InsertScrollBarL();
1.970 + TEikGroupControl VScrollBarAsGroupControl();
1.971 + void CheckSkinAndUpdateContext();
1.972 +
1.973 + TInt AknLayoutFlags() const;
1.974 + void SizeChangedInControlPane();
1.975 + void SizeChangedInStaconPane();
1.976 + void SizeChangedInRightPane();
1.977 + void UpdateFonts();
1.978 +
1.979 + void DoSkinChange();
1.980 + void DoColorChange();
1.981 + void DoLayoutChange();
1.982 +
1.983 + void SizeChangedInsideDialog();
1.984 +
1.985 + /**
1.986 + * Handles size change events in case of embedded softkeys.
1.987 + */
1.988 + void SizeChangedInPopup();
1.989 +
1.990 + /**
1.991 + * Updates softkey labels in case of embedded softkeys.
1.992 + *
1.993 + * @param aDrawDeferred ETrue to cause a redraw event.
1.994 + */
1.995 + void UpdateLabels( TBool aDrawDeferred );
1.996 +
1.997 + /**
1.998 + * Layouts given cba control to it's rect correctly. This function is
1.999 + * used to layout every text and image inside of @c CEikCba.
1.1000 + *
1.1001 + * @param aControl CBA Control that is to be layouted
1.1002 + * @param aRect the rect where control should be layouted.
1.1003 + */
1.1004 + void LayoutControl(CCoeControl* aControl, const TRect& aRect);
1.1005 +
1.1006 + void DoSetLayers( const TAknsItemID& aIID );
1.1007 +
1.1008 + /**
1.1009 + * Broadcasts transparency information
1.1010 + * to CEikCbaButtons.
1.1011 + */
1.1012 + void BroadcastPostingTransparency( TBool aEnable );
1.1013 +
1.1014 + /**
1.1015 + * Sets the CBA fading according to button content.
1.1016 + */
1.1017 + void SetFadeState();
1.1018 +
1.1019 + /**
1.1020 + * A better version of AddCommandToStackL
1.1021 + * Pushes a command button with text and a command ID onto a position's button stack.
1.1022 + * SizeChanged() is not called, so it need to be done after that.
1.1023 + * Note that this implementation does not support bitmap and mask.
1.1024 + *
1.1025 + * @internal
1.1026 + *
1.1027 + * @param aPosition The position in the button group at which to add the command button.
1.1028 + * @param aCommandId Command ID the button will send.
1.1029 + * @param aText Text for the button.
1.1030 + */
1.1031 + void AddCommandToStackWithoutSizeChangedL(
1.1032 + TInt aPosition,
1.1033 + TInt aCommandId,
1.1034 + const TDesC* aText);
1.1035 +
1.1036 + /**
1.1037 + * Removes previous command but do not call SizeChanged And SetMSKIconL.
1.1038 + *
1.1039 + * @internal
1.1040 + *
1.1041 + * @param aPosition The command's position.
1.1042 + */
1.1043 + void RemovePreviousCommandWithoutSizeChanged(TInt aPosition);
1.1044 +
1.1045 + /**
1.1046 + * Reports state changed event if cba changed from empty to non-empty
1.1047 + * or vice versa.
1.1048 + */
1.1049 + void ReportContentChangedEvent();
1.1050 +
1.1051 + /**
1.1052 + * Draws embedded softkey.
1.1053 + *
1.1054 + * @internal
1.1055 + *
1.1056 + * @param aGroupControl TEikGroupControl used to get access to CBA button.
1.1057 + * @param aRect Softkey rectangle
1.1058 + * @param aGc Graphics context
1.1059 + * @param aMask Mask
1.1060 + */
1.1061 + void DrawEmbeddedSoftkey( TEikGroupControl& aGroupControl,
1.1062 + const TRect& aRect,
1.1063 + CWindowGc& aGc,
1.1064 + CFbsBitmap* aMask ) const;
1.1065 + TBool UpdateIconL();
1.1066 +
1.1067 + /**
1.1068 + * Checks if the middle softkey should be used.
1.1069 + *
1.1070 + * @internal
1.1071 + *
1.1072 + * @return @c ETrue if MSK is to be used, @c EFalse otherwise.
1.1073 + */
1.1074 + TBool MskAllowed() const;
1.1075 +
1.1076 + /**
1.1077 + * Updates item specific softkey.
1.1078 + *
1.1079 + * @param aControl Item specifc softkey control.
1.1080 + * @param aEnable ETrue if control should be enabled, EFalse if disabled.
1.1081 + */
1.1082 + void UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable );
1.1083 +
1.1084 +private: // from CCoeControl
1.1085 + void SizeChanged();
1.1086 +
1.1087 +private: // data
1.1088 + TUint iCbaFlags;
1.1089 +
1.1090 + /** Used to maintain the original settings if a client needs to temporarily change its cba. */
1.1091 + const CEikCba* iLink;
1.1092 +
1.1093 + CCoeBrushAndPenContext* iBrushAndPenContext;
1.1094 + MEikCommandObserver* iCommandObserver;
1.1095 + CEikCbaScrollBarFrame* iSBFrame;
1.1096 + RWindowGroup* iParentWg;
1.1097 +
1.1098 + /** New member variable that stores commands in correct order. */
1.1099 + CEikCommandTable* iCommandTable;
1.1100 +
1.1101 + /** For MSK. */
1.1102 + TBool iMSKset;
1.1103 +
1.1104 + /** For MSK, caches CenRep value. */
1.1105 + TBool iMSKEnabledInPlatform;
1.1106 +
1.1107 + /** Additional observer for MSK. This is called first and default observer after that. */
1.1108 + MEikCommandObserver* iMSKCommandObserver;
1.1109 +
1.1110 + // From extension.
1.1111 + const CFont* iLabelFont;
1.1112 + const CFont* iStaconLabelFont;
1.1113 + const CFont* iRightPaneLabelFont;
1.1114 + TBool iPopupVisible;
1.1115 + TBitFlags iFlags;
1.1116 +
1.1117 + /** Old background context. */
1.1118 + CAknsBasicBackgroundControlContext* iBgContext;
1.1119 +
1.1120 + /** Old stacon background context. */
1.1121 + CAknsLayeredBackgroundControlContext* iStaconBgContext;
1.1122 +
1.1123 + /** Masked layer backgrounds. */
1.1124 + CAknsMaskedLayerBackgroundControlContext* iMLBgContext;
1.1125 + CAknsMaskedLayerBackgroundControlContext* iStaconBgContextTop;
1.1126 + CAknsMaskedLayerBackgroundControlContext* iStaconBgContextBottom;
1.1127 +
1.1128 + TAknsItemID iBgIID;
1.1129 +
1.1130 + /**
1.1131 + * Skin background ID for the status pane controlled region
1.1132 + * of the CBA area in bottom softkey landscape mode.
1.1133 + */
1.1134 + TAknsItemID iClockIndicBgIID;
1.1135 + TBool iIsClockIndicBgIIDSet;
1.1136 +
1.1137 + CEikCbaExtension* iExtension;
1.1138 + };
1.1139 +
1.1140 +/**
1.1141 + * EIKON CBA button class definition.
1.1142 + *
1.1143 + * @internal
1.1144 + * @lib eikcoctl.lib
1.1145 + * @since S60 0.9
1.1146 + */
1.1147 +class CEikCbaButton : public CAknControl
1.1148 + {
1.1149 +public:
1.1150 + /**
1.1151 + * Holds information about command id and dimming status for a button.
1.1152 + */
1.1153 + struct SButtonOptions
1.1154 + {
1.1155 + TInt iCommandId;
1.1156 + TBool iDimmed;
1.1157 + };
1.1158 +public:
1.1159 + /**
1.1160 + * Destructor.
1.1161 + */
1.1162 + ~CEikCbaButton();
1.1163 +
1.1164 + /**
1.1165 + * Constructs a new CBA button instance.
1.1166 + *
1.1167 + * @param aAlignment Alignment for label.
1.1168 + */
1.1169 + void ConstructL(TGulAlignmentValue aAlignment);
1.1170 +public:
1.1171 + /**
1.1172 + * Updates the label text with the given label.
1.1173 + *
1.1174 + * @param aText The new label text.
1.1175 + */
1.1176 + void AddCommandL(const TDesC& aText);
1.1177 +
1.1178 + /**
1.1179 + * Pushes a command into button stack.
1.1180 + *
1.1181 + * @param aCommandId The command to be pushed.
1.1182 + * @param aText Text for the button.
1.1183 + */
1.1184 + void PushCommandL(TInt aCommandId, const TDesC& aText);
1.1185 +
1.1186 + /**
1.1187 + * Pops a command from the button stack.
1.1188 + *
1.1189 + * @return The button's command id. KErrNotFound if the button stack is empty.
1.1190 + */
1.1191 + TInt PopCommand();
1.1192 +
1.1193 + /**
1.1194 + * Removes a command from the button stack.
1.1195 + *
1.1196 + * @param aCommandId The command to be removed.
1.1197 + */
1.1198 + void RemoveCommand(TInt aCommandId);
1.1199 +
1.1200 + /**
1.1201 + * Removes the previous command from the button stack.
1.1202 + */
1.1203 + void RemovePreviousCommand();
1.1204 +
1.1205 + /**
1.1206 + * Switches the button's text to short or long depending on the parameter given.
1.1207 + *
1.1208 + * @param aShortText ETrue for short text, EFalse for the long text.
1.1209 + */
1.1210 + void SwitchToShortTextL(TBool aShortText);
1.1211 +
1.1212 + /**
1.1213 + * Sets the labels font.
1.1214 + *
1.1215 + * @param aLabelFont The font to be used.
1.1216 + */
1.1217 + void SetLabelFont(const CFont* aLabelFont);
1.1218 +
1.1219 + /**
1.1220 + * Truncates the label. This is done by CEikLabel.
1.1221 + */
1.1222 + void TruncateLabelText();
1.1223 +
1.1224 + /**
1.1225 + * Checks if text is empty in this button.
1.1226 + */
1.1227 + TBool IsEmptyText() const;
1.1228 +
1.1229 +public:
1.1230 + /**
1.1231 + * From CCoeControl.
1.1232 + * Sets the control's containing window by copying it from aContainer.
1.1233 + *
1.1234 + * @param aContainer The compound control that is the container for this control.
1.1235 + */
1.1236 + void SetContainerWindowL(const CCoeControl& aContainer);
1.1237 +
1.1238 + /**
1.1239 + * Constructs the control from a resource file.
1.1240 + *
1.1241 + * @param aReader The resource reader.
1.1242 + * @param anAlignment Alignment for label.
1.1243 + */
1.1244 + void ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment);
1.1245 +
1.1246 + /**
1.1247 + * From CCoeControl.
1.1248 + * Sets the control's minimum required size.
1.1249 + *
1.1250 + * @return The minimum size required by the control.
1.1251 + */
1.1252 + TSize MinimumSize();
1.1253 +
1.1254 + /**
1.1255 + * From CCoeControl.
1.1256 + * Sets the control to be dimmed.
1.1257 + *
1.1258 + * @param aDimmed ETrue to dim the control, EFalse to set the control as not dimmed.
1.1259 + */
1.1260 + void SetDimmed(TBool aDimmed);
1.1261 +
1.1262 + /**
1.1263 + * From CCoeControl.
1.1264 + * Handles pointer events.
1.1265 + *
1.1266 + * @param aPointerEvent The pointer event.
1.1267 + */
1.1268 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.1269 +
1.1270 +public:
1.1271 + /**
1.1272 + * Sets the button's image.
1.1273 + *
1.1274 + * @param aImage The image to be set.
1.1275 + */
1.1276 + void SetImage(CEikImage &aImage);
1.1277 +
1.1278 + /**
1.1279 + * Replaces the buttons image with label.
1.1280 + */
1.1281 + void ReplaceImageByLabel();
1.1282 +
1.1283 + /**
1.1284 + * Returns whether the button has image set.
1.1285 + *
1.1286 + * @return ETrue if the button has image set, EFalse otherwise.
1.1287 + */
1.1288 + inline TBool IsImageOn() const {return iDoImage;};
1.1289 +
1.1290 + /**
1.1291 + * Constructs empty button with id EAknSoftkeyEmpty
1.1292 + */
1.1293 + void ConstructEmptyButtonL();
1.1294 +
1.1295 +protected:
1.1296 + /**
1.1297 + * Returns the button's index by command id.
1.1298 + *
1.1299 + * @param aCommandId The button's command id.
1.1300 + * @return The button's index.
1.1301 + */
1.1302 + TInt IndexFromCommandId(TInt aCommandId);
1.1303 +
1.1304 + /**
1.1305 + * Updates the label text with the given label.
1.1306 + *
1.1307 + * @param aText The new label text.
1.1308 + */
1.1309 + void UpdateLabelText(TPtrC aLabelText);
1.1310 +
1.1311 +private:
1.1312 + /**
1.1313 + * From CCoeControl.
1.1314 + * Gets the number of controls contained in a compound control.
1.1315 + *
1.1316 + * @return The number of component controls contained by this control.
1.1317 + */
1.1318 + TInt CountComponentControls() const;
1.1319 +
1.1320 + /**
1.1321 + * From CCoeControl.
1.1322 + * Gets an indexed component of a compound control.
1.1323 + *
1.1324 + * @param The index of the control.
1.1325 + * @return The component control with an index of aIndex.
1.1326 + */
1.1327 + CCoeControl* ComponentControl(TInt aIndex) const;
1.1328 +
1.1329 + /**
1.1330 + * From CCoeControl.
1.1331 + * Responds to changes to the size and position of the contents of this control.
1.1332 + */
1.1333 + void SizeChanged();
1.1334 +
1.1335 + /**
1.1336 + * From CAknControl.
1.1337 + */
1.1338 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.1339 +
1.1340 +public: // new functions
1.1341 + /**
1.1342 + * Returns the state of @c CEikCbaButton.
1.1343 + *
1.1344 + * @return Boolean value for CEikCbaButtons state. ETrue if button is
1.1345 + * pressed down. Otherwise returns EFalse.
1.1346 + */
1.1347 + TBool PressedDown() const;
1.1348 +
1.1349 + /**
1.1350 + * Changes the state of @c CEikCbaButton. Button's state is stored in a
1.1351 + * member variable.
1.1352 + *
1.1353 + * @param aPressedDown The state that button has. @c ETrue if button's
1.1354 + * state is pressed down. @c EFalse for normal,
1.1355 + * not pressed state.
1.1356 + */
1.1357 + void SetPressedDown( const TBool aPressedDown );
1.1358 +
1.1359 + /**
1.1360 + * Enables bitmap mode and hides the label. The text is drawn by CEikCba
1.1361 + * in bitmap mode.
1.1362 + * @internal
1.1363 + * @since S60 v5.0
1.1364 + * @param aEnableBitmap ETrue to enable bitmap mode. EFalse to work in the
1.1365 + * standard way.
1.1366 + */
1.1367 + void SetTextBitmapMode( TBool aEnableBitmap );
1.1368 +
1.1369 + /**
1.1370 + * Draws the button text and mask to give graphics contexts. Background
1.1371 + * is not drawn.
1.1372 + * @internal
1.1373 + * @since S60 v5.0
1.1374 + * @param aContext Graphics context to render the text itself into.
1.1375 + * @param aMaskContext Graphics context to render the text mask into.
1.1376 + * @param aOffset Offset between the coordinate system of the target
1.1377 + * bitmap context relative to screen coordinates.
1.1378 + */
1.1379 + void DrawToContext(
1.1380 + CBitmapContext& aContext,
1.1381 + CBitmapContext& aMaskContext,
1.1382 + const TPoint& aOffset ) const;
1.1383 +
1.1384 + /**
1.1385 + * Returns the textual value of the button
1.1386 + * @internal
1.1387 + * @since S60 v5.0
1.1388 + */
1.1389 + inline TPtrC FullLabelText() { return iFullLabelText;};
1.1390 +
1.1391 +private:
1.1392 + void PrepareImageL();
1.1393 +
1.1394 +protected:
1.1395 + TBuf<KMaxCbaLabelLength> iFullLabelText;
1.1396 + TPtrC iLongLabelText;
1.1397 + TPtrC iShortLabelText;
1.1398 + CEikLabel* iLabel;
1.1399 + CDesCArray* iText;
1.1400 + CArrayFix<SButtonOptions>* iButtonOptions;
1.1401 + CEikImage* iImage;
1.1402 + /** Original mask for softkey image. */
1.1403 + const CFbsBitmap* iMask;
1.1404 + /** Feedback effects transparency mask for softkey image. */
1.1405 + CFbsBitmap* iSfeMask;
1.1406 + TBool iDoImage;
1.1407 + /** ETrue if should use text bitmap mode. */
1.1408 + TBool iUseTextBitmap;
1.1409 + /** Buttons state. */
1.1410 + TBool iPressedDown;
1.1411 + };
1.1412 +
1.1413 +/**
1.1414 + * Specialization of CEikCbaButton for the new Enhanced CBA button.
1.1415 + *
1.1416 + * @lib eikcoctl.lib
1.1417 + * @since S60 3.0
1.1418 + */
1.1419 +class CEikEnhancedCbaButton : public CEikCbaButton
1.1420 + {
1.1421 +public:
1.1422 + /**
1.1423 + * Default constructor.
1.1424 + */
1.1425 + CEikEnhancedCbaButton();
1.1426 +
1.1427 + /**
1.1428 + * Destructor.
1.1429 + */
1.1430 + ~CEikEnhancedCbaButton();
1.1431 +
1.1432 + /**
1.1433 + * Returns the command type for current button.
1.1434 + *
1.1435 + * @return The command type.
1.1436 + */
1.1437 + TInt CommandType() const;
1.1438 +
1.1439 + /**
1.1440 + * Sets command type for current button.
1.1441 + *
1.1442 + * @param aCommandType Command type to be set.
1.1443 + */
1.1444 + void SetCommandType(const TInt aCommandType);
1.1445 +
1.1446 + /**
1.1447 + * Returns the command id for current button.
1.1448 + *
1.1449 + * @return The command id.
1.1450 + */
1.1451 + TInt CommandId() const;
1.1452 +
1.1453 + /**
1.1454 + * Constructs a button based on resource definition.
1.1455 + *
1.1456 + * @param aReader Resource reader for reading information from resource file.
1.1457 + */
1.1458 + void ConstructFromResourceL(TResourceReader& aReader);
1.1459 +
1.1460 + /**
1.1461 + * Constructs empty button with id EAknSoftkeyEmpty.
1.1462 + */
1.1463 + void ConstructEmptyButtonL();
1.1464 +
1.1465 + /**
1.1466 + * Used to get the label text for the button.
1.1467 + *
1.1468 + * @return Pointer to the label text.
1.1469 + */
1.1470 + TPtrC* LabelText();
1.1471 +
1.1472 +private: // data
1.1473 + TInt iCommandType;
1.1474 + TInt iCommandId;
1.1475 + };
1.1476 +
1.1477 +/**
1.1478 + * Holds (enhanced) CBA commands and handles command ordering due to placement rules.
1.1479 + *
1.1480 + * @lib eikcoctl.lib
1.1481 + * @since S60 3.0
1.1482 + *
1.1483 + * @internal
1.1484 + */
1.1485 +NONSHARABLE_CLASS(CEikCommandTable) : public CBase
1.1486 + {
1.1487 +public:
1.1488 + /**
1.1489 + * Constructs a new command table instance.
1.1490 + *
1.1491 + * @return The new command table.
1.1492 + */
1.1493 + static CEikCommandTable* NewL();
1.1494 +
1.1495 + /**
1.1496 + * Constructs a new command table instance.
1.1497 + *
1.1498 + * @return The new command table.
1.1499 + */
1.1500 + static CEikCommandTable* NewLC();
1.1501 +
1.1502 + /**
1.1503 + * Destructor.
1.1504 + */
1.1505 + ~CEikCommandTable();
1.1506 +
1.1507 + /**
1.1508 + * Used to add a command to CommandTable.
1.1509 + *
1.1510 + * @param aButton The button to be added.
1.1511 + * @return KErrNone if addition was successful.
1.1512 + */
1.1513 + TInt AddCommandL(CEikEnhancedCbaButton* aButton);
1.1514 +
1.1515 + /**
1.1516 + * Used to check if command table has a button with a certain id.
1.1517 + *
1.1518 + * @param aCommandId The id to be checked.
1.1519 + * @return ETrue if command is placed in the command table.
1.1520 + */
1.1521 + TBool IsCommandPlaced(const TInt aCommandId) const;
1.1522 +
1.1523 + /**
1.1524 + * Used to replace command with a new command.
1.1525 + *
1.1526 + * @param aCommandId Id for command that should be replaced.
1.1527 + * @param aResourceId Id for new ENHANCED_CBA_BUTTON resource to be placed in the
1.1528 + * CommandTable.
1.1529 + */
1.1530 + void ReplaceCommandL(const TInt aCommandId, const TInt aResourceId);
1.1531 +
1.1532 + /**
1.1533 + * Used to get CEikEnhancedCbaButton for current control button (1-4).
1.1534 + *
1.1535 + * @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions.
1.1536 + * @return CEikCbaButton for current position, NULL if no button placed in that position.
1.1537 + */
1.1538 + CEikEnhancedCbaButton* Command(const TInt aCommandIndex);
1.1539 +
1.1540 + /**
1.1541 + * Reset CommandTable.
1.1542 + */
1.1543 + void Reset();
1.1544 +
1.1545 +private: // member functions
1.1546 + /**
1.1547 + * Constructor.
1.1548 + */
1.1549 + CEikCommandTable();
1.1550 +
1.1551 + /**
1.1552 + * Constructs command table with device button priorities.
1.1553 + */
1.1554 + void ConstructL();
1.1555 +
1.1556 +private: // data
1.1557 + /** Displayed commands. */
1.1558 + TFixedArray<CEikEnhancedCbaButton*, KMaxButtonsInCommandTable> iCommandButtons;
1.1559 +
1.1560 + /** Priority order for each button. */
1.1561 + RArray< RArray<TInt> > iPriorities;
1.1562 + };
1.1563 +
1.1564 +#endif // __EIKCBA_H__