2009-06-16 23:16 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/hbxbp/Makefile

  * harbour/contrib/hbxbp/xbp3state.prg
  * harbour/contrib/hbxbp/xbpcheckbox.prg
  * harbour/contrib/hbxbp/xbpdataref.prg
  * harbour/contrib/hbxbp/xbpdialog.prg
  * harbour/contrib/hbxbp/xbpgeneric.prg
  * harbour/contrib/hbxbp/xbplistbox.prg
  * harbour/contrib/hbxbp/xbpmenubar.prg
  * harbour/contrib/hbxbp/xbppushbutton.prg
  * harbour/contrib/hbxbp/xbpradiobutton.prg
  * harbour/contrib/hbxbp/xbpstatusbar.prg
  * harbour/contrib/hbxbp/xbptabpage.prg
  * harbour/contrib/hbxbp/xbptoolbar.prg
  * harbour/contrib/hbxbp/xbpwindow.prg
  + harbour/contrib/hbxbp/xbpscrollbar.prg
    + Added XbpScrollBar() class.
    ! Rearranged class structure, vastly cleaned, and formatted.

  * harbour/contrib/hbxbp/tests/demoxbp.prg
    + Implemented XbpScrollBar()s.
    + Added one more menu option to open same dialog n number of times.
      It is still at infant stage as all the event handlers are not in place.
      Infact if demoXBP.prg is compiled in MT mode I think it will not 
      be a issue.

      Viktor, can you see why I cannot compile demoXBP.prg in MT mode?
This commit is contained in:
Pritpal Bedi
2009-06-17 06:29:51 +00:00
parent 56e816eefb
commit 03b4481982
17 changed files with 406 additions and 75 deletions

View File

@@ -17,6 +17,35 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-16 23:16 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbxbp/Makefile
* harbour/contrib/hbxbp/xbp3state.prg
* harbour/contrib/hbxbp/xbpcheckbox.prg
* harbour/contrib/hbxbp/xbpdataref.prg
* harbour/contrib/hbxbp/xbpdialog.prg
* harbour/contrib/hbxbp/xbpgeneric.prg
* harbour/contrib/hbxbp/xbplistbox.prg
* harbour/contrib/hbxbp/xbpmenubar.prg
* harbour/contrib/hbxbp/xbppushbutton.prg
* harbour/contrib/hbxbp/xbpradiobutton.prg
* harbour/contrib/hbxbp/xbpstatusbar.prg
* harbour/contrib/hbxbp/xbptabpage.prg
* harbour/contrib/hbxbp/xbptoolbar.prg
* harbour/contrib/hbxbp/xbpwindow.prg
+ harbour/contrib/hbxbp/xbpscrollbar.prg
+ Added XbpScrollBar() class.
! Rearranged class structure, vastly cleaned, and formatted.
* harbour/contrib/hbxbp/tests/demoxbp.prg
+ Implemented XbpScrollBar()s.
+ Added one more menu option to open same dialog n number of times.
It is still at infant stage as all the event handlers are not in place.
Infact if demoXBP.prg is compiled in MT mode I think it will not
be a issue.
Viktor, can you see why I cannot compile demoXBP.prg in MT mode?
2009-06-16 23:06 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbqt/hbqt.ch
* harbour/contrib/hbqt/hbqt_slots.cpp

View File

@@ -54,6 +54,7 @@ PRG_SOURCES=\
xbptabpage.prg \
xbplistbox.prg \
xbpstatusbar.prg \
xbpscrollbar.prg \
PRG_HEADERS=\
xbp.ch \

View File

@@ -59,6 +59,14 @@
/*----------------------------------------------------------------------*/
PROCEDURE Main()
BuildADialog()
RETURN
/*----------------------------------------------------------------------*/
FUNCTION BuildADialog()
LOCAL oDlg, mp1, mp2, oXbp, nEvent, aSize, aTabs
/* Create Application Window */
@@ -102,6 +110,9 @@ PROCEDURE Main()
/* Install Push Buttons */
Build_PushButton( oDlg:drawingArea )
/* Install ScrollBar */
Build_ScrollBar( aTabs[ 1 ] )
/* Present the dialog on the screen */
oDlg:Show()
@@ -174,18 +185,23 @@ STATIC FUNCTION Build_MenuBar()
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Functional"
oSubMenu:addItem( { "Play Opening ~1"+chr(K_TAB)+"Ctrl+U", {|| MyFunctionXbp( 1 ) } } )
oSubMenu:addItem( { "Play Closing ~2", {|| MyFunctionXbp( 2 ) } } )
oSubMenu:addItem( { "Play Closing ~2" , {|| MyFunctionXbp( 2 ) } } )
oSubMenu:addItem( { NIL, NIL, XBPMENUBAR_MIS_SEPARATOR, NIL } )
oSubMenu:addItem( { "new.png|~MessageBox", {|| MyFunctionXbp( 3 ) }, , XBPMENUBAR_MIA_HILITED } )
oSubMenu:addItem( { "new.png|~MessageBox" , {|| MyFunctionXbp( 3 ) } , , XBPMENUBAR_MIA_HILITED } )
oMenuBar:addItem( { oSubMenu, NIL } )
//
oSubMenu:insItem( 2, { "This executes MsgBox()", {|| MyFunctionXbp( 103 ) }, , XBPMENUBAR_MIA_CHECKED } )
oSubMenu:insItem( 2, { "This executes MsgBox()" , {|| MyFunctionXbp( 103 ) }, , XBPMENUBAR_MIA_CHECKED } )
oSubMenu:itemMarked := {|mp1| IF( mp1 == 5, MsgBox( "WOW - ::itemMarked - Activated" ), NIL ) }
/* Menu colors are being honored in Harbour only */
oSubMenu:setColorBG( GraMakeRGBColor( { 134,128,250 } ) )
oSubMenu:setColorFG( GraMakeRGBColor( { 255, 1, 1 } ) )
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Dialogs"
oSubMenu:addItem( { "~One More Instance"+chr(K_TAB)+"Ctrl+M", {|| BuildADialog() } } )
oMenuBar:addItem( { oSubMenu, NIL } )
Return nil
/*----------------------------------------------------------------------*/
@@ -439,4 +455,26 @@ FUNCTION Build_StatusBar( oWnd )
/*----------------------------------------------------------------------*/
FUNCTION Build_ScrollBar( oWnd )
LOCAL oXbpH, oXbpV
LOCAL aSize := oWnd:currentSize()
LOCAL nWidth := aSize[ 1 ]
LOCAL nHeight := aSize[ 2 ]
LOCAL nFat := 20
oXbpH := XbpScrollbar():new()
oXbpH:type := XBPSCROLL_HORIZONTAL
oXbpH:range := { 1, 100 }
oXbpH:create( oWnd, , { 10,nHeight-50 }, { nWidth-40,nFat } )
oXbpH:scroll := {|| oXbpV:setData( oXbpH:getData() ) }
oXbpV := XbpScrollbar():new()
oXbpV:type := XBPSCROLL_VERTICAL
oXbpV:range := { 1, 100 }
oXbpV:create( oWnd, , { nWidth-30,10 }, { nFat,nHeight-60 } )
oXbpV:scroll := {|| oXbpH:setData( oXbpV:getData() ) }
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -114,10 +114,10 @@ METHOD Xbp3State:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::oWidget := QCheckBox():New( QT_PTROF( ::oParent:oWidget ) )
Qt_Connect_Signal( ::pWidget, "stateChanged(int)", {|o,i| ::exeBlock( i,o ) } )
::Connect( ::pWidget, "stateChanged(int)", {|o,i| ::exeBlock( i,o ) } )
::oWidget:setTriState( .t. )
::setPosAndSize()
@@ -137,6 +137,7 @@ METHOD Xbp3State:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::editBuffer := ::oWidget:checkState()
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -114,10 +114,8 @@ METHOD XbpCheckBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::oWidget := QCheckBox():New( QT_PTROF( ::oParent:oWidget ) )
Qt_Connect_Signal( ::pWidget, "stateChanged(int)", {|o,i| ::exeBlock( i,o ) } )
::Connect( ::pWidget, "stateChanged(int)", {|o,i| ::exeBlock( i,o ) } )
::setPosAndSize()
IF ::visible
@@ -130,6 +128,7 @@ METHOD XbpCheckBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::editBuffer := ::oWidget:isChecked()
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -121,6 +121,9 @@ METHOD XbpDataRef:getData()
// CASE cClass == "XBPLISTBOX"
// RETURN ::nCurSelected
CASE cClass == "XBPSCROLLBAR"
::sl_editBuffer := ::oWidget:value()
ENDCASE
IF hb_isBlock( ::dataLink )
@@ -151,26 +154,27 @@ METHOD XbpDataRef:setData( xValue, mp2 )
CASE cClass == "XBP3STATE"
::oWidget:setCheckState( IF( ::sl_editBuffer == 1, 2, IF( ::sl_editBuffer == 2, 1, 0 ) ) )
CASE cClass == "XBPLISTBOX" //::className == "LISTBOX" /* Single Selection */
CASE cClass == "XBPLISTBOX"
IF !empty( ::sl_editBuffer )
//RETURN Win_LbSetCurSel( ::hWnd, ::sl_editBuffer - 1 ) >= 0
ENDIF
RETURN .f.
CASE cClass == "XBPTREEVIEW" //::className == "SysTreeView32"
CASE cClass == "XBPTREEVIEW"
IF ::sl_editBuffer <> NIL .and. ::sl_editBuffer:hItem <> NIL
//Win_TreeView_SelectItem( ::hWnd, ::sl_editBuffer:hItem )
ENDIF
CASE cClass $ "XBPSLE,XBPMLE" //::className == "EDIT"
CASE cClass $ "XBPSLE,XBPMLE"
IF hb_isChar( ::sl_editBuffer )
//Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::sl_editBuffer )
ENDIF
CASE ::className == "XBPSCROLLBAR" //"SCROLLBAR"
CASE ::className == "XBPSCROLLBAR"
IF ::sl_editBuffer <> NIL
//WAPI_SetScrollPos( ::pWnd, SB_CTL, ::sl_editBuffer, .t. )
::oWidget:setValue( ::sl_editBuffer )
ENDIF
ENDCASE
RETURN ::sl_editBuffer

View File

@@ -146,8 +146,8 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
SetAppWindow( self )
Qt_Connect_Signal( QT_PTROF( ::drawingArea:oWidget ), "keyPressEvent()" , {|o,pEvent| ::grabEvent( pEvent, o ) } )
Qt_Connect_Signal( QT_PTROF( ::drawingArea:oWidget ), "mouseMoveEvent()", {|o,pEvent| ::grabEvent( pEvent, o ) } )
::Connect( QT_PTROF( ::drawingArea:oWidget ), "keyPressEvent()" , {|o,pEvent| ::grabEvent( pEvent, o ) } )
::Connect( QT_PTROF( ::drawingArea:oWidget ), "mouseMoveEvent()", {|o,pEvent| ::grabEvent( pEvent, o ) } )
RETURN Self
@@ -165,15 +165,24 @@ METHOD XbpDialog:destroy()
::oEventLoop:exit()
#if 0
IF hb_isObject( ::oMenu )
::oMenu:destroy()
ENDIF
IF len( ::aConnections ) > 0
aeval( ::aConnections, {|e_| Qt_DisConnect_Signal( e_[ 1 ], e_[ 2 ] ) } )
::aConnections := {}
ENDIF
IF Len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
::oWidget:close()
#endif
::xbpWindow:destroy()
RETURN nil
@@ -234,7 +243,7 @@ CLASS XbpDrawingArea INHERIT XbpWindow
METHOD new()
METHOD create()
METHOD destroy()
//METHOD destroy()
METHOD handleEvent()
METHOD setColorFG( nRGB ) INLINE ::oParent:setColorFG( nRGB )
METHOD setColorBG( nRGB ) INLINE ::oParent:setColorBG( nRGB )
@@ -280,13 +289,11 @@ METHOD XbpDrawingArea:handleEvent( nEvent, mp1, mp2 )
RETURN ( 1 )
/*----------------------------------------------------------------------*/
#if 0
METHOD XbpDrawingArea:destroy()
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::oWidget:close()
RETURN NIL
#endif
/*----------------------------------------------------------------------*/

View File

@@ -222,3 +222,33 @@ FUNCTION GraMakeRGBColor( aRGB )
ENDIF
RETURN nRGB
/*----------------------------------------------------------------------*/
FUNCTION Xbp_XtoS( xVar )
LOCAL cType
cType := valtype( xVar )
DO CASE
CASE cType == "N"
RETURN str( xVar )
CASE cType == "D"
RETURN dtoc( xVar )
CASE cType == "L"
RETURN IF( xVar, "Yes", "No" )
CASE cType == "M"
RETURN xVar
CASE cType == "C"
RETURN xVar
CASE cType == "A"
RETURN "A:"+hb_ntos( len( xVar ) )
CASE cType == "O"
RETURN "<OBJECT>"
OTHERWISE
RETURN "<"+cType+">"
ENDCASE
RETURN xVar
/*----------------------------------------------------------------------*/

View File

@@ -176,13 +176,12 @@ METHOD XbpListBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
ENDIF
#endif
::oParent:AddChild( SELF )
::oWidget := QListView():New( ::pParent )
::xDummy := Qt_Connect_Signal( ::pWidget, "clicked(QModelIndex)" , {|o,i| ::exeBlock( 1,i,o ) } )
::xDummy := Qt_Connect_Signal( ::pWidget, "doubleClicked(QModelIndex)", {|o,i| ::exeBlock( 2,i,o ) } )
::xDummy := Qt_Connect_Signal( ::pWidget, "entered(QModelIndex)" , {|o,i| ::exeBlock( 3,i,o ) } )
::Connect( ::pWidget, "clicked(QModelIndex)" , {|o,i| ::exeBlock( 1,i,o ) } )
::Connect( ::pWidget, "doubleClicked(QModelIndex)", {|o,i| ::exeBlock( 2,i,o ) } )
::Connect( ::pWidget, "entered(QModelIndex)" , {|o,i| ::exeBlock( 3,i,o ) } )
::oStrList := QStringList():new( ::pWidget )
::oStrModel := QStringListModel():new( ::pWidget )
@@ -194,6 +193,7 @@ METHOD XbpListBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::show()
ENDIF
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -238,7 +238,7 @@ METHOD XbpListBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible
/*----------------------------------------------------------------------*/
METHOD XbpListBox:destroy()
::WvgWindow:destroy()
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/

View File

@@ -187,6 +187,7 @@ METHOD xbpMenuBar:create( oParent, aPresParams, lVisible )
::oParent:oMenu := Self
endif
::oParent:addChild( self )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -207,11 +208,15 @@ METHOD xbpMenuBar:configure( oParent, aPresParams, lVisible )
METHOD xbpMenuBar:destroy()
#if 0
IF !empty( ::oWidget )
::DelAllItems()
::oWidget:close()
::oWidget := NIL
ENDIF
#endif
::xbpWindow:destroy()
RETURN ( .T. )
@@ -284,18 +289,17 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos )
cKey := substr( cCaption, n+1 )
cCaption := substr( cCaption, 1, n-1 )
ENDIF
oAction:setText( cCaption )
IF file( cIcon )
oAction:setIcon( cIcon )
ENDIF
oAction:setText( cCaption )
IF !empty( cKey )
oKey := QKeySequence():new( cKey )
oAction:setShortcut( QT_PTROF( oKey ) )
ENDIF
Qt_Connect_Signal( QT_PTROF( oAction ), "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } )
Qt_Connect_Signal( QT_PTROF( oAction ), "hovered()" , {|| ::exeHovered( nMenuItemID ) } )
::Connect( QT_PTROF( oAction ), "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } )
::Connect( QT_PTROF( oAction ), "hovered()" , {|| ::exeHovered( nMenuItemID ) } )
DO CASE
CASE nAttrb == XBPMENUBAR_MIA_CHECKED
@@ -650,10 +654,10 @@ METHOD xbpMenu:create( oParent, aPresParams, lVisible )
::aPresParams := aPresParams
::visible := lVisible
::oWidget := QMenu():new( ::oParent:pWidget )
::oWidget := QMenu():new( ::pParent )
::oParent:oWidget:addMenu( ::pWidget )
::oParent:addChild( self )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -109,9 +109,8 @@ CLASS XbpPushButton INHERIT XbpWindow
METHOD XbpPushButton:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
//::style := WS_CHILD + BS_PUSHBUTTON /*+ BS_NOTIFY + BS_PUSHLIKE */
::className := "XBPPUSHBUTTON"
::objType := objTypePushButton
@@ -123,12 +122,11 @@ 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() } )
::Connect( QT_PTROF( ::oWidget ), "clicked()", {|| ::exeBlock() } )
IF ::visible
::oWidget:show()
@@ -140,6 +138,7 @@ METHOD XbpPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::oWidget:setDefault( .t. )
ENDIF
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -156,8 +155,6 @@ METHOD XbpPushButton:exeBlock()
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 )
@@ -168,8 +165,6 @@ METHOD XbpPushButton:handleEvent( nEvent, mp1, mp2 )
METHOD XbpPushButton:destroy()
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::xbpWindow:destroy()
RETURN NIL

View File

@@ -113,10 +113,9 @@ METHOD XbpRadioButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:addChild( SELF )
::oWidget := QRadioButton():New( QT_PTROF( ::oParent:oWidget ) )
Qt_Connect_Signal( ::pWidget, "clicked()", {|| ::exeBlock() } )
::connect( ::pWidget, "clicked()", {|| ::exeBlock() } )
::setPosAndSize()
IF ::visible
@@ -128,6 +127,7 @@ METHOD XbpRadioButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
::oWidget:setChecked( .t. )
ENDIF
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,223 @@
/*
* $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++ xbpScrollBar Compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 15Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpScrollBar INHERIT XbpWindow, XbpDataRef
DATA autoTrack INIT .t.
DATA range INIT {0,1}
DATA type INIT XBPSCROLL_HORIZONTAL
DATA scrollBoxSize INIT -1
DATA excludeScrollBox INIT .f.
DATA sl_xbeSB_Scroll
METHOD new()
METHOD create()
METHOD configure() VIRTUAL
METHOD destroy()
METHOD scroll( xParam ) SETGET
METHOD handleEvent()
METHOD exeBlock()
METHOD setRange( aRange )
METHOD setScrollBoxSize( nUnits )
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XBPSCROLLBAR"
::objType := objTypeScrollBar
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget := QScrollBar():new( ::pParent )
::oWidget:setOrientation( IF( ::type == XBPSCROLL_VERTICAL, 2, 1 ) )
::oWidget:setTracking( ::autoTrack )
::connect( ::pWidget, "actionTriggered(int)", {|o,i| ::exeBlock( i,o ) } )
::setPosAndSize()
::setRange( ::range )
IF ::visible
::show()
ENDIF
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:exeBlock( nAction )
LOCAL nCommand
IF !hb_isBlock( ::sl_xbeSB_Scroll )
RETURN NIL
ENDIF
SWITCH nAction
CASE QAbstractSlider_SliderNoAction
RETURN NIL
CASE QAbstractSlider_SliderSingleStepAdd
nCommand := XBPSB_NEXTPOS
EXIT
CASE QAbstractSlider_SliderSingleStepSub
nCommand := XBPSB_PREVPOS
EXIT
CASE QAbstractSlider_SliderPageStepAdd
nCommand := XBPSB_NEXTPAGE
EXIT
CASE QAbstractSlider_SliderPageStepSub
nCommand := XBPSB_PREVPAGE
EXIT
CASE QAbstractSlider_SliderToMinimum
nCommand := XBPSB_TOP
EXIT
CASE QAbstractSlider_SliderToMaximum
nCommand := XBPSB_BOTTOM
EXIT
CASE QAbstractSlider_SliderMove
nCommand := XBPSB_SLIDERTRACK
EXIT
ENDSWITCH
::sl_editBuffer := ::oWidget:value()
eval( ::sl_xbeSB_Scroll, { ::sl_editBuffer, nCommand }, NIL, self )
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:destroy()
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:scroll( xParam )
IF hb_isBlock( xParam )
::sl_xbeSB_Scroll := xParam
ENDIF
RETURN self
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:setRange( aRange )
LOCAL aOldRange
aOldRange := { ::oWidget:minimum(), ::oWidget:maximum() }
::oWidget:setRange( aRange[ 1 ], aRange[ 2 ] )
RETURN aOldRange
/*----------------------------------------------------------------------*/
METHOD XbpScrollBar:setScrollBoxSize( nUnits )
LOCAL nOldUnits := nUnits
RETURN nOldUnits
/*----------------------------------------------------------------------*/

View File

@@ -117,8 +117,6 @@ METHOD XbpStatusBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::oWidget := QStatusBar():new( ::pParent )
::oParent:oWidget:setStatusBar( ::pWidget )
::oWidget:setSizeGripEnabled( ::sizeGrip )
@@ -128,6 +126,8 @@ METHOD XbpStatusBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
ENDIF
::addItem( , , , , , -1 )
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -328,7 +328,6 @@ METHOD XbpStatusBarPanel:caption( cCaption )
::sl_caption := cCaption
::oParent:oWidget:showMessage( cCaption )
//Wvg_StatusBarSetText( ::oParent:hWnd, ::index, cCaption )
ENDIF
RETURN Self

View File

@@ -127,15 +127,15 @@ METHOD XbpTabPage:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style += TCS_FOCUSNEVER
#endif
::oParent:AddChild( SELF )
IF empty( ::oParent:oTabWidget )
/* NOTE: First tab will decide the position and size of the Tab Control
* One Tab Control per Window can be defined. If another tab control is required then
* create another static and place tabs on that
*/
::oParent:oTabWidget := QTabWidget():new( QT_PTROF( ::oParent:oWidget ) )
Qt_Connect_Signal( QT_PTROF( ::oParent:oTabWidget ), "currentChanged(int)" , {|o,i| ::exeBlock( i,o ) } )
::Connect( QT_PTROF( ::oParent:oTabWidget ), "currentChanged(int)" , {|o,i| ::exeBlock( i,o ) } )
::oParent:oTabWidget:move( ::aPos[ 1 ], ::aPos[ 2 ] )
::oParent:oTabWidget:resize( ::aSize[ 1 ], ::aSize[ 2 ] )
@@ -147,20 +147,17 @@ METHOD XbpTabPage:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
ENDIF
oPar := ::oParent:oTabWidget
//::oWidget := QWidget():new( ::pParent )
::oWidget := QWidget():new()
::oWidget := QWidget():new( ::pParent )
oPar:addTab( ::pWidget, ::caption )
aadd( ::oParent:aTabs, self )
::show()
::setPosAndSize()
IF ::visible
::show()
ENDIF
IF ::minimized
::hide()
ENDIF
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -154,7 +154,6 @@ METHOD XbpToolbar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
ENDIF
/* Create Toolbar Widget */
//::oWidget := QToolBar():new( QT_PTROF( ::oParent:oWidget ) )
::oWidget := QToolBar():new( QT_PTROF( oPar:oWidget ) )
/* Add this toolbar with parent */
@@ -183,12 +182,11 @@ METHOD XbpToolbar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
ENDIF
#endif
::oParent:AddChild( SELF )
IF ::visible
::show()
ENDIF
::oParent:AddChild( SELF )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -196,8 +194,6 @@ METHOD XbpToolbar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
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
@@ -258,7 +254,7 @@ METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS
ENDIF
/* Attach codeblock to be triggered */
Qt_Connect_Signal( QT_PTROF( oBtn:oAction ), "triggered(bool)", {|| ::exeBlock( oBtn ) } )
::Connect( QT_PTROF( oBtn:oAction ), "triggered(bool)", {|| ::exeBlock( oBtn ) } )
/* Attach Action with Toolbar */
::oWidget:addAction( QT_PTROF( oBtn:oAction ) )

View File

@@ -290,6 +290,9 @@ EXPORTED:
DATA oPalette
DATA xDummy
METHOD connect()
DATA aConnections INIT {}
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -352,26 +355,31 @@ METHOD XbpWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible
/*----------------------------------------------------------------------*/
METHOD XbpWindow:connect( pWidget, cSignal, bBlock )
IF Qt_Connect_Signal( pWidget, cSignal, bBlock )
aadd( ::aConnections, { pWidget, cSignal } )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpWindow:destroy()
IF len( ::aConnections ) > 0
aeval( ::aConnections, {|e_| Qt_DisConnect_Signal( e_[ 1 ], e_[ 2 ] ) } )
::aConnections := {}
ENDIF
IF Len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
::aChildren := {}
ENDIF
IF !empty( ::oTabWidget )
// It is a HBQT Object...
ENDIF
::oWidget:close()
IF Qtc_IsWindow( ::hWnd )
Qtc_DestroyWindow( ::hWnd )
ENDIF
IF ::hBrushBG <> NIL
Qtc_DeleteObject( ::hBrushBG )
ENDIF
RETURN Self
RETURN NIL
/*----------------------------------------------------------------------*/