2011-12-08 12:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/gtwvg/gtwvg.c
    ! Fixed: Menu Key Event was being generated even on BN_CLICK
        notification for push buttons. 

  * contrib/gtwvg/wvgcheck.prg
  * contrib/gtwvg/wvglistb.prg
  * contrib/gtwvg/wvgphdlr.prg
  * contrib/gtwvg/wvgpushb.prg
  * contrib/gtwvg/wvgstatc.prg
  * contrib/gtwvg/wvgtreev.prg
  * contrib/gtwvg/wvgwnd.prg
  * contrib/gtwvg/wvtwin.ch
    * Reshuffle: of code and rationalization of conrols' WndProc callbacks.
   
  * contrib/gtwvg/tests/wvgtbrowser.prg
    ! Minor.
This commit is contained in:
Pritpal Bedi
2011-12-08 20:25:04 +00:00
parent f8ca5b43dc
commit b3af539f57
11 changed files with 309 additions and 287 deletions

View File

@@ -16,6 +16,24 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-12-08 12:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/gtwvg.c
! Fixed: Menu Key Event was being generated even on BN_CLICK
notification for push buttons.
* contrib/gtwvg/wvgcheck.prg
* contrib/gtwvg/wvglistb.prg
* contrib/gtwvg/wvgphdlr.prg
* contrib/gtwvg/wvgpushb.prg
* contrib/gtwvg/wvgstatc.prg
* contrib/gtwvg/wvgtreev.prg
* contrib/gtwvg/wvgwnd.prg
* contrib/gtwvg/wvtwin.ch
* Reshuffle: of code and rationalization of conrols' WndProc callbacks.
* contrib/gtwvg/tests/wvgtbrowser.prg
! Minor.
2011-12-07 16:24 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/debian/changelog
* harbour/debian/rules

View File

@@ -2265,7 +2265,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
case WM_COMMAND:
{
if( HIWORD( wParam ) == 0 )
if( ( HIWORD( wParam ) == 0 && ! IsWindow( ( HWND ) lParam ) ) )
{
if( pWVT->pPP->iWndType == HB_WNDTYPE_CRT )
{
@@ -2278,8 +2278,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
PHB_ITEM pEvParams = hb_itemNew( NULL );
int iLo, iHi;
iLo = LOWORD( wParam );
iHi = HIWORD( wParam );
iLo = LOWORD( wParam );
hb_arrayNew( pEvParams, 3 );
hb_arraySetNI( pEvParams, 1, iHi ); /* Notification Code */

View File

@@ -319,7 +319,7 @@ STATIC FUNCTION BrwBuildSLE( oCrt, oBrw )
oXbp:setColorFG( "N" )
oXbp:setColorBG( "BG+" )
oXbp:returnPressed := {|m1,m2,o| m1:=m1, m2:=m2, BrwShowColumn( oBrw, upper( trim( o:getData() ) ) ) }
oXbp:tooltipText := "Typein a FieldName to focus it!"
oXbp:tooltipText := "Type in a field name and press ENTER"
RETURN NIL
@@ -337,7 +337,7 @@ STATIC FUNCTION BrwBuildListBox( oCrt, oBrw )
oXbp:addItem( oBrw:getColumn( i ):heading )
NEXT
oXbp:setData( 3 )
oXbp:tooltipText := "Click on a FieldName to make it active!"
oXbp:tooltipText := "Click on a field name to make it active!"
RETURN oXbp
@@ -353,7 +353,7 @@ STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw )
oXbp:create( , , { -3,-1 }, { -1,-7 } )
oXbp:setColorFG( "R+" )
oXbp:setColorBG( "W" )
oXbp:tooltipText := "Checked: GoBottom, Unchecked: GoTop"
oXbp:tooltipText := "Checked: GoTop, Unchecked: GoBottom"
RETURN NIL

View File

@@ -76,12 +76,6 @@
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS WvgCheckBox INHERIT WvgWindow, DataRef
DATA autosize INIT .F.
@@ -108,11 +102,11 @@ CLASS WvgCheckBox INHERIT WvgWindow, DataRef
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCheckBox
METHOD WvgCheckBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + BS_PUSHBUTTON + BS_AUTOCHECKBOX /*+ BS_NOTIFY */
::style := WS_CHILD + BS_PUSHBUTTON + BS_AUTOCHECKBOX + BS_NOTIFY
::className := "BUTTON"
::objType := objTypeCheckBox
@@ -120,17 +114,17 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCheck
/*----------------------------------------------------------------------*/
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCheckBox
METHOD WvgCheckBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oParent:AddChild( SELF )
::oParent:AddChild( Self )
::createControl()
IF ::isParentCrt()
::SetWindowProcCallback()
ENDIF
#if 0
::SetWindowProcCallback() /* Left to the parent for event processing */
#endif
IF ::visible
::show()
@@ -147,40 +141,43 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCh
/*----------------------------------------------------------------------*/
METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox
LOCAL hDC
hb_traceLog( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
METHOD WvgCheckBox:handleEvent( nMessage, aNM )
DO CASE
CASE nMessage == HB_GTE_RESIZED
::sendMessage( WM_SIZE, 0, 0 )
IF ::isParentCrt()
::rePosition()
ENDIF
::sendMessage( WM_SIZE, 0, 0 )
CASE nMessage == HB_GTE_COMMAND
IF aNM[ NMH_code ] == BN_CLICKED
::editBuffer := ( WVG_Button_GetCheck( ::hWnd ) == BST_CHECKED )
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, ::editBuffer, NIL, self )
RETURN 0
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
eval( ::sl_lbClick, ::editBuffer, NIL, Self )
IF ::isParentCrt()
::setFocus()
ENDIF
// RETURN EVENT_HANDELLED
ENDIF
ENDIF
CASE nMessage == HB_GTE_CTLCOLOR
hDC := aNM[ 1 ]
IF hb_isNumeric( ::clr_FG )
WVG_SetTextColor( hDC, ::clr_FG )
WVG_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
WVG_SetBkMode( hDC, 1 )
WVG_SetBkMode( aNM[ 1 ], 1 )
RETURN ::hBrushBG
ELSE
RETURN WVG_GetCurrentBrush( hDC )
RETURN WVG_GetCurrentBrush( aNM[ 1 ] )
ENDIF
#if 0 /* This should never be reached as parent is processing the events */
CASE nMessage == HB_GTE_ANY
IF ::isParentCrt()
IF aNM[ 1 ] == WM_LBUTTONUP
@@ -192,6 +189,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox
ENDIF
ENDIF
ENDIF
#endif
ENDCASE
@@ -199,25 +197,19 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgCheckBox
/*----------------------------------------------------------------------*/
METHOD destroy() CLASS WvgCheckBox
hb_traceLog( " %s:destroy()", __objGetClsName() )
METHOD WvgCheckBox:destroy()
::wvgWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCheckBox
METHOD WvgCheckBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD setCaption( xCaption ) CLASS WvgCheckBox
METHOD WvgCheckBox:setCaption( xCaption )
IF hb_isChar( xCaption )
::caption := xCaption

View File

@@ -76,12 +76,6 @@
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS WvgListBox INHERIT WvgWindow, DataRef
DATA adjustHeight INIT .F.
@@ -146,7 +140,7 @@ CLASS WvgListBox INHERIT WvgWindow, DataRef
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox
METHOD WvgListBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
@@ -159,7 +153,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListB
/*----------------------------------------------------------------------*/
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox
METHOD WvgListBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
@@ -172,13 +166,14 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgLi
IF ::multiColumn
::style += LBS_MULTICOLUMN
ENDIF
::style += LBS_NOTIFY
::oParent:AddChild( SELF )
::oParent:AddChild( Self )
::createControl()
::SetWindowProcCallback()
#if 0
::SetWindowProcCallback() /* Let parent handle the notifications otherwise remove LBS_NOTIFY bit */
#endif
IF ::visible
::show()
ENDIF
@@ -188,7 +183,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgLi
/*----------------------------------------------------------------------*/
METHOD handleEvent( nMessage, aNM ) CLASS WvgListBox
METHOD WvgListBox:handleEvent( nMessage, aNM )
DO CASE
@@ -199,19 +194,37 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgListBox
::sendMessage( WM_SIZE, 0, 0 )
CASE nMessage == HB_GTE_COMMAND
uiDebug( "listbox:command", aNM[1], aNM[2], aNM[3], LBN_SELCHANGE, LBN_DBLCLK )
IF aNM[ 1 ] == LBN_SELCHANGE
::nCurSelected := WVG_LBGetCurSel( ::hWnd )+ 1
IF hb_isBlock( ::sl_itemMarked )
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
eval( ::sl_itemMarked, NIL, NIL, self )
IF ::isParentCrt()
::setFocus()
ENDIF
RETURN EVENT_UNHANDELLED
ENDIF
ELSEIF aNM[ 1 ] == LBN_DBLCLK
::editBuffer := ::nCurSelected
IF hb_isBlock( ::sl_itemSelected )
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
eval( ::sl_itemSelected, NIL, NIL, self )
IF ::isParentCrt()
::setFocus()
ENDIF
RETURN EVENT_UNHANDELLED
ENDIF
ENDIF
CASE nMessage == HB_GTE_NOTIFY
uiDebug( "listbox:notify", aNM[1], aNM[2], aNM[3] )
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
WVG_SetTextColor( aNM[ 1 ], ::clr_FG )
@@ -270,13 +283,13 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgListBox
/*----------------------------------------------------------------------*/
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox
METHOD WvgListBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD destroy() CLASS WvgListBox
METHOD WvgListBox:destroy()
::WvgWindow:destroy()
RETURN NIL

View File

@@ -96,6 +96,7 @@ CLASS WvgPartHandler
METHOD setParent( oWvg )
METHOD notifier( nEvent, xParams )
METHOD controlWndProc( hWnd, nMessage, nwParam, nlParam )
DATA aChildren INIT {}
DATA nNameId
@@ -241,7 +242,9 @@ METHOD WvgPartHandler:setParent( oWvg )
RETURN oOldXbp
/*----------------------------------------------------------------------*/
/*
This will be called by the WvgCRT() console FOR various events TO be propogated TO child controls
*/
METHOD WvgPartHandler:notifier( nEvent, xParams )
Local aPos, aMenuItem, nIndex, nCtrlID, oObj
LOCAL nReturn := 0
@@ -261,67 +264,67 @@ METHOD WvgPartHandler:notifier( nEvent, xParams )
CASE WM_MOUSEHOVER
IF hb_isBlock( ::sl_enter )
eval( ::sl_enter, aPos, NIL, self )
eval( ::sl_enter, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_MOUSELEAVE
IF hb_isBlock( ::sl_leave )
eval( ::sl_leave, aPos, NIL, self )
eval( ::sl_leave, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_RBUTTONDOWN
IF hb_isBlock( ::sl_rbDown )
eval( ::sl_rbDown, aPos, NIL, self )
eval( ::sl_rbDown, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_LBUTTONDOWN
IF hb_isBlock( ::sl_lbDown )
eval( ::sl_lbDown, aPos, NIL, self )
eval( ::sl_lbDown, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_RBUTTONUP
IF hb_isBlock( ::sl_rbUp )
eval( ::sl_rbUp, aPos, NIL, self )
eval( ::sl_rbUp, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_LBUTTONUP
IF hb_isBlock( ::sl_lbUp )
eval( ::sl_lbUp, aPos, NIL, self )
eval( ::sl_lbUp, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_RBUTTONDBLCLK
IF hb_isBlock( ::sl_rbDblClick )
eval( ::sl_rbDblClick, aPos, NIL, self )
eval( ::sl_rbDblClick, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_LBUTTONDBLCLK
IF hb_isBlock( ::sl_lbDblClick )
eval( ::sl_lbDblClick, aPos, NIL, self )
eval( ::sl_lbDblClick, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_MBUTTONDOWN
IF hb_isBlock( ::sl_mbDown )
eval( ::sl_mbDown, aPos, NIL, self )
eval( ::sl_mbDown, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_MBUTTONUP
IF hb_isBlock( ::sl_mbClick )
eval( ::sl_mbClick, aPos, NIL, self )
eval( ::sl_mbClick, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_MBUTTONDBLCLK
IF hb_isBlock( ::sl_mbDblClick )
eval( ::sl_mbDblClick, aPos, NIL, self )
eval( ::sl_mbDblClick, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_MOUSEMOVE
IF hb_isBlock( ::sl_motion )
eval( ::sl_motion, aPos, NIL, self )
eval( ::sl_motion, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_MOUSEWHEEL
IF hb_isBlock( ::sl_wheel )
eval( ::sl_wheel, aPos, NIL, self )
eval( ::sl_wheel, aPos, NIL, Self )
ENDIF
EXIT
CASE WM_NCMOUSEMOVE
@@ -388,17 +391,6 @@ METHOD WvgPartHandler:notifier( nEvent, xParams )
ENDCASE
CASE nEvent == HB_GTE_RESIZED
IF ::objType == objTypeDialog
IF ::drawingArea:objType == objTypeDA
::drawingArea:setPosAndSize( {0,0}, ::currentSize(), .f. )
ENDIF
ENDIF
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
@@ -437,8 +429,142 @@ METHOD WvgPartHandler:notifier( nEvent, xParams )
ENDIF
ENDIF
CASE nEvent == HB_GTE_RESIZED
IF ::objType == objTypeDialog
IF ::drawingArea:objType == objTypeDA
::drawingArea:setPosAndSize( {0,0}, ::currentSize(), .f. )
ENDIF
ENDIF
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 } ) } )
ENDCASE
RETURN nReturn
/*----------------------------------------------------------------------*/
/*
This will be called if a control is assigned its own WndProc via ::SetWindowProcCallback()
*/
METHOD WvgPartHandler:controlWndProc( hWnd, nMessage, nwParam, nlParam )
LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj, nReturn
SWITCH nMessage
CASE WM_ERASEBKGND
IF ::objType == objTypeDA .AND. ! empty( ::hBrushBG )
::handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } )
ENDIF
EXIT
CASE WM_COMMAND
nCtrlID := WVG_LOWORD( nwParam )
nNotifctn := WVG_HIWORD( nwParam )
hWndCtrl := nlParam
IF hWndCtrl == 0 /* It is menu */
IF hb_isObject( ::oMenu )
IF !empty( aMenuItem := ::oMenu:FindMenuItemById( nCtrlID ) )
IF hb_isBlock( aMenuItem[ 2 ] )
Eval( aMenuItem[ 2 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] )
ELSEIF hb_isBlock( aMenuItem[ 3 ] )
Eval( aMenuItem[ 3 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] )
ENDIF
ENDIF
ENDIF
RETURN 0
ELSE
IF ( nObj := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) ) > 0
nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_COMMAND, { nNotifctn, nCtrlID, hWndCtrl } )
IF hb_isNumeric( nReturn ) .AND. nReturn == 0
RETURN 0
ENDIF
ENDIF
ENDIF
EXIT
CASE WM_NOTIFY
IF ( nObj := ascan( ::aChildren, {| o | o:nID == nwParam } ) ) > 0
nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_NOTIFY, { nwParam, nlParam } )
IF hb_isNumeric( nReturn ) .AND. nReturn == EVENT_HANDELLED
RETURN 0
ELSEIF hb_isLogical( nReturn )
RETURN nReturn
ENDIF
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 )
nReturn := oObj:handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } )
IF nReturn == EVENT_UNHANDELLED
RETURN WVG_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )
ELSE
RETURN nReturn
ENDIF
ENDIF
EXIT
CASE WM_HSCROLL
::handleEvent( HB_GTE_HSCROLL, { WVG_LOWORD( nwParam ), WVG_HIWORD( nwParam ), nlParam } )
RETURN 0
CASE WM_VSCROLL
IF ::handleEvent( HB_GTE_VSCROLL, { WVG_LOWORD( nwParam ), WVG_HIWORD( nwParam ), nlParam } ) == EVENT_HANDELLED
RETURN 0
ENDIF
EXIT
CASE WM_CAPTURECHANGED
EXIT
#if 0
CASE WM_MOUSEMOVE
IF ::objType == objTypeScrollBar
IF ! ::lTracking
::lTracking := Wvg_BeginMouseTracking( ::hWnd )
ENDIF
ENDIF
EXIT
CASE WM_MOUSEHOVER
IF ::objType == objTypeScrollBar
IF ::oParent:objType == objTypeCrt
WAPI_SetFocus( ::oParent:pWnd )
ENDIF
RETURN 0
ENDIF
EXIT
CASE WM_MOUSELEAVE
IF ::objType == objTypeScrollBar
::lTracking := .f.
IF ::oParent:objType == objTypeCrt
WAPI_SetFocus( ::oParent:pWnd )
ENDIF
ENDIF
EXIT
#endif
OTHERWISE
IF ::handleEvent( HB_GTE_ANY, { nMessage, nwParam, nlParam } ) == EVENT_HANDELLED
RETURN 0
ENDIF
EXIT
ENDSWITCH
RETURN WVG_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )
/*----------------------------------------------------------------------*/

View File

@@ -76,12 +76,6 @@
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS WvgPushButton INHERIT WvgWindow
DATA autosize INIT .F.
@@ -114,7 +108,7 @@ METHOD WvgPushButton:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + BS_PUSHBUTTON /* + BS_NOTIFY + BS_PUSHLIKE */
::style := WS_CHILD + BS_PUSHBUTTON + BS_NOTIFY /* + BS_PUSHLIKE */
::className := "BUTTON"
::objType := objTypePushButton
@@ -139,13 +133,12 @@ METHOD WvgPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::style += BS_FLAT
ENDIF
::oParent:AddChild( SELF )
::oParent:AddChild( Self )
::createControl()
// IF ::isParentCrt()
::SetWindowProcCallback()
// ENDIF
#if 0
::SetWindowProcCallback() /* Let parent take control of it */
#endif
IF ::visible
::show()
@@ -172,8 +165,17 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM )
ENDIF
CASE nMessage == HB_GTE_COMMAND
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
IF aNM[ 1 ] == BN_CLICKED
IF hb_isBlock( ::sl_lbClick )
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
eval( ::sl_lbClick, NIL, NIL, self )
IF ::isParentCrt()
::setFocus()
ENDIF
ENDIF
RETURN EVENT_HANDELLED
ENDIF
CASE nMessage == HB_GTE_NOTIFY
@@ -188,6 +190,7 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM )
RETURN ::hBrushBG
ENDIF
#if 0 /* Must not reach here if WndProc is not installed */
CASE nMessage == HB_GTE_ANY
IF aNM[ 1 ] == WM_LBUTTONUP
IF hb_isBlock( ::sl_lbClick )
@@ -197,7 +200,7 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM )
eval( ::sl_lbClick, NIL, NIL, Self )
ENDIF
ENDIF
#endif
ENDCASE
RETURN EVENT_UNHANDELLED

View File

@@ -76,12 +76,6 @@
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS WvgStatic INHERIT WvgWindow
DATA autoSize INIT .F.
@@ -105,7 +99,7 @@ CLASS WvgStatic INHERIT WvgWindow
/*----------------------------------------------------------------------*/
METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic
METHOD WvgStatic:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
@@ -120,7 +114,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStati
/*----------------------------------------------------------------------*/
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic
METHOD WvgStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
@@ -246,7 +240,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt
/*----------------------------------------------------------------------*/
METHOD handleEvent( nMessage, aNM ) CLASS WvgStatic
METHOD WvgStatic:handleEvent( nMessage, aNM )
DO CASE
@@ -256,9 +250,9 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatic
ENDIF
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, NIL, NIL, self )
aeval( ::aChildren, {|o| o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } )
RETURN EVENT_HANDELLED
ENDIF
aeval( ::aChildren, {|o| o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } )
RETURN EVENT_HANDELLED
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )
@@ -271,10 +265,12 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatic
RETURN WVG_GetCurrentBrush( aNM[ 1 ] )
ENDIF
#if 0 /* It should never reach here */
CASE nMessage == HB_GTE_ANY
IF ::IsParentCrt()
IF ::isParentCrt()
ENDIF
#endif
ENDCASE
@@ -282,7 +278,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgStatic
/*----------------------------------------------------------------------*/
METHOD destroy() CLASS WvgStatic
METHOD WvgStatic:destroy()
IF ::hBitmap <> nil
WVG_DeleteObject( ::hBitmap )
@@ -293,13 +289,13 @@ METHOD destroy() CLASS WvgStatic
/*----------------------------------------------------------------------*/
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic
METHOD WvgStatic:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD setCaption( xCaption, cDll )
METHOD WvgStatic:setCaption( xCaption, cDll )
HB_SYMBOL_UNUSED( cDll )

View File

@@ -162,7 +162,9 @@ METHOD WvgTreeView:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::createControl()
// ::SetWindowProcCallback() /* Let parent control the events */
#if 0
::SetWindowProcCallback() /* Let parent control the events because all notifications are posted via WM_NOTIFY */
#endif
::oRootItem := WvgTreeViewItem():New()
::oRootItem:hTree := ::hWnd
@@ -177,32 +179,9 @@ METHOD WvgTreeView:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
/*----------------------------------------------------------------------*/
METHOD WvgTreeView:getSelectionInfo( nlParam )
LOCAL hItemSelected, hParentOfSelected
LOCAL cParent := space( 20 )
LOCAL cText := space( 20 )
LOCAL n
Wvg_TreeView_GetSelectionInfo( ::hWnd, nlParam, @cParent, @cText, @hParentOfSelected, @hItemSelected )
::hParentSelected := hParentOfSelected
::hItemSelected := hItemSelected
::textParentSelected := trim( cParent )
::textItemSelected := trim( cText )
IF ( n := ascan( ::aItems, {|o| o:hItem == hItemSelected } ) ) > 0
::oItemSelected := ::aItems[ n ]
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD WvgTreeView:handleEvent( nMessage, aNM )
LOCAL aHdr
hb_traceLog( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
SWITCH nMessage
CASE HB_GTE_RESIZED
@@ -237,7 +216,6 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM )
CASE aHdr[ NMH_code ] == TVN_SELCHANGED
::getSelectionInfo( aNM[ 2 ] )
IF hb_isBlock( ::sl_itemMarked )
Eval( ::sl_itemMarked, ::oItemSelected, { 0,0,0,0 }, Self )
ENDIF
@@ -249,31 +227,38 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM )
ENDCASE
EXIT
#if 0 /* It must never reach here */
CASE HB_GTE_ANY
IF ::isParentCrt()
IF aNM[ 1 ] == WM_LBUTTONUP
::getSelectionInfo( aNM[ 2 ] )
IF hb_isBlock( ::sl_lbClick )
IF aNM[ 1 ] == WM_LBUTTONDOWN
aHdr := Wvg_GetNMTreeViewInfo( aNM[ 3 ] )
::getSelectionInfo( aNM[ 2 ] )
IF hb_isBlock( ::sl_lbClick )
IF ::isParentCrt()
::oParent:setFocus()
eval( ::sl_lbClick, NIL, NIL, Self )
ENDIF
eval( ::sl_lbClick, NIL, NIL, Self )
IF ::isParentCrt()
::setFocus()
ENDIF
ELSEIF aNM[ 1 ] == WM_LBUTTONDBLCLK
::editBuffer := ::oItemSelected
IF hb_isBlock( ::sl_itemSelected )
::oParent:setFocus()
Eval( ::sl_itemSelected, ::oItemSelected, { 0,0,0,0 }, Self )
::setFocus()
ENDIF
ELSEIF aNM[ 1 ] == WM_KEYDOWN .AND. aNM[ 2 ] == K_ENTER
::getSelectionInfo( aNM[ 2 ] )
ENDIF
RETURN EVENT_HANDELLED
ELSEIF aNM[ 1 ] == WM_LBUTTONDBLCLK .OR. ( aNM[ 1 ] == WM_KEYDOWN .AND. aNM[ 2 ] == K_ENTER )
::editBuffer := ::oItemSelected
IF hb_isBlock( ::sl_itemSelected )
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
Eval( ::sl_itemSelected, ::oItemSelected, { 0,0,0,0 }, Self )
IF ::isParentCrt()
::setFocus()
ENDIF
ENDIF
RETURN .f.
ENDIF
EXIT
#endif
ENDSWITCH
RETURN EVENT_UNHANDELLED
@@ -281,27 +266,40 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM )
/*----------------------------------------------------------------------*/
METHOD WvgTreeView:destroy()
hb_traceLog( " %s:destroy()", __objGetClsName() )
::wvgWindow:destroy()
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD WvgTreeView:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD WvgTreeView:getSelectionInfo( nlParam )
LOCAL hItemSelected, hParentOfSelected
LOCAL cParent := space( 20 )
LOCAL cText := space( 20 )
LOCAL n
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
Wvg_TreeView_GetSelectionInfo( ::hWnd, nlParam, @cParent, @cText, @hParentOfSelected, @hItemSelected )
::hParentSelected := hParentOfSelected
::hItemSelected := hItemSelected
::textParentSelected := trim( cParent )
::textItemSelected := trim( cText )
IF ( n := ascan( ::aItems, {|o| o:hItem == hItemSelected } ) ) > 0
::oItemSelected := ::aItems[ n ]
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD WvgTreeView:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD WvgTreeView:itemFromPos( aPos )
HB_SYMBOL_UNUSED( aPos )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -268,10 +268,8 @@ CLASS WvgWindow INHERIT WvgPartHandler
METHOD getPosAndSize( aPs, aSz )
METHOD isParentCrt() INLINE ( __objGetClsName( ::oParent ) == "WVGCRT" )
METHOD rePosition()
#if 1
METHOD createControl()
METHOD controlWndProc( hWnd, nMessage, nwParam, nlParam )
#endif
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -1391,123 +1389,3 @@ METHOD WvgWindow:createControl()
/*----------------------------------------------------------------------*/
METHOD WvgWindow:controlWndProc( hWnd, nMessage, nwParam, nlParam )
LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj, nReturn
SWITCH nMessage
CASE WM_ERASEBKGND
IF ::objType == objTypeDA .AND. ! empty( ::hBrushBG )
::handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } )
ENDIF
EXIT
CASE WM_COMMAND
nCtrlID := WVG_LOWORD( nwParam )
nNotifctn := WVG_HIWORD( nwParam )
hWndCtrl := nlParam
IF hWndCtrl == 0 /* It is menu */
IF hb_isObject( ::oMenu )
IF !empty( aMenuItem := ::oMenu:FindMenuItemById( nCtrlID ) )
IF hb_isBlock( aMenuItem[ 2 ] )
Eval( aMenuItem[ 2 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] )
ELSEIF hb_isBlock( aMenuItem[ 3 ] )
Eval( aMenuItem[ 3 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] )
ENDIF
ENDIF
ENDIF
RETURN 0
ELSE
IF ( nObj := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) ) > 0
nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_COMMAND, { nNotifctn, nCtrlID, hWndCtrl } )
IF hb_isNumeric( nReturn ) .AND. nReturn == 0
RETURN 0
ENDIF
ENDIF
ENDIF
EXIT
CASE WM_NOTIFY
IF ( nObj := ascan( ::aChildren, {| o | o:nID == nwParam } ) ) > 0
nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_NOTIFY, { nwParam, nlParam } )
IF hb_isNumeric( nReturn ) .AND. nReturn == EVENT_HANDELLED
RETURN 0
ELSEIF hb_isLogical( nReturn )
RETURN nReturn
ENDIF
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 )
nReturn := oObj:handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } )
IF nReturn == EVENT_UNHANDELLED
RETURN WVG_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )
ELSE
RETURN nReturn
ENDIF
ENDIF
EXIT
CASE WM_HSCROLL
::handleEvent( HB_GTE_HSCROLL, { WVG_LOWORD( nwParam ), WVG_HIWORD( nwParam ), nlParam } )
RETURN 0
CASE WM_VSCROLL
IF ::handleEvent( HB_GTE_VSCROLL, { WVG_LOWORD( nwParam ), WVG_HIWORD( nwParam ), nlParam } ) == EVENT_HANDELLED
RETURN 0
ENDIF
EXIT
CASE WM_CAPTURECHANGED
EXIT
#if 0
CASE WM_MOUSEMOVE
IF ::objType == objTypeScrollBar
IF ! ::lTracking
::lTracking := Wvg_BeginMouseTracking( ::hWnd )
ENDIF
ENDIF
EXIT
CASE WM_MOUSEHOVER
IF ::objType == objTypeScrollBar
IF ::oParent:objType == objTypeCrt
WAPI_SetFocus( ::oParent:pWnd )
ENDIF
RETURN 0
ENDIF
EXIT
CASE WM_MOUSELEAVE
IF ::objType == objTypeScrollBar
::lTracking := .f.
IF ::oParent:objType == objTypeCrt
WAPI_SetFocus( ::oParent:pWnd )
ENDIF
ENDIF
EXIT
#endif
OTHERWISE
IF ::handleEvent( HB_GTE_ANY, { nMessage, nwParam, nlParam } ) == EVENT_HANDELLED
RETURN 0
ENDIF
EXIT
ENDSWITCH
RETURN WVG_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam )
/*----------------------------------------------------------------------*/

View File

@@ -264,7 +264,6 @@
#define TPM_NONOTIFY 0x0080 /* Don't send any notification msgs */
#define TPM_RETURNCMD 0x0100
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* ShowWindow() Commands
@@ -285,7 +284,6 @@
#define SW_FORCEMINIMIZE 11
#define SW_MAX 11
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* Window Messages
@@ -877,7 +875,6 @@
#define STN_ENABLE 2
#define STN_DISABLE 3
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* Listbox messages
@@ -955,7 +952,6 @@
#define LBN_SETFOCUS 4
#define LBN_KILLFOCUS 5
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* MessageBox() Flags
@@ -1073,7 +1069,9 @@
#define DT_PREFIXONLY 2097152
/*----------------------------------------------------------------------*/
// Brush Styles
/*
* Brush Styles
*/
#define BS_SOLID 0
#define BS_NULL 1
#define BS_HOLLOW BS_NULL