From db7a876f86cdb38f328cb116cf7297026d4dbf84 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 16 Apr 2011 05:52:30 +0000 Subject: [PATCH] 2011-04-15 22:43 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpfontdialog.prg * contrib/hbxbp/xbpmenubar.prg * contrib/hbxbp/xbpstatic.prg * contrib/hbxbp/xbpwindow.prg ! Restructured: Presentation Parameters engine. Restored: CSS enabled presentation parameters management. Perhaps this is the only way to handle many artifacts cummulatively. The engine is enhanced to offer users as Harbour extenstion, to enhance GUI components. oXbp:setStyleSheet( cIdentifier, cCSS ) where can be used to re-arrange widget attributes. * contrib/hbxbp/tests/demoxbp.prg ! Commented-out but adopted to new protocol :setStyleSheet() calls. --- harbour/ChangeLog | 16 +++ harbour/contrib/hbxbp/tests/demoxbp.prg | 36 +++--- harbour/contrib/hbxbp/xbpfontdialog.prg | 2 + harbour/contrib/hbxbp/xbpmenubar.prg | 30 +---- harbour/contrib/hbxbp/xbpstatic.prg | 4 +- harbour/contrib/hbxbp/xbpwindow.prg | 157 ++++++++++++++++++++---- 6 files changed, 173 insertions(+), 72 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8c19a268e8..e558fbbf18 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2011-04-15 22:43 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbxbp/xbpfontdialog.prg + * contrib/hbxbp/xbpmenubar.prg + * contrib/hbxbp/xbpstatic.prg + * contrib/hbxbp/xbpwindow.prg + ! Restructured: Presentation Parameters engine. + Restored: CSS enabled presentation parameters management. + Perhaps this is the only way to handle many artifacts + cummulatively. The engine is enhanced to offer users as + Harbour extenstion, to enhance GUI components. + oXbp:setStyleSheet( cIdentifier, cCSS ) where + can be used to re-arrange widget attributes. + + * contrib/hbxbp/tests/demoxbp.prg + ! Commented-out but adopted to new protocol :setStyleSheet() calls. + 2011-04-15 22:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/hbmk2_qt.hbs * contrib/hbrun/headers.prg diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index f05ed04ad5..207c61b3b3 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -138,8 +138,8 @@ DispMem( "oDlg := GuiStdDialog" ) ( aSize[ 2 ] - oDlg:currentSize()[ 2 ] ) / 2 } ) /* Make background color of :drawingArea different */ - oDa:setColorBG( GraMakeRGBColor( { 134,128,200 } ) ) oDa:setFontCompoundName( "10.Tohama italics" ) + oDa:setColorBG( GraMakeRGBColor( { 134,128,200 } ) ) //oDa:setColorFG( GraMakeRGBColor( { 255,255,255 } ) ) #ifdef __HARBOUR__ @@ -415,7 +415,8 @@ STATIC FUNCTION MyFunctionXbp( nMode ) /*----------------------------------------------------------------------*/ FUNCTION Build_ToolBar( oDA ) - LOCAL oTBar, s, txt_:= {} + LOCAL oTBar + //LOCAL s, txt_:= {} // Create an XbpToolBar object and // add it at the top of the dialog @@ -449,7 +450,7 @@ FUNCTION Build_ToolBar( oDA ) oTBar:transparentColor := GRA_CLR_INVALID oTBar:buttonClick := {|oButton| ExeToolbar( oButton, oDa ) } - #ifdef __HARBOUR__ + #ifdef __xHARBOUR__ aadd( txt_, ' ' ) aadd( txt_, ' QToolBar { ' ) aadd( txt_, ' background: cyan; ' ) @@ -464,7 +465,7 @@ FUNCTION Build_ToolBar( oDA ) s := "" aeval( txt_, {|e| s += e + chr( 13 )+chr( 10 ) } ) - oTBar:setStyleSheet( s ) + oTBar:setStyleSheet( "TOOLBAR", s ) #endif RETURN nil @@ -767,7 +768,6 @@ FUNCTION Build_PushButton( oDA ) oXbp:create( , , {180,200}, {90,40} ) oXbp:activate:= {|| MsgBox( "Pushbutton A" ) } /* Harbour supports presentation colors */ - //oXbp:setColorBG( GraMakeRGBColor( {133,240,90} ) ) oXbp:setColorBG( GraMakeRGBColor( {0,0,255} ) ) oXbp := XbpPushButton():new( oDA ) @@ -924,8 +924,8 @@ FUNCTION Build_TreeView( oWnd ) oTree:hasButtons := .T. oTree:create() oTree:itemCollapsed := {|oItem,aRect,oSelf| HB_SYMBOL_UNUSED( aRect ), HB_SYMBOL_UNUSED( oSelf ), MsgBox( oItem:caption ) } - #ifdef __HARBOUR__ - oTree:setStyleSheet( GetTreeStyleSheet() ) + #ifdef __xHARBOUR__ + oTree:setStyleSheet( "MYTREE", GetTreeStyleSheet() ) #endif FOR i := 1 TO 5 WorkAreaInfo( oTree, i ) @@ -1276,8 +1276,8 @@ FUNCTION Build_HTMLViewer( oWnd ) oFrm:type := XBPSTATIC_TYPE_RECESSEDBOX oFrm:options := XBPSTATIC_FRAMETHICK oFrm:create() - #ifdef __HARBOUR__ - //oFrm:setStyleSheet( "border: 2px solid yellow;" ) + #ifdef __xHARBOUR__ + //oFrm:setStyleSheet( "HTML", "border: 2px solid yellow;" ) #endif sz_:= oFrm:currentSize() @@ -1639,7 +1639,7 @@ STATIC FUNCTION RtfApplyFont( oRTF ) /*----------------------------------------------------------------------*/ FUNCTION Build_Browse( oWnd ) - LOCAL aPresParam, oXbpBrowse, oXbpColumn, s + LOCAL aPresParam, oXbpBrowse, oXbpColumn LOCAL cPath := hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() Set( _SET_DATEFORMAT, "yyyy.mm.dd" ) /* ANSI */ @@ -1677,9 +1677,9 @@ FUNCTION Build_Browse( oWnd ) oXbpBrowse:headerRbDown := {|mp1, mp2, o| HB_SYMBOL_UNUSED( mp1 ), HB_SYMBOL_UNUSED( mp2 ), HB_SYMBOL_UNUSED( o ) } - #ifdef __HARBOUR__ + #ifdef __xHARBOUR__ s := "selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5, stop: 0 #FF92BB, stop: 1 gray); " - oXbpBrowse:setStyleSheet( s ) + oXbpBrowse:setStyleSheet( "XBPBROWSE", s ) #endif aPresParam := {} @@ -1702,7 +1702,7 @@ FUNCTION Build_Browse( oWnd ) oXbpColumn := XbpColumn():new() oXbpColumn:type := XBPCOL_TYPE_FILEICON cPath := hb_DirBase() + hb_ps() - oXbpColumn:dataLink := {|n| n := recno(), IF( n%3 == 0, cPath + "abs3.png", IF( n%5 == 0, cPath + "copy.png", cPath + "vr.png" ) ) } + oXbpColumn:dataLink := {|n| n := recno(), iif( n%3 == 0, cPath + "abs3.png", iif( n%5 == 0, cPath + "copy.png", cPath + "vr.png" ) ) } oXbpColumn:create( , , , , aPresParam ) // oXbpBrowse:addColumn( oXbpColumn ) @@ -1726,7 +1726,7 @@ FUNCTION Build_Browse( oWnd ) oXbpColumn := XbpColumn():new() oXbpColumn:dataLink := {|| test->Last } - oXbpColumn:colorBlock := {|x| IF( left( x,1 ) $ "L,H", { GRA_CLR_BLUE, GRA_CLR_YELLOW }, { NIL, NIL } ) } + oXbpColumn:colorBlock := {|x| iif( left( x,1 ) $ "L,H", { GRA_CLR_BLUE, GRA_CLR_YELLOW }, { NIL, NIL } ) } oXbpColumn:create( , , , , aPresParam ) // oXbpBrowse:addColumn( oXbpColumn ) @@ -1838,7 +1838,7 @@ FUNCTION Build_Browse( oWnd ) aadd( aPresParam, { XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_ROWHEIGHT , 20 } ) - aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "USA" } ) + aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "City" } ) aadd( aPresParam, { XBP_PP_COL_FA_FGCLR , GRA_CLR_BLACK } ) aadd( aPresParam, { XBP_PP_COL_FA_BGCLR , GRA_CLR_DARKGRAY } ) aadd( aPresParam, { XBP_PP_COL_FA_HEIGHT , 25 } ) @@ -1861,7 +1861,7 @@ FUNCTION Build_Browse( oWnd ) aadd( aPresParam, { XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_ROWHEIGHT , 20 } ) - aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "USA" } ) + aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "St" } ) aadd( aPresParam, { XBP_PP_COL_FA_FGCLR , GRA_CLR_BLACK } ) aadd( aPresParam, { XBP_PP_COL_FA_BGCLR , GRA_CLR_DARKGRAY } ) aadd( aPresParam, { XBP_PP_COL_FA_HEIGHT , 25 } ) @@ -1884,7 +1884,7 @@ FUNCTION Build_Browse( oWnd ) aadd( aPresParam, { XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_ROWHEIGHT , 20 } ) - aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "USA" } ) + aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "Zip-USA" } ) aadd( aPresParam, { XBP_PP_COL_FA_FGCLR , GRA_CLR_BLACK } ) aadd( aPresParam, { XBP_PP_COL_FA_BGCLR , GRA_CLR_DARKGRAY } ) aadd( aPresParam, { XBP_PP_COL_FA_HEIGHT , 25 } ) @@ -1907,7 +1907,7 @@ FUNCTION Build_Browse( oWnd ) aadd( aPresParam, { XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED } ) aadd( aPresParam, { XBP_PP_COL_DA_ROWHEIGHT , 20 } ) - aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "Generic" } ) + aadd( aPresParam, { XBP_PP_COL_FA_CAPTION , "Notes" } ) aadd( aPresParam, { XBP_PP_COL_FA_FGCLR , GRA_CLR_BLACK } ) aadd( aPresParam, { XBP_PP_COL_FA_BGCLR , GRA_CLR_DARKGRAY } ) aadd( aPresParam, { XBP_PP_COL_FA_HEIGHT , 25 } ) diff --git a/harbour/contrib/hbxbp/xbpfontdialog.prg b/harbour/contrib/hbxbp/xbpfontdialog.prg index aabc2c2686..5b9a2943eb 100644 --- a/harbour/contrib/hbxbp/xbpfontdialog.prg +++ b/harbour/contrib/hbxbp/xbpfontdialog.prg @@ -450,6 +450,8 @@ METHOD XbpFont:create( cFontName ) nPoint := 12 ENDIF + ::setCompoundName( hb_ntos( nPoint ) + "." + cFont + " " + cAttr ) + ::oWidget := QFont( cFont, nPoint ) ::oWidget:setBold( ::bold ) diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index 2678c9a8d6..e3c7e525d9 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -147,8 +147,6 @@ CLASS xbpMenuBar INHERIT xbpWindow METHOD setStyle() METHOD numItems() INLINE len( ::aMenuItems ) - METHOD setStyleSheet( cCSS, cCSSPops ) - ENDCLASS /*----------------------------------------------------------------------*/ @@ -603,21 +601,8 @@ METHOD XbpMenuBar:onMenuKey( ... ) /*----------------------------------------------------------------------*/ -METHOD xbpMenuBar:setStyleSheet( cCSS, cCSSPops ) - LOCAL oMenu - - FOR EACH oMenu IN ::aChildren - oMenu:setStyleSheet( cCSSPops ) - NEXT - ::oWidget:setStyleSheet( cCSS ) - - RETURN Self - -/*------------------------------------------------------------------------*/ - METHOD xbpMenuBar:setStyle() - LOCAL txt_:={} - LOCAL s + LOCAL s, txt_:={} aadd( txt_, 'QMenuBar { ' ) aadd( txt_, ' background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, ' ) @@ -667,7 +652,6 @@ CLASS xbpMenu INHERIT xbpMenuBar METHOD setTitle( cTitle ) METHOD popUp( oXbp, aPos, nDefaultItem, nControl ) METHOD setStyle() - METHOD setStyleSheet( cCSS ) ENDCLASS @@ -724,18 +708,6 @@ METHOD xbpMenu:popUp( oXbp, aPos, nDefaultItem, nControl ) /*----------------------------------------------------------------------*/ -METHOD xbpMenu:setStyleSheet( cCSS ) - LOCAL oMenu - - FOR EACH oMenu IN ::aChildren - oMenu:setStyleSheet( cCSS ) - NEXT - ::oWidget:setStyleSheet( cCSS ) - - RETURN Self - -/*------------------------------------------------------------------------*/ - METHOD xbpMenu:setStyle() LOCAL s, txt_:={} diff --git a/harbour/contrib/hbxbp/xbpstatic.prg b/harbour/contrib/hbxbp/xbpstatic.prg index 910f79f072..04621761d5 100644 --- a/harbour/contrib/hbxbp/xbpstatic.prg +++ b/harbour/contrib/hbxbp/xbpstatic.prg @@ -298,9 +298,9 @@ METHOD XbpStatic:setCaption( xCaption, cDll ) ELSEIF hb_isChar( ::caption ) /* $HARBOUR$ */ IF ::options == XBPSTATIC_BITMAP_SCALED - ::oWidget:setStyleSheet( 'border-image: url('+ ::caption +');' ) + ::setCSSAttribute( "XBPSTATIC_BITMAP_SCALED" , 'border-image: url(' + ::caption + ');' ) ELSE - ::oWidget:setStyleSheet( 'background: url('+ ::caption +'); repeat-xy;' ) + ::setCSSAttribute( "XBPSTATIC_BITMAP_NONSCALED", 'background: url(' + ::caption + '); repeat-xy;' ) ENDIF ENDIF diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 2ea3256703..ecc399f987 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -168,6 +168,7 @@ CLASS XbpWindow INHERIT XbpPartHandler DATA qLayout DATA nLayout DATA oFont + DATA aCSS INIT { { "", "" } } METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -187,7 +188,9 @@ CLASS XbpWindow INHERIT XbpPartHandler METHOD setSize( aSize, lPaint ) METHOD isDerivedFrom( cClassORoObject ) METHOD setPresParam( aPPNew ) - METHOD setStyleSheet( cCSS ) INLINE ::oWidget:setStyleSheet( ::oWidget:styleSheet() + " " + cCSS ) + METHOD setCSSAttribute( cAttr, cCSS ) + METHOD setStyleSheet( cAttr, cCSS ) + METHOD getCSS( nAttr, xValue ) DATA cTitle INIT "" METHOD title( cTitle ) SETGET @@ -336,6 +339,23 @@ METHOD XbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ENDIF ::aPP := NIL + /* Initialize CSS parameters */ + IF ( i := ascan( ::aPresParams, {|e_| e_[ 1 ] == XBP_PP_FGCLR } ) ) > 0 + IF ! ( ::aPresParams[ i, 2 ] == NIL ) + ::setCSSAttribute( "XBP_PP_FGCLR", ::getCSS( XBP_PP_FGCLR, ::aPresParams[ i, 2 ] ) ) + ENDIF + ENDIF + IF ( i := ascan( ::aPresParams, {|e_| e_[ 1 ] == XBP_PP_BGCLR } ) ) > 0 + IF ! ( ::aPresParams[ i, 2 ] == NIL ) + ::setCSSAttribute( "XBP_PP_BGCLR", ::getCSS( XBP_PP_BGCLR, ::aPresParams[ i, 2 ] ) ) + ENDIF + ENDIF + IF ( i := ascan( ::aPresParams, {|e_| e_[ 1 ] == XBP_PP_COMPOUNDNAME } ) ) > 0 + IF ! ( ::aPresParams[ i, 2 ] == NIL ) + ::setCSSAttribute( "XBP_PP_COMPOUNDNAME", ::getCSS( XBP_PP_COMPOUNDNAME, ::aPresParams[ i, 2 ] ) ) + ENDIF + ENDIF + DO CASE CASE cClass $ 'XBPDIALOG,XBPDRAWINGAREA' hbxbp_SetPresParamIfNil( ::aPresParams, XBP_PP_BGCLR , XBPSYSCLR_DIALOGBACKGROUND ) @@ -384,6 +404,7 @@ METHOD XbpWindow:setQtProperty( cProperty ) METHOD XbpWindow:postCreate() ::status := iif( ::oWidget:hasValidPointer(), XBP_STAT_CREATE, XBP_STAT_FAILURE ) + ::setStyleSheet() RETURN Self @@ -886,41 +907,131 @@ METHOD XbpWindow:lockUpdate() /*----------------------------------------------------------------------*/ STATIC FUNCTION Xbp_RgbToName( nRgb ) - LOCAL oColor := QColor( nRGB ) - LOCAL cName := oColor:name - + LOCAL cName := QColor( nRGB ):name() RETURN '#'+substr( cName,6 ) + substr( cName,4,2 ) + substr( cName,2,2 ) /*----------------------------------------------------------------------*/ -METHOD XbpWindow:setColorBG( nRGB ) - LOCAL oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_BGCLR, nRGB ) - LOCAL oPalette +METHOD XbpWindow:setStyleSheet( cAttr, cCSS ) + LOCAL n, s := "" - oPalette := ::oWidget:palette() - oPalette:setColor( QPalette_Window, QColor( nRGB ) ) - ::oWidget:setPalette( oPalette ) + IF ! empty( cAttr ) + ::setCSSAttribute( cAttr, cCSS ) + ENDIF + FOR n := 1 TO len( ::aCSS ) + s += ::aCSS[ n,2 ] + " " + NEXT + + ::oWidget:setStyleSheet( "" ) /* Must Enforce It */ + ::oWidget:setStyleSheet( s ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD XbpWindow:setCSSAttribute( cAttr, cCSS ) + LOCAL n + + DEFAULT cCSS TO "" + + IF ( n := ascan( ::aCSS, {|e_| e_[ 1 ] == cAttr } ) ) == 0 + aadd( ::aCSS, { cAttr, cCSS } ) + ELSE + ::aCSS[ n, 2 ] := cCSS + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD XbpWindow:getCSS( nAttr, xValue ) + LOCAL s, n, nPoint, cFont, cFace, cCSS + LOCAL aAttr := { "bolditalic", "italic", "bold" } + LOCAL cAttr := "normal" + LOCAL cWeight := "normal" + + SWITCH nAttr + + CASE XBP_PP_COMPOUNDNAME + cFont := xValue + s := lower( cFont ) + n := ascan( aAttr, {|e| at( e, cFont ) > 0 } ) + IF n > 0 + cAttr := aAttr[ n ] + n := at( cAttr, s ) + cFont := substr( cFont, 1, n-1 ) + ENDIF + IF ( n := at( ".", cFont ) ) > 0 + nPoint := val( substr( cFont,1,n-1 ) ) + cFont := substr( cFont,n+1 ) + ELSE + nPoint := 0 + ENDIF + cFace := alltrim( cFont ) + + IF cAttr == "bolditalic" + cAttr := "italic" + cWeight := "bold" + ENDIF + IF cAttr == "bold" + cAttr := "normal" + cWeight := "bold" + ENDIF + + cCSS := 'font-family: "'+ cFace + '"; font-style: ' + cAttr + '; font-size: ' + ; + hb_ntos( nPoint ) + 'pt; font-weight: ' + cWeight + ';' + RETURN cCSS + + CASE XBP_PP_BGCLR + RETURN "background-color: " + Xbp_RgbToName( xValue ) + ";" + + CASE XBP_PP_FGCLR + RETURN "color: " + Xbp_RgbToName( xValue ) + ";" + + ENDSWITCH + + RETURN "" + +/*----------------------------------------------------------------------*/ + +METHOD XbpWindow:setColorBG( nRGB ) + LOCAL oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_BGCLR ) + + IF hb_isNumeric( nRGB ) + hbxbp_SetPresParam( ::aPresParams, XBP_PP_BGCLR, nRGB ) + ::setCSSAttribute( "XBP_PP_BGCLR", ::getCSS( XBP_PP_BGCLR, nRGB ) ) + ::setStyleSheet() + ENDIF RETURN oldRGB /*----------------------------------------------------------------------*/ METHOD XbpWindow:setColorFG( nRGB ) - LOCAL oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR, nRGB ) - LOCAL oPalette + LOCAL oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR ) - oPalette := ::oWidget:palette() - oPalette:setColor( QPalette_WindowText, QColor( nRGB ) ) - ::oWidget:setPalette( oPalette ) + IF hb_isNumeric( nRGB ) + hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR, nRGB ) + ::setCSSAttribute( "XBP_PP_FGCLR", ::getCSS( XBP_PP_FGCLR, nRGB ) ) + ::setStyleSheet() + ENDIF RETURN oldRGB /*----------------------------------------------------------------------*/ METHOD XbpWindow:setFont( oFont ) + LOCAL cAttr := "" - ::oFont := oFont - ::oWidget:setFont( ::oFont:oWidget ) + IF oFont:bold .and. oFont:italic + cAttr := "bolditalic" + ELSEIF oFont:bold + cAttr := "bold" + ELSEIF oFont:italic + cAttr := "italic" + ENDIF + + ::setFontCompoundName( oFont:compoundName + " " + cAttr ) RETURN Self @@ -928,13 +1039,13 @@ METHOD XbpWindow:setFont( oFont ) METHOD XbpWindow:setFontCompoundName( xFont ) LOCAL cOldFont := hbxbp_SetPresParam( ::aPresParams, XBP_PP_COMPOUNDNAME ) - LOCAL oFont - oFont := Xbpfont():new( Self ):create( xFont ) - - hbxbp_SetPresParam( ::aPresParams, XBP_PP_COMPOUNDNAME, xFont ) - - ::setFont( oFont ) + IF ! hb_isNumeric( xFont ) + IF ! empty( xFont ) + ::setCSSAttribute( "XBP_PP_COMPOUNDNAME", ::getCSS( XBP_PP_COMPOUNDNAME, xFont ) ) + ::setStyleSheet() + ENDIF + ENDIF RETURN cOldFont