os/graphics/windowing/windowserver/nonnga/SERVER/window.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 // CWsWindow and associated classes definitions
    15 // 
    16 //
    17 
    18 #ifndef __WINDOW_H__
    19 #define __WINDOW_H__
    20 
    21 #include "server.h"
    22 #include "winbase.h"
    23 
    24 class CWsWindow : public CWsWindowBase, public MWsWindow
    25 	{
    26 	friend class TWalkWindowTreeDisconnect;
    27 	friend class CWsRootWindow;
    28 	friend class TWalkWindowTreeFindWithFlag;
    29 public:
    30 	CWsWindow(CWsClient* aOwner,WH_HANDLES aType, CScreen* aScreen);
    31 	~CWsWindow();
    32 	void Construct();
    33 	inline const TRect& Rel() const;
    34 	inline const TRect& Abs() const;
    35 	inline CWsWindow *PrevSiblingMultiParent() const;
    36 	inline CWsWindow *NextSiblingMultiParent() const;
    37 	inline TUint PointerFilter() const;
    38 	inline TBool HasPointerGrab() const;
    39 	inline TBool ShutDownInProgress() const;
    40 	inline TRgb BackColor() const;
    41 	virtual const TRegion& WindowArea() const = 0;
    42 	const TRegion* VisibleRegionIfValid() const;
    43 	const TRegion& VisibleRegion() const;
    44 	void ClearVisibleRegion();
    45 	void SetVisibleRegion(const TRegion& aRegion, const TRegion* aTop, TRegion& aNewFadableRegion);
    46 	virtual void GenerateWindowRegion(RWsRegion &aRegion) const=0;
    47 	TRect FullRect() const;
    48 	inline TBool ClientSetInvisible() const;
    49 	inline TBool IsVisible() const;
    50 	inline TBool DragDropCapture() const;
    51 	inline CWsBackedUpWindow *Backup() const;
    52 	TDisplayMode DisplayMode() const;
    53 	inline TInt UsingPointerBuffer() const;
    54 	virtual TDblQue<TPointerKeyList> *PointerKeyList() const;
    55 	inline CWsWindowRedraw *Redraw() const;
    56 	inline TBool IsTopClientWindow() const;
    57 	inline TBool IsActive() const;
    58 	inline void AddDSA(CWsDirectScreenAccess& aDirect);
    59 	inline void RemoveDSA(CWsDirectScreenAccess& aDirect);
    60 	void AbortAllDSAs();
    61 #if defined(_DEBUG)
    62 	inline const TSglQue<CWsDirectScreenAccess>& DSAs() const;
    63 #endif
    64 	void PossibleVisibilityChangedEvent(TBool aForceSend);
    65 	void SetNonFading(TBool aNonFading); 
    66 	void SetFadeBehind(TBool aFade);
    67 	inline void GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const;
    68 	inline TBool IsTranslucent() const;
    69 	inline TBool HasAlpha() const;
    70 	inline TBool HasBeenDrawnToScreen() const;
    71 	inline void SetDrawnToScreen(TBool aDrawn);
    72 	void FocusChanged(TBool aNewFocusState);
    73 	void ClipRectToViewport(TRect& aRect) const;
    74 	void SetNextScheduled(CWsWindow * aWin);
    75 	CWsWindow * NextScheduled() const;
    76 	inline const RWsRegion * ScheduledRegion() const;
    77 	TBool SetScheduledRegion(const RWsRegion& aRegion);
    78 	void ClearScheduledRegion();	
    79 	static TBool ReleaseMemory(MWsMemoryRelease::TMemoryReleaseLevel aLevel);
    80 	TBool ReadyToDraw() const;
    81 	virtual void Render(CFbsBitGc * aGc, const TRegion& aRegion);	
    82 	void AddSprite(CWsSpriteBase * aSprite);
    83 	void RemoveSprite(CWsSpriteBase * aSprite);
    84 	void Accessed();
    85 	
    86 	inline TBool IsNonFading() const;
    87 	const TRegion& FadableRegion() const;
    88 	inline TBool HasSprite() const;
    89 	inline TBool HasAnimation() const;
    90 	
    91 public: // from CWsWindowBase
    92 	TBool IsDSAHost() const;
    93 	
    94 public:	// from MWsWindow
    95 	virtual TPoint Origin() const;
    96 	virtual TRect AbsRect() const;
    97 	virtual TSize Size() const;
    98 	virtual TUint32 Handle() const;
    99 	virtual MWsScreen * WsScreen() const;
   100 	virtual void Invalidate(const TRect *) {}
   101 	virtual MWsWindow * FindChildByHandle(TUint32 aHandle);
   102 	virtual TInt OrdinalPriority() const;
   103 	
   104 protected:
   105 // Shadow generation
   106 	TPoint InquireOffset(TUint32 aHandle) const;
   107 //
   108 	void Shutdown();	// Part of two phase destruction
   109 	void FocusChangedL(TBool aNewFocusState);
   110 	void RemoveFromAccessList();
   111 	void InsertIntoAccessListOldestEnd();
   112 	void InsertIntoAccessListRecentEnd();
   113 	void DeactivateAllSprites();
   114 private:
   115 	void StatusDump(TDes &aBuf);
   116 	void ResetVisibleRegion();
   117 	void AbortDsaIfRequired(const TRegion& aNewRegion, const TRegion* aTop);
   118 #if defined (_DEBUG)
   119 public:
   120 	TBool iInteresting;  // Often useful while debugging for conditional breakpoints.
   121 #endif
   122 protected:
   123 	TRect iRel;
   124 	TRect iAbs;
   125 	TPoint iOrigin;
   126 	RWsRegion iVisibleRegion;
   127 	TUint iPointerFilter;
   128 	TInt iPointerCapturePriority;
   129 	TUint iFlags;
   130 	CWsWindowRedraw *iRedraw;
   131 	TSglQue<CWsDirectScreenAccess> iDSAs;
   132 	CWsWindow * iNextScheduled;
   133 	RWsRegion iScheduledRegion;
   134 	// The access list is a "most recently drawn" ordering list of all redraw msg windows.
   135 	static CWsWindow * iAccessListRecentEnd;
   136 	static CWsWindow * iAccessListOldestEnd;
   137 	CWsWindow * iAccessListPrev;
   138 	CWsWindow * iAccessListNext;
   139 	TUint8 iBlackMap;
   140 	TUint8 iWhiteMap;
   141 	RWsRegion iFadableRegion; // Region which can be faded (Visible region minus already faded regions)
   142 public:
   143 	/** The list of graphic contexts associated with this window. The list is managed by calling the
   144 	GcActivated() and GcDeactivated() functions. 
   145 	This is a linked list. The CWsGc class contains a pointer to the next item: CWsGc::iNextWinGc.
   146 	*/
   147 	CWsGc *iWinGcList;
   148 	CWsAnim *iAnimList;	// Start of linked list of animated objects attached to the window
   149 	CWsSpriteBase *iSpriteList; // Start of linked list of sprites attached to the window
   150 	};
   151 
   152 #include "wnredraw.h"
   153 
   154 inline TBool CWsWindow::IsVisible() const
   155 	{
   156 	return(!(iFlags&EFlagHidden));
   157 	}
   158 
   159 inline TBool CWsWindow::ClientSetInvisible() const
   160 	{
   161 	return(iFlags&EFlagInvisible);
   162 	}
   163 
   164 inline TBool CWsWindow::DragDropCapture() const
   165 	{
   166 	return(iFlags&EFlagPointerCaptureDragDrop);
   167 	}
   168 
   169 inline TRgb CWsWindow::BackColor() const
   170 	{
   171 	return(iRedraw->BackColor());
   172 	}
   173 
   174 inline TInt CWsWindow::UsingPointerBuffer() const
   175 	{
   176 	return(iFlags&EFlagUsingPointerBuffer);
   177 	}
   178 
   179 inline CWsWindowRedraw *CWsWindow::Redraw() const
   180 	{
   181 	return iRedraw;
   182 	}
   183 
   184 inline const TRect& CWsWindow::Rel() const
   185 	{
   186 	return iRel;
   187 	}
   188 	
   189 inline const TRect& CWsWindow::Abs() const
   190 	{
   191 	return iAbs;
   192 	}
   193 	
   194 inline TBool CWsWindow::IsTopClientWindow() const
   195 	{
   196 	return (WinType() == EWinTypeClient && iParent->WinType() == EWinTypeGroup);
   197 	}
   198 
   199 inline TUint CWsWindow::PointerFilter() const
   200 	{
   201 	return(iPointerFilter);
   202 	}
   203 
   204 inline TBool CWsWindow::HasPointerGrab() const
   205 	{
   206 	return(iFlags&EFlagPointerGrab);
   207 	}
   208 
   209 inline TBool CWsWindow::ShutDownInProgress() const
   210 	{
   211 	return(iFlags&EFlagShutDownInProgress);
   212 	}
   213 
   214 inline CWsBackedUpWindow *CWsWindow::Backup() const
   215 	{
   216 	return(iRedraw->Backup());
   217 	}
   218 
   219 inline TBool CWsWindow::IsActive() const
   220 	{
   221 	return iFlags&EFlagActive;
   222 	}
   223 
   224 inline void CWsWindow::AddDSA(CWsDirectScreenAccess& aDirect)
   225 	{
   226 	iDSAs.AddLast(aDirect);
   227 	}
   228 
   229 inline void CWsWindow::RemoveDSA(CWsDirectScreenAccess& aDirect)
   230 	{
   231 	iDSAs.Remove(aDirect);
   232 	}
   233 
   234 inline TBool CWsWindow::IsTranslucent() const
   235 	{
   236 	return (iFlags & static_cast<TUint>(EFlagHasAlpha)) != 0;
   237 	}
   238 
   239 inline TBool CWsWindow::HasAlpha() const
   240 	{
   241 	return (iFlags & static_cast<TUint>(EFlagHasAlpha)) !=0;
   242 	}
   243 
   244 inline TBool CWsWindow::HasBeenDrawnToScreen() const
   245 	{
   246 	return (iFlags & static_cast<TUint>(EFlagDrawnToScreen)) != 0;
   247 	}
   248 
   249 inline void CWsWindow::SetDrawnToScreen(TBool aDrawn)
   250 	{
   251 	if (aDrawn)
   252 		iFlags |= static_cast<TUint>(EFlagDrawnToScreen);
   253 	else
   254 		iFlags &= ~static_cast<TUint>(EFlagDrawnToScreen);
   255 	}
   256 
   257 inline const RWsRegion * CWsWindow::ScheduledRegion() const
   258 	{
   259 	return &iScheduledRegion;
   260 	}
   261 
   262 #if defined(_DEBUG)
   263 inline const TSglQue<CWsDirectScreenAccess>& CWsWindow::DSAs() const
   264 	{
   265 	return iDSAs;
   266 	}
   267 #endif
   268 
   269 inline TBool CWsWindow::IsNonFading() const
   270 	{
   271 	return (iFlags&EFlagNonFadingWindow);
   272 	}
   273 	
   274 inline void CWsWindow::GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const
   275     {aBlackMap=iBlackMap;aWhiteMap=iWhiteMap;}
   276 
   277 inline TBool CWsWindow::HasSprite() const
   278 	{
   279 	return (NULL != iSpriteList);
   280 	}
   281 
   282 inline TBool CWsWindow::HasAnimation() const
   283 	{
   284 	return (NULL != iAnimList);
   285 	}
   286 #endif