TTitle / TTitleText / TTitleImg

Fonte: 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

DATATypeDescription
aImgsArrayArray of 10-position image descriptors: row, col, hBitmap, hPalette, hasAlpha, alphaLevel, reflex, transparent, anima, action
aTextArrayArray of text descriptors: row, col, text, justify, brush, pen, shadow, font, textColor
aGrdBaseArrayGradient array for the base (header) area
aGrdBackArrayGradient array for the background
hBackBrushHandleInternal background pattern brush handle
nShadowNumericShadow direction: TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT
nShadowIntensityNumericShadow opacity percentage (0-100)
nShadowSizeNumericShadow spread distance in pixels
lBaseLogicalPaint the Mac-style dock base area
lBorderLogicalDraw a border around the header
lRoundLogicalUse rounded corners
lVerticalLogicalApply gradient vertically (default: true)
nClrLine1NumericBorder line 1 color
nClrLine2NumericBorder line 2 color

Methods

MethodDescription
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

Veja Também