James Bott wrote:
oRBar:= TRibbonbar():New(…)
oRbar:setStyle(…)
oRBar:Default()
James
#include "FiveWin.ch"
#define RB_THEME_DARK 6
#define COLOR_GRAYTEXT 17
//----------------------------------------------------------------------------//
function Main()
local oWnd
DEFINE WINDOW oWnd
oWnd:SetSize( 1200, 800 )
BuildRibbon( oWnd )
ACTIVATE WINDOW oWnd CENTER // MAXIMIZED
return nil
//----------------------------------------------------------------------------//
function BuildRibbon( oWnd )
local oRb := TRibbonBar():New( oWnd ), oGroup, oBtn
oGroup = oRb:AddGroup( 185, "First", 1 )
oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "One", { || MsgInfo( "One" ) } )
oBtn:LoadBitmaps( "..\bitmaps\32x32\new.bmp" )
oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Two", { || MsgInfo( "Two" ) } )
oBtn:LoadBitmaps( "..\bitmaps\32x32\open.bmp" )
oGroup = oRb:AddGroup( 185, "Second", 1 )
oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "Three" )
oBtn:LoadBitmaps( "..\bitmaps\32x32\setup.bmp" )
oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Four" )
oBtn:LoadBitmaps( "..\bitmaps\32x32\quit.bmp" )
oRb:AddGroup( 185, "Third", 1 )
SetRibbonBarTheme( oRb, RB_THEME_DARK )
return oRb
//----------------------------------------------------------------------------//
function SetRibbonBarTheme( oRb, nTheme )
local oDlg, oGroup, oBtn
do case
case nTheme == RB_THEME_DARK
oRb:oFont:End()
oRb:SetFont( TFont():New( "Segoe UI", 0, -14 ) )
oRb:nHeight = 136
oRb:nHeightFld = 20
oRb:hSeparation = 4
oRb:nLeftMargin = 20
oRb:nRoundBox = 0
oRb:nClrPaneRB = RGB( 68, 68, 68 )
oRb:nClrBoxOut = RGB( 178, 178, 178 )
oRb:nClrBoxIn = RGB( 178, 178, 178 )
oRb:nClrBoxSelOut = RGB( 178, 178, 178 )
oRb:nClrBoxSelIn = RGB( 178, 178, 178 )
oRb:aGrad = { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } },;
{ { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } } ) }
oRb:aGradHigh = { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, RGB( 0, 0, 0 ), RGB( 255, 255, 255 ) ) } )
DeleteObject( oRb:hBmpBrushEx )
DeleteObject( oRb:hBrushEx )
oRb:hBmpBrushEx = GradientBmp( oRb, oRb:nRight - oRb:nRightMargin - 3, oRb:nBottom - oRb:nTopMargin + 1, oRb:aGrad )
oRb:hBrushEx = CreatePatternBrush( oRb:hBmpBrushEx )
for each oDlg in oRb:aDialogs
oDlg:hBack = oRb:hBrushEx
oDlg:Refresh()
for each oGroup in oDlg:aControls
if oGroup:IsKindOf( "TRBGROUP" )
oGroup:oFont:End()
oGroup:SetFont( oRb:oFont )
oGroup:nHeight -= 24
oGroup:nClrBoxIn = RGB( 160, 160, 160 )
oGroup:aGradCaption = { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }
oGroup:bClrText = { | lEnable | If( lEnable, RGB( 0, 0, 0 ), GetSysColor( COLOR_GRAYTEXT ) ) }
oGroup:nClrBoxIn = RGB( 160, 160, 160 )
oGroup:nClrBoxOut = RGB( 160, 160, 160 )
DeleteObject( oGroup:hBrushSel )
DeleteObject( oGroup:hBrushUnSel )
DeleteObject( oGroup:hBack )
oGroup:hBrushUnSel = oDlg:hBack
oGroup:hBack = oDlg:hBack
for each oBtn in oGroup:aControls
if oBtn:IsKindOf( "TRBTN" )
oBtn:oFont:End()
oBtn:SetFont( oRb:oFont )
oBtn:nHeight -= 24
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } },;
{ { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } } ) }
oBtn:aClrGradUnder = { || { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } } }
oBtn:aClrGradBack = { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }
oBtn:nClrBoxIn = RGB( 160, 160, 160 )
oBtn:nClrBoxOut = RGB( 160, 160, 160 )
endif
next
oGroup:Refresh()
endif
next
next
endcase
oRb:Default()
return nil
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 38 guests