|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // RWsTextCursor and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __TCURSOR_H__ |
|
19 #define __TCURSOR_H__ |
|
20 |
|
21 #include "server.h" |
|
22 #include "cliwin.h" |
|
23 #include "sprite.h" |
|
24 |
|
25 class RWsTextCursor; |
|
26 class CEventQueue; |
|
27 |
|
28 class TCursorSprite |
|
29 { |
|
30 public: |
|
31 static void SetFocus(RWsTextCursor* aFocus,CWsClientWindow* aWin=NULL); |
|
32 static void Hide(); |
|
33 static void Reveal(); |
|
34 static void SetCurrentCursor(RWsTextCursor* aFocus, CWsClientWindow* aWin); |
|
35 static TBool IsStandardCursorActive(); |
|
36 private: |
|
37 static RWsTextCursor *iCurrentCursor; |
|
38 static TBool iHidden; |
|
39 }; |
|
40 |
|
41 class RWsTextCursor |
|
42 { |
|
43 public: |
|
44 friend class TCursorSprite; |
|
45 public: |
|
46 void ConstructL(CWsWindowGroup *aOwner); |
|
47 void Close(); |
|
48 void SetL(const TWsWinCmdSetTextCursor &aSet, TBool aClipped); |
|
49 void Cancel(); |
|
50 void WindowDisconnected(CWsWindow *aWin); |
|
51 void LostFocus(); |
|
52 void ReceivedFocus(); |
|
53 inline CWsWindow* Win() const; |
|
54 TRect RectRelativeToScreen() const; |
|
55 void Enable(); |
|
56 void Disable(); |
|
57 TBool IsStandardCursorActive(); |
|
58 TBool IsFlashing() const; |
|
59 void Draw(CFbsBitGc* aGc, const TRegion& aRegion); |
|
60 public: |
|
61 enum TInternalFlags |
|
62 { |
|
63 EHasFocus = 0x00000001, |
|
64 }; |
|
65 private: |
|
66 void Clear(); |
|
67 void doDraw(CFbsBitGc* aGc, const TRegion& aRegion); |
|
68 void ScheduleReDrawNow(); |
|
69 private: |
|
70 CWsWindowGroup *iGroupWin; |
|
71 CWsClientWindow *iWin; |
|
72 TUint iInternalFlags; |
|
73 TInt iType; |
|
74 TPoint iPos; |
|
75 TSize iSize; |
|
76 TUint iFlags; |
|
77 TRgb iColor; |
|
78 TRect iClipRect; |
|
79 RWsRegion iDrawRegion; |
|
80 CWsCustomTextCursor* iCustomTextCursor; |
|
81 }; |
|
82 |
|
83 class CWsPointerCursor : public CWsSpriteBase |
|
84 { |
|
85 public: |
|
86 CWsPointerCursor(CWsClient *aOwner); |
|
87 ~CWsPointerCursor(); |
|
88 void ConstructL(const TWsClCmdCreatePointerCursor &aParams); |
|
89 void CommandL(TInt aOpcode, const TAny *aCmdData); |
|
90 void CloseObject(); |
|
91 void Close(); |
|
92 void Open(); |
|
93 private: |
|
94 TInt iAccessCount; |
|
95 }; |
|
96 |
|
97 class CWsCustomTextCursor : public CWsSpriteBase |
|
98 { |
|
99 public: |
|
100 CWsCustomTextCursor(CWsClient* aOwner, RWsSession::TCustomTextCursorAlignment aAlignment); |
|
101 ~CWsCustomTextCursor(); |
|
102 void ConstructL(TInt aFlags); |
|
103 void CommandL(TInt aOpcode, const TAny* aCmdData); |
|
104 void CompleteL(CWsWindow* aWin, TBool aFlash, TBool aClipSprite, const TPoint& aClipOffset, const TSize& aClipSize); |
|
105 void SetPositionNoRedraw(const TPoint& aPos); |
|
106 inline RWsSession::TCustomTextCursorAlignment Alignment() const; |
|
107 inline void SetWindow(CWsClientWindow* aWin); |
|
108 private: |
|
109 RWsSession::TCustomTextCursorAlignment iAlignment; |
|
110 }; |
|
111 |
|
112 inline CWsWindow* RWsTextCursor::Win() const |
|
113 { |
|
114 return iWin; |
|
115 } |
|
116 |
|
117 inline RWsSession::TCustomTextCursorAlignment CWsCustomTextCursor::Alignment() const |
|
118 { |
|
119 return iAlignment; |
|
120 } |
|
121 |
|
122 inline void CWsCustomTextCursor::SetWindow(CWsClientWindow* aWin) |
|
123 { |
|
124 iWin=aWin; |
|
125 } |
|
126 |
|
127 #endif |