lafagnosticuifoundation/cone/src/COECNTRL.CPP
changeset 22 75713bee6484
parent 0 2f259fa3e83a
equal deleted inserted replaced
21:558113899881 22:75713bee6484
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    67 	{
    67 	{
    68 public:
    68 public:
    69 	inline CCoeControlStorage();
    69 	inline CCoeControlStorage();
    70 	inline RCoeDynamicDataStorage& DynamicDataStorage();
    70 	inline RCoeDynamicDataStorage& DynamicDataStorage();
    71 	inline const RCoeDynamicDataStorage& DynamicDataStorage() const;
    71 	inline const RCoeDynamicDataStorage& DynamicDataStorage() const;
    72 	inline void Open();
    72 	inline TInt Open();
    73 	inline void Close();
    73 	inline void Close();
    74 	inline void AttemptCompress();
    74 	inline void AttemptCompress();
    75 	void SetPointerGrab(TUint aSet, TUint aClear);
    75 	void SetPointerGrab(TUint aSet, TUint aClear);
    76 	TUint8& PointerGrab();
    76 	TUint8& PointerGrab();
    77 	
    77 
    78 private:
    78 private:
    79 	RCoeDynamicDataStorage iDynamicDataStorage;
    79 	RCoeDynamicDataStorage iDynamicDataStorage;
    80 	TUint8 iPointerGrabFlags; // The grab-status of each of the supported pointers
    80 	TUint8 iPointerGrabFlags; // The grab-status of each of the supported pointers
    81 	};
    81 	};
    82 
    82 
   101 	{ return iDynamicDataStorage; }
   101 	{ return iDynamicDataStorage; }
   102 
   102 
   103 inline const RCoeDynamicDataStorage& CCoeControlStorage::DynamicDataStorage() const
   103 inline const RCoeDynamicDataStorage& CCoeControlStorage::DynamicDataStorage() const
   104 	{ return iDynamicDataStorage; }
   104 	{ return iDynamicDataStorage; }
   105 
   105 
   106 inline void CCoeControlStorage::Open()
   106 inline TInt CCoeControlStorage::Open()
   107 	{ iDynamicDataStorage.Open(); }
   107 	{ return iDynamicDataStorage.Open(); }
   108 
   108 
   109 inline void CCoeControlStorage::Close()
   109 inline void CCoeControlStorage::Close()
   110 	{ iDynamicDataStorage.Close(); }
   110 	{ iDynamicDataStorage.Close(); }
   111 
   111 
   112 inline void CCoeControlStorage::AttemptCompress()
   112 inline void CCoeControlStorage::AttemptCompress()
   119 
   119 
   120 Note: CCoeControl is normally used as a base class from which concrete 
   120 Note: CCoeControl is normally used as a base class from which concrete 
   121 control classes are derived. However, it can also be instantiated as a concrete 
   121 control classes are derived. However, it can also be instantiated as a concrete 
   122 class. */
   122 class. */
   123 	{
   123 	{
   124 	iCoeEnv = TheCoe();
   124 	Constructor(TheCoe());
   125 	
       
   126 	iData = new CCoeControlStorage;		// Non-leaving allocation
       
   127 	if (iData)
       
   128 		{
       
   129 		iData->Open();
       
   130 		}
       
   131 	else 
       
   132 		{
       
   133 		iFlags |= EMemoryAllocationFailed;	// Handle OOM later
       
   134 		}
       
   135 	
       
   136 	SetFocusing(CCoeControlStaticSettings::FocusedByDefault(iCoeEnv));	
       
   137 	}
   125 	}
   138 
   126 
   139 EXPORT_C CCoeControl::CCoeControl(CCoeEnv* aCoeEnv)
   127 EXPORT_C CCoeControl::CCoeControl(CCoeEnv* aCoeEnv)
   140 /** C++ constructor. 
   128 /** C++ constructor. 
   141 
   129 
   145 control classes are derived. However, it can also be instantiated as a concrete 
   133 control classes are derived. However, it can also be instantiated as a concrete 
   146 class. 
   134 class. 
   147 
   135 
   148 @param aCoeEnv The control environment.*/
   136 @param aCoeEnv The control environment.*/
   149 	{
   137 	{
       
   138 	Constructor(aCoeEnv);
       
   139 	}
       
   140 
       
   141 void CCoeControl::Constructor(CCoeEnv* aCoeEnv)
       
   142 	{
   150 	iCoeEnv = aCoeEnv;
   143 	iCoeEnv = aCoeEnv;
   151 	
   144 
   152 	iData = new CCoeControlStorage;		// Non-leaving allocation
   145 	iData = new CCoeControlStorage;		// Non-leaving allocation
   153 	if(iData)
   146 	if (!iData || iData->Open()!=KErrNone)
   154 		iData->Open();
       
   155 	else 
       
   156 		iFlags |= EMemoryAllocationFailed;	// Handle OOM later
   147 		iFlags |= EMemoryAllocationFailed;	// Handle OOM later
   157 	
   148 
   158 	SetFocusing(CCoeControlStaticSettings::FocusedByDefault(iCoeEnv));
   149 	SetFocusing(CCoeControlStaticSettings::FocusedByDefault(iCoeEnv));
   159 	}
   150 	}
   160 
   151 
   161 EXPORT_C CCoeControl::~CCoeControl()
   152 EXPORT_C CCoeControl::~CCoeControl()
   162 /** Destructor. 
   153 /** Destructor.