sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // CWsWindow and associated classes definitions sl@0: // sl@0: // sl@0: sl@0: #ifndef __WINDOW_H__ sl@0: #define __WINDOW_H__ sl@0: sl@0: #include "server.h" sl@0: #include "winbase.h" sl@0: sl@0: class CWsWindow : public CWsWindowBase, public MWsWindow sl@0: { sl@0: friend class TWalkWindowTreeDisconnect; sl@0: friend class CWsRootWindow; sl@0: friend class TWalkWindowTreeFindWithFlag; sl@0: public: sl@0: CWsWindow(CWsClient* aOwner,WH_HANDLES aType, CScreen* aScreen); sl@0: ~CWsWindow(); sl@0: void Construct(); sl@0: inline const TRect& Rel() const; sl@0: inline const TRect& Abs() const; sl@0: inline CWsWindow *PrevSiblingMultiParent() const; sl@0: inline CWsWindow *NextSiblingMultiParent() const; sl@0: inline TUint PointerFilter() const; sl@0: inline TBool HasPointerGrab() const; sl@0: inline TBool ShutDownInProgress() const; sl@0: inline TRgb BackColor() const; sl@0: virtual const TRegion& WindowArea() const = 0; sl@0: const TRegion* VisibleRegionIfValid() const; sl@0: const TRegion& VisibleRegion() const; sl@0: void ClearVisibleRegion(); sl@0: void SetVisibleRegion(const TRegion& aRegion, const TRegion* aTop, TRegion& aNewFadableRegion); sl@0: virtual void GenerateWindowRegion(RWsRegion &aRegion) const=0; sl@0: TRect FullRect() const; sl@0: inline TBool ClientSetInvisible() const; sl@0: inline TBool IsVisible() const; sl@0: inline TBool DragDropCapture() const; sl@0: inline CWsBackedUpWindow *Backup() const; sl@0: TDisplayMode DisplayMode() const; sl@0: inline TInt UsingPointerBuffer() const; sl@0: virtual TDblQue *PointerKeyList() const; sl@0: inline CWsWindowRedraw *Redraw() const; sl@0: inline TBool IsTopClientWindow() const; sl@0: inline TBool IsActive() const; sl@0: inline void AddDSA(CWsDirectScreenAccess& aDirect); sl@0: inline void RemoveDSA(CWsDirectScreenAccess& aDirect); sl@0: void AbortAllDSAs(); sl@0: #if defined(_DEBUG) sl@0: inline const TSglQue& DSAs() const; sl@0: #endif sl@0: void PossibleVisibilityChangedEvent(TBool aForceSend); sl@0: void SetNonFading(TBool aNonFading); sl@0: void SetFadeBehind(TBool aFade); sl@0: inline void GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const; sl@0: inline TBool IsTranslucent() const; sl@0: inline TBool HasAlpha() const; sl@0: inline TBool HasBeenDrawnToScreen() const; sl@0: inline void SetDrawnToScreen(TBool aDrawn); sl@0: void FocusChanged(TBool aNewFocusState); sl@0: void ClipRectToViewport(TRect& aRect) const; sl@0: void SetNextScheduled(CWsWindow * aWin); sl@0: CWsWindow * NextScheduled() const; sl@0: inline const RWsRegion * ScheduledRegion() const; sl@0: TBool SetScheduledRegion(const RWsRegion& aRegion); sl@0: void ClearScheduledRegion(); sl@0: static TBool ReleaseMemory(MWsMemoryRelease::TMemoryReleaseLevel aLevel); sl@0: TBool ReadyToDraw() const; sl@0: virtual void Render(CFbsBitGc * aGc, const TRegion& aRegion); sl@0: void AddSprite(CWsSpriteBase * aSprite); sl@0: void RemoveSprite(CWsSpriteBase * aSprite); sl@0: void Accessed(); sl@0: sl@0: inline TBool IsNonFading() const; sl@0: const TRegion& FadableRegion() const; sl@0: inline TBool HasSprite() const; sl@0: inline TBool HasAnimation() const; sl@0: sl@0: public: // from CWsWindowBase sl@0: TBool IsDSAHost() const; sl@0: sl@0: public: // from MWsWindow sl@0: virtual TPoint Origin() const; sl@0: virtual TRect AbsRect() const; sl@0: virtual TSize Size() const; sl@0: virtual TUint32 Handle() const; sl@0: virtual MWsScreen * WsScreen() const; sl@0: virtual void Invalidate(const TRect *) {} sl@0: virtual MWsWindow * FindChildByHandle(TUint32 aHandle); sl@0: virtual TInt OrdinalPriority() const; sl@0: sl@0: protected: sl@0: // Shadow generation sl@0: TPoint InquireOffset(TUint32 aHandle) const; sl@0: // sl@0: void Shutdown(); // Part of two phase destruction sl@0: void FocusChangedL(TBool aNewFocusState); sl@0: void RemoveFromAccessList(); sl@0: void InsertIntoAccessListOldestEnd(); sl@0: void InsertIntoAccessListRecentEnd(); sl@0: void DeactivateAllSprites(); sl@0: private: sl@0: void StatusDump(TDes &aBuf); sl@0: void ResetVisibleRegion(); sl@0: void AbortDsaIfRequired(const TRegion& aNewRegion, const TRegion* aTop); sl@0: #if defined (_DEBUG) sl@0: public: sl@0: TBool iInteresting; // Often useful while debugging for conditional breakpoints. sl@0: #endif sl@0: protected: sl@0: TRect iRel; sl@0: TRect iAbs; sl@0: TPoint iOrigin; sl@0: RWsRegion iVisibleRegion; sl@0: TUint iPointerFilter; sl@0: TInt iPointerCapturePriority; sl@0: TUint iFlags; sl@0: CWsWindowRedraw *iRedraw; sl@0: TSglQue iDSAs; sl@0: CWsWindow * iNextScheduled; sl@0: RWsRegion iScheduledRegion; sl@0: // The access list is a "most recently drawn" ordering list of all redraw msg windows. sl@0: static CWsWindow * iAccessListRecentEnd; sl@0: static CWsWindow * iAccessListOldestEnd; sl@0: CWsWindow * iAccessListPrev; sl@0: CWsWindow * iAccessListNext; sl@0: TUint8 iBlackMap; sl@0: TUint8 iWhiteMap; sl@0: RWsRegion iFadableRegion; // Region which can be faded (Visible region minus already faded regions) sl@0: public: sl@0: /** The list of graphic contexts associated with this window. The list is managed by calling the sl@0: GcActivated() and GcDeactivated() functions. sl@0: This is a linked list. The CWsGc class contains a pointer to the next item: CWsGc::iNextWinGc. sl@0: */ sl@0: CWsGc *iWinGcList; sl@0: CWsAnim *iAnimList; // Start of linked list of animated objects attached to the window sl@0: CWsSpriteBase *iSpriteList; // Start of linked list of sprites attached to the window sl@0: }; sl@0: sl@0: #include "wnredraw.h" sl@0: sl@0: inline TBool CWsWindow::IsVisible() const sl@0: { sl@0: return(!(iFlags&EFlagHidden)); sl@0: } sl@0: sl@0: inline TBool CWsWindow::ClientSetInvisible() const sl@0: { sl@0: return(iFlags&EFlagInvisible); sl@0: } sl@0: sl@0: inline TBool CWsWindow::DragDropCapture() const sl@0: { sl@0: return(iFlags&EFlagPointerCaptureDragDrop); sl@0: } sl@0: sl@0: inline TRgb CWsWindow::BackColor() const sl@0: { sl@0: return(iRedraw->BackColor()); sl@0: } sl@0: sl@0: inline TInt CWsWindow::UsingPointerBuffer() const sl@0: { sl@0: return(iFlags&EFlagUsingPointerBuffer); sl@0: } sl@0: sl@0: inline CWsWindowRedraw *CWsWindow::Redraw() const sl@0: { sl@0: return iRedraw; sl@0: } sl@0: sl@0: inline const TRect& CWsWindow::Rel() const sl@0: { sl@0: return iRel; sl@0: } sl@0: sl@0: inline const TRect& CWsWindow::Abs() const sl@0: { sl@0: return iAbs; sl@0: } sl@0: sl@0: inline TBool CWsWindow::IsTopClientWindow() const sl@0: { sl@0: return (WinType() == EWinTypeClient && iParent->WinType() == EWinTypeGroup); sl@0: } sl@0: sl@0: inline TUint CWsWindow::PointerFilter() const sl@0: { sl@0: return(iPointerFilter); sl@0: } sl@0: sl@0: inline TBool CWsWindow::HasPointerGrab() const sl@0: { sl@0: return(iFlags&EFlagPointerGrab); sl@0: } sl@0: sl@0: inline TBool CWsWindow::ShutDownInProgress() const sl@0: { sl@0: return(iFlags&EFlagShutDownInProgress); sl@0: } sl@0: sl@0: inline CWsBackedUpWindow *CWsWindow::Backup() const sl@0: { sl@0: return(iRedraw->Backup()); sl@0: } sl@0: sl@0: inline TBool CWsWindow::IsActive() const sl@0: { sl@0: return iFlags&EFlagActive; sl@0: } sl@0: sl@0: inline void CWsWindow::AddDSA(CWsDirectScreenAccess& aDirect) sl@0: { sl@0: iDSAs.AddLast(aDirect); sl@0: } sl@0: sl@0: inline void CWsWindow::RemoveDSA(CWsDirectScreenAccess& aDirect) sl@0: { sl@0: iDSAs.Remove(aDirect); sl@0: } sl@0: sl@0: inline TBool CWsWindow::IsTranslucent() const sl@0: { sl@0: return (iFlags & static_cast(EFlagHasAlpha)) != 0; sl@0: } sl@0: sl@0: inline TBool CWsWindow::HasAlpha() const sl@0: { sl@0: return (iFlags & static_cast(EFlagHasAlpha)) !=0; sl@0: } sl@0: sl@0: inline TBool CWsWindow::HasBeenDrawnToScreen() const sl@0: { sl@0: return (iFlags & static_cast(EFlagDrawnToScreen)) != 0; sl@0: } sl@0: sl@0: inline void CWsWindow::SetDrawnToScreen(TBool aDrawn) sl@0: { sl@0: if (aDrawn) sl@0: iFlags |= static_cast(EFlagDrawnToScreen); sl@0: else sl@0: iFlags &= ~static_cast(EFlagDrawnToScreen); sl@0: } sl@0: sl@0: inline const RWsRegion * CWsWindow::ScheduledRegion() const sl@0: { sl@0: return &iScheduledRegion; sl@0: } sl@0: sl@0: #if defined(_DEBUG) sl@0: inline const TSglQue& CWsWindow::DSAs() const sl@0: { sl@0: return iDSAs; sl@0: } sl@0: #endif sl@0: sl@0: inline TBool CWsWindow::IsNonFading() const sl@0: { sl@0: return (iFlags&EFlagNonFadingWindow); sl@0: } sl@0: sl@0: inline void CWsWindow::GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const sl@0: {aBlackMap=iBlackMap;aWhiteMap=iWhiteMap;} sl@0: sl@0: inline TBool CWsWindow::HasSprite() const sl@0: { sl@0: return (NULL != iSpriteList); sl@0: } sl@0: sl@0: inline TBool CWsWindow::HasAnimation() const sl@0: { sl@0: return (NULL != iAnimList); sl@0: } sl@0: #endif