1.1 --- a/epoc32/include/gulbordr.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,348 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#if !defined(__GULBORDR_H__)
1.20 -#define __GULBORDR_H__
1.21 -
1.22 -#if !defined(__E32DEF_H__)
1.23 -#include <e32def.h>
1.24 -#endif
1.25 -
1.26 -#if !defined(__GULDEF_H__)
1.27 -#include <guldef.h>
1.28 -#endif
1.29 -
1.30 -#if !defined(__GDI_H__)
1.31 -#include <gdi.h>
1.32 -#endif
1.33 -
1.34 -
1.35 -class TGulBorder
1.36 -/** Draws a border around a control.
1.37 -
1.38 -The rectangular areas enclosed by borders are typically working areas of the
1.39 -graphics context so the class supplies a number of methods which describe
1.40 -how it occupies the area.
1.41 -
1.42 -A distinction between descriptive and logical borders is made. For descriptive
1.43 -borders the appearance of the border is known and fixed. The type of border
1.44 -drawn is determined by flags which describe how it is to be constructed. These
1.45 -flags can be combined to achieve many different effects, and standard combinations
1.46 -have been supplied (see the TBorderType enumeration). For logical borders
1.47 -the use of the border is known and fixed but the appearance is not specified.
1.48 -The appearance and sizing functions must be supplied in custom written code.
1.49 -@publishedAll
1.50 -@released*/
1.51 - {
1.52 -public:
1.53 - class TColors
1.54 - /** Represents the colours used within the border and for the optional single pixel
1.55 - border outlines.
1.56 -
1.57 - These colours are stored using TRgb values.
1.58 -
1.59 - An object of this type can be populated using ColorUtils::GetRgbDerivedBorderColors().
1.60 -
1.61 - The colours used inside the border are derived from iBack, the border's background
1.62 - colour, so that border colours can be lighter or darker shades of the colour
1.63 - used in the main body of the control they enclose. Different combinations
1.64 - of light and dark shades are used to draw opposite border sides, to achieve
1.65 - a raised or sunken effect. */
1.66 - {
1.67 - public:
1.68 - IMPORT_C TColors();
1.69 - public:
1.70 - /** The line colour.
1.71 -
1.72 - This is the colour used to draw the outlines on either side of the border.
1.73 - Not all border types have an outline. By default, KRgbBlack. */
1.74 - TRgb iLine;
1.75 - /** The background colour for the border.
1.76 -
1.77 - The other colours used in the border are derived from this.
1.78 -
1.79 - By default, KRgbWhite. */
1.80 - TRgb iBack;
1.81 - /** The lightest colour.
1.82 -
1.83 - By default, KRgbWhite. */
1.84 - TRgb iLight;
1.85 - /** The mid light colour.
1.86 -
1.87 - This colour is midway between iBack and iLight. By default, KRgbWhite. */
1.88 - TRgb iMidlight;
1.89 - /** The mid dark colour.
1.90 -
1.91 - This colour is midway between iBack and iDark. By default, KRgbDarkGray. */
1.92 - TRgb iMid;
1.93 - /** The darkest colour.
1.94 -
1.95 - By default, KRgbDarkGray. */
1.96 - TRgb iDark;
1.97 - /** Not used. */
1.98 - TRgb iInternalBack;
1.99 - };
1.100 -
1.101 -public:
1.102 - /** Defines the border outline style.
1.103 -
1.104 - Note that not all border types have an outline. */
1.105 - enum TOutlineStyle
1.106 - {
1.107 - /** The border has a single pixel outline, either solid (by default) or dotted. */
1.108 - EWithOutline=0x01,
1.109 - /** The border outline is drawn using a dotted pen. */
1.110 - EDottedOutline=0x02
1.111 - };
1.112 -
1.113 - /** Defines whether or not the border has a single pixel interior border.
1.114 -
1.115 - By default it does not. */
1.116 - enum TInlineStyle
1.117 - {
1.118 - /** The border has an interior border. */
1.119 - EWithInline=0x04
1.120 - };
1.121 -
1.122 - /** Defines the 3D border style. */
1.123 - enum T3DStyle
1.124 - {
1.125 - /** A flat border. */
1.126 - EFlat=0x10,
1.127 - /** A 3D effect sunken border. */
1.128 - ESunken=0x20,
1.129 - /** A 3D effect raised border. */
1.130 - ERaised=0x40
1.131 - };
1.132 -
1.133 - /** Defines the border's construction style. */
1.134 - enum TConstructionStyle
1.135 - {
1.136 - /** One step border construction.
1.137 -
1.138 - This type of border is drawn using the mid light and mid dark colours on opposite
1.139 - sides of the border. */
1.140 - EOneStep=0x100,
1.141 - /** Two step border construction.
1.142 -
1.143 - This type of border uses light and dark colours for the main border frame
1.144 - (or mid light for the flat border), and an additional half frame using mid
1.145 - light or mid dark colours. */
1.146 - ETwoStep=0x200,
1.147 - /** Three step border construction.
1.148 -
1.149 - This type of border is drawn with an outer frame, a repeating one pixel band
1.150 - in mid tones, and an inner frame. */
1.151 - EThreeStep=0x400,
1.152 - /** Inverted two step border construction.
1.153 -
1.154 - This is the same as ETwoStep except that for raised and sunken borders, the
1.155 - additional half frame is drawn on the opposite side to that used in ETwoStep. */
1.156 - EInvertedTwoStep=0x800
1.157 - };
1.158 -
1.159 - /** Defines the number of pixels to add to the border thickness.
1.160 -
1.161 - The border thickness is the central part of the border, coloured in the mid-tone
1.162 - highlights and lowlights.
1.163 -
1.164 - For two step-constructed borders, the additional pixels are only added to
1.165 - either the top left or bottom right hand sides. */
1.166 - enum TThickness
1.167 - {
1.168 - /** The border has one extra pixel. */
1.169 - EAddOnePixel=0x1000,
1.170 - /** The border has two extra pixels. */
1.171 - EAddTwoPixels=0x2000,
1.172 - /** The border has four extra pixels. */
1.173 - EAddFourPixels=0x4000
1.174 - };
1.175 -
1.176 - /** Defines the number of pixels that are removed to produce rounded corners. */
1.177 - enum TRounding
1.178 - {
1.179 - /** Border rounded by removing one extra pixel. */
1.180 - EAddOneRoundingPixel=0x10000,
1.181 - /** Border rounded by removing two extra pixels. */
1.182 - EAddTwoRoundingPixels=0x20000,
1.183 - /** Border rounded by by removing four extra pixels. */
1.184 - EAddFourRoundingPixels=0x40000
1.185 - };
1.186 -private:
1.187 - enum TNull
1.188 - {
1.189 - ENoBorder=0x00
1.190 - };
1.191 -
1.192 - enum TLegacyStyle
1.193 - {
1.194 - EShallow=EAddOnePixel,
1.195 - EDeep=EAddTwoPixels,
1.196 - EThick=EAddFourPixels,
1.197 - EHorizontal=0x100000,
1.198 - EWithOverlap=0x200000,
1.199 - EGray=0x400000,
1.200 - EBlack=0x80000
1.201 - };
1.202 -
1.203 - enum TLogicalStyle
1.204 - {
1.205 - ELogical=0x800000
1.206 - };
1.207 -public:
1.208 - /** For logical borders, defines whether the border encloses a window, a container
1.209 - control or a control. */
1.210 - enum TLogicalFamily
1.211 - {
1.212 - /** Logical border around a window. */
1.213 - EWindowFamily=ELogical|0x1,
1.214 - /** Logical border around a container. */
1.215 - EContainerFamily=ELogical|0x2,
1.216 - /** Logical border around a control. */
1.217 - EControlFamily=ELogical|0x3
1.218 - };
1.219 -public:
1.220 - /** Defines the descriptive border types. */
1.221 - enum TBorderType
1.222 - {
1.223 - /** No border. */
1.224 - ENone=ENoBorder,
1.225 - /** Border is a 1 pixel wide grey outline. */
1.226 - ESingleGray=EWithOutline|EGray,
1.227 - /** Border is a 1 pixel wide black outline. */
1.228 - ESingleBlack=EWithOutline|EBlack,
1.229 - /** Border is a 1 pixel wide dotted outline. */
1.230 - ESingleDotted=EWithOutline|EDottedOutline,
1.231 - /** A 3D raised border, with 1 pixel thickness. */
1.232 - EShallowRaised=ERaised|EOneStep|EAddOnePixel,
1.233 - /** A 3D sunken border, with 1 pixel thickness. */
1.234 - EShallowSunken=ESunken|EOneStep|EAddOnePixel,
1.235 - /** A 3D raised border, with outline, and 2 pixel thickness. */
1.236 - EDeepRaised=EWithOutline|ERaised|EOneStep|EAddTwoPixels,
1.237 - /** The same as EDeepRaised. */
1.238 - EDeepRaisedWithOutline=EWithOutline|ERaised|EOneStep|EAddTwoPixels,
1.239 - /** A 3D sunken border, with outline, and 2 pixel thickness. */
1.240 - EDeepSunken=EWithOutline|ESunken|EOneStep|EAddTwoPixels,
1.241 - /** The same as EDeepSunken. */
1.242 - EDeepSunkenWithOutline=EWithOutline|ESunken|EOneStep|EAddTwoPixels,
1.243 - /** A 3D raised border, with outline, and 3 pixel thickness. */
1.244 - EThickDeepRaisedWithOutline=EWithOutline|ERaised|EOneStep|EAddOnePixel|EAddTwoPixels,
1.245 - /** A 3D raised border, with 2 pixels thickness and no outline on the left and
1.246 - right hand sides. */
1.247 - EVerticalBar=ERaised|EOneStep|EAddTwoPixels|EWithOverlap,
1.248 - /** A 3D raised border, with 2 pixels thickness and no outline on the top and bottom. */
1.249 - EHorizontalBar=ERaised|EOneStep|EAddTwoPixels|EHorizontal|EWithOverlap
1.250 - };
1.251 -
1.252 - /** Defines the logical border types. */
1.253 - enum TLogicalType
1.254 - {
1.255 - // Window family
1.256 - /** Raised border around a window. */
1.257 - EWindow=EWindowFamily|ERaised,
1.258 - // Container family
1.259 - /** Flat border around a container. */
1.260 - EFlatContainer=EContainerFamily|EFlat,
1.261 - /** Raised border around a container. */
1.262 - ERaisedContainer=EContainerFamily|ERaised,
1.263 - /** Sunken border around a container. */
1.264 - ESunkenContainer=EContainerFamily|ESunken,
1.265 - // Control Family
1.266 - /** Flat border around a control. */
1.267 - EFlatControl=EControlFamily|EFlat,
1.268 - /** Raised border around a control. */
1.269 - ERaisedControl=EControlFamily|ERaised,
1.270 - /** Sunken border around a control. */
1.271 - ESunkenControl=EControlFamily|ESunken,
1.272 - /** Raised border around a control with focus. */
1.273 - EFocusedRaisedControl=EControlFamily|ERaised|0x100,
1.274 - /** Sunken border around a control with focus. */
1.275 - EFocusedSunkenControl=EControlFamily|ESunken|0x100
1.276 - };
1.277 -
1.278 -public:
1.279 - IMPORT_C TGulBorder();
1.280 - IMPORT_C TGulBorder(TBorderType aType);
1.281 - IMPORT_C TGulBorder(TBorderType aType,TGulAdjacent aAdjacent);
1.282 - IMPORT_C TGulBorder(TInt aType);
1.283 - IMPORT_C TGulBorder(TInt aType,TGulAdjacent aAdjacent);
1.284 - IMPORT_C void Draw(CGraphicsContext& aGc,const TRect& aRect,const TColors& aBorderColors) const;
1.285 - IMPORT_C void Draw(CGraphicsContext& aGc,const TRect& aRect) const;
1.286 - IMPORT_C TRect InnerRect(const TRect& aOuterRect) const;
1.287 - IMPORT_C TRect OuterRect(const TRect& aInnerRect) const;
1.288 - IMPORT_C void SetType(TInt aType);
1.289 - IMPORT_C void SetAdjacent(TInt aAdjacent);
1.290 - IMPORT_C TSize SizeDelta() const;
1.291 - IMPORT_C TMargins Margins() const;
1.292 - IMPORT_C TBool HasBorder() const;
1.293 - IMPORT_C TInt Adjacent() const;
1.294 - IMPORT_C TInt Type() const;
1.295 -public: // Internal to Symbian
1.296 - IMPORT_C TInt Thickness() const;
1.297 - IMPORT_C TInt Rounding() const;
1.298 -private:
1.299 - TBool IsSunken() const;
1.300 - TInt Depth() const;
1.301 - void DrawOutline(CGraphicsContext& aGc,const TRect& aRect,TRgb aColor) const;
1.302 - void DrawRectOutline(CGraphicsContext& aGc,const TRect& aRect) const;
1.303 - void DrawInline(CGraphicsContext& aGc,const TRect& aRect,TRgb aColor) const;
1.304 - TMargins OutlineMargins() const;
1.305 - TMargins BorderMargins() const;
1.306 - TMargins InlineMargins() const;
1.307 - TRect OutlineInnerRect(const TRect& aOuterRect) const;
1.308 - TRect BorderInnerRect(const TRect& aOuterRect) const;
1.309 - TInt BorderRounding() const;
1.310 - TInt InlineRounding() const;
1.311 - void DrawOneStep(CGraphicsContext& aGc,const TRect& aRect,TRgb aMidlight,TRgb aMid) const;
1.312 - void DrawTwoStep(CGraphicsContext& aGc,const TRect& aRect,TRgb aLight,TRgb aMidlight,TRgb aMid,TRgb aDark) const;
1.313 - void DrawInvertedTwoStep(CGraphicsContext& aGc,const TRect& aRect,TRgb aLight,TRgb aMidlight,TRgb aMid,TRgb aDark) const;
1.314 - void DrawThreeStep(CGraphicsContext& aGc,const TRect& aRect,TRgb aBack,TRgb aLight,TRgb aMidlight,TRgb aMid,TRgb aDark) const;
1.315 - void DrawTopLeft(CGraphicsContext& aGc,const TRect& aRect,TRgb aColor,const TInt aRounding) const;
1.316 - void DrawRoundedTopLeft(CGraphicsContext& aGc,const TRect& aRect,const TInt aRounding) const;
1.317 - void DrawBottomRight(CGraphicsContext& aGc,const TRect& aRect,TRgb aColor,const TInt aRounding) const;
1.318 - void DrawRoundedBottomRight(CGraphicsContext& aGc,const TRect& aRect,const TInt aRounding) const;
1.319 - void DrawRoundedCorner(CGraphicsContext& aGc,const TPoint& aStart,const TInt aRoundedLength, const TBool aUp, const TBool aRight) const;
1.320 - TInt RoundingMargin(const TInt aRoundedLength) const;
1.321 - inline TInt InternalType() const;
1.322 - void TranslateLegacyTypes();
1.323 -private:
1.324 - TInt iType;
1.325 - };
1.326 -
1.327 -/**
1.328 -The MGulLogicalBorder class specifices an interface for logical borders.
1.329 -
1.330 -@internalTechnology*/
1.331 -class MGulLogicalBorder
1.332 - {
1.333 -public:
1.334 - virtual void Draw(const TGulBorder& aBorder,CGraphicsContext& aGc, const TRect& aRect, const TGulBorder::TColors& aBorderColors) const=0;
1.335 - virtual TMargins Margins(const TGulBorder& aBorder) const=0;
1.336 -private:
1.337 - IMPORT_C virtual void MGulLogicalBorderReserved();
1.338 - };
1.339 -
1.340 -/**
1.341 -The GulTls class sets and gets the thread local storage for EGul.
1.342 -
1.343 -@internalTechnology*/
1.344 -class GulTls
1.345 - {
1.346 -public:
1.347 - IMPORT_C static void SetLogicalBorder(MGulLogicalBorder* aLogicalBorder);
1.348 - IMPORT_C static const MGulLogicalBorder* LogicalBorder();
1.349 - };
1.350 -
1.351 -#endif