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

* harbour/contrib/hbxbp/Makefile

  * harbour/contrib/hbxbp/xbp.ch

  + harbour/contrib/hbxbp/xbp3state.prg
  + harbour/contrib/hbxbp/xbpcheckbox.prg
  + harbour/contrib/hbxbp/xbpdataref.prg
  + harbour/contrib/hbxbp/xbplistbox.prg
  + harbour/contrib/hbxbp/xbpradiobutton.prg
  + harbour/contrib/hbxbp/xbpstatusbar.prg
  + harbour/contrib/hbxbp/xbptabpage.prg
  * harbour/contrib/hbxbp/xbpdialog.prg
  * harbour/contrib/hbxbp/xbpwindow.prg
    + Added classes:
         Xbp3State()
         XbpCheckBox()
         XbpRadioButton()
         XbpListBox()
            XbpDataRef() - Used by data aware components as above.
         XbpStatusBar() - Partial
         XbpTabPage()

  * harbour/contrib/hbxbp/tests/demoxbp.prg
    + Added implementation code of above classes.

    /*
        demoXBP.prg implements 100% Xbase++ code pulled from its 
        documentation. The only attributes changes are done either to
        redefine the parent or window coordinates. Xbase++ ( as I know )
        takes bottom-top approach in screen coordinate system, so 
        demoXBP.prg compiled with Xbase++ shows objects in different
        positions. Except for this and a couple of other compatibility
        issues, Harbour offers more wider horizon. So, once base 
        implementation is done, I may extend these classes to take 
        advantage of QT's powerful design concepts.   
    */
This commit is contained in:
Pritpal Bedi
2009-06-15 08:13:08 +00:00
parent 8276f66f37
commit 94dd785f2a
13 changed files with 1847 additions and 43 deletions

View File

@@ -17,6 +17,44 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-15 00:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbxbp/Makefile
* harbour/contrib/hbxbp/xbp.ch
+ harbour/contrib/hbxbp/xbp3state.prg
+ harbour/contrib/hbxbp/xbpcheckbox.prg
+ harbour/contrib/hbxbp/xbpdataref.prg
+ harbour/contrib/hbxbp/xbplistbox.prg
+ harbour/contrib/hbxbp/xbpradiobutton.prg
+ harbour/contrib/hbxbp/xbpstatusbar.prg
+ harbour/contrib/hbxbp/xbptabpage.prg
* harbour/contrib/hbxbp/xbpdialog.prg
* harbour/contrib/hbxbp/xbpwindow.prg
+ Added classes:
Xbp3State()
XbpCheckBox()
XbpRadioButton()
XbpListBox()
XbpDataRef() - Used by data aware components as above.
XbpStatusBar() - Partial
XbpTabPage()
* harbour/contrib/hbxbp/tests/demoxbp.prg
+ Added implementation code of above classes.
/*
demoXBP.prg implements 100% Xbase++ code pulled from its
documentation. The only attributes changes are done either to
redefine the parent or window coordinates. Xbase++ ( as I know )
takes bottom-top approach in screen coordinate system, so
demoXBP.prg compiled with Xbase++ shows objects in different
positions. Except for this and a couple of other compatibility
issues, Harbour offers more wider horizon. So, once base
implementation is done, I may extend these classes to take
advantage of QT's powerful design concepts.
*/
2009-06-15 10:06 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
- utils/hbextern
+ examples/hbextern

View File

@@ -47,6 +47,13 @@ PRG_SOURCES=\
xbpmenubar.prg \
xbptoolbar.prg \
xbppushbutton.prg \
xbpdataref.prg \
xbpcheckbox.prg \
xbp3state.prg \
xbpradiobutton.prg \
xbptabpage.prg \
xbplistbox.prg \
xbpstatusbar.prg \
PRG_HEADERS=\
xbp.ch \

View File

@@ -59,7 +59,7 @@
/*----------------------------------------------------------------------*/
PROCEDURE Main()
LOCAL oDlg, mp1, mp2, oXbp, nEvent, aSize
LOCAL oDlg, mp1, mp2, oXbp, nEvent, aSize, aTabs
/* Create Application Window */
oDlg := GuiStdDialog( 'Harbour - Xbase++ - QT Dialog [ Press "Q" to Exit ]' )
@@ -72,17 +72,35 @@ PROCEDURE Main()
oDlg:setPos( { ( aSize[ 1 ] - oDlg:currentSize()[ 1 ] ) / 2, ;
( aSize[ 2 ] - oDlg:currentSize()[ 2 ] ) / 2 } )
/* Make background color of :drawingArea different */
oDlg:drawingArea:setColorBG( GraMakeRGBColor( { 134,128,164 } ) )
/* Install menu system */
Build_MenuBar()
/* Install Statusbar */
Build_StatusBar( oDlg )
/* Install Toolbar */
Build_ToolBar( oDlg:drawingArea )
/* install Push Buttons */
Build_PushButton( oDlg:drawingArea )
/* Install Tab Pages */
aTabs := Build_TabPages( oDlg )
/* Make background color of :drawingArea different */
oDlg:drawingArea:setColorBG( GraMakeRGBColor( { 134,128,164 } ) )
/* Install checkboxes */
Build_CheckBox( aTabs[ 3 ] )
/* Install 3state checkboxes */
Build_3State( aTabs[ 3 ] )
/* Install Radio Buttons */
Build_RadioButton( aTabs[ 3 ] )
/* Install ListBox */
Build_ListBox( aTabs[ 1 ] )
/* Install Push Buttons */
Build_PushButton( oDlg:drawingArea )
/* Present the dialog on the screen */
oDlg:Show()
@@ -165,8 +183,8 @@ STATIC FUNCTION Build_MenuBar()
oSubMenu:itemMarked := {|mp1| IF( mp1 == 5, MsgBox( "WOW - ::itemMarked - Activated" ), NIL ) }
/* Menu colors are being honored in Harbour only */
oSubMenu:setColorFG( GraMakeRGBColor( { 255, 1, 1 } ) )
oSubMenu:setColorBG( GraMakeRGBColor( { 134,128,250 } ) )
oSubMenu:setColorFG( GraMakeRGBColor( { 255, 1, 1 } ) )
Return nil
@@ -238,14 +256,14 @@ FUNCTION Build_PushButton( oDA )
oXbp := XbpPushButton():new( oDA )
oXbp:caption := "A"
oXbp:create( , , {30,100}, {100,40} )
oXbp:create( , , {30,370}, {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:create( , , {140,370}, {100,40} )
oXbp:activate:= {|| MsgBox( "Pushbutton B" ) }
/* Harbour supports presentation colors */
oXbp:setColorBG( GraMakeRGBColor( {0,255,255} ) )
@@ -254,3 +272,171 @@ FUNCTION Build_PushButton( oDA )
/*----------------------------------------------------------------------*/
FUNCTION Build_CheckBox( oWnd )
LOCAL oXbp
oXbp := XbpCheckbox():new()
oXbp:caption := "A"
oXbp:create( oWnd, , {30,30}, {100,30} )
// Determine state using mp1
oXbp:selected := ;
{| mp1, mp2, oChk| MsgBox( "Checkbox A", ;
IIf( mp1, "selected" , ;
"not selected" ) ) }
// Create second checkbox, specify position using :new()
oXbp := XbpCheckbox():new( oWnd, , {30,70}, {100,30} )
oXbp:caption := "B"
oXbp:create()
// Determine state using :getData()
oXbp:selected := ;
{| mp1, mp2, oChk| MsgBox( "Checkbox B", ;
IIf( oChk:getData(), "selected", ;
"not selected" ) ) }
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION Build_3State( oWnd )
LOCAL oXbp
LOCAL aState := { "not selected", "selected", "undefined" }
// Create first 3State button, passing the position to :create()
//
oXbp := Xbp3State():new()
oXbp:caption := "3State A"
oXbp:create( oWnd, , {130,30}, {100,30} )
// Determine current state using mp1
oXbp:selected := {| mp1, mp2, oBtn| MsgBox( "3State A", aState[ mp1+1 ] ) }
// Create second 3State Button, passing the position to :new()
//
oXbp := Xbp3State():new( oWnd, , {130,70}, {100,30} )
oXbp:caption := "3State B"
oXbp:create()
// Determine current state using :getData()
oXbp:selected := {| mp1, mp2, oBtn| MsgBox( "3State B", aState[ oBtn:getData()+1 ] ) }
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION Build_RadioButton( oStatic )
LOCAL bSelected, oRadio
// Display which radiobutton is selected
bSelected := {|mp1,mp2,obj| MsgBox( obj:caption ) }
// Create four radiobuttons
oRadio := XbpRadioButton():new( oStatic,, {30,110}, {80,30} )
oRadio:caption := "COM 1"
oRadio:selection :=.T.
oRadio:selected := bSelected
oRadio:create()
oRadio := XbpRadioButton():new( oStatic,, {30,150}, {80,30} )
oRadio:caption := "COM 2"
oRadio:selected := bSelected
oRadio:create()
oRadio := XbpRadioButton():new( oStatic,, {30,190}, {80,30} )
oRadio:caption := "COM 3"
oRadio:selected := bSelected
oRadio:create()
oRadio := XbpRadioButton():new( oStatic,, {30,230}, {80,30} )
oRadio:caption := "COM 4"
oRadio:selected := bSelected
oRadio:create()
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION Build_TabPages( oDlg )
LOCAL oTab1, oTab2, oTab3
LOCAL nHeight := 380
// First tab page is maximized
oTab1 := XbpTabPage():new( oDlg:drawingArea, , { 510, 20 }, { 360, nHeight } )
/* comment our following line to position tabs at the bottom */
//oTab1:type := XBPTABPAGE_TAB_BOTTOM
oTab1:minimized := .F.
oTab1:caption := "Customer"
oTab1:create()
oTab1:TabActivate := ;
{|| oTab2:minimize(), oTab3:minimize(),;
oTab1:maximize(), MsgBox( oTab1:caption ) }
oTab1:setColorBG( GraMakeRGBColor( {198,198,198} ) )
// Second tab page is minimized
oTab2 := XbpTabPage():new( oDlg:drawingArea, , { 510, 20 }, { 360, nHeight } )
oTab2:caption := "Order"
oTab2:preOffset := 20
oTab2:postOffset := 60
oTab2:create()
oTab2:TabActivate := ;
{|| oTab1:minimize(), oTab3:minimize(),;
oTab2:maximize(), MsgBox( oTab2:caption ) }
// Third tab page is minimized
oTab3 := XbpTabPage():new( oDlg:drawingArea, , { 510, 20 }, { 360, nHeight } )
oTab3:caption := "CheckBoxes"
oTab3:preOffset := 40
oTab3:postOffset := 40
oTab3:create()
oTab3:TabActivate := ;
{|x,y,oTab| x := y, oTab1:minimize(), oTab2:minimize(),;
oTab3:maximize(), MsgBox( oTab:caption ) }
RETURN { oTab1, oTab2, oTab3 }
/*----------------------------------------------------------------------*/
FUNCTION Build_ListBox( oWnd )
LOCAL oListBox, aItems
aItems := { "India", "United States", "England", "Japan", "Hungary", "Argentina", "China" }
// Create list box that allows multiple selections
oListBox := XbpListBox():new()
//oListBox:markMode := XBPLISTBOX_MM_MULTIPLE
oListBox:create( oWnd, , {10,10}, {150,200} )
// Copy field names from the DbStruct() array to the list box
aeval( aItems, {|e| oListBox:addItem( e ) } )
// Code block for list box selection:
// The selected fields from the DbStruct()
// array are displayed using QOut()
oListBox:ItemSelected := {|mp1, mp2, obj| mp1:=oListBox:getData(), ;
mp2:=oListBox:getItem(mp1), MsgBox( "itemSelected:"+mp2 ) }
//oListBox:ItemMarked := {|mp1, mp2, obj| MsgBox( "itemMarked" ) }
/* DOES NOT Work */
oListBox:setColorBG( GraMakeRGBColor( {127,12,210} ) )
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION Build_StatusBar( oWnd )
LOCAL oSBar, oPanel
oSBar := XbpStatusBar():new( oWnd )
oSBar:create( oWnd, , { 0,0 }, { oWnd:currentSize()[1],30 } )
oPanel := oSBar:getItem( 1 )
oPanel:caption := "Harbour-QT-Xbase++ is Ready"
oPanel:autosize := XBPSTATUSBAR_AUTOSIZE_SPRING
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -59,6 +59,12 @@
/*----------------------------------------------------------------------*/
#if defined( __HB_OUTDEBUG__ )
#xtranslate HB_OUTDEBUG( [<x>] ) => WAPI_OUTPUTDEBUGSTRING( <x> )
#else
#xtranslate HB_OUTDEBUG( [<x>] ) =>
#endif
#define DA_MODE 1 /* Experimental */
#define objTypeNone 0

View File

@@ -0,0 +1,191 @@
/*
* $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++ xbp3State Compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 14Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS Xbp3State INHERIT XbpWindow, XbpDataRef
DATA autosize INIT .F.
DATA caption INIT ""
DATA pointerFocus INIT .T.
DATA selection INIT .F.
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD setCaption( cCaption )
ACCESS selected INLINE ::sl_lbClick
ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock
METHOD handleEvent( nEvent, aInfo )
METHOD exeBlock()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD Xbp3State:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "Xbp3State"
::objType := objType3State
RETURN Self
/*----------------------------------------------------------------------*/
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 ) } )
::oWidget:setTriState( .t. )
::setPosAndSize()
IF ::visible
::show()
ENDIF
::setCaption( ::caption )
IF ::selection
::oWidget:setCheckState( 2 )
ENDIF
IF ::visible
::show()
ENDIF
::editBuffer := ::oWidget:checkState()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD Xbp3State:exeBlock( iState )
::sl_editBuffer := IF( iState == 2, 1, IF( iState == 1, 2, iState ) )
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, ::sl_editBuffer, NIL, self )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD Xbp3State:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN ( 0 )
/*----------------------------------------------------------------------*/
METHOD Xbp3State:destroy()
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD Xbp3State:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD Xbp3State:setCaption( xCaption )
IF hb_isChar( xCaption )
::caption := xCaption
::oWidget:setText( xCaption )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,183 @@
/*
* $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>
* 14Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpCheckBox INHERIT XbpWindow, XbpDataRef
DATA autosize INIT .F.
DATA caption INIT ""
DATA pointerFocus INIT .T.
DATA selection INIT .F.
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD setCaption( cCaption )
ACCESS selected INLINE ::sl_lbClick
ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock
METHOD handleEvent( nEvent, aInfo )
METHOD exeBlock()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpCheckBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XbpCheckBox"
::objType := objTypeCheckBox
RETURN Self
/*----------------------------------------------------------------------*/
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 ) } )
::setPosAndSize()
IF ::visible
::show()
ENDIF
::setCaption( ::caption )
IF ::selection
::oWidget:setChecked( .t. )
ENDIF
::editBuffer := ::oWidget:isChecked()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpCheckBox:exeBlock( iState )
::sl_editBuffer := iState <> 0
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, iState <> 0, NIL, self )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpCheckBox:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpCheckBox:destroy()
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpCheckBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpCheckBox:setCaption( xCaption )
IF hb_isChar( xCaption )
::caption := xCaption
::oWidget:setText( xCaption )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,196 @@
/*
* $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++ dataRef Compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 14Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpDataRef
DATA changed INIT .F.
DATA dataLink INIT NIL
DATA lastValid INIT .T.
DATA sl_undo INIT NIL
DATA undoBuffer INIT NIL
DATA sl_validate INIT NIL
METHOD new()
DATA sl_editBuffer
DATA sl_buffer
ACCESS editBuffer INLINE ::sl_editBuffer
ASSIGN editBuffer( xData ) INLINE ::sl_editBuffer := xData
METHOD getData()
METHOD setData()
METHOD undo()
METHOD validate( xParam ) SETGET
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpDataRef:new()
RETURN self
/*----------------------------------------------------------------------*/
METHOD XbpDataRef:getData()
LOCAL cClass := __ObjGetClsName( self )
DO CASE
CASE cClass $ "XBPSLE,XBPMLE" //::className == "EDIT"
//::sl_editBuffer := Win_GetMessageText( ::hWnd, WM_GETTEXT, ::bufferLength + 1 )
CASE cClass == "XBPRADIOBUTTON"
::sl_editBuffer := ::oWidget:isChecked()
// CASE cClass == "XBPLISTBOX"
// RETURN ::nCurSelected
ENDCASE
IF hb_isBlock( ::dataLink )
eval( ::dataLink, ::sl_editBuffer )
ENDIF
RETURN ::sl_editBuffer
/*----------------------------------------------------------------------*/
METHOD XbpDataRef:setData( xValue, mp2 )
LOCAL cClass := __ObjGetClsName( self )
HB_SYMBOL_UNUSED( mp2 )
IF hb_isBlock( ::dataLink )
::sl_editBuffer := eval( ::dataLink )
ELSEIF xValue <> NIL
::sl_editBuffer := xValue
ENDIF
DO CASE
CASE cClass $ "XBPCHECKBOX,XBPRADIO"
::oWidget:setChecked( ::sl_editBuffer )
CASE cClass == "XBP3STATE"
::oWidget:setCheckState( IF( ::sl_editBuffer == 1, 2, IF( ::sl_editBuffer == 2, 1, 0 ) ) )
CASE cClass == "XBPLISTBOX" //::className == "LISTBOX" /* Single Selection */
IF !empty( ::sl_editBuffer )
//RETURN Win_LbSetCurSel( ::hWnd, ::sl_editBuffer - 1 ) >= 0
ENDIF
RETURN .f.
CASE cClass == "XBPTREEVIEW" //::className == "SysTreeView32"
IF ::sl_editBuffer <> NIL .and. ::sl_editBuffer:hItem <> NIL
//Win_TreeView_SelectItem( ::hWnd, ::sl_editBuffer:hItem )
ENDIF
CASE cClass $ "XBPSLE,XBPMLE" //::className == "EDIT"
IF hb_isChar( ::sl_editBuffer )
//Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::sl_editBuffer )
ENDIF
CASE ::className == "XBPSCROLLBAR" //"SCROLLBAR"
IF ::sl_editBuffer <> NIL
//WAPI_SetScrollPos( ::pWnd, SB_CTL, ::sl_editBuffer, .t. )
ENDIF
ENDCASE
RETURN ::sl_editBuffer
/*----------------------------------------------------------------------*/
METHOD XbpDataRef:undo()
RETURN .f.
/*----------------------------------------------------------------------*/
METHOD XbpDataRef:validate( xParam )
IF PCount() == 0 .and. hb_isBlock( ::sl_validate )
RETURN eval( ::sl_validate, self )
ELSEIF hb_isBlock( xParam )
::sl_validate := xParam
ENDIF
RETURN .t.
/*----------------------------------------------------------------------*/

View File

@@ -116,8 +116,6 @@ METHOD XbpDialog:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::mouseMode := 0
::objType := objTypeDialog
::style := QWS_THICKFRAME+QWS_OVERLAPPED+QWS_CAPTION+QWS_SYSMENU+QWS_MINIMIZEBOX+QWS_MAXIMIZEBOX
RETURN Self
/*----------------------------------------------------------------------*/
@@ -139,12 +137,9 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::drawingArea := XbpDrawingArea():new( self, , {0,0}, ::aSize, , .t. ):create()
::oWidget:setCentralWidget( QT_PTROF( ::drawingArea:oWidget ) )
::oWidget:resize( ::aSize[ 1 ], ::aSize[ 2 ] )
::oWidget:move( ::aPos[ 1 ], ::aPos[ 2 ] )
::setPosAndSize()
IF ::visible
::lHasInputFocus := .t.
::oWidget:show()
::show()
ENDIF
::oEventLoop := QEventLoop():new( QT_PTROF( ::drawingArea:oWidget ) )

View File

@@ -0,0 +1,244 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the Wvg*Classes
*
* Copyright 2008 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++ xbpTreeView compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 26Nov2008
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpListBox INHERIT XbpWindow, XbpDataRef
DATA adjustHeight INIT .F.
DATA horizScroll INIT .F.
DATA markMode INIT XBPLISTBOX_MM_SINGLE
DATA multiColumn INIT .F.
DATA vertScroll INIT .T.
DATA drawMode INIT XBP_DRAW_NORMAL
DATA oStrList
DATA oStrModel
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD handleEvent()
METHOD exeBlock()
METHOD setItemsHeight( nPixel ) VIRTUAL
METHOD getItemHeight() VIRTUAL
METHOD getTopItem() VIRTUAL
METHOD getVisibleItems() VIRTUAL
METHOD numItems() VIRTUAL
METHOD setTopItem( nIndex ) VIRTUAL
METHOD addItem( cItem ) INLINE ::oStrList:append( cItem ),;
::oStrModel:setStringList( QT_PTROF( ::oStrList ) )
METHOD clear() INLINE ::oStrList:clear(),;
::oStrModel:setStringList( QT_PTROF( ::oStrList ) )
METHOD delItem( nIndex ) INLINE ::oStrList:removeAt( nIndex-1 ),;
::oStrModel:setStringList( QT_PTROF( ::oStrList ) )
METHOD getItem( nIndex ) INLINE ::oStrList:at( nIndex-1 )
METHOD insItem( nIndex, cItem ) INLINE ::oStrList:insert( nIndex-1, cItem ),;
::oStrModel:setStringList( QT_PTROF( ::oStrList ) )
METHOD setItem( nIndex, cItem ) INLINE ::oStrModel:replace( nIndex-1, cItem ),;
::oStrModel:setStringList( QT_PTROF( ::oStrList ) )
METHOD getTabstops() VIRTUAL
METHOD setColumnWidth() VIRTUAL
METHOD setTabstops() VIRTUAL
DATA sl_hScroll
ACCESS hScroll INLINE ::sl_hScroll
ASSIGN hScroll( bBlock ) INLINE ::sl_hScroll := bBlock
DATA sl_vScroll
ACCESS vScroll INLINE ::sl_vScroll
ASSIGN vScroll( bBlock ) INLINE ::sl_vScroll := bBlock
DATA sl_itemMarked
ACCESS itemMarked INLINE ::sl_itemMarked
ASSIGN itemMarked( bBlock ) INLINE ::sl_itemMarked := bBlock
DATA sl_itemSelected
ACCESS itemSelected INLINE ::sl_itemSelected
ASSIGN itemSelected( bBlock ) INLINE ::sl_itemSelected := bBlock
DATA sl_drawItem
ACCESS drawItem INLINE ::sl_drawItem
ASSIGN drawItem( bBlock ) INLINE ::sl_drawItem := bBlock
DATA sl_measureItem
ACCESS measureItem INLINE ::sl_measureItem
ASSIGN measureItem( bBlock ) INLINE ::sl_measureItem := bBlock
DATA nCurSelected INIT 0
METHOD getCurItem() INLINE ::getItem( ::nCurSelected )
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpListBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XBPLISTBOX"
::objType := objTypeListBox
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpListBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
#if 0
IF ::horizScroll
::style += WS_HSCROLL
ENDIF
IF ::vertScroll
::style += WS_VSCROLL
ENDIF
IF ::multiColumn
::style += LBS_MULTICOLUMN
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 ) } )
::oStrList := QStringList():new( ::pWidget )
::oStrModel := QStringListModel():new( ::pWidget )
::oStrModel:setStringList( QT_PTROF( ::oStrList ) )
::oWidget:setModel( QT_PTROF( ::oStrModel ) )
::setPosAndSize()
IF ::visible
::show()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpListBox:exeBlock( nMode, pModel )
LOCAL oModel
IF hb_isPointer( pModel )
oModel := QModelIndex():new()
oModel:pPtr := pModel
::nCurSelected := oModel:row()+1
::sl_editBuffer := oModel:row()+1
ENDIF
IF nMode == 1
IF hb_isBlock( ::sl_itemMarked )
eval( ::sl_itemMarked, NIL, NIL, self )
ENDIF
ELSEIF nMode == 2 .or. nMode == 3
IF hb_isBlock( ::sl_itemSelected )
eval( ::sl_itemSelected, NIL, NIL, self )
ENDIF
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpListBox:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpListBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpListBox:destroy()
::WvgWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,181 @@
/*
* $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>
* 14Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpRadioButton INHERIT XbpWindow, XbpDataRef
DATA autosize INIT .F.
DATA caption INIT ""
DATA pointerFocus INIT .T.
DATA selection INIT .F.
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD setCaption( cCaption )
ACCESS selected INLINE ::sl_lbClick
ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock
METHOD handleEvent( nEvent, aInfo )
METHOD exeBlock()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XbpRadioButton"
::objType := objTypeRadioButton
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:addChild( SELF )
::oWidget := QRadioButton():New( QT_PTROF( ::oParent:oWidget ) )
Qt_Connect_Signal( ::pWidget, "clicked()", {|| ::exeBlock() } )
::setPosAndSize()
IF ::visible
::show()
ENDIF
::setCaption( ::caption )
IF ::selection
::oWidget:setChecked( .t. )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:exeBlock()
::sl_editBuffer := .t.
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, ::sl_editBuffer, NIL, self )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:destroy()
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRadioButton:setCaption( xCaption )
IF hb_isChar( xCaption )
::caption := xCaption
::oWidget:setText( xCaption )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,336 @@
/*
* $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++ xbpStatusBar Compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 14Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpStatusBar INHERIT XbpWindow
DATA caption INIT ""
DATA sizeGrip INIT .T.
DATA aItems INIT {}
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD addItem()
METHOD delItem()
METHOD getItem()
METHOD clear()
METHOD numItems() INLINE Len( ::aItems )
METHOD panelClick() SETGET
METHOD panelDblClick() SETGET
METHOD handleEvent()
METHOD exeBlock()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XbpStatusBar"
::objType := objTypeStatusBar
RETURN Self
/*----------------------------------------------------------------------*/
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 )
IF ::visible
::show()
ENDIF
::addItem( , , , , , -1 )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:exeBlock()
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:destroy()
LOCAL i, nItems
IF ( nItems := Len( ::aItems ) ) > 0
FOR i := 1 TO nItems
NEXT
ENDIF
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:addItem( cCaption, xImage, cDLL, nStyle, cKey, nMode )
LOCAL oPanel, lSuccess := .t.
DEFAULT nMode TO 0
HB_SYMBOL_UNUSED( xImage )
HB_SYMBOL_UNUSED( cDLL )
oPanel := XbpStatusBarPanel():new( cCaption, nStyle, cKey )
oPanel:oParent := self
oPanel:index := ::numItems + 1
IF nMode <> -1
//lSuccess := Wvg_StatusBarCreatePanel( ::hWnd, nMode )
ENDIF
IF lSuccess
aadd( ::aItems, oPanel )
ELSE
RETURN nil
endif
RETURN oPanel
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:delItem( nItemORcKey )
LOCAL nIndex := 0
IF hb_isNumeric( nItemORcKey )
nIndex := ascan( ::aItems, {|o| o:key == nItemORcKey } )
ELSEIF hb_isNumeric( nItemORcKey )
nIndex := nItemORcKey
ENDIF
IF nIndex > 0
/* Delete panel by window */
adel( ::aItems, nIndex )
asize( ::aItems, len( ::aItems ) - 1 )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:getItem( nItemORcKey )
LOCAL nIndex := 0, oPanel
IF hb_isChar( nItemORcKey )
nIndex := ascan( ::aItems, {|o| o:key == nItemORcKey } )
ELSEIF hb_isNumeric( nItemORcKey )
nIndex := nItemORcKey
ENDIF
IF nIndex > 0
oPanel := ::aItems[ nIndex ]
ENDIF
RETURN oPanel
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:clear()
LOCAL i
FOR i := 1 TO ::numItems
/* Remove off window */
NEXT
::aItems := {}
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:panelClick( xParam )
IF hb_isBlock( xParam ) .or. hb_isNil( xParam )
::sl_lbClick := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBar:panelDblClick( xParam )
IF hb_isBlock( xParam ) .or. hb_isNil( xParam )
::sl_lbDblClick := xParam
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* XbpToolbarButton() Class
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
CLASS XbpStatusBarPanel
DATA alignment INIT XBPALIGN_LEFT
DATA autosize INIT XBPSTATUSBAR_AUTOSIZE_NONE
DATA bevel INIT XBPSTATUSBAR_BEVEL_INSET
DATA enabled INIT .T.
DATA index INIT 0
DATA key INIT ""
DATA style INIT XBPSTATUSBAR_PANEL_TEXT
DATA sl_caption INIT ""
DATA image INIT NIL
DATA tooltipText INIT ""
DATA visible INIT .T.
DATA left INIT 0
DATA width INIT 0
DATA minWidth INIT 0
METHOD new()
METHOD caption() SETGET
DATA oParent
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpStatusBarPanel:new( cCaption, nStyle, cKey )
DEFAULT cCaption TO ::sl_caption
DEFAULT nStyle TO ::style
DEFAULT cKey TO ::key
::sl_caption := cCaption
::style := nStyle
::key := cKey
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBarPanel:caption( cCaption )
IF cCaption == NIL
RETURN ::sl_caption
ELSE
DEFAULT cCaption TO ::sl_caption
::sl_caption := cCaption
::oParent:oWidget:showMessage( cCaption )
//Wvg_StatusBarSetText( ::oParent:hWnd, ::index, cCaption )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,245 @@
/*
* $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++ xbpTabPage compatible Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 14Jun2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "appevent.ch"
#include "apig.ch"
#include "hbqt.ch"
/*----------------------------------------------------------------------*/
CLASS XbpTabPage INHERIT XbpWindow
DATA caption INIT NIL /* Character string, Numeric, Object ("") */
DATA clipChildren INIT .T. /* Determines whether Xbase Parts in the child list are clipped during graphic output. */
DATA minimized INIT .T. /* Determines whether the XbpTabPage is minimized after it is created (the page is not visible). */
DATA postOffset INIT 80 /* Determines the distance between the end of the tab and the end of the page as a percentage of the page width. */
DATA preOffset INIT 0 /* Determines the distance between the start of the tab and the start of the page as a percentage of the page width.*/
DATA tabHeight INIT -1 /* Determines the height of the tab. */
DATA type INIT XBPTABPAGE_TAB_TOP /* Determines the position of the tab. */
METHOD new()
METHOD create()
METHOD configure()
METHOD destroy()
METHOD Minimize()
METHOD Maximize()
DATA sl_tabActivate
METHOD tabActivate() SETGET
METHOD handleEvent()
METHOD exeBlock()
METHOD setColorBG()
METHOD setColorFG()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := "XbpTabPage"
::objType := objTypeTabPage
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
LOCAL oPar
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
DEFAULT ::caption TO " "
#if 0
::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 ) } )
::oParent:oTabWidget:move( ::aPos[ 1 ], ::aPos[ 2 ] )
::oParent:oTabWidget:resize( ::aSize[ 1 ], ::aSize[ 2 ] )
IF ::type == XBPTABPAGE_TAB_BOTTOM
::oParent:oTabWidget:setTabPosition( 1 )
ENDIF
::oParent:oTabWidget:show()
ENDIF
oPar := ::oParent:oTabWidget
//::oWidget := QWidget():new( ::pParent )
::oWidget := QWidget():new()
oPar:addTab( ::pWidget, ::caption )
aadd( ::oParent:aTabs, self )
::show()
IF ::visible
::show()
ENDIF
IF ::minimized
::hide()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:exeBlock( iIndex )
IF iIndex >= 0 .and. len( ::oParent:aTabs ) > 0
IF hb_isBlock( ::oParent:aTabs[ iIndex+1 ]:sl_tabActivate )
eval( ::oParent:aTabs[ iIndex+1 ]:sl_tabActivate, NIL, NIL, ::oParent:aTabs[ iIndex+1 ] )
ENDIF
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:handleEvent( nEvent, mp1, mp2 )
HB_SYMBOL_UNUSED( nEvent )
HB_SYMBOL_UNUSED( mp1 )
HB_SYMBOL_UNUSED( mp2 )
RETURN EVENT_UNHANDELLED
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:tabActivate( xParam )
IF hb_isBlock( xParam )
::sl_tabActivate := xParam
ENDIF
RETURN self
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:minimize()
::hide()
RETURN .f.
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:maximize()
::show()
RETURN .t.
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:destroy()
::xbpWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
/* TODO */
METHOD XbpTabPage:setColorBG( nRGB )
LOCAL oPalette
IF hb_isNumeric( nRGB )
oPalette := QPalette():new( QT_PTROF( QColor():new( nRGB ) ) )
//oPalette:pPtr := ::oWidget:palette()
//oPalette:setColor( QPalette_Button , QT_PTROF( QColor():new( nRGB ) ) )
//oPalette:setColor( QPalette_Background, QT_PTROF( QColor():new( nRGB ) ) )
//::oWidget:setBackGroundRole( QPalette_Dark )
::oWidget:setPalette( QT_PTROF( oPalette ) )
//::oParent:oTabWidget:setPalette( QT_PTROF( oPalette ) )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:setColorFG()
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -94,9 +94,6 @@
CLASS XbpWindow INHERIT XbpPartHandler
DATA oWidget
ACCESS pWidget INLINE IF( empty( ::oWidget ), NIL, QT_PTROF( ::oWidget ) )
/* CONFIGURATION */
DATA animate INIT .F.
DATA clipChildren INIT .F.
@@ -285,7 +282,13 @@ EXPORTED:
METHOD grabEvent()
DATA oWidget
ACCESS pWidget INLINE IF( empty( ::oWidget ), NIL, QT_PTROF( ::oWidget ) )
ACCESS pParent INLINE IF( empty( ::oParent ), NIL, QT_PTROF( ::oParent:oWidget ) )
DATA oTabWidget
DATA aTabs INIT {}
DATA oPalette
DATA xDummy
ENDCLASS
@@ -350,29 +353,20 @@ METHOD XbpWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible
/*----------------------------------------------------------------------*/
METHOD XbpWindow:destroy()
#if 0
hb_ToOutDebug( " %s:destroy() XbpWindow()", __objGetClsName( self ) )
#endif
IF Len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
::aChildren := {}
ENDIF
IF !empty( ::oTabWidget )
// It is a HBQT Object...
#ifdef __BYSETPROP__
QTG_ReleaseWindowProcBlock( ::pWnd )
#endif
ENDIF
IF Qtc_IsWindow( ::hWnd )
Qtc_DestroyWindow( ::hWnd )
ENDIF
#ifdef __BYASCALLBACK__
IF !empty( ::nWndProc )
hb_FreeCallBack( ::nWndProc )
ENDIF
#endif
IF ::hBrushBG <> NIL
Qtc_DeleteObject( ::hBrushBG )
ENDIF
@@ -407,10 +401,6 @@ METHOD XbpWindow:grabEvent( pEvent )
METHOD XbpWindow:SetWindowProcCallback()
#ifdef __BYSETPROP__
::nOldProc := QTG_SetWindowProcBlock( ::pWnd, {|h,m,w,l| ::ControlWndProc( h,m,w,l ) } )
#endif
RETURN Self
/*----------------------------------------------------------------------*/
@@ -473,16 +463,16 @@ METHOD XbpWindow:lockUpdate()
/*----------------------------------------------------------------------*/
METHOD XbpWindow:setColorBG( nRGB )
LOCAL cClass
LOCAL cClass := __ObjGetClsName( self )
IF hb_isNumeric( nRGB )
IF empty( ::oPalette )
::oPalette := QPalette():new()
::oPalette := QPalette()
::oPalette:pPtr := ::oWidget:palette()
ENDIF
cClass := upper( ::ClassName )
DO CASE
CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU,XBPTOOLBAR'
CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU,XBPTOOLBAR,XBPTABPAGE,XBPLISTBOX'
::oPalette:setColor( QPalette_Button , QT_PTROF( QColor():new( nRGB ) ) )
OTHERWISE
::oPalette:setColor( QPalette_Background, QT_PTROF( QColor():new( nRGB ) ) )
@@ -496,17 +486,16 @@ METHOD XbpWindow:setColorBG( nRGB )
/*----------------------------------------------------------------------*/
METHOD XbpWindow:setColorFG( nRGB )
LOCAL cClass
LOCAL cClass := __ObjGetClsName( self )
IF hb_isNumeric( nRGB )
IF empty( ::oPalette )
::oPalette := QPalette():new()
::oPalette := QPalette()
::oPalette:pPtr := ::oWidget:palette()
ENDIF
cClass := upper( ::ClassName )
DO CASE
CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU'
CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU,XBPTOOLBAR,XBPTABPAGE'
::oPalette:setColor( QPalette_ButtonText, QT_PTROF( QColor():new( nRGB ) ) )
OTHERWISE
::oPalette:setColor( QPalette_Foreground, QT_PTROF( QColor():new( nRGB ) ) )
@@ -540,6 +529,8 @@ METHOD XbpWindow:setTrackPointer()
METHOD XbpWindow:setPos( aPos, lPaint )
DEFAULT aPos TO ::aPos
IF hb_isArray( aPos )
DEFAULT lPaint TO .T.
::oWidget:move( aPos[ 1 ], aPos[ 2 ] )
@@ -551,6 +542,9 @@ METHOD XbpWindow:setPos( aPos, lPaint )
METHOD XbpWindow:setPosAndSize( aPos, aSize, lPaint )
DEFAULT aPos TO ::aPos
DEFAULT aSize TO ::aSize
IF hb_isArray( aPos ) .and. hb_isArray( aSize )
DEFAULT lPaint TO .T.
@@ -564,6 +558,8 @@ METHOD XbpWindow:setPosAndSize( aPos, aSize, lPaint )
METHOD XbpWindow:setSize( aSize, lPaint )
DEFAULT aSize TO ::aSize
IF hb_isArray( aSize )
DEFAULT lPaint TO .T.