00001 /* 00002 * ============================================================================ 00003 * Name : AknNoteControl.h 00004 * Part of : Avkon 00005 * 00006 * Description: 00007 * 00008 * Version: 00009 * 00010 * Copyright © 2002 Nokia Corporation. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia Corporation. All rights are reserved. Copying, 00014 * including reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia Corporation. This material also contains confidential 00017 * information which may not be disclosed to others without the 00018 * prior written consent of Nokia Corporation. 00019 * ============================================================================ 00020 */ 00021 00022 00023 #ifndef AKNNOTECONTROL_H 00024 #define AKNNOTECONTROL_H 00025 00026 // INCLUDES 00027 #include <AknControl.h> 00028 #include <aknutils.h> 00029 00030 #include <aknprogresstimer.h> 00031 #include <aknbitmapanimation.h> 00032 00033 // FORWARD DECLARATIONS 00034 class CEikImage; 00035 class CEikLabel; 00036 class CEikProgressInfo; 00037 class CAknNoteAttributes; 00038 class CAknTextControl; 00039 class TAknWindowLineLayout; 00040 00041 // CLASS DECLARATION 00042 00052 class CAknNoteControl : public CAknControl 00053 { 00054 friend class CAknNoteAttributes; 00055 00056 public: 00057 00061 IMPORT_C CAknNoteControl(); 00062 00066 IMPORT_C virtual ~CAknNoteControl(); 00067 00073 void ConstructFromResourceL(TResourceReader& aRes); 00074 00075 public: 00076 00087 IMPORT_C void SetImageL(CEikImage* aImage); 00088 00098 IMPORT_C void SetAnimationL(TInt aResource); 00099 00109 IMPORT_C void SetIconL(CEikImage* aIcon); 00110 00118 IMPORT_C void SetFinalProgressValue(TInt aValue); 00119 00128 IMPORT_C TInt IncrementBarsAndDraw(TInt aIncrement); 00129 00135 IMPORT_C void CreateProgressBarL(); 00136 00144 IMPORT_C CEikProgressInfo* GetProgressInfo(); 00145 00151 IMPORT_C void StartAnimationL(); 00152 00162 IMPORT_C TInt CancelAnimation(); 00163 00172 IMPORT_C void ResetText(); 00173 00181 IMPORT_C void SetTextL(const TDesC& aText); 00182 00201 IMPORT_C void SetTextL(const TDesC& aText,TInt aLineNum); 00202 00216 IMPORT_C void SetTextNumberL(const TInt aNumber); 00217 00233 IMPORT_C void SetTextPluralityL(const TBool aIsPlural); 00234 00240 IMPORT_C TInt NumberOfLines() const; 00241 00242 public: 00243 00259 IMPORT_C void Layout(); 00260 00267 void WindowLayout( TAknWindowLineLayout& aLayout ) const; 00268 00277 IMPORT_C TInt NoteHeight() const; 00278 00288 IMPORT_C TInt NoteWidth() const; 00289 00290 public: //Interface to CAknNoteDialog 00291 00296 TSize MinimumSize(); 00297 00302 CAknNoteAttributes* Attributes() const; 00303 00309 void Reset(); 00310 00311 public: 00312 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00313 00314 public: 00324 class TIndex 00325 { 00326 public: 00327 00335 TIndex(TInt aNumberOfLines, 00336 TBool aHasNti = EFalse, 00337 TSize aImageSize = TSize(0,0)); 00338 00339 public: 00340 00345 TInt Lines() const; 00346 00347 public: 00348 00358 TInt WNPWindowTextsLine1(TInt aLineNum) const; 00359 00369 TInt NWIPWindowTextsLine1L(TInt aLineNum) const; 00370 00385 TInt NWIPWindowTextsLine1R(TInt aLineNum) const; 00386 00396 TInt NWIPWindowTextsLine1B(TInt aLineNum) const; 00397 00415 TInt NWIPWindowTextsLine1W(TInt aLineNum) const; 00416 00423 TInt PopupNoteWindow() const; 00424 00433 TInt PopupNoteWaitWindow() const; 00434 00435 private: 00436 void SelfTest() const; 00437 TInt ImageWidthIndex() const; 00438 TInt ImageHeightIndex() const; 00439 TInt HasNtiIndex() const; 00440 00441 private: 00442 TInt iNumberOfLines; 00443 TBool iHasNti; 00444 TSize iImageSize; 00445 }; 00446 00447 private: 00448 //COECONTROL METHODS 00449 void Draw(const TRect& aRect) const; 00450 void SizeChanged(); 00451 void DoLayout(); 00452 TInt CountComponentControls() const; 00453 CCoeControl* ComponentControl(TInt anIndex) const; 00454 private: 00458 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00459 private: 00460 //LAYOUT METHODS 00461 TInt NumberTypeIndicationIndex() const; 00462 TInt ImageWidthIndex() const; 00463 00464 TInt AnimationIndex(); 00465 void AnimationNoteLayout(); 00466 00467 //Layout for general notes 00468 void GeneralNoteLayout(); 00469 void GeneralNoteLabelLayout(); 00470 void GeneralNoteIconLayout(); 00471 00472 //Layout for progress and wait notes 00473 void ProgressNoteLayout(); 00474 void ProgressNoteLabelLayout(); 00475 void ProgressNoteProgressBarLayout(); 00476 void ProgressNoteIconLayout(); 00477 void ProgressNoteNumberTypeIndicationLayout(); 00478 00479 //Layout for image notes 00480 void ImageNoteLayout(); 00481 void ImageNoteLabelLayout(); 00482 void ImageNoteImageLayout(); 00483 void ImageNoteShadowLayout(); 00484 void ImageNoteNumberTypeIndicationLayout(); 00485 00486 TAknWindowLineLayout GetImageLayout(const TSize& aSize); 00487 TAknWindowLineLayout GetImageShadowLayout(const TSize& aSize); 00488 00489 TRect LayoutRect() const; 00490 void SetLineWidthsL(); 00491 00492 void CreateDefaultImageL(); 00493 void ReduceImageIfNeeded(); 00494 00495 void ParseTextL(); 00496 00497 private: 00498 CAknTextControl* TextControl() const; 00499 00500 CEikImage* Image() const; 00501 CEikImage* Icon() const; 00502 00503 CEikProgressInfo* ProgressBar() const; 00504 00505 CAknProgressTimer* Timer() const; 00506 CAknBitmapAnimation* Animation() const; 00507 00508 TBitFlags& Flags() const; 00509 00510 private: 00511 TInt iNoteLayout; 00512 TAknLayoutRect iShadowRect; 00513 TBool iImageHasShadow; 00514 00515 CAknNoteAttributes* iAttributes; 00516 CArrayFixFlat<TInt>* iLineWidths; 00517 00518 public: 00519 00525 IMPORT_C void SetDynamicTextL(const TDesC& aText); 00526 00530 IMPORT_C void UpdateAndFormatLabelsL(const TDesC& aLabels); 00531 00535 IMPORT_C void UpdateLabelsL(const TDesC& aLabel1, 00536 const TDesC& aLabel2=KNullDesC, 00537 const TDesC& aLabel3=KNullDesC); 00541 IMPORT_C void UpdateLabels(const TDesC& aLabel1, 00542 const TDesC& aLabel2=KNullDesC, 00543 const TDesC& aLabel3=KNullDesC); 00544 00550 IMPORT_C void SetLabelReserveLengthL(TInt aLength1=0, 00551 TInt aLength2=0, 00552 TInt aLength3=0); 00553 00554 protected: // from MObjectProvider 00555 00567 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId); 00568 00569 public: // new methods 00570 00579 IMPORT_C void SetBgRect(const TRect& aRect, 00580 const TPoint& aPos, 00581 TBool aOwnerNotDialog = EFalse); 00582 }; 00583 00584 // AKNNOTECONTROL_H 00585 #endif