windowing/windowserver/nga/SERVER/windowgroup.h
changeset 0 5d03bc08d59c
child 116 171fae344dd4
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 // CWsWindow and associated classes definitions
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __WINDOWGROUP_H__
       
    19 #define __WINDOWGROUP_H__
       
    20 
       
    21 #include "server.h"
       
    22 #include "tcursor.h"
       
    23 
       
    24 class CWsWindowGroup : public CWsWindowBase, public MWsWindowGroup
       
    25 	{
       
    26 private:
       
    27 	enum {EMaxIdentifierCount=10000};	// Could go as high as the highest signed int, but this would be impractical to test
       
    28 	enum TGroupWindowFlags {
       
    29 		EGroupFlagDisableKeyClick=0x01,
       
    30 		EGroupFlagReceivesFocus=  0x02,
       
    31 		EGroupFlagAutoForeground= 0x04,
       
    32 		EGroupFlagHandlesDeviceChange= 0x08,
       
    33 		EGroupFlagScreenDeviceDeleted= 0x10,
       
    34 		EGroupFlagMsgQueueActive= 0x20,
       
    35 		EGroupFlagMsgQueueNew=	  0x40,
       
    36 		EGroupFlagMessageSignalled= 0x80,
       
    37 		};
       
    38 public:
       
    39 	static CWsWindowGroup* NewL(CWsClient* aOwner, CScreen* aScreen, 
       
    40 		const TWsClCmdCreateWindowGroup& aCmd);
       
    41 	~CWsWindowGroup();
       
    42 private:
       
    43 	CWsWindowGroup(CWsClient* aOwner,CScreen* aScreen);
       
    44 	void ConstructL(const TWsClCmdCreateWindowGroup &aCmd);
       
    45 public: // virtual functions from CWsObject
       
    46 	void CommandL(TInt aOpcode, const TAny *aCmdData);
       
    47 public: // virtual functions from CWsWindowBase
       
    48 	TPoint Origin() const;
       
    49 	TRect AbsRect() const;
       
    50 	TSize Size() const;
       
    51 	void SendState(MWsWindowTreeObserver& aWindowTreeObserver) const;
       
    52 	void SendStateWindowGroupChain(MWsWindowTreeObserver& aWindowTreeObserver) const;
       
    53 	
       
    54 public: // virtual functions from MWsWindowGroup
       
    55 	TInt Identifier() const;
       
    56 	TPtrC Name() const;
       
    57 	TBool IsFocusable() const;
       
    58 	TInt OrdinalPriority() const;
       
    59     const MWsClient * Client() const;
       
    60 
       
    61 public:
       
    62 	CWsTopClientWindow *Child() const;
       
    63 	inline CWsWindowGroup *PrevSibling() const;
       
    64 	inline CWsWindowGroup *NextSibling() const;
       
    65 	CWsRootWindow *Parent() const;
       
    66 	virtual void AreaCovered(TRegion &aRegion);
       
    67 	void UpdateOrdinalPriority(TBool aDoAdjust);
       
    68 	void LostFocus();
       
    69 	void ReceivedFocus();
       
    70 	inline RWsTextCursor *TextCursor();
       
    71 	inline TBool ReceivesFocus() const;
       
    72 	static TInt NumWindowGroups(TBool aAllPriorities, TInt aPriority);
       
    73 	static TInt SendWindowGroupListAndChainL(TBool aAllPriorities, TInt aPriority, TInt aCount);
       
    74 	static TBool SendEventToAllGroups(TBool aAllPriorities,TBool aOnePerClient,const TWsClCmdSendEventToWindowGroup& aData);
       
    75 	static void SendMessageToAllGroupsL(CWsClient& aSender,TBool aAllPriorities,const TWsClCmdSendMessageToWindowGroup& aData);
       
    76 	static void GetFocusWindowGroupL();
       
    77 	static void ReleasePendedMessagesToAllGroups(CWsClient * aClient);
       
    78 	virtual void SetOrdinalPosition(TInt pos);
       
    79 	TBool SetOrdinalPosition(TInt pos,CWsWindowGroup *aClosingWindow);
       
    80 	void SetOrdinalPriority(TInt aPos, TInt aPriority);
       
    81 	void QueueMessageL(TUid aUid, TInt aDataLength, CWsClient& aSender);
       
    82 	void AddPriorityKeyL(TUint aKeycode, TUint aModifierMask, TUint aModifiers);
       
    83 	void RemovePriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifiers);
       
    84 	void RemoveAllPriorityKeys();
       
    85 	TBool CheckForPriorityKey(const TKeyData &aKey, TInt aScanCode);
       
    86 	inline CWsPointerCursor *GroupPointerCursor() const;
       
    87 	static CWsWindowGroup *WindowGroupFromIdentifier(TInt aIdentifier);
       
    88 	static CWsWindowGroup *WindowGroupFromIdentifierL(TInt aIdentifier);
       
    89 	static CWsWindowGroup *FindWindowGroupL(CWsClient* aClient,TInt aIdentifier,TInt aOffset,const TPtrC *aMatch,const TThreadId *aThreadId);
       
    90 	inline HBufC *GroupName();
       
    91 	inline void SetNextDefaultOwningWindow(CWsWindowGroup *aNext);
       
    92 	inline CWsWindowGroup **NextDefaultOwningWindowPtr();
       
    93 	void SetScreenDeviceValidState(const DWsScreenDevice *aDevice);
       
    94 	void SetScreenChangeEventStateL(TBool aEnabled);
       
    95 	TBool ScreenDeviceValid() const;
       
    96 	TBool CanReceiveFocus() const;
       
    97 	static void SetScreenDeviceValidStates(const DWsScreenDevice *aDevice);
       
    98 	static void SetScreenDeviceValidStates(CScreen* aScreen);
       
    99 	static void NewOrientation(TInt aMode,CFbsBitGc::TGraphicsOrientation aRotation, CWsRootWindow* aRootWindow);
       
   100 	inline DWsScreenDevice *Device();
       
   101 	void FetchMessageL();
       
   102 	static inline void SetFocusGainPreprocessing(TBool aDo);
       
   103 	TBool IsChained(TInt& aParentId);
       
   104 	inline TInt NumWindowGroupsOnMyScreen(TInt aPriority);
       
   105 	static TInt NumWindowGroupsOnScreen(const CWsWindowGroup* aGroupWin,TBool aAllPriorities,TInt aPriority);
       
   106 	inline void SetScreenDeviceDeleted();
       
   107 	inline TBool ScreenDeviceDeleted() const;
       
   108 	static TInt SendWindowGroupListL(TInt aScreenNumber, TBool aAllPriorities, TInt aPriority, TInt aCount);
       
   109 	static void GetFocusWindowGroupL(TInt aScreenNumber);
       
   110 	void SetScreenDevice(DWsScreenDevice *aDevice);
       
   111 	static void SetEventQueueTestState(TBool aEventQueState);
       
   112 	TBool HasVisibleTranslucentChild();
       
   113 	void  ReleasePendedMessage();
       
   114 private:
       
   115 	void SwitchToOwningWindow(CWsWindowGroup *aClosingWindow);
       
   116 	void MoveChainedWindows(TDblQueIter<CWsWindowGroup>& aIter,TBool aForward,TInt aPos,CWsWindowGroup* aClosingWindow);
       
   117 	TBool DoSetOrdinalPosition1(TInt aPos,CWsWindowGroup *aClosingWindow);
       
   118 	void DoSetOrdinalPosition2(TInt aPos,CWsWindowGroup *aClosingWindow);
       
   119 	TBool SignalMessageReady();
       
   120 	static void AdvanceIdentifierCount();
       
   121 	void StatusDump(TDes &aBuf);
       
   122 	void PurgeCapturedKeys();
       
   123 	inline void UpdateKeyClickState();
       
   124 	void ResetFocus(CWsWindowGroup *aClosingWindow);
       
   125 	static TInt GetWindowGroupListL(TInt aScreenNo,TBool aAllPriorities,TInt aPriority,TInt aCount,CArrayFixFlat<TInt>* aList);	
       
   126 	inline CWsWindowGroup* BeforeInChain();
       
   127 	static void GetWindowGroupListAndChainL(TInt aScreen,TBool aAllPriorities,TInt aPriority
       
   128 																,RArray<RWsSession::TWindowGroupChainInfo>& list,TInt& aCountLeft);
       
   129 	TBool CheckCapability(TInt& aOrdinalPriority);
       
   130 	void DeleteQueue(TDblQue<CWsWindowGroup>* aQueue);
       
   131 	TInt NumClientWindowGroups();
       
   132 	void DisconnectFloatingSprites();
       
   133 private:
       
   134 	RWsTextCursor iTextCursor;
       
   135 	TInt iFlags;
       
   136 	TInt iOrdinalPriorityBase;
       
   137 	TInt iOrdinalPriorityAdjust;
       
   138 	TPriorityKey *iPriorityKeys;
       
   139 	TInt iOwningWindowGroup;
       
   140 	HBufC *iGroupName;
       
   141 	TInt iIdentifier;
       
   142 	CWsWindowGroup *iNextDefaultOwningWindow;
       
   143 	CArrayVarSeg<TWsMessage> *iMessageArray;
       
   144 	static TInt iIdentifierCount;
       
   145 	DWsScreenDevice *iScreenDevice;
       
   146 	static RPointerArray< TDblQue<CWsWindowGroup> > iChains;
       
   147 	TDblQue<CWsWindowGroup>* iQueue;
       
   148 	TDblQueLink iChainLink;
       
   149 	TUint32 iChildSID;
       
   150 	static TBool iFocusGainPreProcess;		//'REMOVEFADINGONFOCUSGAIN' flag in INI file
       
   151 	// used for eventqueue testing
       
   152 #if defined(_DEBUG)
       
   153 	static TInt iSkipCount;
       
   154 #endif
       
   155 	static TBool iEventQueueTest;
       
   156 	friend class TWsPointer;
       
   157 	};
       
   158 
       
   159 inline CWsTopClientWindow *CWsWindowGroup::Child() const
       
   160 	{
       
   161 	return (CWsTopClientWindow *)iChild;
       
   162 	}
       
   163 
       
   164 inline CWsWindowGroup *CWsWindowGroup::NextSibling() const
       
   165 	{
       
   166 	return (CWsWindowGroup *)iSibling;
       
   167 	}
       
   168 
       
   169 inline CWsWindowGroup *CWsWindowGroup::PrevSibling() const
       
   170 	{
       
   171 	return (CWsWindowGroup *)GetPrevSibling();
       
   172 	}
       
   173 
       
   174 inline CWsRootWindow *CWsWindowGroup::Parent() const
       
   175 	{
       
   176 	return (CWsRootWindow *)iParent;
       
   177 	}
       
   178 
       
   179 inline TBool CWsWindowGroup::ReceivesFocus() const
       
   180 	{
       
   181 	return(iFlags&EGroupFlagReceivesFocus);
       
   182 	}
       
   183 
       
   184 inline RWsTextCursor *CWsWindowGroup::TextCursor()
       
   185 	{
       
   186 	return &iTextCursor;
       
   187 	}
       
   188 
       
   189 inline HBufC *CWsWindowGroup::GroupName()
       
   190 	{
       
   191 	return iGroupName;
       
   192 	}
       
   193 
       
   194 inline void CWsWindowGroup::SetNextDefaultOwningWindow(CWsWindowGroup *aNext)
       
   195 	{
       
   196 	iNextDefaultOwningWindow=aNext;
       
   197 	}
       
   198 
       
   199 inline CWsWindowGroup **CWsWindowGroup::NextDefaultOwningWindowPtr()
       
   200 	{
       
   201 	return &iNextDefaultOwningWindow;
       
   202 	}
       
   203 
       
   204 /**
       
   205 @return A pointer to the DWsScreenDevice used by this window-group, or 
       
   206 		NULL when there is no DWsScreenDevice used by the window-group.
       
   207 */
       
   208 inline DWsScreenDevice *CWsWindowGroup::Device()
       
   209 	{
       
   210 	return iScreenDevice;
       
   211 	}
       
   212 
       
   213 inline void CWsWindowGroup::SetFocusGainPreprocessing(TBool aDo)
       
   214 	{
       
   215 	iFocusGainPreProcess=aDo;
       
   216 	}
       
   217 
       
   218 inline void CWsWindowGroup::SetScreenDeviceDeleted()
       
   219 	{
       
   220 	iFlags|=EGroupFlagScreenDeviceDeleted;
       
   221 	iScreenDevice = NULL; //  PDEF100409
       
   222 	}
       
   223 
       
   224 inline TBool CWsWindowGroup::ScreenDeviceDeleted() const
       
   225 	{
       
   226 	return (iFlags&EGroupFlagScreenDeviceDeleted);
       
   227 	}
       
   228 
       
   229 #endif