class TGulBorder |
Draws a border around a control.
The rectangular areas enclosed by borders are typically working areas of the graphics context so the class supplies a number of methods which describe how it occupies the area.
A distinction between descriptive and logical borders is made. For descriptive borders the appearance of the border is known and fixed. The type of border drawn is determined by flags which describe how it is to be constructed. These flags can be combined to achieve many different effects, and standard combinations have been supplied (see the TBorderType enumeration). For logical borders the use of the border is known and fixed but the appearance is not specified. The appearance and sizing functions must be supplied in custom written code.
Public Member Functions | |
---|---|
TGulBorder () | |
TGulBorder ( TBorderType ) | |
TGulBorder ( TBorderType , TGulAdjacent ) | |
TGulBorder ( TInt ) | |
TGulBorder ( TInt , TGulAdjacent ) | |
IMPORT_C TInt | Adjacent () |
IMPORT_C void | Draw ( CGraphicsContext &, const TRect &, const TColors &) |
IMPORT_C void | Draw ( CGraphicsContext &, const TRect &) |
IMPORT_C TBool | HasBorder () |
IMPORT_C TRect | InnerRect (const TRect &) |
IMPORT_C TMargins | Margins () |
IMPORT_C TRect | OuterRect (const TRect &) |
IMPORT_C TInt | Rounding () |
IMPORT_C void | SetAdjacent ( TInt ) |
IMPORT_C void | SetType ( TInt ) |
IMPORT_C TSize | SizeDelta () |
IMPORT_C TInt | Thickness () |
IMPORT_C TInt | Type () |
Public Member Enumerations | |
---|---|
enum | T3DStyle { EFlat = 0x10, ESunken = 0x20, ERaised = 0x40 } |
enum |
TBorderType
{
ENone = ENoBorder, ESingleGray = EWithOutline|EGray, ESingleBlack = EWithOutline|EBlack, ESingleDotted = EWithOutline|EDottedOutline, EShallowRaised = ERaised|EOneStep|EAddOnePixel, EShallowSunken = ESunken|EOneStep|EAddOnePixel, EDeepRaised = EWithOutline|ERaised|EOneStep|EAddTwoPixels, EDeepRaisedWithOutline = EWithOutline|ERaised|EOneStep|EAddTwoPixels, EDeepSunken = EWithOutline|ESunken|EOneStep|EAddTwoPixels, EDeepSunkenWithOutline = EWithOutline|ESunken|EOneStep|EAddTwoPixels, EThickDeepRaisedWithOutline = EWithOutline|ERaised|EOneStep|EAddOnePixel|EAddTwoPixels, EVerticalBar = ERaised|EOneStep|EAddTwoPixels|EWithOverlap, EHorizontalBar = ERaised|EOneStep|EAddTwoPixels|EHorizontal|EWithOverlap } |
enum | TConstructionStyle { EOneStep = 0x100, ETwoStep = 0x200, EThreeStep = 0x400, EInvertedTwoStep = 0x800 } |
enum | TInlineStyle { EWithInline = 0x04 } |
enum | TLogicalFamily { EWindowFamily = ELogical|0x1, EContainerFamily = ELogical|0x2, EControlFamily = ELogical|0x3 } |
enum |
TLogicalType
{
EWindow = EWindowFamily|ERaised, EFlatContainer = EContainerFamily|EFlat, ERaisedContainer = EContainerFamily|ERaised, ESunkenContainer = EContainerFamily|ESunken, EFlatControl = EControlFamily|EFlat, ERaisedControl = EControlFamily|ERaised, ESunkenControl = EControlFamily|ESunken, EFocusedRaisedControl = EControlFamily|ERaised|0x100, EFocusedSunkenControl = EControlFamily|ESunken|0x100 } |
enum | TOutlineStyle { EWithOutline = 0x01, EDottedOutline = 0x02 } |
enum | TRounding { EAddOneRoundingPixel = 0x10000, EAddTwoRoundingPixels = 0x20000, EAddFourRoundingPixels = 0x40000 } |
enum | TThickness { EAddOnePixel = 0x1000, EAddTwoPixels = 0x2000, EAddFourPixels = 0x4000 } |
Private Member Enumerations | |
---|---|
enum |
TLegacyStyle
{
EShallow = EAddOnePixel, EDeep = EAddTwoPixels, EThick = EAddFourPixels, EHorizontal = 0x100000, EWithOverlap = 0x200000, EGray = 0x400000, EBlack = 0x80000 } |
enum | TLogicalStyle { ELogical = 0x800000 } |
enum | TNull { ENoBorder = 0x00 } |
Private Attributes | |
---|---|
TInt | iType |
IMPORT_C | TGulBorder | ( | ) |
Default constructor.
The border type is initialised to zero (i.e. no border).
IMPORT_C | TGulBorder | ( | TBorderType | aType | ) |
Constructor with a border type.
TBorderType aType | The border type. |
IMPORT_C | TGulBorder | ( | TBorderType | aType, |
TGulAdjacent | aAdjacent | |||
) |
Constructor with a border type and an adjacency.
TBorderType aType | The border type. |
TGulAdjacent aAdjacent | Border adjacency. No outline is drawn for border sides that are adjacent. |
IMPORT_C | TGulBorder | ( | TInt | aType | ) |
Constructor with a border type, specified as a TInt.
TInt aType | The border type. Possible values are defined in the TBorderType enumeration. |
IMPORT_C | TGulBorder | ( | TInt | aType, |
TGulAdjacent | aAdjacent | |||
) |
Constructor with a border type, specified as a TInt, and a border adjacency.
TInt aType | The border type. |
TGulAdjacent aAdjacent | Border adjacency. No outline is drawn for border sides that are adjacent. |
IMPORT_C TInt | Adjacent | ( | ) | const |
Gets the border adjacency.
No outline is drawn for border sides that are adjacent.
TRect | BorderInnerRect | ( | const TRect & | aOuterRect | ) | const [private] |
const TRect & aOuterRect |
IMPORT_C void | Draw | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
const TColors & | aBorderColors | |||
) | const |
Draws the border using a graphics context, inside a containing rectangle, and using the border colours specified.
This function does nothing if the border type is ENone. If the border is a logical border, drawing is delegated to its implementation of MGulLogicalBorder::Draw() .
CGraphicsContext & aGc | The graphics context to draw through. |
const TRect & aRect | The containing rectangle. This defines the border's outline, i.e. the border is drawn inside this rectangle. |
const TColors & aBorderColors | The border colours. |
IMPORT_C void | Draw | ( | CGraphicsContext & | aGc, |
const TRect & | aRect | |||
) | const |
Draws the border using a graphics context, inside a containing rectangle, and using default values for the border colours.
For details of the default border colours, see class TColors .
This function does nothing if the border type is ENone. If the border is a logical border, drawing is delegated to its implementation of MGulLogicalBorder::Draw() .
CGraphicsContext & aGc | The graphics context to draw through. |
const TRect & aRect | The containing rectangle. This defines the border's outline, i.e. the border is drawn inside this rectangle. |
void | DrawBottomRight | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aColor, | |||
const TInt | aRounding | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
TRgb aColor | |
const TInt aRounding |
void | DrawInline | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aColor | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
TRgb aColor |
void | DrawInvertedTwoStep | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aLight, | |||
TRgb | aMidlight, | |||
TRgb | aMid, | |||
TRgb | aDark | |||
) | const [private] |
void | DrawOneStep | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aMidlight, | |||
TRgb | aMid | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
TRgb aMidlight | |
TRgb aMid |
void | DrawOutline | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aColor | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
TRgb aColor |
void | DrawRectOutline | ( | CGraphicsContext & | aGc, |
const TRect & | aRect | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect |
void | DrawRoundedBottomRight | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
const TInt | aRounding | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
const TInt aRounding |
void | DrawRoundedCorner | ( | CGraphicsContext & | aGc, |
const TPoint & | aStart, | |||
const TInt | aRoundedLength, | |||
const TBool | aUp, | |||
const TBool | aRight | |||
) | const [private] |
CGraphicsContext & aGc | |
const TPoint & aStart | |
const TInt aRoundedLength | |
const TBool aUp | |
const TBool aRight |
void | DrawRoundedTopLeft | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
const TInt | aRounding | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
const TInt aRounding |
void | DrawThreeStep | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aBack, | |||
TRgb | aLight, | |||
TRgb | aMidlight, | |||
TRgb | aMid, | |||
TRgb | aDark | |||
) | const [private] |
void | DrawTopLeft | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aColor, | |||
const TInt | aRounding | |||
) | const [private] |
CGraphicsContext & aGc | |
const TRect & aRect | |
TRgb aColor | |
const TInt aRounding |
void | DrawTwoStep | ( | CGraphicsContext & | aGc, |
const TRect & | aRect, | |||
TRgb | aLight, | |||
TRgb | aMidlight, | |||
TRgb | aMid, | |||
TRgb | aDark | |||
) | const [private] |
IMPORT_C TBool | HasBorder | ( | ) | const |
Tests whether a border is present.
No border is present if its type is ENoBorder.
IMPORT_C TRect | InnerRect | ( | const TRect & | aOuterRect | ) | const |
Returns the rectangular area enclosed by the border.
const TRect & aOuterRect | The border's containing rectangle. |
IMPORT_C TMargins | Margins | ( | ) | const |
Returns the border margins.
The border margins are four integers that represent the widths in pixels of the top, bottom, left and right hand sides of the border.
If the border is a logical border, then calculating the margins is delegated to its implementation of MGulLogicalBorder::Margins() .
Otherwise, the margins are calculated by adding together the single pixel border outline, if present (this is zero for adjacent sides), the border thickness (containing the mid-tone highlights and lowlights), and the single pixel interior outline, if present.
IMPORT_C TRect | OuterRect | ( | const TRect & | aInnerRect | ) | const |
Returns the rectangular area required to accommodate the inner rectangle aInnerRect and the border.
const TRect & aInnerRect | The inner rectangular area. |
TRect | OutlineInnerRect | ( | const TRect & | aOuterRect | ) | const [private] |
const TRect & aOuterRect |
TInt | RoundingMargin | ( | const TInt | aRoundedLength | ) | const [private] |
const TInt aRoundedLength |
IMPORT_C void | SetAdjacent | ( | TInt | aAdjacent | ) |
Sets the border adjacency.
No outline is drawn for border sides that are adjacent.
TInt aAdjacent | The border adjacency. For possible values, see the TGulAdjacent enum. |
IMPORT_C void | SetType | ( | TInt | aType | ) |
Sets the border type.
Descriptive borders use one of the values from the TBorderType enum. Logical borders use one of the TLogicalType values. Custom border types can be created by selecting one value from each of the enums T3DStyle and TConstructionStyle, one or more values from each of the enums TOutlineStyle and TInlineStyle, one or more values from the enums TThickness and TRounding and ORing all these values together.
TInt aType | The border type. |
IMPORT_C TSize | SizeDelta | ( | ) | const |
Returns the size difference between the inner and outer rectangles of the border.
Defines the 3D border style.
EFlat = 0x10 |
A flat border. |
ESunken = 0x20 |
A 3D effect sunken border. |
ERaised = 0x40 |
A 3D effect raised border. |
Defines the descriptive border types.
ENone = ENoBorder |
No border. |
ESingleGray = EWithOutline|EGray |
Border is a 1 pixel wide grey outline. |
ESingleBlack = EWithOutline|EBlack |
Border is a 1 pixel wide black outline. |
ESingleDotted = EWithOutline|EDottedOutline |
Border is a 1 pixel wide dotted outline. |
EShallowRaised = ERaised|EOneStep|EAddOnePixel |
A 3D raised border, with 1 pixel thickness. |
EShallowSunken = ESunken|EOneStep|EAddOnePixel |
A 3D sunken border, with 1 pixel thickness. |
EDeepRaised = EWithOutline|ERaised|EOneStep|EAddTwoPixels |
A 3D raised border, with outline, and 2 pixel thickness. |
EDeepRaisedWithOutline = EWithOutline|ERaised|EOneStep|EAddTwoPixels |
The same as EDeepRaised. |
EDeepSunken = EWithOutline|ESunken|EOneStep|EAddTwoPixels |
A 3D sunken border, with outline, and 2 pixel thickness. |
EDeepSunkenWithOutline = EWithOutline|ESunken|EOneStep|EAddTwoPixels |
The same as EDeepSunken. |
EThickDeepRaisedWithOutline = EWithOutline|ERaised|EOneStep|EAddOnePixel|EAddTwoPixels |
A 3D raised border, with outline, and 3 pixel thickness. |
EVerticalBar = ERaised|EOneStep|EAddTwoPixels|EWithOverlap |
A 3D raised border, with 2 pixels thickness and no outline on the left and right hand sides. |
EHorizontalBar = ERaised|EOneStep|EAddTwoPixels|EHorizontal|EWithOverlap |
A 3D raised border, with 2 pixels thickness and no outline on the top and bottom. |
Defines the border's construction style.
EOneStep = 0x100 |
One step border construction. This type of border is drawn using the mid light and mid dark colours on opposite sides of the border. |
ETwoStep = 0x200 |
Two step border construction. This type of border uses light and dark colours for the main border frame (or mid light for the flat border), and an additional half frame using mid light or mid dark colours. |
EThreeStep = 0x400 |
Three step border construction. This type of border is drawn with an outer frame, a repeating one pixel band in mid tones, and an inner frame. |
EInvertedTwoStep = 0x800 |
Inverted two step border construction. This is the same as ETwoStep except that for raised and sunken borders, the additional half frame is drawn on the opposite side to that used in ETwoStep. |
Defines whether or not the border has a single pixel interior border.
By default it does not.
EWithInline = 0x04 |
The border has an interior border. |
EShallow = EAddOnePixel | |
EDeep = EAddTwoPixels | |
EThick = EAddFourPixels | |
EHorizontal = 0x100000 | |
EWithOverlap = 0x200000 | |
EGray = 0x400000 | |
EBlack = 0x80000 |
For logical borders, defines whether the border encloses a window, a container control or a control.
EWindowFamily = ELogical|0x1 |
Logical border around a window. |
EContainerFamily = ELogical|0x2 |
Logical border around a container. |
EControlFamily = ELogical|0x3 |
Logical border around a control. |
Defines the logical border types.
EWindow = EWindowFamily|ERaised |
Raised border around a window. |
EFlatContainer = EContainerFamily|EFlat |
Flat border around a container. |
ERaisedContainer = EContainerFamily|ERaised |
Raised border around a container. |
ESunkenContainer = EContainerFamily|ESunken |
Sunken border around a container. |
EFlatControl = EControlFamily|EFlat |
Flat border around a control. |
ERaisedControl = EControlFamily|ERaised |
Raised border around a control. |
ESunkenControl = EControlFamily|ESunken |
Sunken border around a control. |
EFocusedRaisedControl = EControlFamily|ERaised|0x100 |
Raised border around a control with focus. |
EFocusedSunkenControl = EControlFamily|ESunken|0x100 |
Sunken border around a control with focus. |
Defines the border outline style.
Note that not all border types have an outline.
EWithOutline = 0x01 |
The border has a single pixel outline, either solid (by default) or dotted. |
EDottedOutline = 0x02 |
The border outline is drawn using a dotted pen. |
Defines the number of pixels that are removed to produce rounded corners.
EAddOneRoundingPixel = 0x10000 |
Border rounded by removing one extra pixel. |
EAddTwoRoundingPixels = 0x20000 |
Border rounded by removing two extra pixels. |
EAddFourRoundingPixels = 0x40000 |
Border rounded by by removing four extra pixels. |
Defines the number of pixels to add to the border thickness.
The border thickness is the central part of the border, coloured in the mid-tone highlights and lowlights.
For two step-constructed borders, the additional pixels are only added to either the top left or bottom right hand sides.
EAddOnePixel = 0x1000 |
The border has one extra pixel. |
EAddTwoPixels = 0x2000 |
The border has two extra pixels. |
EAddFourPixels = 0x4000 |
The border has four extra pixels. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.