2009-07-27 23:42 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbxbp/xbp.ch
  * contrib/hbxbp/xbpbrowse.prg
  * contrib/hbxbp/xbpgeneric.prg
  * contrib/hbxbp/xbpwindow.prg
    + Implemented XbpBrowse() class - a work-in-progress. Still a lot more to go.

  * contrib/hbxbp/tests/demoxbp.prg
  + contrib/hbxbp/tests/test.dbf
    + Demonstrated XbpBrowse() implementation.

      NOTE: Current implementation is just a proof of concept that 
            TBrowse or XbpBrowse like behavior can be simulated. But a lot 
            more work is needed to reach the destination. Currently, 
            data is fetched based on recno(). Qt's Model/View framework
            expects number of rows to be supplied at the begining and hence
            I could find only recno() to pull the row information.
            I have an idea how exact behavior can be simulated but that 
            will need a lot of base work. So for now just play with what 
            I could achieve. Also note that on the face value, pure Xbase++ code
            is working - headers, cell colors, colorblock, navigation, etc. Just study 
            the code and you will know how difficult it was just to precieve how
            this could been achieved.
                 Any suggestions in direction are welcome.
This commit is contained in:
Pritpal Bedi
2009-07-28 06:59:13 +00:00
parent f4ed67c67f
commit ce3082bf1e
7 changed files with 3384 additions and 43 deletions

View File

@@ -17,6 +17,31 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-27 23:42 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbxbp/xbp.ch
* contrib/hbxbp/xbpbrowse.prg
* contrib/hbxbp/xbpgeneric.prg
* contrib/hbxbp/xbpwindow.prg
+ Implemented XbpBrowse() class - a work-in-progress. Still a lot more to go.
* contrib/hbxbp/tests/demoxbp.prg
+ contrib/hbxbp/tests/test.dbf
+ Demonstrated XbpBrowse() implementation.
NOTE: Current implementation is just a proof of concept that
TBrowse or XbpBrowse like behavior can be simulated. But a lot
more work is needed to reach the destination. Currently,
data is fetched based on recno(). Qt's Model/View framework
expects number of rows to be supplied at the begining and hence
I could find only recno() to pull the row information.
I have an idea how exact behavior can be simulated but that
will need a lot of base work. So for now just play with what
I could achieve. Also note that on the face value, pure Xbase++ code
is working - headers, cell colors, colorblock, navigation, etc. Just study
the code and you will know how difficult it was just to precieve how
this could been achieved.
Any suggestions in direction are welcome.
2009-07-27 23:36 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/generator/hbqtgen.prg
+ Added one more section <SUBCLASS> </SUBCLASS>. This holds .PRG

View File

@@ -62,12 +62,15 @@
/*----------------------------------------------------------------------*/
REQUEST DbfCdx
#define TAB_1 1
#define TAB_2 2
#define TAB_3 3
#define TAB_4 4
#define TAB_5 5
#define TAB_6 6
#define TAB_7 7
#define CRLF chr( 13 )+chr( 10 )
@@ -161,11 +164,14 @@ PROCEDURE BuildADialog()
Build_Statics( oDA )
/* Build HTML Viewer */
oHtm := Build_HTMLViewer( aTabs[ TAB_1 ] )
oHtm := Build_HTMLViewer( aTabs[ TAB_7 ] )
/* Build RTF */
Build_Rtf( aTabs[ TAB_6 ] )
/* Build XBPBrowse() */
Build_Browse( aTabs[ TAB_1 ] )
/* Present the dialog on the screen */
oDlg:Show()
@@ -540,12 +546,12 @@ FUNCTION Build_RadioButton( oStatic )
FUNCTION Build_TabPages( oWnd )
LOCAL nHeight := 390
LOCAL aTabs := { NIL,NIL,NIL,NIL,NIL,NIL }
LOCAL aTabs := { NIL,NIL,NIL,NIL,NIL,NIL,NIL }
aTabs[ TAB_1 ] := XbpTabPage():new( oWnd, , { 510, 20 }, { 360, nHeight }, , .t. )
aTabs[ TAB_1 ]:caption := "Web"
// aTabs[ TAB_1 ]:preOffset := 10
// aTabs[ TAB_1 ]:postOffset := 300
aTabs[ TAB_1 ]:caption := "Brw"
aTabs[ TAB_1 ]:preOffset := 10
aTabs[ TAB_1 ]:postOffset := 300
aTabs[ TAB_1 ]:minimized := .F.
aTabs[ TAB_1 ]:create()
aTabs[ TAB_1 ]:TabActivate := SetMaximized( aTabs, 1 )
@@ -558,7 +564,7 @@ FUNCTION Build_TabPages( oWnd )
aTabs[ TAB_2 ]:TabActivate := SetMaximized( aTabs, 2 )
aTabs[ TAB_3 ] := XbpTabPage():new( oWnd, , { 510, 20 }, { 360, nHeight }, , .t. )
aTabs[ TAB_3 ]:caption := "Buttons"
aTabs[ TAB_3 ]:caption := "Btns"
aTabs[ TAB_3 ]:preOffset := 40
aTabs[ TAB_3 ]:postOffset := 100
aTabs[ TAB_3 ]:create()
@@ -590,6 +596,14 @@ FUNCTION Build_TabPages( oWnd )
aTabs[ TAB_6 ]:create()
aTabs[ TAB_6 ]:TabActivate := SetMaximized( aTabs, 6 )
aTabs[ TAB_7 ] := XbpTabPage():new( oWnd, , { 510, 20 }, { 360, nHeight }, , .t. )
aTabs[ TAB_7 ]:caption := "Web"
aTabs[ TAB_7 ]:preOffset := 120
aTabs[ TAB_7 ]:postOffset := 20
aTabs[ TAB_7 ]:minimized := .F.
aTabs[ TAB_7 ]:create()
aTabs[ TAB_7 ]:TabActivate := SetMaximized( aTabs, 7 )
RETURN aTabs
/*----------------------------------------------------------------------*/
@@ -771,14 +785,7 @@ FUNCTION Build_SpinButtons( oWnd )
/*----------------------------------------------------------------------*/
STATIC FUNCTION RGB( r, g, b )
HB_SYMBOL_UNUSED( r )
HB_SYMBOL_UNUSED( g )
HB_SYMBOL_UNUSED( b )
// Display a static window with flashing color of rgb
RETURN nil
RETURN GraMakeRGBColor( { b,g,r } ) /* a bug in Qt */
/*----------------------------------------------------------------------*/
@@ -1133,6 +1140,7 @@ FUNCTION Build_Bitmap( oWnd )
aadd( aFltr, { "X11 Bitmap ", "*.xbm" } )
aadd( aFltr, { "X11 Pixmap ", "*.xpm" } )
oDlg := XbpFileDialog():new():create( oWnd, , { 10,10 } )
oDlg:title := "Specify how to save it !"
oDlg:fileFilters := aFltr
cFile := oDlg:saveAs()
@@ -1153,7 +1161,7 @@ FUNCTION Build_Bitmap( oWnd )
/*----------------------------------------------------------------------*/
FUNCTION GetAnImageFile( oWnd, cTitle )
LOCAL aFltr := {}
LOCAL oDlg, aFltr := {}
DEFAULT cTitle TO "Select an Image"
@@ -1430,3 +1438,136 @@ STATIC FUNCTION RtfApplyFont( oRTF )
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION Build_Browse( oWnd )
LOCAL aPresParam, oXbpBrowse, oXbpColumn
#include "set.ch"
Set( _SET_DATEFORMAT, "MM/DD/YYYY" )
USE "test.dbf" NEW SHARED VIA 'DBFCDX'
oXbpBrowse := XbpBrowse():new( oWnd ):create( , , { 10,10 }, { oWnd:currentSize()[1]-25,oWnd:currentSize()[2]-45 } )
aPresParam := { ;
{ XBP_PP_COL_HA_CAPTION , "Last" }, ;
{ XBP_PP_COL_HA_FGCLR , XBPSYSCLR_WINDOWSTATICTEXT }, ;
{ XBP_PP_COL_HA_BGCLR , XBPSYSCLR_DIALOGBACKGROUND }, ;
{ XBP_PP_COL_HA_HEIGHT , 20 }, ;
{ XBP_PP_COL_DA_FGCLR , GRA_CLR_BLACK }, ;
{ XBP_PP_COL_DA_BGCLR , RGB( 248,210,194 ) }, ;
{ XBP_PP_COL_DA_HILITE_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_HILITE_BGCLR , GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_ROWHEIGHT , 20 } }
oXbpColumn := XbpColumn():new( , , , , aPresParam )
oXbpColumn:dataLink := {|| test->Last }
oXbpColumn:create()
oXbpColumn:colorBlock := {|x| IF( left( x,1 ) $ "L,H", { GRA_CLR_BLUE, GRA_CLR_YELLOW }, { NIL, NIL } ) }
//
oXbpBrowse:addColumn( oXbpColumn )
aPresParam := { ;
{ XBP_PP_COL_HA_CAPTION , "First" }, ;
{ XBP_PP_COL_HA_ALIGNMENT , XBPALIGN_LEFT }, ;
{ XBP_PP_COL_HA_FGCLR , GraMakeRGBColor( { 200, 100, 255 } ) }, ;
{ XBP_PP_COL_HA_BGCLR , GRA_CLR_RED }, ;
{ XBP_PP_COL_HA_HEIGHT , 20 }, ;
{ XBP_PP_COL_DA_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_BGCLR , RGB( 120,130,230 ) }, ;
{ XBP_PP_COL_DA_HILITE_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_HILITE_BGCLR , GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_ROWHEIGHT , 20 } }
//
oXbpColumn := XbpColumn():new( , , , , aPresParam )
oXbpColumn:dataLink := {|| test->First }
oXbpColumn:create()
//
oXbpBrowse:addColumn( oXbpColumn )
aPresParam := { ;
{ XBP_PP_COL_HA_CAPTION , "Hired On" }, ;
{ XBP_PP_COL_HA_FGCLR , GraMakeRGBColor( { 255, 0, 255 } ) }, ;
{ XBP_PP_COL_HA_BGCLR , GRA_CLR_YELLOW }, ;
{ XBP_PP_COL_HA_HEIGHT , 20 }, ;
{ XBP_PP_COL_DA_FGCLR , GRA_CLR_BLACK }, ;
{ XBP_PP_COL_DA_BGCLR , GRA_CLR_GREEN }, ;
{ XBP_PP_COL_DA_HILITE_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_HILITE_BGCLR , GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_ROWHEIGHT , 20 } }
//
oXbpColumn := XbpColumn():new( , , , , aPresParam )
oXbpColumn:dataLink := {|| test->HireDate }
oXbpColumn:create()
//
oXbpBrowse:addColumn( oXbpColumn )
aPresParam := { ;
{ XBP_PP_COL_HA_CAPTION , "Age" }, ;
{ XBP_PP_COL_HA_FGCLR , GraMakeRGBColor( { 200, 100, 255 } ) }, ;
{ XBP_PP_COL_HA_BGCLR , GRA_CLR_BLUE }, ;
{ XBP_PP_COL_HA_HEIGHT , 20 }, ;
{ XBP_PP_COL_DA_FGCLR , GRA_CLR_BLACK }, ;
{ XBP_PP_COL_DA_BGCLR , GRA_CLR_YELLOW }, ;
{ XBP_PP_COL_DA_HILITE_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_HILITE_BGCLR , GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_ROWHEIGHT , 20 } }
//
oXbpColumn := XbpColumn():new( , , , , aPresParam )
oXbpColumn:dataLink := {|| test->Age }
oXbpColumn:create()
//
oXbpBrowse:addColumn( oXbpColumn )
aPresParam := { ;
{ XBP_PP_COL_HA_CAPTION , "City" }, ;
{ XBP_PP_COL_HA_FGCLR , GRA_CLR_CYAN }, ;
{ XBP_PP_COL_HA_BGCLR , GRA_CLR_BLUE }, ;
{ XBP_PP_COL_HA_HEIGHT , 20 }, ;
{ XBP_PP_COL_DA_FGCLR , GRA_CLR_BLACK }, ;
{ XBP_PP_COL_DA_BGCLR , RGB( 205,240,210 ) }, ;
{ XBP_PP_COL_DA_HILITE_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_HILITE_BGCLR , GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_ROWHEIGHT , 20 } }
//
oXbpColumn := XbpColumn():new( , , , , aPresParam )
oXbpColumn:dataLink := {|| test->City }
oXbpColumn:create()
//
oXbpBrowse:addColumn( oXbpColumn )
aPresParam := { ;
{ XBP_PP_COL_HA_CAPTION , "Salary" }, ;
{ XBP_PP_COL_HA_ALIGNMENT , XBPALIGN_RIGHT }, ;
{ XBP_PP_COL_HA_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_HA_BGCLR , RGB( 140,170,240 ) }, ;
{ XBP_PP_COL_HA_HEIGHT , 20 }, ;
{ XBP_PP_COL_DA_FGCLR , GRA_CLR_BLACK }, ;
{ XBP_PP_COL_DA_BGCLR , GRA_CLR_DARKGREEN }, ;
{ XBP_PP_COL_DA_HILITE_FGCLR , GRA_CLR_WHITE }, ;
{ XBP_PP_COL_DA_HILITE_BGCLR , GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COL_DA_ROWSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_COLSEPARATOR , XBPCOL_SEP_DOTTED }, ;
{ XBP_PP_COL_DA_ROWHEIGHT , 20 } }
//
oXbpColumn := XbpColumn():new( , , , , aPresParam )
oXbpColumn:dataLink := {|| test->Salary }
oXbpColumn:create()
oXbpColumn:colorBlock := {|x| IF( x < 40000, { NIL, RGB( 255,0,0 ) }, {NIL,NIL} ) }
//
oXbpBrowse:addColumn( oXbpColumn )
RETURN nil
/*----------------------------------------------------------------------*/

Binary file not shown.

View File

@@ -325,6 +325,11 @@
#define XBPCOL_TYPE_FILEMINIICON 6
#define XBPCOL_TYPE_MULTILINETEXT 7
#define XBPLINE_NONE 1
#define XBPLINE_NORMAL 2
#define XBPLINE_DASHED 4
#define XBPLINE_DOTTED 8
#define XBPCOL_SEP_NONE XBPLINE_NONE
#define XBPCOL_SEP_LINE XBPLINE_NORMAL
#define XBPCOL_SEP_DASHED XBPLINE_DASHED

File diff suppressed because it is too large Load Diff

View File

@@ -69,6 +69,7 @@
#include "xbp.ch"
#include "gra.ch"
#include "appevent.ch"
#include "hbqt.ch"
@@ -380,6 +381,24 @@ FUNCTION ConvertAFact( cMode, nFrom, xValue )
aadd( a_, { XBPRTF_ALIGN_RIGHT , Qt_AlignRight } )
aadd( a_, { XBPRTF_ALIGN_CENTER, Qt_AlignCenter } )
CASE cMode == "ALIGNMENT"
aadd( a_, { XBPALIGN_TOP , Qt_AlignTop } )
aadd( a_, { XBPALIGN_BOTTOM , Qt_AlignBottom } )
aadd( a_, { XBPALIGN_LEFT , Qt_AlignLeft } )
aadd( a_, { XBPALIGN_RIGHT , Qt_AlignRight } )
aadd( a_, { XBPALIGN_VCENTER, Qt_AlignVCenter } )
aadd( a_, { XBPALIGN_HCENTER, Qt_AlignHCenter } )
CASE cMode == "BRWNAVIGATE"
aadd( a_, { xbeK_DOWN , QAbstractItemView_MoveDown } )
aadd( a_, { xbeK_UP , QAbstractItemView_MoveUp } )
aadd( a_, { xbeK_RIGHT, QAbstractItemView_MoveRight } )
aadd( a_, { xbeK_LEFT , QAbstractItemView_MoveLeft } )
aadd( a_, { xbeK_HOME , QAbstractItemView_MoveHome } )
aadd( a_, { xbeK_END , QAbstractItemView_MoveEnd } )
aadd( a_, { xbeK_PGUP , QAbstractItemView_MovePageUp } )
aadd( a_, { xbeK_PGDN , QAbstractItemView_MovePageDown } )
CASE cMode == "SOMEOTHER"
ENDCASE

View File

@@ -1793,6 +1793,8 @@ STATIC FUNCTION Xbp_SetPresParamIfNil( aPP, nParam, xValue )
aPP[ n,2 ] := xValue
ENDIF
ENDIF
ELSE
aadd( aPP, { nParam, xValue } )
ENDIF
RETURN nil
@@ -1807,6 +1809,8 @@ STATIC FUNCTION Xbp_SetPresParam( aPP, nParam, xValue )
IF xValue != NIL
aPP[ n,2 ] := xValue
ENDIF
ELSE
aadd( aPP, { nParam, xValue } )
ENDIF
RETURN oldValue