williamr@4: /* williamr@4: * Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: williamr@4: * FORM global parameters; held in thread-local storage. williamr@4: * williamr@4: */ williamr@4: williamr@2: williamr@2: #ifndef __FRMPARAM_H__ williamr@2: #define __FRMPARAM_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: williamr@2: /** williamr@2: Specifies the protocol for getting system colours for use in text views. A williamr@2: class which implements this protocol allows an application (or a thread, williamr@2: because a pointer to the object is held in thread-local storage) to use system williamr@2: colours in text views. williamr@2: williamr@2: You should create an object of an MFormParam-derived class which implements the williamr@2: SystemColor() function. Then, pass a pointer to the object to the static williamr@2: function MFormParam::Set(). The MFormParam-derived object is owned by the williamr@2: caller of Set(). When system colours are no longer needed, you should cancel williamr@2: them by calling MFormParam::Set(NULL). It is the caller's responsibility to williamr@2: cause the text view to be redrawn after system colours are changed. williamr@2: williamr@2: CTextLayout uses the colour translation function SystemColor() (if an williamr@2: MFormParam-derived object is present) to set the pen and brush colours for williamr@2: drawing components of the text view. It calls MFormParam::Get() before each williamr@2: draw. This enables an application to introduce system colours, change the williamr@2: parameter object, or abolish system colours, and redraw everything correctly; williamr@2: no information is left over from the last draw. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class MFormParam williamr@2: williamr@2: { williamr@2: public: williamr@2: williamr@2: /** Translates 8-bit logical colour indices to physical colours pure williamr@2: virtual function. williamr@2: williamr@2: The colour index is stored in a TLogicalRgb object and is returned by williamr@2: TLogicalRgb::SystemColorIndex(). williamr@2: williamr@2: There are three reserved index values: williamr@2: williamr@2: Zero means the logical colour does not map to a system colour: the logical williamr@2: colour is in fact an ordinary TRgb. This function should not normally be williamr@2: called with this value. williamr@2: williamr@2: 254 and 255 are default foreground and background colours respectively, and williamr@2: should be converted to the GUI's standard foreground and background colours williamr@2: williamr@2: The values 1-253 are reserved for the use of the GUI and can be interpreted williamr@2: as convenient. These can be interpreted as williamr@2: TLogicalColor::EColorWindowBackground upward; this mapping can be done by williamr@2: subtracting one from the index number aColorIndex. williamr@2: williamr@2: @param aColorIndex Logical colour index. Between 1 and 255 inclusive. williamr@2: @param aDefaultColor The default colour. This is the colour to be used if williamr@2: no translation is performed. This allows translation to change certain williamr@2: indices but not others, (by passing the default colour back unchanged). williamr@2: @return The physical colour which maps to the logical colour index. */ williamr@2: virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const = 0; williamr@2: IMPORT_C virtual void Reserved(); williamr@2: IMPORT_C static void Set(const MFormParam* aParam); williamr@2: IMPORT_C static const MFormParam* Get(); williamr@2: }; williamr@2: williamr@2: #endif // __FRMPARAM_H__