2010-08-31 13:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbxbp/xbp.ch
  * contrib/hbxbp/xbp3state.prg
  * contrib/hbxbp/xbpbrowse.prg
  * contrib/hbxbp/xbpcheckbox.prg
  * contrib/hbxbp/xbpcombobox.prg
  * contrib/hbxbp/xbpdialog.prg
  * contrib/hbxbp/xbpfiledialog.prg
  * contrib/hbxbp/xbpfontdialog.prg
  * contrib/hbxbp/xbphtmlviewer.prg
  * contrib/hbxbp/xbplistbox.prg
  * contrib/hbxbp/xbpmenubar.prg
  * contrib/hbxbp/xbpmle.prg
  * contrib/hbxbp/xbpparthandler.prg
  * contrib/hbxbp/xbpprintdialog.prg
  * contrib/hbxbp/xbppushbutton.prg
  * contrib/hbxbp/xbpradiobutton.prg
  * contrib/hbxbp/xbprtf.prg
  * contrib/hbxbp/xbpscrollbar.prg
  * contrib/hbxbp/xbpsle.prg
  * contrib/hbxbp/xbpspinbutton.prg
  * contrib/hbxbp/xbpstatic.prg
  * contrib/hbxbp/xbpstatusbar.prg
  * contrib/hbxbp/xbptabpage.prg
  * contrib/hbxbp/xbptoolbar.prg
  * contrib/hbxbp/xbptreeview.prg
  * contrib/hbxbp/xbpwindow.prg
    + Implemented: :status() method as per Shum's request.
      It just remained unimplemented for so long.
This commit is contained in:
Pritpal Bedi
2010-08-31 20:56:34 +00:00
parent 3e6ef7c908
commit 0c887e73d1
27 changed files with 161 additions and 102 deletions

View File

@@ -16,6 +16,36 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-08-31 13:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/xbp.ch
* contrib/hbxbp/xbp3state.prg
* contrib/hbxbp/xbpbrowse.prg
* contrib/hbxbp/xbpcheckbox.prg
* contrib/hbxbp/xbpcombobox.prg
* contrib/hbxbp/xbpdialog.prg
* contrib/hbxbp/xbpfiledialog.prg
* contrib/hbxbp/xbpfontdialog.prg
* contrib/hbxbp/xbphtmlviewer.prg
* contrib/hbxbp/xbplistbox.prg
* contrib/hbxbp/xbpmenubar.prg
* contrib/hbxbp/xbpmle.prg
* contrib/hbxbp/xbpparthandler.prg
* contrib/hbxbp/xbpprintdialog.prg
* contrib/hbxbp/xbppushbutton.prg
* contrib/hbxbp/xbpradiobutton.prg
* contrib/hbxbp/xbprtf.prg
* contrib/hbxbp/xbpscrollbar.prg
* contrib/hbxbp/xbpsle.prg
* contrib/hbxbp/xbpspinbutton.prg
* contrib/hbxbp/xbpstatic.prg
* contrib/hbxbp/xbpstatusbar.prg
* contrib/hbxbp/xbptabpage.prg
* contrib/hbxbp/xbptoolbar.prg
* contrib/hbxbp/xbptreeview.prg
* contrib/hbxbp/xbpwindow.prg
+ Implemented: :status() method as per Shum's request.
It just remained unimplemented for so long.
2010-08-30 18:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp
* contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp

View File

@@ -471,5 +471,11 @@
/*----------------------------------------------------------------------*/
#define XBP_STAT_INIT 0
#define XBP_STAT_CREATE 1
#define XBP_STAT_FAILURE 2
/*----------------------------------------------------------------------*/
#define _XBP_CH
#endif

View File

@@ -131,6 +131,7 @@ METHOD Xbp3State:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::editBuffer := ::oWidget:checkState()
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -719,11 +719,10 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
/* .DBF Manipulation Model */
::oDbfModel := HBQAbstractItemModel():new( {|t,role,x,y| ::supplyInfo( 141, t, role, x, y ) } )
HB_TRACE( HB_TR_DEBUG, "20000 9" )
/* Attach Model with the View */
::oTableView:setModel( ::oDbfModel )
HB_TRACE( HB_TR_DEBUG, "20000 10" )
/* Horizontal Footer */
::oFooterView := QHeaderView():new( Qt_Horizontal )
//
@@ -790,6 +789,8 @@ HB_TRACE( HB_TR_DEBUG, "20000 10" )
//::oTableView:setEditTriggers( QAbstractItemView_SelectedClicked )
::oTableView:setEditTriggers( QAbstractItemView_AnyKeyPressed )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -122,6 +122,7 @@ METHOD XbpCheckBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::editBuffer := ::oWidget:isChecked()
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -152,6 +152,7 @@ METHOD XbpComboBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::show()
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -218,6 +218,8 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget:connect( QEvent_WindowActivate , {|e| ::execEvent( QEvent_WindowActivate , e ) } )
::oWidget:connect( QEvent_WindowDeactivate , {|e| ::execEvent( QEvent_WindowDeactivate , e ) } )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -125,6 +125,7 @@ METHOD XbpFileDialog:create( oParent, oOwner, aPos )
::oWidget:connect( "filesSelected(QStringList)", {|p| ::execSlot( "filesSelected(QStringList)", p ) } )
::oWidget:connect( "filterSelected(QString)" , {|p| ::execSlot( "filterSelected(QString)" , p ) } )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -199,6 +199,7 @@ METHOD XbpFontDialog:create( oParent, oOwner, oScreenPS, oPrinterPS, aPos )
::oWidget:connect( "currentFontChanged(QFont)", {|p| ::execSlot( "currentFontChanged(QFont)", p ) } )
::oWidget:connect( "fontSelected(QFont)" , {|p| ::execSlot( "fontSelected(QFont)" , p ) } )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -177,7 +177,7 @@ METHOD XbpHTMLViewer:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::oParent:addChild( SELF )
#endif
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -190,6 +190,7 @@ METHOD XbpListBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::show()
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -190,6 +190,7 @@ METHOD xbpMenuBar:create( oParent, aPresParams, lVisible )
endif
::oParent:addChild( self )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/
@@ -745,6 +746,7 @@ METHOD xbpMenu:create( oParent, aPresParams, lVisible )
::oParent:oWidget:addMenu( ::oWidget )
::oParent:addChild( self )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -93,32 +93,32 @@ CLASS XbpMLE INHERIT XbpWindow, XbpDataRef
METHOD execSlot( cSlot, p )
METHOD setStyle()
METHOD clear()
METHOD copyMarked()
METHOD cutMarked()
METHOD deleteMarked()
METHOD clear()
METHOD copyMarked()
METHOD cutMarked()
METHOD deleteMarked()
METHOD delete( nPos, nChars )
METHOD pasteMarked()
METHOD queryFirstChar()
METHOD queryMarked()
METHOD setFirstChar( nBufferPos )
METHOD setMarked( aStartEnd )
METHOD insert( nPos, cString )
METHOD charFromLine( nLine )
METHOD lineFromChar( nPos )
METHOD pos()
METHOD pasteMarked()
METHOD queryFirstChar()
METHOD queryMarked()
METHOD setFirstChar( nBufferPos )
METHOD setMarked( aStartEnd )
METHOD insert( nPos, cString )
METHOD charFromLine( nLine )
METHOD lineFromChar( nPos )
METHOD pos()
DATA sl_undo INIT .T.
DATA sl_hScroll
DATA sl_vScroll
METHOD undo( ... ) SETGET
METHOD hScroll( ... ) SETGET
METHOD vScroll( ... ) SETGET
METHOD undo( ... ) SETGET
METHOD hScroll( ... ) SETGET
METHOD vScroll( ... ) SETGET
METHOD setEditable( lYes )
METHOD setWrap( lWrap )
METHOD setEditable( lYes )
METHOD setWrap( lWrap )
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -181,6 +181,7 @@ METHOD XbpMLE:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::setStyle()
::oParent:addChild( Self )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/
@@ -203,14 +204,14 @@ METHOD XbpMLE:execSlot( cSlot, p )
HB_SYMBOL_UNUSED( cSlot )
HB_SYMBOL_UNUSED( p )
RETURN .t.
/*----------------------------------------------------------------------*/
METHOD XbpMLE:clear()
LOCAL nChars := len( ::oWidget:toPlainText() )
::oWidget:clear()
RETURN nChars
@@ -219,10 +220,10 @@ METHOD XbpMLE:clear()
METHOD XbpMLE:copyMarked()
LOCAL qCursor, cText
qCursor := QTextCursor():from( ::oWidget:textCursor() )
cText := qCursor:selectedText()
::oWidget:copy()
RETURN len( cText )
@@ -231,10 +232,10 @@ METHOD XbpMLE:copyMarked()
METHOD XbpMLE:cutMarked()
LOCAL qCursor, cText
qCursor := QTextCursor():from( ::oWidget:textCursor() )
cText := qCursor:selectedText()
::oWidget:cut()
RETURN len( cText )
@@ -243,7 +244,7 @@ METHOD XbpMLE:cutMarked()
METHOD XbpMLE:deleteMarked()
LOCAL qCursor, cText
qCursor := QTextCursor():from( ::oWidget:textCursor() )
cText := qCursor:selectedText()
qCursor:removeSelectedText()
@@ -255,59 +256,59 @@ METHOD XbpMLE:deleteMarked()
METHOD XbpMLE:delete( nPos, nChars )
LOCAL qCursor, cText
qCursor := QTextCursor():from( ::oWidget:textCursor() )
qCursor:setPosition( nPos )
qCursor:movePosition( QTextCursor_Right, QTextCursor_KeepAnchor, nChars )
cText := qCursor:selectedText()
qCursor:removeSelectedText()
::oWidget:setTextCursor( qCursor )
RETURN len( cText )
/*----------------------------------------------------------------------*/
METHOD XbpMLE:pasteMarked()
METHOD XbpMLE:pasteMarked()
LOCAL cText2
LOCAL cText1 := ::oWidget:toPlainText()
::oWidget:paste() ; cText2 := ::oWidget:toPlainText()
RETURN len( cText2 ) - len( cText1 )
/*----------------------------------------------------------------------*/
METHOD XbpMLE:queryFirstChar()
RETURN 0 /* Cannot be calculated until it is subclassed */
/*----------------------------------------------------------------------*/
METHOD XbpMLE:queryMarked()
LOCAL qCursor, a_
qCursor := QTextCursor():from( ::oWidget:textCursor() )
IF qCursor:hasSelection()
a_:= { qCursor:selectionStart(), qCursor:selectionEnd() }
ELSE
ELSE
a_:= { 0,0 }
ENDIF
ENDIF
RETURN a_
/*----------------------------------------------------------------------*/
METHOD XbpMLE:setFirstChar( nBufferPos )
HB_SYMBOL_UNUSED( nBufferPos )
RETURN .f. /* Cannot be achieved unless it is subclassed*/
/*----------------------------------------------------------------------*/
METHOD XbpMLE:setMarked( aStartEnd )
LOCAL qCursor, cText
IF hb_isArray( aStartEnd ) .AND. len( aStartEnd ) == 2 .AND. aStartEnd[ 1 ] >= 0 .AND. aStartEnd[ 2 ] > aStartEnd[ 1 ]
qCursor := QTextCursor():from( ::oWidget:textCursor() )
qCursor:setPosition( aStartEnd[ 1 ] )
@@ -316,30 +317,30 @@ METHOD XbpMLE:setMarked( aStartEnd )
IF len( cText ) > 0
::oWidget:setTextCursor( qCursor )
RETURN .t.
ENDIF
ENDIF
ENDIF
RETURN .f.
/*----------------------------------------------------------------------*/
METHOD XbpMLE:insert( nPos, cString )
METHOD XbpMLE:insert( nPos, cString )
LOCAL qCursor
IF hb_isChar( cString )
qCursor := QTextCursor():from( ::oWidget:textCursor() )
IF hb_isNumeric( nPos ) .AND. nPos >= 0
qCursor:setPosition( nPos )
ENDIF
ENDIF
qCursor:insertText( cString )
::oWidget:setTextCursor( qCursor )
RETURN .t.
ENDIF
ENDIF
RETURN .f.
/*----------------------------------------------------------------------*/
METHOD XbpMLE:charFromLine( nLine )
LOCAL qCursor, nPos
@@ -351,41 +352,41 @@ METHOD XbpMLE:charFromLine( nLine )
ELSE
qCursor:movePosition( QTextCursor_StartOfLine )
nPos := qCursor:position()
ENDIF
ENDIF
RETURN nPos
/*----------------------------------------------------------------------*/
METHOD XbpMLE:lineFromChar( nPos )
LOCAL qCursor, nLine
qCursor := QTextCursor():from( ::oWidget:textCursor() )
IF hb_isNumeric( nPos )
qCursor:setPosition( nPos )
nLine := qCursor:blockNumber()
ELSE
nLine := qCursor:blockNumber()
ENDIF
RETURN nLine
ENDIF
RETURN nLine
/*----------------------------------------------------------------------*/
METHOD XbpMLE:pos()
RETURN QTextCursor():from( ::oWidget:textCursor() ):position()
/*----------------------------------------------------------------------*/
METHOD XbpMLE:hScroll( ... )
LOCAL a_:= hb_aParams()
IF len( a_ ) == 1 .AND. hb_isBlock( a_[ 1 ] )
::sl_hScroll := a_[ 1 ]
ELSEIF len( a_ ) >= 2 .AND. hb_isBlock( ::sl_hScroll )
eval( ::sl_hScroll, NIL, NIL, Self )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpMLE:vScroll( ... )
@@ -394,9 +395,9 @@ METHOD XbpMLE:vScroll( ... )
::sl_vScroll := a_[ 1 ]
ELSEIF len( a_ ) >= 0 .AND. hb_isBlock( ::sl_vScroll )
eval( ::sl_vScroll, NIL, NIL, Self )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpMLE:undo( ... )
@@ -405,9 +406,9 @@ METHOD XbpMLE:undo( ... )
::sl_undo := a_[ 1 ]
ELSEIF len( a_ ) >= 1 .AND. hb_isBlock( ::sl_undo )
eval( ::sl_undo, a_[ 1 ], NIL, Self )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpMLE:setWrap( lWrap )
@@ -416,14 +417,14 @@ METHOD XbpMLE:setWrap( lWrap )
RETURN ::xDummy == 1
/*----------------------------------------------------------------------*/
METHOD XbpMLE:setEditable( lYes )
::xDummy := ::oWidget:readOnly()
::oWidget:setReadOnly( !lYes )
RETURN ! ::xDummy
/*----------------------------------------------------------------------*/
METHOD XbpMLE:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )

View File

@@ -83,7 +83,7 @@ CLASS XbpPartHandler
METHOD configure( oParent, oOwner )
METHOD destroy()
METHOD handleEvent( hEvent, mp1, mp2 )
METHOD status()
METHOD status( nStatus ) SETGET
METHOD addChild( oXbp )
METHOD addAsChild()
@@ -100,7 +100,7 @@ CLASS XbpPartHandler
DATA nNameId
DATA oParent
DATA oOwner
DATA nStatus INIT 0
DATA nStatus INIT XBP_STAT_INIT
ENDCLASS
@@ -161,9 +161,14 @@ METHOD handleEvent( hEvent, mp1, mp2 ) CLASS XbpPartHandler
/*----------------------------------------------------------------------*/
METHOD status() CLASS XbpPartHandler
METHOD status( nStatus ) CLASS XbpPartHandler
LOCAL nOldStatus := ::nStatus
RETURN ::nStatus
IF hb_isNumeric( nStatus )
::nStatus := nStatus
ENDIF
RETURN nOldStatus
/*----------------------------------------------------------------------*/

View File

@@ -114,6 +114,7 @@ METHOD XbpPrintDialog:create( oParent, oOwner )
::oWidget:connect( "accepted(QPrinter)", {|p| ::pPrinter := p } )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -167,6 +167,7 @@ METHOD XbpPushButton:hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParam
::oWidget:connect( "clicked()", {|| ::execSlot( "clicked()" ) } )
::addAsChild()
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -122,6 +122,7 @@ METHOD XbpRadioButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -189,6 +189,7 @@ METHOD XbpRtf:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oTextCursor:pPtr := ::oWidget:textCursor()
::oTextCharFormat:pPtr := ::oTextCursor:charFormat()
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -127,6 +127,7 @@ METHOD XbpScrollBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -182,6 +182,7 @@ METHOD XbpSLE:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
ENDIF
::oParent:addChild( Self )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -163,6 +163,7 @@ METHOD XbpSpinButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::setData()
::oParent:addChild( Self )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -243,6 +243,7 @@ METHOD XbpStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::show()
ENDIF
::oParent:addChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -92,7 +92,7 @@ CLASS XbpStatusBar INHERIT XbpWindow
METHOD delItem( nItemORcKey )
METHOD getItem( nItemORcKey )
METHOD clear()
METHOD panelClick( ... ) SETGET
METHOD panelDblClick( ... ) SETGET
@@ -134,7 +134,7 @@ METHOD XbpStatusBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::show()
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/
@@ -283,7 +283,7 @@ METHOD XbpStatusBar:panelClick( ... )
::sl_lbClick := a_[ 1 ]
ELSEIF len( a_ ) >= 1 .AND. hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, a_[ 1 ], NIL, Self )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
@@ -294,7 +294,7 @@ METHOD XbpStatusBar:panelDblClick( ... )
::sl_lbDblClick := a_[ 1 ]
ELSEIF len( a_ ) >= 1 .AND. hb_isBlock( ::sl_lbDblClick )
eval( ::sl_lbDblClick, a_[ 1 ], NIL, Self )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -293,9 +293,8 @@ METHOD XbpTabWidget:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
IF ::visible
::show()
ENDIF
::oParent:addChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -188,7 +188,7 @@ METHOD XbpToolbar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::show()
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -179,6 +179,7 @@ METHOD XbpTreeView:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::show()
ENDIF
::oParent:AddChild( SELF )
::postCreate()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -262,6 +262,8 @@ CLASS XbpWindow INHERIT XbpPartHandler
ACCESS pWidget INLINE iif( empty( ::oWidget ), NIL, ::oWidget:pPtr )
ACCESS pParent INLINE iif( empty( ::oParent ), NIL, ::oParent:oWidget:pPtr )
METHOD postCreate()
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -363,6 +365,14 @@ METHOD XbpWindow:setQtProperty( cProperty )
/*----------------------------------------------------------------------*/
METHOD XbpWindow:postCreate()
::status := iif( hbqt_isEmptyQtPointer( ::oWidget:pPtr ), XBP_STAT_FAILURE, XBP_STAT_CREATE )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpWindow:connectWindowEvents()
::oWidget:connect( QEvent_MouseButtonPress , {|e| ::grabEvent( QEvent_MouseButtonPress , e ) } )
@@ -417,18 +427,6 @@ HB_TRACE( HB_TR_DEBUG, hb_threadId(),"Destroy[ B ] "+pad(cCls,12)+ cMsg, memory
::oParent := NIL
::oOwner := NIL
//::oWidget:disconnect()
IF len( ::aEConnections ) > 0
#if 0
FOR EACH e_ IN ::aEConnections
// ::xDummy := Qt_Events_DisConnect( ::pEvents, e_[ 1 ], e_[ 2 ] )
NEXT
::aEConnections := {}
// ::oWidget:removeEventFilter( ::pEvents )
#endif
ENDIF
IF Len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
::aChildren := {}