#include "fivewin.ch"
#include "ribbon.ch"
function main()
local oWnd
local oBtn1, oBtn2, oBtn3, oBtn4
DEFINE WINDOW oWnd
@ 30, 30 RBBTN oBtn1 PROMPT "&Ok" OF oWnd BORDER SIZE 100, 30 ROUND ROUNDSIZE 2 CENTER ;
LINECOLORS RGB( 255,255,255 ), RGB( 255, 0, 0);
GRADIANT { { 0.3, RGB( 254, 154, 128 ), RGB( 254, 154, 128 ) }, ;
{ 0.7, RGB( 252, 85, 40 ), RGB( 181, 61, 29 ) } }
oBtn1:bClrGradNormal = { | lPressed | if ( lPressed,;
{ { 1, RGB( 181, 61, 29 ), RGB( 254, 154, 128 ) } },;
{ { 1, RGB( 254, 154, 128 ), RGB( 181, 61, 29 ) } } ) }
ACTIVATE WINDOW oWnd
return nil
ACTIVATE DIALOG oDlg ON INIT oBtn:lTransparent := .F.
#ifdef __HARBOUR__
AEval( ::aControls,;
{ | o | If( ! Upper( o:ClassName() ) $ ;
"TGET;TMULTIGET;TBTNBMP;TCOMBOBOX;TWBROWSE;TCBROWSE;TXBROWSE;TLISTBOX;TRBTN" .and. ;
! o:IsKindOf( 'TXBROWSE' ),;
o:lTransparent := .t.,) } )
#else
AEval( ::aControls,;
{ | o | If( ! Upper( o:ClassName() ) $ ;
"TGET;TMULTIGET;TBTNBMP;TCOMBOBOX;TWBROWSE;TCBROWSE;TXBROWSE;TLISTBOX;TRBTN",;
o:lTransparent := .t.,) } )
#endif
Raymundo Islas M. wrote:Daniel : Si cambio los colores directamente a la clase, para que todos los botones manejen el mismo color (degradado) afectaria a los botones que tengo en la ribbon ?? o es otra clase aparte ?
Ruben Fernandez wrote:Para asegurarte podrías hacer una prueba, aunque creo que hay que esperar que se puedan usar con SkinButtons()
#include "fivewin.ch"
#include "ribbon.ch"
#define SKIN_DEFAULT 1
#define SKIN_RED 2
#define SKIN_GREEN 3
#define SKIN_GRAY 4
function main()
local oWnd
local oBtn1, oBtn2, oBtn3
local aSkin := Array( 4 )
BuildSkin( aSkin )
DEFINE WINDOW oWnd
@ 30, 30 RBBTN oBtn1 PROMPT "&Ok" OF oWnd BORDER SIZE 100, 30 ROUND ROUNDSIZE 2 CENTER
@ 70, 30 RBBTN oBtn2 PROMPT "&Ok" OF oWnd BORDER SIZE 100, 30 ROUND ROUNDSIZE 2 CENTER
@ 110, 30 RBBTN oBtn3 PROMPT "&Ok" OF oWnd BORDER SIZE 100, 30 ROUND ROUNDSIZE 2 CENTER ;
ACTION ( aSkin[ SKIN_DEFAULT ]:SetSkin( oBtn1 ), oBtn1:Refresh() )
aSkin[ SKIN_RED ]:SetSkin( oBtn1 )
aSkin[ SKIN_GREEN ]:SetSkin( oBtn2 )
aSkin[ SKIN_GRAY ]:SetSkin( oBtn3 )
ACTIVATE WINDOW oWnd
return nil
FUNCTION BuildSkin( aSkin )
//default skin
aSkin[ SKIN_DEFAULT ] = TSkinRBtn():New()
//skin red
aSkin[ SKIN_RED ] = TSkinRBtn():New()
aSkin[ SKIN_RED ]:nClrBoxIn = RGB( 255,255,255 )
aSkin[ SKIN_RED ]:nClrBoxOut = RGB( 255, 0, 0)
aSkin[ SKIN_RED ]:aGradiant = { { 0.3, RGB( 254, 154, 128 ), RGB( 254, 154, 128 ) }, ;
{ 0.7, RGB( 252, 85, 40 ), RGB( 181, 61, 29 ) } }
aSkin[ SKIN_RED ]:bClrGradNormal = { | lPressed | if ( lPressed,;
{ { 1, RGB( 181, 61, 29 ), RGB( 254, 154, 128 ) } },;
{ { 1, RGB( 254, 154, 128 ), RGB( 181, 61, 29 ) } } ) }
//skin green
aSkin[ SKIN_GREEN ] = TSkinRBtn():New()
aSkin[ SKIN_GREEN ]:nClrBoxIn = RGB( 255,255,255 )
aSkin[ SKIN_GREEN ]:nClrBoxOut = RGB( 100, 200, 100 )
aSkin[ SKIN_GREEN ]:aGradiant = { { 0.3, RGB( 150, 255, 150 ), RGB( 150, 255, 150 ) }, ;
{ 0.7, RGB( 180, 230, 100 ), RGB( 200, 255, 200 ) } }
aSkin[ SKIN_GREEN ]:bClrGradNormal = { | lPressed | if ( lPressed,;
{ { 1, RGB( 200, 255, 200 ), RGB( 110, 255, 110 ) } },;
{ { 1, RGB( 110, 255, 110 ), RGB( 200, 255, 200 ) } } ) }
//skin green
aSkin[ SKIN_GRAY ] = TSkinRBtn():New()
aSkin[ SKIN_GRAY ]:nClrBoxIn = RGB( 200,200,200 )
aSkin[ SKIN_GRAY ]:nClrBoxOut = RGB( 100, 100, 100 )
aSkin[ SKIN_GRAY ]:aGradiant = { { 0.3, RGB( 200, 200, 200 ), RGB( 200, 200, 200 ) }, ;
{ 0.7, RGB( 200, 200, 200 ), RGB( 100, 100, 100 ) } }
aSkin[ SKIN_GRAY ]:bClrGradNormal = { | lPressed | if ( lPressed,;
{ { 1, RGB( 200, 200, 200 ), RGB( 100, 100, 100 ) } },;
{ { 1, RGB( 100, 100, 100 ), RGB( 200, 200, 200 ) } } ) }
RETURN NIL
//-----------------------------------------------------//
#define BLUE0 RGB( 218, 229, 243 )
#define BLUE1 RGB( 199, 216, 237 )
#define BLUEBOX0 RGB( 141, 178, 227 )
#define BLUEBOX2 RGB( 237, 242, 248 )
CLASS TSkinRBtn
DATA bClrGradNormal
DATA aClrGradOver
DATA bClrGradSubOver
DATA aClrGradUnder
DATA aClrGradBack
DATA aGradiant
DATA bClrText
DATA bClrGradSelectPress
DATA bClrGradSelect
DATA aClrGradBtnGr
DATA nClrBoxIn, nClrBoxOut
METHOD New( bClrGradNormal, aClrGradOver, bClrGradSubOver, aClrGradUnder,;
aClrGradBack, aGradiant, bClrText, bClrGradSelectPress, bClrGradSelect,;
aClrGradBtnGr )
METHOD SetSkin( oRBtn )
ENDCLASS
//-----------------------------------------------------//
METHOD New( bClrGradNormal, aClrGradOver, bClrGradSubOver, aClrGradUnder,;
aClrGradBack, aGradiant, bClrText, bClrGradSelectPress, bClrGradSelect,;
aClrGradBtnGr, nClrBoxIn, nClrBoxOut, nRound ) CLASS TSkinRBtn
DEFAULT aGradiant := { {0.3, BLUE0, BLUE0 }, { 0.7, BLUE1, BLUE0 } }
DEFAULT nClrBoxOut := BLUEBOX0, nClrBoxIn := BLUEBOX2
DEFAULT bClrGradNormal := { | lPressed | if ( lPressed,;
{ ;
{ 1/3, nRGB( 254, 215, 169 ), nRGB( 251, 179, 99 ) } , ;
{ 2/3, nRGB( 250, 155, 50 ), nRGB( 253, 239, 173 ) } ;
},;
{;
{ 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 147 ) } , ;
{ 2/3, nRGB( 255, 215, 86 ), nRGB( 255, 231, 153 ) } ;
} ) }
DEFAULT 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 ) };
} ) }
DEFAULT aClrGradUnder := {|| { {1 , nRGB( 248,186,107), nRGB( 255, 253, 222 ) } } }
DEFAULT aClrGradOver := {|| { {1 , nRGB( 255,215,84), nRGB( 255, 253, 222 ) } } }
DEFAULT aClrGradBack := { { 1 , nRGB( 255, 253, 222 ), nRGB( 255, 253, 222 ) } }
DEFAULT bClrGradSelect := {| lSelected | if( lSelected ,;
{ ;
{1/3, nRGB( 253,212,168 ), nRGB( 251,178,99 ) },;
{2/3, nRGB( 250,157,52 ), nRGB( 252,234,163 ) };
},;
{ ;
{1/3, nRGB( 245,177,110 ), nRGB( 243,165,89 ) },;
{2/3, nRGB( 216,136,52 ), nRGB( 249,202,98 ) } ;
} ) }
DEFAULT bClrGradSelectPress := {| lPressed | if( lPressed ,;
{ ;
{ 1/3, nRGB( 248, 187, 107 ), nRGB( 253, 171, 98 ) } , ;
{ 2/3, nRGB( 253, 154, 63 ), nRGB( 255, 164, 64 ) };
},;
{ ;
{1/3, nRGB( 245,177,110 ), nRGB( 243,165,89 ) },;
{2/3, nRGB( 216,136,52 ), nRGB( 249,202,98 ) } ;
} ) }
DEFAULT aClrGradBtnGr := {|| ;
{ ;
{ 1/3, nRGB( 200, 219, 238 ), nRGB( 201, 221, 246 ) } , ;
{ 2/3, nRGB( 192, 212, 237 ), nRGB( 208, 225, 247 ) };
} }
::bClrGradNormal = bClrGradNormal
::aClrGradOver = aClrGradOver
::bClrGradSubOver= bClrGradSubOver
::aClrGradUnder = aClrGradUnder
::aClrGradBack = aClrGradBack
::bClrGradSelect = bClrGradSelect
::bClrGradSelectPress = bClrGradSelectPress
::aClrGradBtnGr = aClrGradBtnGr
::aGradiant = aGradiant
::nClrBoxIn = nClrBoxIn
::nClrBoxOut = nClrBoxOut
RETURN Self
//-----------------------------------------------------//
METHOD SetSkin( oRBtn ) CLASS TSkinRBtn
IF oRBtn:hBack != NIL
DeleteObject( oRBtn:hBack )
oRBtn:hBack = NIL
ENDIF
oRBtn:bClrGradNormal = ::bClrGradNormal
oRBtn:aClrGradOver = ::aClrGradOver
oRBtn:bClrGradSubOver = ::bClrGradSubOver
oRBtn:aClrGradUnder = ::aClrGradUnder
oRBtn:aClrGradBack = ::aClrGradBack
oRBtn:bClrGradSelect = ::bClrGradSelect
oRBtn:bClrGradSelectPress = ::bClrGradSelectPress
oRBtn:aClrGradBtnGr = ::aClrGradBtnGr
oRBtn:aGradiant = ::aGradiant
oRBtn:nClrBoxIn = ::nClrBoxIn
oRBtn:nClrBoxOut = ::nClrBoxOut
RETURN NIL
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 46 guests