Ribbon Theme
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Ribbon Theme
Antonio,
Very impressive work.
I worked on this quite a number of hours about 9 months ago. There was a huge learning curve. I didn't know so many things could be modified outside the class. Great!
Here are a few suggestions for your example.
When hovering over a group, the background turns white--it doesn't change color in MS Office.
The font for tabs should be 12pt not 14pt.
The ribbonbar itself and all the tabs have a gradient outline--two outlines 1 pixel each. These need to be eliminated either by not drawing them or making them both the same color as the background color.
I have never been able to figure out how to get rid of the colored line at the bottom of the ribbon. Office doesn't have this. I think I found that it was actually the bottom edge of the background color for the entire ribbonbar. Maybe just drawing the background shorter a pixel or two. Any ideas?
Very impressive work.
I worked on this quite a number of hours about 9 months ago. There was a huge learning curve. I didn't know so many things could be modified outside the class. Great!
Here are a few suggestions for your example.
When hovering over a group, the background turns white--it doesn't change color in MS Office.
The font for tabs should be 12pt not 14pt.
The ribbonbar itself and all the tabs have a gradient outline--two outlines 1 pixel each. These need to be eliminated either by not drawing them or making them both the same color as the background color.
I have never been able to figure out how to get rid of the colored line at the bottom of the ribbon. Office doesn't have this. I think I found that it was actually the bottom edge of the background color for the entire ribbonbar. Maybe just drawing the background shorter a pixel or two. Any ideas?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Ribbon Theme
Thanks to Frances Padilla (FAP) here you have the source code for his example:
Code: Select all
#include "FiveWin.ch"
#include "Ribbon.ch"
#define _nClrPaneRB RGB( 68, 68, 68 )
#define _nClrBoxOutRB RGB( 178, 178, 178 )
#define _nClrBoxInRB RGB( 178, 178, 178 )
#define _nClrBoxSelOut RGB( 178, 178, 178 )
#define _aGradRB { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }
#define _aGradFldRB {|nOpt| iif( nOpt == oRibbon:nStart, { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } },;
{ { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } } ) }
#define _aGradHighRB { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }
#define _aGradOverRB { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }
#define _nCtrlFrGround RGB( 255, 255, 255 )
#define _nCtrlBkGround RGB( 106, 106, 106 )
#define _nClrBoxOut RGB( 160, 160, 160 )
#define _nClrBoxIn RGB( 160, 160, 160 )
#define _nClrTxt RGB( 0, 0, 0 )
#define _bClrGradNormal {|lPressed| iif( lPressed, { { 1, _nClrBoxOut, _nClrBoxOut } },;
{ { 1, _nClrBoxOut, _nClrBoxOut } } ) }
#define _aClrGradUnder {|| { { 1, _nClrBoxOut, _nClrBoxOut } } }
#define _aClrGradBack { { 1, _nClrBoxOut, _nClrBoxOut } }
function Main()
local oFont
local n, oWnd, oRibbon
local aDlgs
DEFINE FONT oFont NAME 'Verdana' SIZE 0, -12
DEFINE WINDOW oWnd
aDlgs := { 'About', 'PettyCash', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine' }
oRibbon := TRibbonBar():New( oWnd, aDlgs,,,, 120, 40, _nClrPaneRB, _nClrBoxOutRB, _nClrBoxInRB,,;
_nClrBoxSelOut, _aGradRB, _aGradFldRB, _aGradHighRB, _aGradOverRB,,,,,.T.)
WITH OBJECT oRibbon
:nHeightFld := 26
:hSeparation := 4
:SetFont( oFont )
FOR n := 1 TO Len( :aPrompts )
:aClrTabTxt[ n ] := { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, RGB( 0, 0, 0 ), RGB( 255, 255, 255 ) ) }
NEXT
:CalcPos()
END
oWnd:SetSize( 1200, 800 )
ACTIVATE WINDOW oWnd CENTER
return nil
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Ribbon Theme
i found a document of colors of microsoft
https://docs.microsoft.com/it-it/powera ... ion-colors
where are the codes of colors
https://brandpalettes.com/microsoft-color-codes/
but on office 2019 I found this dialog where you can set office background or office color and I have only 4 colors
Colorful (default).
Dark Gray.
Black.
White.
https://docs.microsoft.com/it-it/powera ... ion-colors
where are the codes of colors
https://brandpalettes.com/microsoft-color-codes/
but on office 2019 I found this dialog where you can set office background or office color and I have only 4 colors
Colorful (default).
Dark Gray.
Black.
White.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Ribbon Theme
I have done some minor formatting to Silvio example and added purple theme:
rbtheme.prg
rbtheme.prg
Code: Select all
#include "FiveWin.ch"
#include "ribbon.ch"
#define RB_THEME_DARK 6
#define RB_THEME_BLUE 7
#define RB_THEME_RED 8
#define RB_THEME_GREEN 9
#define RB_THEME_ORANGE 10
#define RB_THEME_PURPLE 11
#define CLR_MSBLUE RGB( 43, 87, 154 )
#define CLR_MSLIGHTGRAY RGB( 243, 243, 243 )
#define CLR_MSGRAY RGB( 198, 198, 198 )
#define CLR_DARKGRAY RGB( 54, 54, 54 )
#define CLR_MSRED RGB( 164, 55, 58 )
#define CLR_MSORANGE RGB( 184, 72, 43 )
#define CLR_MSPURPLE RGB( 128, 57, 123 )
#define CLR_MSBLUE1 RGB( 1, 115, 199 )
#define CLR_MSBLUE2 RGB( 57, 85, 163 )
#define CLR_MSBLUE3 RGB( 42, 87, 154 )
#define CLR_MSGREEN1 RGB( 49, 117, 47 )
#define CLR_MSGREEN2 RGB( 7, 117, 104 )
#define CLR_MSGREEN3 RGB( 34, 116, 71 )
#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, oMenu
MENU oMenu POPUP
MENUITEM "Dark" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_DARK ), oRb:Refresh() )
MENUITEM "Blue" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_BLUE ) , oRb:Refresh() )
MENUITEM "Green" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_GREEN ), oRb:Refresh() )
MENUITEM "Red" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_RED ), oRb:Refresh() )
MENUITEM "Orange" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_ORANGE ), oRb:Refresh() )
MENUITEM "Purple" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_PURPLE ) , oRb:Refresh() )
ENDMENU
oRb:SetStyles( .F., .T. )
oGroup = oRb:AddGroup( 185, "First", 1 )
oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "One", { || MsgInfo( "One" ) } )
oBtn:LoadBitmaps( "..\bitmaps\32x32\cascade.bmp" )
oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Two", { || MsgInfo( "Two" ) } )
oBtn:LoadBitmaps( "..\bitmaps\32x32\tiled.bmp" )
oGroup = oRb:AddGroup( 185, "Second", 1 )
oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "Three" )
oBtn:LoadBitmaps( "..\bitmaps\32x32\world.bmp" )
oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Four" )
oBtn:LoadBitmaps( "..\bitmaps\32x32\task.bmp" )
oGroup = oRb:AddGroup( 75, "Styles", 1 )
@ 3,5 ADD BUTTON oBtn ;
PROMPT "Change" BITMAP "..\bitmaps\stylechange32.BMP";
GROUP oGroup MENU oMenu ;
SPLITPOPUP SIZE 65,75 TOP
SetRibbonBarTheme( oRb, RB_THEME_BLUE ) // as default
return oRb
//----------------------------------------------------------------------------//
function SetRibbonBarTheme( oRb, nTheme )
local oDlg, oGroup, oBtn
oRb:nHeight = 130
oRb:nHeightFld = 20
oRb:hSeparation = 4
oRb:nLeftMargin = 20
oRb:nRoundBox = 0
do case
case nTheme == RB_THEME_DARK
oRb:nClrPaneRB = CLR_BLACK
oRb:nClrBoxOut = CLR_DARKGRAY
oRb:nClrBoxIn = CLR_DARKGRAY
oRb:nClrBoxSelOut = CLR_DARKGRAY
oRb:nClrBoxSelIn = CLR_DARKGRAY
oRb:aGrad = { { 1, CLR_DARKGRAY, CLR_DARKGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_DARKGRAY, CLR_DARKGRAY } },;
{ { 1, CLR_DARKGRAY, CLR_DARKGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE, CLR_WHITE ) } )
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
for each oGroup in oDlg:aControls
if oGroup:IsKindOf( "TRBGROUP" )
oGroup:oFont:End()
oGroup:SetFont( oRb:oFont )
oGroup:nHeight = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_WHITE, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:nClrBoxOut = CLR_LIGHTGRAY
DeleteObject( oGroup:hBrushSel )
DeleteObject( oGroup:hBrushUnSel )
DeleteObject( oGroup:hBack )
oGroup:hBrushUnSel = oDlg:hBack
oGroup:hBack = nil
for each oBtn in oGroup:aControls
if oBtn:IsKindOf( "TRBTN" )
oBtn:oFont:End()
oBtn:SetFont( oRb:oFont )
oBtn:nHeight = 80
oBtn:bClrText = { || CLR_WHITE }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_GRAY, CLR_GRAY } },;
{ { 1, CLR_GRAY, CLR_GRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oBtn:nClrBoxIn = CLR_LIGHTGRAY
oBtn:nClrBoxOut = CLR_LIGHTGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_BLUE
oRb:nClrPaneRB = CLR_MSBLUE
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSBLUE, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSBLUE // CLR_LIGHTGRAY
oGroup:nClrBoxOut = CLR_MSBLUE // CLR_LIGHTGRAY
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_RED
oRb:nClrPaneRB = CLR_MSRED
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSRED, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSRED
oGroup:nClrBoxOut = CLR_MSRED
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_GREEN
oRb:nClrPaneRB = CLR_MSGREEN1
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSGREEN2, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_MSGREEN2
oGroup:aGradCaption = { { 1, CLR_MSGREEN3, CLR_MSGREEN3 } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_MSLIGHTGRAY ) }
oGroup:nClrBoxIn = CLR_MSGREEN3
oGroup:nClrBoxOut = CLR_MSGREEN3
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGREEN1, CLR_MSGREEN1 } },;
{ { 1, CLR_MSGREEN2, CLR_MSGREEN2 } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGREEN3, CLR_MSGREEN3 } } }
oBtn:aClrGradBack = { { 1, CLR_MSGREEN1, CLR_MSGREEN1 } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_ORANGE
oRb:nClrPaneRB = CLR_MSORANGE
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSBLUE, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSORANGE // CLR_LIGHTGRAY
oGroup:nClrBoxOut = CLR_MSORANGE // CLR_LIGHTGRAY
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_PURPLE
oRb:nClrPaneRB = CLR_MSPURPLE
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSBLUE, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSPURPLE
oGroup:nClrBoxOut = CLR_MSPURPLE
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
endcase
oRb:Default()
return nil
//----------------------------------------------------------------------------//
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Ribbon Theme
another... why we init from 6 ?
#define RB_THEME_DARK 6
#define RB_THEME_BLUE 7
#define RB_THEME_RED 8
#define RB_THEME_GREEN 9
#define RB_THEME_ORANGE 10
#define RB_THEME_PURPLE 11
where are the syle from 1 to 5
then we must add a new methos direclty to ribbon called
METHOD SetStyle( nStyle )
or change this
METHOD SetStyles( l2010, l2013, l2015, nTopMargin, nClrPaneRB, nClrBoxOut, nClrBoxIn,;
nClrBoxSelOut, nClrBoxSelIn, aGrad, aGradFld, aGradHigh, aGradOver, l2016 )
DEFAULT 1
2010 2
2013 3
2015 4
2016 5
from 6 to 12 ->2019
or erase METHOD SetStyles current and use the function made here also for the other style
wish is the good solution ?
#define RB_THEME_DARK 6
#define RB_THEME_BLUE 7
#define RB_THEME_RED 8
#define RB_THEME_GREEN 9
#define RB_THEME_ORANGE 10
#define RB_THEME_PURPLE 11
where are the syle from 1 to 5
then we must add a new methos direclty to ribbon called
METHOD SetStyle( nStyle )
or change this
METHOD SetStyles( l2010, l2013, l2015, nTopMargin, nClrPaneRB, nClrBoxOut, nClrBoxIn,;
nClrBoxSelOut, nClrBoxSelIn, aGrad, aGradFld, aGradHigh, aGradOver, l2016 )
DEFAULT 1
2010 2
2013 3
2015 4
2016 5
from 6 to 12 ->2019
or erase METHOD SetStyles current and use the function made here also for the other style
wish is the good solution ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Ribbon Theme
just a idea....
#define RB_THEME_2007 1
#define RB_THEME_2010 2
#define RB_THEME_2013 3
#define RB_THEME_2015 4
#define RB_THEME_2016 5
#define RB_THEME_DARK 6
#define RB_THEME_BLUE 7
#define RB_THEME_RED 8
#define RB_THEME_GREEN 9
#define RB_THEME_ORANGE 10
#define RB_THEME_PURPLE 11
#define RB_THEME_2007 1
#define RB_THEME_2010 2
#define RB_THEME_2013 3
#define RB_THEME_2015 4
#define RB_THEME_2016 5
#define RB_THEME_DARK 6
#define RB_THEME_BLUE 7
#define RB_THEME_RED 8
#define RB_THEME_GREEN 9
#define RB_THEME_ORANGE 10
#define RB_THEME_PURPLE 11
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Ribbon Theme
Silvio,
You already answered your own question
You already answered your own question
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Ribbon Theme
I tried to insert
case nTheme == RB_THEME_2007
case nTheme == RB_THEME_2007
Code: Select all
#include "FiveWin.ch"
#include "ribbon.ch"
#define RB_THEME_2007 1
#define RB_THEME_2010 2
#define RB_THEME_2013 3
#define RB_THEME_2015 4
#define RB_THEME_2016 5
#define RB_THEME_DARK 6
#define RB_THEME_BLUE 7
#define RB_THEME_RED 8
#define RB_THEME_GREEN 9
#define RB_THEME_ORANGE 10
#define RB_THEME_PURPLE 11
#define CLR_MSBLUE RGB( 43, 87, 154 )
#define CLR_MSLIGHTGRAY RGB( 243, 243, 243 )
#define CLR_MSGRAY RGB( 198, 198, 198 )
#define CLR_DARKGRAY RGB( 54, 54, 54 )
#define CLR_MSRED RGB( 164, 55, 58 )
#define CLR_MSORANGE RGB( 184, 72, 43 )
#define CLR_MSPURPLE RGB( 128, 57, 123 )
#define CLR_MSBLUE1 RGB( 1, 115, 199 )
#define CLR_MSBLUE2 RGB( 57, 85, 163 )
#define CLR_MSBLUE3 RGB( 42, 87, 154 )
#define CLR_MSGREEN1 RGB( 49, 117, 47 )
#define CLR_MSGREEN2 RGB( 7, 117, 104 )
#define CLR_MSGREEN3 RGB( 34, 116, 71 )
#define COLOR_GRAYTEXT 17
#define CLRTEXT RGB( 21, 66, 139 )
#define CLRTEXTBACK RGB( 113, 106, 183 )
#define BLUE3 RGB( 191, 219, 255 )
#define BLUE0 RGB( 218, 229, 243 )
#define BLUE2 RGB( 194, 217, 240 )
#define BLUE1 RGB( 199, 216, 237 )
#define BLUEBOX0 RGB( 141, 178, 227 )
#define BLUEBOX1 RGB( 197, 210, 223 )
#define BLUEBOX2 RGB( 237, 242, 248 )
#define CLRLIGHT RGB( 216, 230, 246 )
#define CLRDARK RGB( 191, 213, 238 )
#define YELBOX0 RGB( 249, 204, 96 )
#define YELBOX1 RGB( 255, 255, 189 )
#define QUICKGRAD { { 0.3, nRGB( 218, 228, 243 ), nRGB( 218, 228, 243 ) },;
{ 0.65, nRGB( 199, 216, 237 ), nRGB( 217, 228, 242 ) },;
{ 0.05, nRGB( 141, 178, 227 ), nRGB( 172, 201, 231 ) } }
#define COLOR_MENUHILIGHT 29
#define COLOR_MENUBAR 30
//----------------------------------------------------------------------------//
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, oMenu
MENU oMenu POPUP
MENUITEM "2007" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_2007 ), oRb:Refresh() )
MENUITEM "Dark" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_DARK ), oRb:Refresh() )
MENUITEM "Blue" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_BLUE ) , oRb:Refresh() )
MENUITEM "Green" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_GREEN ), oRb:Refresh() )
MENUITEM "Red" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_RED ), oRb:Refresh() )
MENUITEM "Orange" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_ORANGE ), oRb:Refresh() )
MENUITEM "Purple" ;
ACTION ( SetRibbonBarTheme( oRb, RB_THEME_PURPLE ) , oRb:Refresh() )
ENDMENU
oRb:SetStyles( .F., .T. )
oGroup = oRb:AddGroup( 185, "First", 1 )
oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "One", { || MsgInfo( "One" ) } )
oBtn:LoadBitmaps( "c:\work\fwh\bitmaps\32x32\cascade.bmp" )
oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Two", { || MsgInfo( "Two" ) } )
oBtn:LoadBitmaps( "c:\work\fwh\bitmaps\32x32\tiled.bmp" )
oGroup = oRb:AddGroup( 185, "Second", 1 )
oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "Three" )
oBtn:LoadBitmaps( "c:\work\fwh\bitmaps\32x32\world.bmp" )
oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Four" )
oBtn:LoadBitmaps( "c:\work\fwh\bitmaps\32x32\task.bmp" )
oGroup = oRb:AddGroup( 75, "Styles", 1 )
@ 3,5 ADD BUTTON oBtn ;
PROMPT "Change" BITMAP "c:\work\fwh\bitmaps\stylechange32.BMP";
GROUP oGroup MENU oMenu ;
SPLITPOPUP SIZE 65,75 TOP
SetRibbonBarTheme( oRb, RB_THEME_BLUE ) // as default
return oRb
//----------------------------------------------------------------------------//
function SetRibbonBarTheme( oRb, nTheme )
local oDlg, oGroup, oBtn
oRb:nHeight = 130
oRb:nHeightFld = 20
oRb:hSeparation = 4
oRb:nLeftMargin = 20
oRb:nRoundBox = 0
do case
case nTheme == RB_THEME_2007
oRb:nTopMargin := if( hb_IsNil( oRb:nTopMargin ), 25, oRb:nTopMargin )
oRb:nClrPaneRB = BLUE3
oRb:nClrBoxOut = BLUEBOX0
oRb:nClrBoxIn = BLUEBOX2
oRb:nClrBoxSelOut = YELBOX0
oRb:nClrBoxSelIn = YELBOX1
oRb:aGrad = { {0.12, BLUE0, BLUE0 }, { 0.70, BLUE1, BLUE0 }, { 0.18, BLUE0, CLR_WHITE }}
oRb:aGradFld = {| nOpt | if( nOpt == oRb:nStart, { { 1, RGB( 30, 72, 161 ), RGB( 76, 146, 229 ) } },;
{ { 1, CLR_WHITE, BLUE0 } } ) }
oRb:aGradHigh = { { 1, BLUE3, RGB( 202,172,136 ) } }
oRb:aGradOver = { { 1, RGB( 197,221,251), RGB( 226,209,162)} }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE, CLR_WHITE ) } )
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
for each oGroup in oDlg:aControls
if oGroup:IsKindOf( "TRBGROUP" )
oGroup:oFont:End()
oGroup:SetFont( oRb:oFont )
oGroup:nHeight = 100
oGroup:nClrBoxIn = BLUEBOX2
oGroup:aGradCaption = { {1, BLUE2, BLUE2 } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_WHITE, CLRTEXTBACK ) }
oGroup:nClrBoxIn = BLUEBOX2
oGroup:nClrBoxOut = BLUEBOX0
DeleteObject( oGroup:hBrushSel )
DeleteObject( oGroup:hBrushUnSel )
DeleteObject( oGroup:hBack )
oGroup:hBrushUnSel = oDlg:hBack
oGroup:hBack = nil
for each oBtn in oGroup:aControls
if oBtn:IsKindOf( "TRBTN" )
oBtn:oFont:End()
oBtn:SetFont( oRb:oFont )
oBtn:nRound := if( oBtn:lRound, 6, 0 )
oBtn:nHeight := 80
oBtn:bClrText := { || CLR_WHITE }
oBtn:bClrGradNormal := { | lPressed | If( lPressed, { { 1, BLUEBOX1, BLUEBOX1 } },;
{ { 1, BLUEBOX0, BLUEBOX1 } } ) }
oBtn:aClrGradUnder := {|| { { 1 , nRGB( 248, 186, 107 ), nRGB( 255, 253, 222 ) } } }
oBtn:aClrGradBack := { { 1 , nRGB( 255, 253, 222 ), nRGB( 255, 253, 222 ) } }
oBtn:aClrGradOver := {|| { { 1 , nRGB( 255, 215, 84 ), nRGB( 255, 253, 222 ) } } }
oBtn:bClrGradSubOver:= { | lPressed | if ( lPressed,;
{ ;
{ 2/3, nRGB( 248, 187, 107 ), nRGB( 253, 171, 98 ) } , ;
{ 1/3, nRGB( 253, 154, 63 ), nRGB( 255, 164, 64 ) };
},;
{;
{ 2/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 147 ) } , ;
{ 1/3, nRGB( 255, 215, 86 ), nRGB( 255, 231, 153 ) };
} ) }
oBtn:bClrGradSelect := {| lSelected | if( lSelected ,;
{ ;
{2/5, nRGB( 253,212,168 ), nRGB( 251,178,99 ) },;
{3/5, nRGB( 250,157,52 ), nRGB( 252,234,163 ) };
},;
{ ;
{2/5, nRGB( 245,177,110 ), nRGB( 243,165,89 ) },;
{3/5, nRGB( 216,136,52 ), nRGB( 249,202,98 ) } ;
} ) }
oBtn:bClrGradSelectPress := {| lPressed | if( lPressed ,;
{ ;
{ 2/5, nRGB( 248, 187, 107 ), nRGB( 253, 171, 98 ) } , ;
{ 3/5, nRGB( 253, 154, 63 ), nRGB( 255, 164, 64 ) };
},;
{ ;
{2/5, nRGB( 245,177,110 ), nRGB( 243,165,89 ) },;
{3/5, nRGB( 216,136,52 ), nRGB( 249,202,98 ) } ;
} ) }
oBtn:aClrGradBtnGr := {|| ;
{ ;
{ 1/3, nRGB( 200, 219, 238 ), nRGB( 201, 221, 246 ) } , ;
{ 2/3, nRGB( 192, 212, 237 ), nRGB( 208, 225, 247 ) };
} }
oBtn:aGradiant = { { 0.3, BLUE0, BLUE0 }, { 0.7, BLUE1, BLUE0 } }
oBtn:nClrBoxIn = BLUEBOX1
oBtn:nClrBoxOut = BLUEBOX0
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_DARK
oRb:nClrPaneRB = CLR_BLACK
oRb:nClrBoxOut = CLR_DARKGRAY
oRb:nClrBoxIn = CLR_DARKGRAY
oRb:nClrBoxSelOut = CLR_DARKGRAY
oRb:nClrBoxSelIn = CLR_DARKGRAY
oRb:aGrad = { { 1, CLR_DARKGRAY, CLR_DARKGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_DARKGRAY, CLR_DARKGRAY } },;
{ { 1, CLR_DARKGRAY, CLR_DARKGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE, CLR_WHITE ) } )
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
for each oGroup in oDlg:aControls
if oGroup:IsKindOf( "TRBGROUP" )
oGroup:oFont:End()
oGroup:SetFont( oRb:oFont )
oGroup:nHeight = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_WHITE, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:nClrBoxOut = CLR_LIGHTGRAY
DeleteObject( oGroup:hBrushSel )
DeleteObject( oGroup:hBrushUnSel )
DeleteObject( oGroup:hBack )
oGroup:hBrushUnSel = oDlg:hBack
oGroup:hBack = nil
for each oBtn in oGroup:aControls
if oBtn:IsKindOf( "TRBTN" )
oBtn:oFont:End()
oBtn:SetFont( oRb:oFont )
oBtn:nHeight = 80
oBtn:bClrText = { || CLR_WHITE }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_GRAY, CLR_GRAY } },;
{ { 1, CLR_GRAY, CLR_GRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oBtn:nClrBoxIn = CLR_LIGHTGRAY
oBtn:nClrBoxOut = CLR_LIGHTGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_BLUE
oRb:nClrPaneRB = CLR_MSBLUE
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSBLUE, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSBLUE // CLR_LIGHTGRAY
oGroup:nClrBoxOut = CLR_MSBLUE // CLR_LIGHTGRAY
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_RED
oRb:nClrPaneRB = CLR_MSRED
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSRED, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSRED
oGroup:nClrBoxOut = CLR_MSRED
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_GREEN
oRb:nClrPaneRB = CLR_MSGREEN1
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSGREEN2, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_MSGREEN2
oGroup:aGradCaption = { { 1, CLR_MSGREEN3, CLR_MSGREEN3 } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_MSLIGHTGRAY ) }
oGroup:nClrBoxIn = CLR_MSGREEN3
oGroup:nClrBoxOut = CLR_MSGREEN3
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGREEN1, CLR_MSGREEN1 } },;
{ { 1, CLR_MSGREEN2, CLR_MSGREEN2 } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGREEN3, CLR_MSGREEN3 } } }
oBtn:aClrGradBack = { { 1, CLR_MSGREEN1, CLR_MSGREEN1 } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_ORANGE
oRb:nClrPaneRB = CLR_MSORANGE
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSBLUE, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSORANGE // CLR_LIGHTGRAY
oGroup:nClrBoxOut = CLR_MSORANGE // CLR_LIGHTGRAY
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
case nTheme == RB_THEME_PURPLE
oRb:nClrPaneRB = CLR_MSPURPLE
oRb:nClrBoxOut = CLR_MSLIGHTGRAY
oRb:nClrBoxIn = CLR_MSLIGHTGRAY
oRb:nClrBoxSelOut = CLR_MSLIGHTGRAY
oRb:nClrBoxSelIn = CLR_MSLIGHTGRAY
oRb:aGrad = { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } }
oRb:aGradFld = { | nOpt | If( nOpt == oRb:nStart, { { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } },;
{ { 1, CLR_MSLIGHTGRAY, CLR_MSLIGHTGRAY } } ) }
oRb:aGradHigh = { { 1, CLR_BLACK, CLR_BLACK } }
oRb:aGradOver = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_MSBLUE, CLR_WHITE ) } )
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 = 100
oGroup:nClrBoxIn = CLR_LIGHTGRAY
oGroup:aGradCaption = { { 1, CLR_LIGHTGRAY, CLR_LIGHTGRAY } }
oGroup:bClrText = { | lEnable | If( lEnable, CLR_BLACK, CLR_DARKGRAY ) }
oGroup:nClrBoxIn = CLR_MSPURPLE
oGroup:nClrBoxOut = CLR_MSPURPLE
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 = 80
oBtn:bClrText = { || CLR_BLACK }
oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, CLR_MSGRAY, CLR_MSGRAY } },;
{ { 1, CLR_MSGRAY, CLR_MSGRAY } } ) }
oBtn:aClrGradUnder = { || { { 1, CLR_MSGRAY, CLR_MSGRAY } } }
oBtn:aClrGradBack = { { 1, CLR_MSGRAY, CLR_MSGRAY } }
oBtn:nClrBoxIn = CLR_MSGRAY
oBtn:nClrBoxOut = CLR_MSGRAY
oBtn:Refresh()
endif
next
oGroup:Refresh()
endif
next
next
endcase
oRb:Default()
return nil
//----------------------------------------------------------------------------/
Last edited by Silvio.Falconi on Mon May 06, 2019 11:52 am, edited 1 time in total.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Ribbon Theme
Silvio,
Why do you move your code to the right ?
Please respect the source code format that I am using
thank you
Please post a screenshot
Why do you move your code to the right ?
Please respect the source code format that I am using
thank you
Please post a screenshot
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Ribbon Theme
Antonio,
sorry I didn't see that I moved the code to the right, I didn't even notice, sorry
I saw there is problem to set the button for all these set
::bClrGradNormal =
::aClrGradOver =
::bClrGradSubOver=
::aClrGradUnder =
::aClrGradBack =
::bClrGradSelect =
::bClrGradSelectPress =
::aClrGradBtnGr =
::aGradiant =
sorry I didn't see that I moved the code to the right, I didn't even notice, sorry
I saw there is problem to set the button for all these set
::bClrGradNormal =
::aClrGradOver =
::bClrGradSubOver=
::aClrGradUnder =
::aClrGradBack =
::bClrGradSelect =
::bClrGradSelectPress =
::aClrGradBtnGr =
::aGradiant =
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Ribbon Theme
Does anyone know how to change the text color on tabs when the cursor is hovering over it? These need to change to the background color when the cursor is over it, otherwise you can't see the text. Also this is the way it is done in Office.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Ribbon Theme
James,
This line sets the colors of the Tabs texts:
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE, CLR_HRED ) } )
Is this what you are looking for ?
This line sets the colors of the Tabs texts:
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE, CLR_HRED ) } )
Is this what you are looking for ?
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Ribbon Theme
Antonio,
Perhaps the existing code doesn't support this.
Hmm, to complicate things, I just watched a youtube video tutoral for Word 2019 and that version doesn't show tabs changing color when the mouse cursor hovers over it. It only changes color when it is selected. This would solve the problem above, however, we will now need to turn off the color change when hovering. So we still need to find the code that does this.
James
Unfortunately no. That changes the text color of the selected and unselected tabs. I am looking for a way to change the text color of an unselected tag that the mouse cursor is hovering over. As it is now, the background color of the tab changes, but the text does not. When the background changes to a light color and text is a light color then it becomes invisible (or nearly so).AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE, CLR_HRED ) } )
Perhaps the existing code doesn't support this.
Hmm, to complicate things, I just watched a youtube video tutoral for Word 2019 and that version doesn't show tabs changing color when the mouse cursor hovers over it. It only changes color when it is selected. This would solve the problem above, however, we will now need to turn off the color change when hovering. So we still need to find the code that does this.
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Ribbon Theme
James,
Please try this:
Please try this:
Code: Select all
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE,;
If( oRb:nOverPrompt( ScreenToClient( oRb:hWnd, GetCursorPos() )[ 1 ], ScreenToClient( oRb:hWnd, GetCursorPos() )[ 2 ] ) == nPrompt, CLR_HRED, CLR_WHITE ) ) } )
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Ribbon Theme
Antonio,
[quote="Antonio Linares"]James,
Please try this:
where I must insert this code
[quote="Antonio Linares"]James,
Please try this:
Code: Select all
AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, CLR_WHITE,;
If( oRb:nOverPrompt( ScreenToClient( oRb:hWnd, GetCursorPos() )[ 1 ], ScreenToClient( oRb:hWnd, GetCursorPos() )[ 2 ] ) == nPrompt, CLR_HRED, CLR_WHITE ) ) } )
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC