TTitle / TTitleText / TTitleImg
Fuente: source/classes/ttitle.prg
Inherits from: TControl
TTitle is a decorative title / header control that combines gradient backgrounds, text elements, and bitmap images into a single visual header. It supports shadows, borders, rounded corners, image animation, alpha blending, and reflex (mirror) effects. Text and images can be added independently via AddText() and LoadBitmaps().
Key DATA Members
| DATA | Type | Description |
|---|---|---|
aImgs | Array | Array of 10-position image descriptors: row, col, hBitmap, hPalette, hasAlpha, alphaLevel, reflex, transparent, anima, action |
aText | Array | Array of text descriptors: row, col, text, justify, brush, pen, shadow, font, textColor |
aGrdBase | Array | Gradient array for the base (header) area |
aGrdBack | Array | Gradient array for the background |
hBackBrush | Handle | Internal background pattern brush handle |
nShadow | Numeric | Shadow direction: TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT |
nShadowIntensity | Numeric | Shadow opacity percentage (0-100) |
nShadowSize | Numeric | Shadow spread distance in pixels |
lBase | Logical | Paint the Mac-style dock base area |
lBorder | Logical | Draw a border around the header |
lRound | Logical | Use rounded corners |
lVertical | Logical | Apply gradient vertically (default: true) |
nClrLine1 | Numeric | Border line 1 color |
nClrLine2 | Numeric | Border line 2 color |
Methods
| Method | Description |
|---|---|
New( oWnd, nRow, nCol, nW, nH, cText, lBorder, lRound, lBase, lVertical, ... ) | Create a decorative title header with gradient, shadow and text |
AddText( nRow, nCol, cText, lBold, lStrike, lShadow, cAlign, oFont, nClr ) | Add a text element to the header at the given coordinates |
LoadBitmaps( cFile, nRow, nCol, nW, nH, nAlpha, lReflex, lTransparent, lAnima, bAction, nAt ) | Load a bitmap into the image array at the specified position |
AnimaImage() | Animate images (slide-up/scroll effect for multi-image headers) |
ChangeImg( cBitmap, nImg ) | Replace the bitmap at a given image index |
LButtonDown( nRow, nCol, nFlags ) | Handle mouse click; trigger any action associated with the image under the cursor |
Example: Gradient Header with Logo and Shadow
#include "FiveWin.ch"
function Main()
local oWnd, oTitle
DEFINE WINDOW oWnd TITLE "Main" SIZE 600, 400
oTitle = TTitle():New( oWnd, 0, 0, 600, 60, "My Application",;
.T., .F., .F., .T.,,, "BOTTOMRIGHT", 8 )
oTitle:AddText( 15, 40, "My Application", .T., .F., .T., "LEFT",;
oFont(), CLR_WHITE )
oTitle:LoadBitmaps( "logo.png", 10, 540, 40, 40,,,, {|| MsgInfo( "Logo clicked" ) } )
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- The header consists of up to three visual layers: background gradient (
aGrdBack), base gradient (aGrdBase, optional dock-like effect), and overlaid text and images. - Shadow is implemented by offsetting a semi-transparent copy of the header content. The
nShadowdirection constant controls which quadrant the shadow falls in. - Images stored in
aImgscan have individual alpha levels, reflex (mirror) effects, and animated transitions. - When
lBaseis true, an additional darker gradient strip is painted at the bottom of the header (similar to the macOS Dock). - Borders are drawn with two colors (
nClrLine1andnClrLine2) to create a 3D bevel effect.