2008-11-17 23:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/gtwvg/Makefile
  * harbour/contrib/gtwvg/common.mak
    + wvgdlg.prg 
      
  * harbour/contrib/gtwvg/gtwvg.c
    ! Fixed one more issue with screen repaint behavior when
      window was changing size due to font settings.

  * harbour/contrib/gtwvg/wvgcore.c
  * harbour/contrib/gtwvg/wvggui.c
  * harbour/contrib/gtwvg/wvgwin.c
  * harbour/contrib/gtwvg/hbgtwvg.ch
  * harbour/contrib/gtwvg/wvggui.h
  * harbour/contrib/gtwvg/wvgax.prg
  * harbour/contrib/gtwvg/wvgcrt.prg
  * harbour/contrib/gtwvg/wvgphdlr.prg
  * harbour/contrib/gtwvg/wvgwnd.prg
    ! A reshuffling exercise, Wvt*Classes inching towards
      Xbase++ compatibility, more synchronizations.
      
  + harbour/contrib/gtwvg/wvgdlg.prg
    + Added WvgDialog() class on lines with XbpDialog().

  * harbour/contrib/gtwvg/tests/demowvg.prg
    ! Active-X controls hosted with WvgDialog(), pure Windows GT. 
      Previously these were being hosted in WvtCrt() console.
This commit is contained in:
Pritpal Bedi
2008-11-18 08:16:08 +00:00
parent ab6a849699
commit 5c2e4521ce
15 changed files with 730 additions and 961 deletions

View File

@@ -8,6 +8,35 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-11-17 23:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/Makefile
* harbour/contrib/gtwvg/common.mak
+ wvgdlg.prg
* harbour/contrib/gtwvg/gtwvg.c
! Fixed one more issue with screen repaint behavior when
window was changing size due to font settings.
* harbour/contrib/gtwvg/wvgcore.c
* harbour/contrib/gtwvg/wvggui.c
* harbour/contrib/gtwvg/wvgwin.c
* harbour/contrib/gtwvg/hbgtwvg.ch
* harbour/contrib/gtwvg/wvggui.h
* harbour/contrib/gtwvg/wvgax.prg
* harbour/contrib/gtwvg/wvgcrt.prg
* harbour/contrib/gtwvg/wvgphdlr.prg
* harbour/contrib/gtwvg/wvgwnd.prg
! A reshuffling exercise, Wvt*Classes inching towards
Xbase++ compatibility, more synchronizations.
+ harbour/contrib/gtwvg/wvgdlg.prg
+ Added WvgDialog() class on lines with XbpDialog().
* harbour/contrib/gtwvg/tests/demowvg.prg
! Active-X controls hosted with WvgDialog(), pure Windows GT.
Previously these were being hosted in WvtCrt() console.
2008-11-18 03:04 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* ChangeLog
* Two recent TODOs in entries marked as [DONE] by this change:

View File

@@ -23,6 +23,7 @@ PRG_SOURCES=\
wvgwnd.prg \
wvgcrt.prg \
wvgax.prg \
wvgdlg.prg \
PRG_HEADERS=\
hbgtwvg.ch \

View File

@@ -17,6 +17,7 @@ LIB_OBJS = \
$(OBJ_DIR)wvgwnd$(OBJEXT) \
$(OBJ_DIR)wvgcrt$(OBJEXT) \
$(OBJ_DIR)wvgax$(OBJEXT) \
$(OBJ_DIR)wvgdlg$(OBJEXT) \
\
$(OBJ_DIR)gtwvg$(OBJEXT) \
$(OBJ_DIR)wvgcore$(OBJEXT) \

View File

@@ -776,7 +776,7 @@ static BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
return( TRUE );
}
static BOOL hb_gt_wvt_IsSizeChanged( PHB_GTWVT pWVT )
static BOOL hb_gt_wvt_FitSizeRows( PHB_GTWVT pWVT )
{
BOOL bSizeChanged = FALSE;
@@ -891,12 +891,8 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
if( wi.left < 0 || wi.top < 0 )
{
#if 1 // IMO not required [pritpal]
if( hb_gt_wvt_IsSizeChanged( pWVT ) )
{
hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE );
}
#endif
pWVT->bMaximized = TRUE;
hb_gt_wvt_FitSizeRows( pWVT );
/* resize the window to get the specified number of rows and columns */
GetWindowRect( pWVT->hWnd, &wi );
@@ -1718,7 +1714,6 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
case WM_PAINT:
{
RECT updateRect;
if( !pWVT->bDeferPaint )
{
if( pWVT->bResizing )
@@ -1868,7 +1863,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
return 0;
case WM_EXITSIZEMOVE:
hb_gt_wvt_IsSizeChanged( pWVT );
hb_gt_wvt_FitSizeRows( pWVT );
return 0;
case WM_SYSCOMMAND:
@@ -1878,7 +1873,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
{
pWVT->bMaximized = TRUE;
hb_gt_wvt_IsSizeChanged( pWVT );
hb_gt_wvt_FitSizeRows( pWVT );
/* Disable "maximize" button */
@@ -2460,6 +2455,8 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
hb_gt_wvt_ResetWindowSize( pWVT );
hb_gt_wvt_UpdateCaret( pWVT );
HB_GTSELF_REFRESH( pGT );
hb_wvt_gtSaveGuiState( pWVT );
}
}
DeleteObject( hFont );
@@ -3936,9 +3933,11 @@ static void hb_wvt_gtInitGui( PHB_GTWVT pWVT )
static void hb_wvt_gtRestGuiState( PHB_GTWVT pWVT, LPRECT rect )
{
if( pWVT->bGui )
{
BitBlt( pWVT->hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top,
pWVT->hGuiDC, rect->left, rect->top, SRCCOPY );
}
}
static void hb_wvt_gtSaveGuiState( PHB_GTWVT pWVT )
@@ -3948,6 +3947,7 @@ static void hb_wvt_gtSaveGuiState( PHB_GTWVT pWVT )
RECT rc = { 0, 0, 0, 0 };
GetClientRect( pWVT->hWnd, &rc );
pWVT->iGuiWidth = rc.right - rc.left;
pWVT->iGuiHeight = rc.bottom - rc.top;

View File

@@ -56,9 +56,16 @@
//----------------------------------------------------------------------//
// Extended GT Manipulation Constants
//----------------------------------------------------------------------//
#define HB_GTE_MOUSE 6
#define HB_GTE_KEYBOARD 7
#if 0 // Already in hbgtinfo.ch
#define HB_GTE_ACTIVATE 1
#define HB_GTE_SETFOCUS 2
#define HB_GTE_KILLFOCUS 3
#define HB_GTE_CLOSE 4
#define HB_GTE_RESIZED 5
#endif
#define HB_GTE_MOUSE 6
#define HB_GTE_KEYBOARD 7
#define HB_GTE_TIMER 8
#define HB_GTI_SETFONT 71
#define HB_GTI_PRESPARAMS 72
@@ -125,10 +132,11 @@
// Class Framework Constants
//----------------------------------------------------------------------//
#define objTypeNone 0
#define objTypeCrt 1
#define objTypeWindow 2
#define objTypeActiveX 3
#define objTypeNone 0
#define objTypeCrt 1
#define objTypeWindow 2
#define objTypeActiveX 3
#define objTypeDialog 4
//----------------------------------------------------------------------//

View File

@@ -2245,13 +2245,21 @@ FUNCTION DrawSlide( hDlg, nSlide )
Function ExecuteActiveX( nActiveX )
Local oCrt
oCrt := WvgCrt():New( , , { 5,5 }, { 29,59 }, , .f. )
oCrt:closable := .f.
oCrt:create()
#if 0
oCrt := WvgCrt():New( , , { 5,5 }, { 29,59 }, , .f. )
SetCursor( 0 )
SetColor( 'N/W' )
CLS
oCrt:closable := .f.
oCrt:create()
SetCursor( 0 )
SetColor( 'N/W' )
CLS
#else
oCrt := WvgDialog():init( , , { 30,30 }, { 400,500 }, , .f. )
oCrt:closable := .f.
oCrt:create()
#endif
oCrt:show()
@@ -2260,8 +2268,14 @@ Function ExecuteActiveX( nActiveX )
oCrt:Destroy()
Return nil
//----------------------------------------------------------------------//
Static Function Resize( oCom )
Win_MoveWindow( oCom:hWnd, 0, 0, hb_gtInfo( HB_GTI_SCREENWIDTH ), hb_gtInfo( HB_GTI_SCREENHEIGHT ), .F. )
Static Function ResizeMe( oCom )
Local nW, nH
nW := hb_gtInfo( HB_GTI_SCREENWIDTH )
nH := hb_gtInfo( HB_GTI_SCREENHEIGHT )
oCom:SetSize( { nW, nH }, .t. )
Return nil
//----------------------------------------------------------------------//
Static Function ExeActiveX( oCrt, nActiveX )
@@ -2322,7 +2336,6 @@ Static Function ExeActiveX( oCrt, nActiveX )
oCom:create()
if hb_isObject( oCom )
// After :CREATE() Messages
//
if nActiveX == 1
@@ -2339,9 +2352,13 @@ Static Function ExeActiveX( oCrt, nActiveX )
do while !( lEnd )
nKey := inkey()
#if 0
if nKey <> 0
hb_toOutDebug( 'nKey = %i : %i ', nKey, HB_K_RESIZE )
endif
#endif
if nKey == HB_K_RESIZE
Resize( oCom )
ResizeMe( oCom )
elseif nKey == K_F12
if nActiveX == 1
@@ -2363,12 +2380,13 @@ Static Function ExeActiveX( oCrt, nActiveX )
if nTurn > 6
nTurn := 1
endif
sData := NIL
sData := ''
do case
case nTurn == 1
hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] ' + 'Stacked Bars' )
SetMode( 30,100 )
//SetMode( 30,100 )
sData += "00003600|00004450|000051|000061|000073|00008-6972|00009412|00011Tahoma|100011|10"
sData += "0035|1000410|10005-5|10006-5|1000911|100101|100111|100181|100200|1002150000|1002"
@@ -2389,7 +2407,7 @@ Static Function ExeActiveX( oCrt, nActiveX )
case nTurn == 2
hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Floating Bars' )
SetMode( 20,90 )
//SetMode( 20,90 )
sData += "00003550|00004300|000051|000073|00008-2894893|00009412|00011Tahoma|100011|100035"
sData += "|100045|10005-5|10006-5|1000911|100101|100111|100131|100181|100201|1002113|10022"
@@ -2404,7 +2422,7 @@ Static Function ExeActiveX( oCrt, nActiveX )
case nTurn == 3
hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Four Regions' )
SetMode( 40,120 )
//SetMode( 40,120 )
sData += "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|"
sData += "100032|100042|10005348|10006248|1000910|100101|100111|100181|100200|10021100|100"
@@ -2437,7 +2455,7 @@ Static Function ExeActiveX( oCrt, nActiveX )
case nTurn == 4
hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'10 Biggest Companies' )
SetMode( 25,90 )
//SetMode( 25,90 )
sData += "00003670|00004450|000051|000061|000071|00008-10185235|00009412|00011Tahoma|10001"
sData += "1|100035|1000410|10005-5|10006-5|1000912|100101|100111|100131|100181|10020100000"
@@ -2455,7 +2473,7 @@ Static Function ExeActiveX( oCrt, nActiveX )
case nTurn == 5
hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Grouped Bars' )
SetMode( 25,80 )
//SetMode( 25,80 )
sData += "00003600|00004450|000051|000061|000075|00008-2|00009412|00010paper.jpg|00011Taho"
sData += "ma|100011|100035|100045|10005-5|10006-5|1000910|100101|100111|100181|100200|1002"
@@ -2468,7 +2486,7 @@ Static Function ExeActiveX( oCrt, nActiveX )
case nTurn == 6
hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Flow Chart' )
SetMode( 30,50 )
//SetMode( 30,50 )
sData += "00003305|00004400|000051|00008-984833|00009412|00011Tahoma|100011|100035|100045|"
sData += "10005-5|10006-5|10180\7C|010011|010051|010072|010081|0101050|0101125|01012100|01"
@@ -2507,8 +2525,7 @@ Static Function ExeActiveX( oCrt, nActiveX )
oCom:Reset()
oCom:RMCFile := sData
oCom:Draw( .t. )
Resize( oCom )
ResizeMe( oCom )
endif
endif
@@ -2633,9 +2650,6 @@ Static Function ExperimentWGU()
do while .t.
nKey := inkey( 0.1 )
if nKey <> 0
//hb_toOutDebug( 'inkey == %i rows=%i cols=%i', nKey, maxrow(), maxcol() )
endif
if nKey == 27
exit
endif

View File

@@ -112,6 +112,7 @@ CLASS WvgActiveXControl FROM TOleAuto, WvgWindow
DATA hSink
DATA style INIT WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN + WS_CLIPSIBLINGS
DATA hWnd
METHOD New()
METHOD Create()

View File

@@ -2994,6 +2994,7 @@ HB_FUNC( WVT_SAVESCREEN )
{
PHB_GTWVT _s = hb_wvt_gtGetWVT();
HDC hCompDC;
HBITMAP hBmp, oldBmp;
POINT xy = { 0,0 };
int iTop, iLeft, iBottom, iRight, iWidth, iHeight;
@@ -3011,10 +3012,18 @@ HB_FUNC( WVT_SAVESCREEN )
iHeight = iBottom - iTop + 1;
hBmp = CreateCompatibleBitmap( _s->hdc, iWidth, iHeight ) ;
#if 0
oldBmp = (HBITMAP) SelectObject( _s->hCompDC, hBmp );
BitBlt( _s->hCompDC, 0, 0, iWidth, iHeight, _s->hdc, iLeft, iTop, SRCCOPY );
SelectObject( _s->hCompDC, oldBmp );
#else
hCompDC = CreateCompatibleDC( _s->hdc );
oldBmp = (HBITMAP) SelectObject( hCompDC, hBmp );
BitBlt( hCompDC, 0, 0, iWidth, iHeight, _s->hdc, iLeft, iTop, SRCCOPY );
SelectObject( hCompDC, oldBmp );
DeleteDC( hCompDC );
#endif
hb_arraySetNI( info, 1, iWidth );
hb_arraySetNI( info, 2, iHeight );
hb_arraySetNInt( info, 3, ( HB_PTRDIFF ) hBmp );
@@ -3033,6 +3042,7 @@ HB_FUNC( WVT_RESTSCREEN )
POINT xy = { 0,0 };
int iTop, iLeft, iBottom, iRight, iWidth, iHeight;
HBITMAP hBmp;
HDC hCompDC;
BOOL bResult = FALSE;
BOOL bDoNotDestroyBMP = ISNIL( 6 ) ? FALSE : hb_parl( 6 );
@@ -3048,6 +3058,38 @@ HB_FUNC( WVT_RESTSCREEN )
iWidth = iRight - iLeft + 1 ;
iHeight = iBottom - iTop + 1 ;
#if 1
hCompDC = CreateCompatibleDC( _s->hdc );
hBmp = (HBITMAP) SelectObject( hCompDC, ( HBITMAP ) ( HB_PTRDIFF ) hb_parnint( 5,3 ) );
if ( hBmp )
{
if ( ( iWidth == hb_parni( 5,1 ) ) && ( iHeight == hb_parni( 5,2 ) ) )
{
if ( BitBlt( _s->hdc,
iLeft, iTop, iWidth, iHeight,
hCompDC,
0, 0,
SRCCOPY ) )
{
bResult = TRUE;
}
}
else
{
if ( StretchBlt( _s->hdc,
iLeft, iTop, iWidth, iHeight,
hCompDC,
0, 0,
hb_parni( 5,1 ),
hb_parni( 5,2 ),
SRCCOPY ) )
{
bResult = TRUE;
}
}
}
DeleteDC( hCompDC );
#else
hBmp = (HBITMAP) SelectObject( _s->hCompDC, ( HBITMAP ) ( HB_PTRDIFF ) hb_parnint( 5,3 ) );
if ( hBmp )
{
@@ -3084,6 +3126,7 @@ HB_FUNC( WVT_RESTSCREEN )
}
}
}
#endif
SelectObject( _s->hCompDC, hBmp );

View File

@@ -242,7 +242,6 @@ EXPORTED:
DATA objType INIT objTypeCrt
DATA ClassName INIT 'WVGCRT'
METHOD notifier()
METHOD setFocus()
METHOD sendMessage()
@@ -558,7 +557,14 @@ METHOD setPresParam() CLASS WvgCrt
//----------------------------------------------------------------------//
METHOD setSize() CLASS WvgCrt
METHOD setSize( aSize, lPaint ) CLASS WvgCrt
if hb_isArray( aSize )
DEFAULT lPaint TO .T.
hb_gtInfo( HB_GTI_SCREENHEIGHT, aSize[ 1 ] )
hb_gtInfo( HB_GTI_SCREENWIDTH , aSize[ 2 ] )
endif
RETURN Self
@@ -1099,123 +1105,6 @@ METHOD dragDrop( xParam, xParam1 ) CLASS WvgCrt
//----------------------------------------------------------------------//
// HARBOUR SPECIFIC
//----------------------------------------------------------------------//
METHOD notifier( nEvent, xParams ) CLASS WvgCrt
Local aPos, nReturn := 0
DO CASE
CASE nEvent == HB_GTE_MOUSE
if xParams[ 1 ] == WM_MOUSEHOVER
aPos := { xParams[ 3 ], xParams[ 4 ] }
elseif xParams[ 1 ] == WM_MOUSELEAVE
// Nothing
else
aPos := if( ::mouseMode == 2, { xParams[ 3 ], xParams[ 4 ] }, { xParams[ 5 ], xParams[ 6 ] } )
endif
SWITCH xParams[ 1 ]
case WM_MOUSEHOVER
if hb_isBlock( ::sl_enter )
eval( ::sl_enter, aPos, NIL, self )
endif
EXIT
case WM_MOUSELEAVE
if hb_isBlock( ::sl_leave )
eval( ::sl_leave, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONDOWN
if hb_isBlock( ::sl_rbDown )
eval( ::sl_rbDown, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONDOWN
if hb_isBlock( ::sl_lbDown )
eval( ::sl_lbDown, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONUP ////
if hb_isBlock( ::sl_rbUp )
eval( ::sl_rbUp, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONUP ////
if hb_isBlock( ::sl_lbUp )
eval( ::sl_lbUp, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONDBLCLK
if hb_isBlock( ::sl_rbDblClick )
eval( ::sl_rbDblClick, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONDBLCLK
if hb_isBlock( ::sl_lbDblClick )
eval( ::sl_lbDblClick, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONDOWN
if hb_isBlock( ::sl_mbDown )
eval( ::sl_mbDown, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONUP ////
if hb_isBlock( ::sl_mbClick )
eval( ::sl_mbClick, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONDBLCLK
if hb_isBlock( ::sl_mbDblClick )
eval( ::sl_mbDblClick, aPos, NIL, self )
endif
EXIT
case WM_MOUSEMOVE
if hb_isBlock( ::sl_motion )
eval( ::sl_motion, aPos, NIL, self )
endif
EXIT
case WM_MOUSEWHEEL
if hb_isBlock( ::sl_wheel )
eval( ::sl_wheel, aPos, NIL, self )
endif
EXIT
case WM_NCMOUSEMOVE
EXIT
END
CASE nEvent == HB_GTE_KEYBOARD
if hb_isBlock( ::keyboard )
eval( ::keyboard, xParams, NIL, Self )
endif
CASE nEvent == HB_GTE_SETFOCUS
if hb_isBlock( ::setInputFocus )
eval( ::setInputFocus, NIL, NIL, Self )
endif
::lHasInputFocus := .t.
CASE nEvent == HB_GTE_KILLFOCUS
if hb_isBlock( ::killInputFocus )
eval( ::killInputFocus, NIL, NIL, Self )
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
CASE nEvent == HB_GTE_CLOSE
if hb_isBlock( ::close )
nReturn := eval( ::close, NIL, NIL, Self )
endif
ENDCASE
RETURN nReturn
//----------------------------------------------------------------------//
METHOD setFocus() CLASS WvgCrt
::sendMessage( WM_ACTIVATE, 1, 0 )
@@ -1228,4 +1117,3 @@ METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgCrt
RETURN Self
//----------------------------------------------------------------------//

View File

@@ -0,0 +1,147 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the Wvg*Classes
*
* 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++ Compatible xbpDialog Class
//
// Pritpal Bedi <pritpal@vouchcac.com>
// 17Nov2008
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
#include 'hbclass.ch'
#include 'common.ch'
#include 'hbgtinfo.ch'
#include 'hbgtwvg.ch'
#include 'wvtwin.ch'
#include 'inkey.ch'
//----------------------------------------------------------------------//
CLASS WvgDialog FROM WvgWindow
METHOD init()
METHOD create()
METHOD configure()
METHOD destroy()
ENDCLASS
//----------------------------------------------------------------------//
METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDialog
::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::className := 'WVGDIALOG'
::resizeMode := 0
::mouseMode := 0
::objType := objTypeDialog
::style := WS_THICKFRAME+WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX;
RETURN Self
//----------------------------------------------------------------------//
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDialog
::WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
if ::lModal
::pGT := hb_gtCreate( 'WGU' )
::pGTp := hb_gtSelect( ::pGT )
else
hb_gtReload( 'WGU' )
::pGT := hb_gtSelect()
endif
hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ;
::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F., .f. } )
::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE )
hb_gtInfo( HB_GTI_RESIZABLE , ::resizable )
hb_gtInfo( HB_GTI_CLOSABLE , ::closable )
hb_gtInfo( HB_GTI_WINTITLE , ::title )
if !empty( ::icon )
if hb_isNumeric( ::icon )
hb_gtInfo( HB_GTI_ICONRES, ::icon )
elseif hb_isChar( ::icon )
hb_gtInfo( HB_GTI_ICONFILE, ::icon )
endif
endif
if ::lModal
hb_gtInfo( HB_GTI_DISABLE, ::pGTp )
endif
if ::visible
hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL )
::lHasInputFocus := .t.
endif
hb_gtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| ::notifier( nEvent, ... ) } )
RETURN Self
//----------------------------------------------------------------------//
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDialog
RETURN Self
//----------------------------------------------------------------------//
METHOD destroy() CLASS WvgDialog
RETURN Self
//----------------------------------------------------------------------//

File diff suppressed because it is too large Load Diff

View File

@@ -254,28 +254,6 @@ typedef struct
} HB_GT_PARAMS, * PHB_GT_PARAMS;
typedef struct
{
HPEN penWhite; // White pen to draw GDI elements
HPEN penBlack; // Black pen to draw GDI elements
HPEN penWhiteDim; // White dim pen to draw GDI elements
HPEN penDarkGray; // Dark gray pen to draw GDI elements
HPEN penGray; // Gray pen equivilant to Clipper White
HPEN penNull; // Null pen
HPEN currentPen; // Handle to current pen settable at runtime
HBRUSH currentBrush; // Handle to current brush settable by runtime
HBRUSH diagonalBrush; // Handle to diaoganl brush to draw scrollbars
HBRUSH solidBrush; // Handle to solid brush
HBRUSH wvtWhiteBrush; // Wvt specific White colored brush
IPicture *iPicture[ WVT_PICTURES_MAX ]; // Array to hold the Picture Streams to avoid recurring loading and unloading
HFONT hUserFonts[ WVT_FONTS_MAX ] ; // User defined font handles
HPEN hUserPens[ WVT_PENS_MAX ]; // User defined pens
HINSTANCE hMSImg32; // Handle to the loaded library msimg32.dll
wvtGradientFill pfnGF; // Pointer to Address of the GradientFill function in MSImg32.dll
wvtSetLayeredWindowAttributes pfnLayered;// Pointer to set Windows attribute - transparency.
} HB_GUIDATA, * PHB_GUIDATA;
typedef struct
{
PHB_GT pGT; /* core GT pointer */
@@ -320,12 +298,10 @@ typedef struct
int CodePage; /* Code page to use for display characters */
BOOL Win9X; /* Flag to say if running on Win9X not NT/2000/XP */
BOOL AltF4Close; /* Can use Alt+F4 to close application */
BOOL CentreWindow; /* True if window is to be Reset into centre of window */
BOOL IgnoreWM_SYSCHAR;
BOOL bMaximized; /* Flag is set when window has been maximized */
BOOL bResizable;
BOOL bClosable;
@@ -338,9 +314,6 @@ typedef struct
int iFactor; // Transparency factor 0~255
HDC hdc; // Handle to Windows Device Context
HDC hCompDC; // Compatible DC to _s.hdc
int LastMenuEvent; // Last menu item selected
int MenuKeyEvent; // User definable event number for windows menu command
BOOL InvalidateWindow; // Flag for controlling whether to use ScrollWindowEx()
@@ -351,13 +324,6 @@ typedef struct
BOOL bSetFocus;
BOOL bKillFocus;
PHB_DYNS pSymWVT_PAINT; // Stores pointer to WVT_PAINT function
PHB_DYNS pSymWVT_SETFOCUS; // Stores pointer to WVT_SETFOCUS function
PHB_DYNS pSymWVT_KILLFOCUS; // Stores pointer to WVT_KILLFOCUS function
PHB_DYNS pSymWVT_MOUSE; // Stores pointer to WVT_MOUSE function
PHB_DYNS pSymWVT_TIMER; // Stores pointer to WVT_TIMER function
PHB_DYNS pSymWVT_KEY;
HINSTANCE hMSImg32; // Handle to the loaded library msimg32.dll
wvtGradientFill pfnGF; // Pointer to Address of the GradientFill function in MSImg32.dll
HINSTANCE hUser32; // Handle to the loaded library user32.dll
@@ -366,8 +332,9 @@ typedef struct
PHB_GT_PARAMS pPP; // Presentation Parameters
BOOL bTracking; // To track if mouse has eneter or left the window area
BOOL bResizing; // To know when it is in resizing mode
int width;
int height;
} HB_GTWVT, * PHB_GTWVT;

View File

@@ -67,12 +67,16 @@
#include 'hbclass.ch'
#include 'common.ch'
#include 'hbgtinfo.ch'
#include 'hbgtwvg.ch'
#include 'wvtwin.ch'
#include 'inkey.ch'
//----------------------------------------------------------------------//
CLASS WvgPartHandler
DATA Cargo
DATA cargo
METHOD init( oParent, oOwner )
METHOD create( oParent, oOwner )
@@ -89,6 +93,8 @@ CLASS WvgPartHandler
METHOD setOwner( oWvg )
METHOD setParent( oWvg )
METHOD notifier( nEvent, xParams )
DATA hChildren INIT hb_hash()
DATA nNameId
DATA oParent
@@ -226,3 +232,120 @@ METHOD setParent( oWvg ) CLASS WvgPartHandler
//----------------------------------------------------------------------//
METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler
Local aPos, nReturn := 0
DO CASE
CASE nEvent == HB_GTE_MOUSE
if xParams[ 1 ] == WM_MOUSEHOVER
aPos := { xParams[ 3 ], xParams[ 4 ] }
elseif xParams[ 1 ] == WM_MOUSELEAVE
// Nothing
else
aPos := if( ::mouseMode == 2, { xParams[ 3 ], xParams[ 4 ] }, { xParams[ 5 ], xParams[ 6 ] } )
endif
SWITCH xParams[ 1 ]
case WM_MOUSEHOVER
if hb_isBlock( ::sl_enter )
eval( ::sl_enter, aPos, NIL, self )
endif
EXIT
case WM_MOUSELEAVE
if hb_isBlock( ::sl_leave )
eval( ::sl_leave, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONDOWN
if hb_isBlock( ::sl_rbDown )
eval( ::sl_rbDown, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONDOWN
if hb_isBlock( ::sl_lbDown )
eval( ::sl_lbDown, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONUP ////
if hb_isBlock( ::sl_rbUp )
eval( ::sl_rbUp, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONUP ////
if hb_isBlock( ::sl_lbUp )
eval( ::sl_lbUp, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONDBLCLK
if hb_isBlock( ::sl_rbDblClick )
eval( ::sl_rbDblClick, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONDBLCLK
if hb_isBlock( ::sl_lbDblClick )
eval( ::sl_lbDblClick, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONDOWN
if hb_isBlock( ::sl_mbDown )
eval( ::sl_mbDown, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONUP ////
if hb_isBlock( ::sl_mbClick )
eval( ::sl_mbClick, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONDBLCLK
if hb_isBlock( ::sl_mbDblClick )
eval( ::sl_mbDblClick, aPos, NIL, self )
endif
EXIT
case WM_MOUSEMOVE
if hb_isBlock( ::sl_motion )
eval( ::sl_motion, aPos, NIL, self )
endif
EXIT
case WM_MOUSEWHEEL
if hb_isBlock( ::sl_wheel )
eval( ::sl_wheel, aPos, NIL, self )
endif
EXIT
case WM_NCMOUSEMOVE
EXIT
END
CASE nEvent == HB_GTE_KEYBOARD
if hb_isBlock( ::keyboard )
eval( ::keyboard, xParams, NIL, Self )
endif
CASE nEvent == HB_GTE_SETFOCUS
if hb_isBlock( ::setInputFocus )
eval( ::setInputFocus, NIL, NIL, Self )
endif
::lHasInputFocus := .t.
CASE nEvent == HB_GTE_KILLFOCUS
if hb_isBlock( ::killInputFocus )
eval( ::killInputFocus, NIL, NIL, Self )
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
CASE nEvent == HB_GTE_CLOSE
if hb_isBlock( ::close )
nReturn := eval( ::close, NIL, NIL, Self )
endif
ENDCASE
RETURN nReturn
//----------------------------------------------------------------------//

View File

@@ -477,7 +477,8 @@ HB_FUNC( WIN_GETWINDOWRECT )
}
//-------------------------------------------------------------------//
// Win_MoveWindow( hWnd, nLeft, nTop, nWidth, nHeight, lRePaint )
//
HB_FUNC( WIN_MOVEWINDOW )
{
MoveWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), hb_parnl( 4 ), hb_parnl( 5 ), hb_parl( 6 ) );

View File

@@ -67,7 +67,10 @@
#include 'hbclass.ch'
#include 'common.ch'
#include 'hbgtinfo.ch'
#include 'hbgtwvg.ch'
#include 'wvtwin.ch'
#include 'inkey.ch'
//----------------------------------------------------------------------//
@@ -98,6 +101,8 @@ CLASS WvgWindow INHERIT WvgPartHandler
DATA aPresParams INIT {}
DATA objType INIT objTypeNone
DATA ClassName INIT ''
DATA title INIT ' '
DATA icon INIT 0
// CALLBACK SLOTS
DATA sl_enter
@@ -215,6 +220,34 @@ EXPORTED:
METHOD setDisplayFocus() SETGET
METHOD killDisplayFocus() SETGET
// HARBOUR implementation
DATA closable INIT .T.
DATA resizable INIT .t.
DATA resizeMode INIT 0
DATA style INIT WS_OVERLAPPEDWINDOW
DATA exStyle INIT 0
DATA lModal INIT .f.
DATA pGTp
DATA pGT
DATA objType INIT objTypeNone
DATA ClassName INIT ''
METHOD notifier()
METHOD setFocus()
METHOD sendMessage()
PROTECTED:
DATA hWnd
DATA aPos INIT { 0,0 }
DATA aSize INIT { 0,0 }
DATA aPresParams INIT {}
DATA lHasInputFocus INIT .F.
DATA nFrameState INIT 0 // normal
DATA maxCol INIT 79
DATA maxRow INIT 24
DATA mouseMode INIT 1
ENDCLASS
//----------------------------------------------------------------------//
@@ -228,8 +261,16 @@ METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWind
DEFAULT aPresParams TO ::aPresParams
DEFAULT lVisible TO ::visible
::oParent := oParent
::oOwner := oOwner
::aPos := aPos
::aSize := aSize
::aPresParams := aPresParams
::visible := lVisible
::WvgPartHandler:init( oParent, oOwner )
#if 0
if hb_isArray( aPos )
::aPos := aPos
endif
@@ -242,7 +283,7 @@ METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWind
if hb_isLogical( lVisible )
::visible := lVisible
endif
#endif
RETURN Self
//----------------------------------------------------------------------//
@@ -361,14 +402,31 @@ METHOD setPosAndSize() CLASS WvgWindow
//----------------------------------------------------------------------//
METHOD setSize() CLASS WvgWindow
METHOD setSize( aSize, lPaint ) CLASS WvgWindow
if hb_isArray( aSize )
DEFAULT lPaint TO .T.
switch ::objType
case objTypeDialog
case objTypeActiveX
Win_MoveWindow( ::hWnd, 0, 0, aSize[ 1 ], aSize[ 2 ], lPaint )
exit
case objTypeCrt
hb_gtInfo( HB_GTI_SCREENWIDTH , aSize[ 1 ] )
hb_gtInfo( HB_GTI_SCREENHEIGHT, aSize[ 2 ] )
exit
end
endif
RETURN Self
//----------------------------------------------------------------------//
METHOD show() CLASS WvgWindow
Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL )
::lHasInputFocus := .t.
RETURN Self
//----------------------------------------------------------------------//
@@ -969,3 +1027,134 @@ METHOD dragDrop( xParam, xParam1 ) CLASS WvgWindow
RETURN Self
//----------------------------------------------------------------------//
// HARBOUR SPECIFIC
//----------------------------------------------------------------------//
METHOD notifier( nEvent, xParams ) CLASS WvgWindow
Local aPos, nReturn := 0
DO CASE
CASE nEvent == HB_GTE_MOUSE
if xParams[ 1 ] == WM_MOUSEHOVER
aPos := { xParams[ 3 ], xParams[ 4 ] }
elseif xParams[ 1 ] == WM_MOUSELEAVE
// Nothing
else
aPos := if( ::mouseMode == 2, { xParams[ 3 ], xParams[ 4 ] }, { xParams[ 5 ], xParams[ 6 ] } )
endif
SWITCH xParams[ 1 ]
case WM_MOUSEHOVER
if hb_isBlock( ::sl_enter )
eval( ::sl_enter, aPos, NIL, self )
endif
EXIT
case WM_MOUSELEAVE
if hb_isBlock( ::sl_leave )
eval( ::sl_leave, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONDOWN
if hb_isBlock( ::sl_rbDown )
eval( ::sl_rbDown, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONDOWN
if hb_isBlock( ::sl_lbDown )
eval( ::sl_lbDown, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONUP ////
if hb_isBlock( ::sl_rbUp )
eval( ::sl_rbUp, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONUP ////
if hb_isBlock( ::sl_lbUp )
eval( ::sl_lbUp, aPos, NIL, self )
endif
EXIT
case WM_RBUTTONDBLCLK
if hb_isBlock( ::sl_rbDblClick )
eval( ::sl_rbDblClick, aPos, NIL, self )
endif
EXIT
case WM_LBUTTONDBLCLK
if hb_isBlock( ::sl_lbDblClick )
eval( ::sl_lbDblClick, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONDOWN
if hb_isBlock( ::sl_mbDown )
eval( ::sl_mbDown, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONUP ////
if hb_isBlock( ::sl_mbClick )
eval( ::sl_mbClick, aPos, NIL, self )
endif
EXIT
case WM_MBUTTONDBLCLK
if hb_isBlock( ::sl_mbDblClick )
eval( ::sl_mbDblClick, aPos, NIL, self )
endif
EXIT
case WM_MOUSEMOVE
if hb_isBlock( ::sl_motion )
eval( ::sl_motion, aPos, NIL, self )
endif
EXIT
case WM_MOUSEWHEEL
if hb_isBlock( ::sl_wheel )
eval( ::sl_wheel, aPos, NIL, self )
endif
EXIT
case WM_NCMOUSEMOVE
EXIT
END
CASE nEvent == HB_GTE_KEYBOARD
if hb_isBlock( ::keyboard )
eval( ::keyboard, xParams, NIL, Self )
endif
CASE nEvent == HB_GTE_SETFOCUS
if hb_isBlock( ::setInputFocus )
eval( ::setInputFocus, NIL, NIL, Self )
endif
::lHasInputFocus := .t.
CASE nEvent == HB_GTE_KILLFOCUS
if hb_isBlock( ::killInputFocus )
eval( ::killInputFocus, NIL, NIL, Self )
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
CASE nEvent == HB_GTE_CLOSE
if hb_isBlock( ::close )
nReturn := eval( ::close, NIL, NIL, Self )
endif
ENDCASE
RETURN nReturn
//----------------------------------------------------------------------//
METHOD setFocus() CLASS WvgWindow
::sendMessage( WM_ACTIVATE, 1, 0 )
RETURN Self
//----------------------------------------------------------------------//
METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgWindow
Win_SendMessage( ::hWnd, nMessage, nlParam, nwParam )
RETURN Self
//----------------------------------------------------------------------//