72 #endif |
69 #endif |
73 if ( iAutoRefreshTimer && iAutoRefreshTimer->IsActive() ) |
70 if ( iAutoRefreshTimer && iAutoRefreshTimer->IsActive() ) |
74 { |
71 { |
75 iAutoRefreshTimer->Cancel(); |
72 iAutoRefreshTimer->Cancel(); |
76 } |
73 } |
77 delete iAutoRefreshTimer; |
74 delete iAutoRefreshTimer; |
|
75 iPopRegion.Close(); |
|
76 iBubblesArea.Close(); |
|
77 iBubblesMaskArea.Close(); |
|
78 iBubblesPos.Close(); |
|
79 |
|
80 delete iCursorWnd; |
78 } |
81 } |
79 |
82 |
80 void CPenUiWndCtrl::ConstructL() |
83 void CPenUiWndCtrl::ConstructL() |
81 { |
84 { |
82 CreateWindowL(iWndGroup); |
85 CreateWindowL(iWndGroup); |
83 SetComponentsToInheritVisibility(); |
86 SetComponentsToInheritVisibility(); |
84 |
87 |
85 Window().SetRequiredDisplayMode( EColor16MA ); |
88 Window().SetRequiredDisplayMode( EColor16MA ); |
86 iIncallBubble = CAknIncallBubble::NewL(); |
89 iIncallBubble = CAknIncallBubble::NewL(); |
87 MakeVisible( EFalse ); |
90 |
88 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
91 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
89 // only change registration, if not registered, don't register |
92 // only change registration, if not registered, don't register |
90 if (!GfxTransEffect::IsRegistered( this ) ) |
93 if (!GfxTransEffect::IsRegistered( this ) ) |
91 { |
94 { |
92 GfxTransEffect::Register( this, TUid::Uid( 0x2000B477 )); |
95 GfxTransEffect::Register( this, TUid::Uid( 0x2000B477 )); |
94 #endif |
97 #endif |
95 // ActivateL(); |
98 // ActivateL(); |
96 iPopupWnd = CPenUiPopWnd::NewL(iWndGroup,iBitmap,this); |
99 iPopupWnd = CPenUiPopWnd::NewL(iWndGroup,iBitmap,this); |
97 |
100 |
98 iAutoRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
101 iAutoRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
102 |
|
103 iCursorWnd = new (ELeave) CCursorWindow(this); |
|
104 //iCursorWnd->ConstructL(this); |
|
105 iCursorWnd->SetContainerWindowL(*this); |
|
106 |
|
107 MakeVisible( EFalse ); |
99 } |
108 } |
100 |
109 |
101 |
110 |
102 void CPenUiWndCtrl::Draw(const TRect& aRect) const |
111 void CPenUiWndCtrl::Draw(const TRect& aRect) const |
103 { |
112 { |
|
113 if(iNotUpdating) |
|
114 return; |
|
115 |
104 CWindowGc& gc = SystemGc(); |
116 CWindowGc& gc = SystemGc(); |
105 |
117 |
106 if ( iShowPopup ) |
118 if ( iShowPopup ) |
107 { |
119 { |
108 //layout is extended by popup |
120 //layout is extended by popup |
109 TRect rect = aRect; |
121 gc.SetClippingRect( iLayoutClipRect ); |
110 rect.Intersection( iLayoutClipRect ); |
122 } |
111 TPoint pos = rect.iTl - iLayoutClipRect.iTl; |
123 |
112 gc.BitBlt( pos, iBitmap, rect ); |
124 #ifdef FIX_FOR_NGA |
113 return; |
125 gc.BitBlt(TPoint(0,0),iBitmap,Rect()); |
114 } |
126 |
115 |
127 //draw bubble |
116 gc.BitBlt(aRect.iTl,iBitmap,aRect); |
128 for(TInt i = 0 ; i < iBubblesArea.Count(); ++i) |
|
129 { |
|
130 gc.BitBlt(iBubblesPos[i].iTl,iBubblesArea[i]); |
|
131 } |
|
132 #else |
|
133 gc.BitBlt(aRect.iTl,iBitmap,aRect); |
|
134 #endif |
117 } |
135 } |
118 |
136 |
119 void CPenUiWndCtrl::RefreshUI() |
137 void CPenUiWndCtrl::RefreshUI() |
120 { |
138 { |
121 StopRefreshTimer(); |
139 StopRefreshTimer(); |
129 DrawNow(); |
147 DrawNow(); |
130 } |
148 } |
131 CCoeEnv::Static()->WsSession().Flush(); |
149 CCoeEnv::Static()->WsSession().Flush(); |
132 CCoeEnv::Static()->WsSession().Finish(); |
150 CCoeEnv::Static()->WsSession().Finish(); |
133 |
151 |
|
152 } |
|
153 |
|
154 void CPenUiWndCtrl::Clean() |
|
155 { |
|
156 iCursorBmp = NULL; |
|
157 iBubblesArea.Reset(); |
|
158 iBubblesPos.Reset(); |
|
159 iBubblesMaskArea.Close(); |
|
160 iPopRegion.Close(); |
|
161 iChangedBmp= NULL; |
|
162 iBackground = EFalse; |
|
163 iNotUpdating = EFalse; |
|
164 } |
|
165 |
|
166 CCursorWindow::CCursorWindow(CPenUiWndCtrl* aParent) |
|
167 :iParent(aParent) |
|
168 { |
|
169 } |
|
170 |
|
171 void CCursorWindow::SetCursorVisible(TBool aFlag) |
|
172 { |
|
173 iCursorVisible = aFlag; |
|
174 DrawNow(); |
|
175 } |
|
176 void CCursorWindow::Draw(const TRect &aRect ) const |
|
177 { |
|
178 if(!iCursorVisible) |
|
179 return; |
|
180 |
|
181 CWindowGc& gc = SystemGc(); |
|
182 iParent->DrawCursor(gc); |
|
183 } |
|
184 |
|
185 void CPenUiWndCtrl::DrawCursor(CWindowGc& aGc) const |
|
186 { |
|
187 aGc.SetPenColor(KRgbBlack); |
|
188 aGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
189 aGc.SetBrushColor(KRgbBlack); |
|
190 aGc.SetDrawMode(CGraphicsContext::EDrawModeNOTSCREEN); |
|
191 aGc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
192 aGc.SetPenSize( TSize(1,1)); |
|
193 |
|
194 TRect drawRect = iCursorRect; |
|
195 if(!iPopRegion.IsEmpty() && iPopRegion.Intersects(iCursorRect)) |
|
196 { |
|
197 RRegion r; |
|
198 r.AddRect(iCursorRect); |
|
199 const TRect* rl = iPopRegion.RectangleList(); |
|
200 |
|
201 for(TInt i = 0 ; i < iPopRegion.Count(); ++i) |
|
202 { |
|
203 drawRect = iCursorRect; |
|
204 drawRect.Intersection(rl[i]); |
|
205 if(!drawRect.IsEmpty()) |
|
206 r.SubRect(drawRect); |
|
207 } |
|
208 |
|
209 for(TInt ii = 0; ii < r.Count(); ++ii) |
|
210 { |
|
211 aGc.DrawRect(r.RectangleList()[ii]); |
|
212 } |
|
213 r.Close(); |
|
214 } |
|
215 else |
|
216 aGc.DrawRect(iCursorRect); |
|
217 |
|
218 // restore normal draw mode |
|
219 aGc.SetDrawMode(CGraphicsContext::EDrawModePEN); |
|
220 aGc.SetBrushStyle(CGraphicsContext::ENullBrush); |
|
221 |
|
222 } |
|
223 void CPenUiWndCtrl::UpdateCursor(TBool aOnFlag,const CFbsBitmap* aCursorBmp,const TRect& aRect) |
|
224 { |
|
225 if(iNotUpdating || !IsReadyToDraw()) |
|
226 { |
|
227 //some times when layout is diabled, the cursor is still change its pos, and draw to the last place |
|
228 //when layout enabled. So we set the cursor invisible, and wait for next cursor updating event. |
|
229 iCursorWnd->SetCursorVisible(EFalse); |
|
230 return; |
|
231 } |
|
232 |
|
233 iCursorBmp = const_cast<CFbsBitmap*>(aCursorBmp); |
|
234 iCursorPos = aRect.iTl; |
|
235 |
|
236 if(iCursorRect != aRect) |
|
237 { |
|
238 iCursorRect = aRect; |
|
239 iCursorWnd->SetRect(iCursorRect); |
|
240 } |
|
241 iCursorWnd->SetCursorVisible(aOnFlag); |
|
242 } |
|
243 |
|
244 void CPenUiWndCtrl::UpdateBubble(const CFbsBitmap* aBmp,const CFbsBitmap* aMask, |
|
245 const TRect& aPos,TBool aFlag) |
|
246 { |
|
247 TInt idx = iBubblesArea.Find(aBmp); |
|
248 |
|
249 if(aFlag) |
|
250 { |
|
251 if(KErrNotFound == idx) |
|
252 { |
|
253 iBubblesArea.Append(aBmp); |
|
254 iBubblesMaskArea.Append(aMask); |
|
255 iBubblesPos.Append(aPos); |
|
256 } |
|
257 else |
|
258 { |
|
259 iBubblesPos[idx] = aPos; |
|
260 } |
|
261 |
|
262 } |
|
263 else |
|
264 { |
|
265 //remove |
|
266 if(idx != KErrNotFound) |
|
267 { |
|
268 iBubblesArea.Remove(idx); |
|
269 iBubblesMaskArea.Remove(idx); |
|
270 iBubblesPos.Remove(idx); |
|
271 } |
|
272 } |
|
273 Invalidate(Rect(), ETrue); |
|
274 } |
|
275 void CPenUiWndCtrl::UpdateICFArea(const CFbsBitmap* aBmp,const TPoint& aPos) |
|
276 { |
|
277 iICFBmp = const_cast<CFbsBitmap*>(aBmp); |
|
278 iIcfPos = aPos; |
|
279 Invalidate(Rect(), ETrue); |
|
280 } |
|
281 void CPenUiWndCtrl::UpdateChangedArea(const CFbsBitmap* aBmp,const TRect& aPos,TBool aFlag) |
|
282 { |
|
283 UpdateBubble(aBmp,0,aPos,aFlag); |
|
284 return; |
|
285 |
|
286 |
|
287 } |
|
288 void CPenUiWndCtrl::SetPopupArea(const TRect& aRect, TBool aFlag) |
|
289 { |
|
290 if(aFlag) //add pop area |
|
291 { |
|
292 iPopRegion.AddRect(aRect); |
|
293 } |
|
294 else |
|
295 { |
|
296 iPopRegion.SubRect(aRect); |
|
297 } |
134 } |
298 } |
135 |
299 |
136 TInt CPenUiWndCtrl::WndPriority() |
300 TInt CPenUiWndCtrl::WndPriority() |
137 { |
301 { |
138 return iPriority; |
302 return iPriority; |
269 MakeVisible( EFalse ); |
434 MakeVisible( EFalse ); |
270 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
435 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
271 } |
436 } |
272 #endif // RD_UI_TRANSITION_EFFECTS_POPUPS |
437 #endif // RD_UI_TRANSITION_EFFECTS_POPUPS |
273 |
438 |
274 //iResourceChange = EFalse; |
|
275 iShowPopup = EFalse; |
439 iShowPopup = EFalse; |
276 iWndGroup.SetOrdinalPosition( -1, ECoeWinPriorityNormal-1 ); |
440 iWndGroup.SetOrdinalPosition( -1, ECoeWinPriorityNormal-1 ); |
277 DrawableWindow()->SetOrdinalPosition(-1, ECoeWinPriorityNormal-1 ); |
441 DrawableWindow()->SetOrdinalPosition(-1, ECoeWinPriorityNormal-1 ); |
278 TRAP_IGNORE(iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputHide )); |
442 TRAP_IGNORE(iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputHide )); |
279 //MakeVisible( EFalse ); |
|
280 |
|
281 } |
443 } |
282 |
444 |
283 |
445 |
284 void CPenUiWndCtrl::ShowPopup( const TRect& aRectInScreen, const TRect& aRectInLayout, const TRect& aLayoutTrimRect ) |
446 void CPenUiWndCtrl::ShowPopup( const TRect& aRectInScreen, const TRect& aRectInLayout, const TRect& aLayoutTrimRect ) |
285 { |
447 { |
463 void CPenUiWndCtrl::SetResourceChange(TBool aResourceChange) |
625 void CPenUiWndCtrl::SetResourceChange(TBool aResourceChange) |
464 { |
626 { |
465 iResourceChange = aResourceChange; |
627 iResourceChange = aResourceChange; |
466 } |
628 } |
467 |
629 |
|
630 void CPenUiWndCtrl::HandleNGASpecificSignal(TInt aEventType, const TDesC& aEventData) |
|
631 { |
|
632 switch(aEventType) |
|
633 { |
|
634 case ESignalPopupWndClosed: |
|
635 { |
|
636 ClosePopup(); |
|
637 } |
|
638 break; |
|
639 case ESignalUpdateCursor : |
|
640 { |
|
641 struct SData |
|
642 { |
|
643 TBool onOff; |
|
644 CFbsBitmap* bmp; |
|
645 TRect rect; |
|
646 } data; |
|
647 |
|
648 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
649 UpdateCursor(data.onOff,data.bmp,data.rect); |
|
650 |
|
651 } |
|
652 break; |
|
653 case ESignalPopupArea: |
|
654 { |
|
655 struct SData |
|
656 { |
|
657 TRect rr; |
|
658 TBool flag; |
|
659 } data; |
|
660 |
|
661 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
662 SetPopupArea(data.rr,data.flag); |
|
663 } |
|
664 break; |
|
665 case ESignalUpdateICFArea: |
|
666 { |
|
667 struct SData |
|
668 { |
|
669 CFbsBitmap* bmp; |
|
670 TPoint pos; |
|
671 } data; |
|
672 |
|
673 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
674 UpdateICFArea(data.bmp,data.pos); |
|
675 } |
|
676 break; |
|
677 case ESignalUpdateBubble: |
|
678 { |
|
679 struct SData |
|
680 { |
|
681 TBool flag; |
|
682 TRect pos; |
|
683 CFbsBitmap* bmp; |
|
684 CFbsBitmap* mask; |
|
685 } data; |
|
686 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
687 UpdateBubble(data.bmp,data.mask,data.pos,data.flag); |
|
688 } |
|
689 break; |
|
690 case ESignalUpdateChangedArea: |
|
691 { |
|
692 struct SData |
|
693 { |
|
694 TBool flag; |
|
695 CFbsBitmap* bmp; |
|
696 TRect pos; |
|
697 } data; |
|
698 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
699 UpdateChangedArea(data.bmp,data.pos,data.flag); |
|
700 } |
|
701 break; |
|
702 case ESignalRegisterBkControl: |
|
703 { |
|
704 |
|
705 struct SData |
|
706 { |
|
707 //TBool bChangeFrameId; |
|
708 |
|
709 TAknsItemID frameID; |
|
710 TAknsItemID centerID; |
|
711 RArray<TCommonBgCtrlSubItem> *subItems; |
|
712 } data; |
|
713 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
714 iSubItems = data.subItems; |
|
715 iFrameID = data.frameID; |
|
716 iCenterID = data.centerID; |
|
717 iBackground = ETrue; |
|
718 } |
|
719 break; |
|
720 case ESignalDisableUpdating: |
|
721 { |
|
722 iNotUpdating = * (reinterpret_cast<TBool*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
723 } |
|
724 break; |
|
725 case ESignalDrawBackground: |
|
726 { |
|
727 struct SData |
|
728 { |
|
729 CFbsBitGc* gc; |
|
730 CFbsBitmap* bmp; |
|
731 TRect rect; |
|
732 } data; |
|
733 data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() ))); |
|
734 DrawBubbleAsBackground(data.gc,data.bmp,data.rect); |
|
735 } |
|
736 break; |
|
737 default: |
|
738 break; |
|
739 } |
|
740 |
|
741 } |
|
742 |
|
743 void CPenUiWndCtrl::DrawBkground(CWindowGc& aGc,const TRect& aRect) const |
|
744 { |
|
745 |
|
746 DrawFrame(aGc,aRect, iFrameID, iCenterID); |
|
747 |
|
748 for( TInt i = 0; i < (*iSubItems).Count(); i++ ) |
|
749 { |
|
750 if( (*iSubItems)[i].iIsShow ) |
|
751 { |
|
752 DrawFrame(aGc, (*iSubItems)[i].iRect, |
|
753 (*iSubItems)[i].iFrameID, |
|
754 (*iSubItems)[i].iCenterID ); |
|
755 } |
|
756 } |
|
757 |
|
758 } |
|
759 |
|
760 void CPenUiWndCtrl::DrawBubbleAsBackground(CFbsBitGc* aGc, CFbsBitmap* aBmp, const TRect& aRect) |
|
761 { |
|
762 for(TInt i = 0 ; i < iBubblesArea.Count(); ++i) |
|
763 { |
|
764 if(iBubblesArea[i] != aBmp) //not draw same bitmap |
|
765 { |
|
766 //gc.BitBlt(iBubblesPos[i],iBubblesArea[i]); |
|
767 TRect r = aRect; |
|
768 TRect rect2 = iBubblesPos[i]; |
|
769 r.Intersection(rect2); |
|
770 if(!r.IsEmpty()) |
|
771 { |
|
772 TRect src = r; |
|
773 r.Move(TPoint(-aRect.iTl.iX,-aRect.iTl.iY)); |
|
774 src.Move(TPoint(-rect2.iTl.iX,-rect2.iTl.iY)); |
|
775 aGc->BitBlt(r.iTl, iBubblesArea[i], src); |
|
776 } |
|
777 } |
|
778 } |
|
779 |
|
780 } |
|
781 |
|
782 |
|
783 CCoeControl* CPenUiWndCtrl::ComponentControl(TInt) const |
|
784 { |
|
785 return iCursorWnd; |
|
786 } |
|
787 TInt CPenUiWndCtrl::CountComponentControls() const |
|
788 { |
|
789 return 1; |
|
790 } |
|
791 |
|
792 |
|
793 void CPenUiWndCtrl::DrawFrame(CWindowGc& aGc, const TRect& aRect,TAknsItemID aFrameID, |
|
794 TAknsItemID aCenterID ) const |
|
795 { |
|
796 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
797 TRect innerRect = aRect; |
|
798 innerRect.Shrink( 4, 4 ); |
|
799 |
|
800 AknsDrawUtils::DrawFrame( |
|
801 skin, aGc, |
|
802 aRect, innerRect, |
|
803 aFrameID, aCenterID); |
|
804 } |
468 |
805 |
469 void CPenUiWndCtrl::RestartRefreshTimer() |
806 void CPenUiWndCtrl::RestartRefreshTimer() |
470 { |
807 { |
471 StopRefreshTimer(); |
808 StopRefreshTimer(); |
472 |
809 |