2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Button group factory interface definitions.
19 #ifndef __EIKBGFTY_H__
20 #define __EIKBGFTY_H__
26 * The EikButtonGroupFactory class provides an interface to the button group factory.
31 class EikButtonGroupFactory
35 * Defines information required to create a button group.
43 * Constructor taking arguments required to create a button group.
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
55 IMPORT_C TCreationData(
56 CEikButtonGroupContainer::TUse aUse,
57 MEikCommandObserver* aCommandObserver,
59 RWindowGroup* aParentWg,
61 CEikButtonGroupContainer::TOrientation aOrientation);
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.
69 CEikButtonGroupContainer::TUse iUse;
72 * The command observer to be notified of commands on the container.
75 MEikCommandObserver* iCommandObserver;
78 * A resource containing descriptions of buttons in the group.
83 * Parent window group.
86 RWindowGroup* iParentWg;
89 * Flags for the button group.
94 * Orientation of the new button group.
96 CEikButtonGroupContainer::TOrientation iOrientation;
101 * Creates a button group of given type if it exists in any registered button group
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.
110 static MEikButtonGroup* CreateButtonGroupByTypeL(
111 TInt aButtonGroupType,
112 TCreationData& aCreationData,
113 TBool& aAddToButtonGroupStack);
117 * Pointer to a button group factory function is defined as a pointer to a MEikButtonGroup object.
119 typedef MEikButtonGroup* (*TCreateButtonGroupByTypeFunction)(
121 EikButtonGroupFactory::TCreationData&,
125 * Array storing the button group factory functions.
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
135 NONSHARABLE_CLASS(CEikButtonGroupFactoryArray) : public CCoeStatic
139 * Adds a button group factory function to the array.
141 * @param aCreateButtonGroupByTypeFunction The factory function to be added.
143 IMPORT_C static void AppendFactoryFunctionL(
144 TCreateButtonGroupByTypeFunction aCreateButtonGroupByTypeFunction);
147 * Removes a button group factory function from the array.
149 * @param aCreateButtonGroupByTypeFunction The factory function to be removed.
151 IMPORT_C static void RemoveFactoryFunction(
152 TCreateButtonGroupByTypeFunction aCreateButtonGroupByTypeFunction);
155 * Returns the array of pointers to the registered button group factory creation methods.
157 * @return The array of button group factory functions.
159 static CArrayFixFlat<TCreateButtonGroupByTypeFunction>* ButtonGroupFactoryFuncArray();
164 ~CEikButtonGroupFactoryArray();
167 inline CEikButtonGroupFactoryArray();
168 inline static CEikButtonGroupFactoryArray* Self();
171 CArrayFixFlat<TCreateButtonGroupByTypeFunction>* iButtonGroupFactoryFuncArray;
174 #endif // __EIKBGFTY_H__