diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c77659c37d..4c4e3ada6d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,77 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-11-30 23:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/makefile + * harbour/contrib/gtwvg/common.mak + + wvgparts.ch + + wincallb.c + + wincback.prg + + wvglistb.prg + + wvgpushb.prg + + wvgstatb.prg + + wvgstatc.prg + + wvgtreev.prg + + * harbour/contrib/gtwvg/wvggui.c + * harbour/contrib/gtwvg/wvgsink.c + * harbour/contrib/gtwvg/wvgutils.c + * harbour/contrib/gtwvg/wvgwin.c + * harbour/contrib/gtwvg/hbgtwvg.ch + * harbour/contrib/gtwvg/wvgparts.ch + * harbour/contrib/gtwvg/wvtwin.ch + * harbour/contrib/gtwvg/wvgax.prg + * harbour/contrib/gtwvg/wvgcrt.prg + * harbour/contrib/gtwvg/wvgdlg.prg + * harbour/contrib/gtwvg/wvgmenub.prg + * harbour/contrib/gtwvg/wvgphdlr.prg + * harbour/contrib/gtwvg/wvgtoolb.prg + * harbour/contrib/gtwvg/wvgwnd.prg + ! More synchronization, more events firings, etc. + + + harbour/contrib/gtwvg/wincback.prg + + harbour/contrib/gtwvg/wincallb.c + Now PRG/C level callback procedures/code blocks/methods + are made available by Andy Wos. A big thank you. + + :nWndProc := HB_AsCallBack( 'MYWNDPROC', Self ) + + METHOD MYWndProc( hWnd, nMessage, nwParam, nlParam ) + IF nMessage == WM_LBUTTONDOWN + Win_MessageBox( , 'Prg level callback procedure!, 'Info' ) + RETURN 0 + ENDIF + + RETURN 1 + + Before this mechanism was available with only C callbacks which + were of limiting nature. It has made our life so easy. + + + harbour/contrib/gtwvg/wvglistb.prg + + harbour/contrib/gtwvg/wvgcombo.prg + + harbour/contrib/gtwvg/wvgpushb.prg + + harbour/contrib/gtwvg/wvgstatb.prg + + harbour/contrib/gtwvg/wvgstatc.prg + + harbour/contrib/gtwvg/wvgtreev.prg + + Added Xbase++ compatible new classes. + NOTE: Still a work-in-progress, subject to heavy changes. + Basic functionality is working and class skeletons are in place. + The partially functional classes added are: + WvgStatusBar() + WvgStatic() + WvgPushButton() + + * harbour/contrib/gtwvg/tests/demowvg.prg + + Added functionality of new classes. + + ; TOFIX: harbour/contrib/gtwvg/wvggui.c + Przemek, can you please look into this stripped down + version of gtwvg.c. It has memory leak in inkey() and + hb_gtInfo() functions. To test, just resize the window + and exit, boooom, a big hb_out.log with above mem leak + entries. I am sure I just stripped some important loop + but am unable to locate where. + 2008-11-26 18:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/itemapi.c * changed hb_itemPutNLen() function to create integer item only diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index ece073f4e4..a38b3e5d10 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -15,6 +15,7 @@ C_SOURCES=\ wvgwin.c \ wvgsink.c \ wvggui.c \ + wincallb.c \ PRG_SOURCES=\ wvgclass.prg \ @@ -26,11 +27,19 @@ PRG_SOURCES=\ wvgdlg.prg \ wvgmenub.prg \ wvgtoolb.prg \ + wvgcombo.prg \ + wvglistb.prg \ + wvgpushb.prg \ + wvgstatb.prg \ + wvgstatc.prg \ + wvgtreev.prg \ + wincback.prg \ PRG_HEADERS=\ hbgtwvg.ch \ wvtwin.ch \ + wvgparts.ch \ include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) diff --git a/harbour/contrib/gtwvg/common.mak b/harbour/contrib/gtwvg/common.mak index 83e11898e8..9cb498e812 100644 --- a/harbour/contrib/gtwvg/common.mak +++ b/harbour/contrib/gtwvg/common.mak @@ -9,6 +9,7 @@ LIB_PATH = $(LIB_DIR)$(LIBNAME)$(LIBEXT) PRG_HEADERS=\ hbgtwvg.ch \ wvtwin.ch \ + wvgparts.ch \ LIB_OBJS = \ $(OBJ_DIR)wvgclass$(OBJEXT) \ @@ -20,6 +21,13 @@ LIB_OBJS = \ $(OBJ_DIR)wvgdlg$(OBJEXT) \ $(OBJ_DIR)wvgmenub$(OBJEXT) \ $(OBJ_DIR)wvgtoolb$(OBJEXT) \ + $(OBJ_DIR)wvgcombo$(OBJEXT) \ + $(OBJ_DIR)wvglistb$(OBJEXT) \ + $(OBJ_DIR)wvgpushb$(OBJEXT) \ + $(OBJ_DIR)wvgstatb$(OBJEXT) \ + $(OBJ_DIR)wvgstatc$(OBJEXT) \ + $(OBJ_DIR)wvgtreev$(OBJEXT) \ + $(OBJ_DIR)wincback$(OBJEXT) \ \ $(OBJ_DIR)gtwvg$(OBJEXT) \ $(OBJ_DIR)wvgcore$(OBJEXT) \ @@ -27,6 +35,7 @@ LIB_OBJS = \ $(OBJ_DIR)wvgsink$(OBJEXT) \ $(OBJ_DIR)wvgwin$(OBJEXT) \ $(OBJ_DIR)wvggui$(OBJEXT) \ + $(OBJ_DIR)wincallb$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/gtwvg/hbgtwvg.ch b/harbour/contrib/gtwvg/hbgtwvg.ch index 9bdb1c1758..96ade9e417 100644 --- a/harbour/contrib/gtwvg/hbgtwvg.ch +++ b/harbour/contrib/gtwvg/hbgtwvg.ch @@ -68,6 +68,7 @@ #define HB_GTE_TIMER 8 #define HB_GTE_MENU 9 #define HB_GTE_NOTIFY 10 +#define HB_GTE_COMMAND 11 #define HB_GTI_SETFONT 71 #define HB_GTI_PRESPARAMS 72 @@ -130,56 +131,6 @@ #define HB_GTI_GUI 1001 -//----------------------------------------------------------------------// -// Class Framework Constants -//----------------------------------------------------------------------// - -#define objTypeNone 0 -#define objTypeCrt 1 -#define objTypeWindow 2 -#define objTypeActiveX 3 -#define objTypeDialog 4 -#define objTypeToolBar 5 -#define objTypeToolBarButton 6 -#define objTypeMenu 7 - -//----------------------------------------------------------------------// - -#define WVGALIGN_TOP 0 -#define WVGALIGN_LEFT 0 -#define WVGALIGN_HCENTER 1 -#define WVGALIGN_RIGHT 2 -#define WVGALIGN_VCENTER 4 -#define WVGALIGN_BOTTOM 8 -#define WVGALIGN_WORDBREAK 16 - -#define WVGFRAME_NONE 0 -#define WVGFRAME_RECT 1 -#define WVGFRAME_BOX 2 -#define WVGFRAME_RAISED 16 -#define WVGFRAME_RECESSED 32 -#define WVGFRAME_THICK 128 - -#define WVGTOOLBAR_STYLE_STANDARD 0 -#define WVGTOOLBAR_STYLE_FLAT 1 - -#define WVGTOOLBAR_BUTTON_UNPRESSED 0 -#define WVGTOOLBAR_BUTTON_PRESSED 1 - -#define WVGTOOLBAR_BUTTON_DEFAULT 0 -#define WVGTOOLBAR_BUTTON_TOGGLE 1 -#define WVGTOOLBAR_BUTTON_BUTTONGROUP 2 -#define WVGTOOLBAR_BUTTON_SEPARATOR 3 -#define WVGTOOLBAR_BUTTON_PLACEHOLDER 4 -#define WVGTOOLBAR_BUTTON_DROPDOWN 5 - -#define WVGTOOLBAR_STDIMAGES_SMALL 0 -#define WVGTOOLBAR_STDIMAGES_LARGE 1 -#define WVGTOOLBAR_VIEWIMAGES_SMALL 4 -#define WVGTOOLBAR_VIEWIMAGES_LARGE 5 -#define WVGTOOLBAR_EXPLORERIMAGES_SMALL 8 -#define WVGTOOLBAR_EXPLORERIMAGES_LARGE 9 - //----------------------------------------------------------------------// #endif // _HBGTWVG_CH \ No newline at end of file diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 17f840e4a2..ecb1ef143d 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -30,6 +30,7 @@ #include "wvtwin.ch" #include "hbgtinfo.ch" #include "hbgtwvg.ch" +#include "wvgparts.ch" REQUEST DbfCdx @@ -760,12 +761,13 @@ FUNCTION WvtMyBrowse_X( oCrt ) LOCAL cScr := SaveScreen( 0,0,maxrow(),maxcol() ) LOCAL aObjects:= WvtSetObjects( {} ) LOCAL hPopup := Wvt_SetPopupMenu() - LOCAL stru_:={}, cFileIndex, cFileDbf, cRDD, nIndex + LOCAL stru_:={}, cFileIndex, cFileDbf, cRDD, nIndex, oTBar STATIC nStyle := 0 THREAD STATIC nFactor := 200 BrwBuildMenu( oCrt ) + oTBar := ActiveXBuildToolBar( oCrt ) pGT_[ 2 ] := hb_gtSelect() @@ -2252,426 +2254,6 @@ Static Function MyFunction( nMode ) Return nil //----------------------------------------------------------------------// -Static Function ActiveXBuildMenu( oCrt ) - Local oMenuBar, oSubMenu - - oMenuBar := WvgMenuBar():new( oCrt ):create() - - // Define submenu in procedural style. - // The numeric index of the selected menu item - // is passed to the Callback code block -> mp1 - - oSubMenu := WvgMenu():new( oMenuBar ):create() - oSubMenu:title := "~Procedural" - oSubMenu:addItem( { "Play Charge ~1", } ) - oSubMenu:addItem( { "Play Nannyboo ~2", } ) - oSubMenu:itemSelected := {|mp1| MyFunction( 100+mp1 ) } - oMenuBar:addItem( { oSubMenu, NIL } ) - - - // Define submenu in the functional style: - // A menu item executes a code block that - // calls a function - oSubMenu := WvgMenu():new( oMenuBar ):create() - oSubMenu:title := "~Functional" - oSubMenu:addItem( { "Play Opening ~1", {|| MyFunction( 1 ) } } ) - oSubMenu:addItem( { "Play Closing ~2", {|| MyFunction( 2 ) } } ) - oSubMenu:addItem( { "~MessageBox" , {|| MyFunction( 3 ) } } ) - oMenuBar:addItem( { oSubMenu, NIL } ) - - Return nil -//----------------------------------------------------------------------// -STATIC FUNCTION ActiveXBuildToolBar( oCrt, nActiveX ) - LOCAL oTBar - - oTBar := WvgToolBar():new( oCrt , , { 0,0 }, { oCrt:currentSize()[ 1 ], 30 }, , .T. ) - - oTBar:borderStyle := WVGFRAME_RECT - - oTBar:buttonWidth := 26 - oTBar:buttonHeight := 26 - - oTBar:imageWidth := 24 - oTBar:imageHeight := 24 - - IF ( nActiveX % 2 ) == 1 - oTBar:showToolTips := .f. - ENDIF - - // After setting properties, create toolbar. - oTBar:create() - - oTBar:addItem( "New" , 'c:\harbour\contrib\gtwvg\tests\v_new.bmp' ) - oTBar:addItem( "Select" , 'c:\harbour\contrib\gtwvg\tests\v_selct1.bmp' ) - oTBar:addItem( "Calendar" , 'c:\harbour\contrib\gtwvg\tests\v_calend.bmp' ) - oTBar:addItem( "Lock" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) - oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) - oTBar:addItem( "Calculator", 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) - oTBar:addItem( "Notes" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) - - //oTBar:addItem("Button #2", 101) - //oTBar:transparentColor := WVG_CLR_INVALID - - oTBar:buttonClick := {|oButton| Win_MessageBox( , "Button [" + oButton:caption + "] clicked!" ) } - - RETURN oTBar -//----------------------------------------------------------------------// -// The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } ) -// -Function ExecuteActiveX( nActiveX, xParam ) - Local oCrt, oTBar - - #if 0 - oCrt := WvgCrt():New( , , { 5,5 }, { 29,59 }, , .f. ) - - oCrt:closable := .f. - oCrt:create() - - SetCursor( 0 ) - SetColor( 'N/W' ) - CLS - #else - oCrt := WvgDialog():new( , , { 30,30 }, { 500,550 }, , .f. ) - oCrt:closable := .f. - oCrt:create() - #endif - - ActiveXBuildMenu( oCrt ) - oTBar := ActiveXBuildToolBar( oCrt, nActiveX ) - - oCrt:show() - ExeActiveX( nActiveX, oCrt, oTBar, xParam ) - oCrt:Destroy() - - Return nil -//----------------------------------------------------------------------// -Static Function ResizeMe( oCom, oTBar ) - Local nW, nH, aSize - - nW := hb_gtInfo( HB_GTI_SCREENWIDTH ) - nH := hb_gtInfo( HB_GTI_SCREENHEIGHT ) - - aSize := oTBar:currentSize() - - oTBar:SetSize( { nW, 30 }, .t. ) - - oCom:SetPosAndSize( { 0, aSize[ 2 ] }, { nW, nH - aSize[ 2 ] }, .t. ) - - Return nil -//----------------------------------------------------------------------// -Static Function ExeActiveX( nActiveX, oCrt, oTBar, xParam ) - Local oCom, nKey, sData - Local lEnd := .f. - - static nTurn := 0 - - hb_gtInfo( HB_GTI_DEFERPAINT, .T. ) - - DEFAULT nActiveX TO 2 - - oCom := WvgActiveXControl():New( oCrt, , { 0,27 }, { 200,200 }, , .t. ) - - do case - case nActiveX == 1 - hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'http://www.harbour.vouch.info'+' ]' ) - oCom:CLSID := 'Shell.Explorer.2' - oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - - case nActiveX == 11 - hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'MSHTML Demo'+' ]' ) - oCom:CLSID := "MSHTML:" + "

Stream Test

This HTML content is being loaded from a stream." - oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - - case nActiveX == 2 - #define evClick 1 - #define evDblClk 2 - #define evBtnDown 3 - #define evMouseMove 4 - #define evBtnUp 5 - - hb_gtInfo( HB_GTI_WINTITLE, 'AnalogClockControl.AnalogClock' ) - oCom:CLSID := 'AnalogClockControl.AnalogClock' - oCom:Id := 5 - - oCom:mapEvent( evDblClk, {|| oCom:Value := seconds()/86400 ,; - oCom:BackColor := RGB( 0,140,210 ),; - oCom:Refresh() ,; - oCom:ShowSecondsHand := .t. ,; - oCom:Hands3D := .t. ,; - oCom:Refresh() ,; - oCom:showAboutBox() ; - } ) - - oCom:mapEvent( evBtnUp, {|nBtn| if( nBtn == 2, lEnd := .t., NIL ) } ) - - case nActiveX == 3 - hb_gtInfo( HB_GTI_WINTITLE, 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' ) - oCom:CLSID := 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' - oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - - case nActiveX == 4 - hb_gtInfo( HB_GTI_WINTITLE, 'RM Chart [ Attributes Next Charts ]' ) - oCom:CLSID := 'RMChart.RMChartX' - - // RMChart does not have event interface. - // Trying to set it generates GPF. - // Please download RMChart.ocx from http://www.rmchart.com/ . It is free in everysense. - - endcase - - oCom:create() - if hb_isObject( oCom ) - // After :CREATE() Messages - // - if nActiveX == 1 - oCom:AddressBar := .t. - hb_gtInfo( HB_GTI_WINTITLE, IF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) - oCom:Navigate( IF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) - - elseif nActiveX == 4 - ConfigureRMChart( oCom ) - - oCom:Draw( .t. ) - oCom:Draw2Clipboard() - - endif - - do while !( lEnd ) - nKey := inkey( 0.1 ) - - IF nActiveX == 2 - oCom:Value := seconds()/86400 - ENDIF - - if nKey == HB_K_RESIZE - ResizeMe( oCom, oTBar ) - - elseif nKey == K_F12 - if nActiveX == 1 - oCom:Navigate( 'www.vouch.info' ) - - elseif nActiveX == 11 - //oCom:document( 0 ):InnerHTML := "

Stream Test

This HTML content in a document." - - elseif nActiveX == 4 - oCom:RMCBackColor := 23456142 - oCom:RMCStyle := 2 - oCom:RMCUserWatermark := 'Vouch' - - oCom:Region(1):SetProperties( 5.0,5.0,-5.0,-5.0 ) - - oCom:Draw( .t. ) - endif - - elseif nKey == K_F11 - if nActiveX == 4 - nTurn++ - 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 ) - - 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" - sData += "211|100238|100331|100341|100356|100378|100411|100468|100484|100494|10051-6972|10" - sData += "052-16777216|10053-1828|100541|100558|10056-16777216|10057-16777216|10060-167772" - sData += "16|10061-16777216|1006315|10064-32|100652|10066-16776961|10180this is the footer" - sData += "|10181Example of stacked bars|10182Apples*Pears*Cherries*Strawberries|10183 $|10" - sData += "184This is an optional axis text, sized 9 points and bold\9b|10187Label Nr. 1*La" - sData += "bel Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6|10196This is an option" - sData += "al label axis text|110011|110023|110033|110045|110055|11006-1|1100923|110131|110" - sData += "14-1|110171|11019-16777077|1102111|110221|110236|1105310000*10000*16000*12000*20" - sData += "000*10000|120011|120023|120033|120045|120055|12006-1|1200927|120131|12014-1|1201" - sData += "71|12019-16751616|1202111|120221|120236|120535000*7000*4000*15000*10000*10000|13" - sData += "0011|130023|130033|130045|130055|13006-1|1300982|130131|13014-1|130171|13019-838" - sData += "8608|1302111|130221|130236|1305310000*3000*12000*10000*5000*20000|140011|140023|" - sData += "140033|140045|140055|14006-1|1400925|140131|14014-1|140171|14019-4684277|1402111" - sData += "|140221|140236|140535000*9000*12000*6000*10000*5000" - - case nTurn == 2 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Floating Bars' ) - //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" - sData += "13|100238|100331|100341|100356|100378|100411|100468|100482|10052-16777216|10053-" - sData += "1120086|100544|100555|10056-16777216|10057-16777216|10060-16777216|10061-1677721" - sData += "6|1006316|10064-5383962|100652|10066-16777011|10181Birth of a Killer App|10182Sc" - sData += "hedule*Reality|10187Design*Development*Testing*Bug Fixing*Documentation*Marketin" - sData += "g|1020104/01*04/02*04/03*04/04*04/05*04/06*04/07*04/08*04/09*04/10*04/11*04/12*0" - sData += "5/01|110011|110026|110044|110101|110131|11019-6751336|1102111|110221|1102312|110" - sData += "531*3*4*6*6*4*7*4*9*3*10*3|120011|120026|120044|120101|120132|12019-47872|120211" - sData += "1|120221|1202312|120531*.5*1.5*10.5*12*1*12*1*12.5*.5*2*11" - - case nTurn == 3 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Four Regions' ) - //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" - sData += "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721" - sData += "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-" - sData += "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004" - sData += "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7" - sData += "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200" - sData += "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848" - sData += "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060" - sData += "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210" - sData += "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210" - sData += "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091" - sData += "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2" - sData += "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2" - sData += "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400" - sData += "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011" - sData += "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848" - sData += "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009" - sData += "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40" - sData += "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020" - sData += "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400" - sData += "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558" - sData += "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018" - sData += "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410" - sData += "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420" - sData += "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420" - sData += "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5." - sData += "2*11.4*7.3*4.2" - - case nTurn == 4 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'10 Biggest Companies' ) - //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" - sData += "|10021250000|1002211|100239|100281|100292|100300|100310|100322|100331|100341|100" - sData += "3510|100378|100482|100492|10051-32944|10052-1296|10053-983041|100541|100558|1005" - sData += "6-1828|10057-16777216|100592|10060-1828|10061-16777216|10180data source: F.A.Z|1" - sData += "0181The world's 10 biggest industrial companies 2003|10183$ |10184Total turnover" - sData += " in Mill. Dollar|10185 %|10186Net operating margin|10187Exxon Mobil*Royal Dutch " - sData += "/ Shell*BP*General Motors*Daimler Chrysler*Ford Motor*Toyota Motor*General Elect" - sData += "ric*TOTAL*Chevron Texaco|110011|110021|110031|110043|110053|11006-1|1100950|1101" - sData += "31|11014-1|110171|11019-10496|1102111|110221|1102310|11053242365*235598*232571*1" - sData += "85524*170457*164196*149321*132797*130067*119703|120011|1200221|120035|1200422|12" - sData += "0052|120061|120071|1200970|120111|120121|120131|1201421|120171|12019-16744448|12" - sData += "02115|120221|1202310|120261|120538.9*4.1*4.4*2.1*.3*.3*5.9*11.3*6.7*6" - - case nTurn == 5 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Grouped Bars' ) - //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" - sData += "1100|1002211|100238|100331|100341|100355|100378|100468|100484|10053-2|100541|100" - sData += "558|100631|100651|10182First quarter*Second quarter*Third quarter*Fourth quarter" - sData += "|101872000*2001*2002*2003*2004|110011|110022|110044|110131|1102111|110221|110235" - sData += "|1105330*20*40*60*10|120011|120022|120044|120131|1202111|120221|120235|1205330*2" - sData += "0*50*70*60|130011|130022|130044|130131|1302111|130221|130235|1305340*10*30*20*80" - sData += "|140011|140022|140044|140131|1402111|140221|140235|1405370*50*80*40*30" - - case nTurn == 6 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Flow Chart' ) - //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" - sData += "01325|01014-5952982|01015-5952982|01016255|010191|0102010|01026Start|01030-256|0" - sData += "10012|010054|0100721|01014-16776961|010222|01024100*100|0102550*75|01026|010272|" - sData += "010293|010013|010051|010071|010081|0101050|0101175|01012100|0101325|01014-669788" - sData += "2|01015-6697882|01016255|010191|0102010|01026i = 1|01030-16777216|010014|010054|" - sData += "0100721|01014-16776961|010222|01024100*100|01025100*150|01026|010272|010293|0100" - sData += "15|010051|010073|010081|0101050|01011150|01012100|0101350|01014-65536|01015-6553" - sData += "6|01016255|010191|0102010|01026i = 39?|01030-256|010016|010054|0100721|01014-167" - sData += "76961|010222|01024100*100|01025200*225|01026|010272|010293|010017|010051|010071|" - sData += "010081|0101050|01011225|01012100|0101325|01014-6697882|01015-6697882|01016255|01" - sData += "0191|0102010|01026i = i + 1|01030-16777216|010018|010054|0100721|01014-16776961" - sData += "|010222|01024100*100|01025250*275|01026|010272|010293|010019|010051|010073|01008" - sData += "1|0101050|01011275|01012100|0101350|01014-65536|01015-65536|01016255|010191|0102" - sData += "010|01026i <= 100|01030-256|0100110|010054|0100721|01014-16776961|010222|0102410" - sData += "0*100|01025325*350|01026|010272|010293|0100111|010051|010072|010081|0101050|0101" - sData += "1350|01012100|0101325|01014-5952982|01015-5952982|01016255|010191|0102010|01026S" - sData += "top|01030-256|0100113|010054|0100721|01014-16776961|010222|01024150*200|01025175" - sData += "*175|01026|010272|010293|0100114|010051|010081|01010145|01011157|0101250|01014-1" - sData += "6776961|01015-5383962|01016255|010191|0102010|01026yes|01030-16777216|0100115|01" - sData += "0051|010071|010081|01010200|01011162|01012100|0101325|01014-6697882|01015-669788" - sData += "2|01016255|010191|0102010|01026i = 69|01030-16777216|0100116|010054|0100721|0101" - sData += "4-16776961|010224|0102450*10*10*100|01025300*300*125*125|01026|010272|010293|010" - sData += "0117|010054|0100721|01014-16776961|010223|01024250*250*100|01025162*125*125|0102" - sData += "6|010272|010293|0100118|010051|010081|01010100|01011200|0101250|0101325|01014-16" - sData += "776961|01016255|010191|0102010|01026no|01030-16777216|0100119|010051|010081|0101" - sData += "010|01011280|0101240|01014-16776961|01016255|010191|0102010|01026yes|01030-16777" - sData += "216|0100120|010051|010081|01010100|01011322|0101250|01014-16776961|01016255|0101" - sData += "91|0102010|01026no|01030-16777216|0100120|010051|010079|01010180|01011280|010121" - sData += "20|01013100|01015-39322|010191|010209|01026RMChart is not a flowchart tool. This" - sData += " is just an example for the use of CustomObjects!|01030-256" - - endcase - - oCom:Reset() - oCom:RMCFile := sData - oCom:Draw( .t. ) - ResizeMe( oCom ) - endif - - endif - - if nKey == 27 - exit - endif - enddo - - oCom:Destroy() - oCom := NIL - endif - - Return nil -//----------------------------------------------------------------------// -Function ConfigureRMChart( RMChart ) - - #define RMC_CTRLSTYLEFLAT 0 - #define RMC_PIE_GRADIENT 52 - #define RMC_FULL 1 - #define RMC_EXPLODE_NONE 0 - #define RMC_VLABEL_ABSOLUTE 6 - #define RMC_HATCHBRUSH_OFF 0 - - /* The code pulled from freewin sources */ - WITH OBJECT RMChart - :Font := "Tahoma" - :RMCStyle := RMC_CTRLSTYLEFLAT - - :AddRegion() - WITH OBJECT :Region( 1 ) - :Footer = "http://vouch.info" - - :AddCaption() - WITH OBJECT :Caption() - :Titel := "GTWVG Active-X Demo" - :FontSize := 10 - :Bold := .T. - END - - :AddGridlessSeries() - - WITH OBJECT :GridLessSeries - :SeriesStyle := RMC_PIE_GRADIENT - :Alignment := RMC_FULL - :Explodemode := RMC_EXPLODE_NONE - :Lucent := .F. - :ValueLabelOn := RMC_VLABEL_ABSOLUTE - :HatchMode := RMC_HATCHBRUSH_OFF - :StartAngle := 0 - :DataString := "10*5*20*25" - END - END - END - - Return nil -//----------------------------------------------------------------------// Static Function DoModalWindow() Local oCrt, nSel @@ -2756,3 +2338,476 @@ FUNCTION GoogleMap() RETURN nil //----------------------------------------------------------------------// +// The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } ) +// +Function ExecuteActiveX( nActiveX, xParam ) + Local oCrt, oTBar, oSBar, oPanel, oStatic, oCom, oXbp + + HB_SYMBOL_UNUSED( xParam ) + HB_SYMBOL_UNUSED( oCom ) + + oCrt := WvgDialog():new( , , { 30,30 }, { 600,500 }, , .f. ) + oCrt:closable := .t. + oCrt:create() + + // Menu + ActiveXBuildMenu( oCrt ) + + // Toolbar + oTBar := ActiveXBuildToolBar( oCrt, nActiveX ) + + // Statusbar + oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .t. ) + oSBar:panelClick := {|oPanel| Win_MessageBox( , oPanel:caption ) } + oPanel := oSBar:getItem( 1 ) + oPanel:caption := 'My Root Panel' + oPanel := oSBar:addItem() + oPanel:caption := 'Ready' + oPanel := oSBar:addItem() + oPanel:caption := 'Click on any part!' + + // Static text + oStatic := WvgStatic():new( oCrt ) + oStatic:caption := 'This is a Harbour dialog and is compatible with Xbase++ Parts. '+; + 'XbpDialog(), XbpMenuBar(), XbpToolBar(), XbpStatusBar(), ' +; + 'XbpStatic() classes have been implemented' + oStatic:options := WVGSTATIC_TEXT_LEFT + WVGSTATIC_TEXT_WORDBREAK + oStatic:create( , , { 0, oTBar:currentSize()[2] }, { 120, oCrt:currentSize()[2]-; + oTBar:currentSize()[2]-oSBar:currentSize()[2] }, , .t. ) + oStatic:resize := {|mp1,mp2,oSelf,w,x,y| mp1 := mp1, mp2 := mp2, oSelf := oSelf, ; + w := oCrt:currentSize() ,; + x := oTBar:currentSize() ,; + y := oSBar:currentSize() ,; + oStatic:setPosAndSize( { 0, x[2]+3 }, { 120, w[2]-x[2]-y[2]-4 }, .f. ) } + + // Pushbuttons + oXbp := WvgPushButton():new( oStatic ) + oXbp:caption := "A" + oXbp:create( , , { 20,250 }, {80,40} ) + oXbp:activate:= {|| Win_MessageBox( , "Pushbutton A" ) } + // Pushbuttons + oXbp := WvgPushButton():new( oStatic ) + oXbp:caption := "B" + oXbp:create( , , { 20,300 }, {80,40} ) + oXbp:activate:= {|| Win_MessageBox( , "Pushbutton B" ) } + + + #if 1 + // ActiveX Controls + oCom := BuildActiveXControl( nActiveX, oCrt ) + oCom:resize := {|m1,m2,o,w,x,y,z| m1 := m1, m2 := m2, o := o, ; + w := oCrt:currentSize() ,; + x := oTBar:currentSize() ,; + y := oSBar:currentSize() ,; + z := oStatic:currentSize(),; + oCom:setPosAndSize( { z[1], x[2] }, { w[1]-z[1], w[2]-x[2]-y[2] }, .t. ), 1 } + if hb_isObject( oCom ) + oCrt:sendMessage( WM_SIZE, 0, 0 ) + oCrt:show() + ExeActiveX( nActiveX, oCom, xParam ) + ENDIF + #endif + + oCrt:Destroy() + Return nil +//----------------------------------------------------------------------// +STATIC FUNCTION ActiveXBuildToolBar( oCrt, nActiveX ) + LOCAL oTBar + + DEFAULT nActiveX TO 0 + + oTBar := WvgToolBar():new( oCrt , , { 0,0 }, { oCrt:currentSize()[ 1 ], 30 }, , .T. ) + + oTBar:borderStyle := WVGFRAME_RECT + + oTBar:buttonWidth := 28 + oTBar:buttonHeight := 26 + + oTBar:imageWidth := 26 + oTBar:imageHeight := 24 + + IF ( nActiveX % 2 ) == 1 + oTBar:showToolTips := .f. + ENDIF + + // After setting properties, create toolbar. + oTBar:create() + + oTBar:addItem( "New" , 'c:\harbour\contrib\gtwvg\tests\v_new.bmp' ) + oTBar:addItem( "Select" , 'c:\harbour\contrib\gtwvg\tests\v_selct1.bmp' ) + oTBar:addItem( "Calendar" , 'c:\harbour\contrib\gtwvg\tests\v_calend.bmp' ) + oTBar:addItem( "Lock" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) + oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) + oTBar:addItem( "Calculator", 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) + oTBar:addItem( "Notes" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) + + //oTBar:addItem("Button #2", 101) + //oTBar:transparentColor := WVG_CLR_INVALID + + oTBar:buttonClick := {|oButton| Win_MessageBox( , "Button [" + oButton:caption + "] clicked!" ) } + + RETURN oTBar +//----------------------------------------------------------------------// +Static Function ActiveXBuildMenu( oCrt ) + Local oMenuBar, oSubMenu + + oMenuBar := WvgMenuBar():new( oCrt ):create() + + // Define submenu in procedural style. + // The numeric index of the selected menu item + // is passed to the Callback code block -> mp1 + + oSubMenu := WvgMenu():new( oMenuBar ):create() + oSubMenu:title := "~Procedural" + oSubMenu:addItem( { "Play Charge ~1", } ) + oSubMenu:addItem( { "Play Nannyboo ~2", } ) + oSubMenu:itemSelected := {|mp1| MyFunction( 100+mp1 ) } + oMenuBar:addItem( { oSubMenu, NIL } ) + + + // Define submenu in the functional style: + // A menu item executes a code block that + // calls a function + oSubMenu := WvgMenu():new( oMenuBar ):create() + oSubMenu:title := "~Functional" + oSubMenu:addItem( { "Play Opening ~1", {|| MyFunction( 1 ) } } ) + oSubMenu:addItem( { "Play Closing ~2", {|| MyFunction( 2 ) } } ) + oSubMenu:addItem( { "~MessageBox" , {|| MyFunction( 3 ) } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + + Return nil +//----------------------------------------------------------------------// +STATIC FUNCTION BuildActiveXControl( nActiveX, oCrt ) + LOCAL oCom + + DEFAULT nActiveX TO 2 + + oCom := WvgActiveXControl():New( oCrt, , { 0, 0 }, { 100, 100 }, , .t. ) + + do case + case nActiveX == 1 + hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'http://www.harbour.vouch.info'+' ]' ) + oCom:CLSID := 'Shell.Explorer.2' + oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) + + case nActiveX == 11 + hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'MSHTML Demo'+' ]' ) + oCom:CLSID := "MSHTML:" + "

Stream Test

This HTML content is being loaded from a stream." + oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) + + case nActiveX == 2 + #define evClick 1 + #define evDblClk 2 + #define evBtnDown 3 + #define evMouseMove 4 + #define evBtnUp 5 + + hb_gtInfo( HB_GTI_WINTITLE, 'AnalogClockControl.AnalogClock' ) + oCom:CLSID := 'AnalogClockControl.AnalogClock' + oCom:Id := 5 + + oCom:mapEvent( evDblClk, {|| oCom:Value := seconds()/86400 ,; + oCom:BackColor := RGB( 0,140,210 ),; + oCom:Refresh() ,; + oCom:ShowSecondsHand := .t. ,; + oCom:Hands3D := .t. ,; + oCom:Refresh() ,; + oCom:showAboutBox() ; + } ) + + oCom:mapEvent( evBtnUp, {|nBtn| if( nBtn == 2, oCom:oParent:sendMessage( WM_CLOSE,0,0 ), NIL ) } ) + + case nActiveX == 3 + hb_gtInfo( HB_GTI_WINTITLE, 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' ) + oCom:CLSID := 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' + oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) + + case nActiveX == 4 + hb_gtInfo( HB_GTI_WINTITLE, 'RM Chart [ Attributes Next Charts ]' ) + oCom:CLSID := 'RMChart.RMChartX' + + // RMChart does not have event interface. + // Trying to set it generates GPF. + // Please download RMChart.ocx from http://www.rmchart.com/ . It is free in everysense. + + endcase + + oCom:create() + + RETURN oCom +//----------------------------------------------------------------------// +Static Function ExeActiveX( nActiveX, oCom, xParam ) + Local nKey, sData + + static nTurn := 0 + + // After :CREATE() Messages + // + if nActiveX == 1 + oCom:AddressBar := .t. + hb_gtInfo( HB_GTI_WINTITLE, IF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) + oCom:Navigate( IF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) + + elseif nActiveX == 4 + ConfigureRMChart( oCom ) + oCom:Draw( .t. ) + oCom:Draw2Clipboard() + + endif + + do while .t. + nKey := inkey() + + IF nActiveX == 2 + oCom:Value := seconds()/86400 + ENDIF + + if nKey == K_F12 + if nActiveX == 1 + oCom:Navigate( 'www.vouch.info' ) + + elseif nActiveX == 11 + //oCom:document( 0 ):InnerHTML := "

Stream Test

This HTML content in a document." + + elseif nActiveX == 4 + oCom:RMCBackColor := 23456142 + oCom:RMCStyle := 2 + oCom:RMCUserWatermark := 'Vouch' + + oCom:Region(1):SetProperties( 5.0,5.0,-5.0,-5.0 ) + + oCom:Draw( .t. ) + endif + + elseif nKey == K_F11 + if nActiveX == 4 + nTurn++ + 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 ) + + 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" + sData += "211|100238|100331|100341|100356|100378|100411|100468|100484|100494|10051-6972|10" + sData += "052-16777216|10053-1828|100541|100558|10056-16777216|10057-16777216|10060-167772" + sData += "16|10061-16777216|1006315|10064-32|100652|10066-16776961|10180this is the footer" + sData += "|10181Example of stacked bars|10182Apples*Pears*Cherries*Strawberries|10183 $|10" + sData += "184This is an optional axis text, sized 9 points and bold\9b|10187Label Nr. 1*La" + sData += "bel Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6|10196This is an option" + sData += "al label axis text|110011|110023|110033|110045|110055|11006-1|1100923|110131|110" + sData += "14-1|110171|11019-16777077|1102111|110221|110236|1105310000*10000*16000*12000*20" + sData += "000*10000|120011|120023|120033|120045|120055|12006-1|1200927|120131|12014-1|1201" + sData += "71|12019-16751616|1202111|120221|120236|120535000*7000*4000*15000*10000*10000|13" + sData += "0011|130023|130033|130045|130055|13006-1|1300982|130131|13014-1|130171|13019-838" + sData += "8608|1302111|130221|130236|1305310000*3000*12000*10000*5000*20000|140011|140023|" + sData += "140033|140045|140055|14006-1|1400925|140131|14014-1|140171|14019-4684277|1402111" + sData += "|140221|140236|140535000*9000*12000*6000*10000*5000" + + case nTurn == 2 + hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Floating Bars' ) + //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" + sData += "13|100238|100331|100341|100356|100378|100411|100468|100482|10052-16777216|10053-" + sData += "1120086|100544|100555|10056-16777216|10057-16777216|10060-16777216|10061-1677721" + sData += "6|1006316|10064-5383962|100652|10066-16777011|10181Birth of a Killer App|10182Sc" + sData += "hedule*Reality|10187Design*Development*Testing*Bug Fixing*Documentation*Marketin" + sData += "g|1020104/01*04/02*04/03*04/04*04/05*04/06*04/07*04/08*04/09*04/10*04/11*04/12*0" + sData += "5/01|110011|110026|110044|110101|110131|11019-6751336|1102111|110221|1102312|110" + sData += "531*3*4*6*6*4*7*4*9*3*10*3|120011|120026|120044|120101|120132|12019-47872|120211" + sData += "1|120221|1202312|120531*.5*1.5*10.5*12*1*12*1*12.5*.5*2*11" + + case nTurn == 3 + hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Four Regions' ) + //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" + sData += "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721" + sData += "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-" + sData += "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004" + sData += "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7" + sData += "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200" + sData += "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848" + sData += "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060" + sData += "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210" + sData += "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210" + sData += "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091" + sData += "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2" + sData += "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2" + sData += "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400" + sData += "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011" + sData += "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848" + sData += "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009" + sData += "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40" + sData += "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020" + sData += "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400" + sData += "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558" + sData += "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018" + sData += "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410" + sData += "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420" + sData += "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420" + sData += "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5." + sData += "2*11.4*7.3*4.2" + + case nTurn == 4 + hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'10 Biggest Companies' ) + //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" + sData += "|10021250000|1002211|100239|100281|100292|100300|100310|100322|100331|100341|100" + sData += "3510|100378|100482|100492|10051-32944|10052-1296|10053-983041|100541|100558|1005" + sData += "6-1828|10057-16777216|100592|10060-1828|10061-16777216|10180data source: F.A.Z|1" + sData += "0181The world's 10 biggest industrial companies 2003|10183$ |10184Total turnover" + sData += " in Mill. Dollar|10185 %|10186Net operating margin|10187Exxon Mobil*Royal Dutch " + sData += "/ Shell*BP*General Motors*Daimler Chrysler*Ford Motor*Toyota Motor*General Elect" + sData += "ric*TOTAL*Chevron Texaco|110011|110021|110031|110043|110053|11006-1|1100950|1101" + sData += "31|11014-1|110171|11019-10496|1102111|110221|1102310|11053242365*235598*232571*1" + sData += "85524*170457*164196*149321*132797*130067*119703|120011|1200221|120035|1200422|12" + sData += "0052|120061|120071|1200970|120111|120121|120131|1201421|120171|12019-16744448|12" + sData += "02115|120221|1202310|120261|120538.9*4.1*4.4*2.1*.3*.3*5.9*11.3*6.7*6" + + case nTurn == 5 + hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Grouped Bars' ) + //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" + sData += "1100|1002211|100238|100331|100341|100355|100378|100468|100484|10053-2|100541|100" + sData += "558|100631|100651|10182First quarter*Second quarter*Third quarter*Fourth quarter" + sData += "|101872000*2001*2002*2003*2004|110011|110022|110044|110131|1102111|110221|110235" + sData += "|1105330*20*40*60*10|120011|120022|120044|120131|1202111|120221|120235|1205330*2" + sData += "0*50*70*60|130011|130022|130044|130131|1302111|130221|130235|1305340*10*30*20*80" + sData += "|140011|140022|140044|140131|1402111|140221|140235|1405370*50*80*40*30" + + case nTurn == 6 + hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Flow Chart' ) + //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" + sData += "01325|01014-5952982|01015-5952982|01016255|010191|0102010|01026Start|01030-256|0" + sData += "10012|010054|0100721|01014-16776961|010222|01024100*100|0102550*75|01026|010272|" + sData += "010293|010013|010051|010071|010081|0101050|0101175|01012100|0101325|01014-669788" + sData += "2|01015-6697882|01016255|010191|0102010|01026i = 1|01030-16777216|010014|010054|" + sData += "0100721|01014-16776961|010222|01024100*100|01025100*150|01026|010272|010293|0100" + sData += "15|010051|010073|010081|0101050|01011150|01012100|0101350|01014-65536|01015-6553" + sData += "6|01016255|010191|0102010|01026i = 39?|01030-256|010016|010054|0100721|01014-167" + sData += "76961|010222|01024100*100|01025200*225|01026|010272|010293|010017|010051|010071|" + sData += "010081|0101050|01011225|01012100|0101325|01014-6697882|01015-6697882|01016255|01" + sData += "0191|0102010|01026i = i + 1|01030-16777216|010018|010054|0100721|01014-16776961" + sData += "|010222|01024100*100|01025250*275|01026|010272|010293|010019|010051|010073|01008" + sData += "1|0101050|01011275|01012100|0101350|01014-65536|01015-65536|01016255|010191|0102" + sData += "010|01026i <= 100|01030-256|0100110|010054|0100721|01014-16776961|010222|0102410" + sData += "0*100|01025325*350|01026|010272|010293|0100111|010051|010072|010081|0101050|0101" + sData += "1350|01012100|0101325|01014-5952982|01015-5952982|01016255|010191|0102010|01026S" + sData += "top|01030-256|0100113|010054|0100721|01014-16776961|010222|01024150*200|01025175" + sData += "*175|01026|010272|010293|0100114|010051|010081|01010145|01011157|0101250|01014-1" + sData += "6776961|01015-5383962|01016255|010191|0102010|01026yes|01030-16777216|0100115|01" + sData += "0051|010071|010081|01010200|01011162|01012100|0101325|01014-6697882|01015-669788" + sData += "2|01016255|010191|0102010|01026i = 69|01030-16777216|0100116|010054|0100721|0101" + sData += "4-16776961|010224|0102450*10*10*100|01025300*300*125*125|01026|010272|010293|010" + sData += "0117|010054|0100721|01014-16776961|010223|01024250*250*100|01025162*125*125|0102" + sData += "6|010272|010293|0100118|010051|010081|01010100|01011200|0101250|0101325|01014-16" + sData += "776961|01016255|010191|0102010|01026no|01030-16777216|0100119|010051|010081|0101" + sData += "010|01011280|0101240|01014-16776961|01016255|010191|0102010|01026yes|01030-16777" + sData += "216|0100120|010051|010081|01010100|01011322|0101250|01014-16776961|01016255|0101" + sData += "91|0102010|01026no|01030-16777216|0100120|010051|010079|01010180|01011280|010121" + sData += "20|01013100|01015-39322|010191|010209|01026RMChart is not a flowchart tool. This" + sData += " is just an example for the use of CustomObjects!|01030-256" + + endcase + + oCom:Reset() + oCom:RMCFile := sData + oCom:Draw( .t. ) + endif + + endif + + if nKey == 27 + exit + endif + enddo + + Return nil +//----------------------------------------------------------------------// +Function ConfigureRMChart( RMChart ) + + #define RMC_CTRLSTYLEFLAT 0 + #define RMC_PIE_GRADIENT 52 + #define RMC_FULL 1 + #define RMC_EXPLODE_NONE 0 + #define RMC_VLABEL_ABSOLUTE 6 + #define RMC_HATCHBRUSH_OFF 0 + + /* The code pulled from freewin sources */ + WITH OBJECT RMChart + :Font := "Tahoma" + :RMCStyle := RMC_CTRLSTYLEFLAT + + :AddRegion() + WITH OBJECT :Region( 1 ) + :Footer = "http://vouch.info" + + :AddCaption() + WITH OBJECT :Caption() + :Titel := "GTWVG Active-X Demo" + :FontSize := 10 + :Bold := .T. + END + + :AddGridlessSeries() + + WITH OBJECT :GridLessSeries + :SeriesStyle := RMC_PIE_GRADIENT + :Alignment := RMC_FULL + :Explodemode := RMC_EXPLODE_NONE + :Lucent := .F. + :ValueLabelOn := RMC_VLABEL_ABSOLUTE + :HatchMode := RMC_HATCHBRUSH_OFF + :StartAngle := 0 + :DataString := "10*5*20*25" + END + END + END + + Return nil +//----------------------------------------------------------------------// +#if 0 + * harbour/contrib/gtwvg/makefile + * harbour/contrib/gtwvg/wincallb.c + * harbour/contrib/gtwvg/wvggui.c + * harbour/contrib/gtwvg/wvgsink.c + * harbour/contrib/gtwvg/wvgutils.c + * harbour/contrib/gtwvg/wvgwin.c + * harbour/contrib/gtwvg/hbgtwvg.ch + * harbour/contrib/gtwvg/wvgparts.ch + * harbour/contrib/gtwvg/wvtwin.ch + * harbour/contrib/gtwvg/common.mak + * harbour/contrib/gtwvg/wincback.prg + * harbour/contrib/gtwvg/wvgax.prg + * harbour/contrib/gtwvg/wvgcombo.prg + * harbour/contrib/gtwvg/wvgcrt.prg + * harbour/contrib/gtwvg/wvgdlg.prg + * harbour/contrib/gtwvg/wvglistb.prg + * harbour/contrib/gtwvg/wvgmenub.prg + * harbour/contrib/gtwvg/wvgphdlr.prg + * harbour/contrib/gtwvg/wvgpushb.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 + * harbour/contrib/gtwvg/tests/demowvg.prg +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wincallb.c b/harbour/contrib/gtwvg/wincallb.c new file mode 100644 index 0000000000..b5337d2f7d --- /dev/null +++ b/harbour/contrib/gtwvg/wincallb.c @@ -0,0 +1,712 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// A Contribution from Andy Wos +// . +// A Big Thank You +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// Calback pointer interface +// ( to be used with wincback.prg ) +// 6 June 2004, 13 June 2004 +// 5 April 2005 - optional (void) spec added +// January 2006 - used VirtualAlloc to overcome DEP +// February 2006 - reworked using Przemek's brilliant ideas +// prg no longer required. + + +#include +#include "hbapi.h" +#include "hbvm.h" +#include "hbstack.h" +#include "hbapiitm.h" +#include "hbapierr.h" + +void extern hb_ToOutDebug( const char * sTraceMsg, ... ); + +#define MAX_FUNC_SIZE 128 // this must be higher than the largest possible generated + // machine code plus size of CALLBACKDATA structure + // 128 bytes is now more than enough. + +// my virtual memory management structures: + +// callback function pointer and status +typedef struct _FuncData { + LPTSTR pFunc; // the actual function pointer + BOOL bActive; // active flag +} FuncData, *pFuncData; + +// page reservation and commitments +typedef struct _PageData { + LPTSTR lpPage; // pointer to this page + BOOL bCommited; // pages commitment status + pFuncData Functions; // pointer to "array" of functions +} PageData, *pPageData; + +// granular reservations +typedef struct _MemReservation { + LPVOID lpvBase ; // reserved area + pPageData MemPages; // pointer to "array" of pages +} MemReservation, *pMemReservation; + +// callback info +//(stored inside the callback function memory block beyond the function code) +typedef struct CALLBACKDATA { + PHB_DYNS pDynSym; + PHB_ITEM pSelf; + int iFormalParams; + int iCargoParams; + PHB_ITEM * pParams; + BOOL bVoid; +} CALLBACKDATA, * PCALLBACKDATA; + +static void _udp( BYTE * pCode, ULONG ulOffset, void * Address ); // absolute +static void _ucp( BYTE * pCode, ULONG ulOffset, void * Address, ULONG ulNext ); // relative +static LPVOID FuncMemAlloc( void ); +static BOOL FuncMemFree( LPBYTE pMem ); +static LPVOID _GenerateCallback( CALLBACKDATA * pCallback ); + +DWORD dwPageSize = 0; +DWORD dwMinAlloc = 0; +DWORD dwMinReserve = 0; +DWORD dwPagesInAlloc = 0; +DWORD dwFuncsInPage = 0; +DWORD dwReservedLen = 0; + +pMemReservation pAllAllocs = NULL; + +//----------------------------------------------------------------------// +/* + prepare the callback structure and save the xHarbour symbols +*/ +// params: pbcFunc, oObj, nParams, lVoid, cargo_params... + +HB_FUNC( _ASCALLBACK ) +{ + CALLBACKDATA Callback; + + LPVOID pMem; + + int i, iParam; + + if( ISBLOCK( 1 ) ) + { + Callback.pDynSym = hb_dynsymGet( "EVAL" ); + Callback.pSelf = hb_itemNew( hb_param( 1, HB_IT_BLOCK ) ); + } + else + { + if( ISOBJECT( 2 ) ) + { + Callback.pSelf = hb_itemNew( hb_param( 2, HB_IT_OBJECT ) ); + } + else + Callback.pSelf = NULL; + + if( ISCHAR( 1 ) ) + Callback.pDynSym = hb_dynsymGet( hb_parc( 1 ) ); + else if( ISPOINTER( 1 ) ) + Callback.pDynSym = ( ( PHB_SYMB ) hb_parptr( 1 ) )->pDynSym; + else + { + hb_errRT_BASE_SubstR( EG_ARG, 1, NULL, "AsCallback", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); + hb_retnl( 0 ); + return; + } + } + + if( ! Callback.pDynSym ) // is it actually an error? + { + hb_errRT_BASE_SubstR( EG_ARG, 2, NULL, "AsCallback", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); + hb_retnl( 0 ); + return; + } + + Callback.iFormalParams = ISNUM( 3 ) ? hb_parni( 3 ) : 4 ; // default to 4 formal parameters + Callback.bVoid = ISLOG( 4 ) ? hb_parl ( 4 ) : FALSE; // default to non-void function + Callback.iCargoParams = hb_pcount() - 4; + + Callback.pParams = ( PHB_ITEM * ) hb_xgrab( Callback.iCargoParams * sizeof( PHB_ITEM ) ); + iParam = 5; //i + 1; + for( i = 0; i < Callback.iCargoParams; ++i ) + { + Callback.pParams[ i ] = hb_itemNew( hb_param( i + iParam, HB_IT_ANY ) ); + } + + hb_retnl( ( ULONG ) ( pMem = _GenerateCallback( &Callback ) ) ); + + // debugging only + // to see what was generated + if ( ISBYREF( 5 ) ) + hb_storclen( ( char * ) pMem, 128, 5 ); +} +//----------------------------------------------------------------------// +// the actual processing of the callbacks +// +LRESULT __CallbackDispatcher( PCALLBACKDATA pCallback, ... ) +{ + int i; + long lResult; + + // save state? + hb_vmPushState(); + + hb_vmPushSymbol( hb_dynsymSymbol( pCallback->pDynSym ) ); + if( pCallback->pSelf ) + hb_vmPush( pCallback->pSelf ); + else + hb_vmPushNil(); + + // first push the formal parameters + if ( pCallback->iFormalParams ) + { + va_list va; + va_start( va, pCallback ); + + for( i = 1; i <= pCallback->iFormalParams; i++ ) + { + hb_vmPushLong( va_arg( va, DWORD ) ); + } + va_end( va ); + } + + // then push cargo params + for( i = 0; i < pCallback->iCargoParams; ++i ) + { + hb_vmPush( pCallback->pParams[ i ] ); + } + + // execute + if( pCallback->pSelf ) + hb_vmSend( pCallback->iFormalParams + pCallback->iCargoParams ); + else + hb_vmDo( pCallback->iFormalParams + pCallback->iCargoParams ); + + lResult = hb_parnl( -1 ) ; + + hb_vmPopState(); + + return lResult; +} +//----------------------------------------------------------------------// +/* +//i tylko jedna wersje funkcji callback od dynamicznej allokacji: + +LRESULT CALLBACK CallbackTestFunc( LONG hWnd, long nMsg, WPARAM wParam, LPARAM lParam ) +{ + int iHandle = 0; // to podmieniasz na numer hanldera + // own address + + return CallbackDispacher( iHandle, hWnd, nMsg, wParam, lParam ); +} + +//Zas CallbackDispacher() wygladalby tak: + +*/ + +/* + + purpose of this function: + - allocate enough memory for the function itself and the CALLBACK structure + - store pointer to self (to read the callback structure) + - pass the above pointer to the dispatcher plus the formal parameters + - either return a value, or void + +The generated code is equivalent to: +------------------------------------ + +LRESULT CALLBACK GeneratedCode( formal params.... ) +{ + PCALLBACKDATA pCallback = [actual real address] + + return ( __CallbackDispatcher( pCallback, formal params ) ); +} + + void and no void generate the same code, so, it does not matter + except in the universal handler + + if no formal params expected the code is very simple + + 68 .. .. .. .. // push long (constant) + E8 .. .. .. .. // call function + 59 // pop + C3 // return + 90 90 90 // padding + + + if parameters are passed, there is a prolog, + + 55 + 8B EC + + pushing params back to front + 4 bytes per parameter: + + 1: 8B + 2: 45->55->4D->45... + 3: 08+(nParams-nCurrentParam )*4 // 1 based + 4: 50->52->51->50... + + push long constant + 68 .. .. .. .. // push long (constant) + + call function + E8 .. .. .. .. // call function + + clean up after the function call + 83 C4 08 // where 08 is param count dependent -> as per first param + + and epilog+padding + 5D + C2 04 00 // where 04 is paramater count dependent + 90 90 90 +*/ + +static LPVOID _GenerateCallback( CALLBACKDATA * pCallback ) +{ + byte * pMem; + //int nFuncSize; + PCALLBACKDATA pCallbackRecord; + int iOffset; + int i; + int iParVal1; + int iParVal2; + + pMem = FuncMemAlloc(); + + if( pMem ) + { + pCallbackRecord = ( PCALLBACKDATA ) ( pMem + MAX_FUNC_SIZE - sizeof( CALLBACKDATA )-1 ); + memcpy( pCallbackRecord, pCallback, sizeof( CALLBACKDATA ) ); + + if ( pCallback->iFormalParams == 0 ) + { + + BYTE pFuncBody[] = { 0x68, 0x00, 0x00, 0x00, 0x00, // push long (constant) + 0xE8, 0x00, 0x00, 0x00, 0x00, // call function + 0x59, // pop cx + 0xC3, 0x90, 0x90, 0x90 }; // return + // size: 15 + + memcpy( pMem, pFuncBody, 15 ); + _udp( pMem, 1, pCallbackRecord ) ; // update callbackdata pointer + _ucp( pMem, 6, __CallbackDispatcher, 10 ); // update code pointer + + } + else + { + BYTE pFuncProlog[] = { 0x55, // push bp + 0x8B, 0xEC }; // mov bp,sp + + BYTE pFuncEpilog[] = { 0x68, 0x00, 0x00, 0x00, 0x00, // push long (constant) + 0xE8, 0x00, 0x00, 0x00, 0x00, // call function + 0x83, 0xC4, 0x00, + 0x5D, // pop bp + 0xC2, 0x00, 0x00, + 0x90, 0x90, 0x90 }; // size: 20 + + BYTE pParamData[] = { 0x8B, 0x00, 0x00, 0x00 }; + + memcpy( pMem, pFuncProlog, 3 ); + iOffset = 3; + + // add formal parameters + + iParVal1 = 0x45; + iParVal2 = 0x50; + for ( i = 1; i <= pCallback->iFormalParams; i++ ) + { + pParamData[1] = iParVal1; + pParamData[2] = 0x08 + ( ( pCallback->iFormalParams - i )* 4 ); + pParamData[3] = iParVal2; + memcpy( pMem+iOffset, pParamData, 4 ); + iOffset += 4; + + iParVal1 -= 8; + if ( iParVal1 < 0x45 ) + iParVal1 = 0x55; + + iParVal2 --; + if ( iParVal2 < 0x50 ) + iParVal2 = 0x52; + } + + memcpy( pMem+iOffset, pFuncEpilog, 20 ); + _udp( pMem, iOffset+1, pCallbackRecord ) ; // update callbackdata pointer + _ucp( pMem, iOffset+6, __CallbackDispatcher, iOffset+ 10 ); // update code pointer + pMem[ iOffset+12 ] = 0x08 + ( ( pCallback->iFormalParams - 1 )* 4 ); + pMem[ iOffset+15 ] = pCallback->iFormalParams * 4; + } + } + return pMem; +} + +//----------------------------------------------------------------------// + +HB_FUNC( _FREECALLBACK ) +{ + void* ptr = ( void* ) hb_parnl( 1 ); + + hb_retl( FuncMemFree( ptr ) ); + return; +} + +//----------------------------------------------------------------------// +// Intel specific ?? Patch an address relative to the next instruction +// +static void _ucp( BYTE * pCode, ULONG ulOffset, void * Address, ULONG ulNext ) +{ + ULONG ulBase; + ULONG ulRelative; + + ulBase = ( ULONG ) pCode + ulNext; + // Relative to next instruction + ulRelative = ( ULONG ) Address - ulBase; + + pCode[ ulOffset ] = ( BYTE ) ( ( ulRelative ) & 0xFF ); + pCode[ ulOffset + 1 ] = ( BYTE ) ( ( ulRelative >> 8 ) & 0xFF ); + pCode[ ulOffset + 2 ] = ( BYTE ) ( ( ulRelative >> 16 ) & 0xFF ); + pCode[ ulOffset + 3 ] = ( BYTE ) ( ( ulRelative >> 24 ) & 0xFF ); +} +//----------------------------------------------------------------------// +// Patch an address of the dynamic function +// +static void _udp( BYTE * pCode, ULONG ulOffset, void * Address ) +{ + pCode[ ulOffset ] = ( BYTE ) ( ( ( ULONG ) Address ) & 0xFF ); + pCode[ ulOffset + 1 ] = ( BYTE ) ( ( ( ULONG ) Address >> 8 ) & 0xFF ); + pCode[ ulOffset + 2 ] = ( BYTE ) ( ( ( ULONG ) Address >> 16 ) & 0xFF ); + pCode[ ulOffset + 3 ] = ( BYTE ) ( ( ( ULONG ) Address >> 24 ) & 0xFF ); +} +//----------------------------------------------------------------------// +// allocate memory for a function +// it is assumed that in the worst case scenario the function body requires +// 256 bytes. The tests shown that it is in fact 159 bytes, but it has been +// increased to be on the safe side and provide for future expansion of the +// code. + +// on my PC: +// dwPageSize = 4096 +// dwAllocationGranularity = 65536 + +// one page may contain 4096/256 = 16 callback functions +// one min allocation can contain 65536/4096 = 16 pages, and 16*16 = 256 callback functions + +// Note to self: +// it may be required to remove READWRITE flag for systems above Win9* +// use VirtualProtect to change the comitted memory protection scheme +// Note: VirtualProtect is not supported on Win9* systems + +//----------------------------------------------------------------------// + +static LPVOID FuncMemAlloc( void ) +{ + + SYSTEM_INFO sSysInfo; // useful information about the system + LPVOID lpvBase; + //LPVOID lpvResult; + DWORD i,j,k,l; + BOOL bFound; + char * lpPage; + BOOL bError; + LPVOID lpReturn; + + if( dwPageSize == 0 ) + { + GetSystemInfo( &sSysInfo ); // populate the system information structure + dwPageSize = sSysInfo.dwPageSize; + dwMinAlloc = sSysInfo.dwAllocationGranularity; + dwMinReserve = max( dwPageSize, dwMinAlloc ); + dwPagesInAlloc = dwMinReserve/dwPageSize; + dwFuncsInPage = dwPageSize/MAX_FUNC_SIZE; + } + + bFound = FALSE; + bError = FALSE; + lpReturn = NULL; + + // first time called? + if( pAllAllocs == NULL ) + { + // allocate space for the structure + pAllAllocs = ( MemReservation* ) malloc( sizeof( MemReservation ) ); + + // reserve the minimum + lpvBase = VirtualAlloc( + NULL, // system selects address + dwMinReserve, // size of allocation + MEM_RESERVE, // allocate reserved pages + PAGE_NOACCESS ); // protection = no access + + pAllAllocs->lpvBase = lpvBase; // save the reservation + pAllAllocs->MemPages = ( PageData* ) malloc( dwPagesInAlloc * sizeof( PageData ) ); + + for( l = 0 ; l < dwPagesInAlloc ; l++ ) + { + ( ( pAllAllocs )->MemPages+l )->bCommited = FALSE; + } + dwReservedLen = 1; + j = 0; + k = 0; + + } + + //find empty slot + for( i = 0 ; i < dwReservedLen ; i++ ) // each reservation + { + lpPage = ( pAllAllocs+i )->lpvBase; + + for( j = 0 ; j < dwPagesInAlloc ; j++ ) // each reserved page + { + if( ( ( pAllAllocs+i )->MemPages+j )->bCommited ) // if committed + { + for( k = 0 ; k < dwFuncsInPage ; k++ ) + { + if( ! ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->bActive ) // function slot not active + { + bFound = TRUE; + break; + } + } + lpPage += dwPageSize; + } + else // found uncommited page + { + + lpvBase = VirtualAlloc( + lpPage, // system selects address + dwPageSize, // size of allocation + MEM_COMMIT, // allocate reserved pages + PAGE_EXECUTE_READWRITE ); // protection = no access + if( lpvBase == NULL ) + { + // error commiting mem page +//hb_ToOutDebug( "error committing memory" ); + bError = TRUE; + break; + } + + ( ( pAllAllocs+i )->MemPages+j )->lpPage = lpvBase; + ( ( pAllAllocs+i )->MemPages+j )->bCommited = TRUE; + ( ( pAllAllocs+i )->MemPages+j )->Functions = ( FuncData* ) malloc( dwFuncsInPage * sizeof( FuncData ) ); + + for( l = 0 ; l < dwFuncsInPage ; l++ ) + { + ( ( ( pAllAllocs+i )->MemPages+j )->Functions+l )->bActive = FALSE; + ( ( ( pAllAllocs+i )->MemPages+j )->Functions+l )->pFunc = + ( LPTSTR ) ( ( ( LPSTR ) lpvBase) + ( l*MAX_FUNC_SIZE ) ); + } + + j--; // to repeat + } + + if( bFound || bError ) + { + break; + } + } + + if( bError || bFound ) + { + break; + } + + // need to reseve more memory (allocate another block) + if( i == dwReservedLen-1 ) + { + // allocate space for the structure + pAllAllocs = ( MemReservation* ) realloc( pAllAllocs, ( dwReservedLen+1 ) * sizeof( MemReservation ) ); + + // reserve the minimum + lpvBase = VirtualAlloc( + NULL, // system selects address + dwMinReserve, // size of allocation + MEM_RESERVE, // allocate reserved pages + PAGE_NOACCESS ); // protection = no access + + if( lpvBase == NULL ) + { + // error commiting mem page +//hb_ToOutDebug( "error reserving memory" ); + bError = TRUE; + break; + } + + ( pAllAllocs+i+1 )->lpvBase = lpvBase; // save the reservation + ( pAllAllocs+i+1 )->MemPages = ( PageData* ) malloc( dwPagesInAlloc * sizeof( PageData ) ); + + for( l = 0 ; l < dwPagesInAlloc ; l++ ) + { + ( ( pAllAllocs+i+1 )->MemPages+l )->bCommited = FALSE; + } + dwReservedLen++; + } + } + + if( bError ) + { +//hb_ToOutDebug( "error" ); + } + else if( bFound ) + { + ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->bActive = TRUE; + lpReturn = ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->pFunc; + } + + return lpReturn; +} +//----------------------------------------------------------------------// +// free the allocated CALLBACKDATA structure +// +static void FreeCallbackRecord( PCALLBACKDATA pCallback ) +{ + int i; + + if ( pCallback->pSelf ) + hb_itemRelease( pCallback->pSelf ); + + if ( pCallback->iCargoParams ) + { + for ( i = 0; i < pCallback->iCargoParams; ++i ) + { + hb_itemRelease( pCallback->pParams[ i ] ); + } + hb_xfree( pCallback->pParams ); + } +} +//----------------------------------------------------------------------// + +static BOOL FuncMemFree( LPBYTE pMem ) +{ + DWORD i,j,k; + //pPageData lpPage; + BOOL bSuccess = FALSE; + + for( i = 0 ; i < dwReservedLen ; i++ ) // each reservation + { + for( j = 0 ; j < dwPagesInAlloc ; j++ ) // each reserved page + { + if( ( (pAllAllocs+i )->MemPages+j )->bCommited ) // if committed + { + for( k = 0 ; k < dwFuncsInPage ; k++ ) + { + if( ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->bActive ) // function slot active + { + if( pMem == ( LPBYTE ) ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->pFunc ) + { + FreeCallbackRecord( ( PCALLBACKDATA ) ( pMem + MAX_FUNC_SIZE - sizeof( CALLBACKDATA )-1 ) ); + ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->bActive = FALSE; + bSuccess = TRUE; + } + } + } + } + } + } + return bSuccess; +} +//----------------------------------------------------------------------// +// according to MSDN all memory is freed automatically +// perhaps this function is not required at all? +// +static void FuncMemFreeAll( void ) +{ + DWORD i,j,k; + //pPageData lpPage; + LPBYTE pMem; + + if( pAllAllocs != NULL ) + { + for( i = 0 ; i < dwReservedLen ; i++ ) // each reservation + { + for( j = 0 ; j < dwPagesInAlloc ; j++ ) // each reserved page + { + if( ( ( pAllAllocs+i )->MemPages+j )->bCommited ) // if committed + { + for( k = 0 ; k < dwFuncsInPage ; k++ ) + { + if( ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->bActive ) // function slot not active + { + pMem = ( LPBYTE ) ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->pFunc; + FreeCallbackRecord( ( PCALLBACKDATA ) ( pMem + MAX_FUNC_SIZE - sizeof( CALLBACKDATA )-1 ) ); + ( ( ( pAllAllocs+i )->MemPages+j )->Functions+k )->bActive = FALSE; + } + } + free( ( ( pAllAllocs+i )->MemPages+j )->Functions ); + ( ( pAllAllocs+i )->MemPages+j )->bCommited = FALSE; + } + } + free( ( pAllAllocs+i )->MemPages ); + VirtualFree( ( pAllAllocs+1 )->lpvBase, 0, MEM_RELEASE ); + } + free( pAllAllocs ); + pAllAllocs = NULL; + dwReservedLen = 0; + } + return; +} +//----------------------------------------------------------------------// +// as exit procedure +// +HB_FUNC( _FREEALLCALLBACKS ) +{ + FuncMemFreeAll(); +} +//----------------------------------------------------------------------// + + diff --git a/harbour/contrib/gtwvg/wincback.prg b/harbour/contrib/gtwvg/wincback.prg new file mode 100644 index 0000000000..cc612ac273 --- /dev/null +++ b/harbour/contrib/gtwvg/wincback.prg @@ -0,0 +1,144 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// A Contribution from Andy Wos +// . +// A Big Thank You +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'common.ch' + +//----------------------------------------------------------------------// +// +// Calback pointer interface +// ( to be used with _winccback.c ) +// 6 June 2004, 13 June 2004 +// 5 April 2005 (added VOID return option) + +//----------------------------------------------------------------------// +// Universal 32 bit callback procedure interface +// +// Syntax: +// AsCallback( <@MyFunc()>, , [], [], [] ) => pProcPtr +// or +// AsCallback( , , [], [], [] ) => pProcPtr +// or +// AsCallback( , , [], [], [] ) => pProcPtr +// or +// you can replace <@MyFunc()> or with the acual name, eg: "MYFUNC", MYMETH" + +// Returns: - true callback function pointer, or 0 on failure +// + +// Note: Must call FreeCallback( ), when no longer needed +// or memory leak will occur on the application exit. +// All parameters are treated as LONG (32bit) values. +// Also the return value is treated as a numerical LONG (32bit), unless is TRUE. +// +// [] - optional number of formal parameters (not incl. ) +// as passed by the caller, eg. Windows, the default is 4. +// The number of parameters must be exactly as specified. +// Min value is 0, and the maximum is 10. +// +// [] - any extra value to pass to the callback procedure +// (if you intend to change it, it has to be passed by +// reference). It will be passed to the procedure, after +// all formal parameters. +// +// [] - an optional indication that the callback function is not to return +// any value (void) to the calling process (default FALSE). + +// [] - debugging only (not to be used in normal operation) +// if passed by reference, it returns the actual generated +// assembler code for inspection and debugging +// +FUNCTION HB_AsCallback( pbcFunc, oObj, nNumParam, xCargo, lVoid, cDebug ) + LOCAL pCallback + LOCAL nPos := 0 + + HB_SYMBOL_UNUSED( xCargo ) + + pCallback := _AsCallback( pbcFunc, oObj, nNumParam, lVoid, @cDebug ) + + RETURN pCallback +//----------------------------------------------------------------------// +// Syntax: FreeCallback( < nProcPtr > ) => lSuccess +// +// Note: The callback procedure must have been obtained +// through the AsCallback() function +// You should not call this function from within +// the callback function itself !!!!!! +// If it is a window procedure, the window must be +// destroyed first, or it must be "unsubclassed" +// +FUNCTION HB_FreeCallback( pCallback ) + LOCAL lSuccess := .F. + + lSuccess := _FreeCallback( pCallback ) + + RETURN .T. //lSuccess +//----------------------------------------------------------------------// +// free all oustanding unreleased callback pointers on exit from the application +// could be changed to EXIT PROCEDURE +// +PROCEDURE _ExitCallbacks + + _FreeAllCallbacks() + + RETURN +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgax.prg b/harbour/contrib/gtwvg/wvgax.prg index fa7cf9734e..472de481e8 100644 --- a/harbour/contrib/gtwvg/wvgax.prg +++ b/harbour/contrib/gtwvg/wvgax.prg @@ -66,10 +66,14 @@ //----------------------------------------------------------------------// //----------------------------------------------------------------------// -#include "hbclass.ch" -#include "common.ch" -#include "hbgtwvg.ch" -#include "wvtwin.ch" +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// @@ -107,7 +111,6 @@ CLASS WvgActiveXControl FROM TOleAuto, WvgWindow DATA lSubStdEvents INIT .f. DATA hEvents INIT hb_hash() - DATA Id INIT 0 DATA hContainer DATA hSink @@ -143,7 +146,9 @@ METHOD New( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgActiv ::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - ::style := WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN + WS_CLIPSIBLINGS + ::style := WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN + WS_CLIPSIBLINGS + ::objType := objTypeActiveX + ::className := 'WVGACTIVEX' RETURN Self //----------------------------------------------------------------------// @@ -158,9 +163,6 @@ METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLic ::CLSID := cCLSID ::license := cLicense - ::objType := objTypeActiveX - ::className := 'WVGACTIVEX' - ::hObj := 0 ::hSink := 0 @@ -172,13 +174,15 @@ METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLic nRef++ ENDIF - ::hObj := HB_AX_AtlAxGetControl( "ATLAXWin", ::hContainer, ::CLSID, ::Id, ; - ::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ::style, ::exStyle, @hx ) + ::nID := ::oParent:GetControlId() + ::hObj := HB_AX_AtlAxGetControl( "ATLAXWin", ::hContainer, ::CLSID, ::nID, ; + ::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ::style, ::exStyle, @hx ) if ::hObj == 0 Return NIL endif + ::oParent:addChild( SELF ) ::hWnd := hx IF ::hObj <> 0 .AND. !Empty( ::hEvents ) @@ -192,10 +196,11 @@ METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLic RETURN Self //----------------------------------------------------------------------// METHOD Destroy() CLASS WvgActiveXControl + LOCAL bError := ErrorBlock() BEGIN SEQUENCE + IF hb_IsNumeric( ::hObj ) .and. ::hObj <> 0 -//hb_ToOutDebug( '......................Release....................' ) IF Win_IsWindow( ::hWnd ) Win_DestroyWindow( ::hWnd ) @@ -209,11 +214,10 @@ METHOD Destroy() CLASS WvgActiveXControl IF --nRef == 0 // HB_AX_AtlAxWinTerm() ENDIF -//hb_ToOutDebug( '<< Release >>' ) ENDIF ENDSEQUENCE - + ErrorBlock( bError ) RETURN NIL //----------------------------------------------------------------------// METHOD adviseEvents() CLASS WvgActiveXControl diff --git a/harbour/contrib/gtwvg/wvgcombo.prg b/harbour/contrib/gtwvg/wvgcombo.prg new file mode 100644 index 0000000000..8c059256a9 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgcombo.prg @@ -0,0 +1,640 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpTreeView compatible Class +// +// Pritpal Bedi +// 26Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +CLASS WvgComboBox INHERIT WvgListBox // WvgSLE + + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgComboBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + ::className := 'BUTTON' + ::objType := objTypePushButton + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgComboBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + IF ::visible + ::show() + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgComboBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgComboBox + + RETURN NIL + +//----------------------------------------------------------------------// +// MSDN on ComboBox Control +//----------------------------------------------------------------------// +#if 0 + +Functions +========= + +DlgDirListComboBox +Replaces the contents of a combo box with the names of the subdirectories and files +in a specified directory. You can filter the list of names by specifying a set of file +attributes. The list of names can include mapped drive letters. + +DlgDirSelectComboBoxEx +Retrieves the current selection from a combo box filled by using the +DlgDirListComboBox function. The selection is interpreted as a drive letter, a file, +or a directory name. + +GetComboBoxInfo +Retrieves information about the specified combo box. + + +Macros +====== + +ComboBox_AddItemData +Adds item data to the list in a combo box at the specified location. +You can use this macro or send the CB_ADDSTRING message explicitly. + +ComboBox_AddString +Adds a string to a list in a combo box. If the combo box does not have the CBS_SORT style, +the string is added to the end of the list. Otherwise, the string is inserted into the +list and the list is sorted. You can use this macro or send the CB_ADDSTRING message explicitly. + +ComboBox_DeleteString +Deletes the item at the specified location in a list in a combo box. You can use +this macro or send the CB_DELETESTRING message explicitly. + +ComboBox_Dir +Adds names to the list displayed by a combo box. The macro adds the names of +directories and files that match a specified string and set of file attributes. +It can also add mapped drive letters to the list in a combo box. You can use this +macro or send the CB_DIR message explicitly. + +ComboBox_Enable +Enables or disables a combo box control. + +ComboBox_FindItemData +Finds the first item in a combo box list that has the specified item data. You can use +this macro or send the CB_FINDSTRING message explicitly. + +ComboBox_FindString +Finds the first string in a combo box list that begins with the specified string. +You can use this macro or send the CB_FINDSTRING message explicitly. + +ComboBox_FindStringExact +Finds the first string in a combo box list that exactly matches the specified string, +except that the search is not case sensitive. You can use this macro or send the +CB_FINDSTRINGEXACT message explicitly. + +ComboBox_GetCount +Gets the number of items in the list box of a combo box. You can use this macro or +send the CB_GETCOUNT message explicitly. + +ComboBox_GetCueBannerText +Gets the cue banner text displayed in the edit control of a combo box. Use this +macro or send the CB_GETCUEBANNER message explicitly. + +ComboBox_GetCurSel +Gets the index of the currently selected item in a combo box. You can use this +macro or send the CB_GETCURSEL message explicitly. + +ComboBox_GetDroppedControlRect +Retrieves the screen coordinates of a combo box in its dropped-down state. +You can use this macro or send the CB_GETDROPPEDCONTROLRECT message explicitly. + +ComboBox_GetExtendedUI +Ascertains whether a combo box is using the default user interface (UI) or the extended UI. +You can use this macro or send the CB_GETEXTENDEDUI message explicitly. + +ComboBox_GetGetDroppedState +Ascertains whether the drop list in a combo box control is visible. +You can use this macro or send the CB_GETDROPPEDSTATE message explicitly. + +ComboBox_GetItemData +Gets the application-defined value associated with the specified list item in a combo box. +You can use this macro or send the CB_GETITEMDATA message explicitly. + +ComboBox_GetItemHeight +Retrieves the height of list items in a combo box. +You can use this macro or send the CB_GETITEMHEIGHT message explicitly. + +ComboBox_GetLBText +Gets a string from a list in a combo box. +You can use this macro or send the CB_GETLBTEXT message explicitly. + +ComboBox_GetLBTextLen +Gets the length of a string in the list in a combo box. +You can use this macro or send the CB_GETLBTEXTLEN message explicitly. + +ComboBox_GetMinVisible +Gets the minimum number of visible items in the drop-down list of a combo box. + +ComboBox_GetText +Retrieves the text from a combo box control. + +ComboBox_GetTextLength +Gets the number of characters in the text of a combo box. + +ComboBox_InsertItemData +Inserts item data in a list in a combo box at the specified location. +You can use this macro or send the CB_INSERTSTRING message explicitly. + +ComboBox_InsertString +Adds a string to a list in a combo box at the specified location. +You can use this macro or send the CB_INSERTSTRING message explicitly. + +ComboBox_LimitText +Limits the length of the text the user may type into the edit control of a combo box. +You can use this macro or send the CB_LIMITTEXT message explicitly. + +ComboBox_ResetContent +Removes all items from the list box and edit control of a combo box. +You can use this macro or send the CB_RESETCONTENT message explicitly. + +ComboBox_SelectItemData +Searches a list in a combo box for an item that has the specified item data. +If a matching item is found, the item is selected. You can use this macro or send the +CB_SELECTSTRING message explicitly. + +ComboBox_SelectString +Searches a list in a combo box for an item that begins with the characters in a specified string. +If a matching item is found, the item is selected. You can use this macro or send the +CB_SELECTSTRING message explicitly. + +ComboBox_SetCueBannerText +Sets the cue banner text that is displayed for the edit control of a combo box. + +ComboBox_SetCurSel +Sets the currently selected item in a combo box. You can use this macro or send the +CB_SETCURSEL message explicitly. + +ComboBox_SetExtendedUI +Selects either the default user interface (UI) or the extended UI for a combo box that has the +CBS_DROPDOWN or CBS_DROPDOWNLIST style. You can use this macro or send the +CB_SETEXTENDEDUI message explicitly. + +ComboBox_SetItemData +Sets the application-defined value associated with the specified list item in a combo box. +You can use this macro or send the CB_SETITEMDATA message explicitly. + +ComboBox_SetItemHeight +Sets the height of list items or the selection field in a combo box. +You can use this macro or send the CB_SETITEMHEIGHT message explicitly. + +ComboBox_SetMinVisible +Sets the minimum number of visible items in the drop-down list of a combo box. + +SetText +Sets the text of a combo box. + +ComboBox_ShowDropdown +Shows or hides the list in a combo box. +You can use this macro or send the CB_RESETCONTENT message explicitly. + +ListBox_AddItemData +Adds item data to the list box at the specified location. +You can use this macro or send the LB_ADDSTRING message explicitly. + + + +Messages +======== + +CB_ADDSTRING +Adds a string to the list box of a combo box. If the combo box does not have the CBS_SORT style, +the string is added to the end of the list. Otherwise, the string is inserted into the list, +and the list is sorted. + +CB_DELETESTRING +Deletes a string in the list box of a combo box. + +CB_DIR +Adds names to the list displayed by the combo box. The message adds the names of directories and files that match a specified string and set of file attributes. CB_DIR can also add mapped drive letters to the list. + +CB_FINDSTRING +Searches the list box of a combo box for an item beginning with the characters in a specified string. + +CB_FINDSTRINGEXACT +Finds the first list box string in a combo box that matches the string specified in the lParam parameter. + +CB_GETCOMBOBOXINFO +Gets information about the specified combo box. + +CB_GETCOUNT +Gets the number of items in the list box of a combo box. + +CB_GETCUEBANNER +Gets the cue banner text displayed in the edit control of a combo box. +Send this message explicitly or by using the ComboBox_GetCueBannerText macro. + +CB_GETCURSEL +An application sends a CB_GETCURSEL message to retrieve the index of the currently selected item, +if any, in the list box of a combo box. + +CB_GETDROPPEDCONTROLRECT +An application sends a CB_GETDROPPEDCONTROLRECT message to retrieve the screen coordinates of a +combo box in its dropped-down state. + +CB_GETDROPPEDSTATE +Determines whether the list box of a combo box is dropped down. + +CB_GETDROPPEDWIDTH +Gets the minimum allowable width, in pixels, of the list box of a combo box with the +CBS_DROPDOWN or CBS_DROPDOWNLIST style. + +CB_GETEDITSEL +Gets the starting and ending character positions of the current selection in the edit +control of a combo box. + +CB_GETEXTENDEDUI +Determines whether a combo box has the default user interface or the extended user interface. + +CB_GETHORIZONTALEXTENT +Gets the width, in pixels, that the list box can be scrolled horizontally (the scrollable width). +This is applicable only if the list box has a horizontal scroll bar. + +CB_GETITEMDATA +An application sends a CB_GETITEMDATA message to a combo box to retrieve the +application-supplied value associated with the specified item in the combo box. + +CB_GETITEMHEIGHT +Determines the height of list items or the selection field in a combo box. + +CB_GETLBTEXT +Gets a string from the list of a combo box. + +CB_GETLBTEXTLEN +Gets the length, in characters, of a string in the list of a combo box. + +CB_GETLOCALE +Gets the current locale of the combo box. The locale is used to determine the +correct sorting order of displayed text for combo boxes with the CBS_SORT style and +text added by using the CB_ADDSTRING message. + +CB_GETMINVISIBLE +Gets the minimum number of visible items in the drop-down list of a combo box. + +CB_GETTOPINDEX +An application sends the CB_GETTOPINDEX message to retrieve the zero-based index of +the first visible item in the list box portion of a combo box. Initially, the item with +index 0 is at the top of the list box, but if the list box contents have been scrolled, +another item may be at the top. + +CB_INITSTORAGE +An application sends the CB_INITSTORAGE message before adding a large number of items +to the list box portion of a combo box. This message allocates memory for storing list box items. + +CB_INSERTSTRING +Inserts a string or item data into the list of a combo box. Unlike the CB_ADDSTRING message, +the CB_INSERTSTRING message does not cause a list with the CBS_SORT style to be sorted. + +CB_LIMITTEXT +Limits the length of the text the user may type into the edit control of a combo box. + +CB_RESETCONTENT +Removes all items from the list box and edit control of a combo box. + +CB_SELECTSTRING +Searches the list of a combo box for an item that begins with the characters in a specified string. +If a matching item is found, it is selected and copied to the edit control. + +CB_SETCUEBANNER +Sets the cue banner text that is displayed for the edit control of a combo box. + +CB_SETCURSEL +An application sends a CB_SETCURSEL message to select a string in the list of a combo box. +If necessary, the list scrolls the string into view. The text in the edit control of the + combo box changes to reflect the new selection, and any previous selection in the list is removed. + +CB_SETDROPPEDWIDTH +An application sends the CB_SETDROPPEDWIDTH message to set the maximum allowable width, +in pixels, of the list box of a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style. + +CB_SETEDITSEL +An application sends a CB_SETEDITSEL message to select characters in the edit control of a combo box. + +CB_SETEXTENDEDUI +An application sends a CB_SETEXTENDEDUI message to select either the default user +interface (UI) or the extended UI for a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style. + +CB_SETHORIZONTALEXTENT +An application sends the CB_SETHORIZONTALEXTENT message to set the width, in pixels, +by which a list box can be scrolled horizontally (the scrollable width). If the width of +the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items +in the list box. If the width of the list box is equal to or greater than this value, the horizontal +scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled. + +CB_SETITEMDATA +An application sends a CB_SETITEMDATA message to set the value associated with the specified +item in a combo box. + +CB_SETITEMHEIGHT +An application sends a CB_SETITEMHEIGHT message to set the height of list items or the +selection field in a combo box. + +CB_SETLOCALE +An application sends a CB_SETLOCALE message to set the current locale of the combo box. +If the combo box has the CBS_SORT style and strings are added using CB_ADDSTRING, the locale + of a combo box affects how list items are sorted. + +CB_SETMINVISIBLE +An application sends a CB_SETMINVISIBLE message to set the minimum number of visible items +in the drop-down list of a combo box. + +CB_SETTOPINDEX +An application sends the CB_SETTOPINDEX message to ensure that a particular item is visible +in the list box of a combo box. The system scrolls the list box contents so that either the +specified item appears at the top of the list box or the maximum scroll range has been reached. + +CB_SHOWDROPDOWN +An application sends a CB_SHOWDROPDOWN message to show or hide the list box of a combo box +that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style. + + + +Notifications +============= + +CBN_CLOSEUP +The CBN_CLOSEUP notification message is sent when the list box of a combo box has been closed. +The parent window of the combo box receives this notification message through the WM_COMMAND message. + +CBN_DBLCLK +The CBN_DBLCLK notification message is sent when the user double-clicks a string in the list +box of a combo box. The parent window of the combo box receives this notification message +through the WM_COMMAND message. + +CBN_DROPDOWN +The CBN_DROPDOWN notification message is sent when the list box of a combo box is about to +be made visible. The parent window of the combo box receives this notification message +through the WM_COMMAND message. + +CBN_EDITCHANGE +The CBN_EDITCHANGE notification message is sent after the user has taken an action that may +have altered the text in the edit control portion of a combo box. Unlike the +CBN_EDITUPDATE notification message, this notification message is sent after the system +updates the screen. The parent window of the combo box receives this notification message +through the WM_COMMAND message. + +CBN_EDITUPDATE +The CBN_EDITUPDATE notification message is sent when the edit control portion of a combo +box is about to display altered text. This notification message is sent after the control +has formatted the text, but before it displays the text. The parent window of the combo box +receives this notification message through the WM_COMMAND message. + +CBN_ERRSPACE +The CBN_ERRSPACE notification message is sent when a combo box cannot allocate enough +memory to meet a specific request. The parent window of the combo box receives this +notification message through the WM_COMMAND message. + +CBN_KILLFOCUS +The CBN_KILLFOCUS notification message is sent when a combo box loses the keyboard focus. +The parent window of the combo box receives this notification message through the WM_COMMAND message. + +CBN_SELCHANGE +The CBN_SELCHANGE notification message is sent when the user changes the current selection +in the list box of a combo box. The user can change the selection by clicking in the list +box or by using the arrow keys. The parent window of the combo box receives this +notification in the form of a WM_COMMAND message with CBN_SELCHANGE in the high-order +word of the wParam parameter. + +CBN_SELENDCANCEL +The CBN_SELENDCANCEL notification message is sent when the user selects an item, +but then selects another control or closes the dialog box. It indicates the user +s initial selection is to be ignored. The parent window of the combo box receives +this notification message through the WM_COMMAND message. + +CBN_SELENDOK +The CBN_SELENDOK notification message is sent when the user selects a list item, +or selects an item and then closes the list. It indicates that the user s selection +is to be processed. The parent window of the combo box receives this notification +message through the WM_COMMAND message. + +CBN_SETFOCUS +The CBN_SETFOCUS notification message is sent when a combo box receives the keyboard focus. +The parent window of the combo box receives this notification message through the WM_COMMAND message. + +WM_COMPAREITEM +The system sends the WM_COMPAREITEM message to determine the relative position of a new +item in the sorted list of an owner-drawn combo box or list box. Whenever the application +adds a new item, the system sends this message to the owner of a combo box or list box created +with the CBS_SORT or LBS_SORT style. + +WM_DRAWITEM + +The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, +list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed. +A window receives this message through its WindowProc function. + +WM_MEASUREITEM +The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, +list view control, or menu item when the control or menu is created. +A window receives this message through its WindowProc function. + +Structures +========== + +COMBOBOXINFO +Contains combo box status information. + +COMPAREITEMSTRUCT + +Supplies the identifiers and application-supplied data for two items in a sorted, +owner-drawn list box or combo box. + +Whenever an application adds a new item to an owner-drawn list box or combo box +created with the CBS_SORT or LBS_SORT style, the system sends the owner a +WM_COMPAREITEM message. The lParam parameter of the message contains a long pointer +to a COMPAREITEMSTRUCT structure. Upon receiving the message, the owner compares +the two items and returns a value indicating which item sorts before the other. + +DRAWITEMSTRUCT +Provides necessary information the owner window to determine how to paint an owner-drawn +control or menu item. The owner window of the owner-drawn control or menu item receives a +pointer to this structure as the lParam parameter of the WM_DRAWITEM message. + +MEASUREITEMSTRUCT +Informs the system of the dimensions of an owner-drawn control or menu item. +This allows the system to process user interaction with the control correctly. + + + +Combo Box Styles +To create a combo box using the CreateWindow or CreateWindowEx function, specify +the COMBOBOX class, appropriate window style constants, and a combination of the +following combo box styles. + +Constants + +CBS_AUTOHSCROLL +Automatically scrolls the text in an edit control to the right when the user types a +character at the end of the line. If this style is not set, only text that fits within +the rectangular boundary is allowed. + +CBS_DISABLENOSCROLL +Shows a disabled vertical scroll bar in the list box when the box does not contain +enough items to scroll. Without this style, the scroll bar is hidden when the list box +does not contain enough items. + +CBS_DROPDOWN +Similar to CBS_SIMPLE, except that the list box is not displayed unless the user selects +an icon next to the edit control. + +CBS_DROPDOWNLIST +Similar to CBS_DROPDOWN, except that the edit control is replaced by a static text +item that displays the current selection in the list box. + +CBS_HASSTRINGS +Specifies that an owner-drawn combo box contains items consisting of strings. +The combo box maintains the memory and address for the strings so the application +can use the CB_GETLBTEXT message to retrieve the text for a particular item. +For accessibility issues, see Exposing Owner-Drawn Combo Box Items + + +CBS_LOWERCASE +Converts to lowercase all text in both the selection field and the list. + +CBS_NOINTEGRALHEIGHT +Specifies that the size of the combo box is exactly the size specified by the +application when it created the combo box. Normally, the system sizes a combo box +so that it does not display partial items. + +CBS_OEMCONVERT +Converts text entered in the combo box edit control from the Windows character +set to the OEM character set and then back to the Windows character set. +This ensures proper character conversion when the application calls the +CharToOem function to convert a Windows string in the combo box to OEM characters. +This style is most useful for combo boxes that contain file names and applies only +to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN style. + +CBS_OWNERDRAWFIXED +Specifies that the owner of the list box is responsible for drawing its contents +and that the items in the list box are all the same height. The owner window +receives a WM_MEASUREITEM message when the combo box is created and a WM_DRAWITEM +message when a visual aspect of the combo box has changed. + +CBS_OWNERDRAWVARIABLE +Specifies that the owner of the list box is responsible for drawing its contents +and that the items in the list box are variable in height. The owner window receives +a WM_MEASUREITEM message for each item in the combo box when you create the combo box +and a WM_DRAWITEM message when a visual aspect of the combo box has changed. + +CBS_SIMPLE +Displays the list box at all times. The current selection in the list box is displayed +in the edit control. + +CBS_SORT +Automatically sorts strings added to the list box. + +CBS_UPPERCASE +Converts to uppercase all text in both the selection field and the list. + +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgcrt.prg b/harbour/contrib/gtwvg/wvgcrt.prg index d1029bb799..80c5c46c43 100644 --- a/harbour/contrib/gtwvg/wvgcrt.prg +++ b/harbour/contrib/gtwvg/wvgcrt.prg @@ -67,10 +67,12 @@ #include 'hbclass.ch' #include 'common.ch' +#include 'inkey.ch' #include 'hbgtinfo.ch' + #include 'hbgtwvg.ch' #include 'wvtwin.ch' -#include 'inkey.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// @@ -247,7 +249,6 @@ EXPORTED: METHOD setFocus() METHOD sendMessage() -PROTECTED: DATA hWnd DATA aPos INIT { 0,0 } DATA aSize INIT { 24,79 } @@ -256,6 +257,11 @@ PROTECTED: DATA lHasInputFocus INIT .F. DATA nFrameState INIT 0 // normal + DATA nID INIT 0 + DATA nControlID INIT 200 + METHOD createControl() + METHOD getControlID() INLINE ++::nControlID + ENDCLASS //----------------------------------------------------------------------// @@ -367,6 +373,12 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv DEFAULT aPresParams TO ::aPresParams DEFAULT lVisible TO ::visible + ::oParent := oParent + ::oOwner := oOwner + ::aPos := aPos + ::aSize := aSize + ::aPresParams := aPresParams + ::visible := lVisible RETURN Self @@ -378,6 +390,10 @@ METHOD destroy() CLASS WvgCrt ::oMenu:destroy() ENDIF + IF Len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ENDIF + if ::lModal ::pGT := NIL hb_gtSelect( ::pGTp ) @@ -1129,3 +1145,57 @@ METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgCrt RETURN Self //----------------------------------------------------------------------// +METHOD createControl() CLASS WvgCrt + LOCAL hWnd + + DO CASE + + CASE ::objType == objTypeToolBar + + ::nID := ::oParent:GetControlId() + + #if 1 + hWnd := Win_CreateToolBarEx( ::oParent:hWnd,; // hWnd - window handle hosting the toolbar + ::style,; // ws - style of the toolbar + ::nID,; // wID - control identifier supplied with WM_COMMAND + 0,; // nBitmaps - number of button images + NIL,; // hBMInst - mudule instance which hosts the bitmap resource + NIL,; // wBPID - resource identifier of the bitmap + NIL,; // lpButton - TBUTTON structure + 0,; // number of buttons + ::buttonWidth,; // + ::buttonHeight,; + ::imageWidth,; + ::imageHeight ) + //Win_SendMessage( hWnd, TB_AUTOSIZE, 0, 0 ) + #else + hWnd := Win_CreateWindowEx( ::exStyle, ; + TOOLBARCLASSNAME, ; + NIL, ; // window name + ::style, ; + ::aPos[ 1 ], ::aPos[ 2 ],; + ::aSize[ 1 ], ::aSize[ 2 ],; + ::oParent:hWnd,; + NIL,; // hMenu + NIL,; // hInstance + NIL ) // lParam + #endif + OTHERWISE + hWnd := Win_CreateWindowEx( ::exStyle, ; + ::className, ; + "", ; // window name + ::style, ; + ::aPos[ 1 ], ::aPos[ 2 ],; + ::aSize[ 1 ], ::aSize[ 2 ],; + ::oParent:hWnd,; + NIL,; // hMenu + NIL,; // hInstance + NIL ) // lParam + ENDCASE + + IF ( hWnd <> 0 ) + ::hWnd := hWnd + ENDIF + + RETURN Self +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgdlg.prg b/harbour/contrib/gtwvg/wvgdlg.prg index 5102d94e47..b6890f9ee1 100644 --- a/harbour/contrib/gtwvg/wvgdlg.prg +++ b/harbour/contrib/gtwvg/wvgdlg.prg @@ -67,10 +67,12 @@ #include 'hbclass.ch' #include 'common.ch' +#include 'inkey.ch' #include 'hbgtinfo.ch' + #include 'hbgtwvg.ch' #include 'wvtwin.ch' -#include 'inkey.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// CLASS WvgDialog FROM WvgWindow @@ -157,17 +159,23 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv RETURN Self //----------------------------------------------------------------------// METHOD destroy() CLASS WvgDialog + LOCAL bError := ErrorBlock() + + //BEGIN SEQUENCE IF hb_isObject( ::oMenu ) ::oMenu:destroy() ENDIF IF Len( ::aChildren ) > 0 - aeval( ::aChildren, {|o| o:destroy() } ) + aeval( ::aChildren, {|o| hb_toOutDebug( o:className ), o:destroy() } ) ENDIF ::pGT := NIL ::pGTp := NIL + //END SEQUENCE + + ErrorBlock( bError ) RETURN Self //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index 6ffb5931c7..0f50bf781e 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -126,7 +126,7 @@ static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance ) wndclass.hInstance = hInstance; /* wndclass.hIcon = NULL; */ wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); - wndclass.hbrBackground = NULL; /* ( HBRUSH ) ( COLOR_BTNFACE + 1 ) */; + wndclass.hbrBackground = ( HBRUSH ) ( COLOR_BTNFACE + 1 ); /* wndclass.lpszMenuName = NULL; */ wndclass.lpszClassName = s_szClassName; @@ -346,14 +346,14 @@ static void hb_gt_wvt_FireMenuEvent( PHB_GTWVT pWVT, int iMode, int menuIndex ) static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) { int iPos = pWVT->keyPointerIn; - + #if 1 if( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE ) { /* Clipper strips repeated mouse movemnt - let's do the same */ if( pWVT->keyLast == iKey && pWVT->keyPointerIn != pWVT->keyPointerOut ) return; } - + #endif /* * When the buffer is full new event overwrite the last one * in the buffer - it's Clipper behavior, [druzus] @@ -363,7 +363,7 @@ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) iPos = 0; if( iPos != pWVT->keyPointerOut ) pWVT->keyPointerIn = iPos; - + #if 0 /* Fire event to be trapped by the application */ { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -371,6 +371,7 @@ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) hb_gt_wvt_FireEvent( pWVT, HB_GTE_KEYBOARD, pEvParams ); hb_itemRelease( pEvParams ); } + #endif } static BOOL hb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey ) @@ -440,7 +441,7 @@ static int hb_gt_wvt_SizeChanged( PHB_GTWVT pWVT ) hb_arraySetNI( pEvParams, 3, rc.right - rc.left ); hb_arraySetNI( pEvParams, 4, rc.bottom - rc.top ); - hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); + //hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED, pEvParams ); @@ -934,7 +935,7 @@ static BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPA static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { PHB_GTWVT pWVT = hb_gt_wvt_Find( hWnd ); - +//hb_ToOutDebug( "h=%i m=%i w=%i l=%i", hWnd, message, wParam, lParam ); if( pWVT ) switch( message ) { case WM_PAINT: @@ -1009,7 +1010,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara case WM_SIZING: case WM_SIZE: { - return( hb_gt_wvt_SizeChanged( pWVT ) ); + hb_gt_wvt_SizeChanged( pWVT ); + return DefWindowProc( hWnd, message, wParam, lParam ); } case WM_SYSCOMMAND: { @@ -1047,9 +1049,30 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara } case WM_COMMAND: { - if( HIWORD( wParam ) == 0 ) + if( ( int ) lParam == 0 ) { - hb_gt_wvt_FireMenuEvent( pWVT, 0, ( int ) LOWORD( wParam ) ); + // Menu command + if( HIWORD( wParam ) == 0 ) + { + hb_gt_wvt_FireMenuEvent( pWVT, 0, ( int ) LOWORD( wParam ) ); + } + } + else + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + int iLo, iHi; + + iLo = LOWORD( wParam ); + iHi = HIWORD( wParam ); +hb_ToOutDebug( "%i %i %i", iHi, iLo, lParam ); + hb_arrayNew( pEvParams, 3 ); + hb_arraySetNI( pEvParams, 1, iHi ); // Notification Code + hb_arraySetNI( pEvParams, 2, iLo ); // Control identifier + hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) ( HWND ) lParam ); // Controls hWnd + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_COMMAND, pEvParams ); + + hb_itemRelease( pEvParams ); } return 0; } @@ -1097,7 +1120,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara PHB_ITEM pEvParams = hb_itemNew( NULL ); LPNMMOUSE nmm = ( LPNMMOUSE ) lParam; NMHDR nmh = nmm->hdr; - +//hb_ToOutDebug( "WM_NOTIFY" ); if( nmh.code == NM_CLICK ) { hb_arrayNew( pEvParams, 5 ); @@ -1305,7 +1328,7 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) hb_gt_wvt_ProcessMessages( pWVT ); fKey = hb_gt_wvt_GetCharFromInputQueue( pWVT, &c ); - +//hb_ToOutDebug( "fKey = %i ", fKey ); return fKey ? c : 0; } diff --git a/harbour/contrib/gtwvg/wvglistb.prg b/harbour/contrib/gtwvg/wvglistb.prg new file mode 100644 index 0000000000..1360d5bf8f --- /dev/null +++ b/harbour/contrib/gtwvg/wvglistb.prg @@ -0,0 +1,479 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpTreeView compatible Class +// +// Pritpal Bedi +// 26Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +CLASS WvgListBox INHERIT WvgWindow + + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + ::className := 'BUTTON' + ::objType := objTypePushButton + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + IF ::visible + ::show() + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgListBox + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgListBox + + RETURN NIL + +//----------------------------------------------------------------------// +// MSDN on ListBox Control +//----------------------------------------------------------------------// +#if 0 + +Functions +========= + +DlgDirList +Replaces the contents of a list box with the names of the subdirectories and files in a +specified directory. You can filter the list of names by specifying a set of file attributes. +The list can optionally include mapped drives. + +DlgDirSelectEx +Retrieves the current selection from a single-selection list box. It assumes that the +list box has been filled by the DlgDirList function and that the selection is a drive letter, +filename, or directory name. + +GetListBoxInfo +Retrieves information about the specified list box. + + + +Messages +======== + +LB_ADDFILE +Adds the specified filename to a list box that contains a directory listing. + +LB_ADDSTRING +Adds a string to a list box. If the list box does not have the LBS_SORT style, +the string is added to the end of the list. Otherwise, the string is inserted into the list +and the list is sorted. + +LB_DELETESTRING +Deletes a string in a list box. + +LB_DIR +Adds names to the list displayed by a list box. The message adds the names of directories +and files that match a specified string and set of file attributes. LB_DIR can also add +mapped drive letters to the list box. + +LB_FINDSTRING +Finds the first string in a list box that begins with the specified string. + +LB_FINDSTRINGEXACT +Finds the first list box string that exactly matches the specified string, except that +the search is not case sensitive. + +LB_GETANCHORINDEX +Gets the index of the anchor item + +LB_GETCARETINDEX +Retrieves the index of the item that has the focus rectangle in a multiple-selection list box. +The item may or may not be selected. + +LB_GETCOUNT +Gets the number of items in a list box. + +LB_GETCURSEL +Gets the index of the currently selected item, if any, in a single-selection list box. + +LB_GETHORIZONTALEXTENT +Gets the width, in pixels, that a list box can be scrolled horizontally (the scrollable width) +if the list box has a horizontal scroll bar. + +LB_GETITEMDATA +Gets the application-defined value associated with the specified list box item. + +LB_GETITEMHEIGHT +Gets the height of items in a list box. + +LB_GETITEMRECT +Gets the dimensions of the rectangle that bounds a list box item as it is currently displayed +in the list box. + +LB_GETLISTBOXINFO +Gets the number of items per column in a specified list box. + +LB_GETLOCALE +Gets the current locale of the list box. You can use the locale to determine the correct +sorting order of displayed text (for list boxes with the LBS_SORT style) and of text +added by the LB_ADDSTRING message. + +LB_GETSEL +Gets the selection state of an item. + +LB_GETSELCOUNT +Gets the total number of selected items in a multiple-selection list box. + +LB_GETSELITEMS +Fills a buffer with an array of integers that specify the item numbers of selected items in +a multiple-selection list box. + +LB_GETTEXT +Gets a string from a list box. + +LB_GETTEXTLEN +Gets the length of a string in a list box. + +LB_GETTOPINDEX +Gets the index of the first visible item in a list box. Initially the item with index 0 +is at the top of the list box, but if the list box contents have been scrolled another item +may be at the top. + +LB_INITSTORAGE +Allocates memory for storing list box items. This message is used before an application adds +a large number of items to a list box. + +LB_INSERTSTRING +Inserts a string or item data into a list box. Unlike the LB_ADDSTRING message, +the LB_INSERTSTRING message does not cause a list with the LBS_SORT style to be sorted. + +LB_ITEMFROMPOINT +Gets the zero-based index of the item nearest the specified point in a list box. + +LB_RESETCONTENT +Removes all items from a list box. + +LB_SELECTSTRING +Searches a list box for an item that begins with the characters in a specified string. +If a matching item is found, the item is selected. + +LB_SELITEMRANGE +Selects or deselects one or more consecutive items in a multiple-selection list box. + +LB_SELITEMRANGEEX +Selects one or more consecutive items in a multiple-selection list box. + +LB_SETANCHORINDEX +Sets the anchor item + +LB_SETCARETINDEX +Sets the focus rectangle to the item at the specified index in a multiple-selection list box. +If the item is not visible, it is scrolled into view. + +LB_SETCOLUMNWIDTH +Sets the width, in pixels, of all columns in a multiple-column list box. + +LB_SETCOUNT +Sets the count of items in a list box created with the LBS_NODATA style and not created with +the LBS_HASSTRINGS style. + +LB_SETCURSEL +Selects a string and scrolls it into view, if necessary. When the new string is selected, +the list box removes the highlight from the previously selected string. + +LB_SETHORIZONTALEXTENT +Sets the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width). +If the width of the list box is smaller than this value, the horizontal scroll bar horizontally +scrolls items in the list box. If the width of the list box is equal to or greater than this value, +the horizontal scroll bar is hidden. + +LB_SETITEMDATA +Sets a value associated with the specified item in a list box. + +LB_SETITEMHEIGHT +Sets the height, in pixels, of items in a list box. If the list box has the +LBS_OWNERDRAWVARIABLE style, this message sets the height of the item specified +by the wParam parameter. Otherwise, this message sets the height of all items in the list box. + +LB_SETLOCALE +Sets the current locale of the list box. You can use the locale to determine the +correct sorting order of displayed text (for list boxes with the LBS_SORT style) +and of text added by the LB_ADDSTRING message. + +LB_SETSEL +Selects a string in a multiple-selection list box. + +LB_SETTABSTOPS +Sets the tab-stop positions in a list box. + +LB_SETTOPINDEX +Ensures that the specified item in a list box is visible. + + + +Notifications +============= + +LBN_DBLCLK +Notifies the application that the user has double-clicked an item in a list box. +The parent window of the list box receives this notification message through the WM_COMMAND message. + +LBN_ERRSPACE +Notifies the application that the list box cannot allocate enough memory to meet a specific request. +The parent window of the list box receives this notification message through the WM_COMMAND message. + +LBN_KILLFOCUS +Notifies the application that the list box has lost the keyboard focus. The parent window of the +list box receives this notification message through the WM_COMMAND message. + +LBN_SELCANCEL +Notifies the application that the user has canceled the selection in a list box. The parent +window of the list box receives this notification message through the WM_COMMAND message. + +LBN_SELCHANGE +Notifies the application that the selection in a list box has changed. The parent window of +the list box receives this notification message through the WM_COMMAND message. + +LBN_SETFOCUS +Notifies the application that the list box has received the keyboard focus. The parent window +of the list box receives this notification message through the WM_COMMAND message. + +WM_CHARTOITEM +Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. + +WM_CTLCOLORLISTBOX +Sent to the parent window of a list box before the system draws the list box. +By responding to this message, the parent window can set the text and background colors +of the list box by using the specified display device context handle. + +WM_DELETEITEM +Sent to the owner of a list box or combo box when the list box or combo box is destroyed +or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, +or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. +The system sends the WM_DELETEITEM message for any deleted list box or combo box item with +nonzero item data. + +WM_VKEYTOITEM +Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response +to a WM_KEYDOWN message. + + + +Structures +========== + +DELETEITEMSTRUCT +Describes a deleted list box or combo box item. The lParam parameter of a +WM_DELETEITEM message contains a pointer to this structure. When an item is removed from a +list box or combo box or when a list box or combo box is destroyed, the system sends the +WM_DELETEITEM message to the owner for each deleted item. + +Windows NT/2000/XP: The system sends a WM_DELETEITEM message only for items deleted from +an owner-drawn list box (with the LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE style) or +owner-drawn combo box (with the CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE style). + +Windows 95/98/Me: The system sends the WM_DELETEITEM message for any deleted list box +or combo box item with nonzero item data. + + + +List Box Styles +=============== + +To create a list box by using the CreateWindow or CreateWindowEx function, +use the LISTBOX class, appropriate window style constants, and the following style constants to +define the list box. After the control has been created, these styles cannot be modified, except as noted. + +Constants + +LBS_COMBOBOX +Notifies a list box that it is part of a combo box. This allows coordination between the +two controls so that they present a unified user interface (UI). The combo box itself +must set this style. If the style is set by anything but the combo box, the list box +will regard itself incorrectly as a child of a combo box and a failure will result. + +LBS_DISABLENOSCROLL +Shows a disabled vertical scroll bar for the list box when the box does not contain +enough items to scroll. If you do not specify this style, the scroll bar is hidden +when the list box does not contain enough items. + +LBS_EXTENDEDSEL +Allows multiple items to be selected by using the SHIFT key and the mouse or special key combinations. + +LBS_HASSTRINGS +Specifies that a list box contains items consisting of strings. The list box maintains +the memory and addresses for the strings so that the application can use the LB_GETTEXT message +to retrieve the text for a particular item. By default, all list boxes except owner-drawn list +boxes have this style. You can create an owner-drawn list box either with or without this style. + +LBS_MULTICOLUMN +Specifies a multi-columnn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message +sets the width of the columns. + +LBS_MULTIPLESEL +Turns string selection on or off each time the user clicks or double-clicks a string in the list box. +The user can select any number of strings. + +LBS_NODATA +Specifies a no-data list box. Specify this style when the count of items in the list box +will exceed one thousand. A no-data list box must also have the LBS_OWNERDRAWFIXED style, +but must not have the LBS_SORT or LBS_HASSTRINGS style. +A no-data list box resembles an owner-drawn list box except that it contains no string or +bitmap data for an item. Commands to add, insert, or delete an item always ignore any +specified item data; requests to find a string within the list box always fail. +The system sends the WM_DRAWITEM message to the owner window when an item must be drawn. +The itemID member of the DRAWITEMSTRUCT structure passed with the WM_DRAWITEM message +specifies the line number of the item to be drawn. A no-data list box does not send a +WM_DELETEITEM message. + + +LBS_NOINTEGRALHEIGHT +Specifies that the size of the list box is exactly the size specified by the application +when it created the list box. Normally, the system sizes a list box so that the list box +does not display partial items. + +LBS_NOREDRAW +Specifies that the list box s appearance is not updated when changes are made. +To change the redraw state of the control, use the WM_SETREDRAW message. + + +LBS_NOSEL +Specifies that the list box contains items that can be viewed but not selected. + +LBS_NOTIFY +Notifies the parent window with an input message whenever the user clicks or double-clicks +a string in the list box. + +LBS_OWNERDRAWFIXED +Specifies that the owner of the list box is responsible for drawing its contents and that +the items in the list box are the same height. The owner window receives a +WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when +a visual aspect of the list box has changed. + +LBS_OWNERDRAWVARIABLE +Specifies that the owner of the list box is responsible for drawing its contents and that +the items in the list box are variable in height. The owner window receives a +WM_MEASUREITEM message for each item in the combo box when the combo box is created and a +WM_DRAWITEM message when a visual aspect of the combo box has changed. + +LBS_SORT +Sorts strings in the list box alphabetically. + +LBS_STANDARD +Sorts strings in the list box alphabetically. The parent window receives an input +message whenever the user clicks or double-clicks a string. The list box has borders on all sides. + +LBS_USETABSTOPS +Enables a list box to recognize and expand tab characters when drawing its strings. +You can use the LB_SETTABSTOPS message to specify tab stop positions. The default tab positions +are 32 dialog template units apart. Dialog template units are the device-independent units used +in dialog box templates. To convert measurements from dialog template units to screen units (pixels), +use the MapDialogRect function. + +LBS_WANTKEYBOARDINPUT +Specifies that the owner of the list box receives WM_VKEYTOITEM messages whenever +the user presses a key and the list box has the input focus. This enables an application +to perform special processing on the keyboard input. + + +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgmenub.prg b/harbour/contrib/gtwvg/wvgmenub.prg index 6ba4803dca..4b097f41f9 100644 --- a/harbour/contrib/gtwvg/wvgmenub.prg +++ b/harbour/contrib/gtwvg/wvgmenub.prg @@ -67,10 +67,12 @@ #include 'hbclass.ch' #include 'common.ch' +#include 'inkey.ch' #include 'hbgtinfo.ch' + #include 'hbgtwvg.ch' #include 'wvtwin.ch' -#include 'inkey.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgparts.ch b/harbour/contrib/gtwvg/wvgparts.ch new file mode 100644 index 0000000000..26b0154b60 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgparts.ch @@ -0,0 +1,164 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Header file for the WVT*Classes + * + * Copyright 2008 Pritpal Bedi + * www - http://www.xharbour.org 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. + * + */ +//----------------------------------------------------------------------// +// WvgParts.ch +//----------------------------------------------------------------------// + +#ifndef _WVG_CH + +#define _WVG_CH + +//----------------------------------------------------------------------// + +#define objTypeNone 0 +#define objTypeCrt 1 +#define objTypeWindow 2 +#define objTypeActiveX 3 +#define objTypeDialog 4 +#define objTypeToolBar 5 +#define objTypeToolBarButton 6 +#define objTypeMenu 7 +#define objTypeStatusBar 8 +#define objTypePushButton 9 +#define objTypeComboBox 10 +#define objTypeListBox 11 +#define objTypeStatic 12 +#define objTypeTreeView 13 +#define objTypeTreeViewItem 14 + +//----------------------------------------------------------------------// +/* Constants identifying WM_NOTIFY members fired as HB_GTE_NOTIFY */ +#define NM_controlID 1 +#define NM_hWnd 2 +#define NM_idFrom 3 +#define NM_code 4 +#define NM_dwItemSpec 5 + +//----------------------------------------------------------------------// + +#define WVG_AUTOSIZE -1 + +#define WVGALIGN_TOP 0 +#define WVGALIGN_LEFT 0 +#define WVGALIGN_BOTTOM 8 +#define WVGALIGN_RIGHT 2 +#define WVGALIGN_HCENTER 1 +#define WVGALIGN_VCENTER 4 +#define WVGALIGN_WORDBREAK 16 + +#define WVGFRAME_NONE 0 +#define WVGFRAME_RECT 1 +#define WVGFRAME_BOX 2 +#define WVGFRAME_RAISED 16 +#define WVGFRAME_RECESSED 32 +#define WVGFRAME_THICK 128 +#define WVGFRAME_DASHED 256 +#define WVGFRAME_DOTTED 512 + +#define WVGTOOLBAR_STYLE_STANDARD 0 +#define WVGTOOLBAR_STYLE_FLAT 1 + +#define WVGTOOLBAR_BUTTON_DEFAULT 0 + +/* Statusbar Manipulation Constants */ +#define WVGSTATUSBAR_AUTOSIZE_NONE 0 +#define WVGSTATUSBAR_AUTOSIZE_SPRING 1 +#define WVGSTATUSBAR_AUTOSIZE_CONTENTS 2 + +#define WVGSTATUSBAR_BEVEL_NONE 0 +#define WVGSTATUSBAR_BEVEL_INSET 1 +#define WVGSTATUSBAR_BEVEL_RAISED 2 + +#define WVGSTATUSBAR_PANEL_TEXT 0 +#define WVGSTATUSBAR_PANEL_CAPSLOCK 1 +#define WVGSTATUSBAR_PANEL_NUMLOCK 2 +#define WVGSTATUSBAR_PANEL_INSERT 3 +#define WVGSTATUSBAR_PANEL_SCROLL 4 +#define WVGSTATUSBAR_PANEL_TIME 5 +#define WVGSTATUSBAR_PANEL_DATE 6 +#define WVGSTATUSBAR_PANEL_KANA 7 + +#define WVGSTATIC_TYPE_TEXT 1 +#define WVGSTATIC_TYPE_GROUPBOX 2 +#define WVGSTATIC_TYPE_ICON 3 +#define WVGSTATIC_TYPE_SYSICON 4 +#define WVGSTATIC_TYPE_BITMAP 5 +#define WVGSTATIC_TYPE_FGNDRECT 6 +#define WVGSTATIC_TYPE_BGNDRECT 7 +#define WVGSTATIC_TYPE_FGNDFRAME 8 +#define WVGSTATIC_TYPE_BGNDFRAME 9 +#define WVGSTATIC_TYPE_HALFTONERECT 10 +#define WVGSTATIC_TYPE_HALFTONEFRAME 11 +#define WVGSTATIC_TYPE_RAISEDBOX 12 +#define WVGSTATIC_TYPE_RECESSEDBOX 13 +#define WVGSTATIC_TYPE_RAISEDRECT 14 +#define WVGSTATIC_TYPE_RECESSEDRECT 15 +#define WVGSTATIC_TYPE_RAISEDLINE 16 +#define WVGSTATIC_TYPE_RECESSEDLINE 17 + +#define WVGSTATIC_FRAMETHIN 1 +#define WVGSTATIC_FRAMETHICK 2 + +#define WVGSTATIC_TEXT_LEFT WVGALIGN_LEFT +#define WVGSTATIC_TEXT_RIGHT WVGALIGN_RIGHT +#define WVGSTATIC_TEXT_CENTER WVGALIGN_HCENTER +#define WVGSTATIC_TEXT_TOP WVGALIGN_TOP +#define WVGSTATIC_TEXT_VCENTER WVGALIGN_VCENTER +#define WVGSTATIC_TEXT_BOTTOM WVGALIGN_BOTTOM +#define WVGSTATIC_TEXT_WORDBREAK WVGALIGN_WORDBREAK + +#define WVGSTATIC_BITMAP_TILED 1 +#define WVGSTATIC_BITMAP_SCALED 2 + +#endif // #ifndef _WVG_CH + +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgphdlr.prg b/harbour/contrib/gtwvg/wvgphdlr.prg index a3848444fd..6e1726681a 100644 --- a/harbour/contrib/gtwvg/wvgphdlr.prg +++ b/harbour/contrib/gtwvg/wvgphdlr.prg @@ -67,10 +67,12 @@ #include 'hbclass.ch' #include 'common.ch' +#include 'inkey.ch' #include 'hbgtinfo.ch' + #include 'hbgtwvg.ch' #include 'wvtwin.ch' -#include 'inkey.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// @@ -341,14 +343,30 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler eval( ::sl_resize, { xParams[ 1 ], xParams[ 2 ] }, { xParams[ 3 ], xParams[ 4 ] }, Self ) ENDIF + FOR nObj := 1 TO len( ::aChildren ) + + IF ::aChildren[ nObj ]:objType == objTypeToolBar + ::aChildren[ nObj ]:sendMessage( WM_SIZE, 0, 0 ) + + ELSEIF ::aChildren[ nObj ]:objType == objTypeStatusBar + ::aChildren[ nObj ]:sendMessage( WM_SIZE, 0, 0 ) + + ELSEIF hb_isBlock( ::aChildren[ nObj ]:sl_resize ) + eval( ::aChildren[ nObj ]:sl_resize, { xParams[ 1 ], xParams[ 2 ] }, ; + { xParams[ 3 ], xParams[ 4 ] }, ::aChildren[ nObj ] ) + + ENDIF + NEXT + CASE nEvent == HB_GTE_CLOSE IF hb_isBlock( ::close ) nReturn := eval( ::close, NIL, NIL, Self ) ENDIF CASE nEvent == HB_GTE_MENU - DO CASE +hb_ToOutDebug( " CASE nEvent == HB_GTE_MENU" ) + DO CASE CASE xParams[ 1 ] == 0 // menu selected IF hb_isObject( ::oMenu ) IF !empty( aMenuItem := ::oMenu:FindMenuItemById( xParams[ 2 ] ) ) @@ -375,20 +393,43 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler ENDCASE CASE nEvent == HB_GTE_NOTIFY - nCtrlID := xParams[ 1 ] + nCtrlID := xParams[ NM_controlID ] nIndex := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) IF nIndex > 0 DO CASE - CASE xParams[ 4 ] == NM_CLICK - IF hb_isBlock( ::aChildren[ nIndex ]:sl_buttonClick ) - nObj := ascan( ::aChildren[ nIndex ]:aItems, {|e_| e_[ 1 ] == xParams[ 5 ] } ) - Eval( ::aChildren[ nIndex ]:sl_buttonClick, ::aChildren[ nIndex ]:aItems[ nObj,2 ] ) + CASE xParams[ NM_code ] == NM_CLICK + IF hb_isBlock( ::aChildren[ nIndex ]:sl_lbClick ) + DO CASE + CASE ::aChildren[ nIndex ]:objType == objTypeToolBar + nObj := ascan( ::aChildren[ nIndex ]:aItems, {|e_| e_[ 1 ] == xParams[ NM_dwItemSpec ] } ) + Eval( ::aChildren[ nIndex ]:sl_lbClick, ::aChildren[ nIndex ]:aItems[ nObj,2 ], ; + NIL, ::aChildren[ nIndex ] ) + + CASE ::aChildren[ nIndex ]:objType == objTypeStatusBar + IF xParams[ NM_dwItemSpec ] >= 0 + nObj := xParams[ NM_dwItemSpec ] + 1 // zero based + Eval( ::aChildren[ nIndex ]:sl_lbClick, ::aChildren[ nIndex ]:aItems[ nObj ], ; + NIL, ::aChildren[ nIndex ] ) + ENDIF + ENDCASE ENDIF + ENDCASE + ENDIF + CASE nEvent == HB_GTE_COMMAND + nCtrlID := xParams[ 2 ] // Control Identifier + + nIndex := ascan( ::aChildren, {|o| o:nID == nCtrlID } ) // Theoretically it must be present + IF nIndex > 0 + DO CASE + CASE xParams[ 1 ] == BN_CLICKED + IF hb_isBlock( ::aChildren[ nIndex ]:sl_lbClick ) + eval( ::aChildren[ nIndex ]:sl_lbClick, NIL, NIL, ::aChildren[ nIndex ] ) + ENDIF ENDCASE ENDIF diff --git a/harbour/contrib/gtwvg/wvgpushb.prg b/harbour/contrib/gtwvg/wvgpushb.prg new file mode 100644 index 0000000000..bb872101ef --- /dev/null +++ b/harbour/contrib/gtwvg/wvgpushb.prg @@ -0,0 +1,524 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpPushButton Compatible Class +// +// Pritpal Bedi +// 26Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +CLASS WvgPushButton INHERIT WvgWindow + + DATA autosize INIT .F. + DATA border INIT .T. + DATA caption INIT '' + DATA pointerFocus INIT .T. + DATA preSelect INIT .F. + DATA drawMode INIT 0 //WVG_DRAW_NORMAL + DATA default INIT .F. + DATA cancel INIT .F. + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + METHOD setCaption() + + METHOD activate() SETGET + METHOD draw() SETGET + + DATA nWndProc + METHOD PBWndProc() + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPushButton + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + ::className := 'BUTTON' + ::objType := objTypePushButton + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPushButton + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + IF ::visible + ::show() + ENDIF + + ::setCaption( ::caption ) + + ::nWndProc := HB_AsCallBack( 'PBWNDPROC', Self ) + + Win_SetWndProc( ::hWnd, ::nWndProc ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgPushButton + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgPushButton + + IF len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ENDIF + + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + + HB_FreeCallback( ::nWndProc ) + + RETURN NIL + +//----------------------------------------------------------------------// + +METHOD setCaption( xCaption, cDll ) CLASS WvgPushButton + + HB_SYMBOL_UNUSED( cDll ) + + IF hb_isChar( xCaption ) + ::caption := xCaption + Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption ) + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD activate( xParam ) CLASS WvgPushButton + + IF hb_isBlock( xParam ) .or. ( xParam == NIL ) + ::sl_lbClick := xParam + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD draw( xParam ) CLASS WvgPushButton + + IF hb_isBlock( xParam ) .or. ( xParam == NIL ) + ::sl_paint := xParam + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD PBWndProc( h,m,w,l ) CLASS WvgPushButton + + HB_SYMBOL_UNUSED( h ) + HB_SYMBOL_UNUSED( w ) + HB_SYMBOL_UNUSED( l ) + + DO CASE + CASE m == WM_LBUTTONUP + Win_MessageBox( ::hWnd, "Hiding the Parent", "Info" ) + Win_ShowWindow( ::oParent:hWnd, SW_HIDE ) + RETURN 0 + + ENDCASE + + RETURN Win_DefWindowProc( h, m, w, l ) +//----------------------------------------------------------------------// +// MSDN on Button Control +//----------------------------------------------------------------------// +#if 0 + +Functions +========= + +CheckDlgButton +Changes the check state of a button control. + +CheckRadioButton +Adds a check mark to (checks) a specified radio button in a group and removes a check mark from +(clears) all other radio buttons in the group. + +IsDlgButtonChecked +The IsDlgButtonChecked function determines whether a button control is checked or whether a +three-state button control is checked, unchecked, or indeterminate. + + +Macros +====== + +Button_Enable +Enables or disables a button. + +Button_GetCheck +Gets the check state of a radio button or check box. You can use this macro or send the BM_GETCHECK +message explicitly. + +Button_GetIdealSize +Gets the size of the button that best fits the text and image, if an image list is present. +You can use this macro or send the BCM_GETIDEALSIZE message explicitly. + +Button_GetImageList +Gets the BUTTON_IMAGELIST structure that describes the image list that is set for a button control. +You can use this macro or send the BCM_GETIMAGELIST message explicitly. + +Button_GetNote +Gets the text of the note associated with a command link button. You can use this macro or send +the BCM_GETNOTE message explicitly. + +Button_GetNoteLength +Gets the length of the note text that may be displayed in the description for a command link. +Use this macro or send the BCM_GETNOTELENGTH message explicitly. + +Button_GetSplitInfo +Gets information for a specified split button control. Use this macro or send the +BCM_GETSPLITINFO message explicitly. + +Button_GetState +Gets the check state of a radio button or check box. You can use this macro or send the +BM_GETSTATE message explicitly. + +Button_GetText +Gets the text of a button. + +Button_GetTextLength +Gets the number of characters in the text of a button. + +Button_GetTextMargin +Gets the margins used to draw text in a button control. You can use this macro or send the +BCM_GETTEXTMARGIN message explicitly. + +Button_SetCheck +Sets the check state of a radio button or check box. You can use this macro or send the +BM_SETCHECK message explicitly. + +Button_SetDropDownState +Sets the drop down state for a specified button with style of BS_SPLITBUTTON. +Use this macro or send the BCM_SETDROPDOWNSTATE message explicitly. + +Button_SetElevationRequiredState +Sets the elevation required state for a specified button or command link to display an elevated icon. +Use this macro or send the BCM_SETSHIELD message explicitly. + +Button_SetImageList +Assigns an image list to a button control. You can use this macro or send the +BCM_SETIMAGELIST message explicitly. + +Button_SetNote +Sets the text of the note associated with a specified command link button. +You can use this macro or send the BCM_SETNOTE message explicitly. + +Button_SetSplitInfo +Sets information for a specified split button control. Use this macro or send the +BCM_SETSPLITINFO message explicitly. + +Button_SetState +Sets the highlight state of a button. The highlight state indicates whether the button +is highlighted as if the user had pushed it. You can use this macro or send the +BM_SETSTATE message explicitly. + +Button_SetStyle +Sets the style of a button. You can use this macro or send the BM_SETSTYLE message explicitly. + +Button_SetText +Sets the text of a button. + +Button_SetTextMargin +Sets the margins for drawing text in a button control. You can use this macro or send the +BCM_SETTEXTMARGIN message explicitly. + + +Messages +======== + +BCM_GETIDEALSIZE +Gets the size of the button that best fits its text and image, if an image list is present. +You can send this message explicitly or use the Button_GetIdealSize macro. + +BCM_GETIMAGELIST +Gets the BUTTON_IMAGELIST structure that describes the image list assigned to a button control. +You can send this message explicitly or use the Button_GetImageList macro. + +BCM_GETNOTE +Gets the text of the note associated with a command link button. You can send this message +explicitly or use the Button_GetNote macro. + +BCM_GETNOTELENGTH +Gets the length of the note text that may be displayed in the description for a command link button. +Send this message explicitly or by using the Button_GetNoteLength macro. + +BCM_GETSPLITINFO +Gets information for a split button control. Send this message explicitly or by using the +Button_GetSplitInfo macro. + +BCM_GETTEXTMARGIN +Gets the margins used to draw text in a button control. You can send this message explicitly or +use the Button_GetTextMargin macro. + +BCM_SETDROPDOWNSTATE +Sets the drop down state for a button with style TBSTYLE_DROPDOWN. Send this message explicitly +or by using the Button_SetDropDownState macro. + +BCM_SETIMAGELIST +Assigns an image list to a button control. You can send this message explicitly or use the +Button_SetImageList macro. + +BCM_SETNOTE +Sets the text of the note associated with a command link button. You can send this message +explicitly or use the Button_SetNote macro. + +BCM_SETSHIELD +Sets the elevation required state for a specified button or command link to display an elevated icon. +Send this message explicitly or by using the Button_SetElevationRequiredState macro. + +BCM_SETSPLITINFO +Sets information for a split button control. Send this message explicitly or by using the +Button_SetSplitInfo macro. + +BCM_SETTEXTMARGIN +The BCM_SETTEXTMARGIN message sets the margins for drawing text in a button control. + +BM_CLICK +Simulates the user clicking a button. This message causes the button to receive the +WM_LBUTTONDOWN and WM_LBUTTONUP messages, and the button s parent window to receive a +BN_CLICKED notification message. + +BM_GETCHECK +Gets the check state of a radio button or check box. You can send this message explicitly or +use the Button_GetCheck macro. + +BM_GETIMAGE +Retrieves a handle to the image (icon or bitmap) associated with the button. + +BM_GETSTATE +Retrieves the state of a button or check box. You can send this message explicitly or use the +Button_GetState macro. + +BM_SETCHECK +Sets the check state of a radio button or check box. You can send this message explicitly or by +using the Button_SetCheck macro. + +BM_SETDONTCLICK +Sets a flag on a radio button that controls the generation of BN_CLICKED messages when the +button receives focus. + +BM_SETIMAGE +Associates a new image (icon or bitmap) with the button. + +BM_SETSTATE +Sets the highlight state of a button. The highlight state indicates whether the button is +highlighted as if the user had pushed it. You can send this message explicitly or use the +Button_SetState macro. + +BM_SETSTYLE +Sets the style of a button. You can send this message explicitly or use the Button_SetStyle macro. + + +Notifications +============= + +BCN_DROPDOWN +Sent when the user clicks a drop down arrow on a button. The parent window of the control receives +this notification message in the form of a WM_NOTIFY message. + +BCN_HOTITEMCHANGE +Notifies the button control owner that the mouse is entering or leaving the client area of the +button control. The button control sends this notification in the form of a WM_NOTIFY message. + +BN_CLICKED +Sent when the user clicks a button. +The parent window of the button receives the BN_CLICKED notification code through the WM_COMMAND message. + +BN_DBLCLK +Sent when the user double-clicks a button. This notification is sent automatically for +BS_USERBUTTON, BS_RADIOBUTTON, and BS_OWNERDRAW buttons. Other button types send +BN_DBLCLK only if they have the BS_NOTIFY style. +The parent window of the button receives the BN_DBLCLK notification code through the WM_COMMAND message. + +BN_DISABLE +Sent when a button is disabled. +Note This notification message is provided only for compatibility with 16-bit versions of +Microsoft Windows earlier than version 3.0. Applications should use the BS_OWNERDRAW button style +and the DRAWITEMSTRUCT structure for this task. +The parent window of the button receives the BN_DISABLE notification code through the WM_COMMAND message. + +BN_DOUBLECLICKED +Sent when the user double-clicks a button. This notification is sent automatically for +BS_USERBUTTON, BS_RADIOBUTTON, and BS_OWNERDRAW buttons. Other button types send +BN_DOUBLECLICKED only if they have the BS_NOTIFY style. +The parent window of the button receives the BN_DOUBLECLICKED notification code through the +WM_COMMAND message. + +BN_HILITE +Sent when the user selects a button. +Note This notification message is provided only for compatibility with 16-bit versions +of Windows earlier than version 3.0. Applications should use the BS_OWNERDRAW button style +and the DRAWITEMSTRUCT structure for this task. +The parent window of the button receives the BN_HILITE notification code through the WM_COMMAND message. + +BN_KILLFOCUS +Sent when a button loses the keyboard focus. The button must have the +BS_NOTIFY style to send this notification message. + +The parent window of the button receives the BN_KILLFOCUS notification code through the +WM_COMMAND message. + +BN_PAINT +Sent when a button should be painted. +Note This notification message is provided only for compatibility with 16-bit versions of +Windows earlier than version 3.0. Applications should use the BS_OWNERDRAW button style and +the DRAWITEMSTRUCT structure for this task. +The parent window of the button receives the BN_PAINT notification code through the WM_COMMAND message. + +BN_PUSHED +Sent when the push state of a button is set to pushed. +Note This notification message is provided only for compatibility with 16-bit versions +of Windows earlier than version 3.0. Applications should use the BS_OWNERDRAW button +style and the DRAWITEMSTRUCT structure for this task. +The parent window of the button receives the BN_PUSHED notification code through the WM_COMMAND message. + +BN_SETFOCUS +Sent when a button receives the keyboard focus. The button must have the BS_NOTIFY style to +send this notification message. +The parent window of the button receives the BN_SETFOCUS notification code through the WM_COMMAND message. + +BN_UNHILITE +Sent when the highlight should be removed from a button. +Note This notification message is provided only for compatibility with 16-bit versions of +Windows earlier than version 3.0. Applications should use the BS_OWNERDRAW button style and +the DRAWITEMSTRUCT structure for this task. +The parent window of the button receives the BN_UNHILITE notification code through the WM_COMMAND message. + +BN_UNPUSHED +Sent when the push state of a button is set to unpushed. +Note This notification message is provided only for compatibility with 16-bit versions +of Windows earlier than version 3.0. Applications should use the BS_OWNERDRAW button style +and the DRAWITEMSTRUCT structure for this task. +The parent window of the button receives the BN_UNPUSHED notification code through the WM_COMMAND message. + +NM_CUSTOMDRAW (button) +Notifies the parent window of a button control about custom draw operations on the button. +The button control sends this notification in the form of a WM_NOTIFY message. + +WM_CTLCOLORBTN +The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. +The parent window can change the button s text and background colors. However, only owner-drawn +buttons respond to the parent window processing this message. + + +Structures +========== + +BUTTON_IMAGELIST +Contains information about an image list that is used with a button control. + +BUTTON_SPLITINFO +Contains information that defines a split button (BS_SPLITBUTTON and BS_DEFSPLITBUTTON styles). +Used with the BCM_GETSPLITINFO and BCM_SETSPLITINFO messages. + +NMBCDROPDOWN +Contains information about a BCN_DROPDOWN notification. + +NMBCHOTITEM +Contains information about the movement of the mouse over a button control. + + +Constants +========= + +Button Styles +Specifies a combination of button styles. If you create a button using the BUTTON class +with the CreateWindow or CreateWindowEx function, you can specify any of the button styles listed below. + +#endif +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgsink.c b/harbour/contrib/gtwvg/wvgsink.c index 9221f99cc5..598dd6c789 100644 --- a/harbour/contrib/gtwvg/wvgsink.c +++ b/harbour/contrib/gtwvg/wvgsink.c @@ -105,6 +105,16 @@ #include #include +//#include + +//----------------------------------------------------------------------// + +#if defined(__BORLANDC__) && !defined(HB_ARCH_64BIT) + #undef MAKELONG + #define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | \ + (((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))) +#endif + //----------------------------------------------------------------------// static HRESULT s_nOleError; static HMODULE hLib = NULL; @@ -121,6 +131,57 @@ HRESULT hb_oleVariantToItem( PHB_ITEM pItem, VARIANT *pVariant ); void HB_EXPORT hb_ToOutDebug( const char * sTraceMsg, ... ); +//----------------------------------------------------------------------// + +#if !defined( StringCchCat ) + #ifdef UNICODE + #define StringCchCat(d,n,s) hb_wcncpy( (d), (s), (n) - 1 ) + #else + #define StringCchCat(d,n,s) hb_xstrncpy( (d), (s), (n) - 1 ) + #endif +#endif + +/* + * This function copies szText to destination buffer. + * NOTE: Unlike the documentation for strncpy, this routine will always append + * a null + */ +char * hb_xstrncpy( char * pDest, const char * pSource, ULONG ulLen ) +{ + ULONG ulDst, ulSrc; + + pDest[ ulLen ] = 0; + ulDst = strlen( pDest ); + if( ulDst < ulLen ) + { + ulSrc = strlen( pSource ); + if( ulDst + ulSrc > ulLen ) + ulSrc = ulLen - ulDst; + + memcpy( &pDest[ ulDst ], pSource, ulSrc ); + pDest[ ulDst + ulSrc ] = 0; + } + return pDest; +} + + +wchar_t *hb_wcncpy( wchar_t *dstW, const wchar_t *srcW, unsigned long ulLen ) +{ + ULONG ulDst, ulSrc; + + dstW[ ulLen ] = 0; + ulDst = lstrlenW( dstW ); + if( ulDst < ulLen ) + { + ulSrc = lstrlenW( srcW ); + if( ulDst + ulSrc > ulLen ) + ulSrc = ulLen - ulDst; + memcpy( &dstW[ ulDst ], srcW, ulSrc * sizeof( wchar_t ) ); + dstW[ ulDst + ulSrc ] = 0; + } + return dstW; +} + //----------------------------------------------------------------------// // these 2 functions are required to send parameters by reference // @@ -515,7 +576,8 @@ static HRESULT SetupConnectionPoint( device_interface* pdevice_interface, REFIID HB_SYMBOL_UNUSED( riid ); HB_SYMBOL_UNUSED( pn ); - if( !( thisobj = ( IEventHandler * ) GlobalAlloc( GMEM_FIXED, sizeof( MyRealIEventHandler ) ) ) ) + thisobj = ( IEventHandler * ) GlobalAlloc( GMEM_FIXED, sizeof( MyRealIEventHandler ) ); + if( !( thisobj ) ) { hr = E_OUTOFMEMORY; } @@ -636,15 +698,59 @@ HB_FUNC( HB_AX_SETUPCONNECTIONPOINT ) //----------------------------------------------------------------------// HB_FUNC( HB_AX_ATLAXWININIT ) { - PATLAXWININIT AtlAxWinInit; - char szLibName[ MAX_PATH + 1 ] = { 0 }; BOOL bRet = FALSE; if( !hLib ) { + PATLAXWININIT AtlAxWinInit; + + #if 0 + /* the code below needs TCHAR strcat of szLibName and dll name */ + char szLibName[ MAX_PATH + 1 ] = { 0 }; + GetSystemDirectory( szLibName, MAX_PATH ); hb_strncat( szLibName, "\\atl.dll", sizeof( szLibName ) - 1 ); hLib = LoadLibrary( ( LPCSTR ) szLibName ); + #endif + + //hLib = LoadLibrary( TEXT( "atl.dll" ) ); + + #if 1 + TCHAR szLibName[ MAX_PATH + 1 ] = { 0 }; + + /* please always check if given function need size in TCHARs or bytes + * in MS documentation. + */ + GetSystemDirectory( szLibName, MAX_PATH ); + + /* TEXT() macro can be used for literal (and only for literal) string + * values. It creates array of TCHAR items with given text. It cannot + * be used to ecapsulate non literal values. In different [x]Harbour + * source code you may find things like TEXT( hb_parc( 1 ) ) - it's + * a technical nonsense written by someone who has no idea what this + * macro does. + * Use new string functions (StringCchCat() in this case) which always + * set trailing 0 in the given buffer just like hb_strn*() functions. + * [l]str[n]cat() is absolute and should not be used by new code. It does + * not guarantee buffer overflow protection and/or setting trailing 0. + * StringCch*() functions operate on TCHAR types. + */ + StringCchCat( szLibName, MAX_PATH + 1, TEXT( "\\atl.dll" ) ); + + /* Please note that I intentionally removed any casting when szLibName + * is passed to WinAPI functions. Such casting can pacify warnings so + * program will be compiled but code will be still wrong so it does not + * fix anything and only makes much harder later fixing when someone + * will look for wrong code which is not UNICODE ready. The wrong casting + * related to different character representations used only to pacify + * warnings is the biggest problem in MS-Win 3-rd party code written + * for [x]Harbour because it only hides bugs and then people have to + * look for the code line by line to fix it. I dedicated above note to + * developers of few well known MS-Win GUI projects for [x]Harbour. + * Please remember about it. + */ + hLib = LoadLibrary( szLibName ); + #endif if( hLib ) { @@ -703,7 +809,8 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL ) if( hContainer ) { - SendMessage( ( HWND ) hContainer, ( UINT ) WM_SETFONT, ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ), ( LPARAM ) ( MAKELPARAM( FALSE, 0 ) ) ); + LPARAM lParam = MAKELPARAM( FALSE, 0 ); + SendMessage( ( HWND ) hContainer, ( UINT ) WM_SETFONT, ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ), lParam ); uLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen( Caption )+1, NULL, 0 ); wString = ( BSTR ) malloc( uLen * sizeof( WCHAR ) ); MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen( Caption )+1, wString, uLen ); diff --git a/harbour/contrib/gtwvg/wvgstatb.prg b/harbour/contrib/gtwvg/wvgstatb.prg new file mode 100644 index 0000000000..f119514c1e --- /dev/null +++ b/harbour/contrib/gtwvg/wvgstatb.prg @@ -0,0 +1,426 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpStatusBar Compatible Class +// +// Pritpal Bedi +// 25Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +CLASS WvgStatusBar INHERIT WvgActiveXControl + + DATA caption INIT '' + DATA sizeGrip INIT .T. + + DATA aItems INIT {} + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + METHOD addItem() + METHOD delItem() + METHOD getItem() + METHOD clear() + METHOD numItems() INLINE Len( ::aItems ) + + METHOD panelClick() SETGET + METHOD panelDblClick() SETGET + + ENDCLASS +//----------------------------------------------------------------------// + +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 ) + + ::style := WS_CHILD + WS_BORDER + SBARS_TOOLTIPS + ::className := STATUSCLASSNAME + ::objType := objTypeStatusBar + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatusBar + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + IF ::sizeGrip + ::style += SBARS_SIZEGRIP + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + ::addItem( , , , , , -1 ) + + IF ::visible + ::show() + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatusBar + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgStatusBar + LOCAL i, nItems + + IF ( nItems := Len( ::aItems ) ) > 0 + FOR i := 1 TO nItems + + NEXT + ENDIF + + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + + RETURN NIL + +//----------------------------------------------------------------------// + +METHOD addItem( cCaption, xImage, cDLL, nStyle, cKey, nMode ) CLASS WvgStatusBar + LOCAL oPanel, lSuccess + + DEFAULT nMode TO 0 + + HB_SYMBOL_UNUSED( xImage ) + HB_SYMBOL_UNUSED( cDLL ) + + oPanel := WvgStatusBarPanel():new( cCaption, nStyle, cKey ) + oPanel:oParent := self + + oPanel:index := ::numItems + 1 + + lSuccess := Wvg_StatusBarCreatePanel( ::hWnd, nMode ) + + IF lSuccess + aadd( ::aItems, oPanel ) + ELSE + RETURN nil + endif + + RETURN oPanel + +//----------------------------------------------------------------------// + +METHOD delItem( nItemORcKey ) CLASS WvgStatusBar + LOCAL nIndex := 0 + + IF hb_isNumeric( nItemORcKey ) + nIndex := ascan( ::aItems, {|o| o:key == nItemORcKey } ) + ELSEIF hb_isNumeric( nItemORcKey ) + nIndex := nItemORcKey + ENDIF + + IF nIndex > 0 + // Delete panel by window + + adel( ::aItems, nIndex ) + asize( ::aItems, len( ::aItems ) - 1 ) + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD getItem( nItemORcKey ) CLASS WvgStatusBar + LOCAL nIndex := 0, oPanel + + IF hb_isChar( nItemORcKey ) + nIndex := ascan( ::aItems, {|o| o:key == nItemORcKey } ) + + ELSEIF hb_isNumeric( nItemORcKey ) + nIndex := nItemORcKey + + ENDIF + + IF nIndex > 0 + oPanel := ::aItems[ nIndex ] + ENDIF + + RETURN oPanel + +//----------------------------------------------------------------------// + +METHOD clear() CLASS WvgStatusBar + LOCAL i + + FOR i := 1 TO ::numItems + // Remove off window + + NEXT + + ::aItems := {} + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD panelClick( xParam ) CLASS WvgStatusBar + + IF hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbClick := xParam + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD panelDblClick( xParam ) CLASS WvgStatusBar + + IF hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbDblClick := xParam + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// WvgToolbarButton() Class compatible with XbpToolbarButton() +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +CLASS WvgStatusBarPanel + + DATA alignment INIT WVGALIGN_LEFT + DATA autosize INIT WVGSTATUSBAR_AUTOSIZE_NONE + DATA bevel INIT WVGSTATUSBAR_BEVEL_INSET + DATA enabled INIT .T. + DATA index INIT 0 + DATA key INIT '' + DATA style INIT WVGSTATUSBAR_PANEL_TEXT + DATA sl_caption INIT '' + DATA image INIT NIL + DATA tooltipText INIT '' + DATA visible INIT .T. + DATA left INIT 0 + DATA width INIT 0 + DATA minWidth INIT 0 + + METHOD new() + METHOD caption() SETGET + + DATA oParent + + ENDCLASS +//----------------------------------------------------------------------// +METHOD new( cCaption, nStyle, cKey ) CLASS WvgStatusBarPanel + + DEFAULT cCaption TO ::sl_caption + DEFAULT nStyle TO ::style + DEFAULT cKey TO ::key + + ::sl_caption := cCaption + ::style := nStyle + ::key := cKey + + RETURN Self +//----------------------------------------------------------------------// +METHOD caption( cCaption ) CLASS WvgStatusBarPanel + + IF cCaption == NIL + RETURN ::sl_caption + + ELSE + DEFAULT cCaption TO ::sl_caption + + ::sl_caption := cCaption + + Wvg_StatusBarSetText( ::oParent:hWnd, ::index, cCaption ) + ENDIF + + RETURN Self +//----------------------------------------------------------------------// +// MSDN on StatusBar Control +//----------------------------------------------------------------------// +#if 0 + +Messages +======== + +SB_GETBORDERS +Retrieves the current widths of the horizontal and vertical borders of a status window. + +SB_GETICON +Retrieves the icon for a part in a status bar. + +SB_GETPARTS +Retrieves a count of the parts in a status window. The message also retrieves the coordinate +of the right edge of the specified number of parts. + +SB_GETRECT +Retrieves the bounding rectangle of a part in a status window. + +SB_GETTEXT +The SB_GETTEXT message retrieves the text from the specified part of a status window. + +SB_GETTEXTLENGTH +The SB_GETTEXTLENGTH message retrieves the length, in characters, of the text from the specified +part of a status window. + +SB_GETTIPTEXT +Retrieves the ToolTip text for a part in a status bar. The status bar must be created with the +SBT_TOOLTIPS style to enable ToolTips. + +SB_GETUNICODEFORMAT +Retrieves the Unicode character format flag for the control. + +SB_ISSIMPLE +Checks a status bar control to determine if it is in simple mode. + +SB_SETBKCOLOR +Sets the background color in a status bar. + +SB_SETICON +Sets the icon for a part in a status bar. + +SB_SETMINHEIGHT +Sets the minimum height of a status windows drawing area. + +SB_SETPARTS +Sets the number of parts in a status window and the coordinate of the right edge of each part. + +SB_SETTEXT +The SB_SETTEXT message sets the text in the specified part of a status window. + +SB_SETTIPTEXT +Sets the ToolTip text for a part in a status bar. The status bar must have been created with +the SBT_TOOLTIPS style to enable ToolTips. + +SB_SETUNICODEFORMAT +Sets the Unicode character format flag for the control. This message allows you to change the +character set used by the control at run time rather than having to re-create the control. + +SB_SIMPLE +Specifies whether a status window displays simple text or displays all window parts set by a +previous SB_SETPARTS message. + +Notifications +============= + +NM_CLICK (status bar) +Notifies the parent window of a status bar control that the user has clicked the left mouse +button within the control. NM_CLICK (status bar) is sent in the form of a WM_NOTIFY message. + +NM_DBLCLK (status bar) +Notifies the parent window of a a status bar control that the user has double-clicked the +left mouse button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_RCLICK (status bar) +Notifies the parent window of a status bar control that the user has clicked the right mouse +button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_RDBLCLK (status bar) +Notifies the parent windows of a status bar control that the user has double-clicked the right +mouse button within the control. NM_RDBLCLK (status bar) is sent in the form of a WM_NOTIFY message. + +SBN_SIMPLEMODECHANGE +Sent by a status bar control when the simple mode changes due to a SB_SIMPLE message. +This notification is sent in the form of a WM_NOTIFY message. + +Styles +====== + +SBARS_SIZEGRIP +The status bar control will include a sizing grip at the right end of the status bar. +A sizing grip is similar to a sizing border; it is a rectangular area that the user can click and +drag to resize the parent window. + +SBT_TOOLTIPS +Version 4.71.Use this style to enable ToolTips. + +SBARS_TOOLTIPS +Version 5.80.Identical to SBT_TOOLTIPS. Use this flag for versions 5.00 or later. + +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgstatc.prg b/harbour/contrib/gtwvg/wvgstatc.prg new file mode 100644 index 0000000000..c5278a0266 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgstatc.prg @@ -0,0 +1,298 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpTreeView compatible Class +// +// Pritpal Bedi +// 26Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +CLASS WvgStatic INHERIT WvgWindow + + DATA autoSize INIT .F. + DATA caption INIT '' + DATA clipParent INIT .T. + DATA clipSiblings INIT .F. + DATA options INIT WVGSTATIC_TEXT_LEFT + DATA type INIT WVGSTATIC_TYPE_TEXT + + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + METHOD setCaption( xCaption, cDll ) + + ENDCLASS +//----------------------------------------------------------------------// + +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 ) + + // + SS_NOTIFY + SS_ETCHEDFRAME //SS_SUNKEN //+ SS_WHITERECT + // + ::style := WS_CHILD + WS_CLIPCHILDREN + ::className := 'STATIC' + ::objType := objTypeStatic + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic + LOCAL wm_:= {} + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + + SWITCH ::type + CASE WVGSTATIC_TYPE_TEXT + IF ( Win_AND( ::options, WVGSTATIC_TEXT_LEFT ) == WVGSTATIC_TEXT_LEFT ) + ::style += SS_LEFT + SS_LEFTNOWORDWRAP + ENDIF + IF ( Win_AND( ::options, WVGSTATIC_TEXT_RIGHT ) == WVGSTATIC_TEXT_RIGHT ) + ::style += SS_RIGHT + SS_LEFTNOWORDWRAP + ENDIF + IF ( Win_AND( ::options, WVGSTATIC_TEXT_CENTER ) == WVGSTATIC_TEXT_CENTER ) + ::style += SS_CENTER + SS_LEFTNOWORDWRAP + ENDIF + IF ( Win_AND( ::options, WVGSTATIC_TEXT_WORDBREAK ) == WVGSTATIC_TEXT_WORDBREAK ) + ::style -= SS_LEFTNOWORDWRAP + ENDIF + EXIT + CASE WVGSTATIC_TYPE_GROUPBOX + EXIT + CASE WVGSTATIC_TYPE_ICON + EXIT + CASE WVGSTATIC_TYPE_SYSICON + EXIT + CASE WVGSTATIC_TYPE_BITMAP + IF ::options == WVGSTATIC_BITMAP_TILED + + ELSEIF ::options == WVGSTATIC_BITMAP_SCALED + + ELSE + + ENDIF + EXIT + CASE WVGSTATIC_TYPE_FGNDRECT + EXIT + CASE WVGSTATIC_TYPE_BGNDRECT + EXIT + CASE WVGSTATIC_TYPE_FGNDFRAME + EXIT + CASE WVGSTATIC_TYPE_BGNDFRAME + EXIT + CASE WVGSTATIC_TYPE_HALFTONERECT + EXIT + CASE WVGSTATIC_TYPE_HALFTONEFRAME + EXIT + CASE WVGSTATIC_TYPE_RAISEDBOX + EXIT + CASE WVGSTATIC_TYPE_RECESSEDBOX + EXIT + CASE WVGSTATIC_TYPE_RAISEDRECT + EXIT + CASE WVGSTATIC_TYPE_RECESSEDRECT + EXIT + CASE WVGSTATIC_TYPE_RAISEDLINE + EXIT + CASE WVGSTATIC_TYPE_RECESSEDLINE + EXIT + END + + ::createControl() + + IF Win_IsWindow( ::hWnd ) + ::oParent:addChild( SELF ) + + ::setCaption( ::caption ) + IF ::visible + ::show() + ENDIF + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgStatic + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgStatic + + IF len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ENDIF + + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + + RETURN NIL + +//----------------------------------------------------------------------// + +METHOD setCaption( xCaption, cDll ) + + HB_SYMBOL_UNUSED( xCaption ) + HB_SYMBOL_UNUSED( cDll ) + + DEFAULT xCaption TO ::caption + ::caption := xCaption + + DO CASE + CASE ::type == WVGSTATIC_TYPE_TEXT + Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption ) + + ENDCASE + + RETURN Self + +//----------------------------------------------------------------------// +// MSDN on Static Control +//----------------------------------------------------------------------// +#if 0 + +Static Control Styles +Using Static Controls + +This topic provides an example that uses a static control. + + + +Messages +======== + +STM_GETICON +An application sends the STM_GETICON message to retrieve a handle to the icon associated +with a static control that has the SS_ICON style. + +STM_GETIMAGE +An application sends an STM_GETIMAGE message to retrieve a handle to the image +(icon or bitmap) associated with a static control. + +STM_SETICON +An application sends the STM_SETICON message to associate an icon with an icon control. + +STM_SETIMAGE +An application sends an STM_SETIMAGE message to associate a new image with a static control. + + +Notifications +============= + +STN_CLICKED +The STN_CLICKED notification message is sent when the user clicks a static control +that has the SS_NOTIFY style. The parent window of the control receives this +notification message through the WM_COMMAND message. + +STN_DBLCLK +The STN_DBLCLK notification message is sent when the user double-clicks a static +control that has the SS_NOTIFY style. The parent window of the control receives this +notification message through the WM_COMMAND message. + +STN_DISABLE +The STN_DISABLE notification message is sent when a static control is disabled. +The static control must have the SS_NOTIFY style to receive this notification message. +The parent window of the control receives this notification message through the WM_COMMAND message. + +STN_ENABLE +The STN_ENABLE notification message is sent when a static control is enabled. +The static control must have the SS_NOTIFY style to receive this notification message. +The parent window of the control receives this notification message through the WM_COMMAND message. + +WM_CTLCOLORSTATIC +A static control, or an edit control that is read-only or disabled, sends the +WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. +By responding to this message, the parent window can use the specified device context +handle to set the text and background colors of the static control. +A window receives this message through its WindowProc function. + + +#endif +//----------------------------------------------------------------------// + + + diff --git a/harbour/contrib/gtwvg/wvgtoolb.prg b/harbour/contrib/gtwvg/wvgtoolb.prg index 3967708e4f..967fc383f4 100644 --- a/harbour/contrib/gtwvg/wvgtoolb.prg +++ b/harbour/contrib/gtwvg/wvgtoolb.prg @@ -67,10 +67,12 @@ #include 'hbclass.ch' #include 'common.ch' +#include 'inkey.ch' #include 'hbgtinfo.ch' + #include 'hbgtwvg.ch' #include 'wvtwin.ch' -#include 'inkey.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// @@ -109,7 +111,6 @@ CLASS WvgToolBar INHERIT WvgActiveXControl METHOD setPosAndSize() METHOD setSize() - DATA sl_buttonClick DATA sl_change DATA sl_buttonMenuClick DATA sl_buttonDropDown @@ -119,25 +120,12 @@ CLASS WvgToolBar INHERIT WvgActiveXControl METHOD buttonMenuClick() SETGET METHOD buttonDropDown() SETGET - ENDCLASS //----------------------------------------------------------------------// METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolBar - DEFAULT oParent TO ::oParent - DEFAULT oOwner TO ::oOwner - DEFAULT aPos TO ::aPos - DEFAULT aSize TO ::aSize - DEFAULT aPresParams TO ::aPresParams - DEFAULT lVisible TO ::visible - - ::oParent := oParent - ::oOwner := oOwner - ::aPos := aPos - ::aSize := aSize - ::aPresParams := aPresParams - ::visible := lVisible + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -152,19 +140,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolB METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolBar - DEFAULT oParent TO ::oParent - DEFAULT oOwner TO ::oOwner - DEFAULT aPos TO ::aPos - DEFAULT aSize TO ::aSize - DEFAULT aPresParams TO ::aPresParams - DEFAULT lVisible TO ::visible - - ::oParent := oParent - ::oOwner := oOwner - ::aPos := aPos - ::aSize := aSize - ::aPresParams := aPresParams - ::visible := lVisible + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) IF ::visible ::style += WS_VISIBLE @@ -191,10 +167,6 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo ::sendMessage( TB_SETMAXTEXTROWS, 0, 0 ) ENDIF - //::sendMessage( TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DOUBLEBUFFER ) - //::sendMessage( TB_SETPADDING , 0, Win_MakeLParam( 3,3 ) ) - //::sendMessage( TB_SETLISTGAP, 4, 0 ) // vista - IF ::visible ::show() ENDIF @@ -205,19 +177,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolBar - DEFAULT oParent TO ::oParent - DEFAULT oOwner TO ::oOwner - DEFAULT aPos TO ::aPos - DEFAULT aSize TO ::aSize - DEFAULT aPresParams TO ::aPresParams - DEFAULT lVisible TO ::visible - - ::oParent := oParent - ::oOwner := oOwner - ::aPos := aPos - ::aSize := aSize - ::aPresParams := aPresParams - ::visible := lVisible + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) RETURN Self @@ -240,6 +200,10 @@ METHOD destroy() CLASS WvgToolBar NEXT ENDIF + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + RETURN NIL //----------------------------------------------------------------------// @@ -251,7 +215,6 @@ METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey HB_SYMBOL_UNUSED( xHotImage ) HB_SYMBOL_UNUSED( cDLL ) - oBtn := WvgToolbarButton():new( cCaption, nStyle, cKey ) oBtn:index := ::numItems + 1 @@ -274,7 +237,11 @@ METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey aadd( ::aItems, { oBtn:command, oBtn } ) - RETURN Self + //::sendMessage( TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DOUBLEBUFFER ) + //::sendMessage( TB_SETPADDING, 0, MAKELPARAM( 3,3 ) ) + //::sendMessage( TB_SETLISTGAP, 4, 0 ) // vista + + RETURN oBtn //----------------------------------------------------------------------// @@ -337,7 +304,7 @@ METHOD setSize() CLASS WvgToolBar METHOD buttonClick( xParam ) CLASS WvgToolBar IF hb_isBlock( xParam ) .or. hb_isNil( xParam ) - ::sl_buttonClick := xParam + ::sl_lbClick := xParam ENDIF RETURN Self @@ -420,3 +387,596 @@ METHOD new( cCaption, nStyle, cKey ) CLASS WvgToolbarButton RETURN Self //----------------------------------------------------------------------// +// MSDN on ToolBar Control +//----------------------------------------------------------------------// +#if 0 + +MESSAGES +======== + +TB_ADDBITMAP +Adds one or more images to the list of button images available for a toolbar. + +TB_ADDBUTTONS +Adds one or more buttons to a toolbar. + +TB_ADDSTRING +Adds a new string to the toolbars string pool. + +TB_AUTOSIZE +Causes a toolbar to be resized. + +TB_BUTTONCOUNT +Retrieves a count of the buttons currently in the toolbar. + +TB_BUTTONSTRUCTSIZE +Specifies the size of the TBBUTTON structure. + +TB_CHANGEBITMAP +Changes the bitmap for a button in a toolbar. + +TB_CHECKBUTTON +Checks or unchecks a given button in a toolbar. + +TB_COMMANDTOINDEX +Retrieves the zero-based index for the button associated with the specified command identifier. + +TB_CUSTOMIZE +Displays the Customize Toolbar dialog box. + +TB_DELETEBUTTON +Deletes a button from the toolbar. + +TB_ENABLEBUTTON +Enables or disables the specified button in a toolbar. + +TB_GETANCHORHIGHLIGHT +Retrieves the anchor highlight setting for a toolbar. + +TB_GETBITMAP +Retrieves the index of the bitmap associated with a button in a toolbar. + +TB_GETBITMAPFLAGS +Retrieves the flags that describe the type of bitmap to be used. + +TB_GETBUTTON +Retrieves information about the specified button in a toolbar. + +TB_GETBUTTONINFO +Retrieves extended information for a button in a toolbar. + +TB_GETBUTTONSIZE +Retrieves the current width and height of toolbar buttons, in pixels. + +TB_GETBUTTONTEXT +Retrieves the display text of a button on a toolbar. + +TB_GETCOLORSCHEME +Retrieves the color scheme information from the toolbar control. + +TB_GETDISABLEDIMAGELIST +Retrieves the image list that a toolbar control uses to display inactive buttons. + +TB_GETEXTENDEDSTYLE +Retrieves the extended styles for a toolbar control. + +TB_GETHOTIMAGELIST +Retrieves the image list that a toolbar control uses to display hot buttons. + +TB_GETHOTITEM +Retrieves the index of the hot item in a toolbar. + +TB_GETIDEALSIZE +Gets the ideal size of the toolbar. + +TB_GETIMAGELIST +Retrieves the image list that a toolbar control uses to display buttons in their default state. +A toolbar control uses this image list to display buttons when they are not hot or disabled. + +TB_GETIMAGELISTCOUNT +Gets the number of image lists associated with the toolbar. + +TB_GETINSERTMARK +Retrieves the current insertion mark for the toolbar. + +TB_GETINSERTMARKCOLOR +Retrieves the color used to draw the insertion mark for the toolbar. + +TB_GETITEMDROPDOWNRECT + +Gets the bounding rectangle of the dropdown window for a toolbar item with style BTNS_DROPDOWN. + +TB_GETITEMRECT +Retrieves the bounding rectangle of a button in a toolbar. + +TB_GETMAXSIZE +Retrieves the total size of all of the visible buttons and separators in the toolbar. + +TB_GETMETRICS +Retrieves the metrics of a toolbar control. + +TB_GETOBJECT +Retrieves the IDropTarget for a toolbar control. + +TB_GETPADDING +Retrieves the padding for a toolbar control. + +TB_GETPRESSEDIMAGELIST +Gets the image list that a toolbar control uses to display buttons in a pressed state. + +TB_GETRECT +Retrieves the bounding rectangle for a specified toolbar button. + +TB_GETROWS +Retrieves the number of rows of buttons in a toolbar with the TBSTYLE_WRAPABLE style. + +TB_GETSTATE +Retrieves information about the state of the specified button in a toolbar, such as whether it +is enabled, pressed, or checked. + +TB_GETSTRING +Retrieves a string from a toolbars string pool. + +TB_GETSTYLE +Retrieves the styles currently in use for a toolbar control. + +TB_GETTEXTROWS +Retrieves the maximum number of text rows that can be displayed on a toolbar button. + +TB_GETTOOLTIPS +Retrieves the handle to the ToolTip control, if any, associated with the toolbar. + +TB_GETUNICODEFORMAT +Retrieves the Unicode character format flag for the control. + +TB_HIDEBUTTON +Hides or shows the specified button in a toolbar. + +TB_HITTEST +Determines where a point lies in a toolbar control. + +TB_INDETERMINATE +Sets or clears the indeterminate state of the specified button in a toolbar. + +TB_INSERTBUTTON +Inserts a button in a toolbar. + +TB_INSERTMARKHITTEST +Retrieves the insertion mark information for a point in a toolbar. + +TB_ISBUTTONCHECKED +Determines whether the specified button in a toolbar is checked. + +TB_ISBUTTONENABLED +Determines whether the specified button in a toolbar is enabled. + +TB_ISBUTTONHIDDEN +Determines whether the specified button in a toolbar is hidden. + +TB_ISBUTTONHIGHLIGHTED +Checks the highlight state of a toolbar button. + +TB_ISBUTTONINDETERMINATE +Determines whether the specified button in a toolbar is indeterminate. + +TB_ISBUTTONPRESSED +Determines whether the specified button in a toolbar is pressed. + +TB_LOADIMAGES +Loads system-defined button images into a toolbar controls image list. + +TB_MAPACCELERATOR +Determines the ID of the button that corresponds to the specified accelerator character. + +TB_MARKBUTTON +Sets the highlight state of a given button in a toolbar control. + +TB_MOVEBUTTON +Moves a button from one index to another. + +TB_PRESSBUTTON +Presses or releases the specified button in a toolbar. + +TB_REPLACEBITMAP +Replaces an existing bitmap with a new bitmap. + +TB_SAVERESTORE +Send this message to initiate saving or restoring a toolbar state. + +TB_SETANCHORHIGHLIGHT +Sets the anchor highlight setting for a toolbar. + +TB_SETBITMAPSIZE +Sets the size of the bitmapped images to be added to a toolbar. + +TB_SETBUTTONINFO +Sets the information for an existing button in a toolbar. + +TB_SETBUTTONSIZE +Sets the size of buttons on a toolbar. + +TB_SETBUTTONWIDTH +Sets the minimum and maximum button widths in the toolbar control. + +TB_SETCMDID +Sets the command identifier of a toolbar button. + +TB_SETCOLORSCHEME +Sets the color scheme information for the toolbar control. + +TB_SETDISABLEDIMAGELIST +Sets the image list that the toolbar control will use to display disabled buttons. + +TB_SETDRAWTEXTFLAGS +Sets the text drawing flags for the toolbar. + +TB_SETEXTENDEDSTYLE +Sets the extended styles for a toolbar control. + +TB_SETHOTIMAGELIST +Sets the image list that the toolbar control will use to display hot buttons. + +TB_SETHOTITEM +Sets the hot item in a toolbar. + +TB_SETHOTITEM2 +Sets the hot item in a toolbar. + +TB_SETIMAGELIST +Sets the image list that the toolbar uses to display buttons that are in their default state. + +TB_SETINDENT +Sets the indentation for the first button in a toolbar control. + +TB_SETINSERTMARK +Sets the current insertion mark for the toolbar. + +TB_SETINSERTMARKCOLOR +Sets the color used to draw the insertion mark for the toolbar. + +TB_SETLISTGAP +Sets the distance between the toolbar buttons on a specific toolbar. + +TB_SETMAXTEXTROWS +Sets the maximum number of text rows displayed on a toolbar button. + +TB_SETMETRICS +Sets the metrics of a toolbar control. + +TB_SETPADDING +Sets the padding for a toolbar control. + +TB_SETPARENT +Sets the window to which the toolbar control sends notification messages. + +TB_SETPRESSEDIMAGELIST +Sets the image list that the toolbar uses to display buttons that are in a pressed state. + +TB_SETROWS +Sets the number of rows of buttons in a toolbar. + +TB_SETSTATE +Sets the state for the specified button in a toolbar. + +TB_SETSTYLE +Sets the style for a toolbar control. + +TB_SETTOOLTIPS +Associates a ToolTip control with a toolbar. + +TB_SETUNICODEFORMAT +Sets the Unicode character format flag for the control. This message allows you to change the +character set used by the control at run time rather than having to re-create the control. + +TB_SETWINDOWTHEME +Sets the visual style of a toolbar control. + +TB_TRANSLATEACCELERATOR +Passes a keyboard message to the toolbar. + + +NOTIFICATIONS +============= + +NM_CHAR (toolbar) +Sent by the toolbar when it receives a WM_CHAR message. This notification message is sent +in the form of a WM_NOTIFY message. + +NM_CLICK (toolbar) +Sent by a toolbar control when the user clicks an item with the left mouse button. +This notification message is sent in the form of a WM_NOTIFY message. + +NM_CUSTOMDRAW (toolbar) +Sent by the toolbar to notify its parent window about drawing operations. This notification +is sent in the form of a WM_NOTIFY message. + +NM_DBLCLK (toolbar) +Notifies the parent window of a toolbar control that the user has double-clicked the left +mouse button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_KEYDOWN (toolbar) +Sent by a control when the control has the keyboard focus and the user presses a key. +This notification message is sent in the form of a WM_NOTIFY message. + +NM_LDOWN +Notifies a toolbars parent window that the left mouse button has been pressed. + +NM_RCLICK (toolbar) +Sent by a toolbar control when the user clicks the toolbar with the right mouse button. +This notification message is sent in the form of a WM_NOTIFY message. + +NM_RDBLCLK (toolbar) +Notifies a control s parent window that the user has double-clicked the right mouse button +within the control. NM_RDBLCLK (toolbar) is sent in the form of a WM_NOTIFY message. + +NM_RELEASEDCAPTURE (toolbar) +Notifies a toolbar control s parent window that the control is releasing mouse capture. +This notification is sent in the form of a WM_NOTIFY message. + +NM_TOOLTIPSCREATED (toolbar) +Notifies a toolbar s parent window that the toolbar has created a ToolTip control. +This notification is sent in the form of a WM_NOTIFY message. + +TBN_BEGINADJUST +Notifies a toolbar s parent window that the user has begun customizing a toolbar. +This message is sent in the form of a WM_NOTIFY message. + +TBN_BEGINDRAG +Notifies a toolbar s parent window that the user has begun dragging a button in a toolbar. +This message is sent in the form of a WM_NOTIFY message. + +TBN_CUSTHELP +Notifies a toolbar s parent window that the user has chosen the Help button in the +Customize Toolbar dialog box. This message is sent in the form of a WM_NOTIFY message. + +TBN_DELETINGBUTTON +Sent by a toolbar control when a button is about to be deleted. + +TBN_DRAGOUT +Sent by a toolbar control when the user clicks a button and then moves the cursor off the button. +This notification message is sent in the form of a WM_NOTIFY message. + +TBN_DRAGOVER +Ascertains whether a TB_MARKBUTTON message should be sent for a button that is being dragged over.. + +TBN_DROPDOWN +Sent by a toolbar control when the user clicks a dropdown button. +This notification message is sent in the form of a WM_NOTIFY message. + +TBN_DUPACCELERATOR +Ascertains whether an accelerator key can be used on two or more active toolbars. + +TBN_ENDADJUST +Notifies a toolbar s parent window that the user has stopped customizing a toolbar. +This message is sent in the form of a WM_NOTIFY message. + +TBN_ENDDRAG +Notifies the toolbar s parent window that the user has stopped dragging a button in a toolbar. +This message is sent in the form of a WM_NOTIFY message. + +TBN_GETBUTTONINFO +Retrieves toolbar customization information and notifies the toolbar s parent window of any +changes being made to the toolbar. This is sent in the form of a WM_NOTIFY message. + +TBN_GETDISPINFO +Retrieves display information for a toolbar item. This notification is sent in the form of a +WM_NOTIFY message. + +TBN_GETINFOTIP +Retrieves infotip information for a toolbar item. This notification is sent in the form of a +WM_NOTIFY message. + +TBN_GETOBJECT +Sent by a toolbar control that uses the TBSTYLE_REGISTERDROP style to request a drop target +object when the pointer passes over one of its buttons. + +TBN_HOTITEMCHANGE +Sent by a toolbar control when the hot (highlighted) item changes. This notification message +is sent in the form of a WM_NOTIFY message. + +TBN_INITCUSTOMIZE +Notifies a toolbar s parent window that customizing has started. + +TBN_MAPACCELERATOR +Requests the index of the button in the toolbar corresponding to the specified accelerator character. + +TBN_QUERYDELETE +Notifies the toolbar s parent window whether a button may be deleted from a toolbar while the +user is customizing the toolbar. This message is sent in the form of a WM_NOTIFY message. + +TBN_QUERYINSERT +Notifies the toolbar s parent window whether a button may be inserted to the left of the +specified button while the user is customizing a toolbar. This message is sent in the form of a +WM_NOTIFY message. + +TBN_RESET +Notifies the toolbar s parent window that the user has reset the content of the Customize +Toolbar dialog box. This message is sent in the form of a WM_NOTIFY message. + +TBN_RESTORE +Notifies a toolbar s parent window that a toolbar is in the process of being restored. + +TBN_SAVE +Notifies a toolbar s parent window that a toolbar is in the process of being saved. + +TBN_TOOLBARCHANGE +Notifies the toolbar s parent window that the user has customized a toolbar. This message is sent +in the form of a WM_NOTIFY message. + +TBN_WRAPACCELERATOR +Requests the index of the button in one or more toolbars corresponding to the specified accelerator +character. + +TBN_WRAPHOTITEM +Notifies an application with two or more toolbars that the hot item is about to change. + + +BUTTON STATES +============= + +TBSTATE_CHECKED +The button has the TBSTYLE_CHECK style and is being clicked. + +TBSTATE_ELLIPSES +Version 4.70. The button s text is cut off and an ellipsis is displayed. + +TBSTATE_ENABLED +The button accepts user input. A button that doesn t have this state is grayed. + +TBSTATE_HIDDEN +The button is not visible and cannot receive user input. + +TBSTATE_INDETERMINATE +The button is grayed. + +TBSTATE_MARKED +Version 4.71. The button is marked. The interpretation of a marked item is dependent upon the application. + +TBSTATE_PRESSED +The button is being clicked. + +TBSTATE_WRAP +The button is followed by a line break. The button must also have the TBSTATE_ENABLED state. + + +STYLES +====== + +TBSTYLE_ALTDRAG +Allows users to change a toolbar button s position by dragging it while holding down the ALT key. +If this style is not specified, the user must hold down the SHIFT key while dragging a button. Note +that the CCS_ADJUSTABLE style must be specified to enable toolbar buttons to be dragged. + +TBSTYLE_CUSTOMERASE +Version 4.70. Generates NM_CUSTOMDRAW notification messages when the toolbar processes +WM_ERASEBKGND messages. + +TBSTYLE_FLAT +Version 4.70. Creates a flat toolbar. In a flat toolbar, both the toolbar and the buttons are +transparent and hot-tracking is enabled. Button text appears under button bitmaps. To prevent +repainting problems, this style should be set before the toolbar control becomes visible. + +TBSTYLE_LIST +Version 4.70. Creates a flat toolbar with button text to the right of the bitmap. Otherwise, +this style is identical to TBSTYLE_FLAT. To prevent repainting problems, this style should be set +before the toolbar control becomes visible. + +TBSTYLE_REGISTERDROP +Version 4.71. Generates TBN_GETOBJECT notification messages to request drop target objects +when the cursor passes over toolbar buttons. + +TBSTYLE_TOOLTIPS +Creates a ToolTip control that an application can use to display descriptive text for +the buttons in the toolbar. + +TBSTYLE_TRANSPARENT +Version 4.71. Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent +but the buttons are not. Button text appears under button bitmaps. To prevent repainting problems, +this style should be set before the toolbar control becomes visible. + +TBSTYLE_WRAPABLE +Creates a toolbar that can have multiple lines of buttons. Toolbar buttons can "wrap" to +the next line when the toolbar becomes too narrow to include all buttons on the same line. +When the toolbar is wrapped, the break will occur on either the rightmost separator or the rightmost +button if there are no separators on the bar. This style must be set to display a vertical toolbar +control when the toolbar is part of a vertical rebar control. This style cannot be combined with CCS_VERT. + + +BUTTONS +======= + +Note: A toolbar button can have a combination of the following styles. To specify a button style, +set the appropriate flags in the fsStyle member of the button s TBBUTTON structure. Not all styles +can be combined. +For Shell version 4.72 and earlier, both window and button style flags had the form TBSTYLE_XXX. +If you are compiling an application with version 4.72 or earlier of Commctrl.h, you must +use the TBSTYLE_XXX button style flags. For version 5.80 and later, all button styles have +the form BTNS_XXX. All of the TBSTYLE_XXX values have equivalent BTNS_XXX values, +with the same meaning and numerical value. For convenience, both forms are given in the following table. + + +BTNS_AUTOSIZE +Version 5.80. Specifies that the toolbar control should not assign the standard width to +the button. Instead, the button s width will be calculated based on the width of the text +plus the image of the button. Use the equivalent style flag, TBSTYLE_AUTOSIZE, +for version 4.72 and earlier. + +BTNS_BUTTON +Version 5.80. Creates a standard button. Use the equivalent style flag, TBSTYLE_BUTTON, +for version 4.72 and earlier. This flag is defined as 0, and should be used to signify that no +other flags are set. + +BTNS_CHECK +Version 5.80. Creates a dual-state push button that toggles between the pressed and nonpressed +states each time the user clicks it. The button has a different background color when it is in +the pressed state. Use the equivalent style flag, TBSTYLE_CHECK, for version 4.72 and earlier. + +BTNS_CHECKGROUP +Version 5.80. Creates a button that stays pressed until another button in the group is pressed, +similar to option buttons (also known as radio buttons). It is equivalent to combining +BTNS_CHECK and BTNS_GROUP. Use the equivalent style flag, TBSTYLE_CHECKGROUP, +for version 4.72 and earlier. + +BTNS_DROPDOWN +Version 5.80. Creates a drop-down style button that can display a list when the button is clicked. +Instead of the WM_COMMAND message used for normal buttons, drop-down buttons send a TBN_DROPDOWN +notification. An application can then have the notification handler display a list of options. +Use the equivalent style flag, TBSTYLE_DROPDOWN, for version 4.72 and earlier. +If the toolbar has the TBSTYLE_EX_DRAWDDARROWS extended style, drop-down buttons will have a +drop-down arrow displayed in a separate section to their right. If the arrow is clicked, +a TBN_DROPDOWN notification will be sent. If the associated button is clicked, a WM_COMMAND +message will be sent. + +BTNS_GROUP +Version 5.80. When combined with BTNS_CHECK, creates a button that stays pressed until another +button in the group is pressed. Use the equivalent style flag, TBSTYLE_GROUP, +for version 4.72 and earlier. + +BTNS_NOPREFIX +Version 5.80. Specifies that the button text will not have an accelerator prefix associated with it. +Use the equivalent style flag, TBSTYLE_NOPREFIX, for version 4.72 and earlier. + +BTNS_SEP +Version 5.80. Creates a separator, providing a small gap between button groups. A button that has +this style does not receive user input. Use the equivalent style flag, TBSTYLE_SEP, for version 4.72 +and earlier. + +BTNS_SHOWTEXT +Version 5.81. Specifies that button text should be displayed. All buttons can have text, +but only those buttons with the BTNS_SHOWTEXT button style will display it. This button style must +be used with the TBSTYLE_LIST style and the TBSTYLE_EX_MIXEDBUTTONS extended style. +If you set text for buttons that do not have the BTNS_SHOWTEXT style, the toolbar control will +automatically display it as a ToolTip when the cursor hovers over the button. This feature allows +your application to avoid handling the TBN_GETINFOTIP or TTN_GETDISPINFO notification for the toolbar. + +BTNS_WHOLEDROPDOWN +Version 5.80. Specifies that the button will have a drop-down arrow, but not as a separate section. +Buttons with this style behave the same, regardless of whether the TBSTYLE_EX_DRAWDDARROWS extended +style is set. + +TBSTYLE_AUTOSIZE +Equivalent to BTNS_AUTOSIZE. Use TBSTYLE_AUTOSIZE for version 4.72 and earlier. + +TBSTYLE_BUTTON +Equivalent to BTNS_BUTTON. Use TBSTYLE_BUTTON for version 4.72 and earlier. + +TBSTYLE_CHECK +Equivalent to BTNS_CHECK. Use TBSTYLE_CHECK for version 4.72 and earlier. + +TBSTYLE_CHECKGROUP +Equivalent to BTNS_CHECKGROUP. Use TBSTYLE_CHECKGROUP for version 4.72 and earlier. + +TBSTYLE_DROPDOWN +Equivalent to BTNS_DROPDOWN. Use TBSTYLE_DROPDOWN for version 4.72 and earlier. + +TBSTYLE_GROUP +Equivalent to BTNS_GROUP. Use TBSTYLE_GROUP for version 4.72 and earlier. + +TBSTYLE_NOPREFIX +Equivalent to BTNS_NOPREFIX. Use TBSTYLE_NOPREFIX for version 4.72 and earlier. + +TBSTYLE_SEP +Equivalent to BTNS_SEP. Use TBSTYLE_SEP for version 4.72 and earlier. + +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgtreev.prg b/harbour/contrib/gtwvg/wvgtreev.prg new file mode 100644 index 0000000000..d746337f7f --- /dev/null +++ b/harbour/contrib/gtwvg/wvgtreev.prg @@ -0,0 +1,1021 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * 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++ xbpTreeView compatible Class +// +// Pritpal Bedi +// 26Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' + +//----------------------------------------------------------------------// + +CLASS WvgTreeView INHERIT WvgWindow + + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeView + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD + ::className := 'BUTTON' + ::objType := objTypePushButton + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeView + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::visible + ::style += WS_VISIBLE + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + IF ::visible + ::show() + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTreeView + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgTreeView + + RETURN NIL + +//----------------------------------------------------------------------// +// Class WvtTreeViewItem +//----------------------------------------------------------------------// +CLASS WvtTreeViewItem + + DATA className + DATA objType + + METHOD new() + METHOD create() + METHOD configure() + METHOD destroy() + + ENDCLASS +//----------------------------------------------------------------------// + +METHOD new( /*oParent, oOwner, aPos, aSize, aPresParams, lVisible*/ ) CLASS WvtTreeViewItem + + ::className := 'TREEVIEWITEM' + ::objType := objTypeTreeViewItem + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( /*oParent, oOwner, aPos, aSize, aPresParams, lVisible */) CLASS WvtTreeViewItem + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure(/* oParent, oOwner, aPos, aSize, aPresParams, lVisible */) CLASS WvtTreeViewItem + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvtTreeViewItem + + RETURN NIL + +//----------------------------------------------------------------------// +// MSDN on StatusBar Control +//----------------------------------------------------------------------// +#if 0 + +Macros +TreeView_CreateDragImage +Creates a dragging bitmap for the specified item in a tree-view control. The macro also creates +an image list for the bitmap and adds the bitmap to the image list. An application can display +the image when dragging the item by using the image list functions. You can use this macro or send +the TVM_CREATEDRAGIMAGE message explicitly. + +TreeView_DeleteAllItems +Deletes all items from a tree-view control. + +TreeView_DeleteItem +Removes an item and all its children from a tree-view control. You can also send the +TVM_DELETEITEM message explicitly. + +TreeView_EditLabel +Begins in-place editing of the specified item s text, replacing the text of the item with a +single-line edit control containing the text. This macro implicitly selects and focuses the +specified item. You can use this macro or send the TVM_EDITLABEL message explicitly. + +TreeView_EndEditLabelNow +Ends the editing of a tree-view item s label. You can use this macro or send the +TVM_ENDEDITLABELNOW message explicitly. + +TreeView_EnsureVisible +Ensures that a tree-view item is visible, expanding the parent item or scrolling the tree-view control, if necessary. You can use this macro or send the TVM_ENSUREVISIBLE message explicitly. + +TreeView_Expand +The TreeView_Expand macro expands or collapses the list of child items associated with the +specified parent item, if any. You can use this macro or send the TVM_EXPAND message explicitly. + +TreeView_GetBkColor +Retrieves the current background color of the control. You can use this macro or send the +TVM_GETBKCOLOR message explicitly. + +TreeView_GetCheckState +Gets the check state of the specified item. You can also use the TVM_GETITEMSTATE message directly. + +TreeView_GetChild +Retrieves the first child item of the specified tree-view item. You can use this macro, or +you can explicitly send the TVM_GETNEXTITEM message with the TVGN_CHILD flag. + +TreeView_GetCount +Retrieves a count of the items in a tree-view control. You can use this macro or send the +TVM_GETCOUNT message explicitly. + +TreeView_GetDropHilight +Retrieves the tree-view item that is the target of a drag-and-drop operation. You can use +this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_DROPHILITE flag. + +TreeView_GetEditControl +Retrieves the handle to the edit control being used to edit a tree-view item s text. +You can use this macro or send the TVM_GETEDITCONTROL message explicitly. + +TreeView_GetExtendedStyle +Retrieves the extended style for a specified tree-view control. Use this macro or send the +TVM_GETEXTENDEDSTYLE message explicitly. + +TreeView_GetFirstVisible +Retrieves the first visible item in a tree-view control window. You can use this macro, +or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_FIRSTVISIBLE flag. + +TreeView_GetImageList +Retrieves the handle to the normal or state image list associated with a tree-view control. +You can use this macro or send the TVM_GETIMAGELIST message explicitly. + +TreeView_GetIndent +Retrieves the amount, in pixels, that child items are indented relative to their parent items. +You can use this macro or send the TVM_GETINDENT message explicitly. + +TreeView_GetInsertMarkColor +Retrieves the color used to draw the insertion mark for the tree view. +You can use this macro or send the TVM_GETINSERTMARKCOLOR message explicitly. + +TreeView_GetISearchString +Retrieves the incremental search string for a tree-view control. +The tree-view control uses the incremental search string to select an item based on characters +typed by the user. You can use this macro or send the TVM_GETISEARCHSTRING message explicitly. + +TreeView_GetItem +Retrieves some or all of a tree-view item s attributes. +You can use this macro or send the TVM_GETITEM message explicitly. + +TreeView_GetItemHeight +Retrieves the current height of the tree-view items. +You can use this macro or send the TVM_GETITEMHEIGHT message explicitly. + +TreeView_GetItemPartRect +Retrieves the largest possible bounding rectangle that constitutes the "hit zone" +for a specified part of an item. Use this macro or send the TVM_GETITEMPARTRECT message explicitly. + +TreeView_GetItemRect +Retrieves the bounding rectangle for a tree-view item and indicates whether the item is visible. +You can use this macro or send the TVM_GETITEMRECT message explicitly. + +TreeView_GetItemState +Retrieves some or all of a tree-view item s state attributes. +You can use this macro or send the TVM_GETITEMSTATE message explicitly. + +TreeView_GetLastVisible +Retrieves the last expanded item in a tree-view control. This does not retrieve the last item +visible in the tree-view window. You can use this macro, or +you can explicitly send the TVM_GETNEXTITEM message with the TVGN_LASTVISIBLE flag. + +TreeView_GetLineColor +Gets the current line color. You can also use the TVM_GETLINECOLOR message directly. + +TreeView_GetNextItem +Retrieves the tree-view item that bears the specified relationship to a specified item. +You can use this macro, use one of the TreeView_Get macros described below, +or send the TVM_GETNEXTITEM message explicitly. + +TreeView_GetNextSelected +Retrieves the tree-view item that bears the TVGN_NEXTSELECTED relationship to a specified tree item. + +TreeView_GetNextSibling +Retrieves the next sibling item of a specified item in a tree-view control. +You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_NEXT flag. + +TreeView_GetNextVisible +Retrieves the next visible item that follows a specified item in a tree-view control. +You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_NEXTVISIBLE flag. + +TreeView_GetParent +Retrieves the parent item of the specified tree-view item. You can use this macro, +or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_PARENT flag. + +TreeView_GetPrevSibling +Retrieves the previous sibling item of a specified item in a tree-view control. +You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_PREVIOUS flag. + +TreeView_GetPrevVisible +Retrieves the first visible item that precedes a specified item in a tree-view control. +You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_PREVIOUSVISIBLE flag. + +TreeView_GetRoot +Retrieves the topmost or very first item of the tree-view control. You can use this macro, or +you can explicitly send the TVM_GETNEXTITEM message with the TVGN_ROOT flag. + +TreeView_GetScrollTime +Retrieves the maximum scroll time for the tree-view control. +You can use this macro or send the TVM_GETSCROLLTIME message explicitly. + +TreeView_GetSelectedCount +Not implemented. + +TreeView_GetSelection +Retrieves the currently selected item in a tree-view control. +You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_CARET flag. + +TreeView_GetTextColor +Retrieves the current text color of the control. +You can use this macro or send the TVM_GETTEXTCOLOR message explicitly. + +TreeView_GetToolTips +Retrieves the handle to the child ToolTip control used by a tree-view control. +You can use this macro or send the TVM_GETTOOLTIPS message explicitly. + +TreeView_GetUnicodeFormat +Retrieves the Unicode character format flag for the control. +You can use this macro or send the TVM_GETUNICODEFORMAT message explicitly. + +TreeView_GetVisibleCount +Obtains the number of items that can be fully visible in the client window of a tree-view control. +You can use this macro or send the TVM_GETVISIBLECOUNT message explicitly. + +TreeView_HitTest +Determines the location of the specified point relative to the client area of a tree-view control. +You can use this macro or send the TVM_HITTEST message explicitly. + +TreeView_InsertItem +Inserts a new item in a tree-view control. +You can use this macro or send the TVM_INSERTITEM message explicitly. + +TreeView_MapAccIDToHTREEITEM +Maps an accessibility ID to an HTREEITEM. +You can use this macro or send the TVM_MAPACCIDTOHTREEITEM message explicitly. + +TreeView_MapHTREEITEMtoAccID +Maps an HTREEITEM to an accessibility ID. +You can use this macro or send the TVM_MAPHTREEITEMTOACCID message explicitly. + +TreeView_Select +Selects the specified tree-view item, scrolls the item into view, or redraws the item in the +style used to indicate the target of a drag-and-drop operation. +You can use this macro or the TreeView_SelectItem, TreeView_SelectSetFirstVisible, or TreeView_SelectDropTarget macros, or you can send the TVM_SELECTITEM message explicitly. + +TreeView_SelectDropTarget +Redraws a specified tree-view control item in the style used to indicate the target of a +drag-and-drop operation. You can use this macro or the TreeView_Select macro, +or you can send the TVM_SELECTITEM message explicitly. + +TreeView_SelectItem +Selects the specified tree-view item. +You can use this macro or the TreeView_Select macro, or you can send the TVM_SELECTITEM message explicitly. + +TreeView_SelectSetFirstVisible +Scrolls the tree-view control vertically to ensure that the specified item is visible. +If possible, the specified item becomes the first visible item at the top of the control s window. +You can use this macro or the TreeView_Select macro, or you can send the TVM_SELECTITEM message explicitly. + +TreeView_SetAutoScrollInfo +Sets information used to determine auto-scroll characteristics. +Use this macro or send the TVM_SETAUTOSCROLLINFO message explicitly. + +TreeView_SetBkColor +Sets the background color of the control. +You can use this macro or send the TVM_SETBKCOLOR message explicitly. + +TreeView_SetCheckState +Sets the item s state image to "checked" or "unchecked." +You can also use the TVM_SETITEM message directly. + +TreeView_SetExtendedStyle +Sets the extended style for a specified TreeView control. +Use this macro or send the TVM_SETEXTENDEDSTYLE message explicitly. + +TreeView_SetImageList +Sets the normal or state image list for a tree-view control and redraws the control using the new images. +You can use this macro or send the TVM_SETIMAGELIST message explicitly. + +TreeView_SetIndent +Sets the width of indentation for a tree-view control and redraws the control to reflect the new width. +You can use this macro or send the TVM_SETINDENT message explicitly. + +TreeView_SetInsertMark +Sets the insertion mark in a tree-view control. +You can use this macro or send the TVM_SETINSERTMARK message explicitly. + +TreeView_SetInsertMarkColor +Sets the color used to draw the insertion mark for the tree view. +You can use this macro or send the TVM_SETINSERTMARKCOLOR message explicitly. + +TreeView_SetItem +The TreeView_SetItem macro sets some or all of a tree-view item s attributes. +You can use this macro or send the TVM_SETITEM message explicitly. + +TreeView_SetItemHeight +Sets the height of the tree-view items. +You can use this macro or send the TVM_SETITEMHEIGHT message explicitly. + +TreeView_SetItemState +Sets a tree-view item s state attributes. +You can use this macro or send the TVM_SETITEM message explicitly. + +TreeView_SetLineColor +Sets the current line color. You can also use the TVM_SETLINECOLOR message directly. + +TreeView_SetScrollTime +Sets the maximum scroll time for the tree-view control. +You can use this macro or send the TVM_SETSCROLLTIME message explicitly. + +TreeView_SetTextColor +Sets the text color of the control. You can use this macro or send the TVM_SETTEXTCOLOR message explicitly. + +TreeView_SetToolTips +Sets a tree-view control s child ToolTip control. +You can use this macro or send the TVM_SETTOOLTIPS message explicitly. + +TreeView_SetUnicodeFormat +Sets the Unicode character format flag for the control. +This message allows you to change the character set used by the control at run time rather +than having to re-create the control. You can use this macro or send the TVM_SETUNICODEFORMAT message explicitly. + +TreeView_ShowInfoTip +Shows the infotip for a specified item in a tree-view control. +Use this macro or send the TVM_SHOWINFOTIP message explicitly. + +TreeView_SortChildren +Sorts the child items of the specified parent item in a tree-view control. +You can use this macro or send the TVM_SORTCHILDREN message explicitly. + +TreeView_SortChildrenCB +Sorts tree-view items using an application-defined callback function that compares the items. +You can use this macro or send the TVM_SORTCHILDRENCB message explicitly. + + + +Messages +======== + +TVM_CREATEDRAGIMAGE +Creates a dragging bitmap for the specified item in a tree-view control. +The message also creates an image list for the bitmap and adds the bitmap to the image list. +An application can display the image when dragging the item by using the image list functions. +You can send this message explicitly or by using the TreeView_CreateDragImage macro. + +TVM_DELETEITEM +Removes an item and all its children from a tree-view control. +You can send this message explicitly or by using the TreeView_DeleteItem macro. + +TVM_EDITLABEL +Begins in-place editing of the specified item s text, replacing the text of the item with a +single-line edit control containing the text. This message implicitly selects and focuses the specified +item. You can send this message explicitly or by using the TreeView_EditLabel macro. + +TVM_ENDEDITLABELNOW +Ends the editing of a tree-view item s label. +You can send this message explicitly or by using the TreeView_EndEditLabelNow macro. + +TVM_ENSUREVISIBLE +Ensures that a tree-view item is visible, expanding the parent item or scrolling the tree-view control, +if necessary. You can send this message explicitly or by using the TreeView_EnsureVisible macro. + +TVM_EXPAND +The TVM_EXPAND message expands or collapses the list of child items associated with the +specified parent item, if any. You can send this message explicitly or by using the TreeView_Expand macro. + +TVM_GETBKCOLOR +Retrieves the current background color of the control. +You can send this message explicitly or by using the TreeView_GetBkColor macro. + +TVM_GETCOUNT +Retrieves a count of the items in a tree-view control. +You can send this message explicitly or by using the TreeView_GetCount macro. + +TVM_GETEDITCONTROL +Retrieves the handle to the edit control being used to edit a tree-view item s text. +You can send this message explicitly or by using the TreeView_GetEditControl macro. + +TVM_GETEXTENDEDSTYLE +Retrieves the extended style for a tree-view control. +Send this message explicitly or by using the TreeView_GetExtendedStyle macro. + +TVM_GETIMAGELIST +Retrieves the handle to the normal or state image list associated with a tree-view control. +You can send this message explicitly or by using the TreeView_GetImageList macro. + +TVM_GETINDENT +Retrieves the amount, in pixels, that child items are indented relative to their parent items. +You can send this message explicitly or by using the TreeView_GetIndent macro. + +TVM_GETINSERTMARKCOLOR +Retrieves the color used to draw the insertion mark for the tree view. +You can send this message explicitly or by using the TreeView_GetInsertMarkColor macro. + +TVM_GETISEARCHSTRING +Retrieves the incremental search string for a tree-view control. The tree-view control uses the +incremental search string to select an item based on characters typed by the user. +You can send this message explicitly or by using the TreeView_GetISearchString macro. + +TVM_GETITEM +Retrieves some or all of a tree-view item s attributes. +You can send this message explicitly or by using the TreeView_GetItem macro. + +TVM_GETITEMHEIGHT +Retrieves the current height of the each tree-view item. +You can send this message explicitly or by using the TreeView_GetItemHeight macro. + +TVM_GETITEMPARTRECT +Not implemented. + +TVM_GETITEMRECT +Retrieves the bounding rectangle for a tree-view item and indicates whether the item is visible. You can send this message explicitly or by using the TreeView_GetItemRect macro. + +TVM_GETITEMSTATE +Retrieves some or all of a tree-view item s state attributes. You can send this message explicitly or by using the TreeView_GetItemState macro. + +TVM_GETLINECOLOR +The TVM_GETLINECOLOR message gets the current line color. + +TVM_GETNEXTITEM +Retrieves the tree-view item that bears the specified relationship to a specified item. +You can send this message explicitly, by using the TreeView_GetNextItem macro. + +TVM_GETSCROLLTIME +Retrieves the maximum scroll time for the tree-view control. +You can send this message explicitly or by using the TreeView_GetScrollTime macro. + +TVM_GETSELECTEDCOUNT +Not implemented. + +TVM_GETTEXTCOLOR +Retrieves the current text color of the control. +You can send this message explicitly or by using the TreeView_GetTextColor macro. + +TVM_GETTOOLTIPS +Retrieves the handle to the child ToolTip control used by a tree-view control. +You can send this message explicitly or by using the TreeView_GetToolTips macro. + +TVM_GETUNICODEFORMAT +Retrieves the Unicode character format flag for the control. +You can send this message explicitly or use the TreeView_GetUnicodeFormat macro. + +TVM_GETVISIBLECOUNT +Obtains the number of items that can be fully visible in the client window of a tree-view control. +You can send this message explicitly or by using the TreeView_GetVisibleCount macro. + +TVM_HITTEST +Determines the location of the specified point relative to the client area of a tree-view control. +You can send this message explicitly or by using the TreeView_HitTest macro. + +TVM_INSERTITEM +Inserts a new item in a tree-view control. +You can send this message explicitly or by using the TreeView_InsertItem macro. + +TVM_MAPACCIDTOHTREEITEM +Maps an accessibility ID to an HTREEITEM. + +TVM_MAPHTREEITEMTOACCID +Maps an HTREEITEM to an accessibility ID. + +TVM_SELECTITEM +Selects the specified tree-view item, scrolls the item into view, or redraws the item in the +style used to indicate the target of a drag-and-drop operation. +You can send this message explicitly or by using the TreeView_Select, TreeView_SelectItem, or TreeView_SelectDropTarget macro. + +TVM_SETAUTOSCROLLINFO +Sets information used to determine auto-scroll characteristics. +You can send this message explicitly or by using the TreeView_SetAutoScrollInfo macro. + +TVM_SETBKCOLOR +Sets the background color of the control. +You can send this message explicitly or by using the TreeView_SetBkColor macro. + +TVM_SETEXTENDEDSTYLE +Informs the tree-view control to set extended styles. +Send this message or use the macro TreeView_SetExtendedStyle. + +TVM_SETIMAGELIST +Sets the normal or state image list for a tree-view control and redraws the control using the new images. +You can send this message explicitly or by using the TreeView_SetImageList macro. + +TVM_SETINDENT +Sets the width of indentation for a tree-view control and redraws the control to reflect the new width. +You can send this message explicitly or by using the TreeView_SetIndent macro. + +TVM_SETINSERTMARK +Sets the insertion mark in a tree-view control. +You can send this message explicitly or by using the TreeView_SetInsertMark macro. + +TVM_SETINSERTMARKCOLOR +Sets the color used to draw the insertion mark for the tree view. +You can send this message explicitly or by using the TreeView_SetInsertMarkColor macro. + +TVM_SETITEM +The TVM_SETITEM message sets some or all of a tree-view item s attributes. +You can send this message explicitly or by using the TreeView_SetItem macro. + +TVM_SETITEMHEIGHT +Sets the height of the tree-view items. +You can send this message explicitly or by using the TreeView_SetItemHeight macro. + +TVM_SETLINECOLOR +The TVM_SETLINECOLOR message sets the current line color. + +TVM_SETSCROLLTIME +Sets the maximum scroll time for the tree-view control. +You can send this message explicitly or by using the TreeView_SetScrollTime macro. + +TVM_SETTEXTCOLOR +Sets the text color of the control. +You can send this message explicitly or by using the TreeView_SetTextColor macro. + +TVM_SETTOOLTIPS +Sets a tree-view control s child ToolTip control. +You can send this message explicitly or by using the TreeView_SetToolTips macro. + +TVM_SETUNICODEFORMAT +Sets the Unicode character format flag for the control. +This message allows you to change the character set used by the control at run time rather than +having to re-create the control. +You can send this message explicitly or use the TreeView_SetUnicodeFormat macro. + +TVM_SHOWINFOTIP +Shows the infotip for a specified item in a tree-view control. +You can send this message explicitly or by using the TreeView_ShowInfoTip macro.. + +TVM_SORTCHILDREN +Sorts the child items of the specified parent item in a tree-view control. +You can send this message explicitly or by using the TreeView_SortChildren macro. + +TVM_SORTCHILDRENCB +Sorts tree-view items using an application-defined callback function that compares the items. +You can send this message explicitly or by using the TreeView_SortChildrenCB macro. + + + +Notifications +============= + +NM_CLICK (tree view) +Notifies the parent window of a tree-view control that the user has clicked the left mouse +button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_CUSTOMDRAW (tree view) +Sent by a tree-view control to notify its parent window about drawing operations. +This notification is sent in the form of a WM_NOTIFY message. + +NM_DBLCLK (tree view) +Notifies the parent window of a tree-view control that the user has double-clicked the left mouse +button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_KILLFOCUS (tree view) +Notifies a tree-view control s parent window that the control has lost the input focus. +This notification is sent in the form of a WM_NOTIFY message. + +NM_RCLICK (tree view) +Notifies the parent window of a tree-view control that the user has clicked the right mouse +button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_RDBLCLK (tree view) +Notifies the parent of a tree-view control that the user has double-clicked the right mouse +button within the control. This notification is sent in the form of a WM_NOTIFY message. + +NM_RETURN (tree view) +Notifies a tree-view control s parent window that the control has the input focus and that the user +has pressed the key. This notification is sent in the form of a WM_NOTIFY message. + +NM_SETCURSOR (tree view) +Notifies a tree-view control s parent window that the control is setting the cursor in response +to a WM_SETCURSOR message. This notification is sent in the form of a WM_NOTIFY message. + +NM_SETFOCUS (tree view) +Notifies a tree-view control s parent window that the control has received the input focus. +This notification is sent in the form of a WM_NOTIFY message. + +TVN_ASYNCDRAW +Sent by a tree-view control to its parent when the drawing of a icon or overlay has failed. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_BEGINDRAG +Notifies a tree-view control s parent window that a drag-and-drop operation involving the left mouse +button is being initiated. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_BEGINLABELEDIT +Notifies a tree-view control s parent window about the start of label editing for an item. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_BEGINRDRAG +Notifies a tree-view control s parent window about the initiation of a drag-and-drop operation +involving the right mouse button. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_DELETEITEM +Notifies a tree-view control s parent window that an item is being deleted. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_ENDLABELEDIT +Notifies a tree-view control s parent window about the end of label editing for an item. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_GETDISPINFO +Requests that a tree-view control s parent window provide information needed to display or sort an item. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_GETINFOTIP +Sent by a tree-view control that has the TVS_INFOTIP style. This notification is sent when the +control is requesting additional text information to be displayed in a ToolTip. +The notification is sent in the form of a WM_NOTIFY message. + +TVN_ITEMCHANGED +Notifies a tree-view control s parent window that item attributes have changed. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_ITEMCHANGING +Notifies a tree-view control s parent window that item attributes are about to change. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_ITEMEXPANDED +Notifies a tree-view control s parent window that a parent item s list of child items has expanded +or collapsed. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_ITEMEXPANDING +Notifies a tree-view control s parent window that a parent item s list of child items is about to +expand or collapse. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_KEYDOWN +Notifies a tree-view control s parent window that the user pressed a key and the tree-view control +has the input focus. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_SELCHANGED +Notifies a tree-view control s parent window that the selection has changed from one item to another. +This notification message is sent in the form of a WM_NOTIFY message. + +TVN_SELCHANGING +Notifies a tree-view control s parent window that the selection is about to change from one item +to another. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_SETDISPINFO +Notifies a tree-view control s parent window that it must update the information it maintains +about an item. This notification message is sent in the form of a WM_NOTIFY message. + +TVN_SINGLEEXPAND +Sent by a tree-view control with the TVS_SINGLEEXPAND style when the user opens or closes a +tree item using a single click of the mouse. This notification is sent in the form of a WM_NOTIFY message. + + + +Structures +========== + +NMTREEVIEW +Contains information about a tree-view notification message. This structure is identical to +the NM_TREEVIEW structure, but it has been renamed to follow current naming conventions. + +NMTVASYNCDRAW +Contains an explanation of why the draw of an icon or overlay tree item failed. +This structure is sent on a TVN_ASYNCDRAW notification. Set the dwRetFlags member to indicate +what action the control should take. Note that a draw can fail if there is no image; in other words, +when the icon image has not been extracted. + +NMTVCUSTOMDRAW +Contains information specific to an NM_CUSTOMDRAW (tree view) notification message +sent by a tree-view control. + +NMTVDISPINFO +Contains and receives display information for a tree-view item. This structure is identical +to the TV_DISPINFO structure, but it has been renamed to follow current naming conventions. + +NMTVDISPINFOEX +Contains information pertaining to extended TreeView notification information. + +NMTVGETINFOTIP +Contains and receives tree-view item information needed to display a ToolTip for an item. +This structure is used with the TVN_GETINFOTIP notification message. + +NMTVITEMCHANGE +Contains information on a tree-view item change. This structure is sent with the TVN_ITEMCHANGED +and TVN_ITEMCHANGING notifications. + +NMTVITEMRECT +Not currently supported. + +NMTVKEYDOWN +Contains information about a keyboard event in a tree-view control. This structure is used +with the TVN_KEYDOWN notification message. The structure is identical to the TV_KEYDOWN structure, + but it has been renamed to follow current naming conventions. + +NMTVSTATEIMAGECHANGING +Contains information about a tree-view state image changing notification message. + +TVGETITEMPARTRECTINFO +Contains information for identifying the "hit zone" for a specified part of a tree item. +The structure is used with the TVM_GETITEMPARTRECT message and the TreeView_GetItemPartRect macro. + +TVHITTESTINFO +Contains information used to determine the location of a point relative to a tree-view control. +This structure is used with the TVM_HITTEST message. The structure is identical to +the TV_HITTESTINFO structure, but it has been renamed to follow current naming conventions. + +TVINSERTSTRUCT +Contains information used to add a new item to a tree-view control. This structure is used with the +TVM_INSERTITEM message. The structure is identical to the TV_INSERTSTRUCT structure, +but it has been renamed to follow current naming conventions. + +TVITEM +Specifies or receives attributes of a tree-view item. This structure is identical to the +TV_ITEM structure, but it has been renamed to follow current naming conventions. +New applications should use this structure. + +TVITEMEX +Specifies or receives attributes of a tree-view item. This structure is an enhancement to the +TVITEM structure. New applications should use this structure where appropriate. + +TVSORTCB +Contains information used to sort child items in a tree-view control. This structure is used +with the TVM_SORTCHILDRENCB message. This structure is identical to the TV_SORTCB structure, + but it has been renamed to follow current naming conventions. + + + +Constants +========= + +Tree-View Control Extended Styles +This section lists extended styles used when creating tree-view controls. +The value of extended styles is a bitwise combination of these styles. + +Tree-View Control Item States +This section lists the item state flags used to indicate the state of an item in a tree-view control. + +Tree-View Control Window Styles +This section lists window styles used when creating tree-view controls. + + +Constants : Tree-View Control Extended Styles +============================================= + +TVS_EX_AUTOHSCROLL +Remove the horizontal scrollbar and auto-scroll depending on mouse position. + +TVS_EX_DIMMEDCHECKBOXES +Include dimmed checkbox state if the control has the TVS_CHECKBOXES style. + +TVS_EX_DOUBLEBUFFER +Specifies how the background is erased or filled. + +TVS_EX_DRAWIMAGEASYNC +Retrieves calendar grid information. + +TVS_EX_EXCLUSIONCHECKBOXES +Include exclusion checkbox state if the control has the TVS_CHECKBOXES style. + +TVS_EX_FADEINOUTEXPANDOS +Fade expando buttons in or out when the mouse moves away or into a state of hovering over the control. + +TVS_EX_MULTISELECT +Not supported. Do not use. + +TVS_EX_NOINDENTSTATE +Do not indent the tree view for the expando buttons. + +TVS_EX_PARTIALCHECKBOXES +Include partial checkbox state if the control has the TVS_CHECKBOXES style. + +TVS_EX_RICHTOOLTIP +Allow rich tooltips in the tree view (custom drawn with icon and text). + + +Constants : Tree-View Control Item States +========================================= + +TVIS_BOLD +The item is bold. + +TVIS_CUT +The item is selected as part of a cut-and-paste operation. + +TVIS_DROPHILITED +The item is selected as a drag-and-drop target. + +TVIS_EXPANDED +The item s list of child items is currently expanded; that is, the child items are visible. +This value applies only to parent items. + +TVIS_EXPANDEDONCE +The item s list of child items has been expanded at least once. The TVN_ITEMEXPANDING and +TVN_ITEMEXPANDED notification messages are not generated for parent items that have this +state set in response to a TVM_EXPAND message. Using TVE_COLLAPSE and TVE_COLLAPSERESET +with TVM_EXPAND will cause this state to be reset. This value applies only to parent items. + +TVIS_EXPANDPARTIAL +Version 4.70. A partially expanded tree-view item. In this state, some, but not all, +of the child items are visible and the parent item s plus symbol is displayed. + +TVIS_SELECTED +The item is selected. Its appearance depends on whether it has the focus. +The item will be drawn using the system colors for selection. + +Note: +When you set or retrieve an item s overlay image index or state image index, +you must specify the following masks in the stateMask member of the TVITEM structure. +These values can also be used to mask off the state bits that are not of interest. + +TVIS_OVERLAYMASK +Mask for the bits used to specify the item s overlay image index. + +TVIS_STATEIMAGEMASK +Mask for the bits used to specify the item s state image index. + +TVIS_USERMASK +Same as TVIS_STATEIMAGEMASK. + + +Constants : Tree-View Control Window Styles +=========================================== + +TVS_CHECKBOXES +Version 4.70. Enables check boxes for items in a tree-view control. A check box is displayed +only if an image is associated with the item. When set to this style, the control effectively +uses DrawFrameControl to create and set a state image list containing two images. State image 1 +is the unchecked box and state image 2 is the checked box. Setting the state image to zero removes +the check box altogether. For more information, see Working with state image indexes. +Version 5.80. Displays a check box even if no image is associated with the item. +Once a tree-view control is created with this style, the style cannot be removed. +Instead, you must destroy the control and create a new one in its place. Destroying the +tree-view control does not destroy the check box state image list. You must destroy it explicitly. +Get the handle to the state image list by sending the tree-view control a TVM_GETIMAGELIST message. +Then destroy the image list with ImageList_Destroy. + +If you want to use this style, you must set the TVS_CHECKBOXES style with SetWindowLong +after you create the treeview control, and before you populate the tree. Otherwise, +the checkboxes might appear unchecked, depending on timing issues. + + +TVS_DISABLEDRAGDROP +Prevents the tree-view control from sending TVN_BEGINDRAG notification messages. + +TVS_EDITLABELS +Allows the user to edit the labels of tree-view items. + +TVS_FULLROWSELECT +Version 4.71. Enables full-row selection in the tree view. The entire row of the selected item +is highlighted, and clicking anywhere on an item s row causes it to be selected. This style cannot +be used in conjunction with the TVS_HASLINES style. + +TVS_HASBUTTONS +Displays plus (+) and minus (-) buttons next to parent items. The user clicks the buttons to +expand or collapse a parent item s list of child items. To include buttons with items at the +root of the tree view, TVS_LINESATROOT must also be specified. + +TVS_HASLINES +Uses lines to show the hierarchy of items. + +TVS_INFOTIP +Version 4.71. Obtains ToolTip information by sending the TVN_GETINFOTIP notification. + +TVS_LINESATROOT +Uses lines to link items at the root of the tree-view control. This value is ignored +if TVS_HASLINES is not also specified. + +TVS_NOHSCROLL +Version 5.80. Disables horizontal scrolling in the control. The control will not display +any horizontal scroll bars. + +TVS_NONEVENHEIGHT +Version 4.71 Sets the height of the items to an odd height with the TVM_SETITEMHEIGHT message. +By default, the height of items must be an even value. + +TVS_NOSCROLL +Version 4.71. Disables both horizontal and vertical scrolling in the control. +The control will not display any scroll bars. + +TVS_NOTOOLTIPS +Version 4.70. Disables ToolTips. + +TVS_RTLREADING +Version 4.70. Causes text to be displayed from right-to-left (RTL). +Usually, windows display text left-to-right (LTR). Windows can be mirrored to display +languages such as Hebrew or Arabic that read RTL. Typically, tree-view text is displayed +in the same direction as the text in its parent window. if TVS_RTLREADING is set, tree-view text +reads in the opposite direction from the text in the parent window. + +TVS_SHOWSELALWAYS +Causes a selected item to remain selected when the tree-view control loses focus. + +TVS_SINGLEEXPAND +Version 4.71. Causes the item being selected to expand and the item being unselected to +collapse upon selection in the tree view. If the mouse is used to single-click the selected item and +that item is closed, it will be expanded. If the user holds down the CTRL key while selecting an item, +the item being unselected will not be collapsed. +Version 5.80. Causes the item being selected to expand and the item being unselected to +collapse upon selection in the tree view. If the user holds down the CTRL key while selecting an item, +the item being unselected will not be collapsed. + + +TVS_TRACKSELECT +Version 4.70. Enables hot tracking in a tree-view control. + +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index 77cbeb12f8..93d462b8e9 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -735,38 +735,75 @@ HB_FUNC( WVT_CREATEPOPUPMENU ) HB_FUNC( WVT_APPENDMENU ) { - char ucBuf[ 256 ]; - int i,iLen ; - LPCTSTR lpszCaption; + #if 0 + char ucBuf[ 256 ]; + int i,iLen; + LPTSTR lpszCaption; - if ( ISCHAR( 4 ) ) - { - iLen = hb_parclen( 4 ); - if ( iLen > 0 && iLen < 256 ) // Translate '~' to '&' - { - //lpszCaption = hb_parc( 4 ) ; - lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) ); - for ( i = 0; i < iLen; i++ ) - { - ucBuf[ i ] = ( *lpszCaption == '~' ) ? '&' : ( char ) *lpszCaption; - lpszCaption++; - } - ucBuf[ iLen ]= '\0'; - //lpszCaption = ucBuf ; - lpszCaption = HB_TCHAR_CONVTO( ucBuf ); - } - else - { - //lpszCaption = hb_parc( 4 ) ; + if ( ISCHAR( 4 ) ) + { + iLen = hb_parclen( 4 ); + if ( iLen > 0 && iLen < 256 ) // Translate '~' to '&' + { lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) ); - } - } - else - { - lpszCaption = ( LPCTSTR ) ( HB_PTRDIFF ) hb_parnint( 4 ) ; // It is a SEPARATOR or Submenu - } + for ( i = 0; i < iLen; i++ ) + { + ucBuf[ i ] = ( *lpszCaption == '~' ) ? '&' : ( char ) *lpszCaption; + lpszCaption++; + } + ucBuf[ iLen ]= '\0'; - hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + lpszCaption = HB_TCHAR_CONVTO( ucBuf ); + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + HB_TCHAR_FREE( lpszCaption ); + } + else + { + lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + HB_TCHAR_FREE( lpszCaption ); + } + } + else + { + lpszCaption = ( LPTSTR ) ( HB_PTRDIFF ) hb_parnint( 4 ) ; // It is a SEPARATOR or Submenu + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + } + #endif + + LPTSTR buffer; + int i,iLen ; + + if ( ISCHAR( 4 ) ) + { + iLen = hb_parclen( 4 ); + if ( iLen > 0 && iLen < 256 ) // Translate '~' to '&' + { + LPTSTR pDest; + + buffer = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + pDest = buffer; + for ( i = 0; i < iLen; i++ ) + { + pDest[ i ] = ( *buffer == '~' ) ? '&' : ( char ) *buffer; + buffer++; + } + buffer = pDest; + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), buffer ) ) ; + HB_TCHAR_FREE( buffer ); + } + else + { + buffer = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), buffer ) ) ; + HB_TCHAR_FREE( buffer ); + } + } + else + { // It is a SEPARATOR or Submenu + LPCTSTR lpszCaption = ( LPCTSTR ) ( HB_PTRDIFF ) hb_parnint( 4 ) ; + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + } } //-------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 6e40cf347f..061dc23e8c 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -78,6 +78,16 @@ #include "gtwvg.h" +#define WIN_STATUSBAR_MAX_PARTS 256 + +//----------------------------------------------------------------------// + +#if defined(__BORLANDC__) && !defined(HB_ARCH_64BIT) + #undef MAKELONG + #define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | \ + (((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))) +#endif + //----------------------------------------------------------------------// static HANDLE wvg_hInstance( void ) @@ -303,11 +313,11 @@ HB_FUNC( WIN_GETDLGITEM ) HB_FUNC( WIN_MESSAGEBOX ) { - HWND hWnd = ISNIL( 1 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ; + HWND hWnd = ISNIL( 1 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ; LPTSTR lpMsg = HB_TCHAR_CONVTO( ISNIL( 2 ) ? "" : hb_parc( 2 ) ); LPTSTR lpTitle = HB_TCHAR_CONVTO( ISNIL( 3 ) ? "Info" : hb_parc( 3 ) ); - hb_retni( MessageBox( hWnd, lpMsg, lpTitle, ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ) ; + hb_retni( MessageBox( hWnd, lpMsg, lpTitle, ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ); HB_TCHAR_FREE( lpTitle ); HB_TCHAR_FREE( lpMsg ); @@ -702,35 +712,39 @@ HB_FUNC( WIN_CREATEPOPUPMENU ) HB_FUNC( WIN_APPENDMENU ) { - char ucBuf[ 256 ]; - int i,iLen ; - LPCTSTR lpszCaption; + LPTSTR buffer; + int i,iLen ; - if ( ISCHAR( 4 ) ) - { - iLen = hb_parclen( 4 ); - if ( iLen > 0 && iLen < 256 ) // Translate '~' to '&' - { - lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) ); - for ( i = 0; i < iLen; i++ ) + if ( ISCHAR( 4 ) ) + { + iLen = hb_parclen( 4 ); + if ( iLen > 0 && iLen < 256 ) // Translate '~' to '&' { - ucBuf[ i ] = ( *lpszCaption == '~' ) ? '&' : ( char ) *lpszCaption; - lpszCaption++; - } - ucBuf[ iLen ]= '\0'; - lpszCaption = HB_TCHAR_CONVTO( ucBuf ); - } - else - { - lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) ); - } - } - else - { - lpszCaption = ( LPCTSTR ) ( HB_PTRDIFF ) hb_parnint( 4 ) ; // It is a SEPARATOR or Submenu - } + LPTSTR pDest; - hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + buffer = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + pDest = buffer; + for ( i = 0; i < iLen; i++ ) + { + pDest[ i ] = ( *buffer == '~' ) ? '&' : ( char ) *buffer; + buffer++; + } + buffer = pDest; + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), buffer ) ) ; + HB_TCHAR_FREE( buffer ); + } + else + { + buffer = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), buffer ) ) ; + HB_TCHAR_FREE( buffer ); + } + } + else + { // It is a SEPARATOR or Submenu + LPCTSTR lpszCaption = ( LPCTSTR ) ( HB_PTRDIFF ) hb_parnint( 4 ) ; + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ; + } } //-------------------------------------------------------------------// @@ -1209,3 +1223,145 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) } } //----------------------------------------------------------------------// + +HB_FUNC( WVG_STATUSBARCREATEPANEL ) +{ + HWND hWndSB = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ); + int iMode = hb_parni( 2 ); + + if ( hWndSB == NULL || !IsWindow( hWndSB ) ) + { + hb_retl( FALSE ); + return; + } + + switch( iMode ) + { + case 0: + { + int ptArray[ WIN_STATUSBAR_MAX_PARTS ]; + int iParts; + RECT rc = { 0 }; + int n ; + USHORT width; + + iParts = SendMessage( hWndSB, SB_GETPARTS, WIN_STATUSBAR_MAX_PARTS, ( LPARAM ) ( LPINT ) ptArray ); + + GetClientRect( hWndSB, &rc ); + width = rc.right / ( iParts + 1 ); + for( n = 0; n < iParts; n++ ) + { + ptArray[ n ] = ( width * ( n + 1 ) ); + } + ptArray[ iParts ] = -1; + + if( SendMessage( hWndSB, SB_SETPARTS, iParts + 1, ( LPARAM ) ( LPINT ) ptArray ) ) + { + hb_retl( TRUE ); + return; + } + } + case -1: + { + RECT rc = { 0 }; + int ptArray[ WIN_STATUSBAR_MAX_PARTS ]; + + if ( GetClientRect( hWndSB, &rc ) ) + { + ptArray[ 0 ] = rc.right; + + SendMessage( hWndSB, SB_SETPARTS, 1, ( LPARAM ) ( LPINT ) ptArray ); + + hb_retl( TRUE ); + return; + } + } + } + + hb_retl( FALSE ); +} + +//----------------------------------------------------------------------// + +HB_FUNC( WVG_STATUSBARSETTEXT ) +{ + HWND hWndSB = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ); + + if( hWndSB && IsWindow( hWndSB ) ) + { + int iPart = ISNIL( 2 ) ? 1 : hb_parni( 2 ); + TCHAR szText[ 1024 ]; + int iFlags; + TCHAR *szCaption; + + iPart -= 1; // Zero based + + iFlags = ( int ) HIWORD( SendMessage( hWndSB, SB_GETTEXT, ( WPARAM ) iPart, ( LPARAM ) szText ) ); + + szCaption = HB_TCHAR_CONVTO( hb_parc( 3 ) ); + SendMessage( hWndSB, SB_SETTEXT, ( WPARAM ) iPart | iFlags, ( LPARAM ) szCaption ); + HB_TCHAR_FREE( szCaption ); + } +} + +//----------------------------------------------------------------------// + +HB_FUNC( WVG_STATUSBARREFRESH ) +{ + #if 0 + HWND hWndSB = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ); + + if( hWndSB && IsWindow( hWndSB ) ) + { + int ptArray[ WIN_STATUSBAR_MAX_PARTS ]; + int iParts,i; + + iParts = SendMessage( hWndSB, SB_GETPARTS, WIN_STATUSBAR_MAX_PARTS, ( LPARAM ) ( LPINT ) ptArray ); + + ptArray[ iParts-1 ] = -1; + + if( SendMessage( hWndSB, SB_SETPARTS, iParts, ( LPARAM ) ( LPINT ) ptArray ) ) + { + hb_retl( TRUE ); + return; + } + } + hb_retl( FALSE ); + #endif +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_SENDMESSAGETEXT ) +{ + LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + + SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), + ( WPARAM ) hb_parni( 3 ), ( LPARAM ) lpBuffer ); + HB_TCHAR_FREE( lpBuffer ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETWNDPROC ) +{ + HWND hWnd = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ); + WNDPROC wndProc = ( WNDPROC ) ( HB_PTRDIFF ) hb_parnint( 2 ); + WNDPROC oldProc; + + oldProc = ( WNDPROC ) SetWindowLong( hWnd, GWL_WNDPROC, ( long ) wndProc ) ; + + hb_retnint( ( HB_PTRDIFF ) oldProc ); +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_DEFWINDOWPROC ) +{ + hb_retni( DefWindowProc( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), + hb_parni( 2 ), + ( WPARAM ) hb_parnint( 3 ), + ( LPARAM ) hb_parnint( 4 ) ) ); +} + +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg index a33a547465..df2d992dad 100644 --- a/harbour/contrib/gtwvg/wvgwnd.prg +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -67,10 +67,12 @@ #include 'hbclass.ch' #include 'common.ch' +#include 'inkey.ch' #include 'hbgtinfo.ch' + #include 'hbgtwvg.ch' #include 'wvtwin.ch' -#include 'inkey.ch' +#include 'wvgparts.ch' //----------------------------------------------------------------------// @@ -242,6 +244,8 @@ EXPORTED: METHOD createControl() METHOD getControlID() INLINE ++::nControlID + METHOD Initialize() + ENDCLASS //----------------------------------------------------------------------// @@ -264,20 +268,6 @@ METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWind ::WvgPartHandler:init( oParent, oOwner ) - #if 0 - if hb_isArray( aPos ) - ::aPos := aPos - endif - if hb_isArray( aSize ) - ::aSize := aSize - endif - if hb_isArray( aPresParams ) - ::aPresParams := aPresParams - endif - if hb_isLogical( lVisible ) - ::visible := lVisible - endif - #endif RETURN Self //----------------------------------------------------------------------// @@ -320,6 +310,18 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv METHOD destroy() CLASS WvgWindow + IF Len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| hb_toOutDebug( '< '+o:className+' >' ), o:destroy() } ) + ::aChildren := {} + ENDIF + + ::destroy() + + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ::hWnd := NIL + ENDIF + RETURN Self //----------------------------------------------------------------------// @@ -396,7 +398,9 @@ METHOD setPosAndSize( aPos, aSize, lPaint ) CLASS WvgWindow DEFAULT lPaint TO .T. switch ::objType + case objTypeDialog + case objTypeStatic case objTypeActiveX Win_MoveWindow( ::hWnd, aPos[ 1 ], aPos[ 2 ], aSize[ 1 ], aSize[ 2 ], lPaint ) exit @@ -419,6 +423,8 @@ METHOD setSize( aSize, lPaint ) CLASS WvgWindow DEFAULT lPaint TO .T. switch ::objType + + case objTypeStatic case objTypeDialog case objTypeActiveX Win_MoveWindow( ::hWnd, 0, 0, aSize[ 1 ], aSize[ 2 ], lPaint ) @@ -1045,6 +1051,26 @@ METHOD dragDrop( xParam, xParam1 ) CLASS WvgWindow //----------------------------------------------------------------------// +METHOD Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWindow + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::aSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + ::oParent := oParent + ::oOwner := oOwner + ::aPos := aPos + ::aSize := aSize + ::aPresParams := aPresParams + ::visible := lVisible + + RETURN Self + +//----------------------------------------------------------------------// + METHOD setFocus() CLASS WvgWindow ::sendMessage( WM_ACTIVATE, 1, 0 ) @@ -1060,13 +1086,12 @@ METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgWindow METHOD createControl() CLASS WvgWindow LOCAL hWnd + ::nID := ::oParent:GetControlId() + DO CASE CASE ::objType == objTypeToolBar - ::nID := ::oParent:GetControlId() - - #if 1 hWnd := Win_CreateToolBarEx( ::oParent:hWnd,; // hWnd - window handle hosting the toolbar ::style,; // ws - style of the toolbar ::nID,; // wID - control identifier supplied with WM_COMMAND @@ -1079,20 +1104,8 @@ METHOD createControl() CLASS WvgWindow ::buttonHeight,; ::imageWidth,; ::imageHeight ) - //Win_SendMessage( hWnd, TB_AUTOSIZE, 0, 0 ) - #else - hWnd := Win_CreateWindowEx( ::exStyle, ; - TOOLBARCLASSNAME, ; - NIL, ; // window name - ::style, ; - ::aPos[ 1 ], ::aPos[ 2 ],; - ::aSize[ 1 ], ::aSize[ 2 ],; - ::oParent:hWnd,; - NIL,; // hMenu - NIL,; // hInstance - NIL ) // lParam - #endif OTHERWISE + hWnd := Win_CreateWindowEx( ::exStyle, ; ::className, ; "", ; // window name @@ -1100,7 +1113,7 @@ METHOD createControl() CLASS WvgWindow ::aPos[ 1 ], ::aPos[ 2 ],; ::aSize[ 1 ], ::aSize[ 2 ],; ::oParent:hWnd,; - NIL,; // hMenu + ::nID,; // hMenu NIL,; // hInstance NIL ) // lParam ENDCASE diff --git a/harbour/contrib/gtwvg/wvtwin.ch b/harbour/contrib/gtwvg/wvtwin.ch index 1c7c297f0e..af4fcb4f67 100644 --- a/harbour/contrib/gtwvg/wvtwin.ch +++ b/harbour/contrib/gtwvg/wvtwin.ch @@ -57,6 +57,12 @@ // GTWVT Specific // //-------------------------------------------------------------------// + +#xtranslate MAKELONG(, ) => (() + () * 65536) +#xtranslate MAKELPARAM(, ) => (() + () * 65536) + +//----------------------------------------------------------------------// + // // Wvt_DrawButton() constants // @@ -1114,358 +1120,356 @@ /* * Window field offsets for GetWindowLong() */ -#define GWL_WNDPROC (-4) -#define GWL_HINSTANCE (-6) -#define GWL_HWNDPARENT (-8) -#define GWL_STYLE (-16) -#define GWL_EXSTYLE (-20) -#define GWL_USERDATA (-21) -#define GWL_ID (-12) +#define GWL_WNDPROC (-4) +#define GWL_HINSTANCE (-6) +#define GWL_HWNDPARENT (-8) +#define GWL_STYLE (-16) +#define GWL_EXSTYLE (-20) +#define GWL_USERDATA (-21) +#define GWL_ID (-12) -#define DWL_MSGRESULT 0 -#define DWL_DLGPROC 4 -#define DWL_USER 8 +#define DWL_MSGRESULT 0 +#define DWL_DLGPROC 4 +#define DWL_USER 8 //--------------------------------------------------------------------// /* * Virtual Key Codes */ -#define VK_LBUTTON 1 -#define VK_RBUTTON 2 -#define VK_CANCEL 3 -#define VK_MBUTTON 4 -#define VK_BACK 8 -#define VK_TAB 9 -#define VK_CLEAR 12 -#define VK_RETURN 13 -#define VK_SHIFT 16 -#define VK_CONTROL 17 -#define VK_MENU 18 -#define VK_PAUSE 19 -#define VK_CAPITAL 20 -#define VK_ESCAPE 27 -#define VK_SPACE 32 -#define VK_PRIOR 33 -#define VK_NEXT 34 -#define VK_END 35 -#define VK_HOME 36 -#define VK_LEFT 37 -#define VK_UP 38 -#define VK_RIGHT 39 -#define VK_DOWN 40 -#define VK_SELECT 41 -#define VK_PRINT 42 -#define VK_EXECUTE 43 -#define VK_SNAPSHOT 44 -#define VK_INSERT 45 -#define VK_DELETE 46 -#define VK_HELP 47 -#define VK_NUMPAD0 96 -#define VK_NUMPAD1 97 -#define VK_NUMPAD2 98 -#define VK_NUMPAD3 99 -#define VK_NUMPAD4 100 -#define VK_NUMPAD5 101 -#define VK_NUMPAD6 102 -#define VK_NUMPAD7 103 -#define VK_NUMPAD8 104 -#define VK_NUMPAD9 105 -#define VK_MULTIPLY 106 -#define VK_ADD 107 -#define VK_SEPARATOR 108 -#define VK_SUBTRACT 109 -#define VK_DECIMAL 110 -#define VK_DIVIDE 111 -#define VK_F1 112 -#define VK_F2 113 -#define VK_F3 114 -#define VK_F4 115 -#define VK_F5 116 -#define VK_F6 117 -#define VK_F7 118 -#define VK_F8 119 -#define VK_F9 120 -#define VK_F10 121 -#define VK_F11 122 -#define VK_F12 123 -#define VK_F13 124 -#define VK_F14 125 -#define VK_F15 126 -#define VK_F16 127 -#define VK_F17 128 -#define VK_F18 129 -#define VK_F19 130 -#define VK_F20 131 -#define VK_F21 132 -#define VK_F22 133 -#define VK_F23 134 -#define VK_F24 135 -#define VK_NUMLOCK 144 -#define VK_SCROLL 145 +#define VK_LBUTTON 1 +#define VK_RBUTTON 2 +#define VK_CANCEL 3 +#define VK_MBUTTON 4 +#define VK_BACK 8 +#define VK_TAB 9 +#define VK_CLEAR 12 +#define VK_RETURN 13 +#define VK_SHIFT 16 +#define VK_CONTROL 17 +#define VK_MENU 18 +#define VK_PAUSE 19 +#define VK_CAPITAL 20 +#define VK_ESCAPE 27 +#define VK_SPACE 32 +#define VK_PRIOR 33 +#define VK_NEXT 34 +#define VK_END 35 +#define VK_HOME 36 +#define VK_LEFT 37 +#define VK_UP 38 +#define VK_RIGHT 39 +#define VK_DOWN 40 +#define VK_SELECT 41 +#define VK_PRINT 42 +#define VK_EXECUTE 43 +#define VK_SNAPSHOT 44 +#define VK_INSERT 45 +#define VK_DELETE 46 +#define VK_HELP 47 +#define VK_NUMPAD0 96 +#define VK_NUMPAD1 97 +#define VK_NUMPAD2 98 +#define VK_NUMPAD3 99 +#define VK_NUMPAD4 100 +#define VK_NUMPAD5 101 +#define VK_NUMPAD6 102 +#define VK_NUMPAD7 103 +#define VK_NUMPAD8 104 +#define VK_NUMPAD9 105 +#define VK_MULTIPLY 106 +#define VK_ADD 107 +#define VK_SEPARATOR 108 +#define VK_SUBTRACT 109 +#define VK_DECIMAL 110 +#define VK_DIVIDE 111 +#define VK_F1 112 +#define VK_F2 113 +#define VK_F3 114 +#define VK_F4 115 +#define VK_F5 116 +#define VK_F6 117 +#define VK_F7 118 +#define VK_F8 119 +#define VK_F9 120 +#define VK_F10 121 +#define VK_F11 122 +#define VK_F12 123 +#define VK_F13 124 +#define VK_F14 125 +#define VK_F15 126 +#define VK_F16 127 +#define VK_F17 128 +#define VK_F18 129 +#define VK_F19 130 +#define VK_F20 131 +#define VK_F21 132 +#define VK_F22 133 +#define VK_F23 134 +#define VK_F24 135 +#define VK_NUMLOCK 144 +#define VK_SCROLL 145 //----------------------------------------------------------------------// /* * File Open/Save Dialog Constants */ -#define OFN_READONLY 1 -#define OFN_OVERWRITEPROMPT 2 -#define OFN_HIDEREADONLY 4 -#define OFN_NOCHANGEDIR 8 -#define OFN_SHOWHELP 16 -#define OFN_ENABLEHOOK 32 -#define OFN_ENABLETEMPLATE 64 -#define OFN_ENABLETEMPLATEHANDLE 128 -#define OFN_NOVALIDATE 256 -#define OFN_ALLOWMULTISELECT 512 -#define OFN_EXTENSIONDIFFERENT 1024 -#define OFN_PATHMUSTEXIST 2048 -#define OFN_FILEMUSTEXIST 4096 -#define OFN_CREATEPROMPT 8192 -#define OFN_SHAREAWARE 16384 -#define OFN_NOREADONLYRETURN 32768 -#define OFN_NOTESTFILECREATE 65536 -#define OFN_NONETWORKBUTTON 131072 -#define OFN_NOLONGNAMES 262144 // force no long names for 4.x modules -#define OFN_EXPLORER 524288 // new look commdlg -#define OFN_NODEREFERENCELINKS 1048576 -#define OFN_LONGNAMES 2097152 // force long names for 3.x modules -#define OFN_ENABLEINCLUDENOTIFY 4194304 // send include message to callback -#define OFN_ENABLESIZING 8388608 -#define OFN_DONTADDTORECENT 33554432 -#define OFN_FORCESHOWHIDDEN 268435456 // Show All files including System and hidden files +#define OFN_READONLY 1 +#define OFN_OVERWRITEPROMPT 2 +#define OFN_HIDEREADONLY 4 +#define OFN_NOCHANGEDIR 8 +#define OFN_SHOWHELP 16 +#define OFN_ENABLEHOOK 32 +#define OFN_ENABLETEMPLATE 64 +#define OFN_ENABLETEMPLATEHANDLE 128 +#define OFN_NOVALIDATE 256 +#define OFN_ALLOWMULTISELECT 512 +#define OFN_EXTENSIONDIFFERENT 1024 +#define OFN_PATHMUSTEXIST 2048 +#define OFN_FILEMUSTEXIST 4096 +#define OFN_CREATEPROMPT 8192 +#define OFN_SHAREAWARE 16384 +#define OFN_NOREADONLYRETURN 32768 +#define OFN_NOTESTFILECREATE 65536 +#define OFN_NONETWORKBUTTON 131072 +#define OFN_NOLONGNAMES 262144 // force no long names for 4.x modules +#define OFN_EXPLORER 524288 // new look commdlg +#define OFN_NODEREFERENCELINKS 1048576 +#define OFN_LONGNAMES 2097152 // force long names for 3.x modules +#define OFN_ENABLEINCLUDENOTIFY 4194304 // send include message to callback +#define OFN_ENABLESIZING 8388608 +#define OFN_DONTADDTORECENT 33554432 +#define OFN_FORCESHOWHIDDEN 268435456 // Show All files including System and hidden files //----------------------------------------------------------------------// /* Common Control Constants */ -#define CCS_TOP 1 -#define CCS_NOMOVEY 2 -#define CCS_BOTTOM 3 -#define CCS_NORESIZE 4 -#define CCS_NOPARENTALIGN 8 -#define CCS_ADJUSTABLE 32 -#define CCS_NODIVIDER 64 -#define CCS_VERT 128 -#define CCS_LEFT (CCS_VERT + CCS_TOP) -#define CCS_RIGHT (CCS_VERT + CCS_BOTTOM) -#define CCS_NOMOVEX (CCS_VERT + CCS_NOMOVEY) -//----------------------------------------------------------------------// +#define CCS_TOP 1 +#define CCS_NOMOVEY 2 +#define CCS_BOTTOM 3 +#define CCS_NORESIZE 4 +#define CCS_NOPARENTALIGN 8 +#define CCS_ADJUSTABLE 32 +#define CCS_NODIVIDER 64 +#define CCS_VERT 128 +#define CCS_LEFT (CCS_VERT + CCS_TOP) +#define CCS_RIGHT (CCS_VERT + CCS_BOTTOM) +#define CCS_NOMOVEX (CCS_VERT + CCS_NOMOVEY) -#define TOOLBARCLASSNAME "ToolbarWindow32" +#define TOOLBARCLASSNAME "ToolbarWindow32" +#define STATUSCLASSNAME "msctls_statusbar32" /* Toolbar messages */ -#define TB_SAVERESTOREA (WM_USER + 26) -#define TB_SAVERESTOREW (WM_USER + 76) -#define TB_CUSTOMIZE (WM_USER + 27) -#define TB_ADDSTRINGA (WM_USER + 28) -#define TB_ADDSTRINGW (WM_USER + 77) -#define TB_GETITEMRECT (WM_USER + 29) -#define TB_BUTTONSTRUCTSIZE (WM_USER + 30) -#define TB_SETBUTTONSIZE (WM_USER + 31) -#define TB_SETBITMAPSIZE (WM_USER + 32) -#define TB_AUTOSIZE (WM_USER + 33) -#define TB_GETTOOLTIPS (WM_USER + 35) -#define TB_SETTOOLTIPS (WM_USER + 36) -#define TB_SETPARENT (WM_USER + 37) -#define TB_SETROWS (WM_USER + 39) -#define TB_GETROWS (WM_USER + 40) -#define TB_GETBITMAPFLAGS (WM_USER + 41) -#define TB_SETCMDID (WM_USER + 42) -#define TB_CHANGEBITMAP (WM_USER + 43) -#define TB_GETBITMAP (WM_USER + 44) -#define TB_GETBUTTONTEXTA (WM_USER + 45) -#define TB_GETBUTTONTEXTW (WM_USER + 75) -#define TB_REPLACEBITMAP (WM_USER + 46) -#define TB_SETINDENT (WM_USER + 47) -#define TB_SETIMAGELIST (WM_USER + 48) -#define TB_GETIMAGELIST (WM_USER + 49) -#define TB_LOADIMAGES (WM_USER + 50) -#define TB_GETRECT (WM_USER + 51) // wParam is the Cmd instead of index -#define TB_SETHOTIMAGELIST (WM_USER + 52) -#define TB_GETHOTIMAGELIST (WM_USER + 53) -#define TB_SETDISABLEDIMAGELIST (WM_USER + 54) -#define TB_GETDISABLEDIMAGELIST (WM_USER + 55) -#define TB_SETSTYLE (WM_USER + 56) -#define TB_GETSTYLE (WM_USER + 57) -#define TB_GETBUTTONSIZE (WM_USER + 58) -#define TB_SETBUTTONWIDTH (WM_USER + 59) -#define TB_SETMAXTEXTROWS (WM_USER + 60) -#define TB_GETTEXTROWS (WM_USER + 61) +#define TB_SAVERESTOREA (WM_USER + 26) +#define TB_SAVERESTOREW (WM_USER + 76) +#define TB_CUSTOMIZE (WM_USER + 27) +#define TB_ADDSTRINGA (WM_USER + 28) +#define TB_ADDSTRINGW (WM_USER + 77) +#define TB_GETITEMRECT (WM_USER + 29) +#define TB_BUTTONSTRUCTSIZE (WM_USER + 30) +#define TB_SETBUTTONSIZE (WM_USER + 31) +#define TB_SETBITMAPSIZE (WM_USER + 32) +#define TB_AUTOSIZE (WM_USER + 33) +#define TB_GETTOOLTIPS (WM_USER + 35) +#define TB_SETTOOLTIPS (WM_USER + 36) +#define TB_SETPARENT (WM_USER + 37) +#define TB_SETROWS (WM_USER + 39) +#define TB_GETROWS (WM_USER + 40) +#define TB_GETBITMAPFLAGS (WM_USER + 41) +#define TB_SETCMDID (WM_USER + 42) +#define TB_CHANGEBITMAP (WM_USER + 43) +#define TB_GETBITMAP (WM_USER + 44) +#define TB_GETBUTTONTEXTA (WM_USER + 45) +#define TB_GETBUTTONTEXTW (WM_USER + 75) +#define TB_REPLACEBITMAP (WM_USER + 46) +#define TB_SETINDENT (WM_USER + 47) +#define TB_SETIMAGELIST (WM_USER + 48) +#define TB_GETIMAGELIST (WM_USER + 49) +#define TB_LOADIMAGES (WM_USER + 50) +#define TB_GETRECT (WM_USER + 51) // wParam is the Cmd instead of index +#define TB_SETHOTIMAGELIST (WM_USER + 52) +#define TB_GETHOTIMAGELIST (WM_USER + 53) +#define TB_SETDISABLEDIMAGELIST (WM_USER + 54) +#define TB_GETDISABLEDIMAGELIST (WM_USER + 55) +#define TB_SETSTYLE (WM_USER + 56) +#define TB_GETSTYLE (WM_USER + 57) +#define TB_GETBUTTONSIZE (WM_USER + 58) +#define TB_SETBUTTONWIDTH (WM_USER + 59) +#define TB_SETMAXTEXTROWS (WM_USER + 60) +#define TB_GETTEXTROWS (WM_USER + 61) #ifdef UNICODE -#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTW -#define TB_SAVERESTORE TB_SAVERESTOREW -#define TB_ADDSTRING TB_ADDSTRINGW +#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTW +#define TB_SAVERESTORE TB_SAVERESTOREW +#define TB_ADDSTRING TB_ADDSTRINGW #else -#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTA -#define TB_SAVERESTORE TB_SAVERESTOREA -#define TB_ADDSTRING TB_ADDSTRINGA +#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTA +#define TB_SAVERESTORE TB_SAVERESTOREA +#define TB_ADDSTRING TB_ADDSTRINGA #endif -#define TB_GETOBJECT (WM_USER + 62) // wParam == IID, lParam void **ppv -#define TB_GETHOTITEM (WM_USER + 71) -#define TB_SETHOTITEM (WM_USER + 72) // wParam == iHotItem -#define TB_SETANCHORHIGHLIGHT (WM_USER + 73) // wParam == TRUE/FALSE -#define TB_GETANCHORHIGHLIGHT (WM_USER + 74) -#define TB_MAPACCELERATORA (WM_USER + 78) // wParam == ch, lParam int * pidBtn +#define TB_GETOBJECT (WM_USER + 62) // wParam == IID, lParam void **ppv +#define TB_GETHOTITEM (WM_USER + 71) +#define TB_SETHOTITEM (WM_USER + 72) // wParam == iHotItem +#define TB_SETANCHORHIGHLIGHT (WM_USER + 73) // wParam == TRUE/FALSE +#define TB_GETANCHORHIGHLIGHT (WM_USER + 74) +#define TB_MAPACCELERATORA (WM_USER + 78) // wParam == ch, lParam int * pidBtn -#define TB_GETINSERTMARK (WM_USER + 79) // lParam == LPTBINSERTMARK -#define TB_SETINSERTMARK (WM_USER + 80) // lParam == LPTBINSERTMARK -#define TB_INSERTMARKHITTEST (WM_USER + 81) // wParam == LPPOINT lParam == LPTBINSERTMARK -#define TB_MOVEBUTTON (WM_USER + 82) -#define TB_GETMAXSIZE (WM_USER + 83) // lParam == LPSIZE -#define TB_SETEXTENDEDSTYLE (WM_USER + 84) // For TBSTYLE_EX_* -#define TB_GETEXTENDEDSTYLE (WM_USER + 85) // For TBSTYLE_EX_* -#define TB_GETPADDING (WM_USER + 86) -#define TB_SETPADDING (WM_USER + 87) -#define TB_SETINSERTMARKCOLOR (WM_USER + 88) -#define TB_GETINSERTMARKCOLOR (WM_USER + 89) +#define TB_GETINSERTMARK (WM_USER + 79) // lParam == LPTBINSERTMARK +#define TB_SETINSERTMARK (WM_USER + 80) // lParam == LPTBINSERTMARK +#define TB_INSERTMARKHITTEST (WM_USER + 81) // wParam == LPPOINT lParam == LPTBINSERTMARK +#define TB_MOVEBUTTON (WM_USER + 82) +#define TB_GETMAXSIZE (WM_USER + 83) // lParam == LPSIZE +#define TB_SETEXTENDEDSTYLE (WM_USER + 84) // For TBSTYLE_EX_* +#define TB_GETEXTENDEDSTYLE (WM_USER + 85) // For TBSTYLE_EX_* +#define TB_GETPADDING (WM_USER + 86) +#define TB_SETPADDING (WM_USER + 87) +#define TB_SETINSERTMARKCOLOR (WM_USER + 88) +#define TB_GETINSERTMARKCOLOR (WM_USER + 89) -#define TB_SETCOLORSCHEME CCM_SETCOLORSCHEME // lParam is color scheme -#define TB_GETCOLORSCHEME CCM_GETCOLORSCHEME // fills in COLORSCHEME pointed to by lParam +#define TB_SETCOLORSCHEME CCM_SETCOLORSCHEME // lParam is color scheme +#define TB_GETCOLORSCHEME CCM_GETCOLORSCHEME // fills in COLORSCHEME pointed to by lParam -#define TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define TB_MAPACCELERATORW (WM_USER + 90) // wParam == ch, lParam int * pidBtn +#define TB_MAPACCELERATORW (WM_USER + 90) // wParam == ch, lParam int * pidBtn #ifdef UNICODE -#define TB_MAPACCELERATOR TB_MAPACCELERATORW +#define TB_MAPACCELERATOR TB_MAPACCELERATORW #else -#define TB_MAPACCELERATOR TB_MAPACCELERATORA +#define TB_MAPACCELERATOR TB_MAPACCELERATORA #endif -#define TBIMHT_AFTER 1 // TRUE = insert After iButton, otherwise before -#define TBIMHT_BACKGROUND 2 // TRUE iff missed buttons completely +#define TBIMHT_AFTER 1 // TRUE = insert After iButton, otherwise before +#define TBIMHT_BACKGROUND 2 // TRUE iff missed buttons completely -#define TBBF_LARGE 1 +#define TBBF_LARGE 1 -#define TBIF_IMAGE 1 -#define TBIF_TEXT 2 -#define TBIF_STATE 4 -#define TBIF_STYLE 8 -#define TBIF_LPARAM 16 -#define TBIF_COMMAND 32 -#define TBIF_SIZE 64 +#define TBIF_IMAGE 1 +#define TBIF_TEXT 2 +#define TBIF_STATE 4 +#define TBIF_STYLE 8 +#define TBIF_LPARAM 16 +#define TBIF_COMMAND 32 +#define TBIF_SIZE 64 -#define TBIF_BYINDEX 2147483648 // this specifies that the wparam in Get/SetButtonInfo is an index, not id +#define TBIF_BYINDEX 2147483648 // this specifies that the wparam in Get/SetButtonInfo is an index, not id #ifdef UNICODE -#define TBBUTTONINFO TBBUTTONINFOW -#define LPTBBUTTONINFO LPTBBUTTONINFOW +#define TBBUTTONINFO TBBUTTONINFOW +#define LPTBBUTTONINFO LPTBBUTTONINFOW #else -#define TBBUTTONINFO TBBUTTONINFOA -#define LPTBBUTTONINFO LPTBBUTTONINFOA +#define TBBUTTONINFO TBBUTTONINFOA +#define LPTBBUTTONINFO LPTBBUTTONINFOA #endif -#define TB_GETBUTTONINFOW (WM_USER + 63) -#define TB_SETBUTTONINFOW (WM_USER + 64) -#define TB_GETBUTTONINFOA (WM_USER + 65) -#define TB_SETBUTTONINFOA (WM_USER + 66) +#define TB_GETBUTTONINFOW (WM_USER + 63) +#define TB_SETBUTTONINFOW (WM_USER + 64) +#define TB_GETBUTTONINFOA (WM_USER + 65) +#define TB_SETBUTTONINFOA (WM_USER + 66) #ifdef UNICODE -#define TB_GETBUTTONINFO TB_GETBUTTONINFOW -#define TB_SETBUTTONINFO TB_SETBUTTONINFOW +#define TB_GETBUTTONINFO TB_GETBUTTONINFOW +#define TB_SETBUTTONINFO TB_SETBUTTONINFOW #else -#define TB_GETBUTTONINFO TB_GETBUTTONINFOA -#define TB_SETBUTTONINFO TB_SETBUTTONINFOA +#define TB_GETBUTTONINFO TB_GETBUTTONINFOA +#define TB_SETBUTTONINFO TB_SETBUTTONINFOA #endif -#define TB_INSERTBUTTONW (WM_USER + 67) -#define TB_ADDBUTTONSW (WM_USER + 68) -#define TB_HITTEST (WM_USER + 69) +#define TB_INSERTBUTTONW (WM_USER + 67) +#define TB_ADDBUTTONSW (WM_USER + 68) +#define TB_HITTEST (WM_USER + 69) #ifdef UNICODE -#define TB_INSERTBUTTON TB_INSERTBUTTONW -#define TB_ADDBUTTONS TB_ADDBUTTONSW +#define TB_INSERTBUTTON TB_INSERTBUTTONW +#define TB_ADDBUTTONS TB_ADDBUTTONSW #else -#define TB_INSERTBUTTON TB_INSERTBUTTONA -#define TB_ADDBUTTONS TB_ADDBUTTONSA +#define TB_INSERTBUTTON TB_INSERTBUTTONA +#define TB_ADDBUTTONS TB_ADDBUTTONSA #endif -#define TB_SETDRAWTEXTFLAGS (WM_USER + 70) // wParam == mask lParam == bit values +#define TB_SETDRAWTEXTFLAGS (WM_USER + 70) +#define TB_GETSTRING (WM_USER + 92) -#define TB_GETSTRING (WM_USER + 92) - -#define TBN_GETBUTTONINFOA (TBN_FIRST-0) -#define TBN_BEGINDRAG (TBN_FIRST-1) -#define TBN_ENDDRAG (TBN_FIRST-2) -#define TBN_BEGINADJUST (TBN_FIRST-3) -#define TBN_ENDADJUST (TBN_FIRST-4) -#define TBN_RESET (TBN_FIRST-5) -#define TBN_QUERYINSERT (TBN_FIRST-6) -#define TBN_QUERYDELETE (TBN_FIRST-7) -#define TBN_TOOLBARCHANGE (TBN_FIRST-8) -#define TBN_CUSTHELP (TBN_FIRST-9) -#define TBN_DROPDOWN (TBN_FIRST-10) -#define TBN_GETOBJECT (TBN_FIRST-12) +#define TBN_GETBUTTONINFOA (TBN_FIRST-0) +#define TBN_BEGINDRAG (TBN_FIRST-1) +#define TBN_ENDDRAG (TBN_FIRST-2) +#define TBN_BEGINADJUST (TBN_FIRST-3) +#define TBN_ENDADJUST (TBN_FIRST-4) +#define TBN_RESET (TBN_FIRST-5) +#define TBN_QUERYINSERT (TBN_FIRST-6) +#define TBN_QUERYDELETE (TBN_FIRST-7) +#define TBN_TOOLBARCHANGE (TBN_FIRST-8) +#define TBN_CUSTHELP (TBN_FIRST-9) +#define TBN_DROPDOWN (TBN_FIRST-10) +#define TBN_GETOBJECT (TBN_FIRST-12) /* Toolbar Control Constants */ -#define TBSTATE_CHECKED 1 -#define TBSTATE_PRESSED 2 -#define TBSTATE_ENABLED 4 -#define TBSTATE_HIDDEN 8 -#define TBSTATE_INDETERMINATE 16 -#define TBSTATE_WRAP 32 -#define TBSTATE_ELLIPSES 64 -#define TBSTATE_MARKED 128 +#define TBSTATE_CHECKED 1 +#define TBSTATE_PRESSED 2 +#define TBSTATE_ENABLED 4 +#define TBSTATE_HIDDEN 8 +#define TBSTATE_INDETERMINATE 16 +#define TBSTATE_WRAP 32 +#define TBSTATE_ELLIPSES 64 +#define TBSTATE_MARKED 128 -#define TBSTYLE_BUTTON 0 // obsolete; use BTNS_BUTTON instead -#define TBSTYLE_SEP 1 // obsolete; use BTNS_SEP instead -#define TBSTYLE_CHECK 2 // obsolete; use BTNS_CHECK instead -#define TBSTYLE_GROUP 4 // obsolete; use BTNS_GROUP instead -#define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP + TBSTYLE_CHECK) // obsolete; use BTNS_CHECKGROUP instead -#define TBSTYLE_DROPDOWN 8 // obsolete; use BTNS_DROPDOWN instead -#define TBSTYLE_AUTOSIZE 16 // obsolete; use BTNS_AUTOSIZE instead -#define TBSTYLE_NOPREFIX 32 // obsolete; use BTNS_NOPREFIX instead +#define TBSTYLE_BUTTON 0 +#define TBSTYLE_SEP 1 +#define TBSTYLE_CHECK 2 +#define TBSTYLE_GROUP 4 +#define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP + TBSTYLE_CHECK) +#define TBSTYLE_DROPDOWN 8 +#define TBSTYLE_AUTOSIZE 16 +#define TBSTYLE_NOPREFIX 32 -#define TBSTYLE_TOOLTIPS 256 -#define TBSTYLE_WRAPABLE 512 -#define TBSTYLE_ALTDRAG 1024 -#define TBSTYLE_FLAT 2048 -#define TBSTYLE_LIST 4096 -#define TBSTYLE_CUSTOMERASE 8192 -#define TBSTYLE_REGISTERDROP 16384 -#define TBSTYLE_TRANSPARENT 32768 +#define TBSTYLE_TOOLTIPS 256 +#define TBSTYLE_WRAPABLE 512 +#define TBSTYLE_ALTDRAG 1024 +#define TBSTYLE_FLAT 2048 +#define TBSTYLE_LIST 4096 +#define TBSTYLE_CUSTOMERASE 8192 +#define TBSTYLE_REGISTERDROP 16384 +#define TBSTYLE_TRANSPARENT 32768 +#define BTNS_BUTTON TBSTYLE_BUTTON +#define BTNS_SEP TBSTYLE_SEP +#define BTNS_CHECK TBSTYLE_CHECK +#define BTNS_GROUP TBSTYLE_GROUP +#define BTNS_CHECKGROUP TBSTYLE_CHECKGROUP +#define BTNS_DROPDOWN TBSTYLE_DROPDOWN +#define BTNS_AUTOSIZE TBSTYLE_AUTOSIZE +#define BTNS_NOPREFIX TBSTYLE_NOPREFIX +#define BTNS_SHOWTEXT 64 // ignored unless TBSTYLE_EX_MIXEDBUTTONS is set +#define BTNS_WHOLEDROPDOWN 128 // draw drop-down arrow, but without split arrow section -#define BTNS_BUTTON TBSTYLE_BUTTON // 0x0000 -#define BTNS_SEP TBSTYLE_SEP // 0x0001 -#define BTNS_CHECK TBSTYLE_CHECK // 0x0002 -#define BTNS_GROUP TBSTYLE_GROUP // 0x0004 -#define BTNS_CHECKGROUP TBSTYLE_CHECKGROUP // (TBSTYLE_GROUP | TBSTYLE_CHECK) -#define BTNS_DROPDOWN TBSTYLE_DROPDOWN // 0x0008 -#define BTNS_AUTOSIZE TBSTYLE_AUTOSIZE // 0x0010; automatically calculate the cx of the button -#define BTNS_NOPREFIX TBSTYLE_NOPREFIX // 0x0020; this button should not have accel prefix -#define BTNS_SHOWTEXT 64 // ignored unless TBSTYLE_EX_MIXEDBUTTONS is set -#define BTNS_WHOLEDROPDOWN 128 // draw drop-down arrow, but without split arrow section +#define TBSTYLE_EX_DRAWDDARROWS 1 +#define TBSTYLE_EX_MIXEDBUTTONS 8 +#define TBSTYLE_EX_HIDECLIPPEDBUTTONS 16 // don't show partially obscured buttons +#define TBSTYLE_EX_DOUBLEBUFFER 0x00000080 -#define TBSTYLE_EX_DRAWDDARROWS 1 -#define TBSTYLE_EX_MIXEDBUTTONS 8 -#define TBSTYLE_EX_HIDECLIPPEDBUTTONS 16 // don't show partially obscured buttons -#define TBSTYLE_EX_DOUBLEBUFFER 0x00000080 +#define NM_FIRST (0- 0) // generic to all controls +#define NM_LAST (0- 99) -//----------------------------------------------------------------------// -// WM_NOTIFY codes (NMHDR.code values) +#define NM_OUTOFMEMORY (NM_FIRST-1) +#define NM_CLICK (NM_FIRST-2) // uses NMCLICK struct +#define NM_DBLCLK (NM_FIRST-3) +#define NM_RETURN (NM_FIRST-4) +#define NM_RCLICK (NM_FIRST-5) // uses NMCLICK struct +#define NM_RDBLCLK (NM_FIRST-6) +#define NM_SETFOCUS (NM_FIRST-7) +#define NM_KILLFOCUS (NM_FIRST-8) +#define NM_CUSTOMDRAW (NM_FIRST-12) +#define NM_HOVER (NM_FIRST-13) +#define NM_NCHITTEST (NM_FIRST-14) // uses NMMOUSE struct +#define NM_KEYDOWN (NM_FIRST-15) // uses NMKEY struct +#define NM_RELEASEDCAPTURE (NM_FIRST-16) +#define NM_SETCURSOR (NM_FIRST-17) // uses NMMOUSE struct +#define NM_CHAR (NM_FIRST-18) // uses NMCHAR struct +#define NM_TOOLTIPSCREATED (NM_FIRST-19) // notify of when the tooltips window is create +#define NM_LDOWN (NM_FIRST-20) +#define NM_RDOWN (NM_FIRST-21) -#define NM_FIRST (0- 0) // generic to all controls -#define NM_LAST (0- 99) - -#define NM_OUTOFMEMORY (NM_FIRST-1) -#define NM_CLICK (NM_FIRST-2) // uses NMCLICK struct -#define NM_DBLCLK (NM_FIRST-3) -#define NM_RETURN (NM_FIRST-4) -#define NM_RCLICK (NM_FIRST-5) // uses NMCLICK struct -#define NM_RDBLCLK (NM_FIRST-6) -#define NM_SETFOCUS (NM_FIRST-7) -#define NM_KILLFOCUS (NM_FIRST-8) -#define NM_CUSTOMDRAW (NM_FIRST-12) -#define NM_HOVER (NM_FIRST-13) -#define NM_NCHITTEST (NM_FIRST-14) // uses NMMOUSE struct -#define NM_KEYDOWN (NM_FIRST-15) // uses NMKEY struct -#define NM_RELEASEDCAPTURE (NM_FIRST-16) -#define NM_SETCURSOR (NM_FIRST-17) // uses NMMOUSE struct -#define NM_CHAR (NM_FIRST-18) // uses NMCHAR struct -#define NM_TOOLTIPSCREATED (NM_FIRST-19) // notify of when the tooltips window is create -#define NM_LDOWN (NM_FIRST-20) -#define NM_RDOWN (NM_FIRST-21) +#define SBARS_SIZEGRIP 256 +#define SBARS_TOOLTIPS 2048 //----------------------------------------------------------------------// #endif