2013-04-03 00:42 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/gtwvg/wvgparts.ch
    + Added: constants - WVG_IMAGE_ICONFILE
                         WVG_IMAGE_ICONRESOURCE
                         WVG_IMAGE_BITMAPFILE
                         WVG_IMAGE_BITMAPRESOURCE

  * contrib/gtwvg/pushbut.prg
    + Implemented: Display of Bitmaps or Icons on the pushbuttons
       from resources also. Before, it was available from disk files
       only. For this to happen a push button be created like this:

       WITH OBJECT oXbp := WvgPushButton():new()
          :pointerFocus := .F.
          :caption := { "Vouch", WVG_IMAGE_ICONFILE, IMAGE_VR }
          :border  := .F.
          :create( , , { {|| -( MaxRow() - 1 ) }, -31 }, { -2, -4 } )
          :activate := {|| hb_threadStart( {|| demoXbp() } ) }
          :toolTipText := "Flat Button . Lines: press ESC when finished."
       ENDWITH

       :caption := { [<cButtonText>], <nImageType>, <xImage> }
                =>
                   { "Vouch", WVG_IMAGE_ICONFILE, hb_dirBase() + "vr1.ico" }
                   { "Vouch", WVG_IMAGE_ICONRESOURCE, 212 /*Numeric ID in resource*/ }
                   { "Vouch", WVG_IMAGE_ICONRESOURCE, "VOUCHICO" /*Character ID in resource*/ }

       IMPORTANT - :caption has to be defined before :create() is called.

  * contrib/gtwvg/tests/demowvg.prg
    + Added: code to demonstrate above usage.
This commit is contained in:
Pritpal Bedi
2013-04-03 01:01:20 -07:00
parent 764f140a97
commit 6f4a99fdf1
4 changed files with 88 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* $Id$
*/
@@ -10,6 +10,38 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-04-03 00:42 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/wvgparts.ch
+ Added: constants - WVG_IMAGE_ICONFILE
WVG_IMAGE_ICONRESOURCE
WVG_IMAGE_BITMAPFILE
WVG_IMAGE_BITMAPRESOURCE
* contrib/gtwvg/pushbut.prg
+ Implemented: Display of Bitmaps or Icons on the pushbuttons
from resources also. Before, it was available from disk files
only. For this to happen a push button be created like this:
WITH OBJECT oXbp := WvgPushButton():new()
:pointerFocus := .F.
:caption := { "Vouch", WVG_IMAGE_ICONFILE, IMAGE_VR }
:border := .F.
:create( , , { {|| -( MaxRow() - 1 ) }, -31 }, { -2, -4 } )
:activate := {|| hb_threadStart( {|| demoXbp() } ) }
:toolTipText := "Flat Button . Lines: press ESC when finished."
ENDWITH
:caption := { [<cButtonText>], <nImageType>, <xImage> }
=>
{ "Vouch", WVG_IMAGE_ICONFILE, hb_dirBase() + "vr1.ico" }
{ "Vouch", WVG_IMAGE_ICONRESOURCE, 212 /*Numeric ID in resource*/ }
{ "Vouch", WVG_IMAGE_ICONRESOURCE, "VOUCHICO" /*Character ID in resource*/ }
IMPORTANT - :caption has to be defined before :create() is called.
* contrib/gtwvg/tests/demowvg.prg
+ Added: code to demonstrate above usage.
2013-04-03 05:48 UTC+0200 Viktor Szakats (harbour syenar.net)
* config/po2lang.hb
* hide e-mail in lang .c files
@@ -4345,7 +4377,7 @@
* harbour/src/codepage/cpua866.c
! fixed UA866 definition. CP866 does not contain cyrillic version
of "I" and "i" letters and also "Ґ" and "ґ" so Ukrainian letters
of "I" and "i" letters and also "?" and "?" so Ukrainian letters
defined in l_ua.c cannot be used.
2013-01-31 14:04 UTC+0100 Viktor Szakats (harbour syenar.net)

View File

@@ -112,6 +112,15 @@ METHOD WvgPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
ELSEIF ".BMP" == Upper( Right( ::caption, 4 ) )
::style += BS_BITMAP
ENDIF
ELSEIF HB_ISARRAY( ::caption )
ASize( ::caption, 3 )
IF HB_ISNUMERIC( ::caption[ 2 ] )
IF ::caption[ 2 ] == WVG_IMAGE_ICONFILE .OR. ::caption[ 2 ] == WVG_IMAGE_ICONRESOURCE
::style += BS_ICON
ELSEIF ::caption[ 2 ] == WVG_IMAGE_BITMAPFILE .OR. ::caption[ 2 ] == WVG_IMAGE_BITMAPRESOURCE
::style += BS_BITMAP
ENDIF
ENDIF
ENDIF
IF ! ::border
::style += BS_FLAT
@@ -199,24 +208,56 @@ METHOD WvgPushButton:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisi
RETURN Self
METHOD WvgPushButton:setCaption( xCaption, cDll )
LOCAL nLoadFromResByIdNumber := 0
LOCAL nLoadFromResByIdName := 1
LOCAL nLoadFromDiskFile := 2
__defaultNIL( @xCaption, ::caption )
HB_SYMBOL_UNUSED( cDll )
::caption := xCaption
IF HB_ISSTRING( xCaption )
::caption := xCaption
IF ".ico" == Lower( Right( ::caption, 4 ) )
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( ::caption, 2, IMAGE_ICON ) )
IF ".ICO" == Upper( Right( ::caption, 4 ) )
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( ::caption, nLoadFromDiskFile, IMAGE_ICON ) )
ELSEIF ".BMP" == Upper( Right( ::caption, 4 ) )
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_BITMAP, Wvg_LoadImage( ::caption, 2, IMAGE_BITMAP ) )
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_BITMAP, Wvg_LoadImage( ::caption, nLoadFromDiskFile, IMAGE_BITMAP ) )
ELSE
Wvg_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption )
ENDIF
ELSEIF HB_ISNUMERIC( xCaption ) /* Handle to the bitmap */
::caption := xCaption
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_BITMAP, ::caption )
ELSEIF HB_ISARRAY( xCaption )
ASize( xCaption, 4 )
IF HB_ISCHAR( xCaption[ 1 ] )
Wvg_SendMessageText( ::hWnd, WM_SETTEXT, 0, xCaption[ 1 ] )
ENDIF
IF ! Empty( xCaption[ 2 ] )
SWITCH xCaption[ 2 ]
CASE WVG_IMAGE_ICONFILE
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( xCaption[ 3 ], nLoadFromDiskFile, IMAGE_ICON ) )
EXIT
CASE WVG_IMAGE_ICONRESOURCE
IF ValType( xCaption[ 3 ] ) == "C"
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( xCaption[ 3 ], nLoadFromResByIdName, IMAGE_ICON ) )
ELSE
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( xCaption[ 3 ], nLoadFromResByIdNumber, IMAGE_ICON ) )
ENDIF
EXIT
CASE WVG_IMAGE_BITMAPFILE
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_BITMAP, Wvg_LoadImage( xCaption[ 3 ], nLoadFromDiskFile, IMAGE_BITMAP ) )
EXIT
CASE WVG_IMAGE_BITMAPRESOURCE
IF ValType( xCaption[ 3 ] ) == "C"
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( xCaption[ 3 ], nLoadFromResByIdName, IMAGE_BITMAP ) )
ELSE
Wvg_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, Wvg_LoadImage( xCaption[ 3 ], nLoadFromResByIdNumber, IMAGE_BITMAP ) )
ENDIF
EXIT
ENDSWITCH
ENDIF
ENDIF
RETURN Self

View File

@@ -20,6 +20,7 @@
#include "inkey.ch"
#include "hbgtinfo.ch"
#include "wvgparts.ch"
REQUEST DBFCDX
REQUEST DBFNTX
@@ -579,10 +580,10 @@ FUNCTION BuildButtons()
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F.
oXbp:caption := IMAGE_VR
oXbp:caption := { "Vouch", WVG_IMAGE_ICONFILE, IMAGE_VR }
oXbp:border := .F.
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -31 }, { -2, -4 } )
oXbp:activate := {|| hb_threadStart( {|| demoXbp() } ) } // {|| Wvt_Keyboard( K_F8 ) }
oXbp:activate := {|| hb_threadStart( {|| demoXbp() } ) }
oXbp:toolTipText := "Flat Button . Lines: press ESC when finished."
RETURN NIL

View File

@@ -212,4 +212,9 @@
#define WVGCOMBO_DROPDOWN 2
#define WVGCOMBO_DROPDOWNLIST 3
#define WVG_IMAGE_ICONFILE 1
#define WVG_IMAGE_ICONRESOURCE 2
#define WVG_IMAGE_BITMAPFILE 3
#define WVG_IMAGE_BITMAPRESOURCE 4
#endif /* _WVG_CH */