From b60157c4eda80999d108295a2eb7e7f3dcbcf0ec Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 8 Dec 2008 06:48:32 +0000 Subject: [PATCH] 2008-12-07 22:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/makefile * harbour/contrib/gtwvg/common.mak + wvg3stat.prg + wvgbitmp.prg + wvgmle.prg + wvgsle.prg * harbour/contrib/gtwvg/wvgparts.ch + New constants to handle new classes. + harbour/contrib/gtwvg/wvgbitmp.prg + Code skelton of WvgBitmap class ( non-functional yet ). + harbour/contrib/gtwvg/wvg3stat.prg + Wvg3State() class compatible to Xbase++ Xbp3State(). + harbour/contrib/gtwvg/wvgmle.prg + WvgMLE() class compatible with Xbase++ XbpMLE(). + harbour/contrib/gtwvg/wvgsle.prg + WvgSLE() class compatible with Xbase++ XbpSLE(). * harbour/contrib/gtwvg/wvgwin.c + Added new functions for new classes. * harbour/contrib/gtwvg/wvgcheck.prg * harbour/contrib/gtwvg/wvgdatar.prg * harbour/contrib/gtwvg/wvglistb.prg * harbour/contrib/gtwvg/wvgphdlr.prg * harbour/contrib/gtwvg/wvgstatb.prg * harbour/contrib/gtwvg/wvgradio.prg * harbour/contrib/gtwvg/wvgstatc.prg * harbour/contrib/gtwvg/wvgtreev.prg * harbour/contrib/gtwvg/wvghwnd.prg ; Heavy changes in class framework. * harbour/contrib/gtwvg/tests/demowvg.prg + Added functionality of Wvg3State() and WvgSLE(), WvgMLE() classes. ; IMPLEMENTATION : Point to menu option, click on any Active-X Control, Play with all controls : clicks, double clicks, resize. Watch statusbar panels, click on toolbar button, the resulting panel contains latest classes SLE, MLE, CHECKBOX, RADIO, 3STATE. --- harbour/ChangeLog | 43 ++++ harbour/contrib/gtwvg/Makefile | 5 +- harbour/contrib/gtwvg/common.mak | 4 + harbour/contrib/gtwvg/tests/demowvg.prg | 132 +++++++----- harbour/contrib/gtwvg/tests/hbmk_b32.bat | 2 +- harbour/contrib/gtwvg/wvg3stat.prg | 208 +++++++++++++++++++ harbour/contrib/gtwvg/wvgbitmp.prg | 149 ++++++++++++++ harbour/contrib/gtwvg/wvgcheck.prg | 2 +- harbour/contrib/gtwvg/wvgdatar.prg | 34 +++- harbour/contrib/gtwvg/wvggui.c | 1 - harbour/contrib/gtwvg/wvglistb.prg | 13 +- harbour/contrib/gtwvg/wvgmle.prg | 249 +++++++++++++++++++++++ harbour/contrib/gtwvg/wvgparts.ch | 9 + harbour/contrib/gtwvg/wvgphdlr.prg | 8 +- harbour/contrib/gtwvg/wvgradio.prg | 9 +- harbour/contrib/gtwvg/wvgsle.prg | 235 +++++++++++++++++++++ harbour/contrib/gtwvg/wvgstatc.prg | 21 +- harbour/contrib/gtwvg/wvgtreev.prg | 15 +- harbour/contrib/gtwvg/wvgwin.c | 57 +++--- harbour/contrib/gtwvg/wvgwnd.prg | 8 +- 20 files changed, 1098 insertions(+), 106 deletions(-) create mode 100644 harbour/contrib/gtwvg/wvg3stat.prg create mode 100644 harbour/contrib/gtwvg/wvgbitmp.prg create mode 100644 harbour/contrib/gtwvg/wvgmle.prg create mode 100644 harbour/contrib/gtwvg/wvgsle.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6918ffae03..cf9d581c4b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,49 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-12-07 22:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/makefile + * harbour/contrib/gtwvg/common.mak + + wvg3stat.prg + + wvgbitmp.prg + + wvgmle.prg + + wvgsle.prg + + * harbour/contrib/gtwvg/wvgparts.ch + + New constants to handle new classes. + + + harbour/contrib/gtwvg/wvgbitmp.prg + + Code skelton of WvgBitmap class ( non-functional yet ). + + harbour/contrib/gtwvg/wvg3stat.prg + + Wvg3State() class compatible to Xbase++ Xbp3State(). + + harbour/contrib/gtwvg/wvgmle.prg + + WvgMLE() class compatible with Xbase++ XbpMLE(). + + harbour/contrib/gtwvg/wvgsle.prg + + WvgSLE() class compatible with Xbase++ XbpSLE(). + + * harbour/contrib/gtwvg/wvgwin.c + + Added new functions for new classes. + + * harbour/contrib/gtwvg/wvgcheck.prg + * harbour/contrib/gtwvg/wvgdatar.prg + * harbour/contrib/gtwvg/wvglistb.prg + * harbour/contrib/gtwvg/wvgphdlr.prg + * harbour/contrib/gtwvg/wvgstatb.prg + * harbour/contrib/gtwvg/wvgradio.prg + * harbour/contrib/gtwvg/wvgstatc.prg + * harbour/contrib/gtwvg/wvgtreev.prg + * harbour/contrib/gtwvg/wvghwnd.prg + ; Heavy changes in class framework. + + * harbour/contrib/gtwvg/tests/demowvg.prg + + Added functionality of Wvg3State() and WvgSLE(), WvgMLE() classes. + + ; IMPLEMENTATION : Point to menu option, click on any + Active-X Control, Play with all controls : clicks, + double clicks, resize. Watch statusbar panels, click on + toolbar button, the resulting panel contains + latest classes SLE, MLE, CHECKBOX, RADIO, 3STATE. + 2008-12-07 17:12 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/bin/hb-mkslib.sh ! added support for absolute paths in passed object or static library diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index 3dc9653464..6ede6461fa 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -37,7 +37,10 @@ PRG_SOURCES=\ wvgcheck.prg \ wvgdatar.prg \ wvgradio.prg \ - + wvg3stat.prg \ + wvgbitmp.prg \ + wvgsle.prg \ + wvgmle.prg \ PRG_HEADERS=\ hbgtwvg.ch \ diff --git a/harbour/contrib/gtwvg/common.mak b/harbour/contrib/gtwvg/common.mak index 4829a3824f..f7e33c3092 100644 --- a/harbour/contrib/gtwvg/common.mak +++ b/harbour/contrib/gtwvg/common.mak @@ -31,6 +31,10 @@ LIB_OBJS = \ $(OBJ_DIR)wvgcheck$(OBJEXT) \ $(OBJ_DIR)wvgdatar$(OBJEXT) \ $(OBJ_DIR)wvgradio$(OBJEXT) \ + $(OBJ_DIR)wvg3stat$(OBJEXT) \ + $(OBJ_DIR)wvgbitmp$(OBJEXT) \ + $(OBJ_DIR)wvgsle$(OBJEXT) \ + $(OBJ_DIR)wvgmle$(OBJEXT) \ \ $(OBJ_DIR)gtwvg$(OBJEXT) \ $(OBJ_DIR)wvgcore$(OBJEXT) \ diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 58d9f79410..f272509ed3 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -2341,9 +2341,12 @@ FUNCTION GoogleMap() // The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } ) // Function ExecuteActiveX( nActiveX, xParam ) - Local oCrt, oTBar, oSBar, oPanel, oStatic, oCom, oXbp, oTree, oItem1, oItem2 - LOCAL oListBox, oCheck, oRadio, oStatic2 - LOCAL aParts :={} + Local oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 + LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE + LOCAL oPanel, oPanel1, oPanel2, cText + LOCAL cVarA := "Test A", cVarB := "Test B" + LOCAL aState := {"not selected", "selected", "undefined"} + LOCAL aParts := {} HB_SYMBOL_UNUSED( xParam ) HB_SYMBOL_UNUSED( oCom ) @@ -2372,26 +2375,30 @@ Function ExecuteActiveX( nActiveX, xParam ) oSBar:panelClick := {|oPanel| Win_MessageBox( , oPanel:caption ) } oPanel := oSBar:getItem( 1 ) oPanel:caption := 'My Root Panel' - oPanel := oSBar:addItem() - oPanel:caption := 'Ready' - oPanel := oSBar:addItem() - oPanel:caption := 'Click on any part!' + oPanel1 := oSBar:addItem() + oPanel1:caption := 'Ready' + oPanel2 := oSBar:addItem() + oPanel2:caption := 'Click on any part!' //--------------------------- Static ------------------------------\\ oStatic := WvgStatic():new( oCrt ) + oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:options := WVGSTATIC_TEXT_CENTER oStatic:caption := chr(13)+'Implemented Xbase++ Parts' oStatic:create( , , { 0, oTBar:currentSize()[2]+3 }, { 120, oCrt:currentSize()[2]-; oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .t. ) - //--------------------------- Static + Radio----------------------\\ - oStatic2 := WvgStatic():New( oCrt, , { 200,200 }, { 300, 200 }, , .f. ) - oStatic2:options := WVGSTATIC_FRAMETHICK + //--------------------------- Static + Radio + Checkbox ----------\\ + oStatic2 := WvgStatic():New( oCrt, , { 150, 150 }, { 500,310 }, , .f. ) + //oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME + oStatic2:exStyle += WS_EX_WINDOWEDGE + //oStatic2:options := WVGSTATIC_FRAMETHICK oStatic2:create() - oStatic2:setColorBG( RGB( 198,198,198 ) ) + //oStatic2:setColorBG( RGB( 198,198,198 ) ) + oXbp := WvgPushButton():new( oStatic2 ) oXbp:caption := "Hide" - oXbp:create( , , { 230,160 }, {60, 30} ) + oXbp:create( , , { 430,275 }, { 60,25 } ) oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } oRadio := WvgRadioButton():new( oStatic2,, { 10,10 }, { 100,15 } ) @@ -2399,18 +2406,65 @@ Function ExecuteActiveX( nActiveX, xParam ) oRadio:selection := .T. oRadio:selected := {|m1,m2,obj| m1:=m1, m2:=m2, Win_MessageBox( , obj:caption + IF( obj:selection, '< S >', '< N >' ) ) } oRadio:create() + oRadio := WvgRadioButton():new( oStatic2,, { 10,35 }, { 100,15 } ) oRadio:caption := "Com 2" oRadio:create() - //--------------------------- CheckBox ---------------------------\\ - oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100,15 }, , .t. ) - oCheck:caption := 'First Checkbox' + oCheck := WvgCheckBox():New( oStatic2, , { 10,70 }, { 100,15 }, , .t. ) + oCheck:caption := 'Checkbox A' oCheck:create() - oCheck:selected := {|m1,m2,o| m1:=m1,m2:=m2, Win_MessageBox( , IF( o:getData(), 'I am selected','I am not selected' ) ) } + oCheck:selected := {|m1,m2,o| m1:=m1,m2:=m2, Win_MessageBox( , IF( o:getData(), 'I am selected','I am not selected' ) ) } + + // Create first 3State button, passing the position to :create() + oXbp := Wvg3State():new() + oXbp:caption := "3 State A" + oXbp:create( oStatic2, , { 10,100 }, { 100,15 } ) + // Determine current state using mp1 + oXbp:selected := {| m1,m2,oBtn | m2:=m2, oBtn:=oBtn, oPanel1:caption := "3State A ["+aState[ m1+1 ]+"]" } + + // Create second 3State Button, passing the position to :new() + oXbp := Wvg3State():new( oStatic2, , { 10,125 }, { 100,15 } ) + oXbp:caption := "3 State B" + oXbp:create( oStatic2 ) + // Determine current state using :getData() + oXbp:selected := {| m1,m2,oBtn | m1:=m1,m2:=m2, Win_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } + + // Create first SLE, specify position using :create() + // On :typeOut set the focus to the second SLE + oXbp := WvgSLE():new() + oXbp:autoTab := .T. + oXbp:bufferLength := 20 + // Data code block containing assignment to LOCAL variable + oXbp:dataLink := {|x| IIf( x == NIL, cVarA, cVarA := x ) } + oXbp:create( oStatic2, , { 10,170 }, { 150,20 } ) + oXbp:setData() + // Assign the value of the edit buffer to a LOCAL variable when the input focus is lost + oXbp:killInputFocus := { |x,y,oSLE| x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } + + // Create second SLE, specify position using :new() + oXbp := WvgSLE():new( , , { 10,200 }, { 150,20 } ) + oXbp:tabStop := .T. + oXbp:bufferLength := 15 + oXbp:dataLink := {|x| IIf( x == NIL, cVarB, cVarB := x ) } + oXbp:create( oStatic2 ) + oXbp:setData() + oXbp:killInputFocus := { |x,y,oSLE| x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } + + // Read file into LOCAL variable + cText := MemoRead( 'hbmk_b32.bat' ) + // Create MLE, specify position using :create() and + // assign data code block accessing LOCAL variable + oMLE := WvgMLE():new() + oMLE:wordWrap := .F. + oMLE:border := .t. + oMLE:dataLink := {|x| IIf( x==NIL, cText, cText := x ) } + oMLE:create( oStatic2, , { 180,10 }, { 310,250 } ) + // Copy text from LOCAL variable into edit buffer via :dataLink + oMLE:setData() //--------------------------- ListBox -----------------------------\\ - oListBox := WvgListbox():new() + oListBox := WvgListBox():new() oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:setColorFG( RGB( 218,61,34 ) ) @@ -2426,10 +2480,14 @@ Function ExecuteActiveX( nActiveX, xParam ) aadd( aParts, 'XbpPushButton' ) aadd( aParts, 'XbpCheckBox' ) aadd( aParts, 'XbpRadioButton') + aadd( aParts, 'Xbp3State' ) + aadd( aParts, 'XbpSLE' ) + aadd( aParts, 'XbpMLE' ) aadd( aParts, 'DataRef' ) aeval( aParts, {|e| oListBox:addItem( e ) } ) oListBox:itemSelected := {|| Win_MessageBox( , oListBox:getCurItem() ) } + oListBox:setData( 3 ) //--------------------------- PushButton --------------------------\\ oXbp := WvgPushButton():new( oStatic ) @@ -2466,11 +2524,13 @@ Function ExecuteActiveX( nActiveX, xParam ) oTree:showExpanded( .t., 2 ) #endif + oTree:setData( oItem2 ) + //--------------------------- Misc Config ------------------------\\ - oTBar:buttonClick := {|oBtn| IF( oBtn:caption == 'Hide', oStatic:hide(), nil ),; - IF( oBtn:caption == 'Show', oStatic:show(), nil ),; - IF( oBtn:caption == 'Static', oStatic2:show():toFront(), nil ),; - Win_MessageBox( , "Button [" + oBtn:caption + "] clicked!" ) } + oTBar:buttonClick := {|oBtn| IF( oBtn:caption == 'Hide' , oStatic:hide(), nil ),; + IF( oBtn:caption == 'Show' , oStatic:show(), nil ),; + IF( oBtn:caption == 'Tools', oStatic2:show():toFront(), nil ),; + oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } oCrt:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) } #if 1 @@ -2579,7 +2639,7 @@ STATIC FUNCTION ActiveXBuildToolBar( oCrt, nActiveX ) oTBar:addItem( "New" , 'c:\harbour\contrib\gtwvg\tests\v_new.bmp' ) oTBar:addItem( "Select" , 'c:\harbour\contrib\gtwvg\tests\v_selct1.bmp' ) oTBar:addItem( "Calendar" , 'c:\harbour\contrib\gtwvg\tests\v_calend.bmp' ) - oTBar:addItem( "Static" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) + oTBar:addItem( "Tools" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) oTBar:addItem( "Show" , 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) oTBar:addItem( "Hide" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) @@ -2892,31 +2952,3 @@ Function ConfigureRMChart( RMChart ) Return nil //----------------------------------------------------------------------// -#if 0 - * harbour/contrib/gtwvg/makefile - * harbour/contrib/gtwvg/wincallb.c - * harbour/contrib/gtwvg/wvggui.c - * harbour/contrib/gtwvg/wvgsink.c - * harbour/contrib/gtwvg/wvgutils.c - * harbour/contrib/gtwvg/wvgwin.c - * harbour/contrib/gtwvg/hbgtwvg.ch - * harbour/contrib/gtwvg/wvgparts.ch - * harbour/contrib/gtwvg/wvtwin.ch - * harbour/contrib/gtwvg/common.mak - * harbour/contrib/gtwvg/wincback.prg - * harbour/contrib/gtwvg/wvgax.prg - * harbour/contrib/gtwvg/wvgcombo.prg - * harbour/contrib/gtwvg/wvgcrt.prg - * harbour/contrib/gtwvg/wvgdlg.prg - * harbour/contrib/gtwvg/wvglistb.prg - * harbour/contrib/gtwvg/wvgmenub.prg - * harbour/contrib/gtwvg/wvgphdlr.prg - * harbour/contrib/gtwvg/wvgpushb.prg - * harbour/contrib/gtwvg/wvgstatb.prg - * harbour/contrib/gtwvg/wvgstatc.prg - * harbour/contrib/gtwvg/wvgtoolb.prg - * harbour/contrib/gtwvg/wvgtreev.prg - * harbour/contrib/gtwvg/wvgwnd.prg - * harbour/contrib/gtwvg/tests/demowvg.prg -#endif -//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/tests/hbmk_b32.bat b/harbour/contrib/gtwvg/tests/hbmk_b32.bat index ac823543f3..9a8a887ba9 100644 --- a/harbour/contrib/gtwvg/tests/hbmk_b32.bat +++ b/harbour/contrib/gtwvg/tests/hbmk_b32.bat @@ -9,7 +9,7 @@ if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=..\..\..\include set HB_ARCHITECTURE=w32 set HB_COMPILER=bcc32 -set HB_USER_LIBS=gtwvg.lib hbwin.lib xhb.lib +set HB_USER_LIBS=gtwvg.lib hbwin.lib set HB_GUI=yes call %HB_BIN_INSTALL%\hbmk.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/harbour/contrib/gtwvg/wvg3stat.prg b/harbour/contrib/gtwvg/wvg3stat.prg new file mode 100644 index 0000000000..6075e60e75 --- /dev/null +++ b/harbour/contrib/gtwvg/wvg3stat.prg @@ -0,0 +1,208 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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 +// 07Dec2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => +#endif + +//----------------------------------------------------------------------// + +CLASS Wvg3State INHERIT WvgWindow, DataRef + + 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 ) + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3State + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + BS_AUTO3STATE + ::className := 'BUTTON' + ::objType := objType3State + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3State + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + ::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + + IF ::visible + ::show() + ENDIF + + ::setCaption( ::caption ) + + IF ::selection + ::sendMessage( BM_SETCHECK, BST_CHECKED, 0 ) + ENDIF + + ::editBuffer := Win_Button_GetCheck( ::hWnd ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( nMessage, aNM ) CLASS Wvg3State + + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + + SWITCH nMessage + + CASE WM_COMMAND + IF aNM[ NMH_code ] == BN_CLICKED + ::editBuffer := Win_Button_GetCheck( ::hWnd ) + + IF hb_isBlock( ::sl_lbClick ) + eval( ::sl_lbClick, ::editBuffer, NIL, self ) + RETURN 0 + + ENDIF + ENDIF + EXIT + + END + + RETURN 1 + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS Wvg3State + + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) + + IF len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ENDIF + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + HB_FreeCallback( ::nWndProc ) + + RETURN NIL + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3State + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setCaption( xCaption ) CLASS Wvg3State + + IF hb_isChar( xCaption ) + ::caption := xCaption + Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption ) + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgbitmp.prg b/harbour/contrib/gtwvg/wvgbitmp.prg new file mode 100644 index 0000000000..8cc704327b --- /dev/null +++ b/harbour/contrib/gtwvg/wvgbitmp.prg @@ -0,0 +1,149 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpBitmap compatible Class +// +// Pritpal Bedi +// 06Dec2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => +#endif + +//----------------------------------------------------------------------// + +CLASS WvgBitmap + + DATA bits INIT 0 READONLY + DATA bufferOffset INIT 0 READONLY + DATA planes INIT 0 READONLY + DATA transparentClr INIT 0 + DATA xSize INIT 0 READONLY + DATA ySize INIT 0 READONLY + + DATA hBitmap + DATA hDCcompat + DATA lDCToDestroy INIT .f. + + METHOD new() + METHOD create() + METHOD configure() VIRTUAL + METHOD destroy() + + METHOD draw() VIRTUAL + METHOD getColorTable() VIRTUAL + METHOD getDefaultBGColor() VIRTUAL + METHOD load() VIRTUAL + METHOD loadFile() VIRTUAL + METHOD make() VIRTUAL + METHOD presSpace() VIRTUAL + METHOD saveFile() VIRTUAL + METHOD setBuffer() VIRTUAL + METHOD getPicture() VIRTUAL + METHOD setPicture() VIRTUAL + + ENDCLASS + +//----------------------------------------------------------------------// + +METHOD new() CLASS WvgBitmap + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oPScompat ) CLASS WvgBitmap + + IF oPScompat == NIL + ::hDCComp := Win_GetDC() + ::lDCToDestroy := .t. + ELSE + ::hDCComp := oPScompat:hDC + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgBitmap + + IF ::hBitmap <> nil + Win_DeleteObject( ::hBitmap ) + ENDIF + IF ::lDCtoDestroy + Win_ReleaseDC( ::hDCcompat ) + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgcheck.prg b/harbour/contrib/gtwvg/wvgcheck.prg index 79f2d34ef7..4741759890 100644 --- a/harbour/contrib/gtwvg/wvgcheck.prg +++ b/harbour/contrib/gtwvg/wvgcheck.prg @@ -161,7 +161,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox ::editBuffer := ( Win_Button_GetCheck( ::hWnd ) == BST_CHECKED ) IF hb_isBlock( ::sl_lbClick ) - eval( ::sl_lbClick, NIL, NIL, self ) + eval( ::sl_lbClick, ::editBuffer, NIL, self ) RETURN 0 ENDIF diff --git a/harbour/contrib/gtwvg/wvgdatar.prg b/harbour/contrib/gtwvg/wvgdatar.prg index 36bfbf8875..12e9766bf0 100644 --- a/harbour/contrib/gtwvg/wvgdatar.prg +++ b/harbour/contrib/gtwvg/wvgdatar.prg @@ -117,6 +117,11 @@ METHOD new() CLASS DataRef METHOD getData() CLASS DataRef + DO CASE + CASE ::className == "EDIT" + ::sl_editBuffer := Win_GetMessageText( ::hWnd, WM_GETTEXT, ::bufferLength + 1 ) + ENDCASE + IF hb_isBlock( ::dataLink ) eval( ::dataLink, ::sl_editBuffer ) ENDIF @@ -125,7 +130,9 @@ METHOD getData() CLASS DataRef //----------------------------------------------------------------------// -METHOD setData( xValue ) CLASS DataRef +METHOD setData( xValue, mp2 ) CLASS DataRef + + HB_SYMBOL_UNUSED( mp2 ) IF hb_isBlock( ::dataLink ) ::sl_editBuffer := eval( ::dataLink ) @@ -135,11 +142,28 @@ METHOD setData( xValue ) CLASS DataRef ENDIF - SWITCH ::className - CASE 'BUTTON' + DO CASE + + CASE ::className == 'BUTTON' // CheckBox, Radio, 3State ::sendMessage( BM_SETCHECK, IF( ::sl_editBuffer, BST_CHECKED, BST_UNCHECKED ), 0 ) - EXIT - END + + CASE ::className == 'LISTBOX' // Single Selection + IF !empty( ::sl_editBuffer ) + RETURN Win_LbSetCurSel( ::hWnd, ::sl_editBuffer - 1 ) >= 0 + ENDIF + RETURN .f. + + CASE ::className == "SysTreeView32" + IF ::sl_editBuffer <> NIL .and. ::sl_editBuffer:hItem <> NIL + Win_TreeView_SelectItem( ::hWnd, ::sl_editBuffer:hItem ) + ENDIF + + CASE ::className == "EDIT" + IF hb_isChar( ::sl_editBuffer ) + Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::sl_editBuffer ) + ENDIF + + ENDCASE RETURN ::sl_editBuffer diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index 76deab5503..72e6356efd 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -1131,7 +1131,6 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara } case WM_NOTIFY: { - int iResult; PHB_ITEM pEvParams = hb_itemNew( NULL ); hb_arrayNew( pEvParams, 2 ); diff --git a/harbour/contrib/gtwvg/wvglistb.prg b/harbour/contrib/gtwvg/wvglistb.prg index 84ed784627..c2d5456807 100644 --- a/harbour/contrib/gtwvg/wvglistb.prg +++ b/harbour/contrib/gtwvg/wvglistb.prg @@ -82,7 +82,7 @@ //----------------------------------------------------------------------// -CLASS WvgListBox INHERIT WvgWindow +CLASS WvgListBox INHERIT WvgWindow, DataRef DATA adjustHeight INIT .F. DATA horizScroll INIT .F. @@ -98,12 +98,10 @@ CLASS WvgListBox INHERIT WvgWindow METHOD handleEvent() - METHOD getData() VIRTUAL METHOD getItemHeight() INLINE ::sendMessage( LB_GETITEMHEIGHT, 0, 0 ) METHOD getTopItem() INLINE ::sendMessage( LB_GETTOPINDEX, 0, 0 ) METHOD getVisibleItems() VIRTUAL METHOD numItems() INLINE ::sendMessage( LB_GETCOUNT, 0, 0 ) - METHOD setData() VIRTUAL METHOD setItemsHeight( nPixel ) INLINE ::sendMessage( LB_SETITEMHEIGHT, 0, nPixel ) METHOD setTopItem( nIndex ) INLINE ::sendMessage( LB_SETTOPINDEX, nIndex-1, 0 ) @@ -205,10 +203,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgListBox CASE WM_COMMAND IF aNM[ 1 ] == LBN_SELCHANGE ::nCurSelected := Win_LbGetCurSel( ::hWnd )+ 1 + + IF hb_isBlock( ::sl_itemMarked ) + eval( ::sl_itemMarked, NIL, NIL, self ) + ENDIF + + ELSEIF aNM[ 1 ] == LBN_DBLCLK + ::editBuffer := ::nCurSelected + IF hb_isBlock( ::sl_itemSelected ) eval( ::sl_itemSelected, NIL, NIL, self ) ENDIF ENDIF + EXIT CASE WM_SIZE diff --git a/harbour/contrib/gtwvg/wvgmle.prg b/harbour/contrib/gtwvg/wvgmle.prg new file mode 100644 index 0000000000..ebc4922e81 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgmle.prg @@ -0,0 +1,249 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpMLE compatible Class +// +// Pritpal Bedi +// 07Dec2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => +#endif + +//----------------------------------------------------------------------// + +CLASS WvgMLE INHERIT WvgWindow, DataRef + + DATA border INIT .T. + DATA editable INIT .T. + DATA horizScroll INIT .T. + DATA vertScroll INIT .T. + DATA wordWrap INIT .T. + DATA ignoreTab INIT .F. + + DATA bufferLength INIT 32000 + DATA changed INIT .F. + + METHOD new() + METHOD create() + METHOD configure() VIRTUAL + METHOD destroy() + METHOD handleEvent() + + METHOD clear() VIRTUAL + METHOD copyMarked() VIRTUAL + METHOD cutMarked() VIRTUAL + METHOD deleteMarked() VIRTUAL + METHOD delete() VIRTUAL + METHOD pasteMarked() VIRTUAL + METHOD queryFirstChar() VIRTUAL + METHOD queryMarked() VIRTUAL + METHOD setFirstChar() VIRTUAL + METHOD setMarked() VIRTUAL + METHOD insert() VIRTUAL + METHOD charFromLine() VIRTUAL + METHOD lineFromChar() VIRTUAL + METHOD pos() VIRTUAL + + DATA sl_undo INIT .T. + ACCESS undo INLINE IF( ::sl_undo, NIL, NIL ) + ASSIGN undo( lUndo ) INLINE ::sl_undo := lUndo + + METHOD setEditable() VIRTUAL + METHOD setWrap() 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 + + ENDCLASS + +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgMLE + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + ES_MULTILINE + ES_WANTRETURN + ::exStyle := WS_EX_CLIENTEDGE + ::className := 'EDIT' + ::objType := objTypeMLE + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgMLE + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + IF ::tabStop + ::style += WS_TABSTOP + ENDIF + IF !::editable + ::style += ES_READONLY + ENDIF + IF ::border + ::style += WS_BORDER + ENDIF + IF !( ::wordWrap ) + IF ::horizScroll + ::style += WS_HSCROLL + ELSE + ::style += ES_AUTOHSCROLL + ENDIF + ENDIF + IF ::vertScroll + ::style += WS_VSCROLL + ELSE + ::style += ES_AUTOVSCROLL + ENDIF + + ::oParent:addChild( Self ) + + ::createControl() + + ::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + + IF ::visible + ::show() + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( nMessage, aNM ) CLASS WvgMLE + + hb_ToOutDebug( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) + + IF nMessage == WM_COMMAND + DO CASE + CASE aNM[ NMH_code ] == EN_CHANGE + ::changed := .t. + + CASE aNM[ NMH_code ] == EN_UPDATE + + CASE aNM[ NMH_code ] == EN_MAXTEXT + + CASE aNM[ NMH_code ] == EN_KILLFOCUS + IF hb_isBlock( ::sl_killInputFocus ) + eval( ::sl_killInputFocus, NIL, NIL, Self ) + ENDIF + + CASE aNM[ NMH_code ] == EN_SETFOCUS + IF hb_isBlock( ::sl_setInputFocus ) + eval( ::sl_setInputFocus, NIL, NIL, Self ) + ENDIF + + CASE aNM[ NMH_code ] == EN_HSCROLL + IF hb_isBlock( ::sl_hScroll ) + eval( ::sl_hScroll, NIL, NIL, Self ) + ENDIF + + CASE aNM[ NMH_code ] == EN_VSCROLL + IF hb_isBlock( ::sl_vScroll ) + eval( ::sl_vScroll, NIL, NIL, Self ) + ENDIF + + ENDCASE + ENDIF + + RETURN 1 + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgMLE + + hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) ) + + IF len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ENDIF + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + HB_FreeCallback( ::nWndProc ) + + RETURN NIL + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgparts.ch b/harbour/contrib/gtwvg/wvgparts.ch index e7060b0670..ad4a9fe59a 100644 --- a/harbour/contrib/gtwvg/wvgparts.ch +++ b/harbour/contrib/gtwvg/wvgparts.ch @@ -76,6 +76,9 @@ #define objTypeTreeViewItem 14 #define objTypeCheckBox 15 #define objTypeRadioButton 16 +#define objType3State 17 +#define objTypeSLE 18 +#define objTypeMLE 19 //----------------------------------------------------------------------// // NMHDR info @@ -172,6 +175,12 @@ #define WVG_PP_COMPOUNDNAME 15 #define WVG_PP_FONT 16 +#define WVGSLE_LEFT 1 +#define WVGSLE_RIGHT 2 +#define WVGSLE_CENTER 3 + + + #endif // #ifndef _WVG_CH //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgphdlr.prg b/harbour/contrib/gtwvg/wvgphdlr.prg index 19691a347d..4fa627a410 100644 --- a/harbour/contrib/gtwvg/wvgphdlr.prg +++ b/harbour/contrib/gtwvg/wvgphdlr.prg @@ -326,14 +326,14 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler ENDIF CASE nEvent == HB_GTE_SETFOCUS - IF hb_isBlock( ::setInputFocus ) - eval( ::setInputFocus, NIL, NIL, Self ) + IF hb_isBlock( ::sl_setInputFocus ) + eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF ::lHasInputFocus := .t. CASE nEvent == HB_GTE_KILLFOCUS - IF hb_isBlock( ::killInputFocus ) - eval( ::killInputFocus, NIL, NIL, Self ) + IF hb_isBlock( ::sl_killInputFocus ) + eval( ::sl_killInputFocus, NIL, NIL, Self ) ENDIF ::lHasInputFocus := .f. diff --git a/harbour/contrib/gtwvg/wvgradio.prg b/harbour/contrib/gtwvg/wvgradio.prg index 45c6406a39..782c69e475 100644 --- a/harbour/contrib/gtwvg/wvgradio.prg +++ b/harbour/contrib/gtwvg/wvgradio.prg @@ -82,7 +82,7 @@ //----------------------------------------------------------------------// -CLASS WvgRadioButton INHERIT WvgWindow +CLASS WvgRadioButton INHERIT WvgWindow, DataRef DATA autosize INIT .F. DATA caption INIT '' @@ -94,9 +94,6 @@ CLASS WvgRadioButton INHERIT WvgWindow METHOD configure() METHOD destroy() - METHOD editBuffer() INLINE ( Win_Button_GetCheck( ::hWnd ) == BST_CHECKED ) - METHOD getData() INLINE ( Win_Button_GetCheck( ::hWnd ) == BST_CHECKED ) - METHOD setData( lCheck ) INLINE ::sendMessage( BM_SETCHECK, IF( lCheck, BST_CHECKED, BST_UNCHECKED ), 0 ) METHOD setCaption( cCaption ) ACCESS selected INLINE ::sl_lbClick @@ -156,8 +153,10 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgRadioButton CASE WM_COMMAND IF aNM[ NMH_code ] == BN_CLICKED + ::editBuffer := ( Win_Button_GetCheck( ::hWnd ) == BST_CHECKED ) + IF hb_isBlock( ::sl_lbClick ) - eval( ::sl_lbClick, NIL, NIL, self ) + eval( ::sl_lbClick, ::editBuffer, NIL, self ) RETURN 0 ENDIF ENDIF diff --git a/harbour/contrib/gtwvg/wvgsle.prg b/harbour/contrib/gtwvg/wvgsle.prg new file mode 100644 index 0000000000..b413a2b5cb --- /dev/null +++ b/harbour/contrib/gtwvg/wvgsle.prg @@ -0,0 +1,235 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpSLE compatible Class +// +// Pritpal Bedi +// 07Dec2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => +#endif + +//----------------------------------------------------------------------// + +CLASS WvgSLE INHERIT WvgWindow, DataRef + + DATA align INIT WVGSLE_LEFT + DATA autoKeyboard INIT .T. + DATA autoSize INIT .F. + DATA autoTab INIT .F. + DATA border INIT .T. + DATA bufferLength INIT 32 + DATA editable INIT .T. + DATA unReadable INIT .F. + + DATA changed INIT .F. + + METHOD new() + METHOD create() + METHOD configure() VIRTUAL + METHOD destroy() + METHOD handleEvent() + + METHOD clear() VIRTUAL + METHOD copyMarked() VIRTUAL + METHOD cutMarked() VIRTUAL + METHOD delMarked() VIRTUAL + METHOD editBuffer() VIRTUAL + METHOD pasteMarked() VIRTUAL + METHOD queryFirstChar() VIRTUAL + METHOD queryMarked() VIRTUAL + METHOD setFirstChar() VIRTUAL + METHOD setMarked() VIRTUAL + + METHOD setInsertMode( lInsertMode ) VIRTUAL + + DATA sl_hScroll + ACCESS hScroll INLINE ::sl_hScroll + ASSIGN hScroll( bBlock ) INLINE ::sl_hScroll := bBlock + + DATA sl_typeOut + ACCESS typeOut INLINE ::sl_typeOut + ASSIGN typeOut( bBlock ) INLINE ::sl_typeOut := bBlock + + ENDCLASS + +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + ::className := 'EDIT' + ::objType := objTypeSLE + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE + LOCAL es_:= { ES_LEFT, ES_RIGHT, ES_CENTER } + LOCAL xVar + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style += es_[ ::align ] + ::style += ES_AUTOHSCROLL + + IF ::visible + ::style += WS_VISIBLE + ENDIF + IF ::tabStop + ::style += WS_TABSTOP + ENDIF + IF ::autoSize + + ENDIF + IF !::editable + ::style += ES_READONLY + ENDIF + IF ::unReadable + ::style += ES_PASSWORD + ENDIF + IF ::border + ::style += WS_BORDER + ENDIF + + ::oParent:addChild( Self ) + + ::createControl() + + ::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + + IF ::visible + ::show() + ENDIF + + IF hb_isObject( ::datalink ) + xVar := eval( ::datalink ) + ENDIF + + ::sendMessage( EM_SETLIMITTEXT, ::bufferLength ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE + + hb_ToOutDebug( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) + + IF nMessage == WM_COMMAND + DO CASE + CASE aNM[ NMH_code ] == EN_CHANGE + ::changed := .t. + + CASE aNM[ NMH_code ] == EN_UPDATE + + CASE aNM[ NMH_code ] == EN_MAXTEXT + + CASE aNM[ NMH_code ] == EN_KILLFOCUS + IF hb_isBlock( ::sl_killInputFocus ) + eval( ::sl_killInputFocus, NIL, NIL, Self ) + ENDIF + + CASE aNM[ NMH_code ] == EN_SETFOCUS + IF hb_isBlock( ::sl_setInputFocus ) + eval( ::sl_setInputFocus, NIL, NIL, Self ) + ENDIF + + ENDCASE + ENDIF + + RETURN 1 + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgSLE + + hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) ) + + IF len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ENDIF + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + HB_FreeCallback( ::nWndProc ) + + RETURN NIL + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgstatc.prg b/harbour/contrib/gtwvg/wvgstatc.prg index b4ccbbd9bb..934ac00db1 100644 --- a/harbour/contrib/gtwvg/wvgstatc.prg +++ b/harbour/contrib/gtwvg/wvgstatc.prg @@ -77,7 +77,7 @@ //----------------------------------------------------------------------// #ifndef __DBG_PARTS__ -//#xtranslate hb_ToOutDebug( [] ) => +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -88,8 +88,8 @@ CLASS WvgStatic INHERIT WvgWindow DATA caption INIT '' DATA clipParent INIT .T. DATA clipSiblings INIT .F. - DATA options INIT WVGSTATIC_TEXT_LEFT - DATA type INIT WVGSTATIC_TYPE_TEXT + DATA options INIT -1//WVGSTATIC_TEXT_LEFT + DATA type INIT -1//WVGSTATIC_TYPE_TEXT METHOD new() @@ -110,7 +110,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStati ::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - // + SS_NOTIFY + SS_ETCHEDFRAME //SS_SUNKEN //+ SS_WHITERECT + // SS_NOTIFY SS_ETCHEDFRAME SS_SUNKEN SS_WHITERECT // ::style := WS_CHILD + WS_CLIPCHILDREN ::exStyle := WS_EX_NOPARENTNOTIFY @@ -197,6 +197,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt EXIT CASE WVGSTATIC_TYPE_RAISEDBOX + ::style += SS_ETCHEDFRAME EXIT CASE WVGSTATIC_TYPE_RECESSEDBOX EXIT @@ -212,6 +213,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt EXIT END // ::type + #if 1 // Options IF ( ascan( { WVGSTATIC_TYPE_FGNDFRAME, WVGSTATIC_TYPE_BGNDFRAME, WVGSTATIC_TYPE_HALFTONEFRAME }, ::type ) > 0 ) IF ( hb_bitAnd( ::options, WVGSTATIC_FRAMETHIN ) == WVGSTATIC_FRAMETHIN ) @@ -222,7 +224,16 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt ENDIF ENDIF - + #endif + #if 0 + IF ::type == WVGSTATIC_TYPE_TEXT + IF ::options == WVGSTATIC_FRAMETHIN + ::style += WS_BORDER + ELSEIF ::options == WVGSTATIC_FRAMETHICK + ::style += WS_DLGFRAME + ENDIF + ENDIF + #endif //------------------- API request to create control ----------------// ::oParent:addChild( SELF ) diff --git a/harbour/contrib/gtwvg/wvgtreev.prg b/harbour/contrib/gtwvg/wvgtreev.prg index 91b43a20b7..9e276b4005 100644 --- a/harbour/contrib/gtwvg/wvgtreev.prg +++ b/harbour/contrib/gtwvg/wvgtreev.prg @@ -188,6 +188,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView LOCAL hItemSelected, hParentOfSelected, n, aNMHdr LOCAL cParent := space( 20 ) LOCAL cText := space( 20 ) + LOCAL aHdr hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) @@ -205,12 +206,20 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView EXIT CASE WM_NOTIFY + aHdr := Wvg_GetNMHdrInfo( aNM[ 2 ] ) aNMHdr := Wvg_GetNMTreeViewInfo( aNM[ 2 ] ) DO CASE - CASE aNMHdr[ NMH_code ] == TVN_SELCHANGED + CASE aHdr[ NMH_code ] == NM_DBLCLK .OR. aHdr[ NMH_code ] == NM_RETURN + ::editBuffer := ::oItemSelected + IF hb_isBlock( ::sl_itemSelected ) + Eval( ::sl_itemSelected, ::oItemSelected, { 0,0,0,0 }, Self ) + ENDIF + RETURN .t. + + CASE aNMHdr[ NMH_code ] == TVN_SELCHANGED Wvg_TreeView_GetSelectionInfo( ::hWnd, aNM[ 2 ], @cParent, @cText, @hParentOfSelected, @hItemSelected ) ::hParentSelected := hParentOfSelected @@ -224,8 +233,8 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView ::oItemSelected := NIL ENDIF - IF hb_isBlock( ::sl_itemSelected ) - Eval( ::sl_itemSelected, ::oItemSelected, { 0,0,0,0 }, Self ) + IF hb_isBlock( ::sl_itemMarked ) + Eval( ::sl_itemMarked, ::oItemSelected, { 0,0,0,0 }, Self ) ENDIF RETURN .t. diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 2a5b8815cb..8120331f03 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -441,7 +441,7 @@ HB_FUNC( WIN_DRAWIMAGE ) HB_FUNC( WIN_GETDC ) { - hb_retnint( ( HB_PTRDIFF ) GetDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); + hb_retnint( ( HB_PTRDIFF ) GetDC( ISNIL( 1 ) ? NULL : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); } //-------------------------------------------------------------------// @@ -1390,6 +1390,21 @@ HB_FUNC( WIN_SENDMESSAGETEXT ) //----------------------------------------------------------------------// +HB_FUNC( WIN_GETMESSAGETEXT ) +{ + TCHAR cText[ 32000 ]; + + SendMessage( wvg_parhwnd( 1 ), ( UINT ) hb_parni( 2 ), wvg_parwparam( 3 ), ( LPARAM ) &cText ); + + { + char * szText = HB_TCHAR_CONVFROM( cText ); + hb_retc( szText ); + HB_TCHAR_FREE( szText ); + } +} + +//-------------------------------------------------------------------// + HB_FUNC( WIN_SETWNDPROC ) { HWND hWnd = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ); @@ -1433,7 +1448,7 @@ HB_FUNC( WVG_GETNMHDRINFO ) hb_arrayNew( pEvParams, 3 ); - hb_arraySetNInt( pEvParams, 1, lpnmh->code ); + hb_arraySetNI( pEvParams, 1, lpnmh->code ); hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) lpnmh->idFrom ); hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) lpnmh->hwndFrom ); @@ -1476,28 +1491,6 @@ HB_FUNC( WVG_GETNMTREEVIEWINFO ) hb_itemReturnRelease( pEvParams ); } -//----------------------------------------------------------------------// -// Wvg_GetNotifyInfo( wParam, lParam ) -// -HB_FUNC( WVG_GETNOTIFYINFO ) -{ - PHB_ITEM pEvParams = hb_itemNew( NULL ); - LPNMMOUSE nmm = ( LPNMMOUSE ) wvg_parlparam( 2 ); - NMHDR nmh = nmm->hdr; - - hb_arrayNew( pEvParams, 7 ); - - hb_arraySetNI( pEvParams, 1, ( int ) wvg_parwparam( 1 ) ); - hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) nmh.hwndFrom ); - hb_arraySetNI( pEvParams, 3, nmh.idFrom ); - hb_arraySetNI( pEvParams, 4, nmh.code ); - hb_arraySetNL( pEvParams, 5, nmm->dwItemSpec ); - hb_arraySetNInt( pEvParams, 6, ( HB_PTRDIFF ) wvg_parwparam( 1 ) ); - hb_arraySetNInt( pEvParams, 7, ( HB_PTRDIFF ) wvg_parlparam( 2 ) ); - - hb_itemReturnRelease( pEvParams ); -} - //----------------------------------------------------------------------// // TreeView Functions //----------------------------------------------------------------------// @@ -1521,6 +1514,13 @@ HB_FUNC( WIN_TREEVIEW_SETLINECOLOR ) //hb_retl( TreeView_SetLineColor( wvg_parhwnd( 1 ), wvg_parcolor( 2 ) ) ); } +//----------------------------------------------------------------------// + +HB_FUNC( WIN_TREEVIEW_SELECTITEM ) +{ + hb_retl( TreeView_SelectItem( wvg_parhwnd( 1 ), wvg_parhandle( 2 ) ) ); +} + //----------------------------------------------------------------------// // Wvg_TreeView_GetSelectionInfo( ::hWnd, nlParam, @cParent, @cText, @hParentOfSelected, @hItemSelected ) // @@ -1683,7 +1683,7 @@ HB_FUNC( WIN_LBGETTEXT ) TCHAR text[ MAX_PATH + 1 ]; char * szText; - SendMessage( wvg_parhwnd( 1 ), LB_GETTEXT, ( WPARAM ) hb_parni( 2 ), ( LPARAM ) text ); + SendMessage( wvg_parhwnd( 1 ), LB_GETTEXT, wvg_parwparam( 2 ), ( LPARAM ) text ); szText = HB_TCHAR_CONVFROM( text ); hb_retc( szText ); @@ -1697,6 +1697,13 @@ HB_FUNC( WIN_LBGETCURSEL ) hb_retni( ListBox_GetCurSel( wvg_parhwnd( 1 ) ) ); } +//----------------------------------------------------------------------// + +HB_FUNC( WIN_LBSETCURSEL ) +{ + hb_retni( ListBox_SetCurSel( wvg_parhwnd( 1 ), hb_parni( 2 ) ) ); +} + //----------------------------------------------------------------------// // Buttons //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg index f9d7021813..8e6a1383aa 100644 --- a/harbour/contrib/gtwvg/wvgwnd.prg +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -77,7 +77,7 @@ //----------------------------------------------------------------------// #ifndef __DBG_PARTS__ -//#xtranslate hb_ToOutDebug( [] ) => +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -1219,4 +1219,8 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow RETURN Win_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam ) //----------------------------------------------------------------------// - +#if 0 +FUNCTION hb_toOut( ... ) + RETURN hb_ToOutDebug( ... ) +#endif +//----------------------------------------------------------------------//