Advertisement
Guest User

Untitled

a guest
Aug 26th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.93 KB | None | 0 0
  1. /*
  2. * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This software, including documentation is protected by copyright controlled
  5. * by Nokia Corporation. Copying, including reproducing, storing, adapting or
  6. * translating, any or all of this material can only be done in accordance
  7. * with the Nokia Symbian License version 1.0 (or any subsequent update) or
  8. * any other license terms expressly agreed between you and Nokia.
  9. * This material contains Nokia's confidential information which
  10. * may not be disclosed to others without the prior written consent of Nokia.
  11. *
  12. * Initial Contributors:
  13. * Nokia Corporation - initial contribution.
  14. *
  15. * Contributors:
  16. *
  17. * Description: Discreet popup
  18. *
  19. */
  20.  
  21. #ifndef C_AKNDISCREETPOPUP_H
  22. #define C_AKNDISCREETPOPUP_H
  23.  
  24.  
  25. #include <coemain.h>
  26. #include <AknsConstants.h>
  27. #include <coecobs.h>
  28.  
  29. class CAknDiscreetPopupControl;
  30. class MEikCommandObserver;
  31. class CGulIcon;
  32. class CAknDiscreetPopupServerHandler;
  33.  
  34. /**
  35. * Discreet popup is used for notifying user of system generated or user
  36. * activated events without blocking the flow of usage.
  37. *
  38. * The popup duration can be
  39. * 1) Short (by default). It is used when the user can expect a note to appear,
  40. * like confirmations, and when the nature of the message is positive,
  41. * i.e. the attempted operation was successful. The duration is 1.5 seconds.
  42. * 2) Long (KAknDiscreetPopupDurationLong flag). It is used when the note may
  43. * appear spontaneously, i.e. without user action, or if the message content
  44. * is not what the user probably expected (e.g. an error).
  45. * The duration is 3.0 seconds.
  46. *
  47. * @lib avkon
  48. * @since S60 v5.2
  49. */
  50. NONSHARABLE_CLASS( CAknDiscreetPopup ) : public CCoeStatic,
  51. public MCoeControlObserver
  52. {
  53.  
  54. public:
  55.  
  56. /**
  57. * Destructor.
  58. */
  59. ~CAknDiscreetPopup();
  60.  
  61. /**
  62. * Displays a local discreet popup which is created according
  63. * to given parameters.Local discreet popup is an application-specific
  64. * discreet popup that is visible when the parent application is active
  65. * and visible.
  66. *
  67. * Title text is the only compulsory parameter.
  68. * Icon can be provided either
  69. * 1) By providing CGulIcon object with aIcon parameter or
  70. * 2) By providing icon skin id and bitmap file information.
  71. * If CGulIcon object is provided, skin and bitmap information is ignored.
  72. * Popup can inform its command observer that it has been tapped
  73. * through MEikCommandObserver interface.
  74. *
  75. * Possible discreet popup flags are:
  76. *
  77. * KAknDiscreetPopupDurationLong for long discreet popup duration.
  78. * Default duration is short.
  79. *
  80. * KAknDiscreetPopupConfirmationTone - popup plays the confirmation tone.
  81. * KAknDiscreetPopupWarningTone - popup plays the warning tone.
  82. * KAknDiscreetPopupErrorTone - popup plays the error tone.
  83. * By default no tone is played.
  84. *
  85. * @since S60 v5.2
  86. * @param aTitle First line of text.
  87. * @param aText Second line of text.
  88. * @param aIcon Icon.
  89. * @param aSkinId Icon skin item id.
  90. * @param aBitmapFile Icon bitmap file.
  91. * @param aBitmapId Icon bitmap id.
  92. * @param aMaskId Icon mask id.
  93. * @param aFlags Popup flags.
  94. * @param aCommand Popup command id.
  95. * @param aCommandObserver Popup command observer.
  96. * @return Unique id for popup.
  97. * @panic EAknPanicNotSupported The method is called from application
  98. * without existing CCoeEnv.
  99. */
  100. IMPORT_C static TInt ShowLocalPopupL(
  101. const TDesC& aTitle,
  102. const TDesC& aText = KNullDesC,
  103. CGulIcon* aIcon = NULL,
  104. const TAknsItemID& aSkinId = KAknsIIDNone,
  105. const TDesC& aBitmapFile = KNullDesC,
  106. const TInt aBitmapId = 0,
  107. const TInt aMaskId = 0,
  108. const TInt aFlags = 0,
  109. const TInt aCommand = 0,
  110. MEikCommandObserver* aCommandObserver = NULL );
  111.  
  112. /**
  113. * Displays a local discreet popup which is created according
  114. * to given resource id.Local discreet popup is an application-specific
  115. * discreet popup that is visible when the parent application is active
  116. * and visible.
  117. *
  118. * Popup can inform its command observer that it has been tapped
  119. * through MEikCommandObserver interface.
  120. *
  121. * @param aResourceId Discreet popup resource id.
  122. * @param aCommand Popup command id.
  123. * @param aCommandObserver Popup command observer.
  124. * @return Unique id for popup.
  125. * @panic EAknPanicNotSupported The method is called from application
  126. * without existing CCoeEnv.
  127. */
  128. IMPORT_C static TInt ShowLocalPopupL(
  129. const TInt aResourceId,
  130. const TInt aCommand = 0,
  131. MEikCommandObserver* aCommandObserver = NULL );
  132.  
  133. /**
  134. * Displays a global discreet popup which is created according
  135. * to given parameters. Global discreet notifications remains
  136. * visible when user navigates from application to another.
  137. *
  138. * Title text is the only compulsory parameter.
  139. *
  140. * Possible discreet popup flags are:
  141. *
  142. * KAknDiscreetPopupDurationLong for long discreet popup duration.
  143. * Default duration is short.
  144. *
  145. * KAknDiscreetPopupConfirmationTone - popup plays the confirmation tone.
  146. * KAknDiscreetPopupWarningTone - popup plays the warning tone.
  147. * KAknDiscreetPopupErrorTone - popup plays the error tone.
  148. * By default no tone is played.
  149. *
  150. * Note: If caller does not have an existing control environment (CCoeEnv),
  151. * CAknDiscreetPopup::InitL should be called to initialize discreet popup
  152. * before calling this method. In addition, CAknDiscreetPopup::Release
  153. * should be called when there is no need for discreet popup anymore.
  154. * Otherwise all allocated resources will not be freed.
  155. *
  156. * @since S60 v5.2
  157. * @param aTitle First line of text.
  158. * @param aText Second line of text.
  159. * @param aSkinId Icon skin item id.
  160. * @param aBitmapFile Icon bitmap file.
  161. * @param aBitmapId Icon bitmap id.
  162. * @param aMaskId Icon mask id.
  163. * @param aFlags Popup flags.
  164. * @param aCommand Popup command id.
  165. * @param aCommandObserver Popup command observer.
  166. * @param aAppUid Application uid to be launched.
  167. * @param aViewUid Application view uid to be activated.
  168. * @return Unique id for popup.
  169. */
  170. IMPORT_C static TInt ShowGlobalPopupL(
  171. const TDesC& aTitle,
  172. const TDesC& aText = KNullDesC,
  173. const TAknsItemID& aSkinId = KAknsIIDNone,
  174. const TDesC& aBitmapFile = KNullDesC,
  175. const TInt aBitmapId = 0,
  176. const TInt aMaskId = 0,
  177. const TInt aFlags = 0,
  178. const TInt aCommandId = 0,
  179. MEikCommandObserver* aCommandObserver = NULL,
  180. const TUid& aAppUid = TUid::Null(),
  181. const TUid& aViewUid = TUid::Null() );
  182.  
  183. /**
  184. * Displays a global discreet popup which is created according
  185. * to given resource id. Global discreet notifications remains
  186. * visible when user navigates from application to another.
  187. *
  188. * Note: If caller does not have an existing control environment (CCoeEnv),
  189. * CAknDiscreetPopup::InitL should be called to initialize discreet popup
  190. * before calling this method. In addition, CAknDiscreetPopup::Release
  191. * should be called when there is no need for discreet popup anymore.
  192. * Otherwise all allocated resources will not be freed.
  193. *
  194. * @since S60 v5.2
  195. * @param aResourceId Discreet popup resource id.
  196. * @param aResourceFile Discreet popup resource file path.
  197. * @param aCommand Popup command id.
  198. * @param aCommandObserver Popup command observer.
  199. * @param aAppUid Application uid to be launched.
  200. * @param aViewUid Application view uid to be activated.
  201. * @return Unique id for popup.
  202. */
  203. IMPORT_C static TInt ShowGlobalPopupL(
  204. const TInt aResourceId,
  205. const TDesC& aResourceFile,
  206. const TInt aCommandId = 0,
  207. MEikCommandObserver* aCommandObserver = NULL,
  208. const TUid& aAppUid = TUid::Null(),
  209. const TUid& aViewUid = TUid::Null() );
  210.  
  211. /**
  212. * Initializes discreet popup when discreet popup
  213. * is launched in application with no existing CCoeEnv.
  214. * Note: This method is intended only for usage of those applications
  215. * that do not have an existing control environment (CCoeEnv) and should
  216. * be called only once.
  217. *
  218. * @panic EAknPanicNotSupported
  219. * The method is called from application with existing CCoeEnv.
  220. */
  221. IMPORT_C static void InitL();
  222.  
  223. /**
  224. * Releases discreet popup resources when discreet popup
  225. * is launched in application with no existing CCoeEnv.
  226. * Note: This method is intended only for usage of those applications
  227. * that do not have an existing control environment (CCoeEnv) and should
  228. * be called only once when the application terminates.
  229. *
  230. * @panic EAknPanicNotSupported
  231. * The method is called from application with existing CCoeEnv.
  232. */
  233. IMPORT_C static void Release();
  234.  
  235. private:
  236.  
  237. /**
  238. * C++ constructor.
  239. */
  240. CAknDiscreetPopup();
  241.  
  242. /**
  243. * C++ constructor.
  244. */
  245. CAknDiscreetPopup( TBool aUseCoeEnv );
  246.  
  247. /**
  248. * Symbian second-phase constructor.
  249. */
  250. void ConstructL();
  251.  
  252. /**
  253. * Provides the discreet popup singleton.
  254. *
  255. * @return Discreet popup instance.
  256. */
  257. static CAknDiscreetPopup* InstanceL();
  258.  
  259. /**
  260. * Launches the local popup.
  261. *
  262. * @param aTitle First line of text.
  263. * @param aText Second line of text.
  264. * @param aIcon Icon.
  265. * @param aSkinId Icon skin item id.
  266. * @param aBitmapFile Icon bitmap file.
  267. * @param aBitmapId Icon bitmap id.
  268. * @param aMaskId Icon mask id.
  269. * @param aFlags Popup flags.
  270. * @param aCommand Popup command id.
  271. * @param aCommandObserver Popup command observer.
  272. * @return Unique id for popup.
  273. */
  274. TInt DoShowLocalL(
  275. const TDesC& aTitle,
  276. const TDesC& aText,
  277. CGulIcon* aIcon,
  278. const TAknsItemID& aSkinId,
  279. const TDesC& aBitmapFile,
  280. const TInt& aBitmapId,
  281. const TInt& aMaskId,
  282. const TInt& aFlags,
  283. const TInt& aCommand,
  284. MEikCommandObserver* aCommandObserver );
  285.  
  286. /**
  287. * Launches the local popup, if the queues are empty.
  288. * If not, the popup is added to a queue.
  289. *
  290. * @param aResourceId Discreet popup resource id.
  291. * @param aCommand Popup command id.
  292. * @param aCommandObserver Popup command observer.
  293. * @return Unique id for popup.
  294. */
  295. TInt DoShowLocalL(
  296. const TInt& aResourceId,
  297. const TDesC& aResourceFile,
  298. const TInt& aCommand,
  299. MEikCommandObserver* aCommandObserver );
  300.  
  301. /**
  302. * Launches the global popup.
  303. *
  304. * @param aTitle First line of text.
  305. * @param aText Second line of text.
  306. * @param aSkinId Icon skin item id.
  307. * @param aBitmapFile Icon bitmap file.
  308. * @param aBitmapId Icon bitmap id.
  309. * @param aMaskId Icon mask id.
  310. * @param aFlags Popup flags.
  311. * @param aCommand Popup command id.
  312. * @param aCommandObserver Popup command observer.
  313. * @param aAppUid Application uid to be launched.
  314. * @param aViewUid Application view uid to be activated.
  315. * @return Unique id for popup.
  316. */
  317.  
  318. TInt DoShowGlobalL(
  319. const TDesC& aTitle,
  320. const TDesC& aText,
  321. const TAknsItemID& aSkinId,
  322. const TDesC& aBitmapFile,
  323. const TInt& aBitmapId,
  324. const TInt& aMaskId,
  325. const TInt& aFlags,
  326. const TInt& aCommandId,
  327. MEikCommandObserver* aCommandObserver,
  328. const TUid& aAppUid,
  329. const TUid& aViewUid );
  330.  
  331. /**
  332. * Launches the global popup.
  333. *
  334. * @param aResourceId Discreet popup resource id.
  335. * @param aResourceFile Discreet popup resource file path.
  336. * @param aCommand Popup command id.
  337. * @param aCommandObserver Popup command observer.
  338. * @param aAppUid Application uid to be launched.
  339. * @param aViewUid Application view uid to be activated.
  340. * @return Unique id for popup.
  341. */
  342.  
  343. TInt DoShowGlobalL(
  344. const TInt& aResourceId,
  345. const TDesC& aResourceFile,
  346. const TInt& aCommandId,
  347. MEikCommandObserver* aCommandObserver,
  348. const TUid& aAppUid,
  349. const TUid& aViewUid );
  350.  
  351. /**
  352. * This method shows the created popup control.
  353. *
  354. * @param aControl Created popup control.
  355. */
  356. void ShowPopupL( CAknDiscreetPopupControl* aControl );
  357.  
  358. /**
  359. * This method deletes the popup and removes it from
  360. * CAknDiscreetPopup popup list.
  361. *
  362. * @param aControl Closed popup control.
  363. */
  364. void DeletePopup( CAknDiscreetPopupControl* aControl );
  365.  
  366. /**
  367. * Returns next available popup id.
  368. *
  369. * @return Next available popup id.
  370. */
  371. TInt NextPopupId();
  372.  
  373. /**
  374. * Checks if popup id is already in use among local popups.
  375. *
  376. * @return ETrue if popup id is already in use.
  377. */
  378. TBool PopupIdInUse( const TInt& aPopupId );
  379.  
  380. // from base class MCoeControlObserver
  381.  
  382. /**
  383. * Handles an event from an observed control.
  384. *
  385. * @param aControl The control that sent the event.
  386. * @param aEventType The event type.
  387. */
  388. void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
  389.  
  390. private: // data
  391.  
  392. /**
  393. * Local popup array.
  394. */
  395. RPointerArray<CAknDiscreetPopupControl> iLocalPopups;
  396.  
  397. /**
  398. * Ui server handler.
  399. * Own.
  400. */
  401. CAknDiscreetPopupServerHandler* iServerHandler;
  402.  
  403. /**
  404. * ETrue if CoeEnv exists.
  405. */
  406. TBool iUseCoeEnv;
  407. };
  408.  
  409.  
  410. #endif // C_AKNDISCREETPOPUP_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement