2008-12-09 12:46 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/gtwvg/makefile
  * harbour/contrib/gtwvg/common.mak
    + wvghtmlv.prg

  * harbour/contrib/gtwvg/hbgtwvg.ch
    + HB_GTI_ACTIVATESELECTCOPY
    + HB_GTE_CTLCOLOR

  * harbour/contrib/gtwvg/gtwvg.c
    + hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY )
      This has the same effect as to activating the select/copy operation
      from the sys menu of the application. This way you can define
      any key to begin this operation as:

         SetKey( K_RBUTTONUP, {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } )

      and to start copy operation it will be enough to perform right
      click and then dragging the text with left button down.
    
      :TODO: Implementation in GTWVT.

  + harbour/contrib/gtwvg/wvghtmlv.prg
    + Added WvgHTMLViewer() class compatible with XbpHTMLViewer().
      It is a fully functional implementation as per Xbase++ documentation
      except for method :setHTML( cHTMLtext )

  * harbour/contrib/gtwvg/wvggui.c
    + Added evenh handlling for WV_CTLCOLOR* messages.

  * harbour/contrib/gtwvg/wvgwin.c
    + Added more winapi functions.

  * harbour/contrib/gtwvg/wvg3stat.prg
  * harbour/contrib/gtwvg/wvgax.prg
  * harbour/contrib/gtwvg/wvgcheck.prg
  * harbour/contrib/gtwvg/wvglistb.prg
  * harbour/contrib/gtwvg/wvgmle.prg
  * harbour/contrib/gtwvg/wvgphdlr.prg
  * harbour/contrib/gtwvg/wvgpushb.prg
  * harbour/contrib/gtwvg/wvgradio.prg
  * harbour/contrib/gtwvg/wvgsle.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
    ! Heavy changes especially in event handlling management.
    + ::setColorFG( nRGB ) and ::setColorBG( nRGB ) implemented for
      WvgSLE(), WvgMLE(), WvgStatic(), WvgCheckBox(), WvgRadioButton(),
      WvgTreeView(), WvgListBox().
  
  * harbour/contrib/gtwvg/tests/demowvg.prg
    ! Some finer additions.

  + harbour/contrib/gtwvg/tests/demoxbp.prg
    Added new demo with pure Xbase++ code clubbing all the committed classes
    till date including WvgHTMLViewer().
    ;
    Compile as : hbmk_b32 -mt demoxbp
This commit is contained in:
Pritpal Bedi
2008-12-09 21:32:44 +00:00
parent b46a548172
commit e0d79bbb7a
24 changed files with 1002 additions and 117 deletions

View File

@@ -8,6 +8,68 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-12-09 12:46 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/makefile
* harbour/contrib/gtwvg/common.mak
+ wvghtmlv.prg
* harbour/contrib/gtwvg/hbgtwvg.ch
+ HB_GTI_ACTIVATESELECTCOPY
+ HB_GTE_CTLCOLOR
* harbour/contrib/gtwvg/gtwvg.c
+ hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY )
This has the same effect as to activating the select/copy operation
from the sys menu of the application. This way you can define
any key to begin this operation as:
SetKey( K_RBUTTONUP, {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } )
and to start copy operation it will be enough to perform right
click and then dragging the text with left button down.
:TODO: Implementation in GTWVT.
+ harbour/contrib/gtwvg/wvghtmlv.prg
+ Added WvgHTMLViewer() class compatible with XbpHTMLViewer().
It is a fully functional implementation as per Xbase++ documentation
except for method :setHTML( cHTMLtext )
* harbour/contrib/gtwvg/wvggui.c
+ Added evenh handlling for WV_CTLCOLOR* messages.
* harbour/contrib/gtwvg/wvgwin.c
+ Added more winapi functions.
* harbour/contrib/gtwvg/wvg3stat.prg
* harbour/contrib/gtwvg/wvgax.prg
* harbour/contrib/gtwvg/wvgcheck.prg
* harbour/contrib/gtwvg/wvglistb.prg
* harbour/contrib/gtwvg/wvgmle.prg
* harbour/contrib/gtwvg/wvgphdlr.prg
* harbour/contrib/gtwvg/wvgpushb.prg
* harbour/contrib/gtwvg/wvgradio.prg
* harbour/contrib/gtwvg/wvgsle.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
! Heavy changes especially in event handlling management.
+ ::setColorFG( nRGB ) and ::setColorBG( nRGB ) implemented for
WvgSLE(), WvgMLE(), WvgStatic(), WvgCheckBox(), WvgRadioButton(),
WvgTreeView(), WvgListBox().
* harbour/contrib/gtwvg/tests/demowvg.prg
! Some finer additions.
+ harbour/contrib/gtwvg/tests/demoxbp.prg
Added new demo with pure Xbase++ code clubbing all the committed classes
till date including WvgHTMLViewer().
;
Compile as : hbmk_b32 -mt demoxbp
2008-12-08 16:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-mkslib.sh
! fixed last modification

View File

@@ -41,6 +41,7 @@ PRG_SOURCES=\
wvgbitmp.prg \
wvgsle.prg \
wvgmle.prg \
wvghtmlv.prg \
PRG_HEADERS=\
hbgtwvg.ch \

View File

@@ -35,6 +35,7 @@ LIB_OBJS = \
$(OBJ_DIR)wvgbitmp$(OBJEXT) \
$(OBJ_DIR)wvgsle$(OBJEXT) \
$(OBJ_DIR)wvgmle$(OBJEXT) \
$(OBJ_DIR)wvghtmlv$(OBJEXT) \
\
$(OBJ_DIR)gtwvg$(OBJEXT) \
$(OBJ_DIR)wvgcore$(OBJEXT) \

View File

@@ -3261,6 +3261,13 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
break;
}
case HB_GTI_ACTIVATESELECTCOPY:
{
if( pWVT->bSelectCopy )
{
pWVT->bBeginMarked = TRUE;
}
}
default:
return HB_GTSUPER_INFO( pGT, iType, pInfo );
}

View File

@@ -69,6 +69,7 @@
#define HB_GTE_MENU 9
#define HB_GTE_NOTIFY 10
#define HB_GTE_COMMAND 11
#define HB_GTE_CTLCOLOR 12
#define HB_GTI_SETFONT 71
#define HB_GTI_PRESPARAMS 72
@@ -76,6 +77,7 @@
#define HB_GTI_DISABLE 74
#define HB_GTI_SETFOCUS 75
#define HB_GTI_DEFERPAINT 76
#define HB_GTI_ACTIVATESELECTCOPY 77
/* Presentation Parameters | HB_GTI_PRESPARAMS */
#define HB_GTI_PP_EXSTYLE 1

View File

@@ -166,6 +166,10 @@ PROCEDURE Main()
CLS
Wvt_ShowWindow( SW_RESTORE )
SetKey( K_F12 , {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } )
SetKey( K_CTRL_V , {|| __KeyBoard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } )
SetKey( K_RBUTTONDOWN, {|| __KeyBoard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } )
hPopup := Wvt_SetPopupMenu()
oMenu := CreateMainMenu()
@@ -2371,9 +2375,9 @@ Function ExecuteActiveX( nActiveX, xParam )
oTBar := ActiveXBuildToolBar( oCrt, nActiveX )
//--------------------------- StatusBar ---------------------------\\
oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .t. )
oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .t. )
oSBar:panelClick := {|oPanel| Win_MessageBox( , oPanel:caption ) }
oPanel := oSBar:getItem( 1 )
oPanel := oSBar:getItem( 1 )
oPanel:caption := 'My Root Panel'
oPanel1 := oSBar:addItem()
oPanel1:caption := 'Ready'
@@ -2389,42 +2393,42 @@ Function ExecuteActiveX( nActiveX, xParam )
oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .t. )
//--------------------------- Static + Radio + Checkbox ----------\\
oStatic2 := WvgStatic():New( oCrt, , { 150, 150 }, { 500,310 }, , .f. )
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 ) )
oXbp := WvgPushButton():new( oStatic2 )
oXbp := WvgPushButton():new( oStatic2 )
oXbp:caption := "Hide"
oXbp:create( , , { 430,275 }, { 60,25 } )
oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) }
oRadio := WvgRadioButton():new( oStatic2,, { 10,10 }, { 100,15 } )
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 := WvgRadioButton():new( oStatic2,, { 10,35 }, { 100,15 } )
oRadio:caption := "Com 2"
oRadio:create()
oCheck := WvgCheckBox():New( oStatic2, , { 10,70 }, { 100,15 }, , .t. )
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' ) ) }
// Create first 3State button, passing the position to :create()
oXbp := Wvg3State():new()
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 := Wvg3State():new( oStatic2, , { 10,125 }, { 100,15 } )
oXbp:caption := "3 State B"
oXbp:create( oStatic2 )
// Determine current state using :getData()
@@ -2452,10 +2456,10 @@ Function ExecuteActiveX( nActiveX, xParam )
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' )
cText := MemoRead( 'hbmk_b32.bat' )
// Create MLE, specify position using :create() and
// assign data code block accessing LOCAL variable
oMLE := WvgMLE():new()
oMLE := WvgMLE():new()
oMLE:wordWrap := .F.
oMLE:border := .t.
oMLE:dataLink := {|x| IIf( x==NIL, cText, cText := x ) }
@@ -2530,6 +2534,7 @@ Function ExecuteActiveX( nActiveX, xParam )
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 ),;
IF( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ),;
oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" }
oCrt:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) }
@@ -2725,7 +2730,7 @@ Static Function ExeActiveX( nActiveX, oCom, xParam )
endif
do while .t.
nKey := inkey( 0.1 )
nKey := inkey()
//hb_ToOutDebug( "inkey() %i", nKey )
IF nActiveX == 2
oCom:Value := seconds()/86400

View File

@@ -0,0 +1,396 @@
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//
// EnOnkar
// ( The Lord is ONE )
// .
// Xbase++ Compatible XbpDialog() based Application
//
// Pritpal Bedi <pritpal@vouchcac.com>
// 08Dec2008
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
#include "inkey.ch"
#include "common.ch"
#include "wvtwin.ch"
#include "hbgtinfo.ch"
#include "hbgtwvg.ch"
#include "wvgparts.ch"
//----------------------------------------------------------------------//
FUNCTION Main()
Local oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2
LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE, oAddr
LOCAL oPanel, oPanel1, oPanel2, cText, cNavigate
LOCAL cVarA := "Test A", cVarB := "Test B"
LOCAL aState := {"not selected", "selected", "undefined"}
LOCAL aParts := {}
//--------------------------- Dialog -------------------------------\\
#if 1
oCrt := WvgDialog():new( , , { 30,30 }, { 900,600 }, , .f. )
oCrt:closable := .t.
oCrt:icon := "vr_1.ico"
oCrt:create()
#else
oCrt := WvgCrt():new( , , { 5,5 }, { 30,60 }, , .t. )
oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS
oCrt:closable := .t.
oCrt:create()
SetCursor( .f. )
#endif
//--------------------------- Menu --------------------------------\\
ActiveXBuildMenu( oCrt, @oStatic, @oStatic2 )
//--------------------------- ToolBar -----------------------------\\
oTBar := ActiveXBuildToolBar( oCrt )
//--------------------------- StatusBar ---------------------------\\
oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .t. )
oSBar:panelClick := {|oPanel| Win_MessageBox( , oPanel:caption ) }
oPanel := oSBar:getItem( 1 )
oPanel:caption := 'My Root Panel'
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. )
oStatic:setColorBG( RGB( 200,200,200 ) )
//--------------------------- 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( 175,175,175 ) )
oXbp := WvgPushButton():new( oStatic2 )
oXbp:caption := "Hide"
oXbp:create( , , { 430,275 }, { 60,25 } )
oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) }
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()
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' ) ) }
// 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:create( oStatic, , { 5, 55 }, { 107, 380 } )
oListBox:setColorFG( RGB( 218,61,34 ) )
//oListBox:setColorBG( RGB( 250,244,182 ) )
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, '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 ) // show selected 'XbpToolBar'
//--------------------------- PushButton --------------------------\\
oXbp := WvgPushButton():new( oStatic )
oXbp:caption := "Hide"
oXbp:create( , , { 20,440 }, {80,30} )
oXbp:activate:= {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) }
//--------------------------- 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. )
oTree:hasLines := .T.
oTree:hasButtons := .T.
oTree:alwaysShowSelection := .T.
oTree:create()
oTree:setColorBG( RGB( 120,15,240 ) )
oTree:setColorFG( RGB( 15,240,120 ) )
oTree:itemSelected := {|oItem| IF( oItem <> NIL, Win_MessageBox( , oItem:caption ), NIL ) }
oItem1 := oTree:rootItem:addItem( "First level A" )
oTree:rootItem:addItem( "First level B" )
oItem2 := oItem1:addItem( "Second level A" )
oItem1:addItem( "Second level B" )
oItem2:addItem( "Third level A" )
oItem2:addItem( "Third level B" )
oItem2:addItem( "Third level C" )
#if 0
oItem1:expand( .t. )
#else
oTree:showExpanded( .t., 2 )
#endif
oTree:setData( oItem2 )
//--------------------------- Active-X ---------------------------\\
hb_gtInfo( HB_GTI_WINTITLE, 'http://www.harbour.vouch.info' )
#if 0
oCom := WvgActiveXControl():New( oCrt, , { 0, 0 }, { 100, 100 }, , .t. )
oCom:CLSID := 'Shell.Explorer.2'
oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } )
#else
oCom := WvgHTMLViewer():New( oCrt, , { 0, 0 }, { 100, 100 }, , .t. )
oCom:beforeNavigate := {|cURL, x, oHTML| x := x, oHTML := oHTML, oPanel:caption := cURL }
oCom:statusTextChange := {|cText| oPanel:caption := cText }
#endif
oCom:create()
oCom:Navigate( 'http://www.harbour.vouch.info' )
oAddr := WvgSLE():new()
oAddr:bufferLength := 500
oAddr:border := .t.
cNavigate := 'http://www.harbour.vouch.info'
oAddr:dataLink := {|x| iif( x == NIL, cNavigate, cNavigate := x ) }
oAddr:setColorFG( RGB( 0,0,255 ) )
oAddr:setColorBG( RGB( 0,255,255 ) )
oAddr:create( oCrt, , { 120, oTBar:currentSize()[2] }, { 500,20 }, , .t. )
oAddr:setData()
oAddr:killInputFocus := {|m1,m2,oS| m1:=m1, m2:=m2, oS:getData(), oCom:navigate( cNavigate ) }
//--------------------------- Misc Config ------------------------\\
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 ),;
IF( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ),;
oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" }
oCrt:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr ) }
oCrt:sendMessage( WM_SIZE, 0, 0 )
oCrt:show()
DO WHILE .t.
IF inkey() == 27
EXIT
ENDIF
ENDDO
oCrt:Destroy()
Return nil
//----------------------------------------------------------------------//
STATIC FUNCTION ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr )
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. )
oAddr:setPosAndSize( { 120, nT+2 }, { aCrt[1]-120-150, 20 }, .t. )
oCom:setPosAndSize( { 120, nT+2+20 }, { aCrt[1]-120-150, nH-20 }, .t. )
oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .t. )
ELSE
oAddr:setPosAndSize( { 0, nT+2 }, { aCrt[1]-150, 20 }, .t. )
oCom:setPosAndSize( { 0, nT+2+20 }, { aCrt[1]-150, nH-20 }, .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()
// Define submenu in procedural style.
// The numeric index of the selected menu item
// is passed to the Callback code block -> mp1
oSubMenu := WvgMenu():new( oMenuBar ):create()
oSubMenu:title := "~Procedural"
oSubMenu:addItem( { "Play Charge ~1", } )
oSubMenu:addItem( { "Play Nannyboo ~2", } )
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
oSubMenu := WvgMenu():new( oMenuBar ):create()
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 )
LOCAL oTBar
oTBar := WvgToolBar():new( oCrt , , { 0,0 }, { oCrt:currentSize()[ 1 ], 30 }, , .T. )
oTBar:borderStyle := WVGFRAME_RECT
oTBar:buttonWidth := 28
oTBar:buttonHeight := 26
oTBar:imageWidth := 26
oTBar:imageHeight := 24
oTBar:showToolTips := .f.
oTBar:create()
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( "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' )
RETURN oTBar
//----------------------------------------------------------------------//
Static Function MyFunction( nMode )
#define MUSIC_WAITON {800, 1600}
do case
case nMode == 1
tone( MUSIC_WAITON[1], 1 )
tone( MUSIC_WAITON[2], 1 )
case nMode == 2
tone( MUSIC_WAITON[2], 1 )
tone( MUSIC_WAITON[1], 1 )
case nMode == 3
Win_MessageBox( , "Button clicked!" )
case nMode == 101 // Charge
Eval( {|| tone(523,2),tone(698,2),tone(880,2),tone(1046,4),tone(880,2),tone(1046,8) } )
case nMode == 102 // NannyBoo
AEval( {{196,2},{196,2},{164,2},{220,2},{196,4},{164,4}}, {|a| tone(a[1],a[2]) } )
case nMode == 103 // BADKEY
tone( 480,0.25 )
tone( 240,0.25 )
endcase
Return nil
//----------------------------------------------------------------------//
Function HB_GTSYS()
REQUEST HB_GT_GUI_DEFAULT
REQUEST HB_GT_WVG
REQUEST HB_GT_WVT
REQUEST HB_GT_WGU
Return NIL
//----------------------------------------------------------------------//

View File

@@ -151,9 +151,9 @@ METHOD handleEvent( nMessage, aNM ) CLASS Wvg3State
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
SWITCH nMessage
DO CASE
CASE WM_COMMAND
CASE nMessage == HB_GTE_COMMAND
IF aNM[ NMH_code ] == BN_CLICKED
::editBuffer := Win_Button_GetCheck( ::hWnd )
@@ -163,9 +163,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS Wvg3State
ENDIF
ENDIF
EXIT
END
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN 1

View File

@@ -79,20 +79,6 @@
STATIC nRef := 0
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//
// EkOnkar
// ( The LORD is ONE )
//
// Xbase++ Compatible xhbActiveXControl Class
//
// Pritpal Bedi <pritpal@vouchcac.com>
// 08Nov2008
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
CLASS WvgActiveXControl FROM TOleAuto, WvgWindow

View File

@@ -154,9 +154,9 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
SWITCH nMessage
DO CASE
CASE WM_COMMAND
CASE nMessage == HB_GTE_COMMAND
IF aNM[ NMH_code ] == BN_CLICKED
::editBuffer := ( Win_Button_GetCheck( ::hWnd ) == BST_CHECKED )
@@ -166,9 +166,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox
ENDIF
ENDIF
EXIT
END
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN 1

View File

@@ -387,12 +387,14 @@ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey )
if( iPos != pWVT->keyPointerOut )
pWVT->keyPointerIn = iPos;
#if 0
/* Fire event to be trapped by the application */
{
PHB_ITEM pEvParams = hb_itemNew( NULL );
hb_itemPutNI( pEvParams, iKey );
hb_gt_wvt_FireEvent( pWVT, HB_GTE_KEYBOARD, pEvParams );
}
#endif
}
static BOOL hb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey )
@@ -1148,7 +1150,10 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
case WM_CLOSE: /* Clicked 'X' on system menu */
{
PHB_ITEM pEvParams = hb_itemNew( NULL );
hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE, pEvParams );
if( hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE, pEvParams ) == 0 )
{
hb_gt_wvt_AddCharToInputQueue( pWVT, 27 ); // post ESCape
}
return 0;
}
case WM_QUIT:
@@ -1156,6 +1161,29 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
{
return 0;
}
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC:
{
int iResult;
PHB_ITEM pEvParams = hb_itemNew( NULL );
hb_arrayNew( pEvParams, 2 );
hb_arraySetNInt( pEvParams, 1, ( HB_PTRDIFF ) wParam );
hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) lParam );
iResult = hb_gt_wvt_FireEvent( pWVT, HB_GTE_CTLCOLOR, pEvParams );
if( iResult == 0 )
break;
else
return( iResult );
}
}
return DefWindowProc( hWnd, message, wParam, lParam );

View File

@@ -0,0 +1,254 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the Wvg*Classes
*
* Copyright 2008 Andy Wos
* Copyright 2008 Pritpal Bedi <pritpal@vouchcac.com>
* http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//
// EkOnkar
// ( The LORD is ONE )
//
// Xbase++ xbpHtmlViewer compatible Class
//
// Pritpal Bedi <pritpal@vouchcac.com>
// 08Dec2008
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
#include 'hbclass.ch'
#include 'common.ch'
#include 'inkey.ch'
#include 'hbgtinfo.ch'
#include 'hbgtwvg.ch'
#include 'wvtwin.ch'
#include 'wvgparts.ch'
//----------------------------------------------------------------------//
#define evBeforeNavigate 100 //
#define evNavigateComplete 101 //
#define evStatusTextChange 102 //
#define evDownloadComplete 104
#define evCommandStateChange 105
#define evDownloadBegin 106
#define evProgressChange 108 //
#define evTitleChange 113 //
#define evPropertyChange 112
#define evBeforeNavigate2 250
#define evNavigateComplete2 252
#define evDocumentComplete 259 //
#define evNavigateError 271
//----------------------------------------------------------------------//
CLASS WvgHTMLViewer INHERIT WvgActiveXControl
METHOD new()
METHOD create()
METHOD setHTML( cHTML )
METHOD back() INLINE ::goBack()
METHOD forward() INLINE ::goForward()
METHOD home() INLINE ::goHome()
METHOD search() INLINE ::goSearch()
METHOD isBusy() INLINE ::busy()
DATA sl_beforeNavigate PROTECTED
ACCESS beforeNavigate INLINE ::sl_beforeNavigate
ASSIGN beforeNavigate( bBlock ) INLINE ::sl_beforeNavigate := bBlock
METHOD xBeforeNavigate()
DATA sl_navigateComplete PROTECTED
ACCESS navigateComplete INLINE ::sl_navigateComplete
ASSIGN navigateComplete( bBlock ) INLINE ::sl_navigateComplete := bBlock
METHOD xNavigateComplete()
DATA sl_statusTextChange PROTECTED
ACCESS statusTextChange INLINE ::sl_statusTextChange
ASSIGN statusTextChange( bBlock ) INLINE ::sl_statusTextChange := bBlock
METHOD xStatusTextChange()
DATA sl_progressChange PROTECTED
ACCESS progressChange INLINE ::sl_progressChange
ASSIGN progressChange( bBlock ) INLINE ::sl_progressChange := bBlock
METHOD xProgressChange()
DATA sl_titleChange PROTECTED
ACCESS titleChange INLINE ::sl_titleChange
ASSIGN titleChange( bBlock ) INLINE ::sl_titleChange := bBlock
METHOD xTitleChange()
DATA sl_documentComplete PROTECTED
ACCESS documentComplete INLINE ::sl_documentComplete
ASSIGN documentComplete( bBlock ) INLINE ::sl_documentComplete := bBlock
METHOD xDocumentComplete()
DATA CLSID INIT 'Shell.Explorer' PROTECTED
ENDCLASS
//----------------------------------------------------------------------//
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgHTMLViewer
::initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
//----------------------------------------------------------------------//
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgHTMLViewer
::initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::mapEvent( evBeforeNavigate, {| cURL, Flags, TFName, PData, Headers | ;
::xBeforeNavigate( cURL, Flags, TFName, PData, Headers ) } )
::mapEvent( evStatusTextChange, {| cText| ::xStatusTextChange( cText ) } )
::mapEvent( evNavigateComplete, {| cURL | ::xNavigateComplete( cURL ) } )
::mapEvent( evProgressChange , {| nProgress, nProgMax | ::xProgressChange( nProgress, nProgMax ) } )
::mapEvent( evTitleChange , {| cTitle | ::xTitleChange( cTitle ) } )
::mapEvent( evDocumentComplete, {| cURI | ::xDocumentComplete( cURI ) } )
::WvgActiveXControl:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
//----------------------------------------------------------------------//
METHOD xBeforeNavigate( cURL, Flags, TFName, PData, Headers ) CLASS WvgHTMLViewer
HB_SYMBOL_UNUSED( Flags )
HB_SYMBOL_UNUSED( TFName )
HB_SYMBOL_UNUSED( PData )
HB_SYMBOL_UNUSED( Headers )
IF PCount() >= 1 .and. hb_isBlock( ::sl_beforeNavigate )
eval( ::sl_beforeNavigate, cURL, NIL, Self )
RETURN nil
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD xStatusTextChange( cText ) CLASS WvgHTMLViewer
IF hb_isBlock( ::sl_statusTextChange )
eval( ::sl_statusTextChange, cText, NIL, Self )
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD xNavigateComplete( cURL )
IF hb_isBlock( ::sl_navigateComplete )
eval( ::sl_navigateComplete, cURL, NIL, Self )
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD xProgressChange( nProgress, nProgMax ) CLASS WvgHTMLViewer
IF hb_isBlock( ::sl_progressChange )
eval( ::sl_progressChange, nProgress, nProgMax, Self )
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD xTitleChange( cTitle )
IF hb_isBlock( ::sl_titleChange )
eval( ::sl_titleChange, cTitle, NIL, Self )
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD xDocumentComplete( cURI )
IF hb_isBlock( ::sl_documentComplete )
eval( ::sl_documentComplete, cURI, NIL, Self )
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD setHTML( cHTML ) CLASS WvgHTMLViewer
::document:innerHTML := cHTML
::refresh()
RETURN self
//----------------------------------------------------------------------//

View File

@@ -194,13 +194,12 @@ 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
DO CASE
CASE WM_COMMAND
CASE nMessage == HB_GTE_COMMAND
IF aNM[ 1 ] == LBN_SELCHANGE
::nCurSelected := Win_LbGetCurSel( ::hWnd )+ 1
@@ -216,15 +215,24 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgListBox
ENDIF
ENDIF
EXIT
CASE WM_SIZE
CASE nMessage == HB_GTE_RESIZED
::sendMessage( WM_SIZE, 0, 0 )
RETURN 0
END
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
RETURN nHandled
ENDCASE
RETURN 0
//----------------------------------------------------------------------//
@@ -240,6 +248,8 @@ METHOD destroy() CLASS WvgListBox
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::WvgWindow:destroy()
#if 0
IF Len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
::aChildren := {}
@@ -249,7 +259,7 @@ METHOD destroy() CLASS WvgListBox
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL
//----------------------------------------------------------------------//

View File

@@ -195,7 +195,8 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgMLE
hb_ToOutDebug( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage )
IF nMessage == WM_COMMAND
DO CASE
CASE nMessage == HB_GTE_COMMAND
DO CASE
CASE aNM[ NMH_code ] == EN_CHANGE
::changed := .t.
@@ -225,9 +226,21 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgMLE
ENDIF
ENDCASE
ENDIF
RETURN 1
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN 0
//----------------------------------------------------------------------//
@@ -235,6 +248,8 @@ METHOD destroy() CLASS WvgMLE
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
@@ -242,6 +257,7 @@ METHOD destroy() CLASS WvgMLE
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL

View File

@@ -235,7 +235,7 @@ METHOD setParent( oWvg ) CLASS WvgPartHandler
//----------------------------------------------------------------------//
METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler
Local aPos, aMenuItem, nIndex, nCtrlID
Local aPos, aMenuItem, nIndex, nCtrlID, oObj
LOCAL nReturn := 0
DO CASE
@@ -337,19 +337,12 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler
ENDIF
::lHasInputFocus := .f.
CASE nEvent == HB_GTE_RESIZED
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, { xParams[ 1 ], xParams[ 2 ] }, { xParams[ 3 ], xParams[ 4 ] }, Self )
ENDIF
aeval( ::aChildren, {|o| o:handleEvent( WM_SIZE, { 0, 0, 0, 0, 0 } ) } )
CASE nEvent == HB_GTE_CLOSE
IF hb_isBlock( ::close )
nReturn := eval( ::close, NIL, NIL, Self )
ENDIF
CASE nEvent == HB_GTE_MENU
DO CASE
CASE xParams[ 1 ] == 0 // menu selected
IF hb_isObject( ::oMenu )
@@ -376,22 +369,28 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler
ENDCASE
CASE nEvent == HB_GTE_RESIZED
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, { xParams[ 1 ], xParams[ 2 ] }, { xParams[ 3 ], xParams[ 4 ] }, Self )
ENDIF
aeval( ::aChildren, {|o| o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } )
CASE nEvent == HB_GTE_NOTIFY
nCtrlID := xParams[ 1 ]
IF ( nIndex := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) ) > 0
RETURN ( ::aChildren[ nIndex ]:handleEvent( WM_NOTIFY, xParams ) )
RETURN ( ::aChildren[ nIndex ]:handleEvent( HB_GTE_NOTIFY, xParams ) )
ENDIF
CASE nEvent == HB_GTE_COMMAND
nCtrlID := xParams[ 2 ] // Control Identifier
nCtrlID := xParams[ 2 ]
IF ( nIndex := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) ) > 0
DO CASE
CASE xParams[ 1 ] == BN_CLICKED
IF hb_isBlock( ::aChildren[ nIndex ]:sl_lbClick )
eval( ::aChildren[ nIndex ]:sl_lbClick, NIL, NIL, ::aChildren[ nIndex ] )
ENDIF
ENDCASE
RETURN ::aChildren[ nIndex ]:handleEvent( HB_GTE_COMMAND, xParams )
ENDIF
CASE nEvent == HB_GTE_CTLCOLOR
oObj := ::findObjectByHandle( xParams[ 2 ] )
IF hb_isObject( oObj )
RETURN oObj:handleEvent( HB_GTE_CTLCOLOR, xParams )
ENDIF
ENDCASE

View File

@@ -105,6 +105,9 @@ CLASS WvgPushButton INHERIT WvgWindow
METHOD handleEvent( nEvent, aInfo )
METHOD setColorFG() INLINE NIL
METHOD setColorBG() INLINE NIL
ENDCLASS
//----------------------------------------------------------------------//
@@ -145,35 +148,40 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPu
//----------------------------------------------------------------------//
METHOD handleEvent( nMessage, aInfo ) CLASS WvgPushButton
LOCAL nHandled := 0
METHOD handleEvent( nMessage, aNM ) CLASS WvgPushButton
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
HB_SYMBOL_UNUSED( aInfo )
DO CASE
SWITCH nMessage
CASE WM_SIZE
CASE nMessage == HB_GTE_RESIZED
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, NIL, NIL, self )
nHandled := 0
RETURN 0
ENDIF
EXIT
CASE WM_COMMAND
CASE nMessage == HB_GTE_COMMAND
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
RETURN 0
ENDIF
EXIT
CASE WM_NOTIFY
CASE nMessage == HB_GTE_NOTIFY
EXIT
END
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
RETURN nHandled
ENDCASE
RETURN 1
//----------------------------------------------------------------------//

View File

@@ -151,7 +151,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgRadioButton
SWITCH nMessage
CASE WM_COMMAND
CASE HB_GTE_COMMAND
IF aNM[ NMH_code ] == BN_CLICKED
::editBuffer := ( Win_Button_GetCheck( ::hWnd ) == BST_CHECKED )

View File

@@ -191,7 +191,8 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE
hb_ToOutDebug( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage )
IF nMessage == WM_COMMAND
DO CASE
CASE nMessage == HB_GTE_COMMAND
DO CASE
CASE aNM[ NMH_code ] == EN_CHANGE
::changed := .t.
@@ -211,7 +212,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE
ENDIF
ENDCASE
ENDIF
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN 1
@@ -221,6 +234,8 @@ METHOD destroy() CLASS WvgSLE
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
@@ -228,6 +243,7 @@ METHOD destroy() CLASS WvgSLE
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL

View File

@@ -156,21 +156,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatusBar
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
SWITCH nMessage
DO CASE
CASE WM_SIZE
CASE nMessage == HB_GTE_RESIZED
::sendMessage( WM_SIZE, 0, 0 )
RETURN 0
CASE WM_COMMAND
CASE nMessage == HB_GTE_COMMAND
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
RETURN 0
ENDIF
nHandled := 0
EXIT
CASE WM_NOTIFY
CASE nMessage == HB_GTE_NOTIFY
aNMH := Wvg_GetNMMouseInfo( aNM[ 2 ] )
DO CASE
@@ -189,8 +187,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatusBar
ENDIF
ENDCASE
EXIT
END
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN nHandled
@@ -207,11 +216,14 @@ METHOD destroy() CLASS WvgStatusBar
NEXT
ENDIF
::WvgWindow:destroy()
#if 0
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL
//----------------------------------------------------------------------//

View File

@@ -253,20 +253,30 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt
//----------------------------------------------------------------------//
METHOD handleEvent( nMessage/*, aNM */) CLASS WvgStatic
METHOD handleEvent( nMessage, aNM ) CLASS WvgStatic
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
SWITCH nMessage
DO CASE
CASE WM_SIZE
CASE nMessage == HB_GTE_RESIZED
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, NIL, NIL, self )
RETURN ( 0 )
ENDIF
EXIT
END
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
Win_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN ( 1 )
@@ -276,6 +286,8 @@ METHOD destroy() CLASS WvgStatic
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
@@ -283,7 +295,7 @@ METHOD destroy() CLASS WvgStatic
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL
//----------------------------------------------------------------------//

View File

@@ -195,14 +195,14 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgToolBar
SWITCH nMessage
CASE WM_SIZE
CASE HB_GTE_RESIZED
::sendMessage( WM_SIZE, 0, 0 )
RETURN 0
CASE WM_COMMAND
CASE HB_GTE_COMMAND
EXIT
CASE WM_NOTIFY
CASE HB_GTE_NOTIFY
aNMMouse := Wvg_GetNMMouseInfo( aNM[ 2 ] )
DO CASE

View File

@@ -194,18 +194,18 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView
SWITCH nMessage
CASE WM_SIZE
CASE HB_GTE_RESIZED
::sendMessage( WM_SIZE, 0, 0 )
RETURN 0
CASE WM_COMMAND
CASE HB_GTE_COMMAND
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
nHandled := 0
ENDIF
EXIT
CASE WM_NOTIFY
CASE HB_GTE_NOTIFY
aHdr := Wvg_GetNMHdrInfo( aNM[ 2 ] )
aNMHdr := Wvg_GetNMTreeViewInfo( aNM[ 2 ] )
@@ -255,6 +255,9 @@ METHOD destroy() CLASS WvgTreeView
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
@@ -263,6 +266,7 @@ METHOD destroy() CLASS WvgTreeView
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL

View File

@@ -86,13 +86,15 @@
//#define wvg_parwparam( n ) ( ( WPARAM ) hb_parnint( n ) )
//#define wvg_parlparam( n ) ( ( LPARAM ) hb_parnint( n ) )
#define wvg_parwparam( n ) ( ( WPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parlparam( n ) ( ( LPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parhandle( n ) ( ( HANDLE ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parhwnd( n ) ( ( HWND ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parwndproc( n ) ( ( WNDPROC )( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parwparam( n ) ( ( WPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parlparam( n ) ( ( LPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parhandle( n ) ( ( HANDLE ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parhwnd( n ) ( ( HWND ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parwndproc( n ) ( ( WNDPROC ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parhdc( n ) ( ( HDC ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_parcolor( n ) ( ( COLORREF )( HB_PTRDIFF ) hb_parnint( n ) )
#define wvg_rethandle( n ) ( hb_retnint( ( HB_PTRDIFF ) n ) )
#define wvg_parcolor( n ) ( ( COLORREF ) hb_parnint( n ) )
//----------------------------------------------------------------------//
@@ -1715,5 +1717,19 @@ HB_FUNC( WIN_BUTTON_GETCHECK )
//----------------------------------------------------------------------//
HB_FUNC( WIN_GETCURRENTOBJECT )
{
wvg_rethandle( GetCurrentObject( wvg_parhdc( 1 ), hb_parni( 2 ) ) );
}
//----------------------------------------------------------------------//
HB_FUNC( WIN_GETCURRENTBRUSH )
{
wvg_rethandle( GetCurrentObject( wvg_parhdc( 1 ), OBJ_BRUSH ) );
}
//----------------------------------------------------------------------//

View File

@@ -77,7 +77,7 @@
//----------------------------------------------------------------------//
#ifndef __DBG_PARTS__
#xtranslate hb_ToOutDebug( [<x,...>] ) =>
//#xtranslate hb_ToOutDebug( [<x,...>] ) =>
#endif
//----------------------------------------------------------------------//
@@ -169,7 +169,8 @@ EXPORTED:
METHOD winDevice()
// SETTINGS
METHOD setColorBG( nRGB ) INLINE ::clr_BG := nRGB
DATA hBrushBG
METHOD setColorBG( nRGB )
METHOD setColorFG( nRGB ) INLINE ::clr_FG := nRGB, ::invalidateRect()
METHOD setFont()
METHOD setFontCompoundName()
@@ -341,6 +342,10 @@ METHOD destroy() CLASS WvgWindow
ENDIF
hb_FreeCallBack( ::nWndProc )
IF ::hBrushBG <> NIL
Win_DeleteObject( ::hBrushBG )
ENDIF
RETURN Self
//----------------------------------------------------------------------//
@@ -402,6 +407,21 @@ METHOD lockUpdate() CLASS WvgWindow
//----------------------------------------------------------------------//
METHOD setColorBG( nRGB ) CLASS WvgWindow
LOCAL hBrush
IF hb_isNumeric( nRGB )
hBrush := Win_CreateBrush( BS_SOLID, nRGB, 0 )
IF hBrush <> 0
::clr_BG := nRGB
::hBrushBG := hBrush
ENDIF
ENDIF
RETURN Self
//----------------------------------------------------------------------//
METHOD setModalState() CLASS WvgWindow
RETURN Self
@@ -1163,7 +1183,7 @@ METHOD createControl() CLASS WvgWindow
//----------------------------------------------------------------------//
METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj
LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj, nReturn
#if 0
hb_ToOutDebug( "%s:wndProc( %i %i %i %i )", __ObjGetClsName( self ), hWnd, nMessage, nwParam, nlParam )
@@ -1191,7 +1211,7 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
RETURN 0
ELSE
IF ( nObj := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) ) > 0
RETURN ::aChildren[ nObj ]:handleEvent( WM_COMMAND, { nNotifctn, nCtrlID, hWndCtrl } )
RETURN ::aChildren[ nObj ]:handleEvent( HB_GTE_COMMAND, { nNotifctn, nCtrlID, hWndCtrl } )
ENDIF
ENDIF
@@ -1199,17 +1219,27 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
CASE WM_NOTIFY
IF ( nObj := ascan( ::aChildren, {| o | o:nID == nwParam } ) ) > 0
RETURN ::aChildren[ nObj ]:handleEvent( WM_NOTIFY, { nwParam, nlParam } )
RETURN ::aChildren[ nObj ]:handleEvent( HB_GTE_NOTIFY, { nwParam, nlParam } )
ENDIF
EXIT
CASE WM_CTLCOLORLISTBOX
CASE WM_CTLCOLORMSGBOX
CASE WM_CTLCOLOREDIT
CASE WM_CTLCOLORBTN
CASE WM_CTLCOLORDLG
CASE WM_CTLCOLORSCROLLBAR
CASE WM_CTLCOLORSTATIC
oObj := ::findObjectByHandle( nlParam )
IF hb_isObject( oObj )
IF oObj:clr_FG <> NIL
Win_SetTextColor( nwParam, oObj:clr_FG )
RETURN ( Win_GetStockObject( WHITE_BRUSH ) )
nReturn := oObj:handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } )
IF nReturn == 0
RETURN Win_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )
ELSE
RETURN nReturn
ENDIF
ENDIF