I made some modifies on Ribbon Class
Skin feature
I made 4 style
1 = blue Normal default ( 2007)
2 = black
3 = Silver
4= Office 2010
to first you must createa new file SkinRb.ch
and insert this lines and save it
#define BLACK0 RGB(50,50,49)
#define BLACK1 RGB(83,83,83)
#define BLACK3 RGB(184,185,184)
#define BLACKBOX0 RGB(172,175,175)
#define BLACKBOX1 RGB(83,83,83)
#define BLACKBOX2 RGB(184,185,184)
#define BLACK2 RGB(172,175,175)
#define SILVER0 RGB(189,195,204)
#define SILVER1 RGB(208,212,221)
#define SILVER3 RGB(220,223,232)
#define SILVERBOX0 RGB(189,195,204)
#define SILVERBOX1 RGB(208,212,221)
#define SILVERBOX2 RGB(119,114,99)
#define SILVER2 RGB(209,213,224)
#define OFFICE20100 RGB(255,255,255)
#define OFFICE20101 RGB(233,241,246)
#define OFFICE20103 RGB(237,239,242)
#define OFFICE2010BOX0 RGB(255,255,255)
#define OFFICE2010BOX1 RGB(233,241,246)
#define OFFICE2010BOX2 RGB(208,212,221)
#define OFFICE20102 RGB(237,239,242)
then you must add on Ribbon.ch before of #endif this line
#command SET RIBBONBAR STYLE <nstyle> ;
[ OF <oRBAR> ] ;
=> ;
<oRBAR>:SetStyle( <nstyle> )
the you must add to tribbon.prg class :
#include "SkinRb.ch"
CLASS TRibbonBar FROM TControl
...
DATA color0,color1,colorBox0,Colorbox1
DATA RibbonStyle
METHOD SetStyle( nStyle )
....
ENDCLASS
then you must add this method to bottom of the class
Code: Select all
METHOD SetStyle( nStyle ) CLASS TRibbonBar
local hBmp
local n, j, z, oControl
do case
case nStyle == 1 // Blue Normal Default
::color0 := BLUE0
::color1 := BLUE1
::colorBox0 := BLUEBOX0
::Colorbox1 := BLUEBOX1
::aGrad := { {0.12, ::color0 , ::color0 }, { 0.70, ::color1, ::color0 }, { 0.18, ::color0 , CLR_WHITE }}
::aGradFld := { { 1, CLR_WHITE, ::color0 } }
::aGradHigh := { { 1, BLUE3, RGB( 202,172,136 ) } }
::aGradOver := { { 1, RGB( 197,221,251), RGB( 226,209,162)} }
::nClrBoxOut := BLUEBOX0
::nClrBoxIn := BLUEBOX2
::nClrBoxSelOut := YELBOX0
::nClrBoxSelIn := YELBOX1
::nClrPaneRB := BLUE3
case nStyle == 2 //Black
::color0 := BLACK0
::color1 := BLACK1
::colorBox0 := BLACKBOX0
::Colorbox1 := BLACKBOX1
::aGrad := { {0.12, BLACK0, BLACK0 }, { 0.70, BLACK1, BLACK0 }, { 0.18, BLACK0, CLR_WHITE }}
::aGradFld := { { 1, CLR_WHITE, BLACK0 } }
::aGradHigh := { { 1, BLACK3, BLACK1 } }
::aGradOver := { { 1, BLACK0, BLACK0} }
::nClrBoxOut := BLACKBOX0
::nClrBoxIn := BLACKBOX2
::nClrBoxSelOut := YELBOX0
::nClrBoxSelIn := YELBOX1
::nClrPaneRB := BLACK3
case nStyle == 3 //Silver
::color0 := SILVER0
::color1 := SILVER1
::colorBox0 := SILVERBOX0
::Colorbox1 := SILVERBOX1
::aGrad := { {0.12, SILVER0, SILVER0 }, { 0.70, SILVER1, SILVER0 }, { 0.18, SILVER0, CLR_WHITE }}
::aGradFld := { { 1, CLR_WHITE, SILVER0 } }
::aGradHigh := { { 1, SILVER3, RGB( 202,172,136 ) } }
::aGradOver := { { 1, RGB( 197,221,251), RGB( 226,209,162)} }
::nClrBoxOut := SILVERBOX0
::nClrBoxIn := SILVERBOX2
::nClrBoxSelOut := YELBOX0
::nClrBoxSelIn := YELBOX1
::nClrPaneRB := SILVER3
case nStyle == 4 //Office2010
::color0 := OFFICE20100
::color1 := OFFICE20101
::colorBox0 := OFFICE2010BOX0
::Colorbox1 := OFFICE2010BOX1
::aGrad := { {0.12, OFFICE20100 , OFFICE20100 }, { 0.70, OFFICE20101, OFFICE20100 }, { 0.18, OFFICE20100 , CLR_WHITE }}
::aGradFld := { { 1, CLR_WHITE, OFFICE20100 } }
::aGradHigh := { { 1, OFFICE20103, RGB( 202,172,136 ) } }
::aGradOver := { { 1, RGB( 197,221,251), RGB( 226,209,162)} }
::nClrBoxOut := OFFICE2010BOX0
::nClrBoxIn := OFFICE2010BOX2
::nClrBoxSelOut := YELBOX0
::nClrBoxSelIn := YELBOX1
::nClrPaneRB := OFFICE20103
otherwise
if ::bStyle != nil
eval( ::bStyle, self )
endif
endcase
//From Function Change_Colors of Antonio Linares
hBmp := GradientBmp( self, ::nRight - ::nRightMargin - 3,;
::nBottom - ::nTopMargin +1, ::aGrad )
DeleteObject( ::hBrushEx )
::hBrushEx = CreatePatternBrush( hBmp )
DeleteObject( hBmp )
::Refresh()
for n = 1 to Len( ::aDialogs )
DeleteObject( ::aDialogs[ n ]:hBack )
::aDialogs[ n ]:hBack = ::hBrushEx
if ! Empty( ::aDialogs[ n ]:aControls )
for j = 1 to len( ::aDialogs[ n ]:aControls )
oControl = ::aDialogs[ n ]:aControls[ j ]
if oControl:ClassName() == "TRBGROUP" .or. oControl:ClassName() =="TRBTN"
DeleteObject( oControl:hBrushUnsel )
oControl:hBrushUnsel = ::hBrushEx
DeleteObject( oControl:hBrushSel )
oControl:hBrushSel = nil
oControl:SetStyle(nStyle )
endif
next
endif
::aDialogs[ n ]:Refresh()
next
return 0
then you must modify trbgroup.prg
#include "SkinRb.ch"
ADD this method
METHOD SetStyle( nStyle )
...
ENDCLASS
and on the bottom add this method
Code: Select all
METHOD SetStyle( nStyle ) CLASS TRBGroup
local hBmp
local n, j, z, oControl
do case
case nStyle == 1 // Blue Normal Default
::nClrBoxIn := BLUEBOX2
::nClrBoxOut := BLUEBOX0
::aGradSel := { {0.1, BLUE0, BLUE0 }, { 0.9, BLUE1, BLUE0 } }
::aGradCaption = { { 0.3, BLUE0,BLUE0 }, ;
{ 0.7, BLUE0, BLUE1 } }
::aGradDisable := { {0.17,RGB( 245,245,245 ),RGB( 245,245,245 ) },;
{ 0.83,RGB( 233,233,233 ), RGB( 233,233,233 ) } }
::aGradDisableCaption := { {1,RGB( 220,220,220 ),RGB( 220,220,220 ) } }
case nStyle == 2 //Black
::nClrBoxIn := BLACKBOX2
::nClrBoxOut := BLACKBOX0
::aGradSel := { {0.1, BLACK0, BLACK0 }, { 0.9, BLACK1, BLACK0 } }
::aGradCaption = { { 0.3, BLACK0,BLACK0 }, ;
{ 0.7, BLACK0, BLACK1 } }
::aGradDisable := { {0.17,RGB( 245,245,245 ),RGB( 245,245,245 ) },;
{ 0.83,RGB( 233,233,233 ), RGB( 233,233,233 ) } }
::aGradDisableCaption := { {1,RGB( 220,220,220 ),RGB( 220,220,220 ) } }
case nStyle == 3 //Silver
::nClrBoxIn := SILVERBOX2
::nClrBoxOut := SILVERBOX0
::aGradSel := { {0.1, SILVER0, SILVER0 }, { 0.9, SILVER1, SILVER0 } }
::aGradCaption = { { 0.3, SILVER0,SILVER0 }, ;
{ 0.7, SILVER0, SILVER1 } }
::aGradDisable := { {0.17,RGB( 245,245,245 ),RGB( 245,245,245 ) },;
{ 0.83,RGB( 233,233,233 ), RGB( 233,233,233 ) } }
::aGradDisableCaption := { {1,RGB( 220,220,220 ),RGB( 220,220,220 ) } }
case nStyle == 4 //wINDOWS 7 OFFICE2010
::nClrBoxIn := OFFICE2010BOX2
::nClrBoxOut := OFFICE2010BOX0
::aGradSel := { {0.1, OFFICE20100, OFFICE20100 }, { 0.9, OFFICE20101, OFFICE20100 } }
::aGradCaption = { { 0.3,OFFICE20100,OFFICE20100 }, ;
{ 0.7, OFFICE20100, OFFICE20101 } }
::aGradDisable := { {0.17,RGB( 245,245,245 ),RGB( 245,245,245 ) } ,;
{ 0.83,RGB( 233,233,233 ), RGB( 233,233,233 ) } }
::aGradDisableCaption := { {1,RGB( 220,220,220 ),RGB( 220,220,220 ) } }
otherwise
if ::bStyle != nil
eval( ::bStyle, self )
endif
endcase
::refresh()
return 0
If you made these modifies you can call 4 styles for your ribbonbar
sample :
DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Configuración", "Ficheros", "Informes", "Ayudas" HEIGHT 133 TOPMARGIN 25
ADD GROUP oGr1 RIBBON oRBar TO OPTION 1 PROMPT "Font" WIDTH 205
ADD GROUP oGr2 RIBBON oRBar TO OPTION 1 PROMPT "Paragraph" WIDTH 215
ADD GROUP oGr3 RIBBON oRBar TO OPTION 1 PROMPT "Styles" WIDTH 75 BITMAP ".\bitmaps\style16.BMP"
ADD GROUP oGr4 RIBBON oRBar TO OPTION 1 PROMPT "Editing"
....
SET RIBBONBAR STYLE 4 OF oRBar