2009-06-14 00:02 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

+ harbour/contrib/hbxbp/gra.ch
  * harbour/contrib/hbxbp/Makefile
  * harbour/contrib/hbxbp/xbp_temp.prg
  * harbour/contrib/hbxbp/xbpdialog.prg
  * harbour/contrib/hbxbp/xbpgeneric.prg
  + harbour/contrib/hbxbp/xbppushbutton.prg
  + harbour/contrib/hbxbp/xbptoolbar.prg
  * harbour/contrib/hbxbp/xbpwindow.prg

  * harbour/contrib/hbxbp/tests/demoxbp.prg
    + Implemented XbpToolBar() | XbpPushButton() classes.
This commit is contained in:
Pritpal Bedi
2009-06-14 07:05:32 +00:00
parent 2551b5e6be
commit a488c63131
10 changed files with 751 additions and 14 deletions

View File

@@ -17,6 +17,19 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-14 00:02 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
+ harbour/contrib/hbxbp/gra.ch
* harbour/contrib/hbxbp/Makefile
* harbour/contrib/hbxbp/xbp_temp.prg
* harbour/contrib/hbxbp/xbpdialog.prg
* harbour/contrib/hbxbp/xbpgeneric.prg
+ harbour/contrib/hbxbp/xbppushbutton.prg
+ harbour/contrib/hbxbp/xbptoolbar.prg
* harbour/contrib/hbxbp/xbpwindow.prg
* harbour/contrib/hbxbp/tests/demoxbp.prg
+ Implemented XbpToolBar() | XbpPushButton() classes.
2009-06-14 04:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
+ utils/hbmk2/examples/minigui.hbc
+ Added project config for HMG Extended.

View File

@@ -45,11 +45,14 @@ PRG_SOURCES=\
xbpwindow.prg \
xbpparthandler.prg \
xbpmenubar.prg \
xbptoolbar.prg \
xbppushbutton.prg \
PRG_HEADERS=\
xbp.ch \
appevent.ch \
apig.ch \
gra.ch \
include $(TOP)$(ROOT)config/header.cf
INSTALL_RULE_HEADERS := $(INSTALL_RULE)

View File

@@ -0,0 +1,7 @@
/*
* $Id$
*/
#define GRA_CLR_INVALID -6

View File

@@ -54,6 +54,7 @@
#include "xbp.ch"
#include "appevent.ch"
#include "inkey.ch"
#include "gra.ch"
/*----------------------------------------------------------------------*/
@@ -72,7 +73,13 @@ PROCEDURE Main()
( aSize[ 2 ] - oDlg:currentSize()[ 2 ] ) / 2 } )
/* Install menu system */
Build_MenuBar( oDlg )
Build_MenuBar()
/* Install Toolbar */
Build_ToolBar( oDlg:drawingArea )
/* install Push Buttons */
Build_PushButton( oDlg:drawingArea )
/* Make background color of :drawingArea different */
oDlg:drawingArea:setColorBG( GraMakeRGBColor( { 134,128,164 } ) )
@@ -96,6 +103,11 @@ PROCEDURE Main()
/*----------------------------------------------------------------------*/
PROCEDURE AppSys()
RETURN
/*----------------------------------------------------------------------*/
STATIC FUNCTION GuiStdDialog( cTitle )
LOCAL oDlg
@@ -117,7 +129,7 @@ STATIC FUNCTION GuiStdDialog( cTitle )
/*----------------------------------------------------------------------*/
STATIC FUNCTION Build_MenuBar( oDlg )
STATIC FUNCTION Build_MenuBar()
LOCAL oMenuBar, oSubMenu
//oMenuBar := XbpMenuBar():new( oDlg ):create()
@@ -164,7 +176,7 @@ STATIC FUNCTION MyFunctionXbp( nMode )
DO CASE
CASE nMode == 1
MsgBox( "Play Opening ~1" )
MsgBox( "Play Opening" + STR( GraMakeRGBColor( { 134,128,164 } ) ) )
CASE nMode == 2
MsgBox( "Play Closing ~2" )
@@ -187,9 +199,58 @@ STATIC FUNCTION MyFunctionXbp( nMode )
/*----------------------------------------------------------------------*/
PROCEDURE AppSys()
RETURN
FUNCTION Build_ToolBar( oDA )
LOCAL oTBar
// Create an XbpToolBar object and
// add it at the top of the dialog
//
oTBar := XbpToolBar():new( oDA )
oTBar:create( , , { 0, oDA:currentSize()[ 2 ]-60 }, ;
{ oDA:currentSize()[ 1 ], 60 } )
//
// Add two tool bar buttons, each with a
// caption and an image. Constrict the
// button image sizes to 32 pixels and
// ensure transparency is turned off.
//
oTBar:imageWidth := 32
oTBar:imageHeight := 32
/* Harbour does not support resource IDs so giving bitmap files */
#ifdef __HARBOUR__
oTBar:addItem( "Button #1", "new.png" )
oTBar:addItem( "Button #2", "open.png" )
#else
oTBar:addItem( "Button #1" )//, 100 )
oTBar:addItem( "Button #2" )//, 101 )
#endif
oTBar:transparentColor := GRA_CLR_INVALID
oTBar:buttonClick := {|oButton| MsgBox( "Button [" + oButton:caption + "] clicked!" ) }
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION Build_PushButton( oDA )
LOCAL oXbp
oXbp := XbpPushButton():new( oDA )
oXbp:caption := "A"
oXbp:create( , , {30,100}, {100,40} )
oXbp:activate:= {|| MsgBox( "Pushbutton A" ) }
/* Harbour supports presentation colors */
oXbp:setColorBG( GraMakeRGBColor( {133,240,90} ) )
oXbp := XbpPushButton():new( oDA )
oXbp:caption := "new.png"
oXbp:create( , , {30,160}, {100,40} )
oXbp:activate:= {|| MsgBox( "Pushbutton B" ) }
/* Harbour supports presentation colors */
oXbp:setColorBG( GraMakeRGBColor( {0,255,255} ) )
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -64,8 +64,6 @@
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
PROCEDURE QTC_SHOWWINDOW() ; RETURN
PROCEDURE QTC_ISICONIC() ; RETURN
PROCEDURE QTC_ISWINDOW() ; RETURN
@@ -100,4 +98,6 @@ PROCEDURE QTC_FILLRECT() ; RETURN
PROCEDURE QTC_DELETEMENU() ; RETURN
PROCEDURE QTC_TRACKPOPUPMENU() ; RETURN
PROCEDURE HB_TOOUTDEBUG() ; RETURN
PROCEDURE QTC_OUTPUTDEBUGSTRING() ; RETURN
PROCEDURE QTC_SENDTOOLBARMESSAGE() ; RETURN

View File

@@ -251,11 +251,10 @@ CLASS XbpDrawingArea INHERIT XbpWindow
METHOD XbpDrawingArea:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := QWS_CHILD
::exStyle := 0
::className := "DrawingArea"
::className := "XbpDrawingArea"
::objType := objTypeDA
::visible := .t.

View File

@@ -215,7 +215,7 @@ FUNCTION GraMakeRGBColor( aRGB )
IF hb_isNumeric( aRGB[ 1 ] ) .and. ( aRGB[ 1 ] >= 0 ) .and. ( aRGB[ 1 ] <= 255 )
IF hb_isNumeric( aRGB[ 2 ] ) .and. ( aRGB[ 2 ] >= 0 ) .and. ( aRGB[ 2 ] <= 255 )
IF hb_isNumeric( aRGB[ 3 ] ) .and. ( aRGB[ 3 ] >= 0 ) .and. ( aRGB[ 3 ] <= 255 )
nRGB := ( aRGB[ 1 ] + ( aRGB[ 2 ] * 256 ) + ( aRGB[ 3 ] * 256 * 256 ) )
nRGB := ( aRGB[ 1 ] + ( aRGB[ 2 ] * 256 ) + ( aRGB[ 3 ] * 256 * 256 ) ) + ( 256 * 256 * 256 )
ENDIF
ENDIF
ENDIF

View File

@@ -0,0 +1,230 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the Xbp*Classes
*
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Xbase++ xbpPushButton Compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 13Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "inkey.ch"
#include "hbgtinfo.ch"
#include "hbgtwvg.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_ToOutDebug( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS XbpPushButton INHERIT XbpWindow
DATA autosize INIT .F.
DATA border INIT .T.
DATA caption INIT ""
DATA pointerFocus INIT .T.
DATA preSelect INIT .F.
DATA drawMode INIT XBP_DRAW_NORMAL
DATA default INIT .F.
DATA cancel INIT .F.
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD setCaption()
METHOD activate() SETGET
METHOD draw() SETGET
METHOD handleEvent( nEvent, aInfo )
METHOD exeBlock()
//METHOD setColorFG() INLINE NIL
//METHOD setColorBG() INLINE NIL
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
//::style := WS_CHILD + BS_PUSHBUTTON /*+ BS_NOTIFY + BS_PUSHLIKE */
::className := "XBPPUSHBUTTON"
::objType := objTypePushButton
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::oWidget := QPushButton():new( QT_PTROF( ::oParent:oWidget ) )
::oWidget:move( aPos[ 1 ],aPos[ 2 ] )
::oWidget:resize( aSize[ 1 ],aSize[ 2 ] )
Qt_Connect_Signal( QT_PTROF( ::oWidget ), "clicked()", {|| ::exeBlock() } )
IF ::visible
::oWidget:show()
ENDIF
::setCaption( ::caption )
IF ::default
::oWidget:setDefault( .t. )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:exeBlock()
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:handleEvent( nEvent, mp1, mp2 )
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:destroy()
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:setCaption( xCaption, cDll )
HB_SYMBOL_UNUSED( cDll )
IF hb_isChar( xCaption )
::caption := xCaption
IF file( xCaption )
::oWidget:setIcon( xCaption )
ELSE
::oWidget:setText( xCaption )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:activate( xParam )
IF hb_isBlock( xParam ) .or. ( xParam == NIL )
::sl_lbClick := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:draw( xParam )
IF hb_isBlock( xParam ) .or. ( xParam == NIL )
::sl_paint := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,424 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the xbp*Classes
*
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Xbase++ xbpToolBar Compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 13Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "inkey.ch"
#include "hbgtinfo.ch"
#include "hbgtwvg.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpToolBar INHERIT XbpWindow
DATA appearance
DATA style INIT XBPTOOLBAR_STYLE_STANDARD
DATA allowCustomize INIT .T.
DATA enabled INIT .T.
DATA showToolTips INIT .T.
DATA borderStyle INIT XBPFRAME_NONE
DATA wrappable INIT .T.
DATA buttonWidth INIT 0
DATA buttonHeight INIT 0
DATA textAlign INIT XBPALIGN_BOTTOM
DATA imageWidth INIT 0
DATA imageHeight INIT 0
DATA transparentColor INIT 0
DATA aItems INIT {}
DATA hImageList
DATA lSized INIT .F.
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD addItem()
METHOD delItem()
METHOD getItem()
METHOD numItems() INLINE Len( ::aItems )
METHOD clear()
METHOD customize()
METHOD loadImageSet()
METHOD saveToolbar()
METHOD restToolbar()
METHOD setPosAndSize()
METHOD setSize()
DATA sl_change
DATA sl_buttonMenuClick
DATA sl_buttonDropDown
METHOD buttonClick() SETGET
METHOD change() SETGET
METHOD buttonMenuClick() SETGET
METHOD buttonDropDown() SETGET
METHOD sendToolbarMessage()
METHOD ExeBlock()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XbpToolBar"
::objType := objTypeToolBar
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
LOCAL oPar
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF upper( ::oParent:className ) == "XBPDIALOG"
oPar := ::oParent
ELSEIF upper( ::oParent:className ) == "XBPDRAWINGAREA"
oPar := ::oParent:oParent
ELSE
RETURN Self
ENDIF
/* Create Toolbar Widget */
//::oWidget := QToolBar():new( QT_PTROF( ::oParent:oWidget ) )
::oWidget := QToolBar():new( QT_PTROF( oPar:oWidget ) )
/* Add this toolbar with parent */
oPar:oWidget:addToolBar_1( ::pWidget )
#if 0
/* Assign attributes */
IF ::style == XBPTOOLBAR_STYLE_FLAT
//::style := TBSTYLE_FLAT
ELSEIF ::style == XBPTOOLBAR_STYLE_VERTICAL
//::style := CCS_VERT
ELSE
::style := 0
ENDIF
IF ::wrappable
//::style += TBSTYLE_WRAPABLE
ENDIF
IF ::showToolTips
//::style += TBSTYLE_TOOLTIPS
ENDIF
IF ::borderStyle == XBPFRAME_RECT
//::style += WS_BORDER
ENDIF
IF ::appearance == XBP_APPEARANCE_3D
ENDIF
#endif
::oParent:AddChild( SELF )
IF ::visible
::show()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:destroy()
LOCAL i, nItems
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
IF ( nItems := Len( ::aItems ) ) > 0
FOR i := 1 TO nItems
IF ::aItems[ i,2 ]:image <> NIL
//Win_DeleteObject( ::aItems[ i,2 ]:image )
ENDIF
IF ::aItems[ i,2 ]:disabledImage <> NIL
//Win_DeleteObject( ::aItems[ i,2 ]:disabledImage )
ENDIF
IF ::aItems[ i,2 ]:hotImage <> NIL
//Win_DeleteObject( ::aItems[ i,2 ]:hotImage )
ENDIF
NEXT
ENDIF
IF !empty( ::hImageList )
//WAPI_ImageList_Destroy( ::hImageList )
ENDIF
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:sendToolbarMessage( nMsg, p1, p2 )
RETURN QTC_SendToolbarMessage( ::pWnd, nMsg, p1, p2 )
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey, nMapRGB )
LOCAL oBtn
HB_SYMBOL_UNUSED( xDisabledImage )
HB_SYMBOL_UNUSED( xHotImage )
HB_SYMBOL_UNUSED( cDLL )
HB_SYMBOL_UNUSED( nMapRGB )
oBtn := XbpToolbarButton():new( cCaption, nStyle, cKey )
oBtn:index := ::numItems + 1
oBtn:command := 100 + oBtn:index
/* Create an action */
oBtn:oAction := QAction():new( QT_PTROF( ::oWidget ) )
oBtn:oAction:setText( cCaption )
IF valtype( xImage ) == "C" .and. file( xImage )
oBtn:oAction:setIcon( xImage )
ENDIF
/* Attach codeblock to be triggered */
Qt_Connect_Signal( QT_PTROF( oBtn:oAction ), "triggered(bool)", {|| ::exeBlock( oBtn ) } )
/* Attach Action with Toolbar */
::oWidget:addAction( QT_PTROF( oBtn:oAction ) )
aadd( ::aItems, { oBtn:command, oBtn } )
RETURN oBtn
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:exeBlock( oBtn )
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, oBtn, NIL, self )
ENDIF
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:delItem()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:getItem()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:clear()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:customize()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:loadImageSet()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:saveToolbar()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:restToolbar()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:setPosAndSize()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:setSize()
//::sendMessage( TB_AUTOSIZE, 0, 0 )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:buttonClick( xParam )
IF hb_isBlock( xParam ) .or. hb_isNil( xParam )
::sl_lbClick := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:change( xParam )
IF hb_isBlock( xParam ) .or. hb_isNil( xParam )
::sl_change := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:buttonMenuClick( xParam )
IF hb_isBlock( xParam ) .or. hb_isNil( xParam )
::sl_buttonMenuClick := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpToolbar:buttonDropDown( xParam )
IF hb_isBlock( xParam ) .or. hb_isNil( xParam )
::sl_buttonDropDown := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
/*
* XbpToolbarButton() Class compatible with XbpToolbarButton()
*/
/*----------------------------------------------------------------------*/
CLASS XbpToolbarButton
DATA enabled INIT .T.
DATA index INIT 0
DATA key INIT ""
DATA style INIT XBPTOOLBAR_BUTTON_DEFAULT
DATA caption INIT ""
DATA image INIT NIL
DATA disabledImage INIT NIL
DATA hotImage INIT NIL
DATA mixedState INIT .F.
DATA pressed INIT .F.
DATA visible INIT .T.
DATA left INIT 0
DATA bottom INIT 0
DATA top INIT 0
DATA width INIT 0
DATA height INIT 0
DATA description INIT ""
DATA tooltipText INIT ""
DATA command INIT 0
DATA oAction
METHOD new()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpToolbarButton:new( cCaption, nStyle, cKey )
DEFAULT cCaption TO ::caption
DEFAULT nStyle TO ::style
DEFAULT cKey TO ::key
::caption := cCaption
::style := nStyle
::key := cKey
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -478,10 +478,10 @@ METHOD XbpWindow:setColorBG( nRGB )
IF empty( ::oPalette )
::oPalette := QPalette():new()
ENDIF
cClass := upper( ::ClassName )
cClass := upper( ::ClassName )
DO CASE
CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU'
CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU,XBPTOOLBAR'
::oPalette:setColor( QPalette_Button , QT_PTROF( QColor():new( nRGB ) ) )
OTHERWISE
::oPalette:setColor( QPalette_Background, QT_PTROF( QColor():new( nRGB ) ) )