TCoverFlow

Source: source/classes/tcvrflow.prg

Inherits from: TControl

TCoverFlow is a cover-flow image browser control inspired by the iTunes / Apple Cover Flow user interface. It displays a horizontal row of images with the center item enlarged and the side items angled outward. Users can navigate left and right via mouse clicks, keyboard arrows, or programmatic calls.

Key DATA Members

DATATypeDescription
aCoversArrayArray of cover definitions (bitmap, text, color)
nAtNumericIndex of the currently selected cover
nAngleNumericAngle (in degrees) applied to side covers
nSeparationNumericPixel separation between covers
nCoverWidthNumericWidth of each cover image
bActionBlockCode block evaluated when a cover is selected

Methods

MethodDescription
New( nTop, nLeft, nBottom, nRight, oWnd )Create a new TCoverFlow control
AddCover( cBmp, cText, nClrText )Add a cover with bitmap, caption, and text color
GoLeft()Navigate one cover to the left
GoRight()Navigate one cover to the right
GoTo( n )Jump directly to the cover at index n
AtCover( nRow, nCol )Return the cover index at the given pixel coordinates

Example: Album Browser

#include "FiveWin.ch"

function Main()

   local oWnd, oCover, aCovers := { "cover1.jpg", "cover2.jpg", "cover3.jpg" }

   DEFINE WINDOW oWnd TITLE "Album Browser" SIZE 800, 400

   @ 20, 20 COVERFLOW oCover ;
      SIZE 760, 320 OF oWnd ;
      ACTION ( MsgInfo( "Selected cover #" + Str( oCover:nAt ) ) )

   oCover:AddCover( "cover1.jpg", "Album One",   CLR_WHITE )
   oCover:AddCover( "cover2.jpg", "Album Two",   CLR_WHITE )
   oCover:AddCover( "cover3.jpg", "Album Three", CLR_WHITE )

   oCover:nAngle      := 20
   oCover:nSeparation := 60
   oCover:nCoverWidth := 200
   oCover:GoTo( 1 )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also