1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/nonnga/SERVER/walkwindowtree.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,301 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// TWalkWindowTreeBase and associated classes definitions
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __WALKWINDOWTREE_H__
1.22 +#define __WALKWINDOWTREE_H__
1.23 +
1.24 +#include "server.h"
1.25 +
1.26 +class CWsWindow;
1.27 +class CWsWindowBase;
1.28 +class RWsTextCursor;
1.29 +
1.30 +class TWalkWindowTreeBase
1.31 + {
1.32 +public:
1.33 + virtual TBool DoIt(CWsWindow *aWin)=0;
1.34 + };
1.35 +
1.36 +class TResumableWalkWindowTreeBase
1.37 + {
1.38 +public:
1.39 + virtual TBool DoIt(CWsWindow *aWin)=0;
1.40 +private: // walk state
1.41 + friend class CWsWindowBase;
1.42 + CWsWindowBase* iWin;
1.43 + CWsWindowBase* iEnd;
1.44 + CWsWindowBase* iNextChild;
1.45 + CWsWindowBase* iParent;
1.46 + };
1.47 +
1.48 +class TWalkWindowTreeRegionBase : public TWalkWindowTreeBase
1.49 + {
1.50 +public:
1.51 + enum TTranslucentBehaviour
1.52 + {
1.53 + EDontWalkTranslucent, //< Default behaviour - stop when you reach a window
1.54 + EWalkTranslucent, //< Walk through translucent parts of windows
1.55 + };
1.56 +protected:
1.57 + TWalkWindowTreeRegionBase(RWsRegion *aRegion, TTranslucentBehaviour aTranslucentBehaviour = EDontWalkTranslucent);
1.58 + TBool DoIt(CWsWindow *aWin);
1.59 + virtual void DoIt2(CWsWindow *aWin)=0;
1.60 + virtual TBool DoIt3(CWsWindow *aWin);
1.61 +protected:
1.62 + TTranslucentBehaviour iTranslucentBehaviour;
1.63 + RWsRegion *iRegion;
1.64 + RWsRegion *iSubRegion;
1.65 + };
1.66 +
1.67 +/**
1.68 +This tree walker calculates the visible regions of all windows and schedules
1.69 +redraws for anywhere which has changed.
1.70 +*/
1.71 +class TWalkWindowTreeUpdateRegions : public TWalkWindowTreeBase
1.72 + {
1.73 +public:
1.74 + TWalkWindowTreeUpdateRegions(CScreen & aScreen);
1.75 + TBool DoIt(CWsWindow * aWin);
1.76 + void Walk();
1.77 +
1.78 +private:
1.79 + CScreen & iScreen;
1.80 + RWsRegion iVisible;
1.81 + RWsRegion iTop;
1.82 + RWsRegion iRemainsOfFadableScreen; // The remains after the accumulation of already faded regions
1.83 + };
1.84 +
1.85 +/**
1.86 +This schedules the visible regions of all windows walked for redraw.
1.87 +*/
1.88 +class TWalkWindowTreeScheduleRedraws : public TWalkWindowTreeBase
1.89 + {
1.90 +public:
1.91 + enum
1.92 + { // bit mask
1.93 + ERedrawFilterNoFilter = 0,
1.94 + ERedrawFilterOmitDSA = 0x001
1.95 + };
1.96 +
1.97 +public:
1.98 + TWalkWindowTreeScheduleRedraws();
1.99 + TWalkWindowTreeScheduleRedraws( TUint32 aFilter );
1.100 + TBool DoIt(CWsWindow * aWin);
1.101 +
1.102 +private:
1.103 + TUint32 iScheduleRedrawFilter;
1.104 + };
1.105 +
1.106 +/**
1.107 +This offsets all the transparent regions
1.108 +*/
1.109 +class TWalkWindowTreeOffsetTransparentRegions : public TWalkWindowTreeBase
1.110 + {
1.111 +public:
1.112 + TWalkWindowTreeOffsetTransparentRegions(const TPoint& aOffset);
1.113 + TBool DoIt(CWsWindow * aWin);
1.114 +
1.115 +private:
1.116 + const TPoint & iOffset;
1.117 + };
1.118 +
1.119 +/**
1.120 +This recalculates the user opaque regions
1.121 +*/
1.122 +class TWalkWindowTreeRecalcOpaque : public TWalkWindowTreeBase
1.123 + {
1.124 +public:
1.125 + TWalkWindowTreeRecalcOpaque();
1.126 + TBool DoIt(CWsWindow * aWin);
1.127 + };
1.128 +
1.129 +// Tree walkers which schedule a set of windows to be drawn derive from this
1.130 +class TWalkWindowTreeSchedule: public TWalkWindowTreeBase
1.131 + {
1.132 +public:
1.133 + TWalkWindowTreeSchedule();
1.134 + CWsWindow * HeadWindow() const;
1.135 + virtual const TRegion * Region(const CWsWindow* aWin) const = 0;
1.136 +protected:
1.137 + CWsWindow* iHead;
1.138 + };
1.139 +
1.140 +// This walker uses regions to work out the minimum set of pixels that need updating
1.141 +// It requires memory allocation, and so can fail. Check ScheduledRegionsOk before
1.142 +// relying on the results.
1.143 +class TWalkWindowTreeScheduleRegions: public TWalkWindowTreeSchedule
1.144 + {
1.145 +public:
1.146 + TWalkWindowTreeScheduleRegions(RWsRegion *aRegion, const TRegion& aTopLayer);
1.147 + TBool DoIt(CWsWindow *aWin);
1.148 + TBool ScheduledRegionsOk() const;
1.149 + const TRegion * Region(const CWsWindow* aWin) const;
1.150 +private:
1.151 + RWsRegion *iRegion;
1.152 + const TRegion &iTopLayer;
1.153 + TBool iScheduledRegionsOk;
1.154 + };
1.155 +
1.156 +// This walker uses the screens fallback mechanism. This does not require memory
1.157 +// allocation and so should never fail, but is significantly less efficient than the
1.158 +// region based walker.
1.159 +class TWalkWindowTreeScheduleFallback: public TWalkWindowTreeSchedule
1.160 + {
1.161 +public:
1.162 + TWalkWindowTreeScheduleFallback(CScreen::CFallbackMap * aFallbackMap);
1.163 + TBool DoIt(CWsWindow *aWin);
1.164 + const TRegion * Region(const CWsWindow* aWin) const;
1.165 +private:
1.166 + CScreen::CFallbackMap * iFallbackMap;
1.167 + };
1.168 +
1.169 +class TWalkWindowTreeFocusChanged : public TWalkWindowTreeBase
1.170 + {
1.171 +public:
1.172 + TWalkWindowTreeFocusChanged(TBool aNewFocusState);
1.173 + TBool DoIt(CWsWindow *aWin);
1.174 +// Data
1.175 +private:
1.176 + TBool iNewFocusState;
1.177 + };
1.178 +
1.179 +class TResumableWalkWindowTreeFindInvalid : public TResumableWalkWindowTreeBase
1.180 + {
1.181 +public:
1.182 + TResumableWalkWindowTreeFindInvalid(CWsWindowRedraw** aResult);
1.183 + TBool DoIt(CWsWindow* aWin);
1.184 +// Data
1.185 +private:
1.186 + CWsWindowRedraw** iResult;
1.187 + };
1.188 +
1.189 +class TWalkWindowTreeDisconnect : public TWalkWindowTreeBase
1.190 + {
1.191 +public:
1.192 + TWalkWindowTreeDisconnect(RWsTextCursor *aCursor);
1.193 + TBool DoIt(CWsWindow *aWin);
1.194 +private:
1.195 + RWsTextCursor *iTextCursor;
1.196 + };
1.197 +
1.198 +class TWalkWindowTreeIsObscured : public TWalkWindowTreeBase
1.199 + {
1.200 +public:
1.201 + TWalkWindowTreeIsObscured(TBool &aResult);
1.202 + TBool DoIt(CWsWindow *aWin);
1.203 +// Data
1.204 + TBool *iResult;
1.205 + };
1.206 +
1.207 +class TWalkWindowTreeSetNonFading : public TWalkWindowTreeBase
1.208 + {
1.209 +public:
1.210 + TWalkWindowTreeSetNonFading(TBool aNonFading);
1.211 + TBool DoIt(CWsWindow *aWin);
1.212 +// Data
1.213 + const TBool iNonFading;
1.214 + };
1.215 +
1.216 +class TWalkWindowTreeSetFaded : public TWalkWindowTreeBase
1.217 + {
1.218 +public:
1.219 + TWalkWindowTreeSetFaded(TBool aFaded,CWsWindowBase* aWin,TUint8 aBlackMap,TUint8 aWhiteMap);
1.220 + TBool DoIt(CWsWindow *aWin);
1.221 +// Data
1.222 + const TUint8 iBlackMap;
1.223 + const TUint8 iWhiteMap;
1.224 + const TBool iFaded;
1.225 + const CWsWindowGroup* iGroup;
1.226 + };
1.227 +
1.228 +class TWalkWindowTreePurgeEvents : public TWalkWindowTreeBase
1.229 + {
1.230 +public:
1.231 + TWalkWindowTreePurgeEvents();
1.232 + TBool DoIt(CWsWindow *aWin);
1.233 + };
1.234 +
1.235 +class TWalkWindowTreeCalcInvalidGraphics: public TWalkWindowTreeRegionBase
1.236 + {
1.237 +public:
1.238 + TWalkWindowTreeCalcInvalidGraphics(RWsRegion *aRegion,TRegion &aDirty,const TArray<TGraphicDrawerId>& aInvalid);
1.239 + void CalcInvalid(CScreen& aScreen);
1.240 + TBool CreateSubRegion();
1.241 + void DoIt2(CWsWindow */*aWin*/) {}
1.242 + TBool DoIt3(CWsWindow *aWin);
1.243 + void DestroyRegions();
1.244 +private:
1.245 + TRegion& iDirty;
1.246 + const TArray<TGraphicDrawerId>& iInvalid;
1.247 + };
1.248 +
1.249 +#if defined(_DEBUG)
1.250 +class TWalkWindowTreeCheck : public TWalkWindowTreeBase
1.251 + {
1.252 +public:
1.253 + TBool DoIt(CWsWindow *aWin);
1.254 + };
1.255 +
1.256 +#endif
1.257 +
1.258 +class TWalkWindowTreeRedrawStoreSize : public TWalkWindowTreeBase
1.259 + {
1.260 +public:
1.261 + TWalkWindowTreeRedrawStoreSize();
1.262 + TBool DoIt(CWsWindow *aWin);
1.263 + TInt iTotalSize;
1.264 + };
1.265 +
1.266 +
1.267 +// We can't do a proper find_if unless we are prepared to write our own
1.268 +// mem_fun, but this isn't a bad start
1.269 +class TWalkWindowTreeFindWithFlag : public TWalkWindowTreeBase
1.270 + {
1.271 +public:
1.272 + TWalkWindowTreeFindWithFlag(TUint aFlag) : iFlag(aFlag), iFound(0) { }
1.273 + TBool DoIt(CWsWindow *aWin);
1.274 + CWsWindow * Found() { return iFound; }
1.275 +private:
1.276 + TUint iFlag;
1.277 + CWsWindow * iFound;
1.278 + };
1.279 +
1.280 +class TWalkWindowTreeFindByHandle : public TWalkWindowTreeBase
1.281 + {
1.282 +public:
1.283 + TWalkWindowTreeFindByHandle(TUint32 aHandle) : iHandle(aHandle) { }
1.284 + TBool DoIt(CWsWindow * aWin);
1.285 + CWsWindow * Found() { return iFound; }
1.286 +private:
1.287 + TUint32 iHandle;
1.288 + CWsWindow * iFound;
1.289 + };
1.290 +
1.291 +class TWalkWindowTreeReactivateGcs : public TWalkWindowTreeBase
1.292 + {
1.293 +public:
1.294 + TBool DoIt(CWsWindow *aWin);
1.295 + };
1.296 +
1.297 +class TWalkWindowTreeScheduleFadeNoRedraw : public TWalkWindowTreeBase
1.298 + {
1.299 +public:
1.300 + TWalkWindowTreeScheduleFadeNoRedraw();
1.301 + TBool DoIt(CWsWindow *aWin);
1.302 + };
1.303 +
1.304 +#endif