epoc32/include/mw/eikbgfty.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100 (2010-03-31)
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Button group factory interface definitions.
    15 *
    16 */
    17 
    18 
    19 #ifndef __EIKBGFTY_H__
    20 #define __EIKBGFTY_H__
    21 
    22 #include <eikbtgpc.h>
    23 #include <coemain.h>
    24 
    25 /**
    26  * The EikButtonGroupFactory class provides an interface to the button group factory.
    27  *
    28  * @lib eikcoctl.lib
    29  * @since S60 0.9
    30  */ 
    31 class EikButtonGroupFactory
    32     {
    33 public:
    34     /**
    35      * Defines information required to create a button group.
    36      *
    37      * @lib eikcoctl.lib
    38      */
    39     class TCreationData
    40         {
    41     public:
    42         /**
    43          * Constructor taking arguments required to create a button group.
    44          *
    45          * @param aUse The type of button group container.
    46          * @param aCommandObserver A command observer to be notified of commands on the container.
    47          * @param aResourceId A resource containing descriptions of buttons in the group. 
    48          *                    This can be NULL if buttons are to be added dynamically. 
    49          * @param aParentWg Parent window group.
    50          * @param aFlags The button group's flags.
    51          * @param aOrientation The button group's containers orientation. You need specify this 
    52          *                     only for devices that can layout their buttons either horizontally 
    53          *                     or vertically. 
    54          */
    55         IMPORT_C TCreationData(
    56             CEikButtonGroupContainer::TUse aUse,
    57             MEikCommandObserver* aCommandObserver,
    58             TInt aResourceId, 
    59             RWindowGroup* aParentWg, 
    60             TUint aFlags,
    61             CEikButtonGroupContainer::TOrientation aOrientation);
    62     public:
    63         /**
    64          * Container use type.
    65          *
    66          * This member is used to specify to the system the general type of the button group that
    67          * is required. The system then creates the appropriate button group for the specified type. 
    68          */
    69         CEikButtonGroupContainer::TUse iUse;
    70         
    71         /**
    72          * The command observer to be notified of commands on the container. 
    73          * Not owned.
    74          */        
    75         MEikCommandObserver* iCommandObserver;
    76         
    77         /**
    78          * A resource containing descriptions of buttons in the group.
    79          */
    80         TInt iResourceId;
    81         
    82         /**
    83          * Parent window group.
    84          * Not owned.
    85          */        
    86         RWindowGroup* iParentWg;
    87         
    88         /**
    89          * Flags for the button group.
    90          */
    91         TUint iFlags;
    92         
    93         /**
    94          * Orientation of the new button group.
    95          */
    96         CEikButtonGroupContainer::TOrientation iOrientation;
    97         };
    98         
    99 public:
   100     /**
   101      * Creates a button group of given type if it exists in any registered button group
   102      * factory function.
   103      *
   104      * @param aButtonGroupType The type of button group to be created.
   105      * @param aCreationData Required extra information.
   106      * @param aAddToButtonGroupStack Whether to add the button group to the button group stack.
   107      * @return A handle to the button group interface the constructed object implements. NULL 
   108      *         if aButtonGroupType doesn't exist in any registered button group factory function.
   109      */
   110     static MEikButtonGroup* CreateButtonGroupByTypeL(
   111         TInt aButtonGroupType,
   112         TCreationData& aCreationData,
   113         TBool& aAddToButtonGroupStack);
   114     };
   115 
   116 /**
   117  * Pointer to a button group factory function is defined as a pointer to a MEikButtonGroup object.
   118  */
   119 typedef MEikButtonGroup* (*TCreateButtonGroupByTypeFunction)(
   120     TInt, 
   121     EikButtonGroupFactory::TCreationData&, 
   122     TBool&);
   123 
   124 /**
   125  * Array storing the button group factory functions.
   126  *
   127  * The CEikButtonGroupFactoryArray class actually stores the button group factory functions
   128  * which are registered. It also provides facility to add and remove these functions from
   129  * the storage array. Notably this class is CCoeStatic derived, allowing application wide
   130  * access.
   131  *
   132  * @lib eikcoctl.lib
   133  * @since S60 0.9 
   134  */
   135 NONSHARABLE_CLASS(CEikButtonGroupFactoryArray) : public CCoeStatic
   136     {
   137 public:
   138     /**
   139      * Adds a button group factory function to the array.
   140      *
   141      * @param aCreateButtonGroupByTypeFunction The factory function to be added.
   142      */
   143     IMPORT_C static void AppendFactoryFunctionL(
   144         TCreateButtonGroupByTypeFunction aCreateButtonGroupByTypeFunction);
   145         
   146     /**
   147      * Removes a button group factory function from the array.
   148      *
   149      * @param aCreateButtonGroupByTypeFunction The factory function to be removed.
   150      */        
   151     IMPORT_C static void RemoveFactoryFunction(
   152         TCreateButtonGroupByTypeFunction aCreateButtonGroupByTypeFunction);
   153 
   154     /**
   155      * Returns the array of pointers to the registered button group factory creation methods.
   156      *
   157      * @return The array of button group factory functions.
   158      */
   159     static CArrayFixFlat<TCreateButtonGroupByTypeFunction>* ButtonGroupFactoryFuncArray();
   160 
   161     /**
   162      * Destructor.
   163      */
   164     ~CEikButtonGroupFactoryArray();
   165 
   166 private:
   167     inline CEikButtonGroupFactoryArray();
   168     inline static CEikButtonGroupFactoryArray* Self();
   169     
   170 private: // data    
   171     CArrayFixFlat<TCreateButtonGroupByTypeFunction>* iButtonGroupFactoryFuncArray;
   172     };
   173 
   174 #endif // __EIKBGFTY_H__