2009-02-22 19:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/gtwvg/wvgwin.c
  * harbour/contrib/gtwvg/wvg3stat.prg
  * harbour/contrib/gtwvg/wvgcheck.prg
  * harbour/contrib/gtwvg/wvgcombo.prg
  * harbour/contrib/gtwvg/wvgdarea.prg
  * harbour/contrib/gtwvg/wvglistb.prg
  * harbour/contrib/gtwvg/wvgmle.prg
  * harbour/contrib/gtwvg/wvgpushb.prg
  * harbour/contrib/gtwvg/wvgradio.prg
  * harbour/contrib/gtwvg/wvgscrlb.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
    ! Code cleanup.
    ! Implemented generic callback functionality taking 
      use of SetProp()/GetProp() functions of WINAPI. It 
      effectively eliminates the use of AsCallBack() 
      function which has been discussed as non-scalable
      in multi-processor architect.

    ; TODO: To use hb_gcAlloc() mechanism to hold the 
            codeblock. Please review wvgwnd():SetWindowProcCallback()
            and wvgwin:WVG_SetWindowProcBlock( ::hWnd, bBlock ).
            I did try but could not resolve it properly.
This commit is contained in:
Pritpal Bedi
2009-02-23 03:40:33 +00:00
parent 21baf7c58a
commit 643d0291d2
17 changed files with 238 additions and 221 deletions

View File

@@ -8,6 +8,36 @@
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-02-22 19:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/wvgwin.c
* harbour/contrib/gtwvg/wvg3stat.prg
* harbour/contrib/gtwvg/wvgcheck.prg
* harbour/contrib/gtwvg/wvgcombo.prg
* harbour/contrib/gtwvg/wvgdarea.prg
* harbour/contrib/gtwvg/wvglistb.prg
* harbour/contrib/gtwvg/wvgmle.prg
* harbour/contrib/gtwvg/wvgpushb.prg
* harbour/contrib/gtwvg/wvgradio.prg
* harbour/contrib/gtwvg/wvgscrlb.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
! Code cleanup.
! Implemented generic callback functionality taking
use of SetProp()/GetProp() functions of WINAPI. It
effectively eliminates the use of AsCallBack()
function which has been discussed as non-scalable
in multi-processor architect.
; TODO: To use hb_gcAlloc() mechanism to hold the
codeblock. Please review wvgwnd():SetWindowProcCallback()
and wvgwin:WVG_SetWindowProcBlock( ::hWnd, bBlock ).
I did try but could not resolve it properly.
2009-02-22 22:39 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* make_vc.mak
! Added workaround for WinCE mode.

View File

@@ -106,7 +106,7 @@ CLASS Wvg3State INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3State
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + BS_AUTO3STATE
::className := 'BUTTON'
@@ -118,18 +118,13 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3Stat
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3State
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
IF ::visible
::show()
@@ -141,6 +136,10 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wvg3S
::sendMessage( BM_SETCHECK, BST_CHECKED, 0 )
ENDIF
IF ::visible
::show()
ENDIF
::editBuffer := Win_Button_GetCheck( ::hWnd )
RETURN Self
@@ -185,13 +184,7 @@ METHOD destroy() CLASS Wvg3State
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
::WvgWindow:destroy()
RETURN NIL

View File

@@ -123,16 +123,11 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCh
::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 )
::SetWindowProcCallback()
IF ::visible
::show()
@@ -188,13 +183,7 @@ 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 )
::wvgWindow:destroy()
RETURN NIL

View File

@@ -105,14 +105,12 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCo
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
::oParent:AddChild( SELF )
::createControl()
::SetWindowProcCallback()
IF ::visible
::show()
ENDIF
@@ -131,6 +129,8 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv
METHOD destroy() CLASS WvgComboBox
::wvgWindow:destroy()
RETURN NIL
//----------------------------------------------------------------------//

View File

@@ -98,9 +98,7 @@ CLASS WvgDrawingArea INHERIT WvgWindow
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDrawingArea
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD
::exStyle := 0
@@ -116,7 +114,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDr
HB_SYMBOL_UNUSED( lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, .t. )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, .t. )
::oParent:addChild( SELF )
@@ -124,10 +122,10 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDr
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self, 4 )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
::show()
RETURN Self
//----------------------------------------------------------------------//
@@ -169,7 +167,7 @@ METHOD destroy() CLASS WvgDrawingArea
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::WvgWindow:destroy()
::wvgWindow:destroy()
RETURN NIL

View File

@@ -148,9 +148,7 @@ CLASS WvgListBox INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + WS_OVERLAPPED + WS_TABSTOP + LBS_NOTIFY
::exStyle := WS_EX_CLIENTEDGE + WS_EX_LEFT + WS_EX_LTRREADING + WS_EX_RIGHTSCROLLBAR
@@ -163,11 +161,8 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListB
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
IF ::horizScroll
::style += WS_HSCROLL
ENDIF
@@ -179,11 +174,10 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgLi
ENDIF
::oParent:AddChild( SELF )
//
::createControl()
::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
//
::SetWindowProcCallback()
IF ::visible
::show()
@@ -249,17 +243,7 @@ METHOD destroy() CLASS WvgListBox
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::WvgWindow:destroy()
#if 0
IF Len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
::aChildren := {}
ENDIF
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
RETURN NIL
//----------------------------------------------------------------------//

View File

@@ -136,7 +136,7 @@ CLASS WvgMLE INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgMLE
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + ES_MULTILINE + ES_WANTRETURN
::exStyle := WS_EX_CLIENTEDGE
@@ -149,11 +149,8 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgMLE
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgMLE
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
IF ::tabStop
::style += WS_TABSTOP
ENDIF
@@ -177,11 +174,10 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgML
ENDIF
::oParent:addChild( Self )
//
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
//
::SetWindowProcCallback()
IF ::visible
::show()
@@ -248,16 +244,7 @@ METHOD destroy() CLASS WvgMLE
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
::wvgWindow:destroy()
RETURN NIL

View File

@@ -113,7 +113,7 @@ CLASS WvgPushButton INHERIT WvgWindow
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPushButton
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + BS_PUSHBUTTON //+ BS_NOTIFY + BS_PUSHLIKE
::className := 'BUTTON'
@@ -125,18 +125,13 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPushB
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPushButton
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
//
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
//
::SetWindowProcCallback()
IF ::visible
::show()
@@ -157,13 +152,13 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgPushButton
CASE nMessage == HB_GTE_RESIZED
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, NIL, NIL, self )
RETURN 0
RETURN EVENT_HANDELLED
ENDIF
CASE nMessage == HB_GTE_COMMAND
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
RETURN 0
RETURN EVENT_HANDELLED
ENDIF
CASE nMessage == HB_GTE_NOTIFY
@@ -175,13 +170,11 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgPushButton
IF hb_isNumeric( ::hBrushBG )
Win_SetBkMode( aNM[ 1 ], 1 )
RETURN ( ::hBrushBG )
ELSE
RETURN Win_GetCurrentBrush( aNM[ 1 ] )
ENDIF
ENDCASE
RETURN 1
RETURN EVENT_UNHANDELLED
//----------------------------------------------------------------------//
@@ -189,14 +182,7 @@ METHOD destroy() CLASS WvgPushButton
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 )
::wvgWindow:destroy()
RETURN NIL

View File

@@ -106,7 +106,7 @@ CLASS WvgRadioButton INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgRadioButton
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + BS_AUTORADIOBUTTON
::className := 'BUTTON'
@@ -118,18 +118,13 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgRadio
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgRadioButton
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:addChild( SELF )
//
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
//
::SetWindowProcCallback()
IF ::visible
::show()
@@ -172,13 +167,7 @@ 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 )
::wvgWindow:destroy()
RETURN NIL

View File

@@ -152,9 +152,7 @@ CLASS WvgScrollBar INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgScrollBar
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD //+ SBS_SIZEBOX //+ SBS_SIZEGRIP
::className := "SCROLLBAR"
@@ -166,7 +164,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgScrol
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgScrollBar
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::type == WVGSCROLL_VERTICAL
::style += SBS_VERT
@@ -178,8 +176,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSc
::createControl()
::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
::setRange( ::range )
@@ -359,7 +356,7 @@ METHOD destroy() CLASS WvgScrollBar
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::WvgWindow:destroy()
::wvgWindow:destroy()
RETURN NIL

View File

@@ -128,7 +128,7 @@ CLASS WvgSLE INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD
::className := 'EDIT'
@@ -141,14 +141,11 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE
LOCAL es_:= { ES_LEFT, ES_RIGHT, ES_CENTER }
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style += es_[ ::align ]
::style += ES_AUTOHSCROLL
IF ::visible
::style += WS_VISIBLE
ENDIF
IF ::tabStop
::style += WS_TABSTOP
ENDIF
@@ -169,8 +166,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSL
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
IF ::visible
::show()
@@ -233,16 +229,7 @@ METHOD destroy() CLASS WvgSLE
hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
::wvgWindow:destroy()
RETURN NIL

View File

@@ -82,7 +82,7 @@
//----------------------------------------------------------------------//
CLASS WvgStatusBar INHERIT WvgActiveXControl
CLASS WvgStatusBar INHERIT WvgWindow //WvgActiveXControl
DATA caption INIT ''
DATA sizeGrip INIT .T.
@@ -110,9 +110,8 @@ CLASS WvgStatusBar INHERIT WvgActiveXControl
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatusBar
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
//::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + WS_BORDER + SBARS_TOOLTIPS
::className := STATUSCLASSNAME
@@ -124,11 +123,8 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatu
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatusBar
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
IF ::sizeGrip
::style += SBARS_SIZEGRIP
ENDIF
@@ -137,8 +133,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt
::createControl()
::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
IF ::visible
::show()
@@ -216,7 +211,7 @@ METHOD destroy() CLASS WvgStatusBar
NEXT
ENDIF
::WvgWindow:destroy()
::wvgWindow:destroy()
RETURN NIL

View File

@@ -107,9 +107,7 @@ CLASS WvgStatic INHERIT WvgWindow
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
// SS_NOTIFY SS_ETCHEDFRAME SS_SUNKEN SS_WHITERECT
//
@@ -124,11 +122,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStati
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
#if 0
SS_ETCHEDFRAME
@@ -234,19 +228,17 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt
ENDIF
ENDIF
#endif
//------------------- API request to create control ----------------//
::oParent:addChild( SELF )
::createControl()
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self, 4 )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
IF ::visible
::show()
ENDIF
//------------------- After creation settings------------------------//
::setCaption( ::caption )
RETURN Self
@@ -287,12 +279,12 @@ METHOD destroy() CLASS WvgStatic
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::WvgWindow:destroy()
IF ::hBitmap <> nil
Win_DeleteObject( ::hBitmap )
ENDIF
::wvgWindow:destroy()
RETURN NIL
//----------------------------------------------------------------------//

View File

@@ -135,9 +135,6 @@ CLASS WvgToolBar INHERIT WvgWindow //WvgActiveXControl
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolBar
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
//::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
// + TBSTYLE_LIST caption to the right, otherwise caption to the bottom
@@ -152,10 +149,12 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolB
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolBar
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::style == WVGTOOLBAR_STYLE_FLAT
::style := TBSTYLE_FLAT
ELSEIF ::style == WVGTOOLBAR_STYLE_VERTICAL
::style := CCS_VERT
ELSE
::style := 0
ENDIF
@@ -184,8 +183,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo
// so the parent of toolbar will process them anyway
// All other functionality should be default until ownerdraw is introduced.
//
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
#endif
IF !empty( ::hWnd )
@@ -207,7 +205,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo
METHOD handleEvent( nMessage, aNM ) CLASS WvgToolBar
LOCAL nObj, aNMMouse
//hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
SWITCH nMessage
@@ -278,7 +276,7 @@ METHOD destroy() CLASS WvgToolBar
WAPI_ImageList_Destroy( ::hImageList )
ENDIF
::WvgWindow:destroy()
::wvgWindow:destroy()
RETURN NIL

View File

@@ -133,9 +133,7 @@ CLASS WvgTreeView INHERIT WvgWindow, DataRef
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeView
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + WS_TABSTOP + WS_CLIPSIBLINGS
::exStyle := WS_EX_STATICEDGE //+ TVS_EX_FADEINOUTEXPANDOS
@@ -149,11 +147,8 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeV
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeView
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF ::visible
::style += WS_VISIBLE
ENDIF
IF ::alwaysShowSelection
::style += TVS_SHOWSELALWAYS
ENDIF
@@ -168,8 +163,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTr
::createControl()
::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
::SetWindowProcCallback()
IF ::visible
::show()
@@ -184,7 +178,6 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTr
//----------------------------------------------------------------------//
METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView
LOCAL nHandled := 1
LOCAL hItemSelected, hParentOfSelected, n, aNMHdr
LOCAL cParent := space( 20 )
LOCAL cText := space( 20 )
@@ -196,12 +189,12 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView
CASE HB_GTE_RESIZED
::sendMessage( WM_SIZE, 0, 0 )
RETURN 0
RETURN EVENT_HANDELLED
CASE HB_GTE_COMMAND
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
nHandled := 0
RETURN EVENT_HANDELLED
ENDIF
EXIT
@@ -247,7 +240,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTreeView
EXIT
END
RETURN nHandled
RETURN EVENT_UNHANDELLED
//----------------------------------------------------------------------//
@@ -255,18 +248,7 @@ METHOD destroy() CLASS WvgTreeView
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
::WvgWindow:destroy()
#if 0
IF len( ::aChildren ) > 0
aeval( ::aChildren, {|o| o:destroy() } )
ENDIF
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
HB_FreeCallback( ::nWndProc )
#endif
::wvgWindow:destroy()
RETURN NIL

View File

@@ -1302,7 +1302,7 @@ HB_FUNC( WVG_STATUSBARCREATEPANEL )
}
ptArray[ iParts ] = -1;
if( SendMessage( hWndSB, SB_SETPARTS, iParts + 1, ( LPARAM ) ( LPINT ) ptArray ) )
if( SendMessage( hWndSB, SB_SETPARTS, ( WPARAM ) iParts + 1, ( LPARAM ) ( LPINT ) ptArray ) )
{
hb_retl( TRUE );
return;
@@ -1317,7 +1317,7 @@ HB_FUNC( WVG_STATUSBARCREATEPANEL )
{
ptArray[ 0 ] = rc.right;
SendMessage( hWndSB, SB_SETPARTS, 1, ( LPARAM ) ( LPINT ) ptArray );
SendMessage( hWndSB, SB_SETPARTS, ( WPARAM ) 1, ( LPARAM ) ( LPINT ) ptArray );
hb_retl( TRUE );
return;
@@ -2681,7 +2681,6 @@ HB_FUNC( WVG_BEGINMOUSETRACKING )
#include "hbapierr.h"
#include "hbstack.h"
#define HB_MEMSTRU_OSVERSIONINFO 1000001
#define HB_MEMSTRU_LOGFONT 1000002
@@ -2698,10 +2697,6 @@ extern void * hb_memstru_param( int iParam, int iType, BOOL fError );
HB_EXTERN_END
/* end of header file */
typedef struct
{
int type;
@@ -2783,11 +2778,6 @@ BOOL hb_memstru_store( void * pMemAddr, int iType, int iParam )
}
/*
hb_memstru_*() functions can be used to pass structures between
C and .prg code.
*/
HB_FUNC( WAPI_STRUCT_OSVERSIONINFO )
{
OSVERSIONINFO * osvi;
@@ -2811,10 +2801,6 @@ HB_FUNC( WAPI_GETVERSIONEX )
}
/*
You can also define some general functions to access given structure
members if you will find it useful in some cases.
*/
HB_FUNC( WAPI_MEMBER_OSVERSIONINFO )
{
OSVERSIONINFO * osvi;
@@ -2842,3 +2828,104 @@ HB_FUNC( WAPI_MEMBER_OSVERSIONINFO )
}
}
/*----------------------------------------------------------------------*/
static HB_GARBAGE_FUNC( WVG_WndProc_release )
{
void ** ph = ( void ** ) Cargo;
/* Check if pointer is not NULL to avoid multiple freeing */
if( ph && * ph )
{
/* Destroy the object */
hb_itemRelease( ( PHB_ITEM ) * ph );
/* set pointer to NULL to avoid multiple freeing */
* ph = NULL;
}
}
/*----------------------------------------------------------------------*/
static PHB_ITEM WVG_WndProc_par( int iParam )
{
void ** ph = ( void ** ) hb_parptrGC( WVG_WndProc_release, iParam );
return ph ? ( PHB_ITEM ) * ph : NULL;
}
/*----------------------------------------------------------------------*/
HB_FUNC( WVG_GETWNDPROCPOINTER )
{
PHB_ITEM pBlock = hb_itemNew( hb_param( 1, HB_IT_BLOCK ) );
void ** ph = ( void ** ) hb_gcAlloc( sizeof( PHB_ITEM ), WVG_WndProc_release );
* ph = ( void * ) pBlock;
hb_retptrGC( ph );
}
/*----------------------------------------------------------------------*/
LRESULT CALLBACK ControlWindowProcedure( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
PHB_ITEM pBlock = ( PHB_ITEM ) GetProp( hwnd, TEXT( "BLOCKCALLBACK" ) );
long lRet;
if( pBlock )
{
if( hb_itemType( pBlock ) == HB_IT_POINTER )
{
hb_vmPushSymbol( hb_dynsymSymbol( ( ( PHB_SYMB ) pBlock ) -> pDynSym ) );
hb_vmPushNil();
}
else
{
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( pBlock );
}
hb_vmPushLong( ( HB_PTRDIFF ) hwnd );
hb_vmPushInteger( msg );
hb_vmPushLong( ( HB_PTRDIFF ) wParam );
hb_vmPushLong( ( HB_PTRDIFF ) lParam );
hb_vmDo( 4 );
lRet = hb_parnint( -1 );
return lRet;
}
return DefWindowProc( hwnd, msg, wParam, lParam );
}
/*----------------------------------------------------------------------*/
HB_FUNC( WVG_SETWINDOWPROCBLOCK )
{
WNDPROC oldProc;
HWND hWnd = wapi_par_HWND( 1 );
PHB_ITEM pBlock = hb_itemNew( hb_param( 2, HB_IT_BLOCK ) );
SetProp( hWnd, TEXT( "BLOCKCALLBACK" ), pBlock );
#if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_OS_WIN_CE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT)
oldProc = ( WNDPROC ) SetWindowLong( hWnd, GWL_WNDPROC, ( long ) ControlWindowProcedure ) ;
#else
oldProc = ( WNDPROC ) SetWindowLongPtr( hWnd, GWLP_WNDPROC, ( HB_PTRDIFF ) ControlWindowProcedure ) ;
#endif
hb_retnint( ( HB_PTRDIFF ) oldProc );
}
/*----------------------------------------------------------------------*/
HB_FUNC( WVG_RELEASEWINDOWPROCBLOCK )
{
HWND hWnd = wapi_par_HWND( 1 );
PHB_ITEM pBlock = ( PHB_ITEM ) RemoveProp( hWnd, TEXT( "BLOCKCALLBACK" ) );
if( pBlock )
{
hb_itemRelease( pBlock );
}
}
/*----------------------------------------------------------------------*/

View File

@@ -271,6 +271,8 @@ EXPORTED:
METHOD isDerivedFrom()
METHOD setWindowProcCallback()
ENDCLASS
//----------------------------------------------------------------------//
@@ -342,12 +344,18 @@ METHOD destroy() CLASS WvgWindow
aeval( ::aChildren, {|o| o:destroy() } )
::aChildren := {}
ENDIF
WVG_ReleaseWindowProcBlock( ::hWnd )
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
#ifdef __BYASCALLBACK__
IF !empty( ::nWndProc )
hb_FreeCallBack( ::nWndProc )
ENDIF
#endif
IF ::hBrushBG <> NIL
Win_DeleteObject( ::hBrushBG )
@@ -1319,7 +1327,6 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
EXIT
CASE WM_CAPTURECHANGED
//hb_ToOutDebug( 'wm_CAPTURECHANGED' )
EXIT
CASE WM_MOUSEMOVE
@@ -1327,13 +1334,11 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
IF !( ::lTracking )
::lTracking := Wvg_BeginMouseTracking( ::hWnd )
ENDIF
//hb_ToOutDebug( 'wm_mouseMOVE' )
ENDIF
EXIT
CASE WM_MOUSEHOVER
IF ::objType == objTypeScrollBar
//hb_ToOutDebug( 'wm_mousehover' )
IF ::oParent:objType == objTypeCrt
WAPI_SetFocus( ::oParent:hWnd )
ENDIF
@@ -1345,7 +1350,6 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
IF ::objType == objTypeScrollBar
::lTracking := .f.
IF ::oParent:objType == objTypeCrt
//hb_ToOutDebug( 'wm_mouseleave' )
WAPI_SetFocus( ::oParent:hWnd )
ENDIF
ENDIF
@@ -1355,6 +1359,25 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow
RETURN Win_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )
//----------------------------------------------------------------------//
METHOD SetWindowProcCallback() CLASS WvgWindow
LOCAL bBlock := {|h,m,w,l| ::ControlWndProc( h,m,w,l ) }
#ifdef __BYASCALLBACK__
::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self )
::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc )
#else
//LOCAL pBlock
//pBlock := Wvg_GetWndProcPointer( bBlock )
//::nOldProc := WVG_SetWindowProcBlock( ::hWnd, pBlock )
::nOldProc := WVG_SetWindowProcBlock( ::hWnd, bBlock )
#endif
RETURN Self
/*----------------------------------------------------------------------*/
#if 0
FUNCTION hb_toOut( ... )
RETURN hb_ToOutDebug( ... )