windowing/windowserver/nga/SERVER/tcursor.h
changeset 0 5d03bc08d59c
child 11 fed1595b188e
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     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 class CWsRenderStage;
       
    28 class MWsTextCursor;
       
    29 
       
    30 class TCursorSprite
       
    31 	{
       
    32 public:
       
    33 	static void SetFocus(RWsTextCursor* aFocus,CWsClientWindow* aWin=NULL);
       
    34 	static void Hide();
       
    35 	static void Reveal();
       
    36 	static void SetCurrentCursor(RWsTextCursor* aFocus, CWsClientWindow* aWin);
       
    37 	static TBool IsStandardCursorActive();
       
    38 private:
       
    39 	static RWsTextCursor *iCurrentCursor;
       
    40 	static TBool iHidden;
       
    41 	};
       
    42 
       
    43 class RWsTextCursor : public MWsWindowTreeNode, public MWsStandardTextCursor
       
    44 	{
       
    45 public:
       
    46 	friend class TCursorSprite;
       
    47 public:
       
    48 	void ConstructL(CWsWindowGroup *aOwner);
       
    49 	void Close();
       
    50 	void SetL(const TWsWinCmdSetTextCursor &aSet, TBool aClipped);
       
    51 	void Cancel();
       
    52 	void WindowDisconnected(CWsWindow *aWin);
       
    53 	void LostFocus();
       
    54 	void ReceivedFocus();
       
    55 	inline CWsWindow* Win() const;
       
    56 	TRect RectRelativeToScreen() const;
       
    57 	TRect RectRelativeToWindow() const;
       
    58 	void Enable();
       
    59 	void Disable();
       
    60 	TBool IsStandardCursorActive();
       
    61 	TBool IsFlashing() const;
       
    62 	void Draw(const TRegion& aRegion);
       
    63 	TFlashState CurrentCursorFlashState() const;
       
    64 	void CreateNode();
       
    65 	void ReleaseNode();
       
    66 	void SendState(MWsWindowTreeObserver& aWindowTreeObserver) const;
       
    67 public:
       
    68 	enum TInternalFlags
       
    69 		{
       
    70 		EHasFocus	= 0x00000001,
       
    71 		EActiveNode	= 0x00000002
       
    72 		};
       
    73 public: // from MWsWindowTreeNode
       
    74 	MWsWindowTreeNode::TType NodeType() const;
       
    75 	const MWsWindow* Window() const;
       
    76 	const MWsSprite* Sprite() const;
       
    77 	const MWsStandardTextCursor* StandardTextCursor() const;
       
    78 	const MWsWindowGroup* WindowGroup() const;
       
    79 	const MWsWindowTreeNode* ParentNode() const;
       
    80 public: // from MWsStandardTextCursor
       
    81 	TInt Type() const;
       
    82 	TRect Rect() const;
       
    83 	TRect ClipRect() const;
       
    84     TUint Flags() const;
       
    85 	TRgb Color() const;
       
    86 	TTimeIntervalMicroSeconds32 FlashInterval() const;
       
    87 private:
       
    88 	void Clear();
       
    89 	void doDraw(const TRegion& aRegion);
       
    90 	void ScheduleReDrawNow();
       
    91 	void UpdateAttributes(TPoint aPos, TSize aSize, TInt aType, TUint aFlags, TRect aClipRect, TRgb aColor, CWsCustomTextCursor* aCustomTextCursor, CWsClientWindow* aWin);
       
    92 	void NotifyObserver(MWsWindowTreeObserver::TAttributes aAttribute) const;
       
    93 private:
       
    94 	CWsWindowGroup *iGroupWin;
       
    95 	CWsClientWindow *iWin;
       
    96 	TUint iInternalFlags;
       
    97 	TInt iType;
       
    98 	TPoint iPos;
       
    99 	TSize iSize;
       
   100     TUint iFlags;
       
   101 	TRgb iColor;
       
   102 	TRect iClipRect;
       
   103 	TTime iNextCursorUpdate;
       
   104 	RWsRegion iDrawRegion;
       
   105 	CWsCustomTextCursor* iCustomTextCursor;
       
   106 	};
       
   107 
       
   108 class CWsPointerCursor : public CWsSpriteBase
       
   109 	{
       
   110 public:
       
   111 	CWsPointerCursor(CWsClient *aOwner);
       
   112 	~CWsPointerCursor();
       
   113 	void ConstructL(const TWsClCmdCreatePointerCursor &aParams);
       
   114 	void CommandL(TInt aOpcode, const TAny *aCmdData);
       
   115 	void CloseObject();
       
   116 	void Close();
       
   117 	void Open();
       
   118 private:
       
   119 	TInt iAccessCount;
       
   120 	};
       
   121 
       
   122 class CWsCustomTextCursor : public CWsSpriteBase
       
   123 	{
       
   124 public:
       
   125 	CWsCustomTextCursor(CWsClient* aOwner, RWsSession::TCustomTextCursorAlignment aAlignment);
       
   126 	~CWsCustomTextCursor();
       
   127 	void ConstructL(TInt aFlags);
       
   128 	void CommandL(TInt aOpcode, const TAny* aCmdData);
       
   129 	void CompleteL(CWsWindow* aWin, TBool aFlash, TBool aClipSprite, const TPoint& aClipOffset, const TSize& aClipSize);
       
   130 	void SetPositionNoRedraw(const TPoint& aPos);
       
   131 	inline RWsSession::TCustomTextCursorAlignment Alignment() const;
       
   132 	inline void SetWindow(CWsClientWindow* aWin);
       
   133 private:
       
   134 	RWsSession::TCustomTextCursorAlignment iAlignment;
       
   135 	};
       
   136 
       
   137 inline CWsWindow* RWsTextCursor::Win() const
       
   138 	{
       
   139 	return iWin;
       
   140 	}
       
   141 
       
   142 inline RWsSession::TCustomTextCursorAlignment CWsCustomTextCursor::Alignment() const
       
   143 	{
       
   144 	return iAlignment;
       
   145 	}
       
   146 
       
   147 inline void CWsCustomTextCursor::SetWindow(CWsClientWindow* aWin)
       
   148 	{
       
   149 	iWin=aWin;
       
   150 	}
       
   151 
       
   152 #endif