epoc32/include/mw/eikbtgrp.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/eikbtgrp.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,374 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2007 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 button group base class definitions.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef __EIKBTGRP_H__
    1.23 +#define __EIKBTGRP_H__
    1.24 +
    1.25 +#include <e32std.h>
    1.26 +
    1.27 +class CCoeControl;
    1.28 +class CEikCommandButton;
    1.29 +class CFbsBitmap;
    1.30 +class MEikCommandObserver;
    1.31 +
    1.32 +/**
    1.33 + * Abstract base class for EIKON button group.
    1.34 + *
    1.35 + * @lib eikcoctl.lib
    1.36 + * @since S60 0.9  
    1.37 + *
    1.38 + * @internal
    1.39 + */
    1.40 +class MEikButtonGroup
    1.41 +    {
    1.42 +public:
    1.43 +    /**
    1.44 +     * Deletes the object.
    1.45 +     */
    1.46 +    void Release();
    1.47 +    
    1.48 +    /**
    1.49 +     * Sets a command button's bitmap, text and command ID.
    1.50 +     *
    1.51 +     * @param aPosition The position within the button group of the button to change. 
    1.52 +     * @param aCommandId Command ID the button will send.
    1.53 +     * @param aText The text for the button.
    1.54 +     * @param aBitmap The bitmap for the button.
    1.55 +     * @param aMask The mask bitmap for aBitmap.
    1.56 +     */    
    1.57 +    virtual void SetCommandL(
    1.58 +        TInt aPosition,
    1.59 +        TInt aCommandId,
    1.60 +        const TDesC* aText,
    1.61 +        const CFbsBitmap* aBitmap,
    1.62 +        const CFbsBitmap* aMask) = 0;
    1.63 +       
    1.64 +    /**
    1.65 +     * Sets a command button's bitmap, text label and command ID.
    1.66 +     * The bitmap, mask, text and command ID are all read from resource.
    1.67 +     *
    1.68 +     * @param aPosition The position within the button group of the button to change.
    1.69 +     * @param aResourceId Resource ID specifying the text, bitmaps and command ID.
    1.70 +     */        
    1.71 +    virtual void SetCommandL(TInt aPosition, 
    1.72 +        TInt aResourceId) = 0;
    1.73 +
    1.74 +    /**
    1.75 +     * Initialises the group of command buttons from a resource.
    1.76 +     *
    1.77 +     * @param aResourceId ID of the resource structure specifying the command buttons.
    1.78 +     */    
    1.79 +    virtual void SetCommandSetL(TInt aResourceId) = 0;
    1.80 +    
    1.81 +    /**
    1.82 +     * Adds a command button with a command ID and a label containing both a bitmap and text.
    1.83 +     *
    1.84 +     * @param aPosition The position in the button group for the new button.
    1.85 +     * @param aCommandId Command ID for the new button.
    1.86 +     * @param aText Text for the button.
    1.87 +     * @param aBitmap Bitmap for the button.
    1.88 +     * @param aMask Mask bitmap for aBitmap.
    1.89 +     */    
    1.90 +    virtual void AddCommandL(
    1.91 +        TInt aPosition,
    1.92 +        TInt aCommandId,
    1.93 +        const TDesC* aText,
    1.94 +        const CFbsBitmap* aBitmap,
    1.95 +        const CFbsBitmap* aMask) = 0;
    1.96 +        
    1.97 +    /**
    1.98 +     * Pushes a command button with text, bitmap, mask and a command ID onto a 
    1.99 +     * position's button stack.
   1.100 +     *
   1.101 +     * @param aPosition The position in the button group at which to add the command button.
   1.102 +     * @param aCommandId Command ID the button will send.
   1.103 +     * @param aText Text for the button.
   1.104 +     * @param aBitmap Bitmap for the button.
   1.105 +     * @param aMask Mask bitmap for aBitmap.
   1.106 +     */        
   1.107 +    virtual void AddCommandToStackL(
   1.108 +        TInt aPosition,
   1.109 +        TInt aCommandId,
   1.110 +        const TDesC* aText,
   1.111 +        const CFbsBitmap* aBitmap,
   1.112 +        const CFbsBitmap* aMask) = 0;
   1.113 +       
   1.114 +    /**
   1.115 +     * Pushes a command button onto a position's button stack.
   1.116 +     * The text, bitmap, mask and command ID are all read from resource.
   1.117 +     *
   1.118 +     * @param aPosition The position in the button group at which to push the command button.
   1.119 +     * @param aResourceId ID of a resource specifying the text, bitmaps and command ID.
   1.120 +     */        
   1.121 +    virtual void AddCommandToStackL(TInt aPosition, 
   1.122 +        TInt aResourceId) = 0;
   1.123 +    
   1.124 +    /**
   1.125 +     * As with SetCommandL() but for a set of buttons, also allows the previous 
   1.126 +     * command button to be retrieved by calling RemoveCommand().
   1.127 +     *
   1.128 +     * @param aResourceId Resource describing the set of command buttons.
   1.129 +     */    
   1.130 +    virtual void AddCommandSetToStackL(TInt aResourceId) = 0;
   1.131 +
   1.132 +    /**
   1.133 +     * Sets the default command ID for buttons in this button group.
   1.134 +     *
   1.135 +     * @param aCommandId Command to issue if no other is specified.
   1.136 +     */    
   1.137 +    virtual void SetDefaultCommand(TInt aCommandId) = 0;
   1.138 +    
   1.139 +    /**
   1.140 +     * Calculates minimum size required to display the buttons defined in the 
   1.141 +     * specified resource structure.
   1.142 +     *
   1.143 +     * @param aResourceId The ID of the resource structure describing the button group.
   1.144 +     * @return Minimum size required to display the button group defined in the specified 
   1.145 +     *         resource structure.
   1.146 +     */    
   1.147 +    virtual TSize CalcMinimumSizeL(TInt aResourceId) = 0;
   1.148 +    
   1.149 +    /**
   1.150 +     * Removes the command identified by aCommandId, in position aPosition in the 
   1.151 +     * group, from the command stack. Automatically retrieves the previous command 
   1.152 +     * details. Commands are added to the stack by calling AddCommandToStackL.
   1.153 +     *
   1.154 +     * @param aPosition The position in the button group from which to remove the 
   1.155 +     *                  command button.
   1.156 +     * @param aCommandId Command ID.
   1.157 +     */    
   1.158 +    virtual void RemoveCommandFromStack(TInt aPosition, 
   1.159 +        TInt aCommandId) = 0;
   1.160 +    
   1.161 +    /**
   1.162 +     * Returns the command position by command id.
   1.163 +     *
   1.164 +     * @param aCommandId The button's command id.
   1.165 +     * @return The command position in the button group.
   1.166 +     */    
   1.167 +    virtual TInt CommandPos(TInt aCommandId) const = 0;
   1.168 +    
   1.169 +    /**
   1.170 +     * Dims or undims a button without drawing it. 
   1.171 +     *
   1.172 +     * @param aCommandId Command ID of the button to change.
   1.173 +     * @param aDimmed ETrue to dim the specified command. EFalse to undim the specified command.
   1.174 +     */    
   1.175 +    virtual void DimCommand(TInt aCommandId, 
   1.176 +        TBool aDimmed) = 0;
   1.177 +    
   1.178 +    /**
   1.179 +     * Determines whether the button with the specified command ID is dimmed. 
   1.180 +     *
   1.181 +     * @param aCommandId The command ID.
   1.182 +     * @return ETrue if the specified command is dimmed. EFalse if the specified command is 
   1.183 +     *               not dimmed.
   1.184 +     */    
   1.185 +    virtual TBool IsCommandDimmed(TInt aCommandId) const = 0;
   1.186 +    
   1.187 +    /**
   1.188 +     * Makes the button with the specified id either visible, or invisible. 
   1.189 +     *
   1.190 +     * @param aCommandId Specifies the button to alter.
   1.191 +
   1.192 +     * @param aVisible ETrue to make the specified button visible. EFalse to make the specified
   1.193 +     *                 button invisible.
   1.194 +     */    
   1.195 +    virtual void MakeCommandVisible(TInt aCommandId, 
   1.196 +        TBool aVisible) = 0;
   1.197 +    
   1.198 +    /**
   1.199 +     * Tests whether the button with the specified command ID is visible.
   1.200 +     *
   1.201 +     * @param aCommandId Specifies the button.
   1.202 +     * @return ETrue if the specified button is visible. EFalse if the specified button is 
   1.203 +     *               not visible.
   1.204 +     */    
   1.205 +    virtual TBool IsCommandVisible(TInt aCommandId) const = 0;
   1.206 +    
   1.207 +    /**
   1.208 +     * Animates the button with the specified id. 
   1.209 +     *
   1.210 +     * @param aCommandId The button to animate.
   1.211 +     */    
   1.212 +    IMPORT_C virtual void AnimateCommand(TInt aCommandId);
   1.213 +    
   1.214 +    /**
   1.215 +     * Returns the button group as a control.
   1.216 +     *
   1.217 +     * @return The button group as a control.
   1.218 +     */    
   1.219 +    virtual CCoeControl* AsControl() = 0;
   1.220 +    
   1.221 +    /**
   1.222 +     * Returns the button group as a control.
   1.223 +     *
   1.224 +     * @return The button group as a control.
   1.225 +     */    
   1.226 +    virtual const CCoeControl* AsControl() const = 0;
   1.227 +    
   1.228 +    /**
   1.229 +     * Sets the boundary rectangle for externally-positioned button groups. 
   1.230 +     * For use by EExternal button groups only.
   1.231 +     *
   1.232 +     * @param aBoundingRect The boundary rectangle to use. The button group attaches itself 
   1.233 +     *                      to the inside of this rectangle.
   1.234 +     */     
   1.235 +    virtual void SetBoundingRect(const TRect& aBoundingRect) = 0;
   1.236 +    
   1.237 +    /**
   1.238 +     * Subtracts the area occupied by the button group from the specified bounding rectangle.
   1.239 +     * This method should be used in preference to querying the container's area at all times.
   1.240 +     * For use by EExternal button groups only.
   1.241 +     *
   1.242 +     * @param aBoundingRect Rectangle to be modified.
   1.243 +     */     
   1.244 +    virtual void ReduceRect(TRect& aBoundingRect) const = 0;
   1.245 +
   1.246 +    /**
   1.247 +     * Returns a group control (a button) as a control.
   1.248 +     *
   1.249 +     * @param aCommandId The button's command id.
   1.250 +     * @return The group control as a control.
   1.251 +     */     
   1.252 +    virtual CCoeControl* GroupControlById(TInt aCommandId) const = 0;
   1.253 +
   1.254 +    /**
   1.255 +     * Returns a group control (a button) as a command button.
   1.256 +     *
   1.257 +     * @param aCommandId The button's command id.
   1.258 +     * @return The group control as a command button.
   1.259 +     */     
   1.260 +    virtual CEikCommandButton* GroupControlAsButton(TInt aCommandId) const = 0;
   1.261 +
   1.262 +    /**
   1.263 +     * Returns the command id by position.
   1.264 +     *
   1.265 +     * @param aCommandPos The command's position.
   1.266 +     * @return The command id.
   1.267 +     */     
   1.268 +    virtual TInt CommandId(TInt aCommandPos) const = 0;
   1.269 +    
   1.270 +    /**
   1.271 +     * Gets the total number of buttons currently present in the group.
   1.272 +     *
   1.273 +     * @return The number of buttons.
   1.274 +     */     
   1.275 +    virtual TInt ButtonCount() const = 0;
   1.276 +    
   1.277 +    /**
   1.278 +     * Gets the button group flags.
   1.279 +     *
   1.280 +     * @return The button group flags.
   1.281 +     */     
   1.282 +    virtual TUint ButtonGroupFlags() const = 0;
   1.283 +
   1.284 +    /**
   1.285 +     * Sets the middle softkey command observer.
   1.286 +     *
   1.287 +     * @param aCommandObserver The middle softkey command observer.
   1.288 +     */ 
   1.289 +    virtual void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver) = 0;
   1.290 +    
   1.291 +    /**
   1.292 +     * Dims (but doesn't draw) the button with position aPosition.
   1.293 +     *
   1.294 +     * @param aPosition The position for command to be dimmed.
   1.295 +     * @param aDimmed ETrue for dimming.
   1.296 +     */    
   1.297 +    virtual void DimCommandByPosition(TInt aPosition, 
   1.298 +        TBool aDimmed) = 0;
   1.299 +    
   1.300 +    /**
   1.301 +     * Returns ETrue if the button with position aPosition is dimmed.
   1.302 +     *
   1.303 +     * @param aPosition The position for command to be checked.
   1.304 +     * @return The state of the button.    
   1.305 +     */    
   1.306 +    virtual TBool IsCommandDimmedByPosition(TInt aPosition) const = 0;
   1.307 +    
   1.308 +    /**
   1.309 +     * Sets the the button with position aPosition to be visible if aVisible is ETrue.
   1.310 +     *
   1.311 +     * @param aPosition The position for command to be made visible.
   1.312 +     * @param aVisible EFalse for making button invisible.
   1.313 +     */     
   1.314 +    virtual void MakeCommandVisibleByPosition(TInt aPosition, 
   1.315 +        TBool aVisible) = 0;
   1.316 +
   1.317 +    /**
   1.318 +     * Returns ETrue if the button with position aPosition is visible.
   1.319 +     *
   1.320 +     * @param aPosition The position for command to be checked.
   1.321 +     * @return The state of the button.     
   1.322 +     */     
   1.323 +    virtual TBool IsCommandVisibleByPosition(TInt aPosition) const = 0;
   1.324 +    
   1.325 +    /**
   1.326 +     * Animates the button with position aPosition.
   1.327 +     *
   1.328 +     * @param aPosition The position for command to be animated.    
   1.329 +     */  
   1.330 +    virtual void AnimateCommandByPosition(TInt aPosition) = 0;
   1.331 +    
   1.332 +private:
   1.333 +    IMPORT_C void Reserved_1();
   1.334 +    };
   1.335 +    
   1.336 +
   1.337 +/**
   1.338 + * Extends needed functions for enhanced cba.
   1.339 + *
   1.340 + * @internal 
   1.341 + * @since S60 3.0
   1.342 + */
   1.343 +class MEikEnhancedButtonGroup : public MEikButtonGroup
   1.344 +    {
   1.345 +public:
   1.346 +    /**
   1.347 +     * Used to offer list of commands for softkeys.
   1.348 +     *
   1.349 +     * @param aCommandList A list of command ids to be offered for softkeys.
   1.350 +     */
   1.351 +    IMPORT_C virtual void OfferCommandListL(const RArray<TInt>& aCommandList) = 0;
   1.352 +
   1.353 +    /**
   1.354 +     * Used to offer list of commands for softkeys.
   1.355 +     *
   1.356 +     * @param aResourceId Id for CBA resource that defines enhanced cba buttons.
   1.357 +     */
   1.358 +    IMPORT_C virtual void OfferCommandListL(const TInt aResourceId) = 0;
   1.359 +    
   1.360 +    /**
   1.361 +     * Used to check if a certain command have been approved to the current command set.
   1.362 +     *
   1.363 +     * @param aCommandId The id for command which existence should be checked.
   1.364 +     * @return ETrue if command is in control group, otherwise EFalse.
   1.365 +     */ 
   1.366 +    IMPORT_C virtual TBool IsCommandInGroup(const TInt aCommandId) const = 0;
   1.367 +    
   1.368 +    /**
   1.369 +     * Replace existing command with a new command.
   1.370 +     *
   1.371 +     * @param aCommandId Id for command that should be replaced.
   1.372 +     * @param aResourceId Resource id for new enhanced cba button.
   1.373 +     */ 
   1.374 +    IMPORT_C virtual void ReplaceCommand(const TInt aCommandId, const TInt aResourceId) = 0;  
   1.375 +    };
   1.376 +
   1.377 +#endif // __EIKBTGRP_H__