windowing/windowserver/nga/SERVER/openwfc/winbase.h
changeset 0 5d03bc08d59c
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 // CWsWindowBase and associated classes definitions
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __WINBASE_H__
       
    19 #define __WINBASE_H__
       
    20 
       
    21 #include "server.h"
       
    22 
       
    23 class TWalkWindowTreeBase;
       
    24 class TResumableWalkWindowTreeBase;
       
    25 class CWsAnim;
       
    26 class CWsSprite;
       
    27 class CWsBlankWindow;
       
    28 
       
    29 /** The base class that represents a node in the window tree.
       
    30 
       
    31 Every window and window group is part of a window tree. The root of the tree is an instance of the
       
    32 CWsRootWindow class.
       
    33 
       
    34 @see RWindowTreeNode
       
    35 @internalComponent
       
    36 @released
       
    37 */
       
    38 class CWsWindowBase : public CWsScreenObject, public MWsWindowTreeNode
       
    39 	{
       
    40 public:
       
    41 	CWsWindowBase(CWsClient *aOwner,WH_HANDLES aType, CScreen* aScreen);
       
    42 	void ConstructL(CWsWindowBase *aParent);
       
    43 	virtual void AreaCovered(TRegion &aRegion)=0;
       
    44 	virtual TPoint Origin() const = 0;
       
    45 	virtual TRect AbsRect() const = 0;
       
    46 	virtual TSize Size() const = 0;
       
    47 	CWsWindowGroup *WinGroup() const;
       
    48 	inline TUint32 ClientHandle() const;
       
    49 	inline CWsWindowBase *BaseParent() const;
       
    50 	inline CWsWindowBase *BaseChild() const;
       
    51 	inline CWsWindowBase *NextSibling() const;
       
    52 	CWsWindowBase *GetPrevSibling() const;
       
    53 	CWsWindowBase *LastSibling() const;
       
    54 	CWsWindowBase *PrevSiblingMultiParent() const;
       
    55 	CWsWindowBase *NextSiblingMultiParent() const;
       
    56 	inline TWinType WinType() const;
       
    57 	virtual void StatusDump(TDes &aBuf)=0;
       
    58 	TBool QueueEvent(TInt aEvent, TInt aIntVal = 0) const;
       
    59 	inline TBool AdvancedPointersEnabled() const;
       
    60 	inline CWsPointerCursor *PointerCursor() const;
       
    61 	TEventQueueWalkRet EventPurgeCheck(TWsEvent *aEvent);
       
    62 	virtual void SetOrdinalPosition(TInt aPos);
       
    63 	TBool TreeIsObscured() const;
       
    64 	CEventQueue *EventQueue() const;
       
    65 	TInt Depth() const;
       
    66 	void WalkWindowTree(TWalkWindowTreeBase &doIt,TWalkMode aMode);
       
    67 	void WalkWindowTree(TResumableWalkWindowTreeBase& aWalkClass, TWalkMode aMode, TBool aResume);
       
    68 	void WalkWindowTreeBackToFront(TWalkWindowTreeBase &doIt, TWalkModeBackToFront aMode);
       
    69 	void PurgeEvents();
       
    70 	inline TInt FadeCount() const;
       
    71   void AddSprite(CWsSpriteBase * aSprite);
       
    72   void RemoveSprite(CWsSpriteBase * aSprite);
       
    73 	inline TBool HasSprite() const;
       
    74 	virtual TBool IsDSAHost() const;
       
    75 	virtual void SendState(MWsWindowTreeObserver& aWindowTreeObserver) const;
       
    76 	
       
    77 public:	// from CWsObject
       
    78 	TBool CommandL(TInt aOpcode, TWsWinCmdUnion &aCmd);
       
    79 	
       
    80 public: // from MWsWindowTreeNode
       
    81 	MWsWindowTreeNode::TType NodeType() const;
       
    82 	const MWsWindow* Window() const;
       
    83 	const MWsSprite* Sprite() const;
       
    84 	const MWsStandardTextCursor* StandardTextCursor() const;
       
    85 	const MWsWindowGroup* WindowGroup() const;
       
    86 	const MWsWindowTreeNode* ParentNode() const;	
       
    87 	
       
    88 protected:
       
    89 	TInt OrdinalPosition(TBool aFull) const;
       
    90 	TBool CheckOrdinalPositionChange(TInt aPos);
       
    91 	virtual void Shutdown();	// Part of two phase destruction
       
    92 	void SetPointerCursor(CWsPointerCursor *aCursor);
       
    93 	void SetPointerCursorByIndex(TInt aIndex);
       
    94 	void ChangeWindowPosition(TInt aPos,CWsWindowBase* aNewParent);
       
    95 
       
    96 private:
       
    97 	void RemoveFromSiblingList();
       
    98 	virtual TBool IsActivated() const;
       
    99 
       
   100 public:	
       
   101 	CWsSpriteBase *iSpriteList; // Start of linked list of sprites attached to the window		
       
   102 	
       
   103 protected:
       
   104 	enum TBaseWinFlags
       
   105 		{
       
   106 		EBaseWinAdvancedPointersEnabled = 0x00000001,
       
   107 		EBaseWinNodeCreated				= 0x00000002,
       
   108 		};
       
   109 	
       
   110 	CWsWindowBase *iParent;
       
   111 	CWsWindowBase *iSibling;
       
   112 	CWsWindowBase *iChild;
       
   113 	/** The handle specified by the client when the object was created.
       
   114 	
       
   115 	This is different from CWsObject::iWsOwner which is the handle assigned to the object by the server.
       
   116 	@see CWsObject::iWsOwner
       
   117 	*/
       
   118 	TUint32 iClientHandle;
       
   119 	TInt iOrdinalPriority;
       
   120 	TWinType iWinType;
       
   121 	TInt iFadeCount;
       
   122 	TUint iBaseWinFlags;
       
   123 
       
   124 private:
       
   125 	CWsPointerCursor *iPointerCursor;
       
   126 	
       
   127 #if defined(_DEBUG)
       
   128 public:
       
   129 	void CheckTree();
       
   130 	TBool IsClientHandleInUse(TUint32 aHandle);
       
   131 #endif
       
   132 	};
       
   133 	
       
   134 inline TWinType CWsWindowBase::WinType() const
       
   135 	{
       
   136 	return iWinType;
       
   137 	}
       
   138 
       
   139 inline CWsPointerCursor *CWsWindowBase::PointerCursor() const
       
   140 	{
       
   141 	return iPointerCursor;
       
   142 	}
       
   143 
       
   144 inline CWsWindowBase *CWsWindowBase::NextSibling() const
       
   145 	{
       
   146 	return iSibling;
       
   147 	}
       
   148 
       
   149 inline CWsWindowBase *CWsWindowBase::BaseChild() const
       
   150 	{
       
   151 	return iChild;
       
   152 	}
       
   153 
       
   154 inline CWsWindowBase *CWsWindowBase::BaseParent() const
       
   155 	{
       
   156 	return iParent;
       
   157 	}
       
   158 
       
   159 inline TUint32 CWsWindowBase::ClientHandle() const
       
   160 	{
       
   161 	return iClientHandle;
       
   162 	}
       
   163 
       
   164 inline TInt CWsWindowBase::FadeCount() const
       
   165 	{
       
   166 	return iFadeCount;
       
   167 	}
       
   168 
       
   169 inline TBool CWsWindowBase::AdvancedPointersEnabled() const
       
   170 	{
       
   171 	return iBaseWinFlags&EBaseWinAdvancedPointersEnabled;
       
   172 	}
       
   173 
       
   174 inline TBool CWsWindowBase::HasSprite() const
       
   175 	{
       
   176 	return (NULL != iSpriteList);
       
   177 	}
       
   178 
       
   179 #endif