camerauis/activepalette/Inc/ActivePalette2Item.h
changeset 19 d9aefe59d544
parent 3 8b2d6d0384b0
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
     1 /*
       
     2 * Copyright (c) 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:  Active Palette item*
       
    15 */
       
    16 
       
    17 
       
    18 /**
       
    19  * @file ActivePalette2Item.h
       
    20  * Active Palette item
       
    21  */
       
    22 
       
    23 #ifndef _ACTIVE_PALETTE_2_ITEM_H
       
    24 #define _ACTIVE_PALETTE_2_ITEM_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include <e32std.h>
       
    28 
       
    29 #include "CActivePalettePluginBase.h"
       
    30 
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CActivePalettePluginBase;
       
    34 class CActivePalette2Model;
       
    35 class CGulIcon;
       
    36 class CFbsBitmap;
       
    37 
       
    38 // CONSTANTS
       
    39 /// The print plugin UID
       
    40 const TInt KPrintPluginUid = 0x200009E2;
       
    41 /// The print plugin DLL filename
       
    42 _LIT(KPrintPluginDLLName,"PrintActivePalette.dll");
       
    43 
       
    44 /// The print intent plugin UID
       
    45 const TInt KPrintIntentPluginUid = 0x200009CE;
       
    46 /// The print intent plugin DLL filename
       
    47 _LIT(KPrintIntentPluginDLLName,"PrintIntentActivePalette.dll");
       
    48 
       
    49 /// The online sharing  plugin UID
       
    50 const TInt KOnlineSharingPluginUid = 0x20007189;
       
    51 /// The print intent plugin DLL filename
       
    52 _LIT(KOnlineSharingPluginDLLName,"OnlineSharingActivePalette.dll");
       
    53 
       
    54 
       
    55 #ifdef ACTIVEPALETTE_SUPPORT_PLUGIN_CAM
       
    56 /// The cam plugin UID
       
    57 const TInt KCamAPPluginUid = static_cast<TInt>(0x8000FFFF);
       
    58 /// The cam plugin DLL filename
       
    59 _LIT(KCamAPluginDLLName,"CamAPPlugin.dll");
       
    60 #endif // ACTIVEPALETTE_SUPPORT_PLUGIN_CAM
       
    61 
       
    62 
       
    63 // CLASS DECLARATIONS
       
    64 
       
    65 /**
       
    66  * Stores the Item ID
       
    67  */
       
    68 class CActivePalette2IDHolder : public CBase
       
    69     {
       
    70 public:
       
    71 
       
    72 	/**
       
    73     * Constructor
       
    74     * @param aItemId item ID
       
    75     */
       
    76 	CActivePalette2IDHolder(TInt aItemId);
       
    77 
       
    78 	/**
       
    79     * Constructor
       
    80     */
       
    81 	CActivePalette2IDHolder();
       
    82 
       
    83 	/**
       
    84     * Returns the item ID
       
    85     * @return The item ID
       
    86     */
       
    87 	inline TInt ItemId(void) const;
       
    88 	
       
    89     /** 
       
    90     * Sets the item ID
       
    91     * @param aItemId The item ID
       
    92     */
       
    93 	void SetItemId(TInt aItemId);
       
    94 
       
    95 private: // Data
       
    96     /// The item ID
       
    97 	TInt	iItemId;
       
    98     };
       
    99 
       
   100 /**
       
   101  * Item for use in the AP
       
   102  */
       
   103 class CActivePalette2Item : public CActivePalette2IDHolder, 
       
   104                             private MActivePalettePluginObserver
       
   105     {
       
   106 public:
       
   107 
       
   108     /** 
       
   109     * Public constructor
       
   110     * @param aItemId The item ID
       
   111     * @param aPluginUid The plugin UID
       
   112     * @param aModel The model being used
       
   113     * @return Newly constructed object
       
   114     */
       
   115 	static CActivePalette2Item * NewLC(TInt aItemId, 
       
   116 									  const TUid& aPluginUid,
       
   117 									  CActivePalette2Model& aModel);
       
   118 
       
   119     /** 
       
   120     * Destructor
       
   121     */
       
   122 	virtual ~CActivePalette2Item();
       
   123 	
       
   124     /** 
       
   125     * Returns the UID of the plugin handling this item
       
   126     * @return The UID of the plugin handling this item
       
   127     */
       
   128 	TUid PluginUid(void) const;
       
   129 	
       
   130     /** 
       
   131     * Returns a reference to the plugin handling this item
       
   132     * @return A reference to the plugin handling this item
       
   133     */
       
   134 	CActivePalettePluginBase& Plugin(void) const;
       
   135 	
       
   136     /** 
       
   137     * Returns a reference to the item's icon as a bitmap
       
   138     * @return A reference to the item's icon as a bitmap
       
   139     */
       
   140 	CFbsBitmap& Icon(void) const;
       
   141 
       
   142     /** 
       
   143     * Returns a pointer to the item's mask as a bitmap
       
   144     * @return A pointer to the item's mask as a bitmap
       
   145     */
       
   146 	CFbsBitmap* Mask(void) const;
       
   147 
       
   148     /** 
       
   149     * Returns a pointer to the item's tooltip text
       
   150     * @return A pointer to the item's tooltip text
       
   151     */
       
   152 	HBufC*	Tooltip(void) const;
       
   153 	
       
   154     /** 
       
   155     * Sets the item position
       
   156     * @param aItemPosition The new position
       
   157     */
       
   158 	void SetItemPosition(TInt aItemPosition);
       
   159 
       
   160     /** 
       
   161     * Sets the visibility of the item
       
   162     * @param aIsVisible The new visibility
       
   163     */
       
   164 	void SetItemVisible(TBool aIsVisible);
       
   165 
       
   166     /** 
       
   167     * Initialise the plugin handling this item
       
   168     * @param aCustomDataDes Custom data descriptor
       
   169     * @param aCustomDataInt Custom data integer
       
   170     */
       
   171 	void InitPluginL(const TDesC8& aCustomDataDes, TInt aCustomDataInt);
       
   172 
       
   173 private:
       
   174 
       
   175     /** 
       
   176     * Constructor
       
   177     * @param aItemId The item's ID
       
   178     * @param aPluginUid The UID of the plugin to handle this item
       
   179     * @param aModel A reference to the active palette model
       
   180     */
       
   181 	CActivePalette2Item(TInt aItemId,
       
   182 	                   const TUid& aPluginUid,
       
   183 	                   CActivePalette2Model& aModel);
       
   184 	
       
   185     /** 
       
   186     * 2 phase construction
       
   187     */
       
   188 	void ConstructL(void);
       
   189 	
       
   190     /** 
       
   191     * Returns a plugin factory from a given UID
       
   192     * @param aUid The UID of the plugin
       
   193     * @return A pointer to the plugin instantiation method
       
   194     */
       
   195 	NActivePalettePluginFactory::TInstantiatePluginLFunc FindPluginFactoryL(const TUid aUid);
       
   196 
       
   197     /** 
       
   198     * Returns the plugin creation parameters
       
   199     * @return The plugin creation parameters
       
   200     */
       
   201 	NActivePalettePluginFactory::TPluginCreationParams GetPluginCreationParams(void);
       
   202 
       
   203     /** 
       
   204     * Performs the setting of an icon to this item
       
   205     * @param aIcon A pointer to the icon
       
   206     * @param aOnwershipTransfer Whether to transfer ownership of the icon
       
   207     */
       
   208 	void DoSetItemIcon(CGulIcon* aIcon, TBool aOnwershipTransfer);
       
   209 	
       
   210 private:
       
   211 /// @name From MActivePalettePluginObserver
       
   212 //@{
       
   213 	void SetItemIconAndTooltipL(CGulIcon* aIcon, 
       
   214 								TBool aOnwershipTransfer,
       
   215 								const TDesC& aTooltipText);
       
   216 	void SetItemIcon(CGulIcon* aIcon, TBool aOnwershipTransfer);
       
   217 	void SetItemTooltipL(const TDesC& aTooltipText);
       
   218 	void NotifyItemComplete(const TDesC8& aDataDes);
       
   219 	void NotifyItemComplete(TInt aDataInt);
       
   220 	void NotifyPluginDestroyed(CActivePalettePluginBase* aPlugin);
       
   221 	void NotifyPluginCreated(CActivePalettePluginBase* aPlugin);
       
   222 	void SendMessage(TInt aMessageID, const TDesC8& aDataDes);
       
   223 	void SendMessage(TInt aMessageID, TInt aDataInt);
       
   224 //@}
       
   225 
       
   226 private:
       
   227 	/// The plugin UID used for the item
       
   228 	TUid		    iPluginUid;
       
   229     /// The model
       
   230 	CActivePalette2Model& iModel;
       
   231 
       
   232     /// Plug-in instance. Owned.
       
   233 	CActivePalettePluginBase*	iPlugin;
       
   234 	/// The plugin library
       
   235 	RLibrary		iDLL;
       
   236 
       
   237     /// Current icon information. @see iOwnsIcon
       
   238 	CGulIcon* 		iIcon;
       
   239 	/// Whether this instance owns the icon data
       
   240 	TBool			iOwnsIcon;
       
   241 
       
   242     /// The current tooltip. Owned.
       
   243 	HBufC* 			iTooltip;				// owned
       
   244     };
       
   245 
       
   246 #include "ActivePalette2Item.inl"
       
   247 
       
   248 #endif // _ACTIVE_PALETTE_2_ITEM_H
       
   249 
       
   250 // End of File