epoc32/include/coeccntx.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/coeccntx.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/coeccntx.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,119 @@
     1.4 -coeccntx.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __COECCNTX_H__
    1.21 +#define __COECCNTX_H__
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +#include <e32base.h>
    1.25 +#include <w32std.h>
    1.26 +
    1.27 +/** Interface to allow sharing of graphics settings between controls. 
    1.28 +
    1.29 +The interface provides functions to set the graphics context of a control 
    1.30 +before drawing. If a control has its iContext member set, the UI Control Framework 
    1.31 +calls functions defined by this interface when a control is about to be drawn. 
    1.32 +Developers must implement PrepareContext(), which is called by the framework, 
    1.33 +to initialise the control's window with the required graphics settings.
    1.34 +
    1.35 +To use control contexts, a control should inherit from an MCoeControlContext-derived 
    1.36 +class. To share the context between controls, this control should then be 
    1.37 +set as the context for all controls that wish to share it. This is done by 
    1.38 +setting the iContext member of each of the controls, using CCoeControl::SetControlContext() 
    1.39 +and CCoeControl::CopyControlContextFrom(). 
    1.40 +
    1.41 +@publishedAll 
    1.42 +@released */
    1.43 +class MCoeControlContext
    1.44 +	{
    1.45 +public:
    1.46 +	IMPORT_C virtual void ActivateContext(CWindowGc& aGc,RDrawableWindow& aWindow) const;
    1.47 +	IMPORT_C virtual void ResetContext(CWindowGc& aGc) const;
    1.48 +	IMPORT_C virtual void PrepareContext(CWindowGc& aGc) const;
    1.49 +protected:
    1.50 +	IMPORT_C MCoeControlContext();
    1.51 +	
    1.52 +private:
    1.53 +	IMPORT_C virtual void MCoeControlContext_Reserved1();	
    1.54 +	IMPORT_C virtual void MCoeControlContext_Reserved2();
    1.55 +	
    1.56 +private:
    1.57 +	TInt iMCoeControlContext_Reserved1;
    1.58 +	};
    1.59 +
    1.60 +/** Brush and pen graphics context. 
    1.61 +
    1.62 +This class allows an MCoeControlContext to be instantiated and used to set 
    1.63 +brush and pen properties before drawing a control. 
    1.64 +
    1.65 +@publishedAll 
    1.66 +@released */
    1.67 +class CCoeBrushAndPenContext : public CBase, public MCoeControlContext
    1.68 +	{
    1.69 +public:
    1.70 +	IMPORT_C static CCoeBrushAndPenContext* NewL();
    1.71 +	//
    1.72 +	IMPORT_C void SetBrushStyle(CWindowGc::TBrushStyle aBrushStyle);
    1.73 +	IMPORT_C void SetBrushColor(TRgb aColor);
    1.74 +	IMPORT_C void SetBrushBitmap(const CFbsBitmap& aBitmap);
    1.75 +	IMPORT_C void SetPenColor(TRgb aColor);
    1.76 +	//
    1.77 +	IMPORT_C CWindowGc::TBrushStyle BrushStyle() const;
    1.78 +	IMPORT_C TRgb BrushColor() const;
    1.79 +	IMPORT_C const CFbsBitmap& BrushBitmap() const;
    1.80 +	IMPORT_C TRgb PenColor() const;
    1.81 +protected: // from MCoeControlContext
    1.82 +	IMPORT_C void PrepareContext(CWindowGc& aGc) const;
    1.83 +private:
    1.84 +	CCoeBrushAndPenContext();
    1.85 +private:
    1.86 +	CWindowGc::TBrushStyle iBrushStyle;
    1.87 +	TRgb iBrushColor;
    1.88 +	const CFbsBitmap* iBitmap;
    1.89 +	TRgb iPenColor;
    1.90 +	};
    1.91 +
    1.92 +
    1.93 +/** Protocol for sharing brush settings used in graphics operations. 
    1.94 +
    1.95 +It can be used to set brush and pen properties before drawing a control.
    1.96 +
    1.97 +The mixin provides a default implementation of a control context. It implements 
    1.98 +PrepareContext() to initialise brush settings used in graphics operations. 
    1.99 +Its data members are public so that the brush style, brush colour and brush 
   1.100 +pattern can be set by application code.
   1.101 +
   1.102 +@publishedAll
   1.103 +@deprecated */
   1.104 +class MCoeControlBrushContext : public MCoeControlContext
   1.105 +	{
   1.106 +public:
   1.107 +	/** Cause vtable & typeinfo to be exported */
   1.108 +	IMPORT_C MCoeControlBrushContext();
   1.109 +protected: // from MCoeControlContext
   1.110 +	IMPORT_C void PrepareContext(CWindowGc& aGc) const;
   1.111 +public:
   1.112 +	/** Brush style. (Not required if iBitmap is set.) */
   1.113 +	CWindowGc::TBrushStyle iBrushStyle;
   1.114 +	/** Brush colour. (Not required if iBitmap is set.) */
   1.115 +	TRgb iBrushColor;
   1.116 +	/** Brush pattern. */
   1.117 +	const CFbsBitmap* iBitmap;
   1.118 +
   1.119 +private:
   1.120 +	TInt iMCoeControlBrushContext_Reserved1;
   1.121 +	};
   1.122 +
   1.123 +#endif