From 11130f186b59ba9f208196c236d419d690d4e742 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 7 Dec 2008 03:28:16 +0000 Subject: [PATCH] 2008-12-06 19:08 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/makefile * harbour/contrib/gtwvg/common.mak + wvgcheck.prg + wvgdatar.prg + wvgradio.prg + harbour/contrib/gtwvg/wvgcheck.prg + harbour/contrib/gtwvg/wvgdatar.prg + harbour/contrib/gtwvg/wvgradio.prg + Added WvgCheckBox(), WvgRadioButton(), DataRef() Xbase++ compatible classes. * harbour/contrib/gtwvg/wvggui.c * harbour/contrib/gtwvg/wvgwin.c * harbour/contrib/gtwvg/wvgparts.ch * harbour/contrib/gtwvg/wvglistb.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/wvghwnd.prg ; Heavy changes in class framework. + Many new winapi functions. ! Optimized use of hb_ACallBack(). - WinApi functions replaced by Harbour core functions. * harbour/contrib/gtwvg/tests/demowvg.prg + Added functionality of WvgCheckBox() and WvgRadioButton() classes. Now thses classes implement DataRef() class also. Work-in-progress. ;TODO : Few functions in wvgwin.c are not UNICODE compliant yet. DONE All functions are now UNICODE compliant. ;Viktor, can you compile GTWVG on 64bits platform ? ;REQUEST : Can someone familiar with Xbase++ come forward to write a small test program based on implemented classes. Please exclude all that functionality which is not yet implemented. --- harbour/ChangeLog | 41 +++++ harbour/contrib/gtwvg/Makefile | 3 + harbour/contrib/gtwvg/common.mak | 3 + harbour/contrib/gtwvg/tests/demowvg.prg | 195 ++++++++++++++-------- harbour/contrib/gtwvg/wvgcheck.prg | 211 ++++++++++++++++++++++++ harbour/contrib/gtwvg/wvgdatar.prg | 165 ++++++++++++++++++ harbour/contrib/gtwvg/wvggui.c | 113 ++++--------- harbour/contrib/gtwvg/wvglistb.prg | 19 ++- harbour/contrib/gtwvg/wvgparts.ch | 8 + harbour/contrib/gtwvg/wvgpushb.prg | 25 ++- harbour/contrib/gtwvg/wvgradio.prg | 206 +++++++++++++++++++++++ harbour/contrib/gtwvg/wvgstatb.prg | 18 +- harbour/contrib/gtwvg/wvgstatc.prg | 87 ++++++---- harbour/contrib/gtwvg/wvgtoolb.prg | 18 +- harbour/contrib/gtwvg/wvgtreev.prg | 75 +++------ harbour/contrib/gtwvg/wvgwin.c | 155 ++++++++++++++--- harbour/contrib/gtwvg/wvgwnd.prg | 141 +++++++++------- 17 files changed, 1133 insertions(+), 350 deletions(-) create mode 100644 harbour/contrib/gtwvg/wvgcheck.prg create mode 100644 harbour/contrib/gtwvg/wvgdatar.prg create mode 100644 harbour/contrib/gtwvg/wvgradio.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index abee790cb1..4b1fe718e4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,47 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-12-06 19:08 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/makefile + * harbour/contrib/gtwvg/common.mak + + wvgcheck.prg + + wvgdatar.prg + + wvgradio.prg + + + harbour/contrib/gtwvg/wvgcheck.prg + + harbour/contrib/gtwvg/wvgdatar.prg + + harbour/contrib/gtwvg/wvgradio.prg + + Added WvgCheckBox(), WvgRadioButton(), DataRef() Xbase++ compatible classes. + + * harbour/contrib/gtwvg/wvggui.c + * harbour/contrib/gtwvg/wvgwin.c + * harbour/contrib/gtwvg/wvgparts.ch + * harbour/contrib/gtwvg/wvglistb.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/wvghwnd.prg + ; Heavy changes in class framework. + + Many new winapi functions. + ! Optimized use of hb_ACallBack(). + - WinApi functions replaced by Harbour core functions. + + * harbour/contrib/gtwvg/tests/demowvg.prg + + Added functionality of WvgCheckBox() and WvgRadioButton() classes. + Now thses classes implement DataRef() class also. Work-in-progress. + + ;TODO : Few functions in wvgwin.c are not UNICODE compliant yet. + DONE All functions are now UNICODE compliant. + + ;Viktor, can you compile GTWVG on 64bits platform ? + + ;REQUEST : Can someone familiar with Xbase++ come forward to + write a small test program based on implemented classes. + Please exclude all that functionality which is not yet + implemented. + 2008-12-04 23:56 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/tests/hbmk_b32.bat + xhb.lib - just to take use of hb_ToOutDebug(). While under heavy diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index 943a617ef9..3dc9653464 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -34,6 +34,9 @@ PRG_SOURCES=\ wvgstatc.prg \ wvgtreev.prg \ wincback.prg \ + wvgcheck.prg \ + wvgdatar.prg \ + wvgradio.prg \ PRG_HEADERS=\ diff --git a/harbour/contrib/gtwvg/common.mak b/harbour/contrib/gtwvg/common.mak index 9cb498e812..4829a3824f 100644 --- a/harbour/contrib/gtwvg/common.mak +++ b/harbour/contrib/gtwvg/common.mak @@ -28,6 +28,9 @@ LIB_OBJS = \ $(OBJ_DIR)wvgstatc$(OBJEXT) \ $(OBJ_DIR)wvgtreev$(OBJEXT) \ $(OBJ_DIR)wincback$(OBJEXT) \ + $(OBJ_DIR)wvgcheck$(OBJEXT) \ + $(OBJ_DIR)wvgdatar$(OBJEXT) \ + $(OBJ_DIR)wvgradio$(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 f0dcb7b8e9..58d9f79410 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -1377,9 +1377,9 @@ FUNCTION CreateMainMenu() oMenu:AddItem( "Dialog One . New Window . Threaded", {|| MyDialogOne( 1 ) } ) oMenu:AddItem( "Dialog One . Main Window . Primary Thread", {|| MyDialogOne( 2 ) } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Dialog Two", {|| MyDialogTwo() } ) + oMenu:AddItem( "Dialog Two" , {|| MyDialogTwo() } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Exit" , {|| __keyboard( K_ESC ) } ) + oMenu:AddItem( "Exit" , {|| __keyboard( K_ESC ) } ) g_oMenuBar:addItem( "",oMenu ) oMenu := wvtMenu():new():create() @@ -1399,39 +1399,39 @@ FUNCTION CreateMainMenu() oMenu := wvtMenu():new():create() oMenu:Caption:= "Common Dialogs" - oMenu:AddItem( "Fonts" ,{|| Wvt_ChooseFont() } ) + oMenu:AddItem( "Fonts" , {|| Wvt_ChooseFont() } ) oMenu:AddItem( "-") - oMenu:AddItem( "Colors",{|| Wvt_ChooseColor() } ) + oMenu:AddItem( "Colors" , {|| Wvt_ChooseColor() } ) g_oMenuBar:addItem( "",oMenu) oMenu := wvtMenu():new():create() oMenu:Caption:= "Functionality" - oMenu:AddItem( "Expand" ,{|| WvtWindowExpand( 1 ) } ) - oMenu:AddItem( "Shrink" ,{|| WvtWindowExpand( -1 ) } ) + oMenu:AddItem( "Expand" , {|| WvtWindowExpand( 1 ) } ) + oMenu:AddItem( "Shrink" , {|| WvtWindowExpand( -1 ) } ) oMenu:AddItem( "-") - oMenu:AddItem( "Minimize",{|| Wvt_Minimize() } ) - oMenu:AddItem( "Maximize",{|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) } ) + oMenu:AddItem( "Minimize" , {|| Wvt_Minimize() } ) + oMenu:AddItem( "Maximize" , {|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) } ) g_oMenuBar:addItem( "",oMenu) oMenu := wvtMenu():new():create() oMenu:Caption:= "Modeless Dialogs" - oMenu:AddItem( "Dynamic Dialog . Modeless" ,{|| DynDialog_2( 1 ) } ) - oMenu:AddItem( "Dynamic Dialog . Modal " ,{|| DynDialog_2( 2 ) } ) + oMenu:AddItem( "Dynamic Dialog . Modeless" , {|| DynDialog_2( 1 ) } ) + oMenu:AddItem( "Dynamic Dialog . Modal " , {|| DynDialog_2( 2 ) } ) oMenu:AddItem( "-") - oMenu:AddItem( "Slide Show . Modeless" ,{|| DlgSlideShow() } ) + oMenu:AddItem( "Slide Show . Modeless" , {|| DlgSlideShow() } ) g_oMenuBar:addItem( "",oMenu) oMenu := wvtMenu():new():create() - oMenu:Caption:= "Active-X Controls" - oMenu:AddItem( "ActiveX - Analog Clock" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 2 ) } ) } ) + oMenu:Caption:= "~XbpDialog()s" + oMenu:AddItem( "ActiveX - Internet Explorer" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 1 ) } ) } ) oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Internet Explorer", {|| Hb_ThreadStart( {|| ExecuteActiveX( 1 ) } ) } ) + oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 3 ) } ) } ) oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 3 ) } ) } ) + oMenu:AddItem( "ActiveX - Explorer . DHTML" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 11 ) } ) } ) oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Explorer . DHTML" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 11 ) } ) } ) + oMenu:AddItem( "ActiveX - RMChart" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 4 ) } ) } ) oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - RMChart" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 4 ) } ) } ) + oMenu:AddItem( "ActiveX - Analog Clock" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 2 ) } ) } ) g_oMenuBar:addItem( "",oMenu) RETURN g_oMenuBar @@ -2341,19 +2341,16 @@ 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, oListBox - LOCAL bComSize := {|m1,m2,o,w,x,y| m1 := m1, m2 := m2, o := o, ; - w := oCrt:currentSize() ,; - x := oTBar:currentSize() ,; - y := oSBar:currentSize() ,; - oCom:setPosAndSize( { 0, x[2] }, { w[1], w[2]-x[2]-y[2] }, .t. ), 1 } + Local oCrt, oTBar, oSBar, oPanel, oStatic, oCom, oXbp, oTree, oItem1, oItem2 + LOCAL oListBox, oCheck, oRadio, oStatic2 + LOCAL aParts :={} HB_SYMBOL_UNUSED( xParam ) HB_SYMBOL_UNUSED( oCom ) + //--------------------------- Dialog -------------------------------\\ #if 1 oCrt := WvgDialog():new( , , { 30,30 }, { 800,600 }, , .f. ) - //oCrt:resizable := .f. oCrt:closable := .t. oCrt:create() #else @@ -2364,13 +2361,13 @@ Function ExecuteActiveX( nActiveX, xParam ) SetCursor( .f. ) #endif - // Menu - ActiveXBuildMenu( oCrt ) + //--------------------------- Menu --------------------------------\\ + ActiveXBuildMenu( oCrt, @oStatic, @oStatic2 ) - // Toolbar - oTBar := ActiveXBuildToolBar( oCrt, nActiveX ) + //--------------------------- ToolBar -----------------------------\\ + oTBar := ActiveXBuildToolBar( oCrt, nActiveX ) - // Statusbar + //--------------------------- StatusBar ---------------------------\\ oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .t. ) oSBar:panelClick := {|oPanel| Win_MessageBox( , oPanel:caption ) } oPanel := oSBar:getItem( 1 ) @@ -2380,45 +2377,67 @@ Function ExecuteActiveX( nActiveX, xParam ) oPanel := oSBar:addItem() oPanel:caption := 'Click on any part!' - // Static text + //--------------------------- Static ------------------------------\\ oStatic := WvgStatic():new( oCrt ) - - oStatic:caption := chr(13)+'This is a Harbour dialog and is compatible with Xbase++ Parts. '+CRLF+; - 'XbpDialog() XbpMenuBar() XbpToolBar() XbpStatusBar() ' +; - 'XbpStatic() XbpTreeView() XbpActiveX() XbpListBox() '+CRLF+; - 'classes have been implemented' - 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. ) - oStatic:resize := {|mp1,mp2,oSelf,w,x,y| mp1 := mp1, mp2 := mp2, oSelf := oSelf, ; - w := oCrt:currentSize() ,; - x := oTBar:currentSize() ,; - y := oSBar:currentSize() ,; - oStatic:setPosAndSize( { 0, x[2]+3 }, { 120, w[2]-x[2]-y[2]-4 }, .t. ) } + //--------------------------- Static + Radio----------------------\\ + oStatic2 := WvgStatic():New( oCrt, , { 200,200 }, { 300, 200 }, , .f. ) + oStatic2:options := WVGSTATIC_FRAMETHICK + oStatic2:create() + oStatic2:setColorBG( RGB( 198,198,198 ) ) + oXbp := WvgPushButton():new( oStatic2 ) + oXbp:caption := "Hide" + oXbp:create( , , { 230,160 }, {60, 30} ) + oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - HB_SYMBOL_UNUSED( oListBox ) + oRadio := WvgRadioButton():new( oStatic2,, { 10,10 }, { 100,15 } ) + oRadio:caption := "Com 1" + 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() - // ListBox + //--------------------------- CheckBox ---------------------------\\ + oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100,15 }, , .t. ) + oCheck:caption := 'First Checkbox' + oCheck:create() + oCheck:selected := {|m1,m2,o| m1:=m1,m2:=m2, Win_MessageBox( , IF( o:getData(), 'I am selected','I am not selected' ) ) } + + //--------------------------- ListBox -----------------------------\\ oListBox := WvgListbox():new() - oListBox:create( oStatic, , { 5, 280 }, { 107, 100 } ) - aeval( { 'Apple','Bat','Cat','Data','Elephant','Thanks','Links','Phantom' }, {|e| oListBox:addItem( e ) } ) - oListBox:itemSelected := {|| Win_MessageBox( , oListBox:getItem( 2 ) ) } + oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) - // Pushbuttons - oXbp := WvgPushButton():new( oStatic ) - oXbp:caption := "A" - oXbp:create( , , { 20,400 }, {80,30} ) - oXbp:activate:= {|| Win_MessageBox( , "Pushbutton A" ) } - // Pushbuttons + oListBox:setColorFG( RGB( 218,61,34 ) ) + + aadd( aParts, 'XbpDialog' ) + aadd( aParts, 'XbpMenuBar' ) + aadd( aParts, 'XbpToolBar' ) + aadd( aParts, 'XbpStatusBar' ) + aadd( aParts, 'XbpStatic' ) + aadd( aParts, 'XbpTreeView' ) + aadd( aParts, 'XbpActiveX' ) + aadd( aParts, 'XbpListBox' ) + aadd( aParts, 'XbpPushButton' ) + aadd( aParts, 'XbpCheckBox' ) + aadd( aParts, 'XbpRadioButton') + aadd( aParts, 'DataRef' ) + + aeval( aParts, {|e| oListBox:addItem( e ) } ) + oListBox:itemSelected := {|| Win_MessageBox( , oListBox:getCurItem() ) } + + //--------------------------- PushButton --------------------------\\ oXbp := WvgPushButton():new( oStatic ) oXbp:caption := "Hide" oXbp:create( , , { 20,440 }, {80,30} ) - oXbp:activate:= {|| oCom:resize := bComSize, oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } + oXbp:activate:= {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - // Treeview + //--------------------------- TreeView ---------------------------\\ oTree := WvgTreeView():new( oCrt, , { oCrt:currentSize()[1]-160,oTBar:currentSize()[2]+3 }, ; { 160, oCrt:currentSize()[2]-; oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .t. ) @@ -2441,22 +2460,28 @@ Function ExecuteActiveX( nActiveX, xParam ) oItem2:addItem( "Third level B" ) oItem2:addItem( "Third level C" ) + #if 0 + oItem1:expand( .t. ) + #else + oTree:showExpanded( .t., 2 ) + #endif + + //--------------------------- 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!" ) } + oCrt:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) } + #if 1 - // ActiveX Controls + //--------------------------- Active-X ---------------------------\\ oCom := BuildActiveXControl( nActiveX, oCrt ) - oCom:resize := {|m1,m2,o,w,x,y,z| m1 := m1, m2 := m2, o := o, ; - w := oCrt:currentSize() ,; - x := oTBar:currentSize() ,; - y := oSBar:currentSize() ,; - z := oStatic:currentSize(),; - oCom:setPosAndSize( { z[1], x[2] }, { w[1]-z[1]-160, w[2]-x[2]-y[2] }, .t. ), 1 } if hb_isObject( oCom ) oCrt:sendMessage( WM_SIZE, 0, 0 ) oCrt:show() ExeActiveX( nActiveX, oCom, xParam ) ENDIF #else - oCrt:sendMessage( WM_SIZE, 0, 0 ) oCrt:show() DO WHILE .t. IF inkey() == 27 @@ -2468,7 +2493,32 @@ Function ExecuteActiveX( nActiveX, xParam ) oCrt:Destroy() Return nil //----------------------------------------------------------------------// -Static Function ActiveXBuildMenu( oCrt ) +STATIC FUNCTION ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) + LOCAL aCrt, aTBar, aSBar, aStatic, aCom, aTree + LOCAL nH, nT + + aCrt := oCrt:currentSize() + aTBar := oTBar:currentSize() + aSBar := oSBar:currentSize() + aStatic := oStatic:currentSize() + aTree := oTree:currentSize() + aCom := oCom:currentSize() + + nT := aTBar[2] + nH := aCrt[2]-aTBar[2]-aSBar[2] + + IF oStatic:isVisible + oStatic:setPosAndSize( { 0, nT+3 }, { 120, nH-4 }, .t. ) + oCom:setPosAndSize( { 120, nT }, { aCrt[1]-120-150, nH }, .t. ) + oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .t. ) + ELSE + oCom:setPosAndSize( { 0, nT }, { aCrt[1]-150, nH }, .t. ) + oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .t. ) + ENDIF + + RETURN 1 +//----------------------------------------------------------------------// +Static Function ActiveXBuildMenu( oCrt, oStatic, oStatic2 ) Local oMenuBar, oSubMenu oMenuBar := WvgMenuBar():new( oCrt ):create() @@ -2484,7 +2534,6 @@ Static Function ActiveXBuildMenu( oCrt ) oSubMenu:itemSelected := {|mp1| MyFunction( 100+mp1 ) } oMenuBar:addItem( { oSubMenu, NIL } ) - // Define submenu in the functional style: // A menu item executes a code block that // calls a function @@ -2492,9 +2541,17 @@ Static Function ActiveXBuildMenu( oCrt ) oSubMenu:title := "~Functional" oSubMenu:addItem( { "Play Opening ~1", {|| MyFunction( 1 ) } } ) oSubMenu:addItem( { "Play Closing ~2", {|| MyFunction( 2 ) } } ) + oSubMenu:addItem() oSubMenu:addItem( { "~MessageBox" , {|| MyFunction( 3 ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) + oSubMenu := WvgMenu():new( oMenuBar ):create() + oSubMenu:title := "F~eatures" + oSubMenu:addItem( { "~Hide or Show Left Panel" , {|| IF( oStatic:isVisible, ; + oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE,0,0 ) } } ) + oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show() } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + Return nil //----------------------------------------------------------------------// STATIC FUNCTION ActiveXBuildToolBar( oCrt, nActiveX ) @@ -2522,12 +2579,10 @@ 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( "Lock" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) + oTBar:addItem( "Static" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) - oTBar:addItem( "Calculator", 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) - oTBar:addItem( "Notes" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) - - oTBar:buttonClick := {|oButton| Win_MessageBox( , "Button [" + oButton:caption + "] clicked!" ) } + oTBar:addItem( "Show" , 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) + oTBar:addItem( "Hide" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) RETURN oTBar //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgcheck.prg b/harbour/contrib/gtwvg/wvgcheck.prg new file mode 100644 index 0000000000..79f2d34ef7 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgcheck.prg @@ -0,0 +1,211 @@ +/* + * $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++ xbpPushButton Compatible Class +// +// Pritpal Bedi +// 05Dec2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#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 WvgCheckBox 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 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 + ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock + + METHOD handleEvent( nEvent, aInfo ) + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCheckBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + BS_PUSHBUTTON + BS_AUTOCHECKBOX //+ BS_NOTIFY + ::className := 'BUTTON' + ::objType := objTypeCheckBox + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCheckBox + + ::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 ) == BST_CHECKED ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox + + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + + SWITCH nMessage + + 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 ) + RETURN 0 + + ENDIF + ENDIF + EXIT + + END + + RETURN 1 + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgCheckBox + + 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 WvgCheckBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setCaption( xCaption ) CLASS WvgCheckBox + + IF hb_isChar( xCaption ) + ::caption := xCaption + Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption ) + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgdatar.prg b/harbour/contrib/gtwvg/wvgdatar.prg new file mode 100644 index 0000000000..36bfbf8875 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgdatar.prg @@ -0,0 +1,165 @@ +/* + * $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++ dataRef 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 DataRef + + 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 new() CLASS DataRef + + RETURN self + +//----------------------------------------------------------------------// + +METHOD getData() CLASS DataRef + + IF hb_isBlock( ::dataLink ) + eval( ::dataLink, ::sl_editBuffer ) + ENDIF + + RETURN ::sl_editBuffer + +//----------------------------------------------------------------------// + +METHOD setData( xValue ) CLASS DataRef + + IF hb_isBlock( ::dataLink ) + ::sl_editBuffer := eval( ::dataLink ) + + ELSEIF xValue <> NIL + ::sl_editBuffer := xValue + + ENDIF + + SWITCH ::className + CASE 'BUTTON' + ::sendMessage( BM_SETCHECK, IF( ::sl_editBuffer, BST_CHECKED, BST_UNCHECKED ), 0 ) + EXIT + END + + RETURN ::sl_editBuffer + +//----------------------------------------------------------------------// + +METHOD undo() CLASS DataRef + + RETURN .f. + +//----------------------------------------------------------------------// + +METHOD validate( xParam ) CLASS DataRef + + IF PCount() == 0 .and. hb_isBlock( ::sl_validate ) + RETURN eval( ::sl_validate, self ) + ELSEIF hb_isBlock( xParam ) + ::sl_validate := xParam + ENDIF + + RETURN .t. + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index 5c6d68c322..76deab5503 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -114,6 +114,16 @@ static const int K_Ctrl[] = static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +//----------------------------------------------------------------------// + +#ifdef __DBG_GTWGU__ +#define WVGDEBUG( d ) hb_ToOutDebug d +#else +#define WVGDEBUG( d ) +#endif + +//----------------------------------------------------------------------// + static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance ) { WNDCLASS wndclass; @@ -145,7 +155,7 @@ static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) int iCount = s_wvtCount, iPos = 0; PHB_GTWVT pWVT = NULL; -//hb_ToOutDebug( "hb_gt_wvt_Find()" ); +//WVGDEBUG( ( "hb_gt_wvt_Find()" ) ); HB_WVT_LOCK @@ -172,9 +182,7 @@ static BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT ) { BOOL fOK = FALSE; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_Alloc()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_Alloc()" ) ); HB_WVT_LOCK @@ -206,9 +214,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) { HB_WVT_LOCK -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_Free()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_Free()" ) ); s_wvtWindows[ pWVT->iHandle ] = NULL; @@ -239,9 +245,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) PHB_GTWVT pWVT; OSVERSIONINFO osvi; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_New()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_New()" ) ); osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); GetVersionEx( &osvi ); @@ -324,9 +328,7 @@ static int hb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent, PHB_ITEM pParams ) { int nResult = 0; /* Unhandled */ -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_FireEvent()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_FireEvent()" ) ); if( pWVT->pGT->pNotifierBlock ) { @@ -350,9 +352,7 @@ static void hb_gt_wvt_FireMenuEvent( PHB_GTWVT pWVT, int iMode, int menuIndex ) { PHB_ITEM pEvParams = hb_itemNew( NULL ); -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_FireMenuEvent()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_FireMenuEvent()" ) ); hb_arrayNew( pEvParams, 2 ); hb_arraySetNI( pEvParams, 1, iMode ); @@ -368,9 +368,7 @@ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) { int iPos = pWVT->keyPointerIn; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_AddCharToInputQueue()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_AddCharToInputQueue()" ) ); if( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE ) { @@ -399,7 +397,8 @@ hb_ToOutDebug( "wvggui:hb_gt_wvt_AddCharToInputQueue()" ); static BOOL hb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey ) { -//hb_ToOutDebug( "wvggui:hb_gt_wvt_GetCharFromInputQueue()" ); + //WVGDEBUG( ( "wvggui:hb_gt_wvt_GetCharFromInputQueue()" ) ); + if( pWVT->keyPointerOut != pWVT->keyPointerIn ) { *iKey = pWVT->Keys[ pWVT->keyPointerOut ]; @@ -418,9 +417,7 @@ static void hb_gt_wvt_TranslateKey( PHB_GTWVT pWVT, int key, int shiftkey, int a { int nVirtKey = GetKeyState( VK_MENU ); -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_TranslateKey()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_TranslateKey()" ) ); if( nVirtKey & 0x8000 ) /* alt + key */ { @@ -449,9 +446,7 @@ static int hb_gt_wvt_key_ansi_to_oem( int c ) BYTE pszAnsi[ 2 ]; BYTE pszOem[ 2 ]; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_key_ansi_to_oem()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_key_ansi_to_oem()" ) ); pszAnsi[ 0 ] = ( BYTE ) c; pszAnsi[ 1 ] = 0; @@ -465,9 +460,7 @@ static int hb_gt_wvt_SizeChanged( PHB_GTWVT pWVT ) PHB_ITEM pEvParams = hb_itemNew( NULL ); RECT rc; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_SizeChanged()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_SizeChanged()" ) ); GetClientRect( pWVT->hWnd, &rc ); @@ -491,9 +484,7 @@ static void hb_gt_wvt_SetWindowTitle( HWND hWnd, const char * title ) { LPTSTR text = HB_TCHAR_CONVTO( title ); -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_SetWindowTitle()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_SetWindowTitle()" ) ); SetWindowText( hWnd, text ); HB_TCHAR_FREE( text ); @@ -504,9 +495,7 @@ static BOOL hb_gt_wvt_GetWindowTitle( HWND hWnd, char ** title ) TCHAR buffer[WVT_MAX_TITLE_SIZE]; int iResult; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_GetWindowTitle()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_GetWindowTitle()" ) ); iResult = GetWindowText( hWnd, buffer, WVT_MAX_TITLE_SIZE ); if( iResult > 0 ) @@ -527,9 +516,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L SHORT keyCode = 0; SHORT keyState; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_MouseEvent()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_MouseEvent()" ) ); HB_SYMBOL_UNUSED( wParam ); if( ! pWVT->MouseMove && ( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) ) @@ -643,10 +630,7 @@ hb_ToOutDebug( "wvggui:hb_gt_wvt_MouseEvent()" ); static BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam ) { - -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_KeyEvent()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_KeyEvent()" ) ); switch( message ) { @@ -984,15 +968,10 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { PHB_GTWVT pWVT = hb_gt_wvt_Find( hWnd ); -#ifdef __DBG_GUI_C__ -//hb_ToOutDebug( "wvggui:hb_gt_wvt_WndPro( %i %i %i %i )", hWnd, message, wParam, lParam ); -#endif + WVGDEBUG( ( "wvggui:wndproc( %i %i %i %i )", hWnd, message, wParam, lParam ) ); if( pWVT ) switch( message ) { - //case WM_PAINT: - //return DefWindowProc( hWnd, message, wParam, lParam );; - case WM_SETFOCUS: { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -1200,9 +1179,7 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT ) HWND hWnd, hWndParent; LPTSTR szAppName; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_CreateWindow()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_CreateWindow()" ) ); szAppName = HB_TCHAR_CONVTO( hb_cmdargARGV()[ 0 ] ); @@ -1261,10 +1238,7 @@ hb_ToOutDebug( "wvggui:hb_gt_wvt_CreateWindow()" ); static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) { - -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_CreateConsoleWindow()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_CreateConsoleWindow()" ) ); if( !pWVT->hWnd ) { @@ -1310,9 +1284,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRDIFF ) hFilenoStdin, ( void * ) ( HB_PTRDIFF ) hFilenoStdout, ( void * ) ( HB_PTRDIFF ) hFilenoStderr ) ); -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_Init()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_Init()" ) ); if( ! hb_winmainArgGet( &hInstance, NULL, &iCmdShow ) ) hb_errInternal( 10001, "It's not a GUI program", NULL, NULL ); @@ -1339,10 +1311,7 @@ static void hb_gt_wvt_Exit( PHB_GT pGT ) PHB_GTWVT pWVT; HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Exit(%p)", pGT)); - -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_Exit()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_Exit()" ) ); pWVT = HB_GTWVT_GET( pGT ); HB_GTSUPER_EXIT( pGT ); @@ -1362,10 +1331,7 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) BOOL fKey; HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", pGT, iEventMask ) ); - -#ifdef __DBG_GUI_C__ -//hb_ToOutDebug( "wvggui:hb_gt_wvt_ReadKey()" ); -#endif + //WVGDEBUG( ( "wvggui:hb_gt_wvt_ReadKey()" ) ); HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the eventmask! */ @@ -1384,10 +1350,7 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration)); - -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_Tone()" ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_wvt_Tone()" ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1401,11 +1364,8 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) PHB_GTWVT pWVT; int iVal; -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_wvt_Info()" ); -#endif - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", pGT, iType, pInfo ) ); + WVGDEBUG( ( "wvggui:hb_gt_wvt_Info()" ) ); pWVT = HB_GTWVT_GET( pGT ); @@ -2191,10 +2151,7 @@ hb_ToOutDebug( "wvggui:hb_gt_wvt_Info()" ); static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_FuncInit(%p)", pFuncTable)); - -#ifdef __DBG_GUI_C__ -hb_ToOutDebug( "wvggui:hb_gt_FuncInit() " ); -#endif + WVGDEBUG( ( "wvggui:hb_gt_FuncInit() " ) ); pFuncTable->Init = hb_gt_wvt_Init; pFuncTable->Exit = hb_gt_wvt_Exit; diff --git a/harbour/contrib/gtwvg/wvglistb.prg b/harbour/contrib/gtwvg/wvglistb.prg index 54c8751c4e..84ed784627 100644 --- a/harbour/contrib/gtwvg/wvglistb.prg +++ b/harbour/contrib/gtwvg/wvglistb.prg @@ -76,8 +76,8 @@ //----------------------------------------------------------------------// -#ifndef __xDBG_TB__ -# xtranslate hb_ToOutDebug( [] ) => +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -184,13 +184,13 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgLi ::createControl() + ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + IF ::visible ::show() ENDIF - ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) - ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) - RETURN Self //----------------------------------------------------------------------// @@ -198,11 +198,13 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgLi METHOD handleEvent( nMessage, aNM ) CLASS WvgListBox LOCAL nHandled := 1 + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + SWITCH nMessage CASE WM_COMMAND IF aNM[ 1 ] == LBN_SELCHANGE - //::nCurSelected := ::sendMessage( LB_GETCURSEL, 0, 0 ) + 1 + ::nCurSelected := Win_LbGetCurSel( ::hWnd )+ 1 IF hb_isBlock( ::sl_itemSelected ) eval( ::sl_itemSelected, NIL, NIL, self ) ENDIF @@ -229,6 +231,8 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv METHOD destroy() CLASS WvgListBox + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) + IF Len( ::aChildren ) > 0 aeval( ::aChildren, {|o| o:destroy() } ) ::aChildren := {} @@ -262,8 +266,6 @@ filename, or directory name. GetListBoxInfo Retrieves information about the specified list box. - - Messages ======== @@ -582,6 +584,5 @@ Specifies that the owner of the list box receives WM_VKEYTOITEM messages wheneve the user presses a key and the list box has the input focus. This enables an application to perform special processing on the keyboard input. - #endif //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgparts.ch b/harbour/contrib/gtwvg/wvgparts.ch index db09d34401..e7060b0670 100644 --- a/harbour/contrib/gtwvg/wvgparts.ch +++ b/harbour/contrib/gtwvg/wvgparts.ch @@ -74,6 +74,8 @@ #define objTypeStatic 12 #define objTypeTreeView 13 #define objTypeTreeViewItem 14 +#define objTypeCheckBox 15 +#define objTypeRadioButton 16 //----------------------------------------------------------------------// // NMHDR info @@ -164,6 +166,12 @@ #define WVGLISTBOX_MM_SINGLE 1 +// Generic Pres Parameters +#define WVG_PP_FGCLR 2 +#define WVG_PP_BGCLR 4 +#define WVG_PP_COMPOUNDNAME 15 +#define WVG_PP_FONT 16 + #endif // #ifndef _WVG_CH //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgpushb.prg b/harbour/contrib/gtwvg/wvgpushb.prg index 4b1ded3752..2ff159e09c 100644 --- a/harbour/contrib/gtwvg/wvgpushb.prg +++ b/harbour/contrib/gtwvg/wvgpushb.prg @@ -56,7 +56,7 @@ // EkOnkar // ( The LORD is ONE ) // -// Xbase++ xbpPushButton Compatible Class +// Xbase++ xbpPushButton Compatible Class // // Pritpal Bedi // 26Nov2008 @@ -76,8 +76,8 @@ //----------------------------------------------------------------------// -#ifndef __DBG_TB__ -# xtranslate hb_ToOutDebug( [] ) => +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -89,7 +89,7 @@ CLASS WvgPushButton INHERIT WvgWindow DATA caption INIT '' DATA pointerFocus INIT .T. DATA preSelect INIT .F. - DATA drawMode INIT 0 //WVG_DRAW_NORMAL + DATA drawMode INIT WVG_DRAW_NORMAL DATA default INIT .F. DATA cancel INIT .F. @@ -103,9 +103,6 @@ CLASS WvgPushButton INHERIT WvgWindow METHOD activate() SETGET METHOD draw() SETGET - DATA nWndProc - DATA nOldProc INIT 0 - METHOD handleEvent( nEvent, aInfo ) ENDCLASS @@ -135,25 +132,27 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPu ::createControl() + ::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + IF ::visible ::show() ENDIF ::setCaption( ::caption ) - ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) - ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) - RETURN Self //----------------------------------------------------------------------// -METHOD handleEvent( nEvent, aInfo ) CLASS WvgPushButton +METHOD handleEvent( nMessage, aInfo ) CLASS WvgPushButton LOCAL nHandled := 0 + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + HB_SYMBOL_UNUSED( aInfo ) - SWITCH nEvent + SWITCH nMessage CASE WM_SIZE IF hb_isBlock( ::sl_resize ) @@ -180,7 +179,7 @@ METHOD handleEvent( nEvent, aInfo ) CLASS WvgPushButton METHOD destroy() CLASS WvgPushButton -hb_ToOutDebug( "WvgPushButton:destroy()" ) + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) IF len( ::aChildren ) > 0 aeval( ::aChildren, {|o| o:destroy() } ) diff --git a/harbour/contrib/gtwvg/wvgradio.prg b/harbour/contrib/gtwvg/wvgradio.prg new file mode 100644 index 0000000000..45c6406a39 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgradio.prg @@ -0,0 +1,206 @@ +/* + * $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++ xbpPushButton 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 WvgRadioButton INHERIT WvgWindow + + DATA autosize INIT .F. + DATA caption INIT '' + DATA pointerFocus INIT .T. + DATA selection INIT .F. + + METHOD new() + METHOD create() + 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 + ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock + + METHOD handleEvent( nEvent, aInfo ) + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgRadioButton + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + BS_AUTORADIOBUTTON + ::className := 'BUTTON' + ::objType := objTypeRadioButton + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgRadioButton + + ::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 + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( nMessage, aNM ) CLASS WvgRadioButton + + hb_ToOutDebug( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) + + SWITCH nMessage + + CASE WM_COMMAND + IF aNM[ NMH_code ] == BN_CLICKED + IF hb_isBlock( ::sl_lbClick ) + eval( ::sl_lbClick, NIL, NIL, self ) + RETURN 0 + ENDIF + ENDIF + EXIT + + END + + RETURN 1 + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgRadioButton + + 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 + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgRadioButton + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setCaption( xCaption ) CLASS WvgRadioButton + + IF hb_isChar( xCaption ) + ::caption := xCaption + Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption ) + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgstatb.prg b/harbour/contrib/gtwvg/wvgstatb.prg index e9e81d3cb1..d2157ef7ba 100644 --- a/harbour/contrib/gtwvg/wvgstatb.prg +++ b/harbour/contrib/gtwvg/wvgstatb.prg @@ -76,8 +76,8 @@ //----------------------------------------------------------------------// -#ifndef __DBG_TB__ -# xtranslate hb_ToOutDebug( [] ) => +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -103,9 +103,6 @@ CLASS WvgStatusBar INHERIT WvgActiveXControl METHOD panelClick() SETGET METHOD panelDblClick() SETGET - DATA nOldProc INIT 0 - DATA nWndProc - METHOD handleEvent() ENDCLASS @@ -140,14 +137,14 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt ::createControl() - ::addItem( , , , , , -1 ) + ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) IF ::visible ::show() ENDIF - ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) - ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + ::addItem( , , , , , -1 ) RETURN Self @@ -157,6 +154,8 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatusBar LOCAL nHandled := 1 LOCAL nObj, aNMH + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + SWITCH nMessage CASE WM_SIZE @@ -199,7 +198,8 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatusBar METHOD destroy() CLASS WvgStatusBar LOCAL i, nItems -hb_ToOutDebug( "WvgStatusBar:destroy()" ) + + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) IF ( nItems := Len( ::aItems ) ) > 0 FOR i := 1 TO nItems diff --git a/harbour/contrib/gtwvg/wvgstatc.prg b/harbour/contrib/gtwvg/wvgstatc.prg index 7a0de4ad97..b4ccbbd9bb 100644 --- a/harbour/contrib/gtwvg/wvgstatc.prg +++ b/harbour/contrib/gtwvg/wvgstatc.prg @@ -76,8 +76,8 @@ //----------------------------------------------------------------------// -#ifndef __xDBG_TB__ -# xtranslate hb_ToOutDebug( [] ) => +#ifndef __DBG_PARTS__ +//#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -99,9 +99,6 @@ CLASS WvgStatic INHERIT WvgWindow METHOD setCaption( xCaption, cDll ) - DATA nOldProc INIT 0 - DATA nWndProc - METHOD handleEvent() ENDCLASS @@ -133,28 +130,45 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt ::style += WS_VISIBLE ENDIF + #if 0 + SS_ETCHEDFRAME + SS_SUNKEN + SS_LEFTNOWORDWRAP + SS_SIMPLE + SS_CENTERIMAGE + SS_REALSIZEIMAGE + SS_ENHMETAFILE + SS_ETCHEDHORZ + SS_ETCHEDVERT + SS_RIGHTJUST + #endif + + SWITCH ::type CASE WVGSTATIC_TYPE_TEXT - IF ( Win_AND( ::options, WVGSTATIC_TEXT_LEFT ) == WVGSTATIC_TEXT_LEFT ) + IF ( hb_bitAnd( ::options, WVGSTATIC_TEXT_LEFT ) == WVGSTATIC_TEXT_LEFT ) ::style += SS_LEFT //+ SS_LEFTNOWORDWRAP ENDIF - IF ( Win_AND( ::options, WVGSTATIC_TEXT_RIGHT ) == WVGSTATIC_TEXT_RIGHT ) + IF ( hb_bitAnd( ::options, WVGSTATIC_TEXT_RIGHT ) == WVGSTATIC_TEXT_RIGHT ) ::style += SS_RIGHT ENDIF - IF ( Win_AND( ::options, WVGSTATIC_TEXT_CENTER ) == WVGSTATIC_TEXT_CENTER ) + IF ( hb_bitAnd( ::options, WVGSTATIC_TEXT_CENTER ) == WVGSTATIC_TEXT_CENTER ) ::style += SS_CENTER ENDIF - IF ( Win_AND( ::options, WVGSTATIC_TEXT_WORDBREAK ) == WVGSTATIC_TEXT_WORDBREAK ) + IF ( hb_bitAnd( ::options, WVGSTATIC_TEXT_WORDBREAK ) == WVGSTATIC_TEXT_WORDBREAK ) ::style -= SS_LEFTNOWORDWRAP ENDIF EXIT + CASE WVGSTATIC_TYPE_GROUPBOX EXIT CASE WVGSTATIC_TYPE_ICON + ::style += SS_ICON EXIT CASE WVGSTATIC_TYPE_SYSICON EXIT CASE WVGSTATIC_TYPE_BITMAP + ::style += SS_BITMAP IF ::options == WVGSTATIC_BITMAP_TILED ELSEIF ::options == WVGSTATIC_BITMAP_SCALED @@ -164,54 +178,73 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt ENDIF EXIT CASE WVGSTATIC_TYPE_FGNDRECT + ::style += SS_WHITERECT EXIT CASE WVGSTATIC_TYPE_BGNDRECT - EXIT - CASE WVGSTATIC_TYPE_FGNDFRAME - EXIT - CASE WVGSTATIC_TYPE_BGNDFRAME + ::style += SS_BLACKRECT EXIT CASE WVGSTATIC_TYPE_HALFTONERECT + ::style += SS_GRAYRECT + EXIT + CASE WVGSTATIC_TYPE_FGNDFRAME + ::style += SS_WHITEFRAME + EXIT + CASE WVGSTATIC_TYPE_BGNDFRAME + ::style += SS_BLACKFRAME EXIT CASE WVGSTATIC_TYPE_HALFTONEFRAME + ::style += SS_GRAYFRAME EXIT + CASE WVGSTATIC_TYPE_RAISEDBOX EXIT CASE WVGSTATIC_TYPE_RECESSEDBOX EXIT + CASE WVGSTATIC_TYPE_RAISEDRECT EXIT CASE WVGSTATIC_TYPE_RECESSEDRECT EXIT + CASE WVGSTATIC_TYPE_RAISEDLINE EXIT CASE WVGSTATIC_TYPE_RECESSEDLINE EXIT - END + END // ::type - ::createControl() + // Options + IF ( ascan( { WVGSTATIC_TYPE_FGNDFRAME, WVGSTATIC_TYPE_BGNDFRAME, WVGSTATIC_TYPE_HALFTONEFRAME }, ::type ) > 0 ) + IF ( hb_bitAnd( ::options, WVGSTATIC_FRAMETHIN ) == WVGSTATIC_FRAMETHIN ) + ::style += WS_BORDER - IF Win_IsWindow( ::hWnd ) - ::oParent:addChild( SELF ) + ELSEIF ( hb_bitAnd( ::options, WVGSTATIC_FRAMETHICK ) == WVGSTATIC_FRAMETHICK ) + ::style += WS_DLGFRAME - ::setCaption( ::caption ) - IF ::visible - ::show() ENDIF ENDIF - ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self, 4 ) + //------------------- API request to create control ----------------// + ::oParent:addChild( SELF ) + + ::createControl() + + ::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self, 4 ) ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + IF ::visible + ::show() + ENDIF + + //------------------- After creation settings------------------------// + ::setCaption( ::caption ) + RETURN Self //----------------------------------------------------------------------// -METHOD handleEvent( nMessage, aInfo ) CLASS WvgStatic +METHOD handleEvent( nMessage/*, aNM */) CLASS WvgStatic -hb_ToOutDebug( "WvgStatic:handleEvent %i", nMessage ) - - HB_SYMBOL_UNUSED( aInfo ) + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) SWITCH nMessage @@ -230,12 +263,11 @@ hb_ToOutDebug( "WvgStatic:handleEvent %i", nMessage ) METHOD destroy() CLASS WvgStatic -hb_ToOutDebug( "WvgStatic:destroy()" ) + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) IF len( ::aChildren ) > 0 aeval( ::aChildren, {|o| o:destroy() } ) ENDIF - IF Win_IsWindow( ::hWnd ) Win_DestroyWindow( ::hWnd ) ENDIF @@ -255,7 +287,6 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv METHOD setCaption( xCaption, cDll ) - HB_SYMBOL_UNUSED( xCaption ) HB_SYMBOL_UNUSED( cDll ) DEFAULT xCaption TO ::caption diff --git a/harbour/contrib/gtwvg/wvgtoolb.prg b/harbour/contrib/gtwvg/wvgtoolb.prg index 6af9597319..2594a5449c 100644 --- a/harbour/contrib/gtwvg/wvgtoolb.prg +++ b/harbour/contrib/gtwvg/wvgtoolb.prg @@ -76,8 +76,8 @@ //----------------------------------------------------------------------// -#ifndef __DBG_TB__ -# xtranslate hb_ToOutDebug( [] ) => +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -172,16 +172,16 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo ::createControl() - IF ::showToolTips - ::sendMessage( TB_SETMAXTEXTROWS, 0, 0 ) - ENDIF + ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) IF ::visible ::show() ENDIF - ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) - ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + IF ::showToolTips + ::sendMessage( TB_SETMAXTEXTROWS, 0, 0 ) + ENDIF RETURN Self @@ -191,6 +191,8 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgToolBar LOCAL nHandled := 1 LOCAL nObj, aNMMouse + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + SWITCH nMessage CASE WM_SIZE @@ -229,7 +231,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgToolBar METHOD destroy() CLASS WvgToolBar LOCAL i, nItems -hb_ToOutDebug( "WvgToolBar:destroy()" ) + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) IF ( nItems := Len( ::aItems ) ) > 0 FOR i := 1 TO nItems diff --git a/harbour/contrib/gtwvg/wvgtreev.prg b/harbour/contrib/gtwvg/wvgtreev.prg index 866f98e9b7..91b43a20b7 100644 --- a/harbour/contrib/gtwvg/wvgtreev.prg +++ b/harbour/contrib/gtwvg/wvgtreev.prg @@ -76,13 +76,13 @@ //----------------------------------------------------------------------// -#ifndef __DBG_TB__ -# xtranslate hb_ToOutDebug( [] ) => +#ifndef __DBG_PARTS__ +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// -CLASS WvgTreeView INHERIT WvgWindow +CLASS WvgTreeView INHERIT WvgWindow, DataRef DATA alwaysShowSelection INIT .F. DATA hasButtons INIT .F. @@ -98,9 +98,7 @@ CLASS WvgTreeView INHERIT WvgWindow METHOD configure() METHOD destroy() - METHOD getData() METHOD itemFromPos( aPos ) - METHOD setData( oMarkedItem ) DATA sl_itemCollapsed DATA sl_itemExpanded @@ -120,14 +118,14 @@ CLASS WvgTreeView INHERIT WvgWindow DATA textParentSelected INIT '' DATA textItemSelected INIT '' - METHOD setColorFG( nRGB ) INLINE WIN_TreeView_SetTextColor( ::hWnd, nRGB ) - METHOD setColorBG( nRGB ) INLINE WIN_TreeView_SetBkColor( ::hWnd, nRGB ) - METHOD setColorLines( nRGB ) INLINE WIN_TreeView_SetLineColor( ::hWnd, nRGB ) + METHOD setColorFG( nRGB ) INLINE Win_TreeView_SetTextColor( ::hWnd, nRGB ) + METHOD setColorBG( nRGB ) INLINE Win_TreeView_SetBkColor( ::hWnd, nRGB ) + METHOD setColorLines( nRGB ) INLINE Win_TreeView_SetLineColor( ::hWnd, nRGB ) - DATA nWndProc - DATA nOldProc INIT 0 + METHOD handleEvent( nMessage, aInfo ) - METHOD handleEvent( nEvent, aInfo ) + METHOD showExpanded( lExpanded, nLevels ) INLINE Wvg_TreeView_ShowExpanded( ::hWnd, ; + IF( hb_isNil( lExpanded ), .f., lExpanded ), nLevels ) ENDCLASS @@ -143,7 +141,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeV ::exStyle := WS_EX_STATICEDGE //+ TVS_EX_FADEINOUTEXPANDOS ::className := "SysTreeView32" - ::objType := objTypePushButton + ::objType := objTypeTreeView RETURN Self @@ -170,6 +168,9 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTr ::createControl() + ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + IF ::visible ::show() ENDIF @@ -178,9 +179,6 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTr ::oRootItem:hTree := ::hWnd ::oRootItem:oWnd := Self - ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) - ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) - RETURN Self //----------------------------------------------------------------------// @@ -191,7 +189,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView LOCAL cParent := space( 20 ) LOCAL cText := space( 20 ) -hb_ToOutDebug( "WvgTreeView:handleEvent( %i )", nMessage ) + hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) SWITCH nMessage @@ -246,6 +244,8 @@ hb_ToOutDebug( "WvgTreeView:handleEvent( %i )", nMessage ) METHOD destroy() CLASS WvgTreeView + hb_ToOutDebug( " %s:destroy()", __objGetClsName() ) + IF len( ::aChildren ) > 0 aeval( ::aChildren, {|o| o:destroy() } ) ENDIF @@ -267,11 +267,6 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv //----------------------------------------------------------------------// -METHOD getData() CLASS WvgTreeView - RETURN Self - -//----------------------------------------------------------------------// - METHOD itemFromPos( aPos ) CLASS WvgTreeView HB_SYMBOL_UNUSED( aPos ) @@ -280,14 +275,6 @@ METHOD itemFromPos( aPos ) CLASS WvgTreeView //----------------------------------------------------------------------// -METHOD setData( oMarkedItem ) CLASS WvgTreeView - - HB_SYMBOL_UNUSED( oMarkedItem ) - - RETURN Self - -//----------------------------------------------------------------------// - METHOD itemCollapsed( xParam ) CLASS WvgTreeView IF hb_isBlock( xParam ) .or. ( xParam == NIL ) @@ -350,16 +337,14 @@ CLASS WvgTreeViewItem METHOD configure() METHOD destroy() - METHOD expand( lExpand ) + METHOD expand( lExpand ) INLINE Win_TreeView_Expand( ::hTree, ::hItem, ; + IF( hb_isLogical( lExpand ), lExpand, .t. ) ) METHOD isExpanded() METHOD setCaption( cCaption ) METHOD setExpandedImage( nResIdoBitmap ) METHOD setImage( nResIdoBitmap ) METHOD setMarkedImage( nResIdoBitmap ) - METHOD getData() - METHOD setData( xValue ) - METHOD addItem() METHOD delItem() METHOD getChildItems() @@ -393,14 +378,6 @@ METHOD destroy() CLASS WvgTreeViewItem //----------------------------------------------------------------------// -METHOD expand( lExpand ) CLASS WvgTreeViewItem - - HB_SYMBOL_UNUSED( lExpand ) - - RETURN NIL - -//----------------------------------------------------------------------// - METHOD isExpanded() CLASS WvgTreeViewItem RETURN NIL @@ -438,20 +415,6 @@ METHOD setMarkedImage( nResIdoBitmap ) CLASS WvgTreeViewItem //----------------------------------------------------------------------// -METHOD getData() CLASS WvgTreeViewItem - - RETURN NIL - -//----------------------------------------------------------------------// - -METHOD setData( xValue ) CLASS WvgTreeViewItem - - HB_SYMBOL_UNUSED( xValue ) - - RETURN NIL - -//----------------------------------------------------------------------// - METHOD addItem( cCaption ) CLASS WvgTreeViewItem Local oItem, hParent @@ -464,7 +427,7 @@ METHOD addItem( cCaption ) CLASS WvgTreeViewItem hParent := if( hb_isObject( oItem:oParent ), oItem:oParent:hItem, NIL ) - oItem:hItem := Wvg_TreeView_AddItem( oItem:hTree, hParent, oItem:Caption ) + oItem:hItem := Wvg_TreeView_AddItem( oItem:hTree, hParent, oItem:caption ) aadd( oItem:oWnd:aItems, oItem ) diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index dce6f13174..2a5b8815cb 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -523,6 +523,20 @@ HB_FUNC( WIN_SETPARENT ) //-------------------------------------------------------------------// +HB_FUNC( WIN_BRINGWINDOWTOTOP ) +{ + hb_retl( BringWindowToTop( wvg_parhwnd( 1 ) ) ); +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_SETFOREGROUNDWINDOW ) +{ + hb_retl( BringWindowToTop( wvg_parhwnd( 1 ) ) ); +} + +//----------------------------------------------------------------------// + HB_FUNC( WIN_SETWINDOWLONG ) { hb_retnl( SetWindowLong( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parnl( 3 ) ) ); @@ -537,6 +551,13 @@ HB_FUNC( WIN_ISWINDOW ) //-------------------------------------------------------------------// +HB_FUNC( WIN_ENABLEWINDOW ) +{ + hb_retl( EnableWindow( wvg_parhwnd( 1 ), hb_parl( 2 ) ) ); +} + +//-------------------------------------------------------------------// + HB_FUNC( WIN_DESTROYWINDOW ) { hb_retl( DestroyWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); @@ -1507,42 +1528,41 @@ HB_FUNC( WVG_TREEVIEW_GETSELECTIONINFO ) { LPNMTREEVIEW pnmtv = ( LPNMTREEVIEW ) wvg_parlparam( 2 ); HTREEITEM hSelected = pnmtv->itemNew.hItem; - HTREEITEM hParent; if( hSelected != NULL ) { - char *textDisp = ( char* ) hb_xgrab( MAX_PATH + 1 ); - char *ParentDisp = ( char* ) hb_xgrab( MAX_PATH + 1 ); - TV_ITEM item; + TCHAR text[ MAX_PATH + 1 ]; + TCHAR Parent[ MAX_PATH + 1 ]; + TV_ITEM item; + HTREEITEM hParent; hb_stornl( ( long ) hSelected, 6 ); item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_IMAGE; item.hItem = hSelected; - item.pszText = textDisp; + item.pszText = text; item.cchTextMax = MAX_PATH; if( SendMessage( wvg_parhwnd( 1 ), ( UINT ) TVM_GETITEM, ( WPARAM ) 0, ( LPARAM ) &item ) ) { - hb_storclenAdopt( textDisp, strlen( textDisp ), 4 ); + char * szText = HB_TCHAR_CONVFROM( text ); + hb_storclen( szText, strlen( szText ), 4 ); + HB_TCHAR_FREE( szText ); } hParent = TreeView_GetParent( wvg_parhwnd( 1 ), hSelected ); hb_stornl( ( long ) hParent, 5 ); - //hParent = SendMessage( wvg_parhwnd( 2 ), ( UINT ) TVM_GETNEXTITEM, ( WPARAM ) TVGN_PARENT, ( LPARAM ) hSelected ); item.mask = TVIF_HANDLE | TVIF_TEXT; item.hItem = hParent; - item.pszText = ParentDisp; + item.pszText = Parent; item.cchTextMax = MAX_PATH; if( SendMessage( wvg_parhwnd( 1 ), ( UINT ) TVM_GETITEM, ( WPARAM ) 0, ( LPARAM ) &item ) ) { - hb_storclenAdopt( ParentDisp, strlen( ParentDisp ), 3 ); - } - else - { - hb_xfree( ParentDisp ); + char * szText = HB_TCHAR_CONVFROM( Parent ); + hb_storclen( szText, strlen( szText ), 3 ); + HB_TCHAR_FREE( szText ); } } } @@ -1553,14 +1573,24 @@ HB_FUNC( WVG_TREEVIEW_GETSELECTIONINFO ) // HB_FUNC( WVG_TREEVIEW_ADDITEM ) { + #ifdef UNICODE + typedef struct tagTVINSERTSTRUCTA + { + HTREEITEM hParent; + HTREEITEM hInsertAfter; + TV_ITEMW item; + } TVINSERTSTRUCTW, FAR *LPTVINSERTSTRUCTW; + #else typedef struct tagTVINSERTSTRUCTA { HTREEITEM hParent; HTREEITEM hInsertAfter; TV_ITEMA item; } TVINSERTSTRUCTA, FAR *LPTVINSERTSTRUCTA; + #endif TVINSERTSTRUCT tvis; + LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 3 ) ); tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE; @@ -1571,9 +1601,77 @@ HB_FUNC( WVG_TREEVIEW_ADDITEM ) tvis.item.state = NULL; // TVI_BOLD tvis.hParent = ISNIL( 2 ) ? NULL : wvg_parhandle( 2 ); - tvis.item.pszText = hb_parc( 3 ); + tvis.item.pszText = text; hb_retnint( ( long ) SendMessage( wvg_parhwnd( 1 ), TVM_INSERTITEM, ( WPARAM ) 0, ( LPARAM ) &tvis ) ); + + HB_TCHAR_FREE( text ); +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_TREEVIEW_EXPAND ) +{ + hb_retl( TreeView_Expand( wvg_parhwnd( 1 ), wvg_parhandle( 2 ), ( hb_parl( 3 ) ? TVE_EXPAND : TVE_COLLAPSE ) ) ); +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_TVIS_EXPANDED ) +{ + //hb_retl( TreeView_GetItemState( wvg_parhwnd( 1 ), wvg_parhandle( 2 ), ( UINT ) TVIS_EXPANDED ) ); +} + +//----------------------------------------------------------------------// + +HB_FUNC( WVG_TREEVIEW_SHOWEXPANDED ) +{ + HWND hwnd = wvg_parhwnd( 1 ); + HTREEITEM hroot, hitem, hitem1, hitem2, hitem3; + int iExpand = ( hb_parl( 2 ) ? TVE_EXPAND : TVE_COLLAPSE ); + int iLevels = hb_parni( 3 ) <= 0 ? 5 : hb_parni( 3 ); + + hroot = ( HTREEITEM ) SendMessage( hwnd, TVM_GETNEXTITEM, TVGN_ROOT, NULL ); + if( hroot ) + { + TreeView_Expand( hwnd, hroot, iExpand ); + if( iLevels >= 2 ) + { + hitem = TreeView_GetNextItem( hwnd, hroot, TVGN_CHILD ); + while( hitem ) + { + TreeView_Expand( hwnd, hitem, iExpand ); + if( iLevels >= 3 ) + { + hitem1 = TreeView_GetNextItem( hwnd, hitem, TVGN_CHILD ); + while( hitem1 ) + { + TreeView_Expand( hwnd, hitem1, iExpand ); + if( iLevels >= 4 ) + { + hitem2 = TreeView_GetNextItem( hwnd, hitem1, TVGN_CHILD ); + while( hitem2 ) + { + TreeView_Expand( hwnd, hitem2, iExpand ); + if( iLevels >= 5 ) + { + hitem3 = TreeView_GetNextItem( hwnd, hitem2, TVGN_CHILD ); + while( hitem3 ) + { + TreeView_Expand( hwnd, hitem3, iExpand ); + hitem3 = TreeView_GetNextItem( hwnd, hitem3, TVGN_NEXT ); + } + } + hitem2 = TreeView_GetNextItem( hwnd, hitem2, TVGN_NEXT ); + } + } + hitem1 = TreeView_GetNextItem( hwnd, hitem1, TVGN_NEXT ); + } + } + hitem = TreeView_GetNextItem( hwnd, hitem, TVGN_NEXT ); + } + } + } } //----------------------------------------------------------------------// @@ -1582,20 +1680,33 @@ HB_FUNC( WVG_TREEVIEW_ADDITEM ) HB_FUNC( WIN_LBGETTEXT ) { - USHORT iLen = ( USHORT ) SendMessage( wvg_parhwnd( 1 ), LB_GETTEXTLEN, 0, 0 ) + 1 ; - LPTSTR cText = ( LPTSTR ) hb_xgrab( iLen * sizeof( TCHAR ) ); + TCHAR text[ MAX_PATH + 1 ]; char * szText; - UINT iResult; - iResult = SendMessage( wvg_parhwnd( 1 ), LB_GETTEXT, ( WPARAM ) hb_parni( 2 ), ( LPARAM ) cText ); + SendMessage( wvg_parhwnd( 1 ), LB_GETTEXT, ( WPARAM ) hb_parni( 2 ), ( LPARAM ) text ); - cText[ iResult ] = '\0'; - szText = HB_TCHAR_CONVFROM( cText ); + szText = HB_TCHAR_CONVFROM( text ); hb_retc( szText ); HB_TCHAR_FREE( szText ); - hb_xfree( cText ); } -//-------------------------------------------------------------------// +//----------------------------------------------------------------------// + +HB_FUNC( WIN_LBGETCURSEL ) +{ + hb_retni( ListBox_GetCurSel( wvg_parhwnd( 1 ) ) ); +} + +//----------------------------------------------------------------------// +// Buttons +//----------------------------------------------------------------------// + +HB_FUNC( WIN_BUTTON_GETCHECK ) +{ + hb_retnl( Button_GetCheck( wvg_parhwnd( 1 ) ) ); +} + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg index 9d7e524fc8..f9d7021813 100644 --- a/harbour/contrib/gtwvg/wvgwnd.prg +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -76,6 +76,12 @@ //----------------------------------------------------------------------// +#ifndef __DBG_PARTS__ +//#xtranslate hb_ToOutDebug( [] ) => +#endif + +//----------------------------------------------------------------------// + CLASS WvgWindow INHERIT WvgPartHandler // CONFIGURATION @@ -95,6 +101,11 @@ CLASS WvgWindow INHERIT WvgPartHandler DATA helpLink DATA tooltipText INIT '' + DATA clr_FG + DATA clr_BG + DATA fnt_COMMPOUNDNAME + DATA fnt_hFont + // CALLBACK SLOTS DATA sl_enter DATA sl_leave @@ -158,8 +169,8 @@ EXPORTED: METHOD winDevice() // SETTINGS - METHOD setColorBG() - METHOD setColorFG() + METHOD setColorBG( nRGB ) INLINE ::clr_BG := nRGB + METHOD setColorFG( nRGB ) INLINE ::clr_FG := nRGB, ::invalidateRect() METHOD setFont() METHOD setFontCompoundName() METHOD setPresParam() @@ -170,8 +181,11 @@ EXPORTED: METHOD getHWND() METHOD getModalState() METHOD hasInputFocus() - METHOD isEnabled() - METHOD isVisible() + + DATA is_hidden INIT .F. + DATA is_enabled INIT .T. + METHOD isEnabled() INLINE ::is_enabled + METHOD isVisible() INLINE !( ::is_hidden ) // CALLBACKS // @@ -212,46 +226,47 @@ EXPORTED: METHOD killDisplayFocus() SETGET - DATA title INIT ' ' - DATA icon INIT 0 - DATA closable INIT .T. - DATA resizable INIT .t. - DATA resizeMode INIT 0 - DATA style INIT WS_OVERLAPPEDWINDOW - DATA exStyle INIT 0 - DATA lModal INIT .f. + DATA title INIT ' ' + DATA icon INIT 0 + DATA closable INIT .T. + DATA resizable INIT .t. + DATA resizeMode INIT 0 + DATA style INIT WS_OVERLAPPEDWINDOW + DATA exStyle INIT 0 + DATA lModal INIT .f. DATA pGTp DATA pGT - DATA objType INIT objTypeNone - DATA className INIT '' + DATA objType INIT objTypeNone + DATA className INIT '' METHOD setFocus() METHOD sendMessage() DATA hWnd - DATA aPos INIT { 0,0 } - DATA aSize INIT { 0,0 } - DATA aPresParams INIT {} - DATA lHasInputFocus INIT .F. - DATA nFrameState INIT 0 // normal + DATA aPos INIT { 0,0 } + DATA aSize INIT { 0,0 } + DATA aPresParams INIT {} + DATA lHasInputFocus INIT .F. + DATA nFrameState INIT 0 // normal - DATA maxCol INIT 79 - DATA maxRow INIT 24 - DATA mouseMode INIT 1 + DATA maxCol INIT 79 + DATA maxRow INIT 24 + DATA mouseMode INIT 1 - DATA nID INIT 0 - DATA nControlID INIT 5000 + DATA nID INIT 0 + DATA nControlID INIT 5000 METHOD createControl() METHOD getControlID() INLINE ++::nControlID METHOD Initialize() - DATA nOldProc INIT 0 + DATA nOldProc INIT 0 DATA nWndProc DATA oMenu METHOD HandleEvent() INLINE ( 1 ) METHOD ControlWndProc() + METHOD findObjectByHandle( hWnd ) ENDCLASS @@ -338,13 +353,23 @@ METHOD captureMouse() CLASS WvgWindow METHOD disable() CLASS WvgWindow - RETURN Self + IF Win_EnableWindow( ::hWnd, .f. ) + ::is_enabled := .f. + RETURN .t. + ENDIF + + RETURN .f. //----------------------------------------------------------------------// METHOD enable() CLASS WvgWindow - RETURN Self + IF Win_EnableWindow( ::hWnd, .t. ) + ::is_enabled := .t. + RETURN .t. + ENDIF + + RETURN .f. //----------------------------------------------------------------------// @@ -352,6 +377,7 @@ METHOD hide() CLASS WvgWindow IF Win_IsWindow( ::hWnd ) Win_ShowWindow( ::hWnd, SW_HIDE ) + ::is_hidden := .t. ENDIF RETURN Self @@ -459,6 +485,7 @@ METHOD setSize( aSize, lPaint ) CLASS WvgWindow METHOD show() CLASS WvgWindow Win_ShowWindow( ::hWnd, SW_NORMAL ) + ::is_hidden := .f. ::lHasInputFocus := .t. RETURN Self @@ -473,7 +500,7 @@ METHOD toBack() CLASS WvgWindow METHOD toFront() CLASS WvgWindow - RETURN Self + RETURN Win_SetForegroundWindow( ::hWnd ) //----------------------------------------------------------------------// @@ -489,18 +516,6 @@ METHOD winDevice() CLASS WvgWindow //----------------------------------------------------------------------// -METHOD setColorBG() CLASS WvgWindow - - RETURN Self - -//----------------------------------------------------------------------// - -METHOD setColorFG() CLASS WvgWindow - - RETURN Self - -//----------------------------------------------------------------------// - METHOD setFont() CLASS WvgWindow RETURN Self @@ -553,18 +568,6 @@ METHOD hasInputFocus() CLASS WvgWindow RETURN Self -//----------------------------------------------------------------------// - -METHOD isEnabled() CLASS WvgWindow - - RETURN Self - -//----------------------------------------------------------------------// - -METHOD isVisible() CLASS WvgWindow - - RETURN Self - //----------------------------------------------------------------------// // Callback Methods //----------------------------------------------------------------------// @@ -1093,13 +1096,30 @@ METHOD setFocus() CLASS WvgWindow ::sendMessage( WM_ACTIVATE, 1, 0 ) RETURN Self + //----------------------------------------------------------------------// + METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgWindow Win_SendMessage( ::hWnd, nMessage, nlParam, nwParam ) RETURN Self + //----------------------------------------------------------------------// + +METHOD findObjectByHandle( hWnd ) CLASS WvgWindow + LOCAL nObj + + IF len( ::aChildren ) > 0 + IF ( nObj := ascan( ::aChildren, {|o| o:hWnd == hWnd } ) ) > 0 + RETURN ::aChildren[ nObj ] + ENDIF + ENDIF + + RETURN NIL + +//----------------------------------------------------------------------// + METHOD createControl() CLASS WvgWindow LOCAL hWnd @@ -1143,9 +1163,11 @@ METHOD createControl() CLASS WvgWindow //----------------------------------------------------------------------// METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow - LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem + LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj -hb_ToOutDebug( "Control:wndProc:%s( %i %i %i %i )", __ObjGetClsName( self ), hWnd, nMessage, nwParam, nlParam ) + #if 0 + hb_ToOutDebug( "%s:wndProc( %i %i %i %i )", __ObjGetClsName( self ), hWnd, nMessage, nwParam, nlParam ) + #endif SWITCH nMessage @@ -1169,7 +1191,6 @@ hb_ToOutDebug( "Control:wndProc:%s( %i %i %i %i )", __ObjGetClsName RETURN 0 ELSE IF ( nObj := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) ) > 0 -hb_ToOutDebug( "Control:wndProc:%s( %i )", __ObjGetClsName( self ), nCtrlID ) RETURN ::aChildren[ nObj ]:handleEvent( WM_COMMAND, { nNotifctn, nCtrlID, hWndCtrl } ) ENDIF @@ -1184,9 +1205,15 @@ hb_ToOutDebug( "Control:wndProc:%s( %i )", __ObjGetClsName( self ), nCtrlID ) EXIT CASE WM_CTLCOLORLISTBOX - Win_SetTextColor( nwParam, RGB( 100,55,255 ) ) - RETURN ( Win_GetStockObject( WHITE_BRUSH ) ) + oObj := ::findObjectByHandle( nlParam ) + IF hb_isObject( oObj ) + IF oObj:clr_FG <> NIL + Win_SetTextColor( nwParam, oObj:clr_FG ) + RETURN ( Win_GetStockObject( WHITE_BRUSH ) ) + ENDIF + ENDIF + EXIT END RETURN Win_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )